@flagship.io/react-sdk 2.1.10-beta.0 → 2.1.11-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.
Files changed (37) hide show
  1. package/CONTRIBUTING.md +65 -65
  2. package/LICENSE +201 -201
  3. package/README.md +108 -108
  4. package/dist/FlagshipContext.d.ts +99 -0
  5. package/dist/FlagshipContext.js +312 -0
  6. package/dist/FlagshipContext.js.map +1 -0
  7. package/dist/FlagshipErrorBoundary.d.ts +34 -0
  8. package/dist/FlagshipErrorBoundary.js +95 -0
  9. package/dist/FlagshipErrorBoundary.js.map +1 -0
  10. package/dist/FlagshipHooks.d.ts +33 -0
  11. package/dist/FlagshipHooks.js +198 -0
  12. package/dist/FlagshipHooks.js.map +1 -0
  13. package/dist/components/ReactErrorBoundaryContainer/index.d.ts +10 -0
  14. package/dist/components/ReactErrorBoundaryContainer/index.js +65 -0
  15. package/dist/components/ReactErrorBoundaryContainer/index.js.map +1 -0
  16. package/dist/index.d.ts +2 -0
  17. package/dist/index.js +15 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/lib/loggerHelper.d.ts +5 -0
  20. package/dist/lib/loggerHelper.js +14 -0
  21. package/dist/lib/loggerHelper.js.map +1 -0
  22. package/dist/lib/utils.d.ts +1 -0
  23. package/dist/lib/utils.js +7 -0
  24. package/dist/lib/utils.js.map +1 -0
  25. package/dist/setupTests.d.ts +1 -0
  26. package/dist/setupTests.js +9 -0
  27. package/dist/setupTests.js.map +1 -0
  28. package/dist/tests/mock/apiAnswers/oneModifInMoreThanOneCampaign.d.ts +3 -0
  29. package/dist/tests/mock/apiAnswers/oneModifInMoreThanOneCampaign.js +51 -0
  30. package/dist/tests/mock/apiAnswers/oneModifInMoreThanOneCampaign.js.map +1 -0
  31. package/dist/tests/mock/env.d.ts +5 -0
  32. package/dist/tests/mock/env.js +8 -0
  33. package/dist/tests/mock/env.js.map +1 -0
  34. package/dist/tests/mock/index.d.ts +74 -0
  35. package/dist/tests/mock/index.js +90 -0
  36. package/dist/tests/mock/index.js.map +1 -0
  37. package/package.json +111 -111
