@scaleway/use-growthbook 2.1.0 → 2.1.2

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.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2091](https://github.com/scaleway/scaleway-lib/pull/2091) [`2f04650`](https://github.com/scaleway/scaleway-lib/commit/2f04650ecc92205aa0b06a526675c641e041bcfd) Thanks [@renovate](https://github.com/apps/renovate)! - Updated dependency `@growthbook/growthbook-react` to `1.1.0`.
8
+
9
+ ## 2.1.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#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`.
14
+
3
15
  ## 2.1.0
4
16
 
5
17
  ### Minor Changes
@@ -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
- if (growthBook) {
7
- const attributes = growthBook.getAttributes();
8
- const setAttributes = (newAttributes) => growthBook.setAttributes({
9
- ...attributes,
10
- ...newAttributes
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,5 +1,2 @@
1
1
  import type { Attributes } from './types';
2
- export declare const useAbTestAttributes: () => [
3
- Attributes,
4
- (attributes: Attributes) => void
5
- ];
2
+ export declare const useAbTestAttributes: () => [Attributes, (attributes: Attributes) => void];
@@ -1,16 +1,12 @@
1
1
  import { useGrowthBook } from "@growthbook/growthbook-react";
2
2
  const useAbTestAttributes = () => {
3
3
  const growthBook = useGrowthBook();
4
- if (growthBook) {
5
- const attributes = growthBook.getAttributes();
6
- const setAttributes = (newAttributes) => growthBook.setAttributes({
7
- ...attributes,
8
- ...newAttributes
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/use-growthbook",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Utility package to expose AB test tool",
5
5
  "engines": {
6
6
  "node": ">=20.x"
@@ -31,7 +31,7 @@
31
31
  "feature flags"
32
32
  ],
33
33
  "dependencies": {
34
- "@growthbook/growthbook-react": "0.26.0"
34
+ "@growthbook/growthbook-react": "1.1.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "react": "18.3.1"
@@ -40,6 +40,7 @@
40
40
  "react": "18.x"
41
41
  },
42
42
  "scripts": {
43
+ "prebuild": "shx rm -rf dist",
43
44
  "typecheck": "tsc --noEmit",
44
45
  "type:generate": "tsc --declaration -p tsconfig.build.json",
45
46
  "build": "vite build --config vite.config.ts && pnpm run type:generate",