@scaleway/use-growthbook 1.0.6 → 2.0.1
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/CHANGELOG.md +16 -0
- package/dist/AbTestProvider.js +22 -26
- package/dist/index.d.ts +2 -6
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @scaleway/use-growthbook
|
|
2
2
|
|
|
3
|
+
## 2.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1865](https://github.com/scaleway/scaleway-lib/pull/1865) [`778989b`](https://github.com/scaleway/scaleway-lib/commit/778989bf70f52461463ac3a4ff260d3da73b86e8) Thanks [@renovate](https://github.com/apps/renovate)! - Updated dependency `@growthbook/growthbook-react` to `0.25.0`.
|
|
8
|
+
|
|
9
|
+
## 2.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- [#1837](https://github.com/scaleway/scaleway-lib/pull/1837) [`5404963`](https://github.com/scaleway/scaleway-lib/commit/5404963ddd01fafe6ed9753d8324fb19849065ca) Thanks [@philibea](https://github.com/philibea)! - upgrade node version from 14 to 20
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#1789](https://github.com/scaleway/scaleway-lib/pull/1789) [`cf00fbd`](https://github.com/scaleway/scaleway-lib/commit/cf00fbd55a29a56dc3aba89d426d67eb51e6cd22) Thanks [@renovate](https://github.com/apps/renovate)! - Updated dependency `@growthbook/growthbook-react` to `0.24.0`.
|
|
18
|
+
|
|
3
19
|
## 1.0.6
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/AbTestProvider.js
CHANGED
|
@@ -7,35 +7,31 @@ const defaultLoadConfig = {
|
|
|
7
7
|
timeout: 500,
|
|
8
8
|
skipCache: false
|
|
9
9
|
};
|
|
10
|
-
const getGrowthBookInstance =
|
|
11
|
-
|
|
12
|
-
config: {
|
|
13
|
-
apiHost,
|
|
14
|
-
clientKey,
|
|
15
|
-
enableDevMode,
|
|
16
|
-
backgroundSync,
|
|
17
|
-
subscribeToChanges
|
|
18
|
-
},
|
|
19
|
-
trackingCallback
|
|
20
|
-
} = _ref;
|
|
21
|
-
return new GrowthBook({
|
|
10
|
+
const getGrowthBookInstance = ({
|
|
11
|
+
config: {
|
|
22
12
|
apiHost,
|
|
23
13
|
clientKey,
|
|
24
14
|
enableDevMode,
|
|
25
|
-
trackingCallback,
|
|
26
15
|
backgroundSync,
|
|
27
16
|
subscribeToChanges
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
17
|
+
},
|
|
18
|
+
trackingCallback
|
|
19
|
+
}) => new GrowthBook({
|
|
20
|
+
apiHost,
|
|
21
|
+
clientKey,
|
|
22
|
+
enableDevMode,
|
|
23
|
+
trackingCallback,
|
|
24
|
+
backgroundSync,
|
|
25
|
+
subscribeToChanges
|
|
26
|
+
});
|
|
27
|
+
const AbTestProvider = ({
|
|
28
|
+
children,
|
|
29
|
+
config,
|
|
30
|
+
trackingCallback,
|
|
31
|
+
errorCallback,
|
|
32
|
+
attributes,
|
|
33
|
+
loadConfig
|
|
34
|
+
}) => {
|
|
39
35
|
const growthbook = useMemo(() => getGrowthBookInstance({
|
|
40
36
|
config,
|
|
41
37
|
trackingCallback
|
|
@@ -54,9 +50,9 @@ const AbTestProvider = _ref2 => {
|
|
|
54
50
|
growthbook.setAttributes({
|
|
55
51
|
...currentAttributes,
|
|
56
52
|
...attributes
|
|
57
|
-
});
|
|
53
|
+
}).catch(errorCallback);
|
|
58
54
|
}
|
|
59
|
-
}, [attributes, growthbook]);
|
|
55
|
+
}, [attributes, growthbook, errorCallback]);
|
|
60
56
|
return jsx(GrowthBookProvider, {
|
|
61
57
|
growthbook: growthbook,
|
|
62
58
|
children: children
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context } from '@growthbook/growthbook-react';
|
|
1
|
+
import { Context, GrowthBook } from '@growthbook/growthbook-react';
|
|
2
2
|
export { FeatureString, FeaturesReady, IfFeatureEnabled, useExperiment, useFeature, useFeatureIsOn, useFeatureValue, useGrowthBook, useGrowthBookSSR, withRunExperiment } from '@growthbook/growthbook-react';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
@@ -9,11 +9,7 @@ type Attributes = Record<string, string | number | undefined>;
|
|
|
9
9
|
* @param {number} [timeout] - 500.
|
|
10
10
|
* @param {boolean} [skipCache] - false.
|
|
11
11
|
*/
|
|
12
|
-
type LoadConfig =
|
|
13
|
-
autoRefresh: boolean;
|
|
14
|
-
timeout: number;
|
|
15
|
-
skipCache: boolean;
|
|
16
|
-
};
|
|
12
|
+
type LoadConfig = NonNullable<Parameters<GrowthBook['loadFeatures']>[0]>;
|
|
17
13
|
type ToolConfig = Pick<Context, 'apiHost' | 'clientKey' | 'enableDevMode' | 'backgroundSync' | 'subscribeToChanges'>;
|
|
18
14
|
type TrackingCallback = NonNullable<Context['trackingCallback']>;
|
|
19
15
|
type ErrorCallback = (error: Error | string) => void | null;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleway/use-growthbook",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Utility package to expose AB test tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
|
-
"node": ">=
|
|
7
|
+
"node": ">=20.x"
|
|
8
8
|
},
|
|
9
9
|
"exports": {
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"feature flags"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@growthbook/growthbook-react": "0.
|
|
28
|
+
"@growthbook/growthbook-react": "0.25.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"react": "18.2.0"
|