@flagship.io/react-sdk 4.0.0-alpha.0 → 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,871 +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]);
340
+ // #region functions
212
341
 
213
- const onVariationsForced = () => {
214
- setState(state => ({ ...state,
215
- toggleForcedVariations: !state.toggleForcedVariations
216
- }));
342
+ const onBucketingLastModified = lastUpdate => {
343
+ if (onBucketingUpdated) {
344
+ onBucketingUpdated(lastUpdate);
345
+ }
346
+ setLastModified(lastUpdate);
217
347
  };
218
-
219
- function initializeState(param) {
220
- const newStatus = {
221
- isSdkReady: param.isSdkReady,
222
- isLoading: param.isLoading,
223
- isVisitorDefined: !!param.fsVisitor,
224
- lastRefresh: new Date().toISOString()
225
- };
226
- setState(currentState => {
227
- if (!currentState.status.firstInitSuccess) {
228
- newStatus.firstInitSuccess = new Date().toISOString();
229
- }
230
-
231
- return { ...currentState,
232
- visitor: param.fsVisitor,
233
- modifications: param.fsVisitor.modifications,
234
- config: _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.Flagship.getConfig(),
235
- status: { ...currentState.status,
236
- ...newStatus
237
- }
238
- };
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
239
377
  });
240
- return newStatus;
241
- } // eslint-disable-next-line @typescript-eslint/no-explicit-any
242
-
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
+ }
243
388
 
389
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
244
390
  const onVisitorReady = (fsVisitor, error) => {
245
391
  if (error) {
246
- (0,_utils__WEBPACK_IMPORTED_MODULE_3__.logError)(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.Flagship.getConfig(), error.message || error, 'onReady');
392
+ (0,_utils__WEBPACK_IMPORTED_MODULE_3__.logError)(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1___default().getConfig(), error.message || error, 'onReady');
393
+ }
394
+ initializeState({
395
+ fsVisitor
396
+ });
397
+ };
398
+ const createVisitor = () => {
399
+ if (!visitorData) {
247
400
  return;
248
401
  }
249
-
250
- const newStatus = initializeState({
251
- fsVisitor,
252
- isSdkReady: true,
253
- isLoading: false
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
254
411
  });
255
-
256
- if (onUpdate) {
257
- onUpdate({
258
- fsModifications: fsVisitor.modifications,
259
- config: _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.Flagship.getConfig(),
260
- status: newStatus
412
+ fsVisitor === null || fsVisitor === void 0 || fsVisitor.on('ready', error => {
413
+ onVisitorReady(fsVisitor, error);
414
+ });
415
+ if (!fetchNow) {
416
+ initializeState({
417
+ fsVisitor
261
418
  });
262
419
  }
263
420
  };
264
-
265
421
  function updateVisitor() {
266
422
  if (!visitorData) {
267
423
  return;
268
424
  }
269
-
270
425
  if (!state.visitor || state.visitor.visitorId !== visitorData.id && (!visitorData.isAuthenticated || visitorData.isAuthenticated && state.visitor.anonymousId)) {
271
426
  createVisitor();
272
427
  return;
273
428
  }
274
-
275
429
  if (visitorData.hasConsented !== state.visitor.hasConsented) {
276
430
  var _visitorData$hasConse;
277
-
278
431
  state.visitor.setConsent((_visitorData$hasConse = visitorData.hasConsented) !== null && _visitorData$hasConse !== void 0 ? _visitorData$hasConse : true);
279
- } // eslint-disable-next-line @typescript-eslint/no-explicit-any
280
-
281
-
432
+ }
433
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
282
434
  state.visitor.updateContext(visitorData.context);
283
-
284
435
  if (!state.visitor.anonymousId && visitorData.isAuthenticated) {
285
436
  state.visitor.authenticate(visitorData.id);
286
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
+ /***/ }),
287
1034
 
288
- if (state.visitor.anonymousId && !visitorData.isAuthenticated) {
289
- state.visitor.unauthenticate();
290
- }
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__) => {
291
1040
 
292
- state.visitor.fetchFlags();
293
- }
294
1041
 
295
- const createVisitor = () => {
296
- if (!visitorData) {
297
- return;
298
- }
1042
+ var NATIVE_BIND = __webpack_require__(/*! ../internals/function-bind-native */ "./node_modules/core-js/internals/function-bind-native.js");
299
1043
 
300
- const fsVisitor = _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.Flagship.newVisitor({
301
- visitorId: visitorData.id,
302
- context: visitorData.context,
303
- isAuthenticated: visitorData.isAuthenticated,
304
- hasConsented: visitorData.hasConsented,
305
- initialCampaigns,
306
- initialModifications,
307
- initialFlagsData
308
- });
309
- fsVisitor === null || fsVisitor === void 0 ? void 0 : fsVisitor.on('ready', error => {
310
- onVisitorReady(fsVisitor, error);
311
- });
1044
+ var FunctionPrototype = Function.prototype;
1045
+ var call = FunctionPrototype.call;
1046
+ var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);
312
1047
 
313
- if (!fetchNow) {
314
- initializeState({
315
- fsVisitor,
316
- isSdkReady: true,
317
- isLoading: false
318
- });
319
- }
1048
+ module.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) {
1049
+ return function () {
1050
+ return call.apply(fn, arguments);
320
1051
  };
1052
+ };
321
1053
 