@@ -0,0 +1,74 @@
1
+ import React from 'react';
2
+ import { FlagshipSdkConfig } from '@flagship.io/js-sdk';
3
+ import { FsState } from '../../FlagshipContext';
4
+ export declare const apiAnswers: {
5
+ oneModifInMoreThanOneCampaign: import("@flagship.io/js-sdk").DecisionApiResponseData;
6
+ };
7
+ export declare const defaultConfig: FlagshipSdkConfig;
8
+ export declare const DefaultLoadingComponent: React.SFC;
9
+ export declare const defaultContext: {
10
+ hasError: boolean;
11
+ state: FsState;
12
+ };
13
+ export declare const anonymousIdForTest = "anonymousTest";
14
+ export declare const providerProps: {
15
+ visitorData: {
16
+ id: string;
17
+ context: {
18
+ isAuth: boolean;
19
+ isVip: boolean;
20
+ };
21
+ };
22
+ config: {
23
+ fetchNow: boolean;
24
+ enableConsoleLogs: boolean;
25
+ enableSafeMode: boolean;
26
+ enableErrorLayout: boolean;
27
+ nodeEnv: string;
28
+ apiKey: string;
29
+ };
30
+ envId: string;
31
+ };
32
+ export declare const fetchedModifications: ({
33
+ id: string;
34
+ slug: null;
35
+ type: string;
36
+ variation: {
37
+ id: string;
38
+ modifications: {
39
+ type: string;
40
+ value: {
41
+ array: number[];
42
+ complex: {
43
+ carray: {
44
+ cobject: number;
45
+ }[];
46
+ };
47
+ object: {
48
+ value: number;
49
+ };
50
+ discount?: undefined;
51
+ };
52
+ };
53
+ reference: boolean;
54
+ };
55
+ variationGroupId: string;
56
+ } | {
57
+ id: string;
58
+ slug: null;
59
+ type: string;
60
+ variation: {
61
+ id: string;
62
+ modifications: {
63
+ type: string;
64
+ value: {
65
+ discount: string;
66
+ array?: undefined;
67
+ complex?: undefined;
68
+ object?: undefined;
69
+ };
70
+ };
71
+ reference: boolean;
72
+ };
73
+ variationGroupId: string;
74
+ })[];
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.fetchedModifications = exports.providerProps = exports.anonymousIdForTest = exports.defaultContext = exports.DefaultLoadingComponent = exports.defaultConfig = exports.apiAnswers = void 0;
7
+ var react_1 = __importDefault(require("react"));
8
+ var oneModifInMoreThanOneCampaign_1 = __importDefault(require("./apiAnswers/oneModifInMoreThanOneCampaign"));
9
+ var env_1 = require("./env");
10
+ exports.apiAnswers = {
11
+ oneModifInMoreThanOneCampaign: oneModifInMoreThanOneCampaign_1.default
12
+ };
13
+ exports.defaultConfig = {};
14
+ exports.DefaultLoadingComponent = function () { return react_1.default.createElement("div", null, "Loading Flagship React SDK"); };
15
+ exports.defaultContext = {
16
+ hasError: false,
17
+ state: {
18
+ fsSdk: null,
19
+ fsVisitor: null,
20
+ log: null,
21
+ fsModifications: null,
22
+ status: {
23
+ isSdkReady: false,
24
+ isLoading: true,
25
+ isVisitorDefined: false,
26
+ lastRefresh: null,
27
+ firstInitSuccess: null,
28
+ hasError: false
29
+ },
30
+ private: {
31
+ previousFetchedModifications: undefined
32
+ }
33
+ }
34
+ };
35
+ exports.anonymousIdForTest = 'anonymousTest';
36
+ exports.providerProps = {
37
+ visitorData: {
38
+ id: env_1.vId,
39
+ context: { isAuth: true, isVip: false }
40
+ },
41
+ config: {
42
+ fetchNow: true,
43
+ enableConsoleLogs: true,
44
+ enableSafeMode: true,
45
+ enableErrorLayout: true,
46
+ nodeEnv: 'production',
47
+ apiKey: 'M2FYdfXsJ12tjJQuadw7y9DZojqNGBvecpjGXY93'
48
+ },
49
+ envId: 'bn1ab7m56qolupi5sa0g'
50
+ };
51
+ exports.fetchedModifications = [
52
+ {
53
+ id: 'bsq046crms2g1jsvtb20',
54
+ slug: null,
55
+ type: 'ab',
56
+ variation: {
57
+ id: 'bsq046crms2g1jsvtb40',
58
+ modifications: {
59
+ type: 'JSON',
60
+ value: {
61
+ array: [1, 2, 3],
62
+ complex: {
63
+ carray: [
64
+ {
65
+ cobject: 0
66
+ }
67
+ ]
68
+ },
69
+ object: {
70
+ value: 123456
71
+ }
72
+ }
73
+ },
74
+ reference: false
75
+ },
76
+ variationGroupId: 'bsq046crms2g1jsvtb30'
77
+ },
78
+ {
79
+ id: 'bqjfstuirtfg01mctmn0',
80
+ slug: null,
81
+ type: 'perso',
82
+ variation: {
83
+ id: 'bqjfstuirtfg01mctmp0',
84
+ modifications: { type: 'JSON', value: { discount: '10%' } },
85
+ reference: false
86
+ },
87
+ variationGroupId: 'bqjfstuirtfg01mctmo0'
88
+ }
89
+ ];
90
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tests/mock/index.tsx"],"names":[],"mappings":";;;;;;AAAA,gDAAwD;AAIxD,6GAAuF;AACvF,6BAA4B;AAEf,QAAA,UAAU,GAAG;IAEtB,6BAA6B,yCAAA;CAChC,CAAC;AAEW,QAAA,aAAa,GAAsB,EAE/C,CAAC;AAEW,QAAA,uBAAuB,GAAc,cAAM,OAAA,wEAAqC,EAArC,CAAqC,CAAC;AAEjF,QAAA,cAAc,GAGvB;IACA,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE;QACH,KAAK,EAAE,IAAI;QACX,SAAS,EAAE,IAAI;QACf,GAAG,EAAE,IAAI;QACT,eAAe,EAAE,IAAI;QACrB,MAAM,EAAE;YACJ,UAAU,EAAE,KAAK;YACjB,SAAS,EAAE,IAAI;YACf,gBAAgB,EAAE,KAAK;YACvB,WAAW,EAAE,IAAI;YACjB,gBAAgB,EAAE,IAAI;YACtB,QAAQ,EAAE,KAAK;SAClB;QACD,OAAO,EAAE;YACL,4BAA4B,EAAE,SAAS;SAC1C;KACJ;CACJ,CAAC;AAEW,QAAA,kBAAkB,GAAG,eAAe,CAAC;AAErC,QAAA,aAAa,GAAG;IACzB,WAAW,EAAE;QACT,EAAE,EAAE,SAAG;QACP,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE;KAC1C;IACD,MAAM,EAAE;QACJ,QAAQ,EAAE,IAAI;QACd,iBAAiB,EAAE,IAAI;QACvB,cAAc,EAAE,IAAI;QACpB,iBAAiB,EAAE,IAAI;QACvB,OAAO,EAAE,YAAY;QACrB,MAAM,EAAE,0CAA0C;KACrD;IACD,KAAK,EAAE,sBAAsB;CAChC,CAAC;AAEW,QAAA,oBAAoB,GAAG;IAChC;QACI,EAAE,EAAE,sBAAsB;QAC1B,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,IAAI;QACV,SAAS,EAAE;YACP,EAAE,EAAE,sBAAsB;YAC1B,aAAa,EAAE;gBACX,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE;oBACH,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;oBAChB,OAAO,EAAE;wBACL,MAAM,EAAE;4BACJ;gCACI,OAAO,EAAE,CAAC;6BACb;yBACJ;qBACJ;oBACD,MAAM,EAAE;wBACJ,KAAK,EAAE,MAAM;qBAChB;iBACJ;aACJ;YACD,SAAS,EAAE,KAAK;SACnB;QACD,gBAAgB,EAAE,sBAAsB;KAC3C;IACD;QACI,EAAE,EAAE,sBAAsB;QAC1B,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,OAAO;QACb,SAAS,EAAE;YACP,EAAE,EAAE,sBAAsB;YAC1B,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;YAC3D,SAAS,EAAE,KAAK;SACnB;QACD,gBAAgB,EAAE,sBAAsB;KAC3C;CACJ,CAAC"}
package/package.json CHANGED
@@ -1,111 +1,111 @@
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
+ {
2
+ "name": "@flagship.io/react-sdk",
3
+ "version": "2.1.11-alpha.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.13-alpha.0",
62
+ "@flagship.io/js-sdk-logs": "^0.1.3",
63
+ "use-ssr": "^1.0.23"
64
+ },
65
+ "peerDependencies": {
66
+ "react": ">=16.8.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
+ }