@flagship.io/react-sdk 2.1.8 → 2.1.10-beta.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/CONTRIBUTING.md +65 -65
- package/LICENSE +201 -201
- package/README.md +108 -108
- package/package.json +111 -112
- package/dist/FlagshipContext.d.ts +0 -99
- package/dist/FlagshipContext.js +0 -309
- package/dist/FlagshipContext.js.map +0 -1
- package/dist/FlagshipErrorBoundary.d.ts +0 -34
- package/dist/FlagshipErrorBoundary.js +0 -95
- package/dist/FlagshipErrorBoundary.js.map +0 -1
- package/dist/FlagshipHooks.d.ts +0 -33
- package/dist/FlagshipHooks.js +0 -198
- package/dist/FlagshipHooks.js.map +0 -1
- package/dist/components/ReactErrorBoundaryContainer/index.d.ts +0 -10
- package/dist/components/ReactErrorBoundaryContainer/index.js +0 -65
- package/dist/components/ReactErrorBoundaryContainer/index.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -15
- package/dist/index.js.map +0 -1
- package/dist/lib/loggerHelper.d.ts +0 -5
- package/dist/lib/loggerHelper.js +0 -14
- package/dist/lib/loggerHelper.js.map +0 -1
- package/dist/lib/utils.d.ts +0 -1
- package/dist/lib/utils.js +0 -7
- package/dist/lib/utils.js.map +0 -1
- package/dist/setupTests.d.ts +0 -1
- package/dist/setupTests.js +0 -9
- package/dist/setupTests.js.map +0 -1
- package/dist/tests/mock/apiAnswers/oneModifInMoreThanOneCampaign.d.ts +0 -3
- package/dist/tests/mock/apiAnswers/oneModifInMoreThanOneCampaign.js +0 -51
- package/dist/tests/mock/apiAnswers/oneModifInMoreThanOneCampaign.js.map +0 -1
- package/dist/tests/mock/env.d.ts +0 -5
- package/dist/tests/mock/env.js +0 -8
- package/dist/tests/mock/env.js.map +0 -1
- package/dist/tests/mock/index.d.ts +0 -70
- package/dist/tests/mock/index.js +0 -86
- package/dist/tests/mock/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
|
|
3
|
-
<img src="https://mk0abtastybwtpirqi5t.kinstacdn.com/wp-content/uploads/picture-solutions-persona-product-flagship.jpg" width="211" height="182" alt="flagship-react-sdk" />
|
|
4
|
-
|
|
5
|
-
</p>
|
|
6
|
-
|
|
7
|
-
<h3 align="center">Bring your features to life</h3>
|
|
8
|
-
|
|
9
|
-
<div style='display: flex; justify-content: space-around;'>
|
|
10
|
-
|
|
11
|
-
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
12
|
-
|
|
13
|
-
[](#contributors-)
|
|
14
|
-
|
|
15
|
-
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
16
|
-
|
|
17
|
-
[](http://www.apache.org/licenses/LICENSE-2.0)
|
|
18
|
-
|
|
19
|
-
[](https://github.com/abtasty/flagship-react-sdk/releases)
|
|
20
|
-
|
|
21
|
-
</div>
|
|
22
|
-
|
|
23
|
-
## Docs
|
|
24
|
-
|
|
25
|
-
**Visit [https://developers.flagship.io/](https://developers.flagship.io/) to get started with Flagship.**
|
|
26
|
-
|
|
27
|
-
- [Installation & Getting Started](https://developers.flagship.io/docs/sdk/react/v2.0#getting-started)
|
|
28
|
-
- [API Reference](https://developers.flagship.io/docs/sdk/react/v2.0#api-reference)
|
|
29
|
-
- [Flagship Provider Props](https://developers.flagship.io/docs/sdk/react/v2.0#flagshipprovider)
|
|
30
|
-
- Available Hooks
|
|
31
|
-
|
|
32
|
-
- [useFlagship](https://developers.flagship.io/docs/sdk/react/v2.0#useflagship)
|
|
33
|
-
- [useFsModifications](https://developers.flagship.io/docs/sdk/react/v2.0#usefsmodifications)
|
|
34
|
-
- [useFsActivate](https://developers.flagship.io/docs/sdk/react/v2.0#usefsactivate)
|
|
35
|
-
|
|
36
|
-
- [Getting modifications](https://developers.flagship.io/docs/sdk/react/v2.0#getting-modifications)
|
|
37
|
-
- [Campaign synchronization](https://developers.flagship.io/docs/sdk/react/v2.0#campaign-synchronization)
|
|
38
|
-
- [Hit tracking](https://developers.flagship.io/docs/sdk/react/v2.0#hit-tracking)
|
|
39
|
-
- [Release Notes](https://github.com/flagship-io/flagship-react-sdk/blob/master/RELEASENOTES.md)
|
|
40
|
-
- [Contributing](https://github.com/flagship-io/flagship-react-sdk/blob/master/CONTRIBUTING.md)
|
|
41
|
-
|
|
42
|
-
## Examples
|
|
43
|
-
|
|
44
|
-
Following demos illustrate how the SDK is used in practice ☕
|
|
45
|
-
|
|
46
|
-
- With React (for developers):
|
|
47
|
-
|
|
48
|
-
<a href="https://flagship-io.github.io/flagship-react-sdk/">
|
|
49
|
-
<div style="max-width: 850px; margin: 0 auto;">
|
|
50
|
-
|
|
51
|
-

|
|
52
|
-
|
|
53
|
-
</div>
|
|
54
|
-
</a>
|
|
55
|
-
<div style="display: flex; justify-content: space-around; font-size: 24px">
|
|
56
|
-
|
|
57
|
-
[Readme 📖](examples/react-dev-demo/README.md)
|
|
58
|
-
|
|
59
|
-
[Live Demo 🕹](https://flagship-io.github.io/flagship-react-sdk/)
|
|
60
|
-
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
- With React, e-commerce app:
|
|
64
|
-
|
|
65
|
-
<a href="https://react-ecommerce-demo.internal.flagship.io/">
|
|
66
|
-
<div style="max-width: 850px; margin: 0 auto;">
|
|
67
|
-
|
|
68
|
-

|
|
69
|
-
|
|
70
|
-
</div>
|
|
71
|
-
</a>
|
|
72
|
-
<div style="display: flex; justify-content: space-around; font-size: 24px">
|
|
73
|
-
|
|
74
|
-
[Readme 📖](examples/react-ecommerce-demo/README.md)
|
|
75
|
-
|
|
76
|
-
[Live Demo 🕹](https://react-ecommerce-demo.internal.flagship.io/)
|
|
77
|
-
|
|
78
|
-
</div>
|
|
79
|
-
|
|
80
|
-
- With React, codeSandbox, using campaign displaying cats / dogs / both:
|
|
81
|
-
|
|
82
|
-
<a href="https://codesandbox.io/s/flagship-sdk-react-example-sg5qu">
|
|
83
|
-
<div style="max-width: 850px; margin: 0 auto;">
|
|
84
|
-
|
|
85
|
-

|
|
86
|
-
|
|
87
|
-
</div>
|
|
88
|
-
</a>
|
|
89
|
-
<div style="display: flex; justify-content: space-around; font-size: 24px">
|
|
90
|
-
|
|
91
|
-
[Live Demo 🕹](https://codesandbox.io/s/flagship-sdk-react-example-sg5qu)
|
|
92
|
-
|
|
93
|
-
</div>
|
|
94
|
-
</a>
|
|
95
|
-
|
|
96
|
-
- With an universal (isomorphic) app, uses React both on server and client side:
|
|
97
|
-
|
|
98
|
-
[Source code 📚](./examples/react-universal-demo/README.md)
|
|
99
|
-
|
|
100
|
-
- With a server side rendering app, uses React on server:
|
|
101
|
-
|
|
102
|
-
[Source code 📚](./examples/react-ssr-demo/README.md)
|
|
103
|
-
|
|
104
|
-
</div>
|
|
105
|
-
|
|
106
|
-
## Licence
|
|
107
|
-
|
|
108
|
-
[Apache License.](https://github.com/flagship-io/flagship-react-sdk/blob/master/LICENSE)
|
|
1
|
+
<p align="center">
|
|
2
|
+
|
|
3
|
+
<img src="https://mk0abtastybwtpirqi5t.kinstacdn.com/wp-content/uploads/picture-solutions-persona-product-flagship.jpg" width="211" height="182" alt="flagship-react-sdk" />
|
|
4
|
+
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<h3 align="center">Bring your features to life</h3>
|
|
8
|
+
|
|
9
|
+
<div style='display: flex; justify-content: space-around;'>
|
|
10
|
+
|
|
11
|
+
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
12
|
+
|
|
13
|
+
[](#contributors-)
|
|
14
|
+
|
|
15
|
+
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
16
|
+
|
|
17
|
+
[](http://www.apache.org/licenses/LICENSE-2.0)
|
|
18
|
+
|
|
19
|
+
[](https://github.com/abtasty/flagship-react-sdk/releases)
|
|
20
|
+
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
## Docs
|
|
24
|
+
|
|
25
|
+
**Visit [https://developers.flagship.io/](https://developers.flagship.io/) to get started with Flagship.**
|
|
26
|
+
|
|
27
|
+
- [Installation & Getting Started](https://developers.flagship.io/docs/sdk/react/v2.0#getting-started)
|
|
28
|
+
- [API Reference](https://developers.flagship.io/docs/sdk/react/v2.0#api-reference)
|
|
29
|
+
- [Flagship Provider Props](https://developers.flagship.io/docs/sdk/react/v2.0#flagshipprovider)
|
|
30
|
+
- Available Hooks
|
|
31
|
+
|
|
32
|
+
- [useFlagship](https://developers.flagship.io/docs/sdk/react/v2.0#useflagship)
|
|
33
|
+
- [useFsModifications](https://developers.flagship.io/docs/sdk/react/v2.0#usefsmodifications)
|
|
34
|
+
- [useFsActivate](https://developers.flagship.io/docs/sdk/react/v2.0#usefsactivate)
|
|
35
|
+
|
|
36
|
+
- [Getting modifications](https://developers.flagship.io/docs/sdk/react/v2.0#getting-modifications)
|
|
37
|
+
- [Campaign synchronization](https://developers.flagship.io/docs/sdk/react/v2.0#campaign-synchronization)
|
|
38
|
+
- [Hit tracking](https://developers.flagship.io/docs/sdk/react/v2.0#hit-tracking)
|
|
39
|
+
- [Release Notes](https://github.com/flagship-io/flagship-react-sdk/blob/master/RELEASENOTES.md)
|
|
40
|
+
- [Contributing](https://github.com/flagship-io/flagship-react-sdk/blob/master/CONTRIBUTING.md)
|
|
41
|
+
|
|
42
|
+
## Examples
|
|
43
|
+
|
|
44
|
+
Following demos illustrate how the SDK is used in practice ☕
|
|
45
|
+
|
|
46
|
+
- With React (for developers):
|
|
47
|
+
|
|
48
|
+
<a href="https://flagship-io.github.io/flagship-react-sdk/">
|
|
49
|
+
<div style="max-width: 850px; margin: 0 auto;">
|
|
50
|
+
|
|
51
|
+

|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
</a>
|
|
55
|
+
<div style="display: flex; justify-content: space-around; font-size: 24px">
|
|
56
|
+
|
|
57
|
+
[Readme 📖](examples/react-dev-demo/README.md)
|
|
58
|
+
|
|
59
|
+
[Live Demo 🕹](https://flagship-io.github.io/flagship-react-sdk/)
|
|
60
|
+
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
- With React, e-commerce app:
|
|
64
|
+
|
|
65
|
+
<a href="https://react-ecommerce-demo.internal.flagship.io/">
|
|
66
|
+
<div style="max-width: 850px; margin: 0 auto;">
|
|
67
|
+
|
|
68
|
+

|
|
69
|
+
|
|
70
|
+
</div>
|
|
71
|
+
</a>
|
|
72
|
+
<div style="display: flex; justify-content: space-around; font-size: 24px">
|
|
73
|
+
|
|
74
|
+
[Readme 📖](examples/react-ecommerce-demo/README.md)
|
|
75
|
+
|
|
76
|
+
[Live Demo 🕹](https://react-ecommerce-demo.internal.flagship.io/)
|
|
77
|
+
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
- With React, codeSandbox, using campaign displaying cats / dogs / both:
|
|
81
|
+
|
|
82
|
+
<a href="https://codesandbox.io/s/flagship-sdk-react-example-sg5qu">
|
|
83
|
+
<div style="max-width: 850px; margin: 0 auto;">
|
|
84
|
+
|
|
85
|
+

|
|
86
|
+
|
|
87
|
+
</div>
|
|
88
|
+
</a>
|
|
89
|
+
<div style="display: flex; justify-content: space-around; font-size: 24px">
|
|
90
|
+
|
|
91
|
+
[Live Demo 🕹](https://codesandbox.io/s/flagship-sdk-react-example-sg5qu)
|
|
92
|
+
|
|
93
|
+
</div>
|
|
94
|
+
</a>
|
|
95
|
+
|
|
96
|
+
- With an universal (isomorphic) app, uses React both on server and client side:
|
|
97
|
+
|
|
98
|
+
[Source code 📚](./examples/react-universal-demo/README.md)
|
|
99
|
+
|
|
100
|
+
- With a server side rendering app, uses React on server:
|
|
101
|
+
|
|
102
|
+
[Source code 📚](./examples/react-ssr-demo/README.md)
|
|
103
|
+
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
## Licence
|
|
107
|
+
|
|
108
|
+
[Apache License.](https://github.com/flagship-io/flagship-react-sdk/blob/master/LICENSE)
|
package/package.json
CHANGED
|
@@ -1,112 +1,111 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@flagship.io/react-sdk",
|
|
3
|
-
"version": "2.1.
|
|
4
|
-
"description": "Flagship REACT SDK",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist",
|
|
9
|
-
"CONTRIBUTING.md",
|
|
10
|
-
"README.md",
|
|
11
|
-
"package.json"
|
|
12
|
-
],
|
|
13
|
-
"scripts": {
|
|
14
|
-
"test": "jest
|
|
15
|
-
"test:coverage": "jest --coverage --silent",
|
|
16
|
-
"release": "npm run checkReleasePrerequisites && docker login https://docker.pkg.github.com && np",
|
|
17
|
-
"version": "npm run build",
|
|
18
|
-
"checkReleasePrerequisites": "docker -v",
|
|
19
|
-
"publish": "
|
|
20
|
-
"publish:
|
|
21
|
-
"
|
|
22
|
-
"update:
|
|
23
|
-
"update:
|
|
24
|
-
"update:
|
|
25
|
-
"update:
|
|
26
|
-
"update:
|
|
27
|
-
"
|
|
28
|
-
"contributors:
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"build": "
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
"@flagship.io/js-sdk": "^
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"@testing-library/
|
|
71
|
-
"@testing-library/react": "^
|
|
72
|
-
"@
|
|
73
|
-
"@types/enzyme": "^
|
|
74
|
-
"@types/
|
|
75
|
-
"@types/
|
|
76
|
-
"@types/react": "^16.9.
|
|
77
|
-
"@types/
|
|
78
|
-
"@
|
|
79
|
-
"@typescript-eslint/
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"enzyme": "^
|
|
85
|
-
"enzyme-
|
|
86
|
-
"
|
|
87
|
-
"eslint": "^
|
|
88
|
-
"eslint-config-
|
|
89
|
-
"eslint-
|
|
90
|
-
"eslint-
|
|
91
|
-
"eslint-plugin-
|
|
92
|
-
"eslint-plugin-
|
|
93
|
-
"eslint-plugin-
|
|
94
|
-
"eslint-plugin-react": "^
|
|
95
|
-
"
|
|
96
|
-
"jest": "^
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"react": "^16.9.0",
|
|
101
|
-
"react-
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@flagship.io/react-sdk",
|
|
3
|
+
"version": "2.1.10-beta.0",
|
|
4
|
+
"description": "Flagship REACT SDK",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"CONTRIBUTING.md",
|
|
10
|
+
"README.md",
|
|
11
|
+
"package.json"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"test": "jest",
|
|
15
|
+
"test:coverage": "jest --coverage --silent",
|
|
16
|
+
"release": "npm run checkReleasePrerequisites && docker login https://docker.pkg.github.com && np",
|
|
17
|
+
"version": "npm run build",
|
|
18
|
+
"checkReleasePrerequisites": "docker -v",
|
|
19
|
+
"publish:reactDemoDev": "cd ./examples/react-dev-demo && npm i && npm run deploy:github",
|
|
20
|
+
"publish:reactDemoEcommerce": "cd ./examples/react-ecommerce-demo && npm run release:docker",
|
|
21
|
+
"update:fsLog": "npm install @flagship.io/js-sdk-logs@latest --save",
|
|
22
|
+
"update:examples": "npm run update:reactDemoDev && npm run update:reactDemoEcommerce && npm run update:reactUniversalDemo && npm run update:reactSSRDemo",
|
|
23
|
+
"update:reactDemoDev": "cd ./examples/react-dev-demo && npm install @flagship.io/react-sdk@latest @flagship.io/js-sdk@latest --save && cd ../../",
|
|
24
|
+
"update:reactUniversalDemo": "cd ./examples/react-universal-demo && npm install @flagship.io/react-sdk@latest @flagship.io/js-sdk@latest --save && cd ../../",
|
|
25
|
+
"update:reactSSRDemo": "cd ./examples/react-ssr-demo && npm install @flagship.io/react-sdk@latest @flagship.io/js-sdk@latest --save && cd ../../",
|
|
26
|
+
"update:reactDemoEcommerce": "cd ./examples/react-ecommerce-demo && npm install @flagship.io/react-sdk@latest @flagship.io/js-sdk@latest --save && cd ../../",
|
|
27
|
+
"contributors:add": "all-contributors add",
|
|
28
|
+
"contributors:generate": "all-contributors generate",
|
|
29
|
+
"clean": "rm -rf ./node_modules/react && rm -rf ./node_modules/react-dom",
|
|
30
|
+
"build": "rm -rf dist && tsc",
|
|
31
|
+
"build:skipUpdate": "rm -rf dist && tsc"
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/abtasty/flagship-react-sdk.git"
|
|
36
|
+
},
|
|
37
|
+
"license": "Apache-2.0",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/abtasty/flagship-react-sdk/issues",
|
|
40
|
+
"email": "emilien.domenge-heritier@abtasty.com"
|
|
41
|
+
},
|
|
42
|
+
"contributors": [
|
|
43
|
+
{
|
|
44
|
+
"name": "Emilien Domenge-Heritier",
|
|
45
|
+
"email": "emilien.domenge-heritier@abtasty.com",
|
|
46
|
+
"url": "https://domenge.fr"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "Guillaume Jacquart",
|
|
50
|
+
"email": "guillaume.jacquart@abtasty.com"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"keywords": [
|
|
54
|
+
"flagship",
|
|
55
|
+
"abtasty",
|
|
56
|
+
"react",
|
|
57
|
+
"sdk"
|
|
58
|
+
],
|
|
59
|
+
"homepage": "https://github.com/abtasty/flagship-react-sdk#readme",
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@flagship.io/js-sdk": "^2.2.12",
|
|
62
|
+
"@flagship.io/js-sdk-logs": "^0.1.3",
|
|
63
|
+
"use-ssr": "^1.0.23"
|
|
64
|
+
},
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"react": "^16.8.0 || ^17.0.0"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@testing-library/jest-dom": "^5.5.0",
|
|
70
|
+
"@testing-library/react": "^11.0.4",
|
|
71
|
+
"@testing-library/react-hooks": "^3.2.1",
|
|
72
|
+
"@types/enzyme": "^3.10.5",
|
|
73
|
+
"@types/enzyme-adapter-react-16": "^1.0.6",
|
|
74
|
+
"@types/jest": "^25.2.1",
|
|
75
|
+
"@types/react": "^16.9.32",
|
|
76
|
+
"@types/react-dom": "^16.9.6",
|
|
77
|
+
"@types/sinon": "^9.0.0",
|
|
78
|
+
"@typescript-eslint/eslint-plugin": "^2.26.0",
|
|
79
|
+
"@typescript-eslint/parser": "^2.26.0",
|
|
80
|
+
"all-contributors-cli": "^6.16.1",
|
|
81
|
+
"awesome-typescript-loader": "^5.2.1",
|
|
82
|
+
"axios": "^0.21.4",
|
|
83
|
+
"enzyme": "^3.11.0",
|
|
84
|
+
"enzyme-adapter-react-16": "^1.15.2",
|
|
85
|
+
"enzyme-to-json": "^3.4.4",
|
|
86
|
+
"eslint": "^6.8.0",
|
|
87
|
+
"eslint-config-airbnb": "^18.1.0",
|
|
88
|
+
"eslint-config-prettier": "^6.10.1",
|
|
89
|
+
"eslint-loader": "^3.0.3",
|
|
90
|
+
"eslint-plugin-import": "^2.25.4",
|
|
91
|
+
"eslint-plugin-jsx-a11y": "^6.2.3",
|
|
92
|
+
"eslint-plugin-prettier": "^3.1.2",
|
|
93
|
+
"eslint-plugin-react": "^7.19.0",
|
|
94
|
+
"eslint-plugin-react-hooks": "^2.5.0",
|
|
95
|
+
"jest": "^25.4.0",
|
|
96
|
+
"jest-mock-axios": "^3.2.0",
|
|
97
|
+
"np": "^6.2.3",
|
|
98
|
+
"prettier": "^2.0.4",
|
|
99
|
+
"react": "^16.9.0",
|
|
100
|
+
"react-dom": "^16.9.0",
|
|
101
|
+
"react-test-renderer": "^16.9.0",
|
|
102
|
+
"sinon": "^9.0.2",
|
|
103
|
+
"ts-jest": "^25.4.0",
|
|
104
|
+
"typescript": "^4.0.3"
|
|
105
|
+
},
|
|
106
|
+
"jest": {
|
|
107
|
+
"setupFilesAfterEnv": [
|
|
108
|
+
"./src/setupTests.js"
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import React, { SetStateAction, Dispatch } from 'react';
|
|
2
|
-
import { FlagshipSdkConfig, FlagshipVisitorContext, IFlagshipVisitor, SaveCacheArgs, DecisionApiCampaign, PostFlagshipApiCallback, BucketingApiResponse, IFlagship } from '@flagship.io/js-sdk';
|
|
3
|
-
import { FsLogger } from '@flagship.io/js-sdk-logs';
|
|
4
|
-
import { HandleErrorBoundaryDisplay } from './FlagshipErrorBoundary';
|
|
5
|
-
export declare type FsStatus = {
|
|
6
|
-
isLoading: boolean;
|
|
7
|
-
isSdkReady: boolean;
|
|
8
|
-
isVisitorDefined: boolean;
|
|
9
|
-
hasError: boolean;
|
|
10
|
-
lastRefresh: string | null;
|
|
11
|
-
firstInitSuccess: string | null;
|
|
12
|
-
};
|
|
13
|
-
export declare type FsState = {
|
|
14
|
-
fsSdk: IFlagship | null;
|
|
15
|
-
fsVisitor: IFlagshipVisitor | null;
|
|
16
|
-
fsModifications: DecisionApiCampaign[] | null;
|
|
17
|
-
status: FsStatus;
|
|
18
|
-
log: FsLogger | null;
|
|
19
|
-
private: {
|
|
20
|
-
previousFetchedModifications: undefined | DecisionApiCampaign[];
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
export interface FlagshipReactSdkConfig extends FlagshipSdkConfig {
|
|
24
|
-
fetchNow?: boolean;
|
|
25
|
-
pollingInterval?: number | null;
|
|
26
|
-
activateNow?: boolean;
|
|
27
|
-
enableConsoleLogs?: boolean;
|
|
28
|
-
decisionMode?: 'API' | 'Bucketing';
|
|
29
|
-
nodeEnv?: string;
|
|
30
|
-
enableClientCache?: boolean;
|
|
31
|
-
flagshipApi?: string;
|
|
32
|
-
apiKey?: string | null;
|
|
33
|
-
initialModifications?: DecisionApiCampaign[] | null;
|
|
34
|
-
initialBucketing?: BucketingApiResponse | null;
|
|
35
|
-
timeout?: number;
|
|
36
|
-
enableErrorLayout?: boolean;
|
|
37
|
-
enableSafeMode?: boolean;
|
|
38
|
-
internal?: {
|
|
39
|
-
react?: {};
|
|
40
|
-
reactNative?: {
|
|
41
|
-
httpCallback?: PostFlagshipApiCallback;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
export declare const initState: FsState;
|
|
46
|
-
export declare type BucketingSuccessArgs = {
|
|
47
|
-
status: string;
|
|
48
|
-
payload: BucketingApiResponse;
|
|
49
|
-
};
|
|
50
|
-
export declare type FsContext = {
|
|
51
|
-
hasError: boolean;
|
|
52
|
-
state: FsState;
|
|
53
|
-
setState: Dispatch<SetStateAction<FsState>> | null;
|
|
54
|
-
};
|
|
55
|
-
declare const FlagshipContext: React.Context<FsContext>;
|
|
56
|
-
export declare type FsOnUpdateArguments = {
|
|
57
|
-
fsModifications: DecisionApiCampaign[] | null;
|
|
58
|
-
config: FlagshipReactSdkConfig;
|
|
59
|
-
status: FsStatus;
|
|
60
|
-
};
|
|
61
|
-
export declare type FsOnUpdate = (data: FsOnUpdateArguments, visitor: IFlagshipVisitor | null) => void;
|
|
62
|
-
interface FlagshipProviderProps {
|
|
63
|
-
children: React.ReactNode;
|
|
64
|
-
loadingComponent?: React.ReactNode;
|
|
65
|
-
envId: string;
|
|
66
|
-
visitorData: {
|
|
67
|
-
id: string;
|
|
68
|
-
context?: FlagshipVisitorContext;
|
|
69
|
-
isAuthenticated?: boolean;
|
|
70
|
-
};
|
|
71
|
-
reactNative?: {
|
|
72
|
-
handleErrorDisplay: HandleErrorBoundaryDisplay;
|
|
73
|
-
httpCallback: PostFlagshipApiCallback;
|
|
74
|
-
};
|
|
75
|
-
fetchNow?: boolean;
|
|
76
|
-
decisionMode?: 'API' | 'Bucketing';
|
|
77
|
-
pollingInterval?: number | null;
|
|
78
|
-
activateNow?: boolean;
|
|
79
|
-
enableConsoleLogs?: boolean;
|
|
80
|
-
enableErrorLayout?: boolean;
|
|
81
|
-
enableSafeMode?: boolean;
|
|
82
|
-
enableClientCache?: boolean;
|
|
83
|
-
nodeEnv?: string;
|
|
84
|
-
timeout?: number;
|
|
85
|
-
flagshipApi?: string;
|
|
86
|
-
apiKey?: string | null;
|
|
87
|
-
initialModifications?: DecisionApiCampaign[];
|
|
88
|
-
initialBucketing?: BucketingApiResponse;
|
|
89
|
-
onInitStart?(): void;
|
|
90
|
-
onInitDone?(): void;
|
|
91
|
-
onBucketingSuccess?(data: BucketingSuccessArgs): void;
|
|
92
|
-
onBucketingFail?(error: Error): void;
|
|
93
|
-
onSavingModificationsInCache?(args: SaveCacheArgs): void;
|
|
94
|
-
onUpdate?: FsOnUpdate;
|
|
95
|
-
}
|
|
96
|
-
export declare const FlagshipProvider: React.SFC<FlagshipProviderProps>;
|
|
97
|
-
export declare const FlagshipConsumer: React.Consumer<FsContext>;
|
|
98
|
-
export default FlagshipContext;
|
|
99
|
-
export declare const useFlagshipContext: () => any;
|