Skip to content

Commit 8dcd68d

Browse files
authored
Merge branch 'main' into browser-include-credentials
2 parents b931e7b + b702e55 commit 8dcd68d

File tree

6 files changed

+23
-18
lines changed

6 files changed

+23
-18
lines changed

packages/browser-sdk/src/client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,12 +483,14 @@ export class BucketClient {
483483
* Add a hook to the client.
484484
*
485485
* @param hook Hook to add.
486+
* @returns A function to remove the hook.
486487
*/
487488
on<THookType extends keyof HookArgs>(
488489
type: THookType,
489490
handler: (args0: HookArgs[THookType]) => void,
490491
) {
491492
this.hooks.addHook(type, handler);
493+
return () => this.hooks.removeHook(type, handler);
492494
}
493495

494496
/**

packages/browser-sdk/src/hooksManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export interface HookArgs {
1313
track: TrackEvent;
1414
}
1515

16-
type TrackEvent = {
16+
export type TrackEvent = {
1717
user: UserContext;
1818
company?: CompanyContext;
1919
eventName: string;

packages/browser-sdk/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ export type {
2828
OnScoreSubmitResult,
2929
OpenFeedbackFormOptions,
3030
} from "./feedback/ui/types";
31+
export type { TrackEvent } from "./hooksManager";
3132
export type { Logger } from "./logger";
3233
export { feedbackContainerId, propagatedEvents } from "./ui/constants";

packages/react-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
}
3535
},
3636
"dependencies": {
37-
"@bucketco/browser-sdk": "3.0.0-alpha.6",
37+
"@bucketco/browser-sdk": "3.0.0",
3838
"canonical-json": "^0.0.4",
3939
"rollup": "^4.2.0"
4040
},

packages/react-sdk/src/index.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,26 @@ import canonicalJSON from "canonical-json";
1313
import {
1414
BucketClient,
1515
BucketContext,
16+
CheckEvent,
17+
CompanyContext,
1618
InitOptions,
1719
RawFeatures,
1820
RequestFeedbackData,
21+
TrackEvent,
1922
UnassignedFeedback,
23+
UserContext,
2024
} from "@bucketco/browser-sdk";
2125

2226
import { version } from "../package.json";
2327

28+
export type {
29+
CheckEvent,
30+
CompanyContext,
31+
RawFeatures,
32+
TrackEvent,
33+
UserContext,
34+
};
35+
2436
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
2537
export interface Features {}
2638

@@ -349,9 +361,11 @@ export function useUpdateOtherContext() {
349361
*
350362
* ```ts
351363
* const client = useClient();
352-
* client.on("configCheck", () => {
353-
* console.log("configCheck hook called");
354-
* });
364+
* useEffect(() => {
365+
* return client?.on("enabledCheck", () => {
366+
* console.log("enabledCheck hook called");
367+
* });
368+
* }, [client]);
355369
* ```
356370
*/
357371
export function useClient() {

yarn.lock

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -448,18 +448,6 @@ __metadata:
448448
languageName: unknown
449449
linkType: soft
450450

451-
"@bucketco/browser-sdk@npm:3.0.0-alpha.6":
452-
version: 3.0.0-alpha.6
453-
resolution: "@bucketco/browser-sdk@npm:3.0.0-alpha.6"
454-
dependencies:
455-
"@floating-ui/dom": "npm:^1.6.8"
456-
canonical-json: "npm:^0.0.4"
457-
js-cookie: "npm:^3.0.5"
458-
preact: "npm:^10.22.1"
459-
checksum: 10c0/3fe141d1674401d7bbfebec76a59cabbc0e76ed3006198aa91704d237cc0ee5c0731aae9bef5d1c101eef47a49460b06ecb30879f7a5d3cd29d2f35bddb26306
460-
languageName: node
461-
linkType: hard
462-
463451
"@bucketco/eslint-config@npm:0.0.2, @bucketco/eslint-config@npm:~0.0.2, @bucketco/eslint-config@workspace:^, @bucketco/eslint-config@workspace:packages/eslint-config":
464452
version: 0.0.0-use.local
465453
resolution: "@bucketco/eslint-config@workspace:packages/eslint-config"
@@ -567,7 +555,7 @@ __metadata:
567555
version: 0.0.0-use.local
568556
resolution: "@bucketco/react-sdk@workspace:packages/react-sdk"
569557
dependencies:
570-
"@bucketco/browser-sdk": "npm:3.0.0-alpha.6"
558+
"@bucketco/browser-sdk": "npm:3.0.0"
571559
"@bucketco/eslint-config": "workspace:^"
572560
"@bucketco/tsconfig": "workspace:^"
573561
"@testing-library/react": "npm:^15.0.7"

0 commit comments

Comments
 (0)