@flagship.io/react-sdk 3.0.8 → 3.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FlagshipContext.js +15 -22
- package/dist/index.browser.js +114 -99
- package/dist/index.browser.js.map +1 -1
- package/dist/index.node.js +89 -98
- package/dist/index.node.js.map +1 -1
- package/package.json +3 -3
package/dist/FlagshipContext.js
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
// eslint-disable-next-line no-use-before-define
|
|
2
13
|
import React, { useState, useEffect, createContext, useRef } from 'react';
|
|
3
14
|
import { Flagship, FlagshipStatus } from '@flagship.io/js-sdk';
|
|
@@ -8,7 +19,8 @@ const initStat = {
|
|
|
8
19
|
export const FlagshipContext = createContext({
|
|
9
20
|
state: Object.assign({}, initStat)
|
|
10
21
|
});
|
|
11
|
-
export const FlagshipProvider = (
|
|
22
|
+
export const FlagshipProvider = (_a) => {
|
|
23
|
+
var { children, fetchNow, envId, apiKey, decisionMode, visitorData, onInitStart, onInitDone, loadingComponent, statusChangedCallback, onBucketingUpdated, onUpdate, initialCampaigns, initialModifications, initialFlagsData, fetchFlagsOnBucketingUpdated } = _a, props = __rest(_a, ["children", "fetchNow", "envId", "apiKey", "decisionMode", "visitorData", "onInitStart", "onInitDone", "loadingComponent", "statusChangedCallback", "onBucketingUpdated", "onUpdate", "initialCampaigns", "initialModifications", "initialFlagsData", "fetchFlagsOnBucketingUpdated"]);
|
|
12
24
|
let modifications = new Map();
|
|
13
25
|
if (initialFlagsData && initialFlagsData.forEach) {
|
|
14
26
|
initialFlagsData.forEach((flag) => {
|
|
@@ -129,27 +141,8 @@ export const FlagshipProvider = ({ children, fetchNow, envId, apiKey, decisionMo
|
|
|
129
141
|
setLastModified(lastUpdate);
|
|
130
142
|
};
|
|
131
143
|
const initSdk = () => {
|
|
132
|
-
Flagship.start(envId, apiKey, {
|
|
133
|
-
|
|
134
|
-
fetchNow,
|
|
135
|
-
timeout,
|
|
136
|
-
logLevel,
|
|
137
|
-
statusChangedCallback: statusChanged,
|
|
138
|
-
logManager,
|
|
139
|
-
pollingInterval,
|
|
140
|
-
onBucketingFail,
|
|
141
|
-
onBucketingSuccess,
|
|
142
|
-
enableClientCache,
|
|
143
|
-
decisionApiUrl,
|
|
144
|
-
onBucketingUpdated: onBucketingLastModified,
|
|
145
|
-
initialBucketing,
|
|
146
|
-
activateDeduplicationTime,
|
|
147
|
-
hitDeduplicationTime,
|
|
148
|
-
visitorCacheImplementation,
|
|
149
|
-
hitCacheImplementation,
|
|
150
|
-
disableCache,
|
|
151
|
-
language
|
|
152
|
-
});
|
|
144
|
+
Flagship.start(envId, apiKey, Object.assign({ decisionMode,
|
|
145
|
+
fetchNow, statusChangedCallback: statusChanged, onBucketingUpdated: onBucketingLastModified }, props));
|
|
153
146
|
};
|
|
154
147
|
const handleDisplay = () => {
|
|
155
148
|
const isFirstInit = !state.visitor;
|