322
- const statusChanged = status => {
323
- if (statusChangedCallback) {
324
- statusChangedCallback(status);
325
- }
326
1054
 
327
- switch (status) {
328
- case _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.FlagshipStatus.STARTING:
329
- if (status === _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.FlagshipStatus.STARTING && onInitStart) {
330
- onInitStart();
331
- }
1055
+ /***/ }),
332
1056
 
333
- break;
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__) => {
334
1062
 
335
- case _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.FlagshipStatus.READY_PANIC_ON:
336
- case _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.FlagshipStatus.READY:
337
- if (onInitDone) {
338
- onInitDone();
339
- }
340
1063
 
341
- createVisitor();
342
- break;
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");
343
1066
 
344
- case _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.FlagshipStatus.NOT_INITIALIZED:
345
- setState(prev => ({ ...prev,
346
- status: { ...prev.status,
347
- isLoading: false
348
- },
349
- config: _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.Flagship.getConfig()
350
- }));
351
- break;
352
- }
353
- };
1067
+ var aFunction = function (argument) {
1068
+ return isCallable(argument) ? argument : undefined;
1069
+ };
354
1070
 
355
- const onBucketingLastModified = lastUpdate => {
356
- if (onBucketingUpdated) {
357
- onBucketingUpdated(lastUpdate);
358
- }
1071
+ module.exports = function (namespace, method) {
1072
+ return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method];
1073
+ };
359
1074
 
360
- setLastModified(lastUpdate);
361
- };
362
1075
 
363
- const initSdk = () => {
364
- _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__.Flagship.start(envId, apiKey, {
365
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
366
- decisionMode: decisionMode,
367
- fetchNow,
368
- statusChangedCallback: statusChanged,
369
- onBucketingUpdated: onBucketingLastModified,
370
- hitDeduplicationTime,
371
- language,
372
- sdkVersion,
373
- ...props
374
- });
375
- };
1076
+ /***/ }),
376
1077
 
377
- const handleDisplay = () => {
378
- const isFirstInit = !state.visitor;
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__) => {
379
1083
 
380
- if (state.status.isLoading && loadingComponent && isFirstInit && fetchNow) {
381
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, loadingComponent);
382
- }
383
1084
 
384
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, children);
385
- };
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");
386
1087
 
387
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(FlagshipContext.Provider, {
388
- value: {
389
- state,
390
- setState
391
- }
392
- }, handleDisplay());
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);
393
1093
  };
394
1094
 
1095
+
395
1096
  /***/ }),
396
1097
 
397
- /***/ "./src/FlagshipHooks.tsx":
398
- /*!*******************************!*\
399
- !*** ./src/FlagshipHooks.tsx ***!
400
- \*******************************/
401
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1098
+ /***/ "./node_modules/core-js/internals/global.js":
1099
+ /*!**************************************************!*\
1100
+ !*** ./node_modules/core-js/internals/global.js ***!
1101
+ \**************************************************/
1102
+ /***/ (function(module) {
402
1103
 
403
- __webpack_require__.r(__webpack_exports__);
404
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
405
- /* harmony export */ "useFlagship": () => (/* binding */ useFlagship),
406
- /* harmony export */ "useFsActivate": () => (/* binding */ useFsActivate),
407
- /* harmony export */ "useFsFlag": () => (/* binding */ useFsFlag),
408
- /* harmony export */ "useFsModification": () => (/* binding */ useFsModification),
409
- /* harmony export */ "useFsModificationInfo": () => (/* binding */ useFsModificationInfo),
410
- /* harmony export */ "useFsModifications": () => (/* binding */ useFsModifications)
411
- /* harmony export */ });
412
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
413
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
414
- /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @flagship.io/js-sdk */ "@flagship.io/js-sdk");
415
- /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__);
416
- /* harmony import */ var _FlagshipContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./FlagshipContext */ "./src/FlagshipContext.tsx");
417
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ "./src/utils.tsx");
418
- /* harmony import */ var _Flag__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Flag */ "./src/Flag.ts");
419
- /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants */ "./src/constants.ts");
420
1104
 
