@kameleoon/react-sdk 4.1.1 → 6.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/README.md +62 -1456
- package/dist/KameleoonContext.d.ts +2 -2
- package/dist/KameleoonContext.js.map +1 -1
- package/dist/KameleoonError.d.ts +1 -1
- package/dist/KameleoonProvider.d.ts +5 -5
- package/dist/KameleoonProvider.js +1 -1
- package/dist/KameleoonProvider.js.map +1 -1
- package/dist/constants.d.ts +1 -24
- package/dist/constants.js +2 -28
- package/dist/constants.js.map +1 -1
- package/dist/eventSource/browserEventSource.d.ts +4 -0
- package/dist/eventSource/browserEventSource.js +38 -0
- package/dist/eventSource/browserEventSource.js.map +1 -0
- package/dist/eventSource/index.d.ts +2 -0
- package/dist/eventSource/index.js +8 -0
- package/dist/eventSource/index.js.map +1 -0
- package/dist/eventSource/nativeEventSource.d.ts +4 -0
- package/dist/eventSource/nativeEventSource.js +39 -0
- package/dist/eventSource/nativeEventSource.js.map +1 -0
- package/dist/index.d.ts +16 -42
- package/dist/index.js +34 -92
- package/dist/index.js.map +1 -1
- package/dist/kameleoonClient.d.ts +4 -13
- package/dist/kameleoonClient.js +18 -72
- package/dist/kameleoonClient.js.map +1 -1
- package/dist/kameleoonUtils/browserUtils.d.ts +13 -0
- package/dist/kameleoonUtils/browserUtils.js +72 -0
- package/dist/kameleoonUtils/browserUtils.js.map +1 -0
- package/dist/kameleoonUtils/nativeUtils.d.ts +12 -0
- package/dist/kameleoonUtils/nativeUtils.js +68 -0
- package/dist/kameleoonUtils/nativeUtils.js.map +1 -0
- package/dist/storage/index.d.ts +2 -0
- package/dist/storage/index.js +8 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/localStorage.d.ts +4 -0
- package/dist/storage/localStorage.js +44 -0
- package/dist/storage/localStorage.js.map +1 -0
- package/dist/storage/nativeStorage.d.ts +4 -0
- package/dist/storage/nativeStorage.js +41 -0
- package/dist/storage/nativeStorage.js.map +1 -0
- package/dist/useAddData.d.ts +14 -9
- package/dist/useAddData.js +14 -5
- package/dist/useAddData.js.map +1 -1
- package/dist/useBrowserVisitorCode.d.ts +17 -0
- package/dist/useBrowserVisitorCode.js +20 -0
- package/dist/useBrowserVisitorCode.js.map +1 -0
- package/dist/useConfigurationUpdate.d.ts +17 -0
- package/dist/useConfigurationUpdate.js +29 -0
- package/dist/useConfigurationUpdate.js.map +1 -0
- package/dist/useError.d.ts +1 -1
- package/dist/useError.js +1 -3
- package/dist/useError.js.map +1 -1
- package/dist/useErrors.d.ts +2 -2
- package/dist/useExperiments.d.ts +18 -0
- package/dist/useExperiments.js +30 -0
- package/dist/useExperiments.js.map +1 -0
- package/dist/useFeatureFlagActive.d.ts +19 -0
- package/dist/useFeatureFlagActive.js +30 -0
- package/dist/useFeatureFlagActive.js.map +1 -0
- package/dist/useFeatureFlagVariationKey.d.ts +19 -0
- package/dist/useFeatureFlagVariationKey.js +30 -0
- package/dist/useFeatureFlagVariationKey.js.map +1 -0
- package/dist/useFeatureFlags.d.ts +18 -0
- package/dist/useFeatureFlags.js +30 -0
- package/dist/useFeatureFlags.js.map +1 -0
- package/dist/useFeatureVariable.d.ts +12 -8
- package/dist/useFeatureVariable.js +7 -18
- package/dist/useFeatureVariable.js.map +1 -1
- package/dist/useFlushData.d.ts +14 -0
- package/dist/useFlushData.js +21 -0
- package/dist/useFlushData.js.map +1 -0
- package/dist/useInitialize.d.ts +15 -0
- package/dist/{useAsyncVisitorCode.js → useInitialize.js} +28 -10
- package/dist/useInitialize.js.map +1 -0
- package/dist/useKameleoon.d.ts +8 -7
- package/dist/useKameleoon.js +3 -1
- package/dist/useKameleoon.js.map +1 -1
- package/dist/useNativeVisitorCode.d.ts +16 -0
- package/dist/useNativeVisitorCode.js +20 -0
- package/dist/useNativeVisitorCode.js.map +1 -0
- package/dist/useRemoteData.d.ts +19 -0
- package/dist/{useRetrieveDataFromRemoteSource.js → useRemoteData.js} +25 -28
- package/dist/useRemoteData.js.map +1 -0
- package/dist/useTrackConversion.d.ts +18 -0
- package/dist/useTrackConversion.js +29 -0
- package/dist/useTrackConversion.js.map +1 -0
- package/dist/useTriggerExperiment.d.ts +12 -10
- package/dist/useTriggerExperiment.js +8 -9
- package/dist/useTriggerExperiment.js.map +1 -1
- package/dist/useVisitorExperiments.d.ts +20 -0
- package/dist/useVisitorExperiments.js +30 -0
- package/dist/useVisitorExperiments.js.map +1 -0
- package/dist/useVisitorFeatureFlags.d.ts +19 -0
- package/dist/useVisitorFeatureFlags.js +30 -0
- package/dist/useVisitorFeatureFlags.js.map +1 -0
- package/package.json +10 -5
- package/dist/Feature.d.ts +0 -11
- package/dist/Feature.js +0 -26
- package/dist/Feature.js.map +0 -1
- package/dist/compose.d.ts +0 -8
- package/dist/compose.js +0 -58
- package/dist/compose.js.map +0 -1
- package/dist/getKameleoonException.d.ts +0 -2
- package/dist/getKameleoonException.js +0 -34
- package/dist/getKameleoonException.js.map +0 -1
- package/dist/types.d.ts +0 -37
- package/dist/types.js +0 -4
- package/dist/types.js.map +0 -1
- package/dist/useActivateFeature.d.ts +0 -14
- package/dist/useActivateFeature.js +0 -33
- package/dist/useActivateFeature.js.map +0 -1
- package/dist/useAsyncVisitorCode.d.ts +0 -12
- package/dist/useAsyncVisitorCode.js.map +0 -1
- package/dist/useBrowser.d.ts +0 -13
- package/dist/useBrowser.js +0 -22
- package/dist/useBrowser.js.map +0 -1
- package/dist/useConversion.d.ts +0 -14
- package/dist/useConversion.js +0 -18
- package/dist/useConversion.js.map +0 -1
- package/dist/useCustomData.d.ts +0 -13
- package/dist/useCustomData.js +0 -18
- package/dist/useCustomData.js.map +0 -1
- package/dist/useDevice.d.ts +0 -12
- package/dist/useDevice.js +0 -16
- package/dist/useDevice.js.map +0 -1
- package/dist/useFeature.d.ts +0 -5
- package/dist/useFeature.js +0 -101
- package/dist/useFeature.js.map +0 -1
- package/dist/useFlush.d.ts +0 -11
- package/dist/useFlush.js +0 -19
- package/dist/useFlush.js.map +0 -1
- package/dist/usePageView.d.ts +0 -14
- package/dist/usePageView.js +0 -18
- package/dist/usePageView.js.map +0 -1
- package/dist/useRetrieveDataFromRemoteSource.d.ts +0 -12
- package/dist/useRetrieveDataFromRemoteSource.js.map +0 -1
- package/dist/useRunWhenReady.d.ts +0 -14
- package/dist/useRunWhenReady.js +0 -23
- package/dist/useRunWhenReady.js.map +0 -1
- package/dist/useTrackingConversion.d.ts +0 -13
- package/dist/useTrackingConversion.js +0 -19
- package/dist/useTrackingConversion.js.map +0 -1
- package/dist/useVariationAssociatedData.d.ts +0 -16
- package/dist/useVariationAssociatedData.js +0 -30
- package/dist/useVariationAssociatedData.js.map +0 -1
- package/dist/useVisitorCode.d.ts +0 -12
- package/dist/useVisitorCode.js +0 -19
- package/dist/useVisitorCode.js.map +0 -1
- package/dist/withActivateFeature.d.ts +0 -17
- package/dist/withActivateFeature.js +0 -28
- package/dist/withActivateFeature.js.map +0 -1
- package/dist/withAddData.d.ts +0 -16
- package/dist/withAddData.js +0 -28
- package/dist/withAddData.js.map +0 -1
- package/dist/withAsyncVisitorCode.d.ts +0 -15
- package/dist/withAsyncVisitorCode.js +0 -75
- package/dist/withAsyncVisitorCode.js.map +0 -1
- package/dist/withBrowser.d.ts +0 -16
- package/dist/withBrowser.js +0 -35
- package/dist/withBrowser.js.map +0 -1
- package/dist/withConversion.d.ts +0 -17
- package/dist/withConversion.js +0 -31
- package/dist/withConversion.js.map +0 -1
- package/dist/withCustomData.d.ts +0 -16
- package/dist/withCustomData.js +0 -31
- package/dist/withCustomData.js.map +0 -1
- package/dist/withDevice.d.ts +0 -15
- package/dist/withDevice.js +0 -29
- package/dist/withDevice.js.map +0 -1
- package/dist/withFeature.d.ts +0 -6
- package/dist/withFeature.js +0 -31
- package/dist/withFeature.js.map +0 -1
- package/dist/withFeatureVariable.d.ts +0 -17
- package/dist/withFeatureVariable.js +0 -28
- package/dist/withFeatureVariable.js.map +0 -1
- package/dist/withFlush.d.ts +0 -14
- package/dist/withFlush.js +0 -36
- package/dist/withFlush.js.map +0 -1
- package/dist/withKameleoon.d.ts +0 -13
- package/dist/withKameleoon.js +0 -33
- package/dist/withKameleoon.js.map +0 -1
- package/dist/withPageView.d.ts +0 -17
- package/dist/withPageView.js +0 -31
- package/dist/withPageView.js.map +0 -1
- package/dist/withRetrieveDataFromRemoteSource.d.ts +0 -14
- package/dist/withRetrieveDataFromRemoteSource.js +0 -28
- package/dist/withRetrieveDataFromRemoteSource.js.map +0 -1
- package/dist/withRunWhenReady.d.ts +0 -16
- package/dist/withRunWhenReady.js +0 -28
- package/dist/withRunWhenReady.js.map +0 -1
- package/dist/withTrackingConversion.d.ts +0 -16
- package/dist/withTrackingConversion.js +0 -36
- package/dist/withTrackingConversion.js.map +0 -1
- package/dist/withTriggerExperiment.d.ts +0 -19
- package/dist/withTriggerExperiment.js +0 -30
- package/dist/withTriggerExperiment.js.map +0 -1
- package/dist/withVariationAssociatedData.d.ts +0 -18
- package/dist/withVariationAssociatedData.js +0 -30
- package/dist/withVariationAssociatedData.js.map +0 -1
- package/dist/withVisitorCode.d.ts +0 -15
- package/dist/withVisitorCode.js +0 -36
- package/dist/withVisitorCode.js.map +0 -1
package/dist/withConversion.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Conversion } from '@kameleoon/javascript-sdk-core/dist/data';
|
|
3
|
-
import { UnknownPropsType, Without } from './types';
|
|
4
|
-
interface IWithConversion {
|
|
5
|
-
/**
|
|
6
|
-
* @param goalId - unique identifier of the goal
|
|
7
|
-
* @param revenue - conversion revenue
|
|
8
|
-
* @param negative - defines if the revenue is positive or negative
|
|
9
|
-
*/
|
|
10
|
-
addConversion: (goalId: number, revenue?: number, negative?: boolean) => Conversion;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* A React HOC that gives a wrapped component access to callback function
|
|
14
|
-
* which adds conversion
|
|
15
|
-
*/
|
|
16
|
-
export declare function withConversion<Props extends UnknownPropsType>(Component: React.ComponentType<Props>): React.ComponentType<Props & Without<Props, IWithConversion>>;
|
|
17
|
-
export {};
|
package/dist/withConversion.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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.withConversion = void 0;
|
|
15
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
-
var react_1 = require("react");
|
|
17
|
-
var javascript_sdk_core_1 = require("@kameleoon/javascript-sdk-core");
|
|
18
|
-
/**
|
|
19
|
-
* A React HOC that gives a wrapped component access to callback function
|
|
20
|
-
* which adds conversion
|
|
21
|
-
*/
|
|
22
|
-
function withConversion(Component) {
|
|
23
|
-
return function WrappedComponent(props) {
|
|
24
|
-
var addConversion = (0, react_1.useCallback)(function (goalId, revenue, negative) {
|
|
25
|
-
return new javascript_sdk_core_1.KameleoonData.Conversion(goalId, revenue, negative);
|
|
26
|
-
}, []);
|
|
27
|
-
return (0, jsx_runtime_1.jsx)(Component, __assign({ addConversion: addConversion }, props), void 0);
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
exports.withConversion = withConversion;
|
|
31
|
-
//# sourceMappingURL=withConversion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withConversion.js","sourceRoot":"","sources":["../src/withConversion.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAC3C,sEAA+D;AAiB/D;;;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,mCAAa,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.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { CustomData } from '@kameleoon/javascript-sdk-core/dist/data';
|
|
3
|
-
import { UnknownPropsType, Without } from './types';
|
|
4
|
-
interface IWithCustomData {
|
|
5
|
-
/**
|
|
6
|
-
* @param index - index or unique identifier of the custom data to be stored
|
|
7
|
-
* @param value - value of the custom data to be stored
|
|
8
|
-
*/
|
|
9
|
-
addCustomData: (index: number, value: string) => CustomData;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* A React HOC that gives a wrapped component access to callback function
|
|
13
|
-
* which adds custom data
|
|
14
|
-
*/
|
|
15
|
-
export declare function withCustomData<Props extends UnknownPropsType>(Component: React.ComponentType<Props>): React.ComponentType<Props & Without<Props, IWithCustomData>>;
|
|
16
|
-
export {};
|
package/dist/withCustomData.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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.withCustomData = void 0;
|
|
15
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
-
var react_1 = require("react");
|
|
17
|
-
var javascript_sdk_core_1 = require("@kameleoon/javascript-sdk-core");
|
|
18
|
-
/**
|
|
19
|
-
* A React HOC that gives a wrapped component access to callback function
|
|
20
|
-
* which adds custom data
|
|
21
|
-
*/
|
|
22
|
-
function withCustomData(Component) {
|
|
23
|
-
return function WrappedComponent(props) {
|
|
24
|
-
var addCustomData = (0, react_1.useCallback)(function (index, value) {
|
|
25
|
-
return new javascript_sdk_core_1.KameleoonData.CustomData(index, value);
|
|
26
|
-
}, []);
|
|
27
|
-
return (0, jsx_runtime_1.jsx)(Component, __assign({ addCustomData: addCustomData }, props), void 0);
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
exports.withCustomData = withCustomData;
|
|
31
|
-
//# sourceMappingURL=withCustomData.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withCustomData.js","sourceRoot":"","sources":["../src/withCustomData.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAC3C,sEAA+D;AAY/D;;;GAGG;AACH,SAAgB,cAAc,CAC5B,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,aAAa,GAAG,IAAA,mBAAW,EAC/B,UAAC,KAAa,EAAE,KAAa;YAC3B,OAAO,IAAI,mCAAa,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACpD,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/withDevice.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Device as IDevice, DeviceType } from '@kameleoon/javascript-sdk-core/dist/data';
|
|
3
|
-
import { UnknownPropsType, Without } from './types';
|
|
4
|
-
interface IWithDevice {
|
|
5
|
-
/**
|
|
6
|
-
* @param device - device types: Phone, Tablet, Desktop
|
|
7
|
-
*/
|
|
8
|
-
addDevice: (device: DeviceType) => IDevice;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* A React HOC that gives a wrapped component access to callback function
|
|
12
|
-
* which adds device type
|
|
13
|
-
*/
|
|
14
|
-
export declare function withDevice<Props extends UnknownPropsType>(Component: React.ComponentType<Props>): React.ComponentType<Props & Without<Props, IWithDevice>>;
|
|
15
|
-
export {};
|
package/dist/withDevice.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
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.withDevice = void 0;
|
|
15
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
-
var react_1 = require("react");
|
|
17
|
-
var javascript_sdk_core_1 = require("@kameleoon/javascript-sdk-core");
|
|
18
|
-
/**
|
|
19
|
-
* A React HOC that gives a wrapped component access to callback function
|
|
20
|
-
* which adds device type
|
|
21
|
-
*/
|
|
22
|
-
function withDevice(Component) {
|
|
23
|
-
return function WrappedComponent(props) {
|
|
24
|
-
var addDevice = (0, react_1.useCallback)(function (device) { return new javascript_sdk_core_1.KameleoonData.Device(device); }, []);
|
|
25
|
-
return (0, jsx_runtime_1.jsx)(Component, __assign({ addDevice: addDevice }, props), void 0);
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
exports.withDevice = withDevice;
|
|
29
|
-
//# sourceMappingURL=withDevice.js.map
|
package/dist/withDevice.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withDevice.js","sourceRoot":"","sources":["../src/withDevice.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAK3C,sEAA+D;AAU/D;;;GAGG;AACH,SAAgB,UAAU,CACxB,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,SAAS,GAAG,IAAA,mBAAW,EAC3B,UAAC,MAAkB,IAAc,OAAA,IAAI,mCAAa,CAAC,MAAM,CAAC,MAAM,CAAC,EAAhC,CAAgC,EACjE,EAAE,CACH,CAAC;QAEF,OAAO,uBAAC,SAAS,aAAC,SAAS,EAAE,SAAS,IAAO,KAAe,UAAI,CAAC;IACnE,CAAC,CAAC;AACJ,CAAC;AAXD,gCAWC"}
|
package/dist/withFeature.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Without, IFeatureParams, UnknownPropsType } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* A React HOC that gives a wrapped component access to the status of a feature flag and its variables
|
|
5
|
-
*/
|
|
6
|
-
export declare function withFeature(args: IFeatureParams): <Props extends UnknownPropsType>(Component: React.ComponentType<Props>) => React.ComponentType<Props & Without<Props, IFeatureParams>>;
|
package/dist/withFeature.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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.withFeature = void 0;
|
|
15
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
-
var useFeature_1 = require("./useFeature");
|
|
17
|
-
/**
|
|
18
|
-
* A React HOC that gives a wrapped component access to the status of a feature flag and its variables
|
|
19
|
-
*/
|
|
20
|
-
function withFeature(args) {
|
|
21
|
-
// Returns curried function that can be used with the specified args
|
|
22
|
-
// e.g. withFeature(...args)(Component)
|
|
23
|
-
return function callbackWithArgs(Component) {
|
|
24
|
-
return function WrappedComponent(props) {
|
|
25
|
-
var _a = (0, useFeature_1.useFeature)(__assign({}, args)), feature = _a.feature, featureErrors = _a.errors;
|
|
26
|
-
return ((0, jsx_runtime_1.jsx)(Component, __assign({ feature: feature, featureErrors: featureErrors }, props), void 0));
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
exports.withFeature = withFeature;
|
|
31
|
-
//# sourceMappingURL=withFeature.js.map
|
package/dist/withFeature.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;YACrC,IAAA,KAAqC,IAAA,uBAAU,eAAM,IAAI,EAAG,EAA1D,OAAO,aAAA,EAAU,aAAa,YAA4B,CAAC;YAEnE,OAAO,CACL,uBAAC,SAAS,aACR,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,IACvB,KAAe,UACpB,CACH,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAlBD,kCAkBC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { KameleoonError } from './KameleoonError';
|
|
3
|
-
import { FeatureFlagVariableType, UnknownPropsType, Without } from './types';
|
|
4
|
-
interface IWithFeatureVariable {
|
|
5
|
-
/**
|
|
6
|
-
* @param featureKey - unique identifier or key of the feature you want to obtain to a user
|
|
7
|
-
* @param variableKey - key of the variable
|
|
8
|
-
*/
|
|
9
|
-
getFeatureVariable: (featureKey: string | number, variableKey: string) => FeatureFlagVariableType;
|
|
10
|
-
featureVariableError: KameleoonError | null;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* A React HOC that gives a wrapped component access to callback function
|
|
14
|
-
* which retrieves a feature variable
|
|
15
|
-
*/
|
|
16
|
-
export declare function withFeatureVariable<Props extends UnknownPropsType>(Component: React.ComponentType<Props>): React.ComponentType<Props & Without<Props, IWithFeatureVariable>>;
|
|
17
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
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.withFeatureVariable = void 0;
|
|
15
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
-
var useFeatureVariable_1 = require("./useFeatureVariable");
|
|
17
|
-
/**
|
|
18
|
-
* A React HOC that gives a wrapped component access to callback function
|
|
19
|
-
* which retrieves a feature variable
|
|
20
|
-
*/
|
|
21
|
-
function withFeatureVariable(Component) {
|
|
22
|
-
return function WrappedComponent(props) {
|
|
23
|
-
var _a = (0, useFeatureVariable_1.useFeatureVariable)(), getFeatureVariable = _a.getFeatureVariable, featureVariableError = _a.error;
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)(Component, __assign({ getFeatureVariable: getFeatureVariable, featureVariableError: featureVariableError }, props), void 0));
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
exports.withFeatureVariable = withFeatureVariable;
|
|
28
|
-
//# sourceMappingURL=withFeatureVariable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withFeatureVariable.js","sourceRoot":"","sources":["../src/withFeatureVariable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,2DAA0D;AAc1D;;;GAGG;AACH,SAAgB,mBAAmB,CACjC,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QACrC,IAAA,KACJ,IAAA,uCAAkB,GAAE,EADd,kBAAkB,wBAAA,EAAS,oBAAoB,WACjC,CAAC;QAEvB,OAAO,CACL,uBAAC,SAAS,aACR,kBAAkB,EAAE,kBAAkB,EACtC,oBAAoB,EAAE,oBAAoB,IACrC,KAAe,UACpB,CACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAfD,kDAeC"}
|
package/dist/withFlush.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { UnknownPropsType, Without } from './types';
|
|
3
|
-
interface IWithFlush {
|
|
4
|
-
/**
|
|
5
|
-
* @param visitorCode - unique identifier of the user
|
|
6
|
-
*/
|
|
7
|
-
flush: (visitorCode: string) => void;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* A React HOC that gives a wrapped component access to callback function
|
|
11
|
-
* which allows to flush data to servers
|
|
12
|
-
*/
|
|
13
|
-
export declare function withFlush<Props extends UnknownPropsType>(Component: React.ComponentType<Props>): React.ComponentType<Props & Without<Props, IWithFlush>>;
|
|
14
|
-
export {};
|
package/dist/withFlush.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
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.withFlush = void 0;
|
|
15
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
-
var react_1 = require("react");
|
|
17
|
-
var ProviderError_1 = require("./ProviderError");
|
|
18
|
-
var KameleoonContext_1 = require("./KameleoonContext");
|
|
19
|
-
/**
|
|
20
|
-
* A React HOC that gives a wrapped component access to callback function
|
|
21
|
-
* which allows to flush data to servers
|
|
22
|
-
*/
|
|
23
|
-
function withFlush(Component) {
|
|
24
|
-
return function WrappedComponent(props) {
|
|
25
|
-
var client = (0, react_1.useContext)(KameleoonContext_1.KameleoonContext);
|
|
26
|
-
var flush = (0, react_1.useCallback)(function (visitorCode) {
|
|
27
|
-
if (!client) {
|
|
28
|
-
throw new ProviderError_1.ProviderError('withFlush');
|
|
29
|
-
}
|
|
30
|
-
client.flush(visitorCode);
|
|
31
|
-
}, [client]);
|
|
32
|
-
return (0, jsx_runtime_1.jsx)(Component, __assign({ flush: flush }, props), void 0);
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
exports.withFlush = withFlush;
|
|
36
|
-
//# sourceMappingURL=withFlush.js.map
|
package/dist/withFlush.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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/withKameleoon.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { KameleoonClient } from '@kameleoon/javascript-sdk-core';
|
|
3
|
-
import { UnknownPropsType, Without } from './types';
|
|
4
|
-
interface IWithKameleoonProps {
|
|
5
|
-
/** An instance of KameleoonClient */
|
|
6
|
-
client: KameleoonClient;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* A React HOC that gives a wrapped component direct access
|
|
10
|
-
* to Kameleoon client via props
|
|
11
|
-
*/
|
|
12
|
-
export declare function withKameleoon<Props extends UnknownPropsType>(Component: React.ComponentType<Props>): React.ComponentType<Props & Without<Props, IWithKameleoonProps>>;
|
|
13
|
-
export {};
|
package/dist/withKameleoon.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
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.withKameleoon = void 0;
|
|
15
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
-
var react_1 = require("react");
|
|
17
|
-
var KameleoonContext_1 = require("./KameleoonContext");
|
|
18
|
-
var ProviderError_1 = require("./ProviderError");
|
|
19
|
-
/**
|
|
20
|
-
* A React HOC that gives a wrapped component direct access
|
|
21
|
-
* to Kameleoon client via props
|
|
22
|
-
*/
|
|
23
|
-
function withKameleoon(Component) {
|
|
24
|
-
return function WrappedComponent(props) {
|
|
25
|
-
var client = (0, react_1.useContext)(KameleoonContext_1.KameleoonContext);
|
|
26
|
-
if (!client) {
|
|
27
|
-
throw new ProviderError_1.ProviderError('withKameleoon');
|
|
28
|
-
}
|
|
29
|
-
return (0, jsx_runtime_1.jsx)(Component, __assign({ client: client }, props), void 0);
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
exports.withKameleoon = withKameleoon;
|
|
33
|
-
//# sourceMappingURL=withKameleoon.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { PageView } from '@kameleoon/javascript-sdk-core/dist/data';
|
|
3
|
-
import { UnknownPropsType, Without } from './types';
|
|
4
|
-
interface IWithPageView {
|
|
5
|
-
/**
|
|
6
|
-
* @param url - URL of the page viewed
|
|
7
|
-
* @param title - title of the page viewed
|
|
8
|
-
* @param referrer - referrer of the page viewed
|
|
9
|
-
*/
|
|
10
|
-
addPageView: (url: string, title: string, referrer?: number) => PageView;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* A React HOC that gives a wrapped component access to callback function
|
|
14
|
-
* which adds page view
|
|
15
|
-
*/
|
|
16
|
-
export declare function withPageView<Props extends UnknownPropsType>(Component: React.ComponentType<Props>): React.ComponentType<Props & Without<Props, IWithPageView>>;
|
|
17
|
-
export {};
|
package/dist/withPageView.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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.withPageView = void 0;
|
|
15
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
-
var react_1 = require("react");
|
|
17
|
-
var javascript_sdk_core_1 = require("@kameleoon/javascript-sdk-core");
|
|
18
|
-
/**
|
|
19
|
-
* A React HOC that gives a wrapped component access to callback function
|
|
20
|
-
* which adds page view
|
|
21
|
-
*/
|
|
22
|
-
function withPageView(Component) {
|
|
23
|
-
return function WrappedComponent(props) {
|
|
24
|
-
var addPageView = (0, react_1.useCallback)(function (url, title, referrer) {
|
|
25
|
-
return new javascript_sdk_core_1.KameleoonData.PageView(url, title, referrer);
|
|
26
|
-
}, []);
|
|
27
|
-
return (0, jsx_runtime_1.jsx)(Component, __assign({ addPageView: addPageView }, props), void 0);
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
exports.withPageView = withPageView;
|
|
31
|
-
//# sourceMappingURL=withPageView.js.map
|
package/dist/withPageView.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withPageView.js","sourceRoot":"","sources":["../src/withPageView.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAE3C,sEAA+D;AAY/D;;;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,mCAAa,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"}
|
|
@@ -1,14 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { UnknownPropsType, Without } from './types';
|
|
3
|
-
interface IWithRunWhenReadyData {
|
|
4
|
-
/**
|
|
5
|
-
* @param successCallback - callback which will be executed on successful client initialization
|
|
6
|
-
* @param errorCallback - callback which will be executed if client wasn't able to initialize during the timeout
|
|
7
|
-
* @param timeout - timeout which is given to perform HTTP call for initialization in ms (by default: 2 seconds)
|
|
8
|
-
*/
|
|
9
|
-
runWhenReady: (successCallback: () => void, errorCallback: () => void, timeout?: number) => void;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* A React HOC that gives a wrapped component access to callback function which makes sure that
|
|
13
|
-
* Kameleoon Client will be initialized properly using HTTP call within the specified timeout
|
|
14
|
-
*/
|
|
15
|
-
export declare function withRunWhenReady<Props extends UnknownPropsType>(Component: React.ComponentType<Props>): React.ComponentType<Props & Without<Props, IWithRunWhenReadyData>>;
|
|
16
|
-
export {};
|
package/dist/withRunWhenReady.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
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.withRunWhenReady = void 0;
|
|
15
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
-
var useRunWhenReady_1 = require("./useRunWhenReady");
|
|
17
|
-
/**
|
|
18
|
-
* A React HOC that gives a wrapped component access to callback function which makes sure that
|
|
19
|
-
* Kameleoon Client will be initialized properly using HTTP call within the specified timeout
|
|
20
|
-
*/
|
|
21
|
-
function withRunWhenReady(Component) {
|
|
22
|
-
return function WrappedComponent(props) {
|
|
23
|
-
var runWhenReady = (0, useRunWhenReady_1.useRunWhenReady)().runWhenReady;
|
|
24
|
-
return (0, jsx_runtime_1.jsx)(Component, __assign({ runWhenReady: runWhenReady }, props), void 0);
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
exports.withRunWhenReady = withRunWhenReady;
|
|
28
|
-
//# sourceMappingURL=withRunWhenReady.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withRunWhenReady.js","sourceRoot":"","sources":["../src/withRunWhenReady.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,qDAAoD;AAepD;;;GAGG;AACH,SAAgB,gBAAgB,CAC9B,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QACnC,IAAA,YAAY,GAAK,IAAA,iCAAe,GAAE,aAAtB,CAAuB;QAE3C,OAAO,uBAAC,SAAS,aAAC,YAAY,EAAE,YAAY,IAAO,KAAe,UAAI,CAAC;IACzE,CAAC,CAAC;AACJ,CAAC;AARD,4CAQC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { UnknownPropsType, Without } from './types';
|
|
3
|
-
interface IWithTrackingConversion {
|
|
4
|
-
/**
|
|
5
|
-
* @param visitorCode - unique identifier of the user
|
|
6
|
-
* @param goalId - unique identifier of the goal
|
|
7
|
-
* @param revenue - revenue of the conversion
|
|
8
|
-
*/
|
|
9
|
-
trackConversion: (visitorCode: string, goalId: number, revenue?: number) => void;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* A React HOC that gives a wrapped component access to callback function
|
|
13
|
-
* which tracks conversion
|
|
14
|
-
*/
|
|
15
|
-
export declare function withTrackingConversion<Props extends UnknownPropsType>(Component: React.ComponentType<Props>): React.ComponentType<Props & Without<Props, IWithTrackingConversion>>;
|
|
16
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
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.withTrackingConversion = void 0;
|
|
15
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
-
var react_1 = require("react");
|
|
17
|
-
var ProviderError_1 = require("./ProviderError");
|
|
18
|
-
var KameleoonContext_1 = require("./KameleoonContext");
|
|
19
|
-
/**
|
|
20
|
-
* A React HOC that gives a wrapped component access to callback function
|
|
21
|
-
* which tracks conversion
|
|
22
|
-
*/
|
|
23
|
-
function withTrackingConversion(Component) {
|
|
24
|
-
return function WrappedComponent(props) {
|
|
25
|
-
var client = (0, react_1.useContext)(KameleoonContext_1.KameleoonContext);
|
|
26
|
-
var trackConversion = (0, react_1.useCallback)(function (visitorCode, goalId, revenue) {
|
|
27
|
-
if (!client) {
|
|
28
|
-
throw new ProviderError_1.ProviderError('withTrackingConversion');
|
|
29
|
-
}
|
|
30
|
-
return client.trackConversion(visitorCode, goalId, revenue);
|
|
31
|
-
}, [client]);
|
|
32
|
-
return ((0, jsx_runtime_1.jsx)(Component, __assign({ trackConversion: trackConversion }, props), void 0));
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
exports.withTrackingConversion = withTrackingConversion;
|
|
36
|
-
//# sourceMappingURL=withTrackingConversion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withTrackingConversion.js","sourceRoot":"","sources":["../src/withTrackingConversion.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAAuD;AAEvD,iDAAgD;AAChD,uDAAsD;AAetD;;;GAGG;AACH,SAAgB,sBAAsB,CACpC,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,mCAAgB,CAAC,CAAC;QAE5C,IAAM,eAAe,GAAG,IAAA,mBAAW,EACjC,UAAC,WAAmB,EAAE,MAAc,EAAE,OAAgB;YACpD,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,IAAI,6BAAa,CAAC,wBAAwB,CAAC,CAAC;aACnD;YAED,OAAO,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9D,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;QAEF,OAAO,CACL,uBAAC,SAAS,aAAC,eAAe,EAAE,eAAe,IAAO,KAAe,UAAI,CACtE,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AArBD,wDAqBC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { KameleoonError } from './KameleoonError';
|
|
3
|
-
import { UnknownPropsType, Without } from './types';
|
|
4
|
-
interface IWithTriggerExperiment {
|
|
5
|
-
/**
|
|
6
|
-
* @param visitorCode - unique identifier of the user
|
|
7
|
-
* @param experimentId - unique identifier of the experiment you want to expose to a user
|
|
8
|
-
*/
|
|
9
|
-
getVariationId: (visitorCode: string, experimentId: number) => number;
|
|
10
|
-
triggerExperimentError: KameleoonError | null;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* A React HOC that gives a wrapped component access to callback function which triggers experiment
|
|
14
|
-
* If such a user has never been associated with any variation, the SDK returns a randomly selected variation.
|
|
15
|
-
* If a user with a given visitorCode is already registered with a variation,
|
|
16
|
-
* it will detect the previously registered variation and return the variationID
|
|
17
|
-
*/
|
|
18
|
-
export declare function withTriggerExperiment<Props extends UnknownPropsType>(Component: React.ComponentType<Props>): React.ComponentType<Props & Without<Props, IWithTriggerExperiment>>;
|
|
19
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
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.withTriggerExperiment = void 0;
|
|
15
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
-
var useTriggerExperiment_1 = require("./useTriggerExperiment");
|
|
17
|
-
/**
|
|
18
|
-
* A React HOC that gives a wrapped component access to callback function which triggers experiment
|
|
19
|
-
* If such a user has never been associated with any variation, the SDK returns a randomly selected variation.
|
|
20
|
-
* If a user with a given visitorCode is already registered with a variation,
|
|
21
|
-
* it will detect the previously registered variation and return the variationID
|
|
22
|
-
*/
|
|
23
|
-
function withTriggerExperiment(Component) {
|
|
24
|
-
return function WrappedComponent(props) {
|
|
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));
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
exports.withTriggerExperiment = withTriggerExperiment;
|
|
30
|
-
//# sourceMappingURL=withTriggerExperiment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|