@flagship.io/react-sdk 4.0.0-alpha.1 → 4.0.0-alpha.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.
@@ -2,101 +2,67 @@
2
2
  /******/ "use strict";
3
3
  /******/ var __webpack_modules__ = ({
4
4
 
5
- /***/ "./src/Flag.ts":
6
- /*!*********************!*\
7
- !*** ./src/Flag.ts ***!
8
- \*********************/
5
+ /***/ "./src/FSFlag.ts":
6
+ /*!***********************!*\
7
+ !*** ./src/FSFlag.ts ***!
8
+ \***********************/
9
9
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10
10
 
11
11
  __webpack_require__.r(__webpack_exports__);
12
12
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13
- /* harmony export */ "Flag": () => (/* binding */ Flag)
13
+ /* harmony export */ FSFlag: () => (/* binding */ FSFlag)
14
14
  /* harmony export */ });
15
- /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @flagship.io/js-sdk */ "@flagship.io/js-sdk");
16
- /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0__);
17
- /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants */ "./src/constants.ts");
18
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./src/utils.tsx");
19
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
20
-
15
+ /* harmony import */ var core_js_modules_es_regexp_flags_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.regexp.flags.js */ "./node_modules/core-js/modules/es.regexp.flags.js");
16
+ /* harmony import */ var core_js_modules_es_regexp_flags_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_flags_js__WEBPACK_IMPORTED_MODULE_0__);
17
+ /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @flagship.io/js-sdk */ "@flagship.io/js-sdk");
18
+ /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__);
19
+ /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants */ "./src/constants.ts");
20
+ /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ "./src/utils.ts");
21
21
 
22
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
23
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
24
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
22
25
 
23
26
 
24
- class Flag {
25
- constructor(defaultValue, key, flagsData) {
26
- _defineProperty(this, "defaultValue", void 0);
27
27
 
28
+ class FSFlag {
29
+ constructor(key, state) {
28
30
  _defineProperty(this, "key", void 0);
29
-
30
31
  _defineProperty(this, "flag", void 0);
31
-
32
- if (!flagsData) {
33
- (0,_utils__WEBPACK_IMPORTED_MODULE_1__.logWarn)(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0___default().getConfig(), _constants__WEBPACK_IMPORTED_MODULE_2__.noVisitorMessage, 'GetFlag');
32
+ const flagsData = state.flags;
33
+ if (!state.hasVisitorData) {
34
+ (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logWarn)(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.Flagship.getConfig(), _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, 'GetFlag');
34
35
  }
35
-
36
- this.defaultValue = defaultValue;
37
36
  this.key = key;
38
37
  this.flag = flagsData === null || flagsData === void 0 ? void 0 : flagsData.get(key);
39
38
  }
40
-
41
- NotSameType() {
42
- var _this$flag;
43
-
44
- return this.defaultValue !== null && this.defaultValue !== undefined && !(0,_utils__WEBPACK_IMPORTED_MODULE_1__.hasSameType)((_this$flag = this.flag) === null || _this$flag === void 0 ? void 0 : _this$flag.value, this.defaultValue);
45
- }
46
-
47
- getValue() {
39
+ getValue(defaultValue) {
48
40
  if (!this.flag) {
49
- (0,_utils__WEBPACK_IMPORTED_MODULE_1__.logWarn)(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0___default().getConfig(), _constants__WEBPACK_IMPORTED_MODULE_2__.noVisitorMessage, 'getValue');
50
- return this.defaultValue;
41
+ return defaultValue;
51
42
  }
52
-
53
- if (this.NotSameType()) {
54
- (0,_utils__WEBPACK_IMPORTED_MODULE_1__.logInfo)(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0___default().getConfig(), (0,_utils__WEBPACK_IMPORTED_MODULE_1__.sprintf)(_constants__WEBPACK_IMPORTED_MODULE_2__.GET_FLAG_CAST_ERROR, this.key), 'getValue');
55
- return this.defaultValue;
43
+ if (this.flag.value === null || this.flag.value === undefined) {
44
+ return defaultValue;
45
+ }
46
+ if (defaultValue !== null && defaultValue !== undefined && !(0,_utils__WEBPACK_IMPORTED_MODULE_2__.hasSameType)(this.flag.value, defaultValue)) {
47
+ (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logInfo)(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.Flagship.getConfig(), (0,_utils__WEBPACK_IMPORTED_MODULE_2__.sprintf)(_constants__WEBPACK_IMPORTED_MODULE_3__.GET_FLAG_CAST_ERROR, this.key), 'getValue');
48
+ return defaultValue;
56
49
  }
57
-
58
50
  return this.flag.value;
59
51
  }
60
-
61
52
  exists() {
62
53
  if (!this.flag) {
63
- (0,_utils__WEBPACK_IMPORTED_MODULE_1__.logWarn)(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0___default().getConfig(), _constants__WEBPACK_IMPORTED_MODULE_2__.noVisitorMessage, 'exists');
64
54
  return false;
65
55
  }
66
-
67
56
  return !!(this.flag.campaignId && this.flag.variationId && this.flag.variationGroupId);
68
57
  }
69
-
70
- userExposed() {
71
- if (!this.flag) {
72
- (0,_utils__WEBPACK_IMPORTED_MODULE_1__.logWarn)(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0___default().getConfig(), _constants__WEBPACK_IMPORTED_MODULE_2__.noVisitorMessage, 'userExposed');
73
- }
74
-
75
- return Promise.resolve();
76
- }
77
-
78
- visitorExposed() {
79
- if (!this.flag) {
80
- (0,_utils__WEBPACK_IMPORTED_MODULE_1__.logWarn)(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0___default().getConfig(), _constants__WEBPACK_IMPORTED_MODULE_2__.noVisitorMessage, 'visitorExposed');
81
- }
82
-
83
- return Promise.resolve();
58
+ async visitorExposed() {
59
+ // do nothing
84
60
  }
85
-
86
61
  get metadata() {
87
- const functionName = 'metadata';
88
-
89
62
  if (!this.flag) {
90
- (0,_utils__WEBPACK_IMPORTED_MODULE_1__.logWarn)(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0___default().getConfig(), _constants__WEBPACK_IMPORTED_MODULE_2__.noVisitorMessage, functionName);
91
- return _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0__.FlagMetadata.Empty();
92
- }
93
-
94
- if (this.NotSameType()) {
95
- (0,_utils__WEBPACK_IMPORTED_MODULE_1__.logInfo)(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0___default().getConfig(), (0,_utils__WEBPACK_IMPORTED_MODULE_1__.sprintf)(_constants__WEBPACK_IMPORTED_MODULE_2__.GET_METADATA_CAST_ERROR, this.key), functionName);
96
- return _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0__.FlagMetadata.Empty();
63
+ return _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.FSFlagMetadata.Empty();
97
64
  }
98
-
99
- return new _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0__.FlagMetadata({
65
+ return new _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.FSFlagMetadata({
100
66
  campaignId: this.flag.campaignId,
101
67
  campaignName: this.flag.campaignName,
102
68
  variationGroupId: this.flag.variationGroupId,
@@ -108,7 +74,12 @@ class Flag {
108
74
  slug: this.flag.slug
109
75
  });
110
76
  }
111
-
77
+ get status() {
78
+ if (!this.exists()) {
79
+ return _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.FSFlagStatus.NOT_FOUND;
80
+ }
81
+ return _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.FSFlagStatus.FETCHED;
82
+ }
112
83
  }
113
84
 
114
85
  /***/ }),
@@ -121,881 +92,1849 @@ class Flag {
121
92
 
122
93
  __webpack_require__.r(__webpack_exports__);
123
94
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
124
- /* harmony export */ "FlagshipContext": () => (/* binding */ FlagshipContext),
125
- /* harmony export */ "FlagshipProvider": () => (/* binding */ FlagshipProvider)
95
+ /* harmony export */ FlagshipContext: () => (/* binding */ FlagshipContext),
96
+ /* harmony export */ initStat: () => (/* binding */ initStat)
126
97
  /* harmony export */ });
127
98
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
128
99
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
129
- /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @flagship.io/js-sdk */ "@flagship.io/js-sdk");
130
- /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__);
131
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./src/utils.tsx");
132
- /* harmony import */ var _sdkVersion__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./sdkVersion */ "./src/sdkVersion.ts");
133
- /* harmony import */ var _internalType__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./internalType */ "./src/internalType.ts");
134
- 'use client'; // eslint-disable-next-line no-use-before-define
100
+ 'use client';
101
+
102
+
103
+ const initStat = {
104
+ isInitializing: true
105
+ };
106
+ const FlagshipContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)({
107
+ state: {
108
+ ...initStat
109
+ }
110
+ });
135
111
 
112
+ /***/ }),
113
+
114
+ /***/ "./src/FlagshipHooks.ts":
115
+ /*!******************************!*\
116
+ !*** ./src/FlagshipHooks.ts ***!
117
+ \******************************/
118
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
119
+
120
+ __webpack_require__.r(__webpack_exports__);
121
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
122
+ /* harmony export */ useFlagship: () => (/* binding */ useFlagship),
123
+ /* harmony export */ useFsFlag: () => (/* binding */ useFsFlag)
124
+ /* harmony export */ });
125
+ /* harmony import */ var core_js_modules_es_regexp_flags_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.regexp.flags.js */ "./node_modules/core-js/modules/es.regexp.flags.js");
126
+ /* harmony import */ var core_js_modules_es_regexp_flags_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_flags_js__WEBPACK_IMPORTED_MODULE_0__);
127
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
128
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
129
+ /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @flagship.io/js-sdk */ "@flagship.io/js-sdk");
130
+ /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_2__);
131
+ /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./constants */ "./src/constants.ts");
132
+ /* harmony import */ var _FlagshipContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./FlagshipContext */ "./src/FlagshipContext.tsx");
133
+ /* harmony import */ var _FSFlag__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./FSFlag */ "./src/FSFlag.ts");
134
+ /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils */ "./src/utils.ts");
135
+ 'use client';
136
136
 
137
137
 
138
138
 
139
139
 
140
140
 
