@equinor/cpl-feature-flag-react 2.0.1 → 2.0.3
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/dist/index.js +8 -23
- package/dist/index.mjs +8 -26
- package/package.json +22 -15
package/dist/index.js
CHANGED
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
8
|
var __export = (target, all) => {
|
|
26
9
|
for (var name in all)
|
|
27
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -97,7 +80,7 @@ function getFeatureFlagConfigFromSessionStorage(storage, storageKey) {
|
|
|
97
80
|
result[featureFlagKey] = value;
|
|
98
81
|
}
|
|
99
82
|
return result;
|
|
100
|
-
} catch
|
|
83
|
+
} catch {
|
|
101
84
|
removeStorageItemSafe(storage, storageKey);
|
|
102
85
|
return void 0;
|
|
103
86
|
}
|
|
@@ -107,7 +90,7 @@ function setFeatureFlagValueInSessionStorage(storage, storageKey, featureFlagKey
|
|
|
107
90
|
return;
|
|
108
91
|
}
|
|
109
92
|
const featueFlagConfig = getFeatureFlagConfigFromSessionStorage(storage, storageKey);
|
|
110
|
-
storage.setItem(storageKey, JSON.stringify(
|
|
93
|
+
storage.setItem(storageKey, JSON.stringify({ ...featueFlagConfig, [featureFlagKey]: value }));
|
|
111
94
|
}
|
|
112
95
|
|
|
113
96
|
// src/buildFeatureFlagContext.tsx
|
|
@@ -139,11 +122,13 @@ function buildReducer(storage, storageKey) {
|
|
|
139
122
|
action.featureFlagKey,
|
|
140
123
|
action.value
|
|
141
124
|
);
|
|
142
|
-
return
|
|
143
|
-
|
|
125
|
+
return {
|
|
126
|
+
...state,
|
|
127
|
+
[action.featureFlagKey]: {
|
|
128
|
+
...state[action.featureFlagKey],
|
|
144
129
|
[action.env]: action.value
|
|
145
|
-
}
|
|
146
|
-
}
|
|
130
|
+
}
|
|
131
|
+
};
|
|
147
132
|
}
|
|
148
133
|
default: {
|
|
149
134
|
return state;
|
package/dist/index.mjs
CHANGED
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
|
|
21
1
|
// src/buildFeatureFlagContext.tsx
|
|
22
2
|
import { createContext, useContext, useReducer } from "react";
|
|
23
3
|
|
|
@@ -64,7 +44,7 @@ function getFeatureFlagConfigFromSessionStorage(storage, storageKey) {
|
|
|
64
44
|
result[featureFlagKey] = value;
|
|
65
45
|
}
|
|
66
46
|
return result;
|
|
67
|
-
} catch
|
|
47
|
+
} catch {
|
|
68
48
|
removeStorageItemSafe(storage, storageKey);
|
|
69
49
|
return void 0;
|
|
70
50
|
}
|
|
@@ -74,7 +54,7 @@ function setFeatureFlagValueInSessionStorage(storage, storageKey, featureFlagKey
|
|
|
74
54
|
return;
|
|
75
55
|
}
|
|
76
56
|
const featueFlagConfig = getFeatureFlagConfigFromSessionStorage(storage, storageKey);
|
|
77
|
-
storage.setItem(storageKey, JSON.stringify(
|
|
57
|
+
storage.setItem(storageKey, JSON.stringify({ ...featueFlagConfig, [featureFlagKey]: value }));
|
|
78
58
|
}
|
|
79
59
|
|
|
80
60
|
// src/buildFeatureFlagContext.tsx
|
|
@@ -106,11 +86,13 @@ function buildReducer(storage, storageKey) {
|
|
|
106
86
|
action.featureFlagKey,
|
|
107
87
|
action.value
|
|
108
88
|
);
|
|
109
|
-
return
|
|
110
|
-
|
|
89
|
+
return {
|
|
90
|
+
...state,
|
|
91
|
+
[action.featureFlagKey]: {
|
|
92
|
+
...state[action.featureFlagKey],
|
|
111
93
|
[action.env]: action.value
|
|
112
|
-
}
|
|
113
|
-
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
114
96
|
}
|
|
115
97
|
default: {
|
|
116
98
|
return state;
|
package/package.json
CHANGED
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/cpl-feature-flag-react",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
8
15
|
"files": [
|
|
9
16
|
"dist/**"
|
|
10
17
|
],
|
|
11
18
|
"devDependencies": {
|
|
12
|
-
"@equinor/eds-core-react": "
|
|
13
|
-
"@storybook/react": "
|
|
14
|
-
"@types/react": "
|
|
15
|
-
"@types/react-dom": "
|
|
16
|
-
"@types/styled-components": "
|
|
17
|
-
"eslint": "
|
|
18
|
-
"react": "
|
|
19
|
-
"react-dom": "
|
|
20
|
-
"styled-components": "
|
|
21
|
-
"tsup": "
|
|
22
|
-
"@equinor/cpl-eslint-config": "1.0.
|
|
23
|
-
"@equinor/cpl-typescript-config": "0.0.
|
|
19
|
+
"@equinor/eds-core-react": "2.3.4",
|
|
20
|
+
"@storybook/react-vite": "10.2.8",
|
|
21
|
+
"@types/react": "19.2.13",
|
|
22
|
+
"@types/react-dom": "19.2.3",
|
|
23
|
+
"@types/styled-components": "5.1.36",
|
|
24
|
+
"eslint": "10.0.0",
|
|
25
|
+
"react": "19.2.4",
|
|
26
|
+
"react-dom": "19.2.4",
|
|
27
|
+
"styled-components": "6.3.9",
|
|
28
|
+
"tsup": "8.5.1",
|
|
29
|
+
"@equinor/cpl-eslint-config": "1.0.4",
|
|
30
|
+
"@equinor/cpl-typescript-config": "0.0.5"
|
|
24
31
|
},
|
|
25
32
|
"peerDependencies": {
|
|
26
33
|
"@equinor/eds-core-react": ">=2.2.0",
|
|
@@ -32,8 +39,8 @@
|
|
|
32
39
|
"access": "public"
|
|
33
40
|
},
|
|
34
41
|
"dependencies": {
|
|
35
|
-
"@equinor/eds-icons": "
|
|
36
|
-
"@equinor/eds-tokens": "
|
|
42
|
+
"@equinor/eds-icons": "1.2.1",
|
|
43
|
+
"@equinor/eds-tokens": "2.1.1"
|
|
37
44
|
},
|
|
38
45
|
"scripts": {
|
|
39
46
|
"build": "tsup src/index.ts --format esm,cjs --dts --external react",
|