@kameleoon/react-sdk 1.2.1 → 2.1.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 +25 -0
- package/README.md +86 -13
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +2 -1
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/dist/stories/Form.d.ts +4 -3
- package/dist/stories/Form.js +92 -35
- package/dist/stories/Form.js.map +1 -1
- package/dist/stories/FormHOC.js +12 -7
- package/dist/stories/FormHOC.js.map +1 -1
- package/dist/stories/FormHook.js +26 -19
- package/dist/stories/FormHook.js.map +1 -1
- package/dist/stories/constants.d.ts +4 -2
- package/dist/stories/constants.js +10 -8
- package/dist/stories/constants.js.map +1 -1
- package/dist/types.d.ts +10 -1
- package/dist/useConversion.d.ts +1 -1
- package/dist/useFeature.d.ts +1 -1
- package/dist/useFeature.js +16 -8
- package/dist/useFeature.js.map +1 -1
- package/dist/useRetrieveDataFromRemoteSource.d.ts +12 -0
- package/dist/useRetrieveDataFromRemoteSource.js +76 -0
- package/dist/useRetrieveDataFromRemoteSource.js.map +1 -0
- package/dist/useVariationAssociatedData.d.ts +2 -2
- package/dist/withActivateFeature.js +0 -1
- package/dist/withActivateFeature.js.map +1 -1
- package/dist/withAddData.js +0 -1
- package/dist/withAddData.js.map +1 -1
- package/dist/withBrowser.js +0 -1
- package/dist/withBrowser.js.map +1 -1
- package/dist/withConversion.d.ts +1 -1
- package/dist/withConversion.js +0 -1
- package/dist/withConversion.js.map +1 -1
- package/dist/withCustomData.js +0 -1
- package/dist/withCustomData.js.map +1 -1
- package/dist/withFeature.js +0 -1
- package/dist/withFeature.js.map +1 -1
- package/dist/withFeatureVariable.js.map +1 -1
- package/dist/withFlush.js +0 -1
- package/dist/withFlush.js.map +1 -1
- package/dist/withInterest.js +0 -1
- package/dist/withInterest.js.map +1 -1
- package/dist/withKameleoon.js +0 -1
- package/dist/withKameleoon.js.map +1 -1
- package/dist/withPageView.js +0 -1
- package/dist/withPageView.js.map +1 -1
- package/dist/withRetrieveDataFromRemoteSource.d.ts +14 -0
- package/dist/withRetrieveDataFromRemoteSource.js +28 -0
- package/dist/withRetrieveDataFromRemoteSource.js.map +1 -0
- package/dist/withTrackingConversion.d.ts +1 -1
- package/dist/withTrackingConversion.js +4 -6
- package/dist/withTrackingConversion.js.map +1 -1
- package/dist/withTriggerExperiment.d.ts +1 -1
- package/dist/withTriggerExperiment.js +1 -2
- package/dist/withTriggerExperiment.js.map +1 -1
- package/dist/withVariationAssociatedData.js.map +1 -1
- package/dist/withVisitorCode.js +0 -1
- package/dist/withVisitorCode.js.map +1 -1
- package/package.json +4 -3
package/dist/stories/FormHook.js
CHANGED
|
@@ -17,28 +17,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.FormHook = void 0;
|
|
18
18
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
var constants_1 = require("./constants");
|
|
20
|
-
var
|
|
20
|
+
var index_1 = require("../index");
|
|
21
21
|
var Form_1 = __importDefault(require("./Form"));
|
|
22
22
|
function FormHook() {
|
|
23
|
-
var client = (0,
|
|
24
|
-
var getVisitorCode = (0,
|
|
25
|
-
var addData = (0,
|
|
26
|
-
var addBrowser = (0,
|
|
27
|
-
var addPageView = (0,
|
|
28
|
-
var addInterest = (0,
|
|
29
|
-
var addConversion = (0,
|
|
30
|
-
var getVariationAssociatedData = (0,
|
|
31
|
-
var trackConversion = (0,
|
|
32
|
-
var getVariationId = (0,
|
|
33
|
-
var hasFeature = (0,
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
constants_1.
|
|
38
|
-
constants_1.
|
|
39
|
-
constants_1.
|
|
40
|
-
constants_1.
|
|
23
|
+
var client = (0, index_1.useKameleoon)().client;
|
|
24
|
+
var getVisitorCode = (0, index_1.useVisitorCode)().getVisitorCode;
|
|
25
|
+
var addData = (0, index_1.useAddData)().addData;
|
|
26
|
+
var addBrowser = (0, index_1.useBrowser)().addBrowser;
|
|
27
|
+
var addPageView = (0, index_1.usePageView)().addPageView;
|
|
28
|
+
var addInterest = (0, index_1.useInterest)().addInterest;
|
|
29
|
+
var addConversion = (0, index_1.useConversion)().addConversion;
|
|
30
|
+
var getVariationAssociatedData = (0, index_1.useVariationAssociatedData)().getVariationAssociatedData;
|
|
31
|
+
var trackConversion = (0, index_1.useTrackingConversion)().trackConversion;
|
|
32
|
+
var getVariationId = (0, index_1.useTriggerExperiment)().getVariationId;
|
|
33
|
+
var hasFeature = (0, index_1.useActivateFeature)().hasFeature;
|
|
34
|
+
var retrieveDataFromRemoteSource = (0, index_1.useRetrieveDataFromRemoteSource)().retrieveDataFromRemoteSource;
|
|
35
|
+
var variableKeys = {
|
|
36
|
+
production: [
|
|
37
|
+
constants_1.FeatureVariables.STRING,
|
|
38
|
+
constants_1.FeatureVariables.BOOLEAN,
|
|
39
|
+
constants_1.FeatureVariables.NUMBER,
|
|
40
|
+
constants_1.FeatureVariables.JSON,
|
|
41
41
|
],
|
|
42
|
+
development: constants_1.FeatureVariables.MULTI_ENVIRONMENT,
|
|
43
|
+
staging: constants_1.FeatureVariables.MULTI_ENVIRONMENT,
|
|
44
|
+
};
|
|
45
|
+
var feature = (0, index_1.useFeature)({
|
|
46
|
+
featureKey: constants_1.FEATURE_KEY,
|
|
47
|
+
variableKeys: variableKeys,
|
|
42
48
|
visitorCode: constants_1.USER_ID,
|
|
43
49
|
});
|
|
44
50
|
var props = {
|
|
@@ -52,6 +58,7 @@ function FormHook() {
|
|
|
52
58
|
addInterest: addInterest,
|
|
53
59
|
addConversion: addConversion,
|
|
54
60
|
getVariationAssociatedData: getVariationAssociatedData,
|
|
61
|
+
retrieveDataFromRemoteSource: retrieveDataFromRemoteSource,
|
|
55
62
|
getVariationId: getVariationId,
|
|
56
63
|
trackConversion: trackConversion,
|
|
57
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormHook.js","sourceRoot":"","sources":["../../src/stories/FormHook.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"FormHook.js","sourceRoot":"","sources":["../../src/stories/FormHook.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yCAAqE;AACrE,kCAckB;AAClB,gDAA0B;AAE1B,SAAgB,QAAQ;IACd,IAAA,MAAM,GAAK,IAAA,oBAAY,GAAE,OAAnB,CAAoB;IAC1B,IAAA,cAAc,GAAK,IAAA,sBAAc,GAAE,eAArB,CAAsB;IACpC,IAAA,OAAO,GAAK,IAAA,kBAAU,GAAE,QAAjB,CAAkB;IACzB,IAAA,UAAU,GAAK,IAAA,kBAAU,GAAE,WAAjB,CAAkB;IAC5B,IAAA,WAAW,GAAK,IAAA,mBAAW,GAAE,YAAlB,CAAmB;IAC9B,IAAA,WAAW,GAAK,IAAA,mBAAW,GAAE,YAAlB,CAAmB;IAC9B,IAAA,aAAa,GAAK,IAAA,qBAAa,GAAE,cAApB,CAAqB;IAClC,IAAA,0BAA0B,GAAK,IAAA,kCAA0B,GAAE,2BAAjC,CAAkC;IAC5D,IAAA,eAAe,GAAK,IAAA,6BAAqB,GAAE,gBAA5B,CAA6B;IAC5C,IAAA,cAAc,GAAK,IAAA,4BAAoB,GAAE,eAA3B,CAA4B;IAC1C,IAAA,UAAU,GAAK,IAAA,0BAAkB,GAAE,WAAzB,CAA0B;IACpC,IAAA,4BAA4B,GAAK,IAAA,uCAA+B,GAAE,6BAAtC,CAAuC;IAE3E,IAAM,YAAY,GAAG;QACnB,UAAU,EAAE;YACV,4BAAgB,CAAC,MAAM;YACvB,4BAAgB,CAAC,OAAO;YACxB,4BAAgB,CAAC,MAAM;YACvB,4BAAgB,CAAC,IAAI;SACtB;QACD,WAAW,EAAE,4BAAgB,CAAC,iBAAiB;QAC/C,OAAO,EAAE,4BAAgB,CAAC,iBAAiB;KAC5C,CAAC;IAEF,IAAM,OAAO,GAAG,IAAA,kBAAU,EAAC;QACzB,UAAU,EAAE,uBAAW;QACvB,YAAY,cAAA;QACZ,WAAW,EAAE,mBAAO;KACrB,CAAC,CAAC;IAEH,IAAM,KAAK,GAAG;QACZ,MAAM,QAAA;QACN,OAAO,SAAA;QACP,cAAc,gBAAA;QACd,UAAU,YAAA;QACV,OAAO,SAAA;QACP,UAAU,YAAA;QACV,WAAW,aAAA;QACX,WAAW,aAAA;QACX,aAAa,eAAA;QACb,0BAA0B,4BAAA;QAC1B,4BAA4B,8BAAA;QAC5B,cAAc,gBAAA;QACd,eAAe,iBAAA;KAChB,CAAC;IAEF,OAAO,uBAAC,cAAI,eAAK,KAAK,IAAE,aAAa,EAAE,KAAK,YAAI,CAAC;AACnD,CAAC;AAhDD,4BAgDC"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
export declare const KAMELEOON_URL = "https://app.kameleoon.com";
|
|
2
2
|
export declare const KAMELEOON_SITE_CODE = "0fpmcg34lg";
|
|
3
|
+
export declare const KAMELEOON_VISITOR_KEY = "4rXwHd620g";
|
|
3
4
|
export declare const KAMELEOON_GOAL_ID = 238446;
|
|
4
5
|
export declare const FEATURE_KEY = "react_sdk_test";
|
|
5
6
|
export declare const USER_ID = "98983";
|
|
6
7
|
export declare const EXPERIMENT_ID = 143611;
|
|
7
8
|
export declare const GOAL_ID = 245023;
|
|
8
|
-
export declare enum
|
|
9
|
+
export declare enum FeatureVariables {
|
|
9
10
|
STRING = "test_variable_one",
|
|
10
11
|
BOOLEAN = "test_variable_two",
|
|
11
12
|
NUMBER = "test_variable_three",
|
|
12
|
-
JSON = "test_variable_four"
|
|
13
|
+
JSON = "test_variable_four",
|
|
14
|
+
MULTI_ENVIRONMENT = "test_variable_multi_environment"
|
|
13
15
|
}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FeatureVariables = exports.GOAL_ID = exports.EXPERIMENT_ID = exports.USER_ID = exports.FEATURE_KEY = exports.KAMELEOON_GOAL_ID = exports.KAMELEOON_VISITOR_KEY = exports.KAMELEOON_SITE_CODE = exports.KAMELEOON_URL = void 0;
|
|
4
4
|
exports.KAMELEOON_URL = 'https://app.kameleoon.com';
|
|
5
5
|
exports.KAMELEOON_SITE_CODE = '0fpmcg34lg';
|
|
6
|
+
exports.KAMELEOON_VISITOR_KEY = '4rXwHd620g';
|
|
6
7
|
exports.KAMELEOON_GOAL_ID = 238446;
|
|
7
8
|
exports.FEATURE_KEY = 'react_sdk_test';
|
|
8
9
|
exports.USER_ID = '98983';
|
|
9
10
|
exports.EXPERIMENT_ID = 143611;
|
|
10
11
|
exports.GOAL_ID = 245023;
|
|
11
|
-
var
|
|
12
|
-
(function (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
var FeatureVariables;
|
|
13
|
+
(function (FeatureVariables) {
|
|
14
|
+
FeatureVariables["STRING"] = "test_variable_one";
|
|
15
|
+
FeatureVariables["BOOLEAN"] = "test_variable_two";
|
|
16
|
+
FeatureVariables["NUMBER"] = "test_variable_three";
|
|
17
|
+
FeatureVariables["JSON"] = "test_variable_four";
|
|
18
|
+
FeatureVariables["MULTI_ENVIRONMENT"] = "test_variable_multi_environment";
|
|
19
|
+
})(FeatureVariables = exports.FeatureVariables || (exports.FeatureVariables = {}));
|
|
18
20
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/stories/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG,2BAA2B,CAAC;AAC5C,QAAA,mBAAmB,GAAG,YAAY,CAAC;AACnC,QAAA,iBAAiB,GAAG,MAAM,CAAC;AAC3B,QAAA,WAAW,GAAG,gBAAgB,CAAC;AAC/B,QAAA,OAAO,GAAG,OAAO,CAAC;AAClB,QAAA,aAAa,GAAG,MAAM,CAAC;AACvB,QAAA,OAAO,GAAG,MAAM,CAAC;AAE9B,IAAY,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/stories/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG,2BAA2B,CAAC;AAC5C,QAAA,mBAAmB,GAAG,YAAY,CAAC;AACnC,QAAA,qBAAqB,GAAG,YAAY,CAAC;AACrC,QAAA,iBAAiB,GAAG,MAAM,CAAC;AAC3B,QAAA,WAAW,GAAG,gBAAgB,CAAC;AAC/B,QAAA,OAAO,GAAG,OAAO,CAAC;AAClB,QAAA,aAAa,GAAG,MAAM,CAAC;AACvB,QAAA,OAAO,GAAG,MAAM,CAAC;AAE9B,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAC1B,gDAA4B,CAAA;IAC5B,iDAA6B,CAAA;IAC7B,kDAA8B,CAAA;IAC9B,+CAA2B,CAAA;IAC3B,yEAAqD,CAAA;AACvD,CAAC,EANW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAM3B"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { FeatureResultField } from './constants';
|
|
2
2
|
export declare type AnyType = any;
|
|
3
3
|
export declare type Without<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
4
|
+
declare type JSONValue = string | number | boolean | {
|
|
5
|
+
[x: string]: JSONValue;
|
|
6
|
+
} | JSONValue[];
|
|
4
7
|
export declare type FeatureFlagVariableType = boolean | number | string | undefined;
|
|
5
8
|
export declare type FeatureVariableType = Record<string, FeatureFlagVariableType>;
|
|
6
9
|
export declare type UnknownPropsType = Record<string, unknown>;
|
|
10
|
+
export declare type VariableKeyType = string | string[];
|
|
11
|
+
export declare type VariableKeysType = {
|
|
12
|
+
[environment: string]: VariableKeyType;
|
|
13
|
+
};
|
|
14
|
+
export declare type RemoteSourceDataType = Record<string, JSONValue>;
|
|
7
15
|
export interface IFeature {
|
|
8
16
|
/** Feature flag status */
|
|
9
17
|
[FeatureResultField.IsActive]: boolean;
|
|
@@ -14,7 +22,8 @@ export interface IFeatureParams {
|
|
|
14
22
|
/** Unique identifier or key of the feature you want to expose to a user */
|
|
15
23
|
featureKey: string | number;
|
|
16
24
|
/** Key of the variable */
|
|
17
|
-
|
|
25
|
+
variableKeys: VariableKeysType;
|
|
18
26
|
/** Unique identifier of the user */
|
|
19
27
|
visitorCode?: string;
|
|
20
28
|
}
|
|
29
|
+
export {};
|
package/dist/useConversion.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Conversion } from 'kameleoon-client-javascript/dist/data';
|
|
|
2
2
|
interface ConversionHookResult {
|
|
3
3
|
/**
|
|
4
4
|
* @param goalId - unique identifier of the goal
|
|
5
|
-
* @param revenue -
|
|
5
|
+
* @param revenue - conversion revenue
|
|
6
6
|
* @param negative - defines if the revenue is positive or negative
|
|
7
7
|
*/
|
|
8
8
|
addConversion: (goalId: number, revenue?: number, negative?: boolean) => Conversion;
|
package/dist/useFeature.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import { IFeature, IFeatureParams } from './types';
|
|
|
2
2
|
/**
|
|
3
3
|
* A React Hook that returns the status of a feature flag and specified variables
|
|
4
4
|
*/
|
|
5
|
-
export declare function useFeature({ featureKey,
|
|
5
|
+
export declare function useFeature({ featureKey, variableKeys, visitorCode, }: IFeatureParams): IFeature;
|
package/dist/useFeature.js
CHANGED
|
@@ -17,15 +17,17 @@ var useActivateFeature_1 = require("./useActivateFeature");
|
|
|
17
17
|
var useFeatureVariable_1 = require("./useFeatureVariable");
|
|
18
18
|
var constants_1 = require("./constants");
|
|
19
19
|
var useVisitorCode_1 = require("./useVisitorCode");
|
|
20
|
+
var useKameleoon_1 = require("./useKameleoon");
|
|
20
21
|
/**
|
|
21
22
|
* A React Hook that returns the status of a feature flag and specified variables
|
|
22
23
|
*/
|
|
23
24
|
function useFeature(_a) {
|
|
24
25
|
var _b;
|
|
25
|
-
var featureKey = _a.featureKey,
|
|
26
|
+
var featureKey = _a.featureKey, variableKeys = _a.variableKeys, visitorCode = _a.visitorCode;
|
|
26
27
|
var hasFeature = (0, useActivateFeature_1.useActivateFeature)().hasFeature;
|
|
27
28
|
var getFeatureVariable = (0, useFeatureVariable_1.useFeatureVariable)().getFeatureVariable;
|
|
28
29
|
var getVisitorCode = (0, useVisitorCode_1.useVisitorCode)().getVisitorCode;
|
|
30
|
+
var client = (0, useKameleoon_1.useKameleoon)().client;
|
|
29
31
|
var _c = (0, react_1.useState)((_b = {},
|
|
30
32
|
_b[constants_1.FeatureResultField.IsActive] = false,
|
|
31
33
|
_b[constants_1.FeatureResultField.Variables] = [],
|
|
@@ -40,27 +42,33 @@ function useFeature(_a) {
|
|
|
40
42
|
}
|
|
41
43
|
return {};
|
|
42
44
|
}
|
|
43
|
-
var getVariablesArray = (0, react_1.useCallback)(function () {
|
|
45
|
+
var getVariablesArray = (0, react_1.useCallback)(function (environment) {
|
|
44
46
|
var variablesArray = [];
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
var environmentVariableKeys = variableKeys[environment];
|
|
48
|
+
if (Array.isArray(environmentVariableKeys)) {
|
|
49
|
+
environmentVariableKeys.forEach(function (key) {
|
|
47
50
|
variablesArray.push(getVariableObject(key, getFeatureVariable(featureKey, key)));
|
|
48
51
|
});
|
|
49
52
|
}
|
|
50
53
|
else {
|
|
51
|
-
variablesArray.push(getVariableObject(
|
|
54
|
+
variablesArray.push(getVariableObject(environmentVariableKeys, getFeatureVariable(featureKey, environmentVariableKeys)));
|
|
52
55
|
}
|
|
53
56
|
return variablesArray;
|
|
54
|
-
}, [
|
|
57
|
+
}, [variableKeys, getFeatureVariable, featureKey]);
|
|
55
58
|
(0, react_1.useEffect)(function () {
|
|
56
59
|
var _a;
|
|
60
|
+
var _b, _c, _d;
|
|
61
|
+
var featureFlag = ((_b = client.configurations) === null || _b === void 0 ? void 0 : _b.configuration.featureFlags.filter(function (item) {
|
|
62
|
+
return item.identificationKey === featureKey;
|
|
63
|
+
}))[0];
|
|
64
|
+
var currentEnvironment = (_d = (_c = featureFlag === null || featureFlag === void 0 ? void 0 : featureFlag.environment) === null || _c === void 0 ? void 0 : _c.key) !== null && _d !== void 0 ? _d : constants_1.PRODUCTION;
|
|
57
65
|
try {
|
|
58
66
|
setFeature((_a = {},
|
|
59
67
|
_a[constants_1.FeatureResultField.IsActive] = hasFeature(userCode, featureKey),
|
|
60
|
-
_a[constants_1.FeatureResultField.Variables] = getVariablesArray(),
|
|
68
|
+
_a[constants_1.FeatureResultField.Variables] = getVariablesArray(currentEnvironment),
|
|
61
69
|
_a));
|
|
62
70
|
}
|
|
63
|
-
catch (
|
|
71
|
+
catch (_e) {
|
|
64
72
|
setFeature(function (prevFeature) {
|
|
65
73
|
var _a;
|
|
66
74
|
return (__assign(__assign({}, prevFeature), (_a = {}, _a[constants_1.FeatureResultField.IsActive] = false, _a)));
|
package/dist/useFeature.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFeature.js","sourceRoot":"","sources":["../src/useFeature.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+BAAyD;AACzD,2DAA0D;AAC1D,2DAA0D;AAE1D,
|
|
1
|
+
{"version":3,"file":"useFeature.js","sourceRoot":"","sources":["../src/useFeature.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+BAAyD;AACzD,2DAA0D;AAC1D,2DAA0D;AAE1D,yCAA6D;AAC7D,mDAAkD;AAClD,+CAA8C;AAE9C;;GAEG;AACH,SAAgB,UAAU,CAAC,EAIV;;QAHf,UAAU,gBAAA,EACV,YAAY,kBAAA,EACZ,WAAW,iBAAA;IAEH,IAAA,UAAU,GAAK,IAAA,uCAAkB,GAAE,WAAzB,CAA0B;IACpC,IAAA,kBAAkB,GAAK,IAAA,uCAAkB,GAAE,mBAAzB,CAA0B;IAC5C,IAAA,cAAc,GAAK,IAAA,+BAAc,GAAE,eAArB,CAAsB;IACpC,IAAA,MAAM,GAAK,IAAA,2BAAY,GAAE,OAAnB,CAAoB;IAC5B,IAAA,KAAwB,IAAA,gBAAQ;QACpC,GAAC,8BAAkB,CAAC,QAAQ,IAAG,KAAK;QACpC,GAAC,8BAAkB,CAAC,SAAS,IAAG,EAAE;YAClC,EAHK,OAAO,QAAA,EAAE,UAAU,QAGxB,CAAC;IAEH,IAAM,QAAQ,GAAG,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,cAAc,CAAC,EAAE,CAAC,CAAC;IAEnD,SAAS,iBAAiB,CACxB,GAAW,EACX,KAA8B;;QAE9B,IAAI,KAAK,EAAE;YACT;gBACE,GAAC,GAAG,IAAG,KAAK;mBACZ;SACH;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAM,iBAAiB,GAAG,IAAA,mBAAW,EACnC,UAAC,WAAmB;QAClB,IAAM,cAAc,GAAG,EAAE,CAAC;QAC1B,IAAM,uBAAuB,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;QAE1D,IAAI,KAAK,CAAC,OAAO,CAAC,uBAAuB,CAAC,EAAE;YAC1C,uBAAuB,CAAC,OAAO,CAAC,UAAC,GAAG;gBAClC,cAAc,CAAC,IAAI,CACjB,iBAAiB,CAAC,GAAG,EAAE,kBAAkB,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAC5D,CAAC;YACJ,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,cAAc,CAAC,IAAI,CACjB,iBAAiB,CACf,uBAAuB,EACvB,kBAAkB,CAAC,UAAU,EAAE,uBAAuB,CAAC,CACxD,CACF,CAAC;SACH;QAED,OAAO,cAAc,CAAC;IACxB,CAAC,EACD,CAAC,YAAY,EAAE,kBAAkB,EAAE,UAAU,CAAC,CAC/C,CAAC;IAEF,IAAA,iBAAS,EAAC;;;QACD,IAAA,WAAW,GAChB,CAAA,MAAA,MAAM,CAAC,cAAc,0CAAE,aAAa,CAAC,YAAY,CAAC,MAAM,CACtD,UAAC,IAA6B;YAC5B,OAAA,IAAI,CAAC,iBAAiB,KAAK,UAAU;QAArC,CAAqC,CACxC,CAAA,GAJe,CAId;QAEJ,IAAM,kBAAkB,GAAG,MAAA,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW,0CAAE,GAAG,mCAAI,sBAAU,CAAC;QAEvE,IAAI;YACF,UAAU;gBACR,GAAC,8BAAkB,CAAC,QAAQ,IAAG,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC;gBAC/D,GAAC,8BAAkB,CAAC,SAAS,IAAG,iBAAiB,CAAC,kBAAkB,CAAC;oBACrE,CAAC;SACJ;QAAC,WAAM;YACN,UAAU,CAAC,UAAC,WAAW;;gBAAK,OAAA,uBACvB,WAAW,gBACb,8BAAkB,CAAC,QAAQ,IAAG,KAAK,OACpC;YAH0B,CAG1B,CAAC,CAAC;SACL;QACD,iEAAiE;QACjE,uDAAuD;IACzD,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;IAEvC,OAAO,OAAO,CAAC;AACjB,CAAC;AA/ED,gCA+EC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RemoteSourceDataType } from './types';
|
|
2
|
+
interface RetrieveDataFromRemoteSourceHookResult {
|
|
3
|
+
/**
|
|
4
|
+
* @param key - unique key for data defined for Kameleoon Data API
|
|
5
|
+
*/
|
|
6
|
+
retrieveDataFromRemoteSource: (key: string) => Promise<RemoteSourceDataType>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A React Hook that returns asynchronous callback function which retrieves data from Kameleoon Data API
|
|
10
|
+
*/
|
|
11
|
+
export declare function useRetrieveDataFromRemoteSource(): RetrieveDataFromRemoteSourceHookResult;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.useRetrieveDataFromRemoteSource = void 0;
|
|
40
|
+
var react_1 = require("react");
|
|
41
|
+
var useKameleoon_1 = require("./useKameleoon");
|
|
42
|
+
var ProviderError_1 = require("./ProviderError");
|
|
43
|
+
/**
|
|
44
|
+
* A React Hook that returns asynchronous callback function which retrieves data from Kameleoon Data API
|
|
45
|
+
*/
|
|
46
|
+
function useRetrieveDataFromRemoteSource() {
|
|
47
|
+
var _this = this;
|
|
48
|
+
var client = (0, useKameleoon_1.useKameleoon)().client;
|
|
49
|
+
var isObjectEmpty = (0, react_1.useCallback)(function (object) {
|
|
50
|
+
return (object &&
|
|
51
|
+
Object.keys(object).length === 0 &&
|
|
52
|
+
Object.getPrototypeOf(object) === Object.prototype);
|
|
53
|
+
}, []);
|
|
54
|
+
var retrieveDataFromRemoteSource = (0, react_1.useCallback)(function (key) { return __awaiter(_this, void 0, void 0, function () {
|
|
55
|
+
var data;
|
|
56
|
+
return __generator(this, function (_a) {
|
|
57
|
+
switch (_a.label) {
|
|
58
|
+
case 0: return [4 /*yield*/, client.retrieveDataFromRemoteSource(key)];
|
|
59
|
+
case 1:
|
|
60
|
+
data = (_a.sent());
|
|
61
|
+
if (isObjectEmpty(data)) {
|
|
62
|
+
throw new Error('No data was retrieved from remote source or the data is empty');
|
|
63
|
+
}
|
|
64
|
+
return [2 /*return*/, data];
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}); }, [client, isObjectEmpty]);
|
|
68
|
+
if (!client) {
|
|
69
|
+
throw new ProviderError_1.ProviderError('useKameleoon');
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
retrieveDataFromRemoteSource: retrieveDataFromRemoteSource,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
exports.useRetrieveDataFromRemoteSource = useRetrieveDataFromRemoteSource;
|
|
76
|
+
//# sourceMappingURL=useRetrieveDataFromRemoteSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRetrieveDataFromRemoteSource.js","sourceRoot":"","sources":["../src/useRetrieveDataFromRemoteSource.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAoC;AACpC,+CAA8C;AAC9C,iDAAgD;AAUhD;;GAEG;AACH,SAAgB,+BAA+B;IAA/C,iBAmCC;IAlCS,IAAA,MAAM,GAAK,IAAA,2BAAY,GAAE,OAAnB,CAAoB;IAElC,IAAM,aAAa,GAAG,IAAA,mBAAW,EAAC,UAAC,MAA4B;QAC7D,OAAO,CACL,MAAM;YACN,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC;YAChC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC,SAAS,CACnD,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAM,4BAA4B,GAAG,IAAA,mBAAW,EAC9C,UAAO,GAAW;;;;wBACF,qBAAM,MAAM,CAAC,4BAA4B,CACrD,GAAG,CACJ,EAAA;;oBAFK,IAAI,GAAG,CAAC,SAEb,CAAyB;oBAE1B,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE;wBACvB,MAAM,IAAI,KAAK,CACb,+DAA+D,CAChE,CAAC;qBACH;oBAED,sBAAO,IAAI,EAAC;;;SACb,EACD,CAAC,MAAM,EAAE,aAAa,CAAC,CACxB,CAAC;IAEF,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,6BAAa,CAAC,cAAc,CAAC,CAAC;KACzC;IAED,OAAO;QACL,4BAA4B,8BAAA;KAC7B,CAAC;AACJ,CAAC;AAnCD,0EAmCC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnyType } from './types';
|
|
2
|
-
interface
|
|
2
|
+
interface VariationAssociatedDataHookResult {
|
|
3
3
|
/**
|
|
4
4
|
* @param variationId - unique identifier of the variation you want to obtain associated data for
|
|
5
5
|
*/
|
|
@@ -10,5 +10,5 @@ interface VariationAssociatedDataHoolResult {
|
|
|
10
10
|
* The JSON data usually represents some metadata of the variation,
|
|
11
11
|
* and can be configured on our web application interface or via our Automation API.
|
|
12
12
|
*/
|
|
13
|
-
export declare function useVariationAssociatedData():
|
|
13
|
+
export declare function useVariationAssociatedData(): VariationAssociatedDataHookResult;
|
|
14
14
|
export {};
|
|
@@ -29,7 +29,6 @@ function withActivateFeature(Component) {
|
|
|
29
29
|
}
|
|
30
30
|
return client.activateFeature(visitorCode, featureKey);
|
|
31
31
|
}, [client]);
|
|
32
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
33
32
|
return (0, jsx_runtime_1.jsx)(Component, __assign({ hasFeature: hasFeature }, props), void 0);
|
|
34
33
|
};
|
|
35
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withActivateFeature.js","sourceRoot":"","sources":["../src/withActivateFeature.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAAuD;AAEvD,uDAAsD;AACtD,iDAAgD;AAUhD;;;GAGG;AACH,SAAgB,mBAAmB,CACjC,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,mCAAgB,CAAC,CAAC;QAE5C,IAAM,UAAU,GAAG,IAAA,mBAAW,EAC5B,UAAC,WAAmB,EAAE,UAA2B;YAC/C,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,IAAI,6BAAa,CAAC,qBAAqB,CAAC,CAAC;aAChD;YAED,OAAO,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACzD,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;QAEF,
|
|
1
|
+
{"version":3,"file":"withActivateFeature.js","sourceRoot":"","sources":["../src/withActivateFeature.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAAuD;AAEvD,uDAAsD;AACtD,iDAAgD;AAUhD;;;GAGG;AACH,SAAgB,mBAAmB,CACjC,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,mCAAgB,CAAC,CAAC;QAE5C,IAAM,UAAU,GAAG,IAAA,mBAAW,EAC5B,UAAC,WAAmB,EAAE,UAA2B;YAC/C,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,IAAI,6BAAa,CAAC,qBAAqB,CAAC,CAAC;aAChD;YAED,OAAO,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACzD,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;QAEF,OAAO,uBAAC,SAAS,aAAC,UAAU,EAAE,UAAU,IAAO,KAAe,UAAI,CAAC;IACrE,CAAC,CAAC;AACJ,CAAC;AAnBD,kDAmBC"}
|
package/dist/withAddData.js
CHANGED
|
@@ -42,7 +42,6 @@ function withAddData(Component) {
|
|
|
42
42
|
}
|
|
43
43
|
return client.addData.apply(client, __spreadArray([visitorCode], dataTypes, false));
|
|
44
44
|
}, [client]);
|
|
45
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
46
45
|
return (0, jsx_runtime_1.jsx)(Component, __assign({ addData: addData }, props), void 0);
|
|
47
46
|
};
|
|
48
47
|
}
|
package/dist/withAddData.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withAddData.js","sourceRoot":"","sources":["../src/withAddData.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAuD;AAGvD,uDAAsD;AACtD,iDAAgD;AAUhD;;;GAGG;AACH,SAAgB,WAAW,CACzB,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,mCAAgB,CAAC,CAAC;QAE5C,IAAM,OAAO,GAAG,IAAA,mBAAW,EACzB,UAAC,WAAmB;YAAE,mBAAqB;iBAArB,UAAqB,EAArB,qBAAqB,EAArB,IAAqB;gBAArB,kCAAqB;;YACzC,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,IAAI,6BAAa,CAAC,aAAa,CAAC,CAAC;aACxC;YAED,OAAO,MAAM,CAAC,OAAO,OAAd,MAAM,iBAAS,WAAW,GAAK,SAAS,UAAE;QACnD,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;QAEF,
|
|
1
|
+
{"version":3,"file":"withAddData.js","sourceRoot":"","sources":["../src/withAddData.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAuD;AAGvD,uDAAsD;AACtD,iDAAgD;AAUhD;;;GAGG;AACH,SAAgB,WAAW,CACzB,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,mCAAgB,CAAC,CAAC;QAE5C,IAAM,OAAO,GAAG,IAAA,mBAAW,EACzB,UAAC,WAAmB;YAAE,mBAAqB;iBAArB,UAAqB,EAArB,qBAAqB,EAArB,IAAqB;gBAArB,kCAAqB;;YACzC,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,IAAI,6BAAa,CAAC,aAAa,CAAC,CAAC;aACxC;YAED,OAAO,MAAM,CAAC,OAAO,OAAd,MAAM,iBAAS,WAAW,GAAK,SAAS,UAAE;QACnD,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;QAEF,OAAO,uBAAC,SAAS,aAAC,OAAO,EAAE,OAAO,IAAO,KAAe,UAAI,CAAC;IAC/D,CAAC,CAAC;AACJ,CAAC;AAnBD,kCAmBC"}
|
package/dist/withBrowser.js
CHANGED
|
@@ -28,7 +28,6 @@ function withBrowser(Component) {
|
|
|
28
28
|
var addBrowser = (0, react_1.useCallback)(function (browser) {
|
|
29
29
|
return new kameleoon_client_javascript_1.KameleoonData.Browser(data_1.default.browsers[browser]);
|
|
30
30
|
}, []);
|
|
31
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
32
31
|
return (0, jsx_runtime_1.jsx)(Component, __assign({ addBrowser: addBrowser }, props), void 0);
|
|
33
32
|
};
|
|
34
33
|
}
|
package/dist/withBrowser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withBrowser.js","sourceRoot":"","sources":["../src/withBrowser.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+BAA2C;AAC3C,+EAE+C;AAC/C,2EAA4D;AAW5D;;;GAGG;AACH,SAAgB,WAAW,CACzB,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,UAAU,GAAG,IAAA,mBAAW,EAAC,UAAC,OAAgB;YAC9C,OAAO,IAAI,2CAAa,CAAC,OAAO,CAAC,cAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3D,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,
|
|
1
|
+
{"version":3,"file":"withBrowser.js","sourceRoot":"","sources":["../src/withBrowser.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+BAA2C;AAC3C,+EAE+C;AAC/C,2EAA4D;AAW5D;;;GAGG;AACH,SAAgB,WAAW,CACzB,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,UAAU,GAAG,IAAA,mBAAW,EAAC,UAAC,OAAgB;YAC9C,OAAO,IAAI,2CAAa,CAAC,OAAO,CAAC,cAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3D,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,uBAAC,SAAS,aAAC,UAAU,EAAE,UAAU,IAAO,KAAe,UAAI,CAAC;IACrE,CAAC,CAAC;AACJ,CAAC;AAVD,kCAUC"}
|
package/dist/withConversion.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { UnknownPropsType, Without } from './types';
|
|
|
4
4
|
interface IWithConversion {
|
|
5
5
|
/**
|
|
6
6
|
* @param goalId - unique identifier of the goal
|
|
7
|
-
* @param revenue -
|
|
7
|
+
* @param revenue - conversion revenue
|
|
8
8
|
* @param negative - defines if the revenue is positive or negative
|
|
9
9
|
*/
|
|
10
10
|
addConversion: (goalId: number, revenue?: number, negative?: boolean) => Conversion;
|
package/dist/withConversion.js
CHANGED
|
@@ -24,7 +24,6 @@ function withConversion(Component) {
|
|
|
24
24
|
var addConversion = (0, react_1.useCallback)(function (goalId, revenue, negative) {
|
|
25
25
|
return new kameleoon_client_javascript_1.KameleoonData.Conversion(goalId, revenue, negative);
|
|
26
26
|
}, []);
|
|
27
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
28
27
|
return (0, jsx_runtime_1.jsx)(Component, __assign({ addConversion: addConversion }, props), void 0);
|
|
29
28
|
};
|
|
30
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withConversion.js","sourceRoot":"","sources":["../src/withConversion.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAC3C,2EAA4D;AAiB5D;;;GAGG;AACH,SAAgB,cAAc,CAC5B,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,aAAa,GAAG,IAAA,mBAAW,EAC/B,UAAC,MAAc,EAAE,OAAgB,EAAE,QAAkB;YACnD,OAAO,IAAI,2CAAa,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QACjE,CAAC,EACD,EAAE,CACH,CAAC;QAEF,
|
|
1
|
+
{"version":3,"file":"withConversion.js","sourceRoot":"","sources":["../src/withConversion.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAC3C,2EAA4D;AAiB5D;;;GAGG;AACH,SAAgB,cAAc,CAC5B,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,aAAa,GAAG,IAAA,mBAAW,EAC/B,UAAC,MAAc,EAAE,OAAgB,EAAE,QAAkB;YACnD,OAAO,IAAI,2CAAa,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QACjE,CAAC,EACD,EAAE,CACH,CAAC;QAEF,OAAO,uBAAC,SAAS,aAAC,aAAa,EAAE,aAAa,IAAO,KAAe,UAAI,CAAC;IAC3E,CAAC,CAAC;AACJ,CAAC;AAbD,wCAaC"}
|
package/dist/withCustomData.js
CHANGED
|
@@ -24,7 +24,6 @@ function withCustomData(Component) {
|
|
|
24
24
|
var addCustomData = (0, react_1.useCallback)(function (goalId, revenue, negative) {
|
|
25
25
|
return new kameleoon_client_javascript_1.KameleoonData.Conversion(goalId, revenue, negative);
|
|
26
26
|
}, []);
|
|
27
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
28
27
|
return (0, jsx_runtime_1.jsx)(Component, __assign({ addCustomData: addCustomData }, props), void 0);
|
|
29
28
|
};
|
|
30
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withCustomData.js","sourceRoot":"","sources":["../src/withCustomData.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAC3C,2EAA4D;AAY5D;;;GAGG;AACH,SAAgB,cAAc,CAC5B,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,aAAa,GAAG,IAAA,mBAAW,EAC/B,UAAC,MAAc,EAAE,OAAgB,EAAE,QAAkB;YACnD,OAAO,IAAI,2CAAa,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QACjE,CAAC,EACD,EAAE,CACH,CAAC;QAEF,
|
|
1
|
+
{"version":3,"file":"withCustomData.js","sourceRoot":"","sources":["../src/withCustomData.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAC3C,2EAA4D;AAY5D;;;GAGG;AACH,SAAgB,cAAc,CAC5B,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,aAAa,GAAG,IAAA,mBAAW,EAC/B,UAAC,MAAc,EAAE,OAAgB,EAAE,QAAkB;YACnD,OAAO,IAAI,2CAAa,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QACjE,CAAC,EACD,EAAE,CACH,CAAC;QAEF,OAAO,uBAAC,SAAS,aAAC,aAAa,EAAE,aAAa,IAAO,KAAe,UAAI,CAAC;IAC3E,CAAC,CAAC;AACJ,CAAC;AAbD,wCAaC"}
|
package/dist/withFeature.js
CHANGED
|
@@ -23,7 +23,6 @@ function withFeature(args) {
|
|
|
23
23
|
return function callbackWithArgs(Component) {
|
|
24
24
|
return function WrappedComponent(props) {
|
|
25
25
|
var feature = (0, useFeature_1.useFeature)(__assign({}, args));
|
|
26
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
27
26
|
return (0, jsx_runtime_1.jsx)(Component, __assign({ feature: feature }, props), void 0);
|
|
28
27
|
};
|
|
29
28
|
};
|
package/dist/withFeature.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withFeature.js","sourceRoot":"","sources":["../src/withFeature.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,2CAA0C;AAE1C;;GAEG;AACH,SAAgB,WAAW,CAAC,IAAoB;IAC9C,oEAAoE;IACpE,uCAAuC;IACvC,OAAO,SAAS,gBAAgB,CAC9B,SAAqC;QAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;YAC3C,IAAM,OAAO,GAAG,IAAA,uBAAU,eAAM,IAAI,EAAG,CAAC;YAExC,
|
|
1
|
+
{"version":3,"file":"withFeature.js","sourceRoot":"","sources":["../src/withFeature.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,2CAA0C;AAE1C;;GAEG;AACH,SAAgB,WAAW,CAAC,IAAoB;IAC9C,oEAAoE;IACpE,uCAAuC;IACvC,OAAO,SAAS,gBAAgB,CAC9B,SAAqC;QAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;YAC3C,IAAM,OAAO,GAAG,IAAA,uBAAU,eAAM,IAAI,EAAG,CAAC;YAExC,OAAO,uBAAC,SAAS,aAAC,OAAO,EAAE,OAAO,IAAO,KAAe,UAAI,CAAC;QAC/D,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAZD,kCAYC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withFeatureVariable.js","sourceRoot":"","sources":["../src/withFeatureVariable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,2DAA0D;AAa1D;;;GAGG;AACH,SAAgB,mBAAmB,CACjC,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QACnC,IAAA,kBAAkB,GAAK,IAAA,uCAAkB,GAAE,mBAAzB,CAA0B;QAEpD,OAAO,CACL,uBAAC,SAAS,aACR,kBAAkB,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"withFeatureVariable.js","sourceRoot":"","sources":["../src/withFeatureVariable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,2DAA0D;AAa1D;;;GAGG;AACH,SAAgB,mBAAmB,CACjC,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QACnC,IAAA,kBAAkB,GAAK,IAAA,uCAAkB,GAAE,mBAAzB,CAA0B;QAEpD,OAAO,CACL,uBAAC,SAAS,aACR,kBAAkB,EAAE,kBAAkB,IACjC,KAAe,UACpB,CACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAbD,kDAaC"}
|
package/dist/withFlush.js
CHANGED
package/dist/withFlush.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withFlush.js","sourceRoot":"","sources":["../src/withFlush.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAAuD;AACvD,iDAAgD;AAEhD,uDAAsD;AAStD;;;GAGG;AACH,SAAgB,SAAS,CACvB,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,mCAAgB,CAAC,CAAC;QAE5C,IAAM,KAAK,GAAG,IAAA,mBAAW,EACvB,UAAC,WAAmB;YAClB,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,IAAI,6BAAa,CAAC,WAAW,CAAC,CAAC;aACtC;YACD,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAC5B,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;QAEF,
|
|
1
|
+
{"version":3,"file":"withFlush.js","sourceRoot":"","sources":["../src/withFlush.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAAuD;AACvD,iDAAgD;AAEhD,uDAAsD;AAStD;;;GAGG;AACH,SAAgB,SAAS,CACvB,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,mCAAgB,CAAC,CAAC;QAE5C,IAAM,KAAK,GAAG,IAAA,mBAAW,EACvB,UAAC,WAAmB;YAClB,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,IAAI,6BAAa,CAAC,WAAW,CAAC,CAAC;aACtC;YACD,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAC5B,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;QAEF,OAAO,uBAAC,SAAS,aAAC,KAAK,EAAE,KAAK,IAAO,KAAe,UAAI,CAAC;IAC3D,CAAC,CAAC;AACJ,CAAC;AAlBD,8BAkBC"}
|
package/dist/withInterest.js
CHANGED
|
@@ -24,7 +24,6 @@ function withInterest(Component) {
|
|
|
24
24
|
var addInterest = (0, react_1.useCallback)(function (index) {
|
|
25
25
|
return new kameleoon_client_javascript_1.KameleoonData.Interest(index);
|
|
26
26
|
}, []);
|
|
27
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
28
27
|
return (0, jsx_runtime_1.jsx)(Component, __assign({ addInterest: addInterest }, props), void 0);
|
|
29
28
|
};
|
|
30
29
|
}
|
package/dist/withInterest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withInterest.js","sourceRoot":"","sources":["../src/withInterest.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAE3C,2EAA4D;AAU5D;;;GAGG;AACH,SAAgB,YAAY,CAC1B,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,WAAW,GAAG,IAAA,mBAAW,EAAC,UAAC,KAAa;YAC5C,OAAO,IAAI,2CAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC3C,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,
|
|
1
|
+
{"version":3,"file":"withInterest.js","sourceRoot":"","sources":["../src/withInterest.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAE3C,2EAA4D;AAU5D;;;GAGG;AACH,SAAgB,YAAY,CAC1B,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,WAAW,GAAG,IAAA,mBAAW,EAAC,UAAC,KAAa;YAC5C,OAAO,IAAI,2CAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC3C,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,uBAAC,SAAS,aAAC,WAAW,EAAE,WAAW,IAAO,KAAe,UAAI,CAAC;IACvE,CAAC,CAAC;AACJ,CAAC;AAVD,oCAUC"}
|
package/dist/withKameleoon.js
CHANGED
|
@@ -26,7 +26,6 @@ function withKameleoon(Component) {
|
|
|
26
26
|
if (!client) {
|
|
27
27
|
throw new ProviderError_1.ProviderError('withKameleoon');
|
|
28
28
|
}
|
|
29
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
30
29
|
return (0, jsx_runtime_1.jsx)(Component, __assign({ client: client }, props), void 0);
|
|
31
30
|
};
|
|
32
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withKameleoon.js","sourceRoot":"","sources":["../src/withKameleoon.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA0C;AAE1C,uDAAsD;AACtD,iDAAgD;AAQhD;;;GAGG;AACH,SAAgB,aAAa,CAC3B,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,mCAAgB,CAAC,CAAC;QAE5C,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,IAAI,6BAAa,CAAC,eAAe,CAAC,CAAC;SAC1C;QAED,
|
|
1
|
+
{"version":3,"file":"withKameleoon.js","sourceRoot":"","sources":["../src/withKameleoon.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA0C;AAE1C,uDAAsD;AACtD,iDAAgD;AAQhD;;;GAGG;AACH,SAAgB,aAAa,CAC3B,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,mCAAgB,CAAC,CAAC;QAE5C,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,IAAI,6BAAa,CAAC,eAAe,CAAC,CAAC;SAC1C;QAED,OAAO,uBAAC,SAAS,aAAC,MAAM,EAAE,MAAM,IAAO,KAAe,UAAI,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC;AAZD,sCAYC"}
|
package/dist/withPageView.js
CHANGED
|
@@ -24,7 +24,6 @@ function withPageView(Component) {
|
|
|
24
24
|
var addPageView = (0, react_1.useCallback)(function (url, title, referrer) {
|
|
25
25
|
return new kameleoon_client_javascript_1.KameleoonData.PageView(url, title, referrer);
|
|
26
26
|
}, []);
|
|
27
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
28
27
|
return (0, jsx_runtime_1.jsx)(Component, __assign({ addPageView: addPageView }, props), void 0);
|
|
29
28
|
};
|
|
30
29
|
}
|
package/dist/withPageView.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withPageView.js","sourceRoot":"","sources":["../src/withPageView.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAE3C,2EAA4D;AAY5D;;;GAGG;AACH,SAAgB,YAAY,CAC1B,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,WAAW,GAAG,IAAA,mBAAW,EAC7B,UAAC,GAAW,EAAE,KAAa,EAAE,QAAiB;YAC5C,OAAO,IAAI,2CAAa,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC1D,CAAC,EACD,EAAE,CACH,CAAC;QAEF,
|
|
1
|
+
{"version":3,"file":"withPageView.js","sourceRoot":"","sources":["../src/withPageView.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAE3C,2EAA4D;AAY5D;;;GAGG;AACH,SAAgB,YAAY,CAC1B,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,WAAW,GAAG,IAAA,mBAAW,EAC7B,UAAC,GAAW,EAAE,KAAa,EAAE,QAAiB;YAC5C,OAAO,IAAI,2CAAa,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC1D,CAAC,EACD,EAAE,CACH,CAAC;QAEF,OAAO,uBAAC,SAAS,aAAC,WAAW,EAAE,WAAW,IAAO,KAAe,UAAI,CAAC;IACvE,CAAC,CAAC;AACJ,CAAC;AAbD,oCAaC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UnknownPropsType, Without, RemoteSourceDataType } from './types';
|
|
3
|
+
interface IWithRetrieveDataFromRemoteSource {
|
|
4
|
+
/**
|
|
5
|
+
* @param key - unique key for data defined for Kameleoon Data API
|
|
6
|
+
*/
|
|
7
|
+
retrieveDataFromRemoteSource: (key: string) => Promise<RemoteSourceDataType>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A React HOC that gives a wrapped component access to callback function
|
|
11
|
+
* which retrieves data from Kameleoon Data API
|
|
12
|
+
*/
|
|
13
|
+
export declare function withRetrieveDataFromRemoteSource<Props extends UnknownPropsType>(Component: React.ComponentType<Props>): React.ComponentType<Props & Without<Props, IWithRetrieveDataFromRemoteSource>>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.withRetrieveDataFromRemoteSource = void 0;
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var useRetrieveDataFromRemoteSource_1 = require("./useRetrieveDataFromRemoteSource");
|
|
17
|
+
/**
|
|
18
|
+
* A React HOC that gives a wrapped component access to callback function
|
|
19
|
+
* which retrieves data from Kameleoon Data API
|
|
20
|
+
*/
|
|
21
|
+
function withRetrieveDataFromRemoteSource(Component) {
|
|
22
|
+
return function WrappedComponent(props) {
|
|
23
|
+
var retrieveDataFromRemoteSource = (0, useRetrieveDataFromRemoteSource_1.useRetrieveDataFromRemoteSource)().retrieveDataFromRemoteSource;
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(Component, __assign({ retrieveDataFromRemoteSource: retrieveDataFromRemoteSource }, props), void 0));
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
exports.withRetrieveDataFromRemoteSource = withRetrieveDataFromRemoteSource;
|
|
28
|
+
//# sourceMappingURL=withRetrieveDataFromRemoteSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withRetrieveDataFromRemoteSource.js","sourceRoot":"","sources":["../src/withRetrieveDataFromRemoteSource.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,qFAAoF;AASpF;;;GAGG;AACH,SAAgB,gCAAgC,CAG9C,SAAqC;IAIrC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QACnC,IAAA,4BAA4B,GAAK,IAAA,iEAA+B,GAAE,6BAAtC,CAAuC;QAE3E,OAAO,CACL,uBAAC,SAAS,aACR,4BAA4B,EAAE,4BAA4B,IACrD,KAAe,UACpB,CACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAjBD,4EAiBC"}
|
|
@@ -9,7 +9,7 @@ interface IWithTrackingConversion {
|
|
|
9
9
|
trackConversion: (visitorCode: string, goalId: number, revenue?: number) => void;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* A React HOC that gives a wrapped component access
|
|
12
|
+
* A React HOC that gives a wrapped component access to callback function
|
|
13
13
|
* which tracks conversion
|
|
14
14
|
*/
|
|
15
15
|
export declare function withTrackingConversion<Props extends UnknownPropsType>(Component: React.ComponentType<Props>): React.ComponentType<Props & Without<Props, IWithTrackingConversion>>;
|