141
- const initStat = {
142
- status: {
143
- isLoading: true,
144
- isSdkReady: false
141
+
142
+
143
+
144
+
145
+ /**
146
+ * This hook returns a flag object by its key. If no flag match the given key an empty flag will be returned.
147
+ * @param key
148
+ * @param defaultValue
149
+ * @returns
150
+ */
151
+ const useFsFlag = key => {
152
+ const {
153
+ state
154
+ } = (0,react__WEBPACK_IMPORTED_MODULE_1__.useContext)(_FlagshipContext__WEBPACK_IMPORTED_MODULE_3__.FlagshipContext);
155
+ const {
156
+ visitor
157
+ } = state;
158
+ if (!visitor) {
159
+ return new _FSFlag__WEBPACK_IMPORTED_MODULE_4__.FSFlag(key, state);
145
160
  }
161
+ return visitor.getFlag(key);
146
162
  };
147
- const FlagshipContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)({
148
- state: { ...initStat
163
+ const useFlagship = () => {
164
+ const {
165
+ state
166
+ } = (0,react__WEBPACK_IMPORTED_MODULE_1__.useContext)(_FlagshipContext__WEBPACK_IMPORTED_MODULE_3__.FlagshipContext);
167
+ const {
168
+ visitor,
169
+ config
170
+ } = state;
171
+ const fsUpdateContext = context => {
172
+ const functionName = 'updateContext';
173
+ if (!visitor) {
174
+ (0,_utils__WEBPACK_IMPORTED_MODULE_5__.logError)(config, _constants__WEBPACK_IMPORTED_MODULE_6__.noVisitorMessage, functionName);
175
+ return;
176
+ }
177
+ visitor.updateContext(context);
178
+ visitor.fetchFlags();
179
+ };
180
+ const fsClearContext = () => {
181
+ const functionName = 'cleanContext';
182
+ if (!visitor) {
183
+ (0,_utils__WEBPACK_IMPORTED_MODULE_5__.logError)(config, _constants__WEBPACK_IMPORTED_MODULE_6__.noVisitorMessage, functionName);
184
+ return;
185
+ }
186
+ visitor.clearContext();
187
+ visitor.fetchFlags();
188
+ };
189
+ const fsAuthenticate = visitorId => {
190
+ const functionName = 'authenticate';
191
+ if (!visitor) {
192
+ (0,_utils__WEBPACK_IMPORTED_MODULE_5__.logError)(config, _constants__WEBPACK_IMPORTED_MODULE_6__.noVisitorMessage, functionName);
193
+ return;
194
+ }
195
+ visitor.authenticate(visitorId);
196
+ visitor.fetchFlags();
197
+ };
198
+ const fsUnauthenticate = () => {
199
+ const functionName = 'unauthenticate';
200
+ if (!visitor) {
201
+ (0,_utils__WEBPACK_IMPORTED_MODULE_5__.logError)(config, _constants__WEBPACK_IMPORTED_MODULE_6__.noVisitorMessage, functionName);
202
+ return;
203
+ }
204
+ visitor.unauthenticate();
205
+ visitor.fetchFlags();
206
+ };
207
+
208
+ /**
209
+ * Send a Hit to Flagship servers for reporting.
210
+ */
211
+ const fsSendHit = hit => {
212
+ const functionName = 'sendHit';
213
+ if (!visitor) {
214
+ (0,_utils__WEBPACK_IMPORTED_MODULE_5__.logError)(config, _constants__WEBPACK_IMPORTED_MODULE_6__.noVisitorMessage, functionName);
215
+ return Promise.resolve();
216
+ }
217
+ if (Array.isArray(hit)) {
218
+ return visitor.sendHits(hit);
219
+ }
220
+ return visitor.sendHit(hit);
221
+ };
222
+ function getFlag(key) {
223
+ if (!visitor) {
224
+ return new _FSFlag__WEBPACK_IMPORTED_MODULE_4__.FSFlag(key, state);
225
+ }
226
+ return visitor.getFlag(key);
149
227
  }
150
- });
151
- const FlagshipProvider = ({
228
+ function fetchFlags() {
229
+ if (!visitor) {
230
+ (0,_utils__WEBPACK_IMPORTED_MODULE_5__.logWarn)(config, _constants__WEBPACK_IMPORTED_MODULE_6__.noVisitorMessage, 'fetchFlags');
231
+ return Promise.resolve();
232
+ }
233
+ return visitor.fetchFlags();
234
+ }
235
+ function setConsent(hasConsented) {
236
+ if (!visitor) {
237
+ (0,_utils__WEBPACK_IMPORTED_MODULE_5__.logWarn)(config, _constants__WEBPACK_IMPORTED_MODULE_6__.noVisitorMessage, 'setConsent');
238
+ return;
239
+ }
240
+ visitor.setConsent(hasConsented);
241
+ }
242
+ async function close() {
243
+ await _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_2__.Flagship.close();
244
+ }
245
+ function getFlags() {
246
+ if (!visitor) {
247
+ var _state$flags;
248
+ const flags = new Map();
249
+ (_state$flags = state.flags) === null || _state$flags === void 0 || _state$flags.forEach((flag, key) => {
250
+ flags.set(key, new _FSFlag__WEBPACK_IMPORTED_MODULE_4__.FSFlag(key, state));
251
+ });
252
+ return new _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_2__.FSFlagCollection({
253
+ flags
254
+ });
255
+ }
256
+ return visitor.getFlags();
257
+ }
258
+ return {
259
+ visitorId: visitor === null || visitor === void 0 ? void 0 : visitor.visitorId,
260
+ anonymousId: visitor === null || visitor === void 0 ? void 0 : visitor.anonymousId,
261
+ context: {
262
+ ...(visitor === null || visitor === void 0 ? void 0 : visitor.context)
263
+ },
264
+ hasConsented: visitor === null || visitor === void 0 ? void 0 : visitor.hasConsented,
265
+ sdkStatus: _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_2__.Flagship.getStatus(),
266
+ fetchStatus: visitor === null || visitor === void 0 ? void 0 : visitor.fetchStatus,
267
+ setConsent,
268
+ updateContext: fsUpdateContext,
269
+ clearContext: fsClearContext,
270
+ authenticate: fsAuthenticate,
271
+ unauthenticate: fsUnauthenticate,
272
+ sendHits: fsSendHit,
273
+ getFlag,
274
+ fetchFlags,
275
+ close,
276
+ getFlags
277
+ };
278
+ };
279
+
280
+ /***/ }),
281
+
282
+ /***/ "./src/FlagshipProvider.tsx":
283
+ /*!**********************************!*\
284
+ !*** ./src/FlagshipProvider.tsx ***!
285
+ \**********************************/
286
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
287
+
288
+ __webpack_require__.r(__webpack_exports__);
289
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
290
+ /* harmony export */ FlagshipProvider: () => (/* binding */ FlagshipProvider)
291
+ /* harmony export */ });
292
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
293
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
294
+ /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @flagship.io/js-sdk */ "@flagship.io/js-sdk");
295
+ /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__);
296
+ /* harmony import */ var _FlagshipContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./FlagshipContext */ "./src/FlagshipContext.tsx");
297
+ /* harmony import */ var _internalType__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./internalType */ "./src/internalType.ts");
298
+ /* harmony import */ var _sdkVersion__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./sdkVersion */ "./src/sdkVersion.ts");
299
+ /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./src/utils.ts");
300
+ 'use client';
301
+
302
+ // eslint-disable-next-line no-use-before-define
303
+
304
+
305
+
306
+
307
+
308
+
309
+ function FlagshipProvider({
152
310
  children,
153
311
  envId,
154
312
  apiKey,
155
313
  decisionMode = _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.DecisionMode.DECISION_API,
156
314
  visitorData,
157
- onInitStart,
158
- onInitDone,
159
315
  loadingComponent,
160
- statusChangedCallback,
316
+ onSdkStatusChanged,
161
317
  onBucketingUpdated,
162
- onUpdate,
163
318
  initialCampaigns,
164
- initialModifications,
165
319
  initialFlagsData,
166
320
  fetchFlagsOnBucketingUpdated,
167
321
  hitDeduplicationTime = 2,
168
322
  fetchNow = true,
169
323
  language = 1,
170
324
  sdkVersion = _sdkVersion__WEBPACK_IMPORTED_MODULE_2__.version,
325
+ onFetchFlagsStatusChanged,
326
+ shouldSaveInstance,
171
327
  ...props
172
- }) => {
328
+ }) {
173
329
  var _state$config;
174
-
175
- let modifications = new Map();
176
-
177
- if (initialFlagsData && initialFlagsData.forEach) {
178
- initialFlagsData.forEach(flag => {
179
- modifications.set(flag.key, flag);
180
- });
181
- } else if (initialModifications && initialModifications.forEach) {
182
- initialModifications.forEach(modification => {
183
- modifications.set(modification.key, modification);
184
- });
185
- } else if (initialCampaigns) {
186
- modifications = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.getModificationsFromCampaigns)(initialCampaigns);
187
- }
188
-
189
- const [state, setState] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)({ ...initStat,
190
- modifications
330
+ const flags = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.extractFlagsMap)(initialFlagsData, initialCampaigns);
331
+ const [state, setState] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)({
332
+ ..._FlagshipContext__WEBPACK_IMPORTED_MODULE_4__.initStat,
333
+ flags,
334
+ hasVisitorData: !!visitorData
191
335
  });
192
336
  const [lastModified, setLastModified] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)();
193
337
  const stateRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
194
338
  stateRef.current = state;
