@newskit-render/feature-flags 0.0.0-1fc471ad

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.
@@ -0,0 +1,48 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ var MissingConfigurationError = /** @class */ (function (_super) {
17
+ __extends(MissingConfigurationError, _super);
18
+ function MissingConfigurationError() {
19
+ return _super.call(this, '@newskit-render/feature-flags: Missing configuration. Please provide optimizely sdk key in the environment variables.') || this;
20
+ }
21
+ return MissingConfigurationError;
22
+ }(Error));
23
+ export { MissingConfigurationError };
24
+ var MissingInstanceError = /** @class */ (function (_super) {
25
+ __extends(MissingInstanceError, _super);
26
+ function MissingInstanceError() {
27
+ return _super.call(this, '@newskit-render/feature-flags: Missing optimizely instance. Please call getFlagsAll, getFlag or getFlagsByKeys') || this;
28
+ }
29
+ return MissingInstanceError;
30
+ }(Error));
31
+ export { MissingInstanceError };
32
+ var MissingUserContextError = /** @class */ (function (_super) {
33
+ __extends(MissingUserContextError, _super);
34
+ function MissingUserContextError() {
35
+ return _super.call(this, '@newskit-render/feature-flags: Missing optimizely user context. Please call getFlagsAll, getFlag or getFlagsByKeys') || this;
36
+ }
37
+ return MissingUserContextError;
38
+ }(Error));
39
+ export { MissingUserContextError };
40
+ var MissingFeatureFlagsProvider = /** @class */ (function (_super) {
41
+ __extends(MissingFeatureFlagsProvider, _super);
42
+ function MissingFeatureFlagsProvider() {
43
+ return _super.call(this, '@newskit-render/feature-flags: useFeatureFlagsContext was used outside of FeatureFlagsContextProvider') || this;
44
+ }
45
+ return MissingFeatureFlagsProvider;
46
+ }(Error));
47
+ export { MissingFeatureFlagsProvider };
48
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAiCA;IAA+C,6CAAK;IAClD;eACE,kBACE,uHAAuH,CACxH;IACH,CAAC;IACH,gCAAC;AAAD,CAAC,AAND,CAA+C,KAAK,GAMnD;;AAED;IAA0C,wCAAK;IAC7C;eACE,kBACE,gHAAgH,CACjH;IACH,CAAC;IACH,2BAAC;AAAD,CAAC,AAND,CAA0C,KAAK,GAM9C;;AAED;IAA6C,2CAAK;IAChD;eACE,kBACE,oHAAoH,CACrH;IACH,CAAC;IACH,8BAAC;AAAD,CAAC,AAND,CAA6C,KAAK,GAMjD;;AAED;IAAiD,+CAAK;IACpD;eACE,kBACE,uGAAuG,CACxG;IACH,CAAC;IACH,kCAAC;AAAD,CAAC,AAND,CAAiD,KAAK,GAMrD"}
@@ -0,0 +1,3 @@
1
+ import { Flags } from './types';
2
+ export declare const _resetInstance: () => void;
3
+ export declare const initAndGetFeatureFlag: (options?: any) => Promise<Flags>;
@@ -0,0 +1,224 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ import { createInstance, logging, setLogLevel, setLogger, } from '@optimizely/optimizely-sdk';
49
+ import { MissingConfigurationError, MissingInstanceError, MissingUserContextError, } from './types';
50
+ var optimizelyClient;
51
+ var user;
52
+ var optimizelyClientReady = true;
53
+ export var _resetInstance = function () {
54
+ optimizelyClient = null;
55
+ };
56
+ // TO DO: Update ReadMe
57
+ // TO DO: Improve TS
58
+ var createOptimizelyInstance = function (options) {
59
+ var _a;
60
+ var sdkKey = ((_a = options === null || options === void 0 ? void 0 : options.sdkConfig) === null || _a === void 0 ? void 0 : _a.sdkKey) || process.env.OPTIMIZELY_SDK_KEY;
61
+ if (!sdkKey) {
62
+ throw new MissingConfigurationError();
63
+ }
64
+ var defaultConfig = {
65
+ datafileOptions: {
66
+ autoUpdate: true,
67
+ updateInterval: 300000,
68
+ },
69
+ };
70
+ var config = { sdkKey: sdkKey };
71
+ var optimizely = createInstance(__assign(__assign({}, defaultConfig), config));
72
+ if (options === null || options === void 0 ? void 0 : options.logLevel) {
73
+ setLogLevel(options === null || options === void 0 ? void 0 : options.logLevel);
74
+ setLogger(logging.createLogger());
75
+ }
76
+ optimizelyClient = optimizely;
77
+ };
78
+ var createUserContext = function (userId, attributes) {
79
+ var userContext = optimizelyClient.createUserContext(userId, attributes);
80
+ user = userContext;
81
+ };
82
+ var init = function (options) { return __awaiter(void 0, void 0, void 0, function () {
83
+ var _a, success, reason, defaultUserId, userId, attributes;
84
+ var _b, _c;
85
+ return __generator(this, function (_d) {
86
+ switch (_d.label) {
87
+ case 0:
88
+ createOptimizelyInstance(options);
89
+ if (!optimizelyClient) {
90
+ throw new MissingInstanceError();
91
+ }
92
+ return [4 /*yield*/, optimizelyClient.onReady({ timeout: 1000 })];
93
+ case 1:
94
+ _a = _d.sent(), success = _a.success, reason = _a.reason;
95
+ if (!success) {
96
+ optimizelyClientReady = false;
97
+ console.log("client initialization unsuccessful, reason: ".concat(reason));
98
+ }
99
+ defaultUserId = 'default_userId';
100
+ userId = ((_b = options === null || options === void 0 ? void 0 : options.userData) === null || _b === void 0 ? void 0 : _b.userId) || defaultUserId;
101
+ attributes = (_c = options === null || options === void 0 ? void 0 : options.userData) === null || _c === void 0 ? void 0 : _c.attributes;
102
+ createUserContext(userId, attributes);
103
+ // TO DO: this check should be moved to the createUserContext function
104
+ if (!user) {
105
+ throw new MissingUserContextError();
106
+ }
107
+ return [2 /*return*/];
108
+ }
109
+ });
110
+ }); };
111
+ var remapFlagInfo = function (flags, includeFlagVariables) {
112
+ if (!flags)
113
+ return {};
114
+ var flagKeys = flags.flagKey ? [flags.flagKey] : Object.keys(flags);
115
+ return flagKeys.reduce(function (acc, flagKey) {
116
+ var decision = flags.flagKey ? flags : flags[flagKey];
117
+ if (includeFlagVariables) {
118
+ acc[flagKey] = {
119
+ variationKey: decision.variationKey,
120
+ enabled: decision.enabled,
121
+ variables: decision.variables,
122
+ };
123
+ }
124
+ else {
125
+ acc[flagKey] = decision.enabled;
126
+ }
127
+ return acc;
128
+ }, {});
129
+ };
130
+ export var initAndGetFeatureFlag = function (options) { return __awaiter(void 0, void 0, void 0, function () {
131
+ var _a, decisions;
132
+ return __generator(this, function (_b) {
133
+ switch (_b.label) {
134
+ case 0:
135
+ _b.trys.push([0, 2, , 3]);
136
+ return [4 /*yield*/, init(options)];
137
+ case 1:
138
+ _b.sent();
139
+ return [3 /*break*/, 3];
140
+ case 2:
141
+ _a = _b.sent();
142
+ return [2 /*return*/, {}];
143
+ case 3:
144
+ if (!optimizelyClientReady)
145
+ return [2 /*return*/, (options === null || options === void 0 ? void 0 : options.defaultFeatureFlags) || {}];
146
+ decisions = user.decideAll(options === null || options === void 0 ? void 0 : options.decideOptions);
147
+ return [2 /*return*/, remapFlagInfo(decisions, options === null || options === void 0 ? void 0 : options.includeFlagVariables)];
148
+ }
149
+ });
150
+ }); };
151
+ // TO DO: With the current implementation this function is not working on the SSR
152
+ // The issue is the instance
153
+ // export const getFlagsAll = async (options?): Promise<Flags> => {
154
+ // if (!optimizelyClient) {
155
+ // // TO DO: try-catch quick fix. This needs to be refactored
156
+ // try {
157
+ // await init(options)
158
+ // } catch {
159
+ // return {}
160
+ // }
161
+ // }
162
+ // if (!optimizelyClientReady) return options?.defaultFeatureFlags || {}
163
+ // const decisions = (user as OptimizelyUserContext).decideAll(
164
+ // options?.decideOptions
165
+ // )
166
+ // return remapFlagInfo(decisions, options?.includeFlagVariables)
167
+ // }
168
+ // export const closeFlagsInstance = async () => {
169
+ // // TO DO: We need to reset the optimizelyClient variable.
170
+ // // At the the lib is throwing an error after closeFlagsInstance is called
171
+ // if (optimizelyClient) {
172
+ // const { success, reason } = await optimizelyClient.close()
173
+ // if (!success) {
174
+ // console.log(`closing Optimizely instance failed, reason: ${reason}`)
175
+ // return
176
+ // }
177
+ // console.log('optimizely instance closed successfully')
178
+ // }
179
+ // }
180
+ // TO DO: With the current implementation this function is not working on the SSR
181
+ // The issue is the instance
182
+ // export const getFlagsByKeys = async (
183
+ // keys: string[],
184
+ // options?
185
+ // ): Promise<Flags> => {
186
+ // if (!optimizelyClient) {
187
+ // // TO DO: try-catch quick fix. This needs to be refactored
188
+ // try {
189
+ // /* istanbul ignore next */
190
+ // await init(options)
191
+ // } catch {
192
+ // /* istanbul ignore next */
193
+ // return {}
194
+ // }
195
+ // }
196
+ // if (!optimizelyClientReady) return options?.defaultFeatureFlags || {}
197
+ // const decisions = (user as OptimizelyUserContext).decideForKeys(
198
+ // keys,
199
+ // options?.decideOptions
200
+ // )
201
+ // return remapFlagInfo(decisions, options?.includeFlagVariables)
202
+ // }
203
+ // TO DO: Do we really need getFlag and getFlagsByKeys? The only difference is key/keys formats
204
+ // TO DO: With the current implementation this function is not working on the SSR
205
+ // The issue is the instance
206
+ // export const getFlag = async (key: string, options?): Promise<Flags> => {
207
+ // if (!optimizelyClient) {
208
+ // // TO DO: try-catch quick fix. This needs to be refactored
209
+ // try {
210
+ // /* istanbul ignore next */
211
+ // await init(options)
212
+ // } catch {
213
+ // /* istanbul ignore next */
214
+ // return {}
215
+ // }
216
+ // }
217
+ // if (!optimizelyClientReady) return options?.defaultFeatureFlags || {}
218
+ // const decision = (user as OptimizelyUserContext).decide(
219
+ // key,
220
+ // options?.decideOptions
221
+ // )
222
+ // return remapFlagInfo(decision, options?.includeFlagVariables)
223
+ // }
224
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAML,cAAc,EACd,OAAO,EACP,WAAW,EACX,SAAS,GACV,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAEL,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,GAExB,MAAM,SAAS,CAAA;AAEhB,IAAI,gBAA+B,CAAA;AACnC,IAAI,IAAkC,CAAA;AACtC,IAAI,qBAAqB,GAAG,IAAI,CAAA;AAEhC,MAAM,CAAC,IAAM,cAAc,GAAG;IAC5B,gBAAgB,GAAG,IAAI,CAAA;AACzB,CAAC,CAAA;AAED,uBAAuB;AACvB,oBAAoB;AAEpB,IAAM,wBAAwB,GAAG,UAAC,OAAQ;;IACxC,IAAM,MAAM,GAAG,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,0CAAE,MAAM,KAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAA;IAE3E,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,yBAAyB,EAAE,CAAA;KACtC;IAED,IAAM,aAAa,GAAW;QAC5B,eAAe,EAAE;YACf,UAAU,EAAE,IAAI;YAChB,cAAc,EAAE,MAAM;SACvB;KACF,CAAA;IACD,IAAM,MAAM,GAAW,EAAE,MAAM,QAAA,EAAE,CAAA;IACjC,IAAM,UAAU,GAAkB,cAAc,uBAC3C,aAAa,GACb,MAAM,EACT,CAAA;IAEF,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AP,OAAO,CAAE,oBAAoB,CAAC,EAAA;;;KAC/D,CAAA;AAED,iFAAiF;AACjF,4BAA4B;AAC5B,mEAAmE;AACnE,6BAA6B;AAC7B,iEAAiE;AACjE,YAAY;AACZ,4BAA4B;AAC5B,gBAAgB;AAChB,kBAAkB;AAClB,QAAQ;AACR,MAAM;AAEN,0EAA0E;AAE1E,iEAAiE;AACjE,6BAA6B;AAC7B,MAAM;AACN,mEAAmE;AACnE,IAAI;AAEJ,kDAAkD;AAClD,8DAA8D;AAC9D,8EAA8E;AAC9E,4BAA4B;AAC5B,iEAAiE;AACjE,sBAAsB;AACtB,6EAA6E;AAC7E,eAAe;AACf,QAAQ;AAER,6DAA6D;AAC7D,MAAM;AACN,IAAI;AAEJ,iFAAiF;AACjF,4BAA4B;AAC5B,wCAAwC;AACxC,oBAAoB;AACpB,aAAa;AACb,yBAAyB;AACzB,6BAA6B;AAC7B,iEAAiE;AACjE,YAAY;AACZ,mCAAmC;AACnC,4BAA4B;AAC5B,gBAAgB;AAChB,mCAAmC;AACnC,kBAAkB;AAClB,QAAQ;AACR,MAAM;AAEN,0EAA0E;AAE1E,qEAAqE;AACrE,YAAY;AACZ,6BAA6B;AAC7B,MAAM;AACN,mEAAmE;AACnE,IAAI;AAEJ,+FAA+F;AAC/F,iFAAiF;AACjF,4BAA4B;AAC5B,4EAA4E;AAC5E,6BAA6B;AAC7B,iEAAiE;AACjE,YAAY;AACZ,mCAAmC;AACnC,4BAA4B;AAC5B,gBAAgB;AAChB,mCAAmC;AACnC,kBAAkB;AAClB,QAAQ;AACR,MAAM;AAEN,0EAA0E;AAE1E,6DAA6D;AAC7D,WAAW;AACX,6BAA6B;AAC7B,MAAM;AACN,kEAAkE;AAClE,IAAI"}
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@newskit-render/feature-flags",
3
+ "version": "0.0.0-1fc471ad",
4
+ "description": "A package for utilizing feature flags for newskit-render consumers, based on optimizely's capabilities.",
5
+ "author": "",
6
+ "license": "UNLICENSED",
7
+ "keywords": [],
8
+ "module": "dist/esm/index.js",
9
+ "main": "dist/cjs/index.js",
10
+ "types": "dist/esm/index.d.ts",
11
+ "sideEffects": false,
12
+ "engines": {
13
+ "node": ">=16.13"
14
+ },
15
+ "scripts": {
16
+ "build": "rm -rf dist && tsc -p tsconfig.build.json && tsc -p tsconfig.build.json --module CommonJS --outDir './dist/cjs'",
17
+ "build:watch": "tsc -b tsconfig.build.json -w",
18
+ "test:unit:watch": "jest --watch",
19
+ "test:unit": "jest",
20
+ "lint": "eslint --ext .js,.jsx,.ts,.tsx . --color",
21
+ "lint:fix": "eslint --ext .js,.jsx,.ts,.tsx . --color --fix && prettier --write './**/*.{js,jsx,ts,tsx,json}'",
22
+ "clean": "rm -rf node_modules & rm -f package-lock.json & rm -f yarn.lock",
23
+ "test:unit:ci": "JEST_JUNIT_OUTPUT_NAME=feature-flags.xml jest --ci --reporters=default --reporters=jest-junit"
24
+ },
25
+ "dependencies": {
26
+ "@optimizely/optimizely-sdk": "5.3.3"
27
+ },
28
+ "devDependencies": {
29
+ "@babel/polyfill": "7.12.1",
30
+ "@babel/register": "7.18.9",
31
+ "@testing-library/react-hooks": "7.0.2",
32
+ "@types/jest": "29.5.5",
33
+ "@types/react": "18.0.26",
34
+ "@types/react-dom": "18.0.10",
35
+ "@typescript-eslint/eslint-plugin": "5.51.0",
36
+ "@typescript-eslint/parser": "5.51.0",
37
+ "eslint": "8.34.0",
38
+ "eslint-config-prettier": "8.6.0",
39
+ "eslint-plugin-prettier": "4.2.1",
40
+ "eslint-plugin-react": "7.31.11",
41
+ "jest": "29.7.0",
42
+ "jest-environment-jsdom": "29.7.0",
43
+ "jest-junit": "15.0.0",
44
+ "prettier": "2.8.1",
45
+ "react": "18.2.0",
46
+ "react-dom": "18.2.0",
47
+ "ts-jest": "29.1.1",
48
+ "typescript": "4.9.4"
49
+ },
50
+ "peerDependencies": {
51
+ "react": ">= 17.0.2 <= 18.2.0",
52
+ "react-dom": ">= 17.0.2 <= 18.2.0"
53
+ },
54
+ "resolutions": {
55
+ "@types/react": "18.0.26",
56
+ "@types/react-dom": "18.0.10"
57
+ },
58
+ "files": [
59
+ "dist"
60
+ ],
61
+ "publishConfig": {
62
+ "access": "public"
63
+ }
64
+ }