@flagship.io/react-sdk 3.0.7 → 3.0.10-alpha.0
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/README.md +27 -27
- package/dist/FlagshipContext.js +15 -22
- package/dist/index.node.js +1 -1531
- package/dist/index.node.js.map +1 -1
- package/package.json +101 -100
- package/dist/index.browser.js +0 -8673
- package/dist/index.browser.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
[](https://github.com/flagship-io/flagship-react-sdk/actions/workflows/workflow.yml) [](https://badge.fury.io/js/@flagship.io%2Freact-sdk)
|
|
2
|
-
|
|
3
|
-
## About Flagship
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<img src="https://www.flagship.io/wp-content/uploads/Flagship-horizontal-black-wake-AB.png" alt="drawing" width="150"/>
|
|
7
|
-
|
|
8
|
-
[Flagship by AB Tasty](https://www.flagship.io/) is a feature flagging platform for modern engineering and product teams. It eliminates the risks of future releases by separating code deployments from these releases :bulb: With Flagship, you have full control over the release process. You can:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- Switch features on or off through remote config.
|
|
12
|
-
- Automatically roll-out your features gradually to monitor performance and gather feedback from your most relevant users.
|
|
13
|
-
- Roll back any feature should any issues arise while testing in production.
|
|
14
|
-
- Segment users by granting access to a feature based on certain user attributes.
|
|
15
|
-
- Carry out A/B tests by easily assigning feature variations to groups of users.
|
|
16
|
-
|
|
17
|
-
<img src="https://www.flagship.io/wp-content/uploads/demo-setup.png" alt="drawing" width="600"/>
|
|
18
|
-
|
|
19
|
-
Flagship also allows you to choose whatever implementation method works for you from our many available SDKs or directly through a REST API. Additionally, our architecture is based on multi-cloud providers that offer high performance and highly-scalable managed services.
|
|
20
|
-
|
|
21
|
-
**To learn more:**
|
|
22
|
-
|
|
23
|
-
- [Solution overview](https://www.flagship.io/#showvideo) - A 5mn video demo :movie_camera:
|
|
24
|
-
- [Documentation](https://docs.developers.flagship.io/) - Our dev portal with guides, how tos, API and SDK references
|
|
25
|
-
- [Sign up for a free trial](https://www.flagship.io/sign-up/) - Create your free account
|
|
26
|
-
- [Guide to feature flagging](https://www.flagship.io/feature-flags/) - Everyhting you need to know about feature flag related use cases
|
|
27
|
-
- [Blog](https://www.flagship.io/blog/) - Additional resources about release management
|
|
1
|
+
[](https://github.com/flagship-io/flagship-react-sdk/actions/workflows/workflow.yml) [](https://badge.fury.io/js/@flagship.io%2Freact-sdk)
|
|
2
|
+
|
|
3
|
+
## About Flagship
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
<img src="https://www.flagship.io/wp-content/uploads/Flagship-horizontal-black-wake-AB.png" alt="drawing" width="150"/>
|
|
7
|
+
|
|
8
|
+
[Flagship by AB Tasty](https://www.flagship.io/) is a feature flagging platform for modern engineering and product teams. It eliminates the risks of future releases by separating code deployments from these releases :bulb: With Flagship, you have full control over the release process. You can:
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
- Switch features on or off through remote config.
|
|
12
|
+
- Automatically roll-out your features gradually to monitor performance and gather feedback from your most relevant users.
|
|
13
|
+
- Roll back any feature should any issues arise while testing in production.
|
|
14
|
+
- Segment users by granting access to a feature based on certain user attributes.
|
|
15
|
+
- Carry out A/B tests by easily assigning feature variations to groups of users.
|
|
16
|
+
|
|
17
|
+
<img src="https://www.flagship.io/wp-content/uploads/demo-setup.png" alt="drawing" width="600"/>
|
|
18
|
+
|
|
19
|
+
Flagship also allows you to choose whatever implementation method works for you from our many available SDKs or directly through a REST API. Additionally, our architecture is based on multi-cloud providers that offer high performance and highly-scalable managed services.
|
|
20
|
+
|
|
21
|
+
**To learn more:**
|
|
22
|
+
|
|
23
|
+
- [Solution overview](https://www.flagship.io/#showvideo) - A 5mn video demo :movie_camera:
|
|
24
|
+
- [Documentation](https://docs.developers.flagship.io/) - Our dev portal with guides, how tos, API and SDK references
|
|
25
|
+
- [Sign up for a free trial](https://www.flagship.io/sign-up/) - Create your free account
|
|
26
|
+
- [Guide to feature flagging](https://www.flagship.io/feature-flags/) - Everyhting you need to know about feature flag related use cases
|
|
27
|
+
- [Blog](https://www.flagship.io/blog/) - Additional resources about release management
|
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;
|