195
- (0,_utils__WEBPACK_IMPORTED_MODULE_3__.useNonInitialEffect)(() => {
196
- if (fetchFlagsOnBucketingUpdated) {
197
- var _state$visitor;
198
339
 
199
- (_state$visitor = state.visitor) === null || _state$visitor === void 0 ? void 0 : _state$visitor.fetchFlags();
200
- }
201
- }, [lastModified]);
202
- (0,_utils__WEBPACK_IMPORTED_MODULE_3__.useNonInitialEffect)(() => {
203
- updateVisitor();
204
- }, [JSON.stringify(visitorData)]);
205
- (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
206
- initSdk();
207
- }, [envId, apiKey, decisionMode]);
208
- (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
209
- window.addEventListener(_internalType__WEBPACK_IMPORTED_MODULE_4__.INTERNAL_EVENTS.FsTriggerRendering, onVariationsForced);
210
- return () => window.removeEventListener(_internalType__WEBPACK_IMPORTED_MODULE_4__.INTERNAL_EVENTS.FsTriggerRendering, onVariationsForced);
211
- }, [(_state$config = state.config) === null || _state$config === void 0 ? void 0 : _state$config.isQAModeEnabled]);
212
-
213
- const onVariationsForced = e => {
214
- const {
215
- detail
216
- } = e;
217
-
218
- if (detail.forcedReFetchFlags) {
219
- var _stateRef$current, _stateRef$current$vis;
340
+ // #region functions
220
341
 
221
- (_stateRef$current = stateRef.current) === null || _stateRef$current === void 0 ? void 0 : (_stateRef$current$vis = _stateRef$current.visitor) === null || _stateRef$current$vis === void 0 ? void 0 : _stateRef$current$vis.fetchFlags();
222
- } else {
223
- setState(state => ({ ...state,
224
- toggleForcedVariations: !state.toggleForcedVariations
225
- }));
342
+ const onBucketingLastModified = lastUpdate => {
343
+ if (onBucketingUpdated) {
344
+ onBucketingUpdated(lastUpdate);
226
345
  }
346
+ setLastModified(lastUpdate);
227
347
  };
228
-
229
- function initializeState(param) {
230
- const newStatus = {
231
- isSdkReady: param.isSdkReady,
232
- isLoading: param.isLoading,
233
- isVisitorDefined: !!param.fsVisitor,
234
- lastRefresh: new Date().toISOString()
235
- };
236
- setState(currentState => {
237
- if (!currentState.status.firstInitSuccess) {
238
- newStatus.firstInitSuccess = new Date().toISOString();
239
- }
240
-
241
- return { ...currentState,
242
- visitor: param.fsVisitor,
243
- modifications: param.fsVisitor.modifications,
244
- config: _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.Flagship.getConfig(),
245
- status: { ...currentState.status,
246
- ...newStatus
247
- }
248
- };
348
+ const statusChanged = status => {
349
+ if (onSdkStatusChanged) {
350
+ onSdkStatusChanged(status);
351
+ }
352
+ switch (status) {
353
+ case _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.FSSdkStatus.SDK_PANIC:
354
+ case _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.FSSdkStatus.SDK_INITIALIZED:
355
+ createVisitor();
356
+ break;
357
+ case _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.FSSdkStatus.SDK_NOT_INITIALIZED:
358
+ setState(prev => ({
359
+ ...prev,
360
+ config: _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1___default().getConfig(),
361
+ isInitializing: false
362
+ }));
363
+ break;
364
+ }
365
+ };
366
+ const initSdk = () => {
367
+ _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1___default().start(envId, apiKey, {
368
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
369
+ decisionMode: decisionMode,
370
+ fetchNow,
371
+ onSdkStatusChanged: statusChanged,
372
+ onBucketingUpdated: onBucketingLastModified,
373
+ hitDeduplicationTime,
374
+ language,
375
+ sdkVersion,
376
+ ...props
249
377
  });
250
- return newStatus;
251
- } // eslint-disable-next-line @typescript-eslint/no-explicit-any
252
-
378
+ };
379
+ function initializeState(param) {
380
+ setState(currentState => ({
381
+ ...currentState,
382
+ visitor: param.fsVisitor,
383
+ config: _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1___default().getConfig(),
384
+ isInitializing: false,
385
+ hasVisitorData: !!visitorData
386
+ }));
387
+ }
253
388
 
389
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
254
390
  const onVisitorReady = (fsVisitor, error) => {
255
391
  if (error) {
256
- (0,_utils__WEBPACK_IMPORTED_MODULE_3__.logError)(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.Flagship.getConfig(), error.message || error, 'onReady');
257
- return;
392
+ (0,_utils__WEBPACK_IMPORTED_MODULE_3__.logError)(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1___default().getConfig(), error.message || error, 'onReady');
258
393
  }
259
-
260
- const newStatus = initializeState({
261
- fsVisitor,
262
- isSdkReady: true,
263
- isLoading: false
394
+ initializeState({
395
+ fsVisitor
264
396
  });
265
-
266
- if (onUpdate) {
267
- onUpdate({
268
- fsModifications: fsVisitor.modifications,
269
- config: _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.Flagship.getConfig(),
270
- status: newStatus
271
- });
272
- }
273
397
  };
274
-
275
- function updateVisitor() {
398
+ const createVisitor = () => {
276
399
  if (!visitorData) {
277
400
  return;
278
401
  }
279
-
280
- if (!state.visitor || state.visitor.visitorId !== visitorData.id && (!visitorData.isAuthenticated || visitorData.isAuthenticated && state.visitor.anonymousId)) {
281
- createVisitor();
282
- return;
283
- }
284
-
285
- if (visitorData.hasConsented !== state.visitor.hasConsented) {
402
+ const fsVisitor = _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1___default().newVisitor({
403
+ visitorId: visitorData.id,
404
+ context: visitorData.context,
405
+ isAuthenticated: visitorData.isAuthenticated,
406
+ hasConsented: visitorData.hasConsented,
407
+ initialCampaigns,
408
+ initialFlagsData,
409
+ onFetchFlagsStatusChanged,
410
+ shouldSaveInstance
411
+ });
412
+ fsVisitor === null || fsVisitor === void 0 || fsVisitor.on('ready', error => {
413
+ onVisitorReady(fsVisitor, error);
414
+ });
415
+ if (!fetchNow) {
416
+ initializeState({
417
+ fsVisitor
418
+ });
419
+ }
420
+ };
421
+ function updateVisitor() {
422
+ if (!visitorData) {
423
+ return;
424
+ }
425
+ if (!state.visitor || state.visitor.visitorId !== visitorData.id && (!visitorData.isAuthenticated || visitorData.isAuthenticated && state.visitor.anonymousId)) {
426
+ createVisitor();
427
+ return;
428
+ }
429
+ if (visitorData.hasConsented !== state.visitor.hasConsented) {
286
430
  var _visitorData$hasConse;
431
+ state.visitor.setConsent((_visitorData$hasConse = visitorData.hasConsented) !== null && _visitorData$hasConse !== void 0 ? _visitorData$hasConse : true);
432
+ }
433
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
434
+ state.visitor.updateContext(visitorData.context);
435
+ if (!state.visitor.anonymousId && visitorData.isAuthenticated) {
436
+ state.visitor.authenticate(visitorData.id);
437
+ }
438
+ if (state.visitor.anonymousId && !visitorData.isAuthenticated) {
439
+ state.visitor.unauthenticate();
440
+ }
441
+ state.visitor.fetchFlags();
442
+ }
443
+
444
+ // #endregion
445
+
446
+ (0,_utils__WEBPACK_IMPORTED_MODULE_3__.useNonInitialEffect)(() => {
447
+ if (fetchFlagsOnBucketingUpdated) {
448
+ var _state$visitor;
449
+ (_state$visitor = state.visitor) === null || _state$visitor === void 0 || _state$visitor.fetchFlags();
450
+ }
451
+ }, [lastModified]);
452
+ (0,_utils__WEBPACK_IMPORTED_MODULE_3__.useNonInitialEffect)(() => {
453
+ updateVisitor();
454
+ }, [JSON.stringify(visitorData)]);
455
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
456
+ initSdk();
457
+ }, [envId, apiKey, decisionMode]);
458
+ const handleDisplay = () => {
459
+ const isFirstInit = !state.visitor;
460
+ if (state.isInitializing && loadingComponent && isFirstInit && fetchNow) {
461
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, loadingComponent);
462
+ }
463
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, children);
464
+ };
465
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
466
+ window.addEventListener(_internalType__WEBPACK_IMPORTED_MODULE_5__.INTERNAL_EVENTS.FsTriggerRendering, onVariationsForced);
467
+ return () => window.removeEventListener(_internalType__WEBPACK_IMPORTED_MODULE_5__.INTERNAL_EVENTS.FsTriggerRendering, onVariationsForced);
468
+ }, [(_state$config = state.config) === null || _state$config === void 0 ? void 0 : _state$config.isQAModeEnabled]);
469
+ const onVariationsForced = e => {
470
+ const {
471
+ detail
472
+ } = e;
473
+ if (detail.forcedReFetchFlags) {
474
+ var _stateRef$current;
475
+ (_stateRef$current = stateRef.current) === null || _stateRef$current === void 0 || (_stateRef$current = _stateRef$current.visitor) === null || _stateRef$current === void 0 || _stateRef$current.fetchFlags();
476
+ } else {
477
+ setState(state => ({
478
+ ...state,
479
+ toggleForcedVariations: !state.toggleForcedVariations
480
+ }));
481
+ }
482
+ };
483
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_FlagshipContext__WEBPACK_IMPORTED_MODULE_4__.FlagshipContext.Provider, {
484
+ value: {
485
+ state,
486
+ setState
487
+ }
488
+ }, handleDisplay());
489
+ }
490
+
491
+ /***/ }),
492
+
493
+ /***/ "./src/constants.ts":
494
+ /*!**************************!*\
495
+ !*** ./src/constants.ts ***!
496
+ \**************************/
497
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
498
+
499
+ __webpack_require__.r(__webpack_exports__);
500
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
501
+ /* harmony export */ GET_FLAG_CAST_ERROR: () => (/* binding */ GET_FLAG_CAST_ERROR),
502
+ /* harmony export */ GET_METADATA_CAST_ERROR: () => (/* binding */ GET_METADATA_CAST_ERROR),
503
+ /* harmony export */ noVisitorDefault: () => (/* binding */ noVisitorDefault),
504
+ /* harmony export */ noVisitorMessage: () => (/* binding */ noVisitorMessage)
505
+ /* harmony export */ });
506
+ const noVisitorMessage = 'flagship Visitor not initialized.';
507
+ const noVisitorDefault = 'fsVisitor not initialized, returns default value';
508
+ const GET_FLAG_CAST_ERROR = 'Flag for key {0} has a different type. Default value is returned.';
509
+ const GET_METADATA_CAST_ERROR = 'Flag for key {0} has a different type with defaultValue, an empty metadata object is returned';
510
+
511
+ /***/ }),
512
+
513
+ /***/ "./src/internalType.ts":
514
+ /*!*****************************!*\
515
+ !*** ./src/internalType.ts ***!
516
+ \*****************************/
517
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
518
+
519
+ __webpack_require__.r(__webpack_exports__);
520
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
521
+ /* harmony export */ INTERNAL_EVENTS: () => (/* binding */ INTERNAL_EVENTS)
522
+ /* harmony export */ });
523
+ let INTERNAL_EVENTS = /*#__PURE__*/function (INTERNAL_EVENTS) {
524
+ INTERNAL_EVENTS["FsTriggerRendering"] = "FS_TRIGGER_RENDERING";
525
+ return INTERNAL_EVENTS;
526
+ }({});
527
+
528
+ /***/ }),
529
+
530
+ /***/ "./src/sdkVersion.ts":
531
+ /*!***************************!*\
532
+ !*** ./src/sdkVersion.ts ***!
533
+ \***************************/
534
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
535
+
536
+ __webpack_require__.r(__webpack_exports__);
537
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
538
+ /* harmony export */ version: () => (/* binding */ version)
539
+ /* harmony export */ });
540
+ // Generated by genversion.
541
+ const version = '4.0.0-alpha.2';
542
+
543
+ /***/ }),
544
+
545
+ /***/ "./src/utils.ts":
546
+ /*!**********************!*\
547
+ !*** ./src/utils.ts ***!
548
+ \**********************/
549
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
550
+
551
+ __webpack_require__.r(__webpack_exports__);
552
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
553
+ /* harmony export */ extractFlagsMap: () => (/* binding */ extractFlagsMap),
554
+ /* harmony export */ getFlagsFromCampaigns: () => (/* binding */ getFlagsFromCampaigns),
555
+ /* harmony export */ hasSameType: () => (/* binding */ hasSameType),
556
+ /* harmony export */ hexToValue: () => (/* binding */ hexToValue),
557
+ /* harmony export */ logError: () => (/* binding */ logError),
558
+ /* harmony export */ logInfo: () => (/* binding */ logInfo),
559
+ /* harmony export */ logWarn: () => (/* binding */ logWarn),
560
+ /* harmony export */ sprintf: () => (/* binding */ sprintf),
561
+ /* harmony export */ useNonInitialEffect: () => (/* binding */ useNonInitialEffect),
562
+ /* harmony export */ uuidV4: () => (/* binding */ uuidV4)
563
+ /* harmony export */ });
564
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
565
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
566
+ /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @flagship.io/js-sdk */ "@flagship.io/js-sdk");
567
+ /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__);
568
+ 'use client';
569
+
570
+
571
+
572
+ function logError(config, message, tag) {
573
+ if (!config || !config.logLevel || config.logLevel < _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.LogLevel.ERROR) {
574
+ return;
575
+ }
576
+ if (typeof config.onLog === 'function') {
577
+ config.onLog(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.LogLevel.ERROR, tag, message);
578
+ }
579
+ if (config.logManager && typeof config.logManager.error === 'function') {
580
+ config.logManager.error(message, tag);
581
+ }
582
+ }
583
+ function logInfo(config, message, tag) {
584
+ if (!config || !config.logLevel || config.logLevel < _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.LogLevel.INFO) {
585
+ return;
586
+ }
587
+ if (typeof config.onLog === 'function') {
588
+ config.onLog(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.LogLevel.INFO, tag, message);
589
+ }
590
+ if (config.logManager && typeof config.logManager.info === 'function') {
591
+ config.logManager.info(message, tag);
592
+ }
593
+ }
594
+ function logWarn(config, message, tag) {
595
+ if (!config || !config.logLevel || config.logLevel < _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.LogLevel.WARNING) {
596
+ return;
597
+ }
598
+ if (typeof config.onLog === 'function') {
599
+ config.onLog(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.LogLevel.WARNING, tag, message);
600
+ }
601
+ if (config.logManager && typeof config.logManager.warning === 'function') {
602
+ config.logManager.warning(message, tag);
603
+ }
604
+ }
605
+ const getFlagsFromCampaigns = campaigns => {
606
+ const flags = new Map();
607
+ if (!campaigns || !Array.isArray(campaigns)) {
608
+ return flags;
609
+ }
610
+ campaigns.forEach(campaign => {
611
+ const object = campaign.variation.modifications.value;
612
+ for (const key in object) {
613
+ const value = object[key];
614
+ flags.set(key, {
615
+ key,
616
+ campaignId: campaign.id,
617
+ campaignName: campaign.name || '',
618
+ variationGroupId: campaign.variationGroupId,
619
+ variationGroupName: campaign.variationGroupName || '',
620
+ variationId: campaign.variation.id,
621
+ variationName: campaign.variation.name || '',
622
+ isReference: campaign.variation.reference,
623
+ slug: campaign.slug || '',
624
+ value
625
+ });
626
+ }
627
+ });
628
+ return flags;
629
+ };
630
+ function uuidV4() {
631
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (char) {
632
+ const rand = Math.random() * 16 | 0;
633
+ const value = char === 'x' ? rand : rand & 0x3 | 0x8;
634
+ return value.toString(16);
635
+ });
636
+ }
637
+ function useNonInitialEffect(effect, deps) {
638
+ const initialRender = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(true);
639
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
640
+ if (initialRender.current) {
641
+ initialRender.current = false;
642
+ return;
643
+ }
644
+ if (typeof effect === 'function') {
645
+ return effect();
646
+ }
647
+ }, deps);
648
+ }
649
+ function hasSameType(flagValue, defaultValue) {
650
+ if (typeof flagValue !== typeof defaultValue) {
651
+ return false;
652
+ }
653
+ if (typeof flagValue === 'object' && typeof defaultValue === 'object' && Array.isArray(flagValue) !== Array.isArray(defaultValue)) {
654
+ return false;
655
+ }
656
+ return true;
657
+ }
658
+
659
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
660
+ function sprintf(format, ...value) {
661
+ let formatted = format;
662
+ for (let i = 0; i < value.length; i++) {
663
+ const element = value[i];
664
+ formatted = formatted.replace(new RegExp(`\\{${i}\\}`, 'g'), element);
665
+ }
666
+ return formatted;
667
+ }
668
+ function hexToValue(hex, config) {
669
+ if (typeof hex !== 'string') {
670
+ logError(config, `Invalid hex string: ${hex}`, 'hexToValue');
671
+ return null;
672
+ }
673
+ let jsonString = '';
674
+ for (let i = 0; i < hex.length; i += 2) {
675
+ const hexChar = hex.slice(i, i + 2);
676
+ const charCode = parseInt(hexChar, 16);
677
+ if (isNaN(charCode)) {
678
+ logError(config, `Invalid hex character: ${hexChar}`, 'hexToValue');
679
+ return null;
680
+ }
681
+ jsonString += String.fromCharCode(charCode);
682
+ }
683
+ try {
684
+ const value = JSON.parse(jsonString);
685
+ return value;
686
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
687
+ } catch (error) {
688
+ logError(config, `Error while parsing JSON: ${error === null || error === void 0 ? void 0 : error.message}`, 'hexToValue');
689
+ return null;
690
+ }
691
+ }
692
+ function extractFlagsMap(initialFlagsData, initialCampaigns) {
693
+ let flags = new Map();
694
+ if (Array.isArray(initialFlagsData)) {
695
+ initialFlagsData.forEach(flag => {
696
+ var _hexToValue;
697
+ flags.set(flag.key, {
698
+ key: flag.key,
699
+ campaignId: flag.campaignId,
700
+ campaignName: flag.campaignName,
701
+ variationGroupId: flag.variationGroupId,
702
+ variationGroupName: flag.variationGroupName,
703
+ variationId: flag.variationId,
704
+ variationName: flag.variationName,
705
+ isReference: flag.isReference,
706
+ campaignType: flag.campaignType,
707
+ slug: flag.slug,
708
+ value: (_hexToValue = hexToValue(flag.hex, _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1___default().getConfig())) === null || _hexToValue === void 0 ? void 0 : _hexToValue.v
709
+ });
710
+ });
711
+ } else if (initialCampaigns) {
712
+ flags = getFlagsFromCampaigns(initialCampaigns);
713
+ }
714
+ return flags;
715
+ }
716
+
717
+ /***/ }),
718
+
719
+ /***/ "@flagship.io/js-sdk":
720
+ /*!**************************************!*\
721
+ !*** external "@flagship.io/js-sdk" ***!
722
+ \**************************************/
723
+ /***/ ((module) => {
724
+
725
+ module.exports = require("@flagship.io/js-sdk");
726
+
727
+ /***/ }),
728
+
729
+ /***/ "react":
730
+ /*!************************!*\
731
+ !*** external "react" ***!
732
+ \************************/
733
+ /***/ ((module) => {
734
+
735
+ module.exports = require("react");
736
+
737
+ /***/ }),
738
+
739
+ /***/ "./node_modules/core-js/internals/a-callable.js":
740
+ /*!******************************************************!*\
741
+ !*** ./node_modules/core-js/internals/a-callable.js ***!
742
+ \******************************************************/
743
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
744
+
745
+
746
+ var isCallable = __webpack_require__(/*! ../internals/is-callable */ "./node_modules/core-js/internals/is-callable.js");
747
+ var tryToString = __webpack_require__(/*! ../internals/try-to-string */ "./node_modules/core-js/internals/try-to-string.js");
748
+
749
+ var $TypeError = TypeError;
750
+
751
+ // `Assert: IsCallable(argument) is true`
752
+ module.exports = function (argument) {
753
+ if (isCallable(argument)) return argument;
754
+ throw new $TypeError(tryToString(argument) + ' is not a function');
755
+ };
756
+
757
+
758
+ /***/ }),
759
+
760
+ /***/ "./node_modules/core-js/internals/an-object.js":
761
+ /*!*****************************************************!*\
762
+ !*** ./node_modules/core-js/internals/an-object.js ***!
763
+ \*****************************************************/
764
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
765
+
766
+
767
+ var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
768
+
769
+ var $String = String;
770
+ var $TypeError = TypeError;
771
+
772
+ // `Assert: Type(argument) is Object`
773
+ module.exports = function (argument) {
774
+ if (isObject(argument)) return argument;
775
+ throw new $TypeError($String(argument) + ' is not an object');
776
+ };
777
+
778
+
779
+ /***/ }),
780
+
781
+ /***/ "./node_modules/core-js/internals/create-non-enumerable-property.js":
782
+ /*!**************************************************************************!*\
783
+ !*** ./node_modules/core-js/internals/create-non-enumerable-property.js ***!
784
+ \**************************************************************************/
785
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
786
+
787
+
788
+ var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
789
+ var definePropertyModule = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js");
790
+ var createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ "./node_modules/core-js/internals/create-property-descriptor.js");
791
+
792
+ module.exports = DESCRIPTORS ? function (object, key, value) {
793
+ return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
794
+ } : function (object, key, value) {
795
+ object[key] = value;
796
+ return object;
797
+ };
798
+
799
+
800
+ /***/ }),
801
+
802
+ /***/ "./node_modules/core-js/internals/create-property-descriptor.js":
803
+ /*!**********************************************************************!*\
804
+ !*** ./node_modules/core-js/internals/create-property-descriptor.js ***!
805
+ \**********************************************************************/
806
+ /***/ ((module) => {
807
+
808
+
809
+ module.exports = function (bitmap, value) {
810
+ return {
811
+ enumerable: !(bitmap & 1),
812
+ configurable: !(bitmap & 2),
813
+ writable: !(bitmap & 4),
814
+ value: value
815
+ };
816
+ };
817
+
818
+
819
+ /***/ }),
820
+
821
+ /***/ "./node_modules/core-js/internals/define-built-in-accessor.js":
822
+ /*!********************************************************************!*\
823
+ !*** ./node_modules/core-js/internals/define-built-in-accessor.js ***!
824
+ \********************************************************************/
825
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
826
+
827
+
828
+ var makeBuiltIn = __webpack_require__(/*! ../internals/make-built-in */ "./node_modules/core-js/internals/make-built-in.js");
829
+ var defineProperty = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js");
830
+
831
+ module.exports = function (target, name, descriptor) {
832
+ if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
833
+ if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
834
+ return defineProperty.f(target, name, descriptor);
835
+ };
836
+
837
+
838
+ /***/ }),
839
+
840
+ /***/ "./node_modules/core-js/internals/define-global-property.js":
841
+ /*!******************************************************************!*\
842
+ !*** ./node_modules/core-js/internals/define-global-property.js ***!
843
+ \******************************************************************/
844
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
845
+
846
+
847
+ var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
848
+
849
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
850
+ var defineProperty = Object.defineProperty;
851
+
852
+ module.exports = function (key, value) {
853
+ try {
854
+ defineProperty(global, key, { value: value, configurable: true, writable: true });
855
+ } catch (error) {
856
+ global[key] = value;
857
+ } return value;
858
+ };
859
+
860
+
861
+ /***/ }),
862
+
863
+ /***/ "./node_modules/core-js/internals/descriptors.js":
864
+ /*!*******************************************************!*\
865
+ !*** ./node_modules/core-js/internals/descriptors.js ***!
866
+ \*******************************************************/
867
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
868
+
869
+
870
+ var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
871
+
872
+ // Detect IE8's incomplete defineProperty implementation
873
+ module.exports = !fails(function () {
874
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
875
+ return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
876
+ });
877
+
878
+
879
+ /***/ }),
880
+
881
+ /***/ "./node_modules/core-js/internals/document-create-element.js":
882
+ /*!*******************************************************************!*\
883
+ !*** ./node_modules/core-js/internals/document-create-element.js ***!
884
+ \*******************************************************************/
885
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
886
+
887
+
888
+ var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
889
+ var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
890
+
891
+ var document = global.document;
892
+ // typeof document.createElement is 'object' in old IE
893
+ var EXISTS = isObject(document) && isObject(document.createElement);
894
+
895
+ module.exports = function (it) {
896
+ return EXISTS ? document.createElement(it) : {};
897
+ };
898
+
899
+
900
+ /***/ }),
901
+
902
+ /***/ "./node_modules/core-js/internals/engine-user-agent.js":
903
+ /*!*************************************************************!*\
904
+ !*** ./node_modules/core-js/internals/engine-user-agent.js ***!
905
+ \*************************************************************/
906
+ /***/ ((module) => {
907
+
908
+
909
+ module.exports = typeof navigator != 'undefined' && String(navigator.userAgent) || '';
910
+
911
+
912
+ /***/ }),
913
+
914
+ /***/ "./node_modules/core-js/internals/engine-v8-version.js":
915
+ /*!*************************************************************!*\
916
+ !*** ./node_modules/core-js/internals/engine-v8-version.js ***!
917
+ \*************************************************************/
918
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
919
+
920
+
921
+ var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
922
+ var userAgent = __webpack_require__(/*! ../internals/engine-user-agent */ "./node_modules/core-js/internals/engine-user-agent.js");
923
+
924
+ var process = global.process;
925
+ var Deno = global.Deno;
926
+ var versions = process && process.versions || Deno && Deno.version;
927
+ var v8 = versions && versions.v8;
928
+ var match, version;
929
+
930
+ if (v8) {
931
+ match = v8.split('.');
932
+ // in old Chrome, versions of V8 isn't V8 = Chrome / 10
933
+ // but their correct versions are not interesting for us
934
+ version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
935
+ }
936
+
937
+ // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
938
+ // so check `userAgent` even if `.v8` exists, but 0
939
+ if (!version && userAgent) {
940
+ match = userAgent.match(/Edge\/(\d+)/);
941
+ if (!match || match[1] >= 74) {
942
+ match = userAgent.match(/Chrome\/(\d+)/);
943
+ if (match) version = +match[1];
944
+ }
945
+ }
946
+
947
+ module.exports = version;
948
+
949
+
950
+ /***/ }),
951
+
952
+ /***/ "./node_modules/core-js/internals/fails.js":
953
+ /*!*************************************************!*\
954
+ !*** ./node_modules/core-js/internals/fails.js ***!
955
+ \*************************************************/
956
+ /***/ ((module) => {
957
+
958
+
959
+ module.exports = function (exec) {
960
+ try {
961
+ return !!exec();
962
+ } catch (error) {
963
+ return true;
964
+ }
965
+ };
966
+
967
+
968
+ /***/ }),
969
+
970
+ /***/ "./node_modules/core-js/internals/function-bind-native.js":
971
+ /*!****************************************************************!*\
972
+ !*** ./node_modules/core-js/internals/function-bind-native.js ***!
973
+ \****************************************************************/
974
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
975
+
976
+
977
+ var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
978
+
979
+ module.exports = !fails(function () {
980
+ // eslint-disable-next-line es/no-function-prototype-bind -- safe
981
+ var test = (function () { /* empty */ }).bind();
982
+ // eslint-disable-next-line no-prototype-builtins -- safe
983
+ return typeof test != 'function' || test.hasOwnProperty('prototype');
984
+ });
985
+
986
+
987
+ /***/ }),
988
+
989
+ /***/ "./node_modules/core-js/internals/function-call.js":
990
+ /*!*********************************************************!*\
991
+ !*** ./node_modules/core-js/internals/function-call.js ***!
992
+ \*********************************************************/
993
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
994
+
995
+
996
+ var NATIVE_BIND = __webpack_require__(/*! ../internals/function-bind-native */ "./node_modules/core-js/internals/function-bind-native.js");
997
+
998
+ var call = Function.prototype.call;
999
+
1000
+ module.exports = NATIVE_BIND ? call.bind(call) : function () {
1001
+ return call.apply(call, arguments);
1002
+ };
1003
+
1004
+
1005
+ /***/ }),
1006
+
1007
+ /***/ "./node_modules/core-js/internals/function-name.js":
1008
+ /*!*********************************************************!*\
1009
+ !*** ./node_modules/core-js/internals/function-name.js ***!
1010
+ \*********************************************************/
1011
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1012
+
1013
+
1014
+ var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
1015
+ var hasOwn = __webpack_require__(/*! ../internals/has-own-property */ "./node_modules/core-js/internals/has-own-property.js");
1016
+
1017
+ var FunctionPrototype = Function.prototype;
1018
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1019
+ var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
1020
+
1021
+ var EXISTS = hasOwn(FunctionPrototype, 'name');
1022
+ // additional protection from minified / mangled / dropped function names
1023
+ var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
1024
+ var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
1025
+
1026
+ module.exports = {
1027
+ EXISTS: EXISTS,
1028
+ PROPER: PROPER,
1029
+ CONFIGURABLE: CONFIGURABLE
1030
+ };
1031
+
1032
+
1033
+ /***/ }),
1034
+
1035
+ /***/ "./node_modules/core-js/internals/function-uncurry-this.js":
1036
+ /*!*****************************************************************!*\
1037
+ !*** ./node_modules/core-js/internals/function-uncurry-this.js ***!
1038
+ \*****************************************************************/
1039
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1040
+
1041
+
1042
+ var NATIVE_BIND = __webpack_require__(/*! ../internals/function-bind-native */ "./node_modules/core-js/internals/function-bind-native.js");
287
1043
 