1105
+ var check = function (it) {
1106
+ return it && it.Math === Math && it;
1107
+ };
421
1108
 
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')();
422
1120
 
423
1121
 
1122
+ /***/ }),
424
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__) => {
425
1129
 
426
1130
 
427
- const checkType = (value, defaultValue) => typeof value === 'object' && typeof defaultValue === 'object' && Array.isArray(value) === Array.isArray(defaultValue) || typeof value === typeof defaultValue;
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");
428
1133
 
429
- const fsModificationsSync = args => {
430
- const {
431
- visitor,
432
- params,
433
- activateAll,
434
- state,
435
- functionName,
436
- config
437
- } = args;
1134
+ var hasOwnProperty = uncurryThis({}.hasOwnProperty);
438
1135
 
439
- if (visitor) {
440
- return visitor.getModificationsSync(params, activateAll);
441
- }
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);
1141
+ };
442
1142
 
443
- const check = !state.status.isSdkReady && !!state.modifications && state.modifications.size > 0;
444
- const flags = {};
445
1143
 
446
- if (check) {
447
- params.forEach(item => {
448
- var _state$modifications;
1144
+ /***/ }),
449
1145
 
450
- const modification = (_state$modifications = state.modifications) === null || _state$modifications === void 0 ? void 0 : _state$modifications.get(item.key);
1146
+ /***/ "./node_modules/core-js/internals/hidden-keys.js":
1147
+ /*!*******************************************************!*\
1148
+ !*** ./node_modules/core-js/internals/hidden-keys.js ***!
1149
+ \*******************************************************/
1150
+ /***/ ((module) => {
451
1151
 
452
- if (modification && checkType(modification === null || modification === void 0 ? void 0 : modification.value, item.defaultValue)) {
453
- flags[item.key] = modification.value;
454
- } else {
455
- flags[item.key] = item.defaultValue;
456
- }
457
- });
458
- return flags;
459
- }
460
1152
 
461
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logWarn)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorDefault, functionName);
462
- params.forEach(item => {
463
- flags[item.key] = item.defaultValue;
464
- });
465
- return flags;
1153
+ module.exports = {};
1154
+
1155
+
1156
+ /***/ }),
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__) => {
1163
+
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");
1168
+
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
+ });
1176
+
1177
+
1178
+ /***/ }),
1179
+
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__) => {
1185
+
1186
+
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");
1190
+
1191
+ var functionToString = uncurryThis(Function.toString);
1192
+
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, {});
466
1228
  };
467
- /**
468
- * 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.
469
- * @deprecated use useFsFlag instead
470
- */
471
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
+ };
472
1238
 
473
- const useFsModifications = (params, activateAll) => {
474
- const {
475
- state
476
- } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_FlagshipContext__WEBPACK_IMPORTED_MODULE_4__.FlagshipContext);
477
- const {
478
- visitor,
479
- config
480
- } = state;
481
- const functionName = 'useFsModifications';
482
- return fsModificationsSync({
483
- functionName,
484
- state,
485
- visitor,
486
- config,
487
- params,
488
- activateAll
489
- });
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
490
1281
  };
491
- /**
492
- * 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.
493
- * @deprecated use useFsFlag instead
494
- */
495
1282
 
496
- const useFsModification = params => {
497
- var _state$modifications2;
498
1283
 
499
- const {
500
- state
501
- } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_FlagshipContext__WEBPACK_IMPORTED_MODULE_4__.FlagshipContext);
502
- const {
503
- visitor,
504
- config
505
- } = state;
506
- const functionName = 'useFsModifications';
1284
+ /***/ }),
507
1285
 
