@scaleway/use-growthbook 2.0.4 → 2.1.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
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @scaleway/use-growthbook
|
|
2
2
|
|
|
3
|
+
## 2.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2045](https://github.com/scaleway/scaleway-lib/pull/2045) [`0d79190`](https://github.com/scaleway/scaleway-lib/commit/0d79190d997cb0fc966a4be53e67877900bc95b3) Thanks [@renovate](https://github.com/apps/renovate)! - Updated dependency `@growthbook/growthbook-react` to `1.0.1`.
|
|
8
|
+
|
|
9
|
+
## 2.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#1960](https://github.com/scaleway/scaleway-lib/pull/1960) [`d034b3c`](https://github.com/scaleway/scaleway-lib/commit/d034b3cda1cac30ce2ed4e95be5a2c79642f8ca4) Thanks [@Slashgear](https://github.com/Slashgear)! - add legacy main attribut for CommonJS export usage
|
|
14
|
+
|
|
3
15
|
## 2.0.4
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<?xml version="1.0" ?>
|
|
2
|
+
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
|
|
3
|
+
<coverage lines-valid="30" lines-covered="30" line-rate="1" branches-valid="6" branches-covered="5" branch-rate="0.8332999999999999" timestamp="1717079733957" complexity="0" version="0.1">
|
|
4
|
+
<sources>
|
|
5
|
+
<source>/Volumes/Dev/scaleway/team-console/scaleway-lib/packages/use-growthbook</source>
|
|
6
|
+
</sources>
|
|
7
|
+
<packages>
|
|
8
|
+
<package name="__mocks__.@growthbook" line-rate="1" branch-rate="1">
|
|
9
|
+
<classes>
|
|
10
|
+
<class name="growthbook-react.tsx" filename="__mocks__/@growthbook/growthbook-react.tsx" line-rate="1" branch-rate="1">
|
|
11
|
+
<methods>
|
|
12
|
+
<method name="(anonymous_0)" hits="3" signature="()V">
|
|
13
|
+
<lines>
|
|
14
|
+
<line number="7" hits="3"/>
|
|
15
|
+
</lines>
|
|
16
|
+
</method>
|
|
17
|
+
<method name="(anonymous_1)" hits="2" signature="()V">
|
|
18
|
+
<lines>
|
|
19
|
+
<line number="10" hits="2"/>
|
|
20
|
+
</lines>
|
|
21
|
+
</method>
|
|
22
|
+
<method name="(anonymous_2)" hits="2" signature="()V">
|
|
23
|
+
<lines>
|
|
24
|
+
<line number="15" hits="2"/>
|
|
25
|
+
</lines>
|
|
26
|
+
</method>
|
|
27
|
+
</methods>
|
|
28
|
+
<lines>
|
|
29
|
+
<line number="5" hits="2" branch="false"/>
|
|
30
|
+
<line number="6" hits="2" branch="false"/>
|
|
31
|
+
<line number="7" hits="3" branch="false"/>
|
|
32
|
+
<line number="10" hits="2" branch="false"/>
|
|
33
|
+
<line number="15" hits="2" branch="false"/>
|
|
34
|
+
<line number="16" hits="2" branch="false"/>
|
|
35
|
+
<line number="18" hits="2" branch="false"/>
|
|
36
|
+
<line number="20" hits="2" branch="false"/>
|
|
37
|
+
</lines>
|
|
38
|
+
</class>
|
|
39
|
+
</classes>
|
|
40
|
+
</package>
|
|
41
|
+
<package name="src" line-rate="1" branch-rate="0.8332999999999999">
|
|
42
|
+
<classes>
|
|
43
|
+
<class name="AbTestProvider.tsx" filename="src/AbTestProvider.tsx" line-rate="1" branch-rate="0.8332999999999999">
|
|
44
|
+
<methods>
|
|
45
|
+
<method name="(anonymous_0)" hits="2" signature="()V">
|
|
46
|
+
<lines>
|
|
47
|
+
<line number="26" hits="2"/>
|
|
48
|
+
</lines>
|
|
49
|
+
</method>
|
|
50
|
+
<method name="(anonymous_1)" hits="2" signature="()V">
|
|
51
|
+
<lines>
|
|
52
|
+
<line number="48" hits="2"/>
|
|
53
|
+
</lines>
|
|
54
|
+
</method>
|
|
55
|
+
<method name="(anonymous_2)" hits="2" signature="()V">
|
|
56
|
+
<lines>
|
|
57
|
+
<line number="57" hits="2"/>
|
|
58
|
+
</lines>
|
|
59
|
+
</method>
|
|
60
|
+
<method name="(anonymous_3)" hits="2" signature="()V">
|
|
61
|
+
<lines>
|
|
62
|
+
<line number="61" hits="2"/>
|
|
63
|
+
</lines>
|
|
64
|
+
</method>
|
|
65
|
+
<method name="(anonymous_4)" hits="2" signature="()V">
|
|
66
|
+
<lines>
|
|
67
|
+
<line number="67" hits="2"/>
|
|
68
|
+
</lines>
|
|
69
|
+
</method>
|
|
70
|
+
<method name="(anonymous_5)" hits="2" signature="()V">
|
|
71
|
+
<lines>
|
|
72
|
+
<line number="72" hits="2"/>
|
|
73
|
+
</lines>
|
|
74
|
+
</method>
|
|
75
|
+
</methods>
|
|
76
|
+
<lines>
|
|
77
|
+
<line number="20" hits="1" branch="false"/>
|
|
78
|
+
<line number="26" hits="1" branch="false"/>
|
|
79
|
+
<line number="39" hits="2" branch="false"/>
|
|
80
|
+
<line number="48" hits="1" branch="false"/>
|
|
81
|
+
<line number="56" hits="2" branch="false"/>
|
|
82
|
+
<line number="57" hits="2" branch="false"/>
|
|
83
|
+
<line number="61" hits="2" branch="false"/>
|
|
84
|
+
<line number="62" hits="2" branch="true" condition-coverage="100% (2/2)"/>
|
|
85
|
+
<line number="63" hits="1" branch="true" condition-coverage="100% (2/2)"/>
|
|
86
|
+
<line number="67" hits="2" branch="false"/>
|
|
87
|
+
<line number="68" hits="2" branch="false"/>
|
|
88
|
+
<line number="72" hits="2" branch="false"/>
|
|
89
|
+
<line number="73" hits="2" branch="false"/>
|
|
90
|
+
<line number="74" hits="2" branch="true" condition-coverage="50% (1/2)"/>
|
|
91
|
+
<line number="75" hits="2" branch="false"/>
|
|
92
|
+
<line number="84" hits="2" branch="false"/>
|
|
93
|
+
</lines>
|
|
94
|
+
</class>
|
|
95
|
+
<class name="useAbTestAttributes.ts" filename="src/useAbTestAttributes.ts" line-rate="1" branch-rate="1">
|
|
96
|
+
<methods>
|
|
97
|
+
<method name="(anonymous_0)" hits="2" signature="()V">
|
|
98
|
+
<lines>
|
|
99
|
+
<line number="4" hits="2"/>
|
|
100
|
+
</lines>
|
|
101
|
+
</method>
|
|
102
|
+
<method name="(anonymous_1)" hits="1" signature="()V">
|
|
103
|
+
<lines>
|
|
104
|
+
<line number="12" hits="1"/>
|
|
105
|
+
</lines>
|
|
106
|
+
</method>
|
|
107
|
+
</methods>
|
|
108
|
+
<lines>
|
|
109
|
+
<line number="4" hits="1" branch="false"/>
|
|
110
|
+
<line number="8" hits="2" branch="false"/>
|
|
111
|
+
<line number="10" hits="2" branch="false"/>
|
|
112
|
+
<line number="12" hits="2" branch="false"/>
|
|
113
|
+
<line number="13" hits="1" branch="false"/>
|
|
114
|
+
<line number="18" hits="2" branch="false"/>
|
|
115
|
+
</lines>
|
|
116
|
+
</class>
|
|
117
|
+
</classes>
|
|
118
|
+
</package>
|
|
119
|
+
</packages>
|
|
120
|
+
</coverage>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{"total": {"lines":{"total":30,"covered":30,"skipped":0,"pct":100},"statements":{"total":31,"covered":31,"skipped":0,"pct":100},"functions":{"total":11,"covered":11,"skipped":0,"pct":100},"branches":{"total":6,"covered":5,"skipped":0,"pct":83.33},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":100}}
|
|
2
|
+
,"/Volumes/Dev/scaleway/team-console/scaleway-lib/packages/use-growthbook/__mocks__/@growthbook/growthbook-react.tsx": {"lines":{"total":8,"covered":8,"skipped":0,"pct":100},"functions":{"total":3,"covered":3,"skipped":0,"pct":100},"statements":{"total":9,"covered":9,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
|
|
3
|
+
,"/Volumes/Dev/scaleway/team-console/scaleway-lib/packages/use-growthbook/src/AbTestProvider.tsx": {"lines":{"total":16,"covered":16,"skipped":0,"pct":100},"functions":{"total":6,"covered":6,"skipped":0,"pct":100},"statements":{"total":16,"covered":16,"skipped":0,"pct":100},"branches":{"total":6,"covered":5,"skipped":0,"pct":83.33}}
|
|
4
|
+
,"/Volumes/Dev/scaleway/team-console/scaleway-lib/packages/use-growthbook/src/useAbTestAttributes.ts": {"lines":{"total":6,"covered":6,"skipped":0,"pct":100},"functions":{"total":2,"covered":2,"skipped":0,"pct":100},"statements":{"total":6,"covered":6,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
|
|
5
|
+
}
|
|
@@ -3,15 +3,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const growthbookReact = require("@growthbook/growthbook-react");
|
|
4
4
|
const useAbTestAttributes = () => {
|
|
5
5
|
const growthBook = growthbookReact.useGrowthBook();
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return [attributes, setAttributes];
|
|
13
|
-
}
|
|
14
|
-
return [{}, () => {
|
|
15
|
-
}];
|
|
6
|
+
const attributes = growthBook.getAttributes();
|
|
7
|
+
const setAttributes = (newAttributes) => growthBook.setAttributes({
|
|
8
|
+
...attributes,
|
|
9
|
+
...newAttributes
|
|
10
|
+
});
|
|
11
|
+
return [attributes, setAttributes];
|
|
16
12
|
};
|
|
17
13
|
exports.useAbTestAttributes = useAbTestAttributes;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { useGrowthBook } from "@growthbook/growthbook-react";
|
|
2
2
|
const useAbTestAttributes = () => {
|
|
3
3
|
const growthBook = useGrowthBook();
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return [attributes, setAttributes];
|
|
11
|
-
}
|
|
12
|
-
return [{}, () => {
|
|
13
|
-
}];
|
|
4
|
+
const attributes = growthBook.getAttributes();
|
|
5
|
+
const setAttributes = (newAttributes) => growthBook.setAttributes({
|
|
6
|
+
...attributes,
|
|
7
|
+
...newAttributes
|
|
8
|
+
});
|
|
9
|
+
return [attributes, setAttributes];
|
|
14
10
|
};
|
|
15
11
|
export {
|
|
16
12
|
useAbTestAttributes
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleway/use-growthbook",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Utility package to expose AB test tool",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.x"
|
|
7
7
|
},
|
|
8
|
+
"main": "./dist/index.cjs",
|
|
8
9
|
"sideEffects": false,
|
|
9
10
|
"type": "module",
|
|
10
11
|
"module": "./dist/index.js",
|
|
@@ -30,15 +31,16 @@
|
|
|
30
31
|
"feature flags"
|
|
31
32
|
],
|
|
32
33
|
"dependencies": {
|
|
33
|
-
"@growthbook/growthbook-react": "0.
|
|
34
|
+
"@growthbook/growthbook-react": "1.0.1"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
|
-
"react": "18.
|
|
37
|
+
"react": "18.3.1"
|
|
37
38
|
},
|
|
38
39
|
"peerDependencies": {
|
|
39
40
|
"react": "18.x"
|
|
40
41
|
},
|
|
41
42
|
"scripts": {
|
|
43
|
+
"prebuild": "shx rm -rf dist",
|
|
42
44
|
"typecheck": "tsc --noEmit",
|
|
43
45
|
"type:generate": "tsc --declaration -p tsconfig.build.json",
|
|
44
46
|
"build": "vite build --config vite.config.ts && pnpm run type:generate",
|