288
- state.visitor.setConsent((_visitorData$hasConse = visitorData.hasConsented) !== null && _visitorData$hasConse !== void 0 ? _visitorData$hasConse : true);
289
- } // eslint-disable-next-line @typescript-eslint/no-explicit-any
1044
+ var FunctionPrototype = Function.prototype;
1045
+ var call = FunctionPrototype.call;
1046
+ var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);
290
1047
 
1048
+ module.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) {
1049
+ return function () {
1050
+ return call.apply(fn, arguments);
1051
+ };
1052
+ };
291
1053
 
292
- state.visitor.updateContext(visitorData.context);
293
1054
 
294
- if (!state.visitor.anonymousId && visitorData.isAuthenticated) {
295
- state.visitor.authenticate(visitorData.id);
296
- }
1055
+ /***/ }),
297
1056
 
298
- if (state.visitor.anonymousId && !visitorData.isAuthenticated) {
299
- state.visitor.unauthenticate();
300
- }
1057
+ /***/ "./node_modules/core-js/internals/get-built-in.js":
1058
+ /*!********************************************************!*\
1059
+ !*** ./node_modules/core-js/internals/get-built-in.js ***!
1060
+ \********************************************************/
1061
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
301
1062
 
302
- state.visitor.fetchFlags();
303
- }
304
1063
 
305
- const createVisitor = () => {
306
- if (!visitorData) {
307
- return;
308
- }
1064
+ var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
1065
+ var isCallable = __webpack_require__(/*! ../internals/is-callable */ "./node_modules/core-js/internals/is-callable.js");
309
1066
 
310
- const fsVisitor = _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.Flagship.newVisitor({
311
- visitorId: visitorData.id,
312
- context: visitorData.context,
313
- isAuthenticated: visitorData.isAuthenticated,
314
- hasConsented: visitorData.hasConsented,
315
- initialCampaigns,
316
- initialModifications,
317
- initialFlagsData
318
- });
319
- fsVisitor === null || fsVisitor === void 0 ? void 0 : fsVisitor.on('ready', error => {
320
- onVisitorReady(fsVisitor, error);
321
- });
1067
+ var aFunction = function (argument) {
1068
+ return isCallable(argument) ? argument : undefined;
1069
+ };
322
1070
 
323
- if (!fetchNow) {
324
- initializeState({
325
- fsVisitor,
326
- isSdkReady: true,
327
- isLoading: false
328
- });
329
- }
330
- };
1071
+ module.exports = function (namespace, method) {
1072
+ return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method];
1073
+ };
331
1074
 
332
- const statusChanged = status => {
333
- if (statusChangedCallback) {
334
- statusChangedCallback(status);
335
- }
336
1075
 
337
- switch (status) {
338
- case _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.FlagshipStatus.STARTING:
339
- if (status === _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.FlagshipStatus.STARTING && onInitStart) {
340
- onInitStart();
341
- }
1076
+ /***/ }),
342
1077
 
343
- break;
1078
+ /***/ "./node_modules/core-js/internals/get-method.js":
1079
+ /*!******************************************************!*\
1080
+ !*** ./node_modules/core-js/internals/get-method.js ***!
1081
+ \******************************************************/
1082
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
344
1083
 
345
- case _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.FlagshipStatus.READY_PANIC_ON:
346
- case _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.FlagshipStatus.READY:
347
- if (onInitDone) {
348
- onInitDone();
349
- }
350
1084
 
351
- createVisitor();
352
- break;
1085
+ var aCallable = __webpack_require__(/*! ../internals/a-callable */ "./node_modules/core-js/internals/a-callable.js");
1086
+ var isNullOrUndefined = __webpack_require__(/*! ../internals/is-null-or-undefined */ "./node_modules/core-js/internals/is-null-or-undefined.js");
353
1087
 
354
- case _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.FlagshipStatus.NOT_INITIALIZED:
355
- setState(prev => ({ ...prev,
356
- status: { ...prev.status,
357
- isLoading: false
358
- },
359
- config: _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.Flagship.getConfig()
360
- }));
361
- break;
362
- }
363
- };
1088
+ // `GetMethod` abstract operation
1089
+ // https://tc39.es/ecma262/#sec-getmethod
1090
+ module.exports = function (V, P) {
1091
+ var func = V[P];
1092
+ return isNullOrUndefined(func) ? undefined : aCallable(func);
1093
+ };
364
1094
 
365
- const onBucketingLastModified = lastUpdate => {
366
- if (onBucketingUpdated) {
367
- onBucketingUpdated(lastUpdate);
368
- }
369
1095
 
370
- setLastModified(lastUpdate);
371
- };
1096
+ /***/ }),
372
1097
 
373
- const initSdk = () => {
374
- _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.Flagship.start(envId, apiKey, {
375
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
376
- decisionMode: decisionMode,
377
- fetchNow,
378
- statusChangedCallback: statusChanged,
379
- onBucketingUpdated: onBucketingLastModified,
380
- hitDeduplicationTime,
381
- language,
382
- sdkVersion,
383
- ...props
384
- });
385
- };
1098
+ /***/ "./node_modules/core-js/internals/global.js":
1099
+ /*!**************************************************!*\
1100
+ !*** ./node_modules/core-js/internals/global.js ***!
1101
+ \**************************************************/
1102
+ /***/ (function(module) {
386
1103
 
387
- const handleDisplay = () => {
388
- const isFirstInit = !state.visitor;
389
1104
 
390
- if (state.status.isLoading && loadingComponent && isFirstInit && fetchNow) {
391
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, loadingComponent);
392
- }
1105
+ var check = function (it) {
1106
+ return it && it.Math === Math && it;
1107
+ };
393
1108
 
394
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, children);
395
- };
1109
+ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
1110
+ module.exports =
1111
+ // eslint-disable-next-line es/no-global-this -- safe
1112
+ check(typeof globalThis == 'object' && globalThis) ||
1113
+ check(typeof window == 'object' && window) ||
1114
+ // eslint-disable-next-line no-restricted-globals -- safe
1115
+ check(typeof self == 'object' && self) ||
1116
+ check(typeof global == 'object' && global) ||
1117
+ check(typeof this == 'object' && this) ||
1118
+ // eslint-disable-next-line no-new-func -- fallback
1119
+ (function () { return this; })() || Function('return this')();
396
1120
 