508
- if (visitor) {
509
- return visitor.getModificationSync(params);
510
- }
1286
+ /***/ "./node_modules/core-js/internals/is-callable.js":
1287
+ /*!*******************************************************!*\
1288
+ !*** ./node_modules/core-js/internals/is-callable.js ***!
1289
+ \*******************************************************/
1290
+ /***/ ((module) => {
511
1291
 
512
- const modification = (_state$modifications2 = state.modifications) === null || _state$modifications2 === void 0 ? void 0 : _state$modifications2.get(params.key);
513
1292
 
514
- if (!state.status.isSdkReady && modification && checkType(modification === null || modification === void 0 ? void 0 : modification.value, params.defaultValue)) {
515
- return modification.value;
516
- }
1293
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
1294
+ var documentAll = typeof document == 'object' && document.all;
517
1295
 
518
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logWarn)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorDefault, functionName);
519
- 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';
520
1303
  };
521
1304
 
522
- const fsModificationInfoSync = args => {
523
- var _state$modifications3;
524
1305
 
525
- const {
526
- key,
527
- visitor,
528
- state
529
- } = args;
1306
+ /***/ }),
530
1307
 
531
- if (visitor) {
532
- return visitor.getModificationInfoSync(key);
533
- }
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) => {
534
1313
 
535
- const modification = (_state$modifications3 = state.modifications) === null || _state$modifications3 === void 0 ? void 0 : _state$modifications3.get(key);
536
1314
 
537
- if (!state.status.isSdkReady && modification) {
538
- return modification;
539
- }
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
+ };
540
1320
 
541
- 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);
542
1335
  };
543
- /**
544
- * Get the campaign modification information value matching the given key.
545
- * @param {string} key key which identify the modification.
546
- * @deprecated use useFsFlag instead
547
- */
548
1336
 
549
1337
 
550
- const useFsModificationInfo = key => {
551
- const {
552
- state
553
- } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_FlagshipContext__WEBPACK_IMPORTED_MODULE_4__.FlagshipContext);
554
- const {
555
- visitor
556
- } = state;
557
- return fsModificationInfoSync({
558
- key,
559
- state,
560
- visitor
561
- });
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));
562
1371
  };
563
1372
 
564
- const fsActivate = async (params, functionName, visitor, config) => {
565
- try {
566
- if (!visitor) {
567
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logWarn)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, functionName);
568
- return;
569
- }
570
1373
 
571
- await visitor.activateModifications(params); // eslint-disable-next-line @typescript-eslint/no-explicit-any
572
- } catch (error) {
573
- (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 });
574
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;
575
1430
  };
576
- /**
577
- * This hook returns a flag object by its key. If no flag match the given key an empty flag will be returned.
578
- * @param key
579
- * @param defaultValue
580
- * @returns
581
- */
582
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');
583
1437
 
584
- const useFsFlag = (key, defaultValue) => {
585
- const {
586
- state
587
- } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_FlagshipContext__WEBPACK_IMPORTED_MODULE_4__.FlagshipContext);
588
- const {
589
- visitor
590
- } = state;
591
1438
 
592
- if (!visitor) {
593
- return new _Flag__WEBPACK_IMPORTED_MODULE_5__.Flag(defaultValue, key, state.modifications);
594
- }
1439
+ /***/ }),
595
1440
 
596
- 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;
597
1490
  };
598
- /**
599
- * Report this user has seen this modification. Report this user has seen these modifications.
600
- * @param params
601
- * @deprecated use useFsFlag instead
602
- * @returns
603
- */
604
1491
 
605
- const useFsActivate = async params => {
606
- const {
607
- state
608
- } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_FlagshipContext__WEBPACK_IMPORTED_MODULE_4__.FlagshipContext);
609
- const {
610
- visitor,
611
- config
612
- } = state;
613
- const functionName = 'useFsModifications';
614
- 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");
615
1530
  };
616
- const useFlagship = () => {
617
- const {
618
- state
619
- } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_FlagshipContext__WEBPACK_IMPORTED_MODULE_4__.FlagshipContext);
620
- const {
621
- visitor,
622
- config
623
- } = state;
624
1531
 
625
- const fsUpdateContext = context => {
626
- const functionName = 'updateContext';
627
1532
 
628
- if (!visitor) {
629
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logError)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, functionName);
630
- return;
631
- }
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
+
632
1590
 
