@statsig/next 3.24.4 → 3.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statsig/next",
3
- "version": "3.24.4",
3
+ "version": "3.25.0",
4
4
  "license": "ISC",
5
5
  "homepage": "https://github.com/statsig-io/js-client-monorepo",
6
6
  "repository": {
@@ -9,8 +9,8 @@
9
9
  "directory": "packages/next"
10
10
  },
11
11
  "dependencies": {
12
- "@statsig/client-core": "3.24.4",
13
- "@statsig/react-bindings": "3.24.4",
12
+ "@statsig/client-core": "3.25.0",
13
+ "@statsig/react-bindings": "3.25.0",
14
14
  "statsig-node": "^6.4.5"
15
15
  },
16
16
  "peerDependencies": {
@@ -1,10 +1,12 @@
1
1
  import { JSX, ReactNode } from 'react';
2
+ import { StatsigOptions as StatsigNodeOptions } from 'statsig-node';
2
3
  import { StatsigOptions, StatsigUser } from '@statsig/react-bindings';
3
- export default function StatsigBootstrapProvider({ children, user, clientKey, serverKey, useCookie, clientOptions, }: {
4
+ export default function StatsigBootstrapProvider({ children, user, clientKey, serverKey, useCookie, clientOptions, serverOptions, }: {
4
5
  user: StatsigUser;
5
6
  children: ReactNode;
6
7
  clientKey: string;
7
8
  serverKey: string;
8
9
  useCookie?: boolean;
9
10
  clientOptions?: StatsigOptions | null;
11
+ serverOptions?: StatsigNodeOptions | null;
10
12
  }): Promise<JSX.Element>;
@@ -16,15 +16,16 @@ const client_core_1 = require("@statsig/client-core");
16
16
  const BootstrapClientSubProvider_1 = require("./BootstrapClientSubProvider");
17
17
  const statsigInitialization = {};
18
18
  function StatsigBootstrapProvider(_a) {
19
- return __awaiter(this, arguments, void 0, function* ({ children, user, clientKey, serverKey, useCookie = true, clientOptions, }) {
20
- var _b, _c;
19
+ return __awaiter(this, arguments, void 0, function* ({ children, user, clientKey, serverKey, useCookie = true, clientOptions, serverOptions, }) {
20
+ var _b;
21
21
  if (!statsigInitialization[serverKey]) {
22
- statsigInitialization[serverKey] = statsig_node_1.default.initialize(serverKey);
22
+ statsigInitialization[serverKey] = statsig_node_1.default.initialize(serverKey, serverOptions !== null && serverOptions !== void 0 ? serverOptions : undefined);
23
23
  }
24
24
  yield statsigInitialization[serverKey];
25
25
  if (!((_b = user.customIDs) === null || _b === void 0 ? void 0 : _b.stableID) && useCookie) {
26
- if ((0, headers_1.cookies)().get((0, client_core_1.getCookieName)(clientKey))) {
27
- user.customIDs = Object.assign(Object.assign({}, (user.customIDs || {})), { stableID: (_c = (0, headers_1.cookies)().get((0, client_core_1.getCookieName)(clientKey))) === null || _c === void 0 ? void 0 : _c.value });
26
+ const cookieValue = yield (0, headers_1.cookies)().get((0, client_core_1.getCookieName)(clientKey));
27
+ if (cookieValue) {
28
+ user.customIDs = Object.assign(Object.assign({}, (user.customIDs || {})), { stableID: cookieValue.value });
28
29
  }
29
30
  else {
30
31
  const stableID = (0, client_core_1.getUUID)();