397
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(FlagshipContext.Provider, {
398
- value: {
399
- state,
400
- setState
401
- }
402
- }, handleDisplay());
1121
+
1122
+ /***/ }),
1123
+
1124
+ /***/ "./node_modules/core-js/internals/has-own-property.js":
1125
+ /*!************************************************************!*\
1126
+ !*** ./node_modules/core-js/internals/has-own-property.js ***!
1127
+ \************************************************************/
1128
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1129
+
1130
+
1131
+ var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ "./node_modules/core-js/internals/function-uncurry-this.js");
1132
+ var toObject = __webpack_require__(/*! ../internals/to-object */ "./node_modules/core-js/internals/to-object.js");
1133
+
1134
+ var hasOwnProperty = uncurryThis({}.hasOwnProperty);
1135
+
1136
+ // `HasOwnProperty` abstract operation
1137
+ // https://tc39.es/ecma262/#sec-hasownproperty
1138
+ // eslint-disable-next-line es/no-object-hasown -- safe
1139
+ module.exports = Object.hasOwn || function hasOwn(it, key) {
1140
+ return hasOwnProperty(toObject(it), key);
403
1141
  };
404
1142
 
1143
+
405
1144
  /***/ }),
406
1145
 
407
- /***/ "./src/FlagshipHooks.tsx":
408
- /*!*******************************!*\
409
- !*** ./src/FlagshipHooks.tsx ***!
410
- \*******************************/
411
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1146
+ /***/ "./node_modules/core-js/internals/hidden-keys.js":
1147
+ /*!*******************************************************!*\
1148
+ !*** ./node_modules/core-js/internals/hidden-keys.js ***!
1149
+ \*******************************************************/
1150
+ /***/ ((module) => {
412
1151
 
413
- __webpack_require__.r(__webpack_exports__);
414
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
415
- /* harmony export */ "useFlagship": () => (/* binding */ useFlagship),
416
- /* harmony export */ "useFsActivate": () => (/* binding */ useFsActivate),
417
- /* harmony export */ "useFsFlag": () => (/* binding */ useFsFlag),
418
- /* harmony export */ "useFsModification": () => (/* binding */ useFsModification),
419
- /* harmony export */ "useFsModificationInfo": () => (/* binding */ useFsModificationInfo),
420
- /* harmony export */ "useFsModifications": () => (/* binding */ useFsModifications)
421
- /* harmony export */ });
422
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
423
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
424
- /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @flagship.io/js-sdk */ "@flagship.io/js-sdk");
425
- /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__);
426
- /* harmony import */ var _FlagshipContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./FlagshipContext */ "./src/FlagshipContext.tsx");
427
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ "./src/utils.tsx");
428
- /* harmony import */ var _Flag__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Flag */ "./src/Flag.ts");
429
- /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants */ "./src/constants.ts");
430
1152
 
1153
+ module.exports = {};
431
1154
 
432
1155
 
1156
+ /***/ }),
433
1157
 
1158
+ /***/ "./node_modules/core-js/internals/ie8-dom-define.js":
1159
+ /*!**********************************************************!*\
1160
+ !*** ./node_modules/core-js/internals/ie8-dom-define.js ***!
1161
+ \**********************************************************/
1162
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
434
1163
 
435
1164
 
1165
+ var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
1166
+ var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
1167
+ var createElement = __webpack_require__(/*! ../internals/document-create-element */ "./node_modules/core-js/internals/document-create-element.js");
436
1168
 
437
- const checkType = (value, defaultValue) => typeof value === 'object' && typeof defaultValue === 'object' && Array.isArray(value) === Array.isArray(defaultValue) || typeof value === typeof defaultValue;
1169
+ // Thanks to IE8 for its funny defineProperty
1170
+ module.exports = !DESCRIPTORS && !fails(function () {
1171
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
1172
+ return Object.defineProperty(createElement('div'), 'a', {
1173
+ get: function () { return 7; }
1174
+ }).a !== 7;
1175
+ });
438
1176
 
439
- const fsModificationsSync = args => {
440
- const {
441
- visitor,
442
- params,
443
- activateAll,
444
- state,
445
- functionName,
446
- config
447
- } = args;
448
1177
 
449
- if (visitor) {
450
- return visitor.getModificationsSync(params, activateAll);
451
- }
1178
+ /***/ }),
452
1179
 
453
- const check = !state.status.isSdkReady && !!state.modifications && state.modifications.size > 0;
454
- const flags = {};
1180
+ /***/ "./node_modules/core-js/internals/inspect-source.js":
1181
+ /*!**********************************************************!*\
1182
+ !*** ./node_modules/core-js/internals/inspect-source.js ***!
1183
+ \**********************************************************/
1184
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
455
1185
 
456
- if (check) {
457
- params.forEach(item => {
458
- var _state$modifications;
459
1186
 
460
- const modification = (_state$modifications = state.modifications) === null || _state$modifications === void 0 ? void 0 : _state$modifications.get(item.key);
1187
+ var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ "./node_modules/core-js/internals/function-uncurry-this.js");
1188
+ var isCallable = __webpack_require__(/*! ../internals/is-callable */ "./node_modules/core-js/internals/is-callable.js");
1189
+ var store = __webpack_require__(/*! ../internals/shared-store */ "./node_modules/core-js/internals/shared-store.js");
461
1190
 
462
- if (modification && checkType(modification === null || modification === void 0 ? void 0 : modification.value, item.defaultValue)) {
463
- flags[item.key] = modification.value;
464
- } else {
465
- flags[item.key] = item.defaultValue;
466
- }
467
- });
468
- return flags;
469
- }
1191
+ var functionToString = uncurryThis(Function.toString);
470
1192
 
471
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logWarn)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorDefault, functionName);
472
- params.forEach(item => {
473
- flags[item.key] = item.defaultValue;
474
- });
475
- return flags;
1193
+ // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
1194
+ if (!isCallable(store.inspectSource)) {
1195
+ store.inspectSource = function (it) {
1196
+ return functionToString(it);
1197
+ };
1198
+ }
1199
+
1200
+ module.exports = store.inspectSource;
1201
+
1202
+
1203
+ /***/ }),
1204
+
1205
+ /***/ "./node_modules/core-js/internals/internal-state.js":
1206
+ /*!**********************************************************!*\
1207
+ !*** ./node_modules/core-js/internals/internal-state.js ***!
1208
+ \**********************************************************/
1209
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1210
+
1211
+
1212
+ var NATIVE_WEAK_MAP = __webpack_require__(/*! ../internals/weak-map-basic-detection */ "./node_modules/core-js/internals/weak-map-basic-detection.js");
1213
+ var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
1214
+ var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
1215
+ var createNonEnumerableProperty = __webpack_require__(/*! ../internals/create-non-enumerable-property */ "./node_modules/core-js/internals/create-non-enumerable-property.js");
1216
+ var hasOwn = __webpack_require__(/*! ../internals/has-own-property */ "./node_modules/core-js/internals/has-own-property.js");
1217
+ var shared = __webpack_require__(/*! ../internals/shared-store */ "./node_modules/core-js/internals/shared-store.js");
1218
+ var sharedKey = __webpack_require__(/*! ../internals/shared-key */ "./node_modules/core-js/internals/shared-key.js");
1219
+ var hiddenKeys = __webpack_require__(/*! ../internals/hidden-keys */ "./node_modules/core-js/internals/hidden-keys.js");
1220
+
1221
+ var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
1222
+ var TypeError = global.TypeError;
1223
+ var WeakMap = global.WeakMap;
1224
+ var set, get, has;
1225
+
1226
+ var enforce = function (it) {
1227
+ return has(it) ? get(it) : set(it, {});
476
1228
  };
477
- /**
478
- * Retrieve a modification value by its key. If no modification match the given key or if the stored value type and default value type do not match, default value will be returned.
479
- * @deprecated use useFsFlag instead
480
- */
481
1229
 
1230
+ var getterFor = function (TYPE) {
1231
+ return function (it) {
1232
+ var state;
1233
+ if (!isObject(it) || (state = get(it)).type !== TYPE) {
1234
+ throw new TypeError('Incompatible receiver, ' + TYPE + ' required');
1235
+ } return state;
1236
+ };
1237
+ };
482
1238
 
483
- const useFsModifications = (params, activateAll) => {
484
- const {
485
- state
486
- } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_FlagshipContext__WEBPACK_IMPORTED_MODULE_4__.FlagshipContext);
487
- const {
488
- visitor,
489
- config
490
- } = state;
491
- const functionName = 'useFsModifications';
492
- return fsModificationsSync({
493
- functionName,
494
- state,
495
- visitor,
496
- config,
497
- params,
498
- activateAll
499
- });
1239
+ if (NATIVE_WEAK_MAP || shared.state) {
1240
+ var store = shared.state || (shared.state = new WeakMap());
1241
+ /* eslint-disable no-self-assign -- prototype methods protection */
1242
+ store.get = store.get;
1243
+ store.has = store.has;
1244
+ store.set = store.set;
1245
+ /* eslint-enable no-self-assign -- prototype methods protection */
1246
+ set = function (it, metadata) {
1247
+ if (store.has(it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
1248
+ metadata.facade = it;
1249
+ store.set(it, metadata);
1250
+ return metadata;
1251
+ };
1252
+ get = function (it) {
1253
+ return store.get(it) || {};
1254
+ };
1255
+ has = function (it) {
1256
+ return store.has(it);
1257
+ };
1258
+ } else {
1259
+ var STATE = sharedKey('state');
1260
+ hiddenKeys[STATE] = true;
1261
+ set = function (it, metadata) {
1262
+ if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
1263
+ metadata.facade = it;
1264
+ createNonEnumerableProperty(it, STATE, metadata);
1265
+ return metadata;
1266
+ };
1267
+ get = function (it) {
1268
+ return hasOwn(it, STATE) ? it[STATE] : {};
1269
+ };
1270
+ has = function (it) {
1271
+ return hasOwn(it, STATE);
1272
+ };
1273
+ }
1274
+
1275
+ module.exports = {
1276
+ set: set,
1277
+ get: get,
1278
+ has: has,
1279
+ enforce: enforce,
1280
+ getterFor: getterFor
500
1281
  };
501
- /**
502
- * Retrieve a modification value by its key. If no modification match the given key or if the stored value type and default value type do not match, default value will be returned.
503
- * @deprecated use useFsFlag instead
504
- */
505
1282
 
506
- const useFsModification = params => {
507
- var _state$modifications2;
508
1283
 
509
- const {
510
- state
511
- } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_FlagshipContext__WEBPACK_IMPORTED_MODULE_4__.FlagshipContext);
512
- const {
513
- visitor,
514
- config
515
- } = state;
516
- const functionName = 'useFsModifications';
1284
+ /***/ }),
517
1285
 
518
- if (visitor) {
519
- return visitor.getModificationSync(params);
520
- }
1286
+ /***/ "./node_modules/core-js/internals/is-callable.js":
1287
+ /*!*******************************************************!*\
1288
+ !*** ./node_modules/core-js/internals/is-callable.js ***!
1289
+ \*******************************************************/
1290
+ /***/ ((module) => {
521
1291
 
522
- const modification = (_state$modifications2 = state.modifications) === null || _state$modifications2 === void 0 ? void 0 : _state$modifications2.get(params.key);
523
1292
 
524
- if (!state.status.isSdkReady && modification && checkType(modification === null || modification === void 0 ? void 0 : modification.value, params.defaultValue)) {
525
- return modification.value;
526
- }
1293
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
1294
+ var documentAll = typeof document == 'object' && document.all;
527
1295
 
528
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logWarn)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorDefault, functionName);
529
- return params.defaultValue;
1296
+ // `IsCallable` abstract operation
1297
+ // https://tc39.es/ecma262/#sec-iscallable
1298
+ // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
1299
+ module.exports = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
1300
+ return typeof argument == 'function' || argument === documentAll;
1301
+ } : function (argument) {
1302
+ return typeof argument == 'function';
530
1303
  };
531
1304
 
532
- const fsModificationInfoSync = args => {
533
- var _state$modifications3;
534
1305
 
535
- const {
536
- key,
537
- visitor,
538
- state
539
- } = args;
1306
+ /***/ }),
540
1307
 
541
- if (visitor) {
542
- return visitor.getModificationInfoSync(key);
543
- }
1308
+ /***/ "./node_modules/core-js/internals/is-null-or-undefined.js":
1309
+ /*!****************************************************************!*\
1310
+ !*** ./node_modules/core-js/internals/is-null-or-undefined.js ***!
1311
+ \****************************************************************/
1312
+ /***/ ((module) => {
544
1313
 
545
- const modification = (_state$modifications3 = state.modifications) === null || _state$modifications3 === void 0 ? void 0 : _state$modifications3.get(key);
546
1314
 
547
- if (!state.status.isSdkReady && modification) {
548
- return modification;
549
- }
1315
+ // we can't use just `it == null` since of `document.all` special case
1316
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
1317
+ module.exports = function (it) {
1318
+ return it === null || it === undefined;
1319
+ };
550
1320
 
551
- return null;
1321
+
1322
+ /***/ }),
1323
+
1324
+ /***/ "./node_modules/core-js/internals/is-object.js":
1325
+ /*!*****************************************************!*\
1326
+ !*** ./node_modules/core-js/internals/is-object.js ***!
1327
+ \*****************************************************/
1328
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1329
+
1330
+
1331
+ var isCallable = __webpack_require__(/*! ../internals/is-callable */ "./node_modules/core-js/internals/is-callable.js");
1332
+
1333
+ module.exports = function (it) {
1334
+ return typeof it == 'object' ? it !== null : isCallable(it);
552
1335
  };
553
- /**
554
- * Get the campaign modification information value matching the given key.
555
- * @param {string} key key which identify the modification.
556
- * @deprecated use useFsFlag instead
557
- */
558
1336
 
559
1337
 