633
- visitor.clearContext();
634
- visitor.updateContext(context);
635
- };
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");
636
1593
 
637
- const fsClearContext = () => {
638
- const functionName = 'cleanContext';
1594
+ var keys = shared('keys');
639
1595
 
640
- if (!visitor) {
641
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logError)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, functionName);
642
- return;
643
- }
1596
+ module.exports = function (key) {
1597
+ return keys[key] || (keys[key] = uid(key));
1598
+ };
644
1599
 
645
- visitor.clearContext();
646
- };
647
1600
 
648
- const fsAuthenticate = visitorId => {
649
- const functionName = 'authenticate';
1601
+ /***/ }),
650
1602
 
651
- if (!visitor) {
652
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logError)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, functionName);
653
- return;
654
- }
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__) => {
655
1608
 
656
- visitor.authenticate(visitorId);
657
- };
658
1609
 
659
- const fsUnauthenticate = () => {
660
- 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");
661
1613
 
662
- if (!visitor) {
663
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logError)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, functionName);
664
- return;
665
- }
1614
+ var SHARED = '__core-js_shared__';
1615
+ var store = module.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
666
1616
 
667
- visitor.unauthenticate();
668
- };
669
- /**
670
- * Send a Hit to Flagship servers for reporting.
671
- */
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
+ });
672
1624
 
673
1625
 
674
- const fsSendHit = hit => {
675
- const functionName = 'sendHit';
1626
+ /***/ }),
676
1627
 
677
- if (!visitor) {
678
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logError)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, functionName);
679
- return Promise.resolve();
680
- }
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__) => {
681
1633
 
682
- return visitor.sendHit(hit);
683
- };
684
- /**
685
- * Send a Hit to Flagship servers for reporting.
686
- */
687
1634
 
1635
+ var store = __webpack_require__(/*! ../internals/shared-store */ "./node_modules/core-js/internals/shared-store.js");
688
1636
 
689
- const fsSendHits = hit => {
690
- const functionName = 'sendHits';
1637
+ module.exports = function (key, value) {
1638
+ return store[key] || (store[key] = value || {});
1639
+ };
691
1640
 
692
- if (!visitor) {
693
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logError)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, functionName);
694
- return Promise.resolve();
695
- }
696
1641
 
697
- return visitor.sendHits(hit);
698
- };
1642
+ /***/ }),
699
1643
 
700
- 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
+ });
701
1669
 
702
- if (!state.status.isSdkReady && state.modifications) {
703
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
704
- modifications = Array.from(state.modifications, ([_key, item]) => item);
705
- }
706
1670
 
707
- const activateModification = async params => {
708
- const functionName = 'activateModification';
709
- await fsActivate(params, functionName, visitor, config);
710
- };
1671
+ /***/ }),
711
1672
 
712
- const synchronizeModifications = async () => {
713
- if (!visitor) {
714
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logWarn)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, 'synchronizeModifications');
715
- return;
716
- }
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__) => {
717
1678
 
718
- await visitor.synchronizeModifications();
719
- };
720
1679
 
721
- const getModifications = (params, activateAll) => {
722
- const functionName = 'getModifications';
723
- return fsModificationsSync({
724
- functionName,
725
- state,
726
- visitor,
727
- config,
728
- params,
729
- activateAll
730
- });
731
- };
1680
+ var requireObjectCoercible = __webpack_require__(/*! ../internals/require-object-coercible */ "./node_modules/core-js/internals/require-object-coercible.js");
732
1681
 
733
- const getModificationInfo = key => {
734
- return fsModificationInfoSync({
735
- key,
736
- state,
737
- visitor
738
- });
739
- };
1682
+ var $Object = Object;
740
1683
 
741
- function getFlag(key, defaultValue) {
742
- if (!visitor) {
743
- return new _Flag__WEBPACK_IMPORTED_MODULE_5__.Flag(defaultValue, key, state.modifications);
744
- }
1684
+ // `ToObject` abstract operation
1685
+ // https://tc39.es/ecma262/#sec-toobject
1686
+ module.exports = function (argument) {
1687
+ return $Object(requireObjectCoercible(argument));
1688
+ };
745
1689
 
746
- return visitor.getFlag(key, defaultValue);
747
- }
748
1690
 
