@kameleoon/react-sdk 2.1.0 → 3.0.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/CHANGELOG.md +11 -0
- package/README.md +230 -31
- package/dist/Feature.js +2 -2
- package/dist/Feature.js.map +1 -1
- package/dist/KameleoonError.d.ts +5 -0
- package/dist/KameleoonError.js +31 -0
- package/dist/KameleoonError.js.map +1 -0
- package/dist/compose.d.ts +1 -1
- package/dist/compose.js +27 -2
- package/dist/compose.js.map +1 -1
- package/dist/constants.d.ts +10 -0
- package/dist/constants.js +12 -1
- package/dist/constants.js.map +1 -1
- package/dist/getKameleoonException.d.ts +2 -0
- package/dist/getKameleoonException.js +34 -0
- package/dist/getKameleoonException.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/stories/Form.d.ts +12 -5
- package/dist/stories/Form.js +78 -17
- package/dist/stories/Form.js.map +1 -1
- package/dist/stories/FormHOC.js +1 -1
- package/dist/stories/FormHOC.js.map +1 -1
- package/dist/stories/FormHook.js +12 -6
- package/dist/stories/FormHook.js.map +1 -1
- package/dist/stories/constants.d.ts +1 -0
- package/dist/stories/constants.js +2 -1
- package/dist/stories/constants.js.map +1 -1
- package/dist/types.d.ts +14 -6
- package/dist/types.js.map +1 -1
- package/dist/useActivateFeature.d.ts +2 -0
- package/dist/useActivateFeature.js +11 -2
- package/dist/useActivateFeature.js.map +1 -1
- package/dist/useAddData.js +17 -1
- package/dist/useAddData.js.map +1 -1
- package/dist/useError.d.ts +7 -0
- package/dist/useError.js +34 -0
- package/dist/useError.js.map +1 -0
- package/dist/useErrors.d.ts +7 -0
- package/dist/useErrors.js +42 -0
- package/dist/useErrors.js.map +1 -0
- package/dist/useFeature.js +29 -8
- package/dist/useFeature.js.map +1 -1
- package/dist/useFeatureVariable.d.ts +2 -0
- package/dist/useFeatureVariable.js +11 -2
- package/dist/useFeatureVariable.js.map +1 -1
- package/dist/useRetrieveDataFromRemoteSource.d.ts +2 -2
- package/dist/useRetrieveDataFromRemoteSource.js +8 -5
- package/dist/useRetrieveDataFromRemoteSource.js.map +1 -1
- package/dist/useRunWhenReady.d.ts +14 -0
- package/dist/useRunWhenReady.js +23 -0
- package/dist/useRunWhenReady.js.map +1 -0
- package/dist/useTriggerExperiment.d.ts +2 -0
- package/dist/useTriggerExperiment.js +12 -2
- package/dist/useTriggerExperiment.js.map +1 -1
- package/dist/useVariationAssociatedData.d.ts +4 -2
- package/dist/useVariationAssociatedData.js +11 -2
- package/dist/useVariationAssociatedData.js.map +1 -1
- package/dist/withActivateFeature.d.ts +2 -0
- package/dist/withActivateFeature.js +3 -11
- package/dist/withActivateFeature.js.map +1 -1
- package/dist/withAddData.js +17 -1
- package/dist/withAddData.js.map +1 -1
- package/dist/withFeature.js +2 -2
- package/dist/withFeature.js.map +1 -1
- package/dist/withFeatureVariable.d.ts +2 -0
- package/dist/withFeatureVariable.js +2 -2
- package/dist/withFeatureVariable.js.map +1 -1
- package/dist/withRunWhenReady.d.ts +16 -0
- package/dist/withRunWhenReady.js +28 -0
- package/dist/withRunWhenReady.js.map +1 -0
- package/dist/withTriggerExperiment.d.ts +2 -0
- package/dist/withTriggerExperiment.js +3 -11
- package/dist/withTriggerExperiment.js.map +1 -1
- package/dist/withVariationAssociatedData.d.ts +4 -2
- package/dist/withVariationAssociatedData.js +3 -11
- package/dist/withVariationAssociatedData.js.map +1 -1
- package/package.json +2 -2
|
@@ -13,9 +13,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.withTriggerExperiment = void 0;
|
|
15
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
-
var
|
|
17
|
-
var KameleoonContext_1 = require("./KameleoonContext");
|
|
18
|
-
var ProviderError_1 = require("./ProviderError");
|
|
16
|
+
var useTriggerExperiment_1 = require("./useTriggerExperiment");
|
|
19
17
|
/**
|
|
20
18
|
* A React HOC that gives a wrapped component access to callback function which triggers experiment
|
|
21
19
|
* If such a user has never been associated with any variation, the SDK returns a randomly selected variation.
|
|
@@ -24,14 +22,8 @@ var ProviderError_1 = require("./ProviderError");
|
|
|
24
22
|
*/
|
|
25
23
|
function withTriggerExperiment(Component) {
|
|
26
24
|
return function WrappedComponent(props) {
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
if (!client) {
|
|
30
|
-
throw new ProviderError_1.ProviderError('withTriggerExperiment');
|
|
31
|
-
}
|
|
32
|
-
return client.triggerExperiment(visitorCode, experimentId);
|
|
33
|
-
}, [client]);
|
|
34
|
-
return (0, jsx_runtime_1.jsx)(Component, __assign({ getVariationId: getVariationId }, props), void 0);
|
|
25
|
+
var _a = (0, useTriggerExperiment_1.useTriggerExperiment)(), getVariationId = _a.getVariationId, triggerExperimentError = _a.error;
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(Component, __assign({ getVariationId: getVariationId, triggerExperimentError: triggerExperimentError }, props), void 0));
|
|
35
27
|
};
|
|
36
28
|
}
|
|
37
29
|
exports.withTriggerExperiment = withTriggerExperiment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withTriggerExperiment.js","sourceRoot":"","sources":["../src/withTriggerExperiment.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"withTriggerExperiment.js","sourceRoot":"","sources":["../src/withTriggerExperiment.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,+DAA8D;AAW9D;;;;;GAKG;AACH,SAAgB,qBAAqB,CACnC,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QACrC,IAAA,KACJ,IAAA,2CAAoB,GAAE,EADhB,cAAc,oBAAA,EAAS,sBAAsB,WAC7B,CAAC;QAEzB,OAAO,CACL,uBAAC,SAAS,aACR,cAAc,EAAE,cAAc,EAC9B,sBAAsB,EAAE,sBAAsB,IACzC,KAAe,UACpB,CACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAfD,sDAeC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { UnknownPropsType, Without,
|
|
2
|
+
import { UnknownPropsType, Without, VariationAssociatedDataType } from './types';
|
|
3
|
+
import { KameleoonError } from './KameleoonError';
|
|
3
4
|
interface IWithVariationAssociatedData {
|
|
4
5
|
/**
|
|
5
6
|
* @param variationId - unique identifier of the variation you want to obtain associated data for
|
|
6
7
|
*/
|
|
7
|
-
getVariationAssociatedData: (variationId: number) =>
|
|
8
|
+
getVariationAssociatedData: (variationId: number) => VariationAssociatedDataType;
|
|
9
|
+
variationAssociatedDataError: KameleoonError | null;
|
|
8
10
|
}
|
|
9
11
|
/**
|
|
10
12
|
* A React HOC that gives a wrapped component access to callback function which
|
|
@@ -13,9 +13,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.withVariationAssociatedData = void 0;
|
|
15
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
-
var
|
|
17
|
-
var KameleoonContext_1 = require("./KameleoonContext");
|
|
18
|
-
var ProviderError_1 = require("./ProviderError");
|
|
16
|
+
var useVariationAssociatedData_1 = require("./useVariationAssociatedData");
|
|
19
17
|
/**
|
|
20
18
|
* A React HOC that gives a wrapped component access to callback function which
|
|
21
19
|
* retrieves JSON data associated with a variation.
|
|
@@ -24,14 +22,8 @@ var ProviderError_1 = require("./ProviderError");
|
|
|
24
22
|
*/
|
|
25
23
|
function withVariationAssociatedData(Component) {
|
|
26
24
|
return function WrappedComponent(props) {
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
if (!client) {
|
|
30
|
-
throw new ProviderError_1.ProviderError('withVariationAssociatedData');
|
|
31
|
-
}
|
|
32
|
-
return client.obtainVariationAssociatedData(variationId);
|
|
33
|
-
}, [client]);
|
|
34
|
-
return ((0, jsx_runtime_1.jsx)(Component, __assign({ getVariationAssociatedData: getVariationAssociatedData }, props), void 0));
|
|
25
|
+
var _a = (0, useVariationAssociatedData_1.useVariationAssociatedData)(), getVariationAssociatedData = _a.getVariationAssociatedData, variationAssociatedDataError = _a.error;
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(Component, __assign({ getVariationAssociatedData: getVariationAssociatedData, variationAssociatedDataError: variationAssociatedDataError }, props), void 0));
|
|
35
27
|
};
|
|
36
28
|
}
|
|
37
29
|
exports.withVariationAssociatedData = withVariationAssociatedData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withVariationAssociatedData.js","sourceRoot":"","sources":["../src/withVariationAssociatedData.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"withVariationAssociatedData.js","sourceRoot":"","sources":["../src/withVariationAssociatedData.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAMA,2EAA0E;AAa1E;;;;;GAKG;AACH,SAAgB,2BAA2B,CACzC,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QACrC,IAAA,KACJ,IAAA,uDAA0B,GAAE,EADtB,0BAA0B,gCAAA,EAAS,4BAA4B,WACzC,CAAC;QAE/B,OAAO,CACL,uBAAC,SAAS,aACR,0BAA0B,EAAE,0BAA0B,EACtD,4BAA4B,EAAE,4BAA4B,IACrD,KAAe,UACpB,CACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAfD,kEAeC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kameleoon/react-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Kameleoon React SDK",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@types/validator": "^13.6.3",
|
|
38
|
-
"kameleoon-client-javascript": "^1.0.
|
|
38
|
+
"kameleoon-client-javascript": "^1.0.8",
|
|
39
39
|
"validator": "^13.6.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|