Skip to content

Commit

Permalink
Adding updateUser CB (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-statsig authored Apr 4, 2023
1 parent cab4cc7 commit e462eb3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"typescript": "^4.3.2"
},
"dependencies": {
"statsig-js": "^4.32.0"
"statsig-js": "^4.33.1"
},
"peerDependencies": {
"react": "^16.6.3 || ^17.0.0 || ^18.0.0"
Expand Down
2 changes: 2 additions & 0 deletions src/StatsigOptions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
InitCompletionCallback,
UpdateUserCompletionCallback,
StatsigEnvironment,
StatsigUser,
} from 'statsig-js';
Expand All @@ -21,6 +22,7 @@ export type StatsigOptions = {
eventLoggingApi?: string;
prefetchUsers?: StatsigUser[];
initCompletionCallback?: InitCompletionCallback | null;
updateUserCompletionCallback?: UpdateUserCompletionCallback | null;
disableDiagnosticsLogging?: boolean;
disableLocalStorage?: boolean;
disableLocalOverrides?: boolean;
Expand Down
6 changes: 5 additions & 1 deletion src/__tests__/StatsigProvider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function UserTestComponent(props: {
disableDiagnosticsLogging: true,
initCompletionCallback: () => {
initCallbacks++;
}
},
}}
>
<div data-testid={TID_USER_VALUE}>{user.userID}</div>
Expand Down Expand Up @@ -102,6 +102,10 @@ describe('StatsigProvider', () => {
global.fetch = jest.fn((url, params) => {
const body = String(params?.body ?? '{}');
requestsMade.push({ url, body: JSON.parse(body) });
return Promise.resolve({
ok: true,
text: () => Promise.resolve('{}'),
});
});

beforeEach(() => {
Expand Down

0 comments on commit e462eb3

Please sign in to comment.