749
- function fetchFlags() {
750
- if (!visitor) {
751
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logWarn)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, 'fetchFlags');
752
- return Promise.resolve();
753
- }
1691
+ /***/ }),
754
1692
 
755
- 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");
756
1721
  }
1722
+ if (pref === undefined) pref = 'number';
1723
+ return ordinaryToPrimitive(input, pref);
1724
+ };
757
1725
 
758
- function setConsent(hasConsented) {
759
- if (!visitor) {
760
- (0,_utils__WEBPACK_IMPORTED_MODULE_2__.logWarn)(config, _constants__WEBPACK_IMPORTED_MODULE_3__.noVisitorMessage, 'setConsent');
761
- return;
762
- }
763
1726
 
764
- visitor.setConsent(hasConsented);
765
- }
1727
+ /***/ }),
766
1728
 
767
- async function close() {
768
- await _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1___default().close();
769
- }
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__) => {
770
1734
 
771
- return {
772
- visitorId: visitor === null || visitor === void 0 ? void 0 : visitor.visitorId,
773
- anonymousId: visitor === null || visitor === void 0 ? void 0 : visitor.anonymousId,
774
- context: { ...(visitor === null || visitor === void 0 ? void 0 : visitor.context)
775
- },
776
- hasConsented: visitor === null || visitor === void 0 ? void 0 : visitor.hasConsented,
777
- setConsent,
778
- updateContext: fsUpdateContext,
779
- clearContext: fsClearContext,
780
- authenticate: fsAuthenticate,
781
- unauthenticate: fsUnauthenticate,
782
- status: state.status,
783
- activateModification,
784
- synchronizeModifications,
785
- getModifications,
786
- modifications: modifications || [],
787
- flagsData: (visitor === null || visitor === void 0 ? void 0 : visitor.getFlagsDataArray()) || [],
788
- getModificationInfo,
789
- hit: {
790
- send: fsSendHit,
791
- sendMultiple: fsSendHits
792
- },
793
- getFlag,
794
- fetchFlags,
795
- close
796
- };
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 + '';
797
1744
  };
798
1745
 
1746
+
799
1747
  /***/ }),
800
1748
 
801
- /***/ "./src/constants.ts":
802
- /*!**************************!*\
803
- !*** ./src/constants.ts ***!
804
- \**************************/
805
- /***/ ((__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
+ };
806
1765
 
807
- __webpack_require__.r(__webpack_exports__);
808
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
809
- /* harmony export */ "GET_FLAG_CAST_ERROR": () => (/* binding */ GET_FLAG_CAST_ERROR),
810
- /* harmony export */ "GET_METADATA_CAST_ERROR": () => (/* binding */ GET_METADATA_CAST_ERROR),
811
- /* harmony export */ "noVisitorDefault": () => (/* binding */ noVisitorDefault),
812
- /* harmony export */ "noVisitorMessage": () => (/* binding */ noVisitorMessage)
813
- /* harmony export */ });
814
- const noVisitorMessage = 'flagship Visitor not initialized.';
815
- const noVisitorDefault = 'fsVisitor not initialized, returns default value';
816
- const GET_FLAG_CAST_ERROR = 'Flag for key {0} has a different type. Default value is returned.';
817
- const GET_METADATA_CAST_ERROR = 'Flag for key {0} has a different type with defaultValue, an empty metadata object is returned';
818
1766
 
819
1767
  /***/ }),
820
1768
 
821
- /***/ "./src/internalType.ts":
822
- /*!*****************************!*\
823
- !*** ./src/internalType.ts ***!
824
- \*****************************/
825
- /***/ ((__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__) => {
826
1774
 
827
- __webpack_require__.r(__webpack_exports__);
828
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
829
- /* harmony export */ "INTERNAL_EVENTS": () => (/* binding */ INTERNAL_EVENTS)
830
- /* harmony export */ });
831
- let INTERNAL_EVENTS;
832
1775
 
833
- (function (INTERNAL_EVENTS) {
834
- INTERNAL_EVENTS["FsTriggerRendering"] = "FS_TRIGGER_RENDERING";
835
- })(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
+
836
1786
 
837
1787
  /***/ }),
838
1788
 