560
- const useFsModificationInfo = key => {
561
- const {
562
- state
563
- } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_FlagshipContext__WEBPACK_IMPORTED_MODULE_4__.FlagshipContext);
564
- const {
565
- visitor
566
- } = state;
567
- return fsModificationInfoSync({
568
- key,
569
- state,
570
- visitor
571
- });
1338
+ /***/ }),
1339
+
1340
+ /***/ "./node_modules/core-js/internals/is-pure.js":
1341
+ /*!***************************************************!*\
1342
+ !*** ./node_modules/core-js/internals/is-pure.js ***!
1343
+ \***************************************************/
1344
+ /***/ ((module) => {
1345
+
1346
+
1347
+ module.exports = false;
1348
+
1349
+
1350
+ /***/ }),
1351
+
1352
+ /***/ "./node_modules/core-js/internals/is-symbol.js":
1353
+ /*!*****************************************************!*\
1354
+ !*** ./node_modules/core-js/internals/is-symbol.js ***!
1355
+ \*****************************************************/
1356
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1357
+
1358
+
1359
+ var getBuiltIn = __webpack_require__(/*! ../internals/get-built-in */ "./node_modules/core-js/internals/get-built-in.js");
1360
+ var isCallable = __webpack_require__(/*! ../internals/is-callable */ "./node_modules/core-js/internals/is-callable.js");
1361
+ var isPrototypeOf = __webpack_require__(/*! ../internals/object-is-prototype-of */ "./node_modules/core-js/internals/object-is-prototype-of.js");
1362
+ var USE_SYMBOL_AS_UID = __webpack_require__(/*! ../internals/use-symbol-as-uid */ "./node_modules/core-js/internals/use-symbol-as-uid.js");
1363
+
1364
+ var $Object = Object;
1365
+
1366
+ module.exports = USE_SYMBOL_AS_UID ? function (it) {
1367
+ return typeof it == 'symbol';
1368
+ } : function (it) {
1369
+ var $Symbol = getBuiltIn('Symbol');
1370
+ return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
572
1371
  };
573
1372
 
574
- const fsActivate = async (params, functionName, visitor, config) => {
575
- try {
576
- if (!visitor) {
577
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logWarn)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, functionName);
578
- return;
579
- }
580
1373
 
581
- await visitor.activateModifications(params); // eslint-disable-next-line @typescript-eslint/no-explicit-any
582
- } catch (error) {
583
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logWarn)(config, error.message || error, functionName);
1374
+ /***/ }),
1375
+
1376
+ /***/ "./node_modules/core-js/internals/make-built-in.js":
1377
+ /*!*********************************************************!*\
1378
+ !*** ./node_modules/core-js/internals/make-built-in.js ***!
1379
+ \*********************************************************/
1380
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1381
+
1382
+
1383
+ var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ "./node_modules/core-js/internals/function-uncurry-this.js");
1384
+ var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
1385
+ var isCallable = __webpack_require__(/*! ../internals/is-callable */ "./node_modules/core-js/internals/is-callable.js");
1386
+ var hasOwn = __webpack_require__(/*! ../internals/has-own-property */ "./node_modules/core-js/internals/has-own-property.js");
1387
+ var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
1388
+ var CONFIGURABLE_FUNCTION_NAME = (__webpack_require__(/*! ../internals/function-name */ "./node_modules/core-js/internals/function-name.js").CONFIGURABLE);
1389
+ var inspectSource = __webpack_require__(/*! ../internals/inspect-source */ "./node_modules/core-js/internals/inspect-source.js");
1390
+ var InternalStateModule = __webpack_require__(/*! ../internals/internal-state */ "./node_modules/core-js/internals/internal-state.js");
1391
+
1392
+ var enforceInternalState = InternalStateModule.enforce;
1393
+ var getInternalState = InternalStateModule.get;
1394
+ var $String = String;
1395
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
1396
+ var defineProperty = Object.defineProperty;
1397
+ var stringSlice = uncurryThis(''.slice);
1398
+ var replace = uncurryThis(''.replace);
1399
+ var join = uncurryThis([].join);
1400
+
1401
+ var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {
1402
+ return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
1403
+ });
1404
+
1405
+ var TEMPLATE = String(String).split('String');
1406
+
1407
+ var makeBuiltIn = module.exports = function (value, name, options) {
1408
+ if (stringSlice($String(name), 0, 7) === 'Symbol(') {
1409
+ name = '[' + replace($String(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
1410
+ }
1411
+ if (options && options.getter) name = 'get ' + name;
1412
+ if (options && options.setter) name = 'set ' + name;
1413
+ if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
1414
+ if (DESCRIPTORS) defineProperty(value, 'name', { value: name, configurable: true });
1415
+ else value.name = name;
1416
+ }
1417
+ if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {
1418
+ defineProperty(value, 'length', { value: options.arity });
584
1419
  }
1420
+ try {
1421
+ if (options && hasOwn(options, 'constructor') && options.constructor) {
1422
+ if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false });
1423
+ // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
1424
+ } else if (value.prototype) value.prototype = undefined;
1425
+ } catch (error) { /* empty */ }
1426
+ var state = enforceInternalState(value);
1427
+ if (!hasOwn(state, 'source')) {
1428
+ state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
1429
+ } return value;
585
1430
  };
586
- /**
587
- * This hook returns a flag object by its key. If no flag match the given key an empty flag will be returned.
588
- * @param key
589
- * @param defaultValue
590
- * @returns
591
- */
592
1431
 
1432
+ // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
1433
+ // eslint-disable-next-line no-extend-native -- required
1434
+ Function.prototype.toString = makeBuiltIn(function toString() {
1435
+ return isCallable(this) && getInternalState(this).source || inspectSource(this);
1436
+ }, 'toString');
593
1437
 
594
- const useFsFlag = (key, defaultValue) => {
595
- const {
596
- state
597
- } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_FlagshipContext__WEBPACK_IMPORTED_MODULE_4__.FlagshipContext);
598
- const {
599
- visitor
600
- } = state;
601
1438
 
602
- if (!visitor) {
603
- return new _Flag__WEBPACK_IMPORTED_MODULE_5__.Flag(defaultValue, key, state.modifications);
604
- }
1439
+ /***/ }),
605
1440
 
606
- return visitor.getFlag(key, defaultValue);
1441
+ /***/ "./node_modules/core-js/internals/object-define-property.js":
1442
+ /*!******************************************************************!*\
1443
+ !*** ./node_modules/core-js/internals/object-define-property.js ***!
1444
+ \******************************************************************/
1445
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1446
+
1447
+
1448
+ var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
1449
+ var IE8_DOM_DEFINE = __webpack_require__(/*! ../internals/ie8-dom-define */ "./node_modules/core-js/internals/ie8-dom-define.js");
1450
+ var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(/*! ../internals/v8-prototype-define-bug */ "./node_modules/core-js/internals/v8-prototype-define-bug.js");
1451
+ var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
1452
+ var toPropertyKey = __webpack_require__(/*! ../internals/to-property-key */ "./node_modules/core-js/internals/to-property-key.js");
1453
+
1454
+ var $TypeError = TypeError;
1455
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
1456
+ var $defineProperty = Object.defineProperty;
1457
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1458
+ var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1459
+ var ENUMERABLE = 'enumerable';
1460
+ var CONFIGURABLE = 'configurable';
1461
+ var WRITABLE = 'writable';
1462
+
1463
+ // `Object.defineProperty` method
1464
+ // https://tc39.es/ecma262/#sec-object.defineproperty
1465
+ exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
1466
+ anObject(O);
1467
+ P = toPropertyKey(P);
1468
+ anObject(Attributes);
1469
+ if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
1470
+ var current = $getOwnPropertyDescriptor(O, P);
1471
+ if (current && current[WRITABLE]) {
1472
+ O[P] = Attributes.value;
1473
+ Attributes = {
1474
+ configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
1475
+ enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
1476
+ writable: false
1477
+ };
1478
+ }
1479
+ } return $defineProperty(O, P, Attributes);
1480
+ } : $defineProperty : function defineProperty(O, P, Attributes) {
1481
+ anObject(O);
1482
+ P = toPropertyKey(P);
1483
+ anObject(Attributes);
1484
+ if (IE8_DOM_DEFINE) try {
1485
+ return $defineProperty(O, P, Attributes);
1486
+ } catch (error) { /* empty */ }
1487
+ if ('get' in Attributes || 'set' in Attributes) throw new $TypeError('Accessors not supported');
1488
+ if ('value' in Attributes) O[P] = Attributes.value;
1489
+ return O;
607
1490
  };
608
- /**
609
- * Report this user has seen this modification. Report this user has seen these modifications.
610
- * @param params
611
- * @deprecated use useFsFlag instead
612
- * @returns
613
- */
614
1491
 
615
- const useFsActivate = async params => {
616
- const {
617
- state
618
- } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_FlagshipContext__WEBPACK_IMPORTED_MODULE_4__.FlagshipContext);
619
- const {
620
- visitor,
621
- config
622
- } = state;
623
- const functionName = 'useFsModifications';
624
- await fsActivate(params, functionName, visitor, config);
1492
+
1493
+ /***/ }),
1494
+
1495
+ /***/ "./node_modules/core-js/internals/object-is-prototype-of.js":
1496
+ /*!******************************************************************!*\
1497
+ !*** ./node_modules/core-js/internals/object-is-prototype-of.js ***!
1498
+ \******************************************************************/
1499
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1500
+
1501
+
1502
+ var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ "./node_modules/core-js/internals/function-uncurry-this.js");
1503
+
1504
+ module.exports = uncurryThis({}.isPrototypeOf);
1505
+
1506
+
1507
+ /***/ }),
1508
+
1509
+ /***/ "./node_modules/core-js/internals/ordinary-to-primitive.js":
1510
+ /*!*****************************************************************!*\
1511
+ !*** ./node_modules/core-js/internals/ordinary-to-primitive.js ***!
1512
+ \*****************************************************************/
1513
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1514
+
1515
+
1516
+ var call = __webpack_require__(/*! ../internals/function-call */ "./node_modules/core-js/internals/function-call.js");
1517
+ var isCallable = __webpack_require__(/*! ../internals/is-callable */ "./node_modules/core-js/internals/is-callable.js");
1518
+ var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
1519
+
1520
+ var $TypeError = TypeError;
1521
+
1522
+ // `OrdinaryToPrimitive` abstract operation
1523
+ // https://tc39.es/ecma262/#sec-ordinarytoprimitive
1524
+ module.exports = function (input, pref) {
1525
+ var fn, val;
1526
+ if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
1527
+ if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
1528
+ if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
1529
+ throw new $TypeError("Can't convert object to primitive value");
625
1530
  };
626
- const useFlagship = () => {
627
- const {
628
- state
629
- } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_FlagshipContext__WEBPACK_IMPORTED_MODULE_4__.FlagshipContext);
630
- const {
631
- visitor,
632
- config
633
- } = state;
634
1531
 
635
- const fsUpdateContext = context => {
636
- const functionName = 'updateContext';
637
1532
 
638
- if (!visitor) {
639
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logError)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, functionName);
640
- return;
641
- }
1533
+ /***/ }),
1534
+
1535
+ /***/ "./node_modules/core-js/internals/regexp-flags.js":
1536
+ /*!********************************************************!*\
1537
+ !*** ./node_modules/core-js/internals/regexp-flags.js ***!
1538
+ \********************************************************/
1539
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1540
+
1541
+
1542
+ var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
1543
+
1544
+ // `RegExp.prototype.flags` getter implementation
1545
+ // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
1546
+ module.exports = function () {
1547
+ var that = anObject(this);
1548
+ var result = '';
1549
+ if (that.hasIndices) result += 'd';
1550
+ if (that.global) result += 'g';
1551
+ if (that.ignoreCase) result += 'i';
1552
+ if (that.multiline) result += 'm';
1553
+ if (that.dotAll) result += 's';
1554
+ if (that.unicode) result += 'u';
1555
+ if (that.unicodeSets) result += 'v';
1556
+ if (that.sticky) result += 'y';
1557
+ return result;
1558
+ };
1559
+
1560
+
1561
+ /***/ }),
1562
+
1563
+ /***/ "./node_modules/core-js/internals/require-object-coercible.js":
1564
+ /*!********************************************************************!*\
1565
+ !*** ./node_modules/core-js/internals/require-object-coercible.js ***!
1566
+ \********************************************************************/
1567
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1568
+
1569
+
1570
+ var isNullOrUndefined = __webpack_require__(/*! ../internals/is-null-or-undefined */ "./node_modules/core-js/internals/is-null-or-undefined.js");
1571
+
1572
+ var $TypeError = TypeError;
1573
+
1574
+ // `RequireObjectCoercible` abstract operation
1575
+ // https://tc39.es/ecma262/#sec-requireobjectcoercible
1576
+ module.exports = function (it) {
1577
+ if (isNullOrUndefined(it)) throw new $TypeError("Can't call method on " + it);
1578
+ return it;
1579
+ };
1580
+
1581
+
1582
+ /***/ }),
1583
+
1584
+ /***/ "./node_modules/core-js/internals/shared-key.js":
1585
+ /*!******************************************************!*\
1586
+ !*** ./node_modules/core-js/internals/shared-key.js ***!
1587
+ \******************************************************/
1588
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1589
+
642
1590
 
643
- visitor.clearContext();
644
- visitor.updateContext(context);
645
- };
1591
+ var shared = __webpack_require__(/*! ../internals/shared */ "./node_modules/core-js/internals/shared.js");
1592
+ var uid = __webpack_require__(/*! ../internals/uid */ "./node_modules/core-js/internals/uid.js");
646
1593
 
647
- const fsClearContext = () => {
648
- const functionName = 'cleanContext';
1594
+ var keys = shared('keys');
649
1595
 
650
- if (!visitor) {
651
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logError)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, functionName);
652
- return;
653
- }
1596
+ module.exports = function (key) {
1597
+ return keys[key] || (keys[key] = uid(key));
1598
+ };
654
1599
 
655
- visitor.clearContext();
656
- };
657
1600
 
658
- const fsAuthenticate = visitorId => {
659
- const functionName = 'authenticate';
1601
+ /***/ }),
660
1602
 
661
- if (!visitor) {
662
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logError)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, functionName);
663
- return;
664
- }
1603
+ /***/ "./node_modules/core-js/internals/shared-store.js":
1604
+ /*!********************************************************!*\
1605
+ !*** ./node_modules/core-js/internals/shared-store.js ***!
1606
+ \********************************************************/
1607
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
665
1608
 
666
- visitor.authenticate(visitorId);
667
- };
668
1609
 
669
- const fsUnauthenticate = () => {
670
- const functionName = 'unauthenticate';
1610
+ var IS_PURE = __webpack_require__(/*! ../internals/is-pure */ "./node_modules/core-js/internals/is-pure.js");
1611
+ var globalThis = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
1612
+ var defineGlobalProperty = __webpack_require__(/*! ../internals/define-global-property */ "./node_modules/core-js/internals/define-global-property.js");
671
1613
 
672
- if (!visitor) {
673
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logError)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, functionName);
674
- return;
675
- }
1614
+ var SHARED = '__core-js_shared__';
1615
+ var store = module.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
676
1616
 
677
- visitor.unauthenticate();
678
- };
679
- /**
680
- * Send a Hit to Flagship servers for reporting.
681
- */
1617
+ (store.versions || (store.versions = [])).push({
1618
+ version: '3.36.1',
1619
+ mode: IS_PURE ? 'pure' : 'global',
1620
+ copyright: 2014-2024 Denis Pushkarev (zloirock.ru)',
1621
+ license: 'https://github.com/zloirock/core-js/blob/v3.36.1/LICENSE',
1622
+ source: 'https://github.com/zloirock/core-js'
1623
+ });
682
1624
 
683
1625
 
684
- const fsSendHit = hit => {
685
- const functionName = 'sendHit';
1626
+ /***/ }),
686
1627
 
687
- if (!visitor) {
688
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logError)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, functionName);
689
- return Promise.resolve();
690
- }
1628
+ /***/ "./node_modules/core-js/internals/shared.js":
1629
+ /*!**************************************************!*\
1630
+ !*** ./node_modules/core-js/internals/shared.js ***!
1631
+ \**************************************************/
1632
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
691
1633
 
692
- return visitor.sendHit(hit);
693
- };
694
- /**
695
- * Send a Hit to Flagship servers for reporting.
696
- */
697
1634
 
1635
+ var store = __webpack_require__(/*! ../internals/shared-store */ "./node_modules/core-js/internals/shared-store.js");
698
1636
 
699
- const fsSendHits = hit => {
700
- const functionName = 'sendHits';
1637
+ module.exports = function (key, value) {
1638
+ return store[key] || (store[key] = value || {});
1639
+ };
701
1640
 
702
- if (!visitor) {
703
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logError)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, functionName);
704
- return Promise.resolve();
705
- }
706
1641
 
707
- return visitor.sendHits(hit);
708
- };
1642
+ /***/ }),
709
1643
 
710
- let modifications = visitor === null || visitor === void 0 ? void 0 : visitor.getModificationsArray();
1644
+ /***/ "./node_modules/core-js/internals/symbol-constructor-detection.js":
1645
+ /*!************************************************************************!*\
1646
+ !*** ./node_modules/core-js/internals/symbol-constructor-detection.js ***!
1647
+ \************************************************************************/
1648
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1649
+
1650
+
1651
+ /* eslint-disable es/no-symbol -- required for testing */
1652
+ var V8_VERSION = __webpack_require__(/*! ../internals/engine-v8-version */ "./node_modules/core-js/internals/engine-v8-version.js");
1653
+ var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
1654
+ var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
1655
+
1656
+ var $String = global.String;
1657
+
1658
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
1659
+ module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
1660
+ var symbol = Symbol('symbol detection');
1661
+ // Chrome 38 Symbol has incorrect toString conversion
1662
+ // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
1663
+ // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
1664
+ // of course, fail.
1665
+ return !$String(symbol) || !(Object(symbol) instanceof Symbol) ||
1666
+ // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
1667
+ !Symbol.sham && V8_VERSION && V8_VERSION < 41;
1668
+ });
711
1669
 
712
- if (!state.status.isSdkReady && state.modifications) {
713
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
714
- modifications = Array.from(state.modifications, ([_key, item]) => item);
715
- }
716
1670
 
717
- const activateModification = async params => {
718
- const functionName = 'activateModification';
719
- await fsActivate(params, functionName, visitor, config);
720
- };
1671
+ /***/ }),
721
1672
 
722
- const synchronizeModifications = async () => {
723
- if (!visitor) {
724
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logWarn)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, 'synchronizeModifications');
725
- return;
726
- }
1673
+ /***/ "./node_modules/core-js/internals/to-object.js":
1674
+ /*!*****************************************************!*\
1675
+ !*** ./node_modules/core-js/internals/to-object.js ***!
1676
+ \*****************************************************/
1677
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
727
1678
 
728
- await visitor.synchronizeModifications();
729
- };
730
1679
 
731
- const getModifications = (params, activateAll) => {
732
- const functionName = 'getModifications';
733
- return fsModificationsSync({
734
- functionName,
735
- state,
736
- visitor,
737
- config,
738
- params,
739
- activateAll
740
- });
741
- };
1680
+ var requireObjectCoercible = __webpack_require__(/*! ../internals/require-object-coercible */ "./node_modules/core-js/internals/require-object-coercible.js");
742
1681
 
743
- const getModificationInfo = key => {
744
- return fsModificationInfoSync({
745
- key,
746
- state,
747
- visitor
748
- });
749
- };
1682
+ var $Object = Object;
750
1683
 
751
- function getFlag(key, defaultValue) {
752
- if (!visitor) {
753
- return new _Flag__WEBPACK_IMPORTED_MODULE_5__.Flag(defaultValue, key, state.modifications);
754
- }
1684
+ // `ToObject` abstract operation
1685
+ // https://tc39.es/ecma262/#sec-toobject
1686
+ module.exports = function (argument) {
1687
+ return $Object(requireObjectCoercible(argument));
1688
+ };
755
1689
 
756
- return visitor.getFlag(key, defaultValue);
757
- }
758
1690
 
759
- function fetchFlags() {
760
- if (!visitor) {
761
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logWarn)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, 'fetchFlags');
762
- return Promise.resolve();
763
- }
1691
+ /***/ }),
764
1692
 
765
- return visitor.fetchFlags();
1693
+ /***/ "./node_modules/core-js/internals/to-primitive.js":
1694
+ /*!********************************************************!*\
1695
+ !*** ./node_modules/core-js/internals/to-primitive.js ***!
1696
+ \********************************************************/
1697
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1698
+
1699
+
1700
+ var call = __webpack_require__(/*! ../internals/function-call */ "./node_modules/core-js/internals/function-call.js");
1701
+ var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
1702
+ var isSymbol = __webpack_require__(/*! ../internals/is-symbol */ "./node_modules/core-js/internals/is-symbol.js");
1703
+ var getMethod = __webpack_require__(/*! ../internals/get-method */ "./node_modules/core-js/internals/get-method.js");
1704
+ var ordinaryToPrimitive = __webpack_require__(/*! ../internals/ordinary-to-primitive */ "./node_modules/core-js/internals/ordinary-to-primitive.js");
1705
+ var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
1706
+
1707
+ var $TypeError = TypeError;
1708
+ var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
1709
+
1710
+ // `ToPrimitive` abstract operation
1711
+ // https://tc39.es/ecma262/#sec-toprimitive
1712
+ module.exports = function (input, pref) {
1713
+ if (!isObject(input) || isSymbol(input)) return input;
1714
+ var exoticToPrim = getMethod(input, TO_PRIMITIVE);
1715
+ var result;
1716
+ if (exoticToPrim) {
1717
+ if (pref === undefined) pref = 'default';
1718
+ result = call(exoticToPrim, input, pref);
1719
+ if (!isObject(result) || isSymbol(result)) return result;
1720
+ throw new $TypeError("Can't convert object to primitive value");
766
1721
  }
1722
+ if (pref === undefined) pref = 'number';
1723
+ return ordinaryToPrimitive(input, pref);
1724
+ };
767
1725
 
768
- function setConsent(hasConsented) {
769
- if (!visitor) {
770
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logWarn)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, 'setConsent');
771
- return;
772
- }
773
1726
 
774
- visitor.setConsent(hasConsented);
775
- }
1727
+ /***/ }),
776
1728
 
777
- async function close() {
778
- await _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1___default().close();
779
- }
1729
+ /***/ "./node_modules/core-js/internals/to-property-key.js":
1730
+ /*!***********************************************************!*\
1731
+ !*** ./node_modules/core-js/internals/to-property-key.js ***!
1732
+ \***********************************************************/
1733
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
780
1734
 
781
- return {
782
- visitorId: visitor === null || visitor === void 0 ? void 0 : visitor.visitorId,
783
- anonymousId: visitor === null || visitor === void 0 ? void 0 : visitor.anonymousId,
784
- context: { ...(visitor === null || visitor === void 0 ? void 0 : visitor.context)
785
- },
786
- hasConsented: visitor === null || visitor === void 0 ? void 0 : visitor.hasConsented,
787
- setConsent,
788
- updateContext: fsUpdateContext,
789
- clearContext: fsClearContext,
790
- authenticate: fsAuthenticate,
791
- unauthenticate: fsUnauthenticate,
792
- status: state.status,
793
- activateModification,
794
- synchronizeModifications,
795
- getModifications,
796
- modifications: modifications || [],
797
- flagsData: (visitor === null || visitor === void 0 ? void 0 : visitor.getFlagsDataArray()) || [],
798
- getModificationInfo,
799
- hit: {
800
- send: fsSendHit,
801
- sendMultiple: fsSendHits
802
- },
803
- getFlag,
804
- fetchFlags,
805
- close
806
- };
1735
+
1736
+ var toPrimitive = __webpack_require__(/*! ../internals/to-primitive */ "./node_modules/core-js/internals/to-primitive.js");
1737
+ var isSymbol = __webpack_require__(/*! ../internals/is-symbol */ "./node_modules/core-js/internals/is-symbol.js");
1738
+
1739
+ // `ToPropertyKey` abstract operation
1740
+ // https://tc39.es/ecma262/#sec-topropertykey
1741
+ module.exports = function (argument) {
1742
+ var key = toPrimitive(argument, 'string');
1743
+ return isSymbol(key) ? key : key + '';
807
1744
  };
808
1745
 
1746
+
809
1747
  /***/ }),
810
1748
 
811
- /***/ "./src/constants.ts":
812
- /*!**************************!*\
813
- !*** ./src/constants.ts ***!
814
- \**************************/
815
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1749
+ /***/ "./node_modules/core-js/internals/try-to-string.js":
1750
+ /*!*********************************************************!*\
1751
+ !*** ./node_modules/core-js/internals/try-to-string.js ***!
1752
+ \*********************************************************/
1753
+ /***/ ((module) => {
1754
+
1755
+
1756
+ var $String = String;
1757
+
1758
+ module.exports = function (argument) {
1759
+ try {
1760
+ return $String(argument);
1761
+ } catch (error) {
1762
+ return 'Object';
1763
+ }
1764
+ };
816
1765
 
817
- __webpack_require__.r(__webpack_exports__);
818
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
819
- /* harmony export */ "GET_FLAG_CAST_ERROR": () => (/* binding */ GET_FLAG_CAST_ERROR),
820
- /* harmony export */ "GET_METADATA_CAST_ERROR": () => (/* binding */ GET_METADATA_CAST_ERROR),
821
- /* harmony export */ "noVisitorDefault": () => (/* binding */ noVisitorDefault),
822
- /* harmony export */ "noVisitorMessage": () => (/* binding */ noVisitorMessage)
823
- /* harmony export */ });
824
- const noVisitorMessage = 'flagship Visitor not initialized.';
825
- const noVisitorDefault = 'fsVisitor not initialized, returns default value';
826
- const GET_FLAG_CAST_ERROR = 'Flag for key {0} has a different type. Default value is returned.';
827
- const GET_METADATA_CAST_ERROR = 'Flag for key {0} has a different type with defaultValue, an empty metadata object is returned';
828
1766
 
829
1767
  /***/ }),
830
1768
 
831
- /***/ "./src/internalType.ts":
832
- /*!*****************************!*\
833
- !*** ./src/internalType.ts ***!
834
- \*****************************/
835
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1769
+ /***/ "./node_modules/core-js/internals/uid.js":
1770
+ /*!***********************************************!*\
1771
+ !*** ./node_modules/core-js/internals/uid.js ***!
1772
+ \***********************************************/
1773
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
836
1774
 
837
- __webpack_require__.r(__webpack_exports__);
838
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
839
- /* harmony export */ "INTERNAL_EVENTS": () => (/* binding */ INTERNAL_EVENTS)
840
- /* harmony export */ });
841
- let INTERNAL_EVENTS;
842
1775
 
843
- (function (INTERNAL_EVENTS) {
844
- INTERNAL_EVENTS["FsTriggerRendering"] = "FS_TRIGGER_RENDERING";
845
- })(INTERNAL_EVENTS || (INTERNAL_EVENTS = {}));
1776
+ var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ "./node_modules/core-js/internals/function-uncurry-this.js");
1777
+
1778
+ var id = 0;
1779
+ var postfix = Math.random();
1780
+ var toString = uncurryThis(1.0.toString);
1781
+
1782
+ module.exports = function (key) {
1783
+ return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
1784
+ };
1785
+
846
1786
 
847
1787
  /***/ }),
848
1788
 
849
- /***/ "./src/sdkVersion.ts":
850
- /*!***************************!*\
851
- !*** ./src/sdkVersion.ts ***!
852
- \***************************/
853
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1789
+ /***/ "./node_modules/core-js/internals/use-symbol-as-uid.js":
1790
+ /*!*************************************************************!*\
1791
+ !*** ./node_modules/core-js/internals/use-symbol-as-uid.js ***!
1792
+ \*************************************************************/
1793
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1794
+
1795
+
1796
+ /* eslint-disable es/no-symbol -- required for testing */
1797
+ var NATIVE_SYMBOL = __webpack_require__(/*! ../internals/symbol-constructor-detection */ "./node_modules/core-js/internals/symbol-constructor-detection.js");
1798
+
1799
+ module.exports = NATIVE_SYMBOL
1800
+ && !Symbol.sham
1801
+ && typeof Symbol.iterator == 'symbol';
854
1802
 
855
- __webpack_require__.r(__webpack_exports__);
856
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
857
- /* harmony export */ "version": () => (/* binding */ version)
858
- /* harmony export */ });
859
- // Generated by genversion.
860
- const version = '4.0.0-alpha.1';
861
1803
 
862
1804
  /***/ }),
863
1805
 