839
- /***/ "./src/sdkVersion.ts":
840
- /*!***************************!*\
841
- !*** ./src/sdkVersion.ts ***!
842
- \***************************/
843
- /***/ ((__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';
844
1802
 
845
- __webpack_require__.r(__webpack_exports__);
846
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
847
- /* harmony export */ "version": () => (/* binding */ version)
848
- /* harmony export */ });
849
- // Generated by genversion.
850
- const version = '4.0.0-alpha.0';
851
1803
 
852
1804
  /***/ }),
853
1805
 
854
- /***/ "./src/utils.tsx":
855
- /*!***********************!*\
856
- !*** ./src/utils.tsx ***!
857
- \***********************/
858
- /***/ ((__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__) => {
859
1811
 
860
- __webpack_require__.r(__webpack_exports__);
861
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
862
- /* harmony export */ "getModificationsFromCampaigns": () => (/* binding */ getModificationsFromCampaigns),
863
- /* harmony export */ "hasSameType": () => (/* binding */ hasSameType),
864
- /* harmony export */ "logError": () => (/* binding */ logError),
865
- /* harmony export */ "logInfo": () => (/* binding */ logInfo),
866
- /* harmony export */ "logWarn": () => (/* binding */ logWarn),
867
- /* harmony export */ "sprintf": () => (/* binding */ sprintf),
868
- /* harmony export */ "useNonInitialEffect": () => (/* binding */ useNonInitialEffect),
869
- /* harmony export */ "uuidV4": () => (/* binding */ uuidV4)
870
- /* harmony export */ });
871
- /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @flagship.io/js-sdk */ "@flagship.io/js-sdk");
872
- /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0__);
873
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
874
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
875
- 'use client';
876
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
+ });
877
1825
 
878
1826
 
879
- function logError(config, message, tag) {
880
- if (!config || !config.logManager || typeof config.logManager.error !== 'function' || !config.logLevel || config.logLevel < _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0__.LogLevel.ERROR) {
881
- return;
882
- }
1827
+ /***/ }),
883
1828
 
884
- config.logManager.error(message, tag);
885
- }
886
- function logInfo(config, message, tag) {
887
- if (!config || !config.logManager || typeof config.logManager.info !== 'function' || !config.logLevel || config.logLevel < _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0__.LogLevel.INFO) {
888
- return;
889
- }
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__) => {
890
1834
 
891
- config.logManager.info(message, tag);
892
- }
893
- function logWarn(config, message, tag) {
894
- if (!config || !config.logManager || typeof config.logManager.warning !== 'function' || !config.logLevel || config.logLevel < _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_0__.LogLevel.WARNING) {
895
- return;
896
- }
897
1835
 
898
- config.logManager.warning(message, tag);
899
- }
900
- const getModificationsFromCampaigns = campaigns => {
901
- 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");
902
1838
 
903
- if (!campaigns || !Array.isArray(campaigns)) {
904
- return modifications;
905
- }
1839
+ var WeakMap = global.WeakMap;
906
1840
 
907
- campaigns.forEach(campaign => {
908
- const object = campaign.variation.modifications.value;
1841
+ module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));
909
1842
 
910
- for (const key in object) {
911
- const value = object[key];
912
- modifications.set(key, {
913
- key,
914
- campaignId: campaign.id,
915
- campaignName: campaign.name || '',
916
- variationGroupId: campaign.variationGroupId,
917
- variationGroupName: campaign.variationGroupName || '',
918
- variationId: campaign.variation.id,
919
- variationName: campaign.variation.name || '',
920
- isReference: campaign.variation.reference,
921
- value
922
- });
923
- }
924
- });
925
- 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];
926
1870
  };
927
- function uuidV4() {
928
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (char) {
929
- const rand = Math.random() * 16 | 0;
930
- const value = char === 'x' ? rand : rand & 0x3 | 0x8;
931
- return value.toString(16);
932
- });
933
- }
934
- function useNonInitialEffect(effect, deps) {
935
- const initialRender = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(true);
936
- (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
937
- if (initialRender.current) {
938
- initialRender.current = false;
939
- return;
940
- }
941
1871
 
942
- if (typeof effect === 'function') {
943
- return effect();
944
- }
945
- }, deps);
946
- }
947
- function hasSameType(flagValue, defaultValue) {
948
- if (typeof flagValue !== typeof defaultValue) {
949
- return false;
950
- }
951
1872
 
952
- if (typeof flagValue === 'object' && typeof defaultValue === 'object' && Array.isArray(flagValue) !== Array.isArray(defaultValue)) {
953
- return false;
954
- }
1873
+ /***/ }),
955
1874
 
956
- return true;
957
- } // 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__) => {
958
1880
 
959
- function sprintf(format, ...value) {
960
- let formatted = format;
961
1881
 
962
- for (let i = 0; i < value.length; i++) {
963
- const element = value[i];
964
- 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;
965
1898
  }
966
1899
 
967
- return formatted;
968
- }
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
+ };
969
1912
 
970
- /***/ }),
1913
+ var pairs = {
1914
+ dotAll: 's',
1915
+ global: 'g',
1916
+ ignoreCase: 'i',
1917
+ multiline: 'm',
1918
+ sticky: 'y'
1919
+ };
971
1920
 
972
- /***/ "@flagship.io/js-sdk":
973
- /*!**************************************!*\
974
- !*** external "@flagship.io/js-sdk" ***!
975
- \**************************************/
976
- /***/ ((module) => {
1921
+ if (INDICES_SUPPORT) pairs.hasIndices = 'd';
977
1922
 
978
- module.exports = require("@flagship.io/js-sdk");
1923
+ for (var key in pairs) addGetter(key, pairs[key]);
979
1924
 
980
- /***/ }),
1925
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1926
+ var result = Object.getOwnPropertyDescriptor(RegExpPrototype, 'flags').get.call(O);
981
1927
 
982
- /***/ "react":
983
- /*!************************!*\
984
- !*** external "react" ***!
985
- \************************/
986
- /***/ ((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
+ });
987
1937
 
988
- module.exports = require("react");
989
1938
 
990
1939
  /***/ })
991
1940
 
@@ -1009,7 +1958,7 @@ module.exports = require("react");
1009
1958
  /******/ };
1010
1959
  /******/
1011
1960
  /******/ // Execute the module function
1012
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
1961
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
1013
1962
  /******/
1014
1963
  /******/ // Return the exports of the module
1015
1964
  /******/ return module.exports;
@@ -1065,28 +2014,24 @@ var __webpack_exports__ = {};
1065
2014
  \***********************/
1066
2015
  __webpack_require__.r(__webpack_exports__);
1067
2016
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1068
- /* harmony export */ "FlagshipContext": () => (/* reexport safe */ _FlagshipContext__WEBPACK_IMPORTED_MODULE_0__.FlagshipContext),
1069
- /* harmony export */ "FlagshipProvider": () => (/* reexport safe */ _FlagshipContext__WEBPACK_IMPORTED_MODULE_0__.FlagshipProvider),
2017
+ /* harmony export */ FlagshipProvider: () => (/* reexport safe */ _FlagshipProvider__WEBPACK_IMPORTED_MODULE_2__.FlagshipProvider),
1070
2018
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
1071
- /* harmony export */ "useFlagship": () => (/* reexport safe */ _FlagshipHooks__WEBPACK_IMPORTED_MODULE_2__.useFlagship),
1072
- /* harmony export */ "useFsActivate": () => (/* reexport safe */ _FlagshipHooks__WEBPACK_IMPORTED_MODULE_2__.useFsActivate),
1073
- /* harmony export */ "useFsFlag": () => (/* reexport safe */ _FlagshipHooks__WEBPACK_IMPORTED_MODULE_2__.useFsFlag),
1074
- /* harmony export */ "useFsModification": () => (/* reexport safe */ _FlagshipHooks__WEBPACK_IMPORTED_MODULE_2__.useFsModification),
1075
- /* harmony export */ "useFsModificationInfo": () => (/* reexport safe */ _FlagshipHooks__WEBPACK_IMPORTED_MODULE_2__.useFsModificationInfo),
1076
- /* 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)
1077
2021
  /* harmony export */ });
1078
- /* harmony import */ var _FlagshipContext__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./FlagshipContext */ "./src/FlagshipContext.tsx");
1079
- /* harmony import */ var _flagship_io_js_sdk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @flagship.io/js-sdk */ "@flagship.io/js-sdk");
1080
- /* 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__);
1081
2025
  /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
1082
- /* 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__]
1083
2027
  /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
1084
- /* 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
+
1085
2030
 
1086
2031
 
1087
2032
 
1088
2033
 
1089
- /* 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);
1090
2035
  })();
1091
2036
 
1092
2037
  module.exports = __webpack_exports__;