864
- /***/ "./src/utils.tsx":
865
- /*!***********************!*\
866
- !*** ./src/utils.tsx ***!
867
- \***********************/
868
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1806
+ /***/ "./node_modules/core-js/internals/v8-prototype-define-bug.js":
1807
+ /*!*******************************************************************!*\
1808
+ !*** ./node_modules/core-js/internals/v8-prototype-define-bug.js ***!
1809
+ \*******************************************************************/
1810
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
869
1811
 
870
- __webpack_require__.r(__webpack_exports__);
871
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
872
- /* harmony export */ "getModificationsFromCampaigns": () => (/* binding */ getModificationsFromCampaigns),
873
- /* harmony export */ "hasSameType": () => (/* binding */ hasSameType),
874
- /* harmony export */ "logError": () => (/* binding */ logError),
875
- /* harmony export */ "logInfo": () => (/* binding */ logInfo),
876
- /* harmony export */ "logWarn": () => (/* binding */ logWarn),
877
- /* harmony export */ "sprintf": () => (/* binding */ sprintf),
878
- /* harmony export */ "useNonInitialEffect": () => (/* binding */ useNonInitialEffect),
879
- /* harmony export */ "uuidV4": () => (/* binding */ uuidV4)
880
- /* harmony export */ });
881
- /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @flagship.io/js-sdk */ "@flagship.io/js-sdk");
882
- /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0__);
883
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
884
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
885
- 'use client';
886
1812
 
1813
+ var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
1814
+ var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
1815
+
1816
+ // V8 ~ Chrome 36-
1817
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3334
1818
+ module.exports = DESCRIPTORS && fails(function () {
1819
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
1820
+ return Object.defineProperty(function () { /* empty */ }, 'prototype', {
1821
+ value: 42,
1822
+ writable: false
1823
+ }).prototype !== 42;
1824
+ });
887
1825
 
888
1826
 
889
- function logError(config, message, tag) {
890
- if (!config || !config.logManager || typeof config.logManager.error !== 'function' || !config.logLevel || config.logLevel < _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0__.LogLevel.ERROR) {
891
- return;
892
- }
1827
+ /***/ }),
893
1828
 
894
- config.logManager.error(message, tag);
895
- }
896
- function logInfo(config, message, tag) {
897
- if (!config || !config.logManager || typeof config.logManager.info !== 'function' || !config.logLevel || config.logLevel < _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0__.LogLevel.INFO) {
898
- return;
899
- }
1829
+ /***/ "./node_modules/core-js/internals/weak-map-basic-detection.js":
1830
+ /*!********************************************************************!*\
1831
+ !*** ./node_modules/core-js/internals/weak-map-basic-detection.js ***!
1832
+ \********************************************************************/
1833
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
900
1834
 
901
- config.logManager.info(message, tag);
902
- }
903
- function logWarn(config, message, tag) {
904
- if (!config || !config.logManager || typeof config.logManager.warning !== 'function' || !config.logLevel || config.logLevel < _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0__.LogLevel.WARNING) {
905
- return;
906
- }
907
1835
 
908
- config.logManager.warning(message, tag);
909
- }
910
- const getModificationsFromCampaigns = campaigns => {
911
- const modifications = new Map();
1836
+ var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
1837
+ var isCallable = __webpack_require__(/*! ../internals/is-callable */ "./node_modules/core-js/internals/is-callable.js");
912
1838
 
913
- if (!campaigns || !Array.isArray(campaigns)) {
914
- return modifications;
915
- }
1839
+ var WeakMap = global.WeakMap;
916
1840
 
917
- campaigns.forEach(campaign => {
918
- const object = campaign.variation.modifications.value;
1841
+ module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));
919
1842
 
920
- for (const key in object) {
921
- const value = object[key];
922
- modifications.set(key, {
923
- key,
924
- campaignId: campaign.id,
925
- campaignName: campaign.name || '',
926
- variationGroupId: campaign.variationGroupId,
927
- variationGroupName: campaign.variationGroupName || '',
928
- variationId: campaign.variation.id,
929
- variationName: campaign.variation.name || '',
930
- isReference: campaign.variation.reference,
931
- value
932
- });
933
- }
934
- });
935
- return modifications;
1843
+
1844
+ /***/ }),
1845
+
1846
+ /***/ "./node_modules/core-js/internals/well-known-symbol.js":
1847
+ /*!*************************************************************!*\
1848
+ !*** ./node_modules/core-js/internals/well-known-symbol.js ***!
1849
+ \*************************************************************/
1850
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1851
+
1852
+
1853
+ var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
1854
+ var shared = __webpack_require__(/*! ../internals/shared */ "./node_modules/core-js/internals/shared.js");
1855
+ var hasOwn = __webpack_require__(/*! ../internals/has-own-property */ "./node_modules/core-js/internals/has-own-property.js");
1856
+ var uid = __webpack_require__(/*! ../internals/uid */ "./node_modules/core-js/internals/uid.js");
1857
+ var NATIVE_SYMBOL = __webpack_require__(/*! ../internals/symbol-constructor-detection */ "./node_modules/core-js/internals/symbol-constructor-detection.js");
1858
+ var USE_SYMBOL_AS_UID = __webpack_require__(/*! ../internals/use-symbol-as-uid */ "./node_modules/core-js/internals/use-symbol-as-uid.js");
1859
+
1860
+ var Symbol = global.Symbol;
1861
+ var WellKnownSymbolsStore = shared('wks');
1862
+ var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol['for'] || Symbol : Symbol && Symbol.withoutSetter || uid;
1863
+
1864
+ module.exports = function (name) {
1865
+ if (!hasOwn(WellKnownSymbolsStore, name)) {
1866
+ WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol, name)
1867
+ ? Symbol[name]
1868
+ : createWellKnownSymbol('Symbol.' + name);
1869
+ } return WellKnownSymbolsStore[name];
936
1870
  };
937
- function uuidV4() {
938
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (char) {
939
- const rand = Math.random() * 16 | 0;
940
- const value = char === 'x' ? rand : rand & 0x3 | 0x8;
941
- return value.toString(16);
942
- });
943
- }
944
- function useNonInitialEffect(effect, deps) {
945
- const initialRender = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(true);
946
- (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
947
- if (initialRender.current) {
948
- initialRender.current = false;
949
- return;
950
- }
951
1871
 
952
- if (typeof effect === 'function') {
953
- return effect();
954
- }
955
- }, deps);
956
- }
957
- function hasSameType(flagValue, defaultValue) {
958
- if (typeof flagValue !== typeof defaultValue) {
959
- return false;
960
- }
961
1872
 
962
- if (typeof flagValue === 'object' && typeof defaultValue === 'object' && Array.isArray(flagValue) !== Array.isArray(defaultValue)) {
963
- return false;
964
- }
1873
+ /***/ }),
965
1874
 
966
- return true;
967
- } // eslint-disable-next-line @typescript-eslint/no-explicit-any
1875
+ /***/ "./node_modules/core-js/modules/es.regexp.flags.js":
1876
+ /*!*********************************************************!*\
1877
+ !*** ./node_modules/core-js/modules/es.regexp.flags.js ***!
1878
+ \*********************************************************/
1879
+ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
968
1880
 
969
- function sprintf(format, ...value) {
970
- let formatted = format;
971
1881
 
972
- for (let i = 0; i < value.length; i++) {
973
- const element = value[i];
974
- formatted = formatted.replace(new RegExp(`\\{${i}\\}`, 'g'), element);
1882
+ var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
1883
+ var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
1884
+ var defineBuiltInAccessor = __webpack_require__(/*! ../internals/define-built-in-accessor */ "./node_modules/core-js/internals/define-built-in-accessor.js");
1885
+ var regExpFlags = __webpack_require__(/*! ../internals/regexp-flags */ "./node_modules/core-js/internals/regexp-flags.js");
1886
+ var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
1887
+
1888
+ // babel-minify and Closure Compiler transpiles RegExp('.', 'd') -> /./d and it causes SyntaxError
1889
+ var RegExp = global.RegExp;
1890
+ var RegExpPrototype = RegExp.prototype;
1891
+
1892
+ var FORCED = DESCRIPTORS && fails(function () {
1893
+ var INDICES_SUPPORT = true;
1894
+ try {
1895
+ RegExp('.', 'd');
1896
+ } catch (error) {
1897
+ INDICES_SUPPORT = false;
975
1898
  }
976
1899
 
977
- return formatted;
978
- }
1900
+ var O = {};
1901
+ // modern V8 bug
1902
+ var calls = '';
1903
+ var expected = INDICES_SUPPORT ? 'dgimsy' : 'gimsy';
1904
+
1905
+ var addGetter = function (key, chr) {
1906
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
1907
+ Object.defineProperty(O, key, { get: function () {
1908
+ calls += chr;
1909
+ return true;
1910
+ } });
1911
+ };
979
1912
 
980
- /***/ }),
1913
+ var pairs = {
1914
+ dotAll: 's',
1915
+ global: 'g',
1916
+ ignoreCase: 'i',
1917
+ multiline: 'm',
1918
+ sticky: 'y'
1919
+ };
981
1920
 
982
- /***/ "@flagship.io/js-sdk":
983
- /*!**************************************!*\
984
- !*** external "@flagship.io/js-sdk" ***!
985
- \**************************************/
986
- /***/ ((module) => {
1921
+ if (INDICES_SUPPORT) pairs.hasIndices = 'd';
987
1922
 
988
- module.exports = require("@flagship.io/js-sdk");
1923
+ for (var key in pairs) addGetter(key, pairs[key]);
989
1924
 
990
- /***/ }),
1925
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1926
+ var result = Object.getOwnPropertyDescriptor(RegExpPrototype, 'flags').get.call(O);
991
1927
 
992
- /***/ "react":
993
- /*!************************!*\
994
- !*** external "react" ***!
995
- \************************/
996
- /***/ ((module) => {
1928
+ return result !== expected || calls !== expected;
1929
+ });
1930
+
1931
+ // `RegExp.prototype.flags` getter
1932
+ // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
1933
+ if (FORCED) defineBuiltInAccessor(RegExpPrototype, 'flags', {
1934
+ configurable: true,
1935
+ get: regExpFlags
1936
+ });
997
1937
 
998
- module.exports = require("react");
999
1938
 
1000
1939
  /***/ })
1001
1940
 
@@ -1019,7 +1958,7 @@ module.exports = require("react");
1019
1958
  /******/ };
1020
1959
  /******/
1021
1960
  /******/ // Execute the module function
1022
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
1961
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
1023
1962
  /******/
1024
1963
  /******/ // Return the exports of the module
1025
1964
  /******/ return module.exports;
@@ -1075,28 +2014,24 @@ var __webpack_exports__ = {};
1075
2014
  \***********************/
1076
2015
  __webpack_require__.r(__webpack_exports__);
1077
2016
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1078
- /* harmony export */ "FlagshipContext": () => (/* reexport safe */ _FlagshipContext__WEBPACK_IMPORTED_MODULE_0__.FlagshipContext),
1079
- /* harmony export */ "FlagshipProvider": () => (/* reexport safe */ _FlagshipContext__WEBPACK_IMPORTED_MODULE_0__.FlagshipProvider),
2017
+ /* harmony export */ FlagshipProvider: () => (/* reexport safe */ _FlagshipProvider__WEBPACK_IMPORTED_MODULE_2__.FlagshipProvider),
1080
2018
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
1081
- /* harmony export */ "useFlagship": () => (/* reexport safe */ _FlagshipHooks__WEBPACK_IMPORTED_MODULE_2__.useFlagship),
1082
- /* harmony export */ "useFsActivate": () => (/* reexport safe */ _FlagshipHooks__WEBPACK_IMPORTED_MODULE_2__.useFsActivate),
1083
- /* harmony export */ "useFsFlag": () => (/* reexport safe */ _FlagshipHooks__WEBPACK_IMPORTED_MODULE_2__.useFsFlag),
1084
- /* harmony export */ "useFsModification": () => (/* reexport safe */ _FlagshipHooks__WEBPACK_IMPORTED_MODULE_2__.useFsModification),
1085
- /* harmony export */ "useFsModificationInfo": () => (/* reexport safe */ _FlagshipHooks__WEBPACK_IMPORTED_MODULE_2__.useFsModificationInfo),
1086
- /* harmony export */ "useFsModifications": () => (/* reexport safe */ _FlagshipHooks__WEBPACK_IMPORTED_MODULE_2__.useFsModifications)
2019
+ /* harmony export */ useFlagship: () => (/* reexport safe */ _FlagshipHooks__WEBPACK_IMPORTED_MODULE_1__.useFlagship),
2020
+ /* harmony export */ useFsFlag: () => (/* reexport safe */ _FlagshipHooks__WEBPACK_IMPORTED_MODULE_1__.useFsFlag)
1087
2021
  /* harmony export */ });
1088
- /* harmony import */ var _FlagshipContext__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./FlagshipContext */ "./src/FlagshipContext.tsx");
1089
- /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @flagship.io/js-sdk */ "@flagship.io/js-sdk");
1090
- /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__);
2022
+ /* harmony import */ var _FlagshipProvider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FlagshipProvider */ "./src/FlagshipProvider.tsx");
2023
+ /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @flagship.io/js-sdk */ "@flagship.io/js-sdk");
2024
+ /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0__);
1091
2025
  /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
1092
- /* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__) if(["default","FlagshipContext","FlagshipProvider"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__[__WEBPACK_IMPORT_KEY__]
2026
+ /* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0__) if(["default","FlagshipProvider"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__]
1093
2027
  /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
1094
- /* harmony import */ var _FlagshipHooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FlagshipHooks */ "./src/FlagshipHooks.tsx");
2028
+ /* harmony import */ var _FlagshipHooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./FlagshipHooks */ "./src/FlagshipHooks.ts");
2029
+
1095
2030
 
1096
2031
 
1097
2032
 
1098
2033
 
1099
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_FlagshipContext__WEBPACK_IMPORTED_MODULE_0__.FlagshipProvider);
2034
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_FlagshipProvider__WEBPACK_IMPORTED_MODULE_2__.FlagshipProvider);
1100
2035
  })();
1101
2036
 
1102
2037
  module.exports = __webpack_exports__;