@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
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
export declare const KameleoonContext: import("react").Context<
|
|
2
|
+
import { KameleoonCore } from '@kameleoon/javascript-sdk-core';
|
|
3
|
+
export declare const KameleoonContext: import("react").Context<KameleoonCore | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KameleoonContext.js","sourceRoot":"","sources":["../src/KameleoonContext.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"KameleoonContext.js","sourceRoot":"","sources":["../src/KameleoonContext.ts"],"names":[],"mappings":";;;AAAA,+BAAsC;AAGzB,QAAA,gBAAgB,GAAG,IAAA,qBAAa,EAAuB,IAAI,CAAC,CAAC"}
|
package/dist/KameleoonError.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
interface IKameleoonProviderProps {
|
|
4
|
-
/** Child elements of the provider */
|
|
2
|
+
import { KameleoonCore } from '@kameleoon/javascript-sdk-core';
|
|
3
|
+
export interface IKameleoonProviderProps {
|
|
4
|
+
/** Child elements of the provider. */
|
|
5
5
|
children: ReactNode;
|
|
6
|
-
/** An instance of KameleoonClient */
|
|
7
|
-
client:
|
|
6
|
+
/** An instance of KameleoonClient. */
|
|
7
|
+
client: KameleoonCore;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* A Provider that wraps the project and provides an access to SDK APIs
|
|
@@ -19,7 +19,7 @@ var KameleoonContext_1 = require("./KameleoonContext");
|
|
|
19
19
|
*/
|
|
20
20
|
function KameleoonProvider(_a) {
|
|
21
21
|
var client = _a.client, children = _a.children;
|
|
22
|
-
return ((0, jsx_runtime_1.jsx)(KameleoonContext_1.KameleoonContext.Provider, __assign({ value: client }, { children: children })
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(KameleoonContext_1.KameleoonContext.Provider, __assign({ value: client }, { children: children })));
|
|
23
23
|
}
|
|
24
24
|
exports.default = (0, react_1.memo)(KameleoonProvider);
|
|
25
25
|
//# sourceMappingURL=KameleoonProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KameleoonProvider.js","sourceRoot":"","sources":["../src/KameleoonProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+BAA+C;AAE/C,uDAAsD;AAStD;;GAEG;AACH,SAAS,iBAAiB,CAAC,EAGD;QAFxB,MAAM,YAAA,EACN,QAAQ,cAAA;IAER,OAAO,CACL,uBAAC,mCAAgB,CAAC,QAAQ,aAAC,KAAK,EAAE,MAAM,gBACrC,QAAQ,
|
|
1
|
+
{"version":3,"file":"KameleoonProvider.js","sourceRoot":"","sources":["../src/KameleoonProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+BAA+C;AAE/C,uDAAsD;AAStD;;GAEG;AACH,SAAS,iBAAiB,CAAC,EAGD;QAFxB,MAAM,YAAA,EACN,QAAQ,cAAA;IAER,OAAO,CACL,uBAAC,mCAAgB,CAAC,QAAQ,aAAC,KAAK,EAAE,MAAM,gBACrC,QAAQ,IACiB,CAC7B,CAAC;AACJ,CAAC;AAED,kBAAe,IAAA,YAAI,EAAC,iBAAiB,CAAC,CAAC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,24 +1 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const PRODUCTION = "production";
|
|
3
|
-
export declare enum Browser {
|
|
4
|
-
Chrome = "CHROME",
|
|
5
|
-
Internet_Explorer = "INTERNET_EXPLORER",
|
|
6
|
-
Firefox = "FIREFOX",
|
|
7
|
-
Safari = "SAFARI",
|
|
8
|
-
Opera = "OPERA",
|
|
9
|
-
Other = "OTHER"
|
|
10
|
-
}
|
|
11
|
-
export declare enum FeatureResultField {
|
|
12
|
-
IsActive = "isActive",
|
|
13
|
-
Variables = "variables"
|
|
14
|
-
}
|
|
15
|
-
export declare enum KameleoonException {
|
|
16
|
-
ExperimentConfigurationNotFound = "ExperimentConfigurationNotFound",
|
|
17
|
-
FeatureConfigurationNotFound = "FeatureConfigurationNotFound",
|
|
18
|
-
VariationConfigurationNotFound = "VariationConfigurationNotFound",
|
|
19
|
-
VariationConfigurationTimedOut = "VariationConfigurationTimedOut",
|
|
20
|
-
NotTargeted = "NotTargeted",
|
|
21
|
-
NotActivated = "NotActivated",
|
|
22
|
-
CredentialsNotFound = "CredentialsNotFound",
|
|
23
|
-
NoDataWasRetrievedFromRemoteServer = "NoDataWasRetrievedFromRemoteServer"
|
|
24
|
-
}
|
|
1
|
+
export declare const DEFAULT_VARIATION_ID = 0;
|
package/dist/constants.js
CHANGED
|
@@ -1,31 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.PRODUCTION = 'production';
|
|
6
|
-
var Browser;
|
|
7
|
-
(function (Browser) {
|
|
8
|
-
Browser["Chrome"] = "CHROME";
|
|
9
|
-
Browser["Internet_Explorer"] = "INTERNET_EXPLORER";
|
|
10
|
-
Browser["Firefox"] = "FIREFOX";
|
|
11
|
-
Browser["Safari"] = "SAFARI";
|
|
12
|
-
Browser["Opera"] = "OPERA";
|
|
13
|
-
Browser["Other"] = "OTHER";
|
|
14
|
-
})(Browser = exports.Browser || (exports.Browser = {}));
|
|
15
|
-
var FeatureResultField;
|
|
16
|
-
(function (FeatureResultField) {
|
|
17
|
-
FeatureResultField["IsActive"] = "isActive";
|
|
18
|
-
FeatureResultField["Variables"] = "variables";
|
|
19
|
-
})(FeatureResultField = exports.FeatureResultField || (exports.FeatureResultField = {}));
|
|
20
|
-
var KameleoonException;
|
|
21
|
-
(function (KameleoonException) {
|
|
22
|
-
KameleoonException["ExperimentConfigurationNotFound"] = "ExperimentConfigurationNotFound";
|
|
23
|
-
KameleoonException["FeatureConfigurationNotFound"] = "FeatureConfigurationNotFound";
|
|
24
|
-
KameleoonException["VariationConfigurationNotFound"] = "VariationConfigurationNotFound";
|
|
25
|
-
KameleoonException["VariationConfigurationTimedOut"] = "VariationConfigurationTimedOut";
|
|
26
|
-
KameleoonException["NotTargeted"] = "NotTargeted";
|
|
27
|
-
KameleoonException["NotActivated"] = "NotActivated";
|
|
28
|
-
KameleoonException["CredentialsNotFound"] = "CredentialsNotFound";
|
|
29
|
-
KameleoonException["NoDataWasRetrievedFromRemoteServer"] = "NoDataWasRetrievedFromRemoteServer";
|
|
30
|
-
})(KameleoonException = exports.KameleoonException || (exports.KameleoonException = {}));
|
|
3
|
+
exports.DEFAULT_VARIATION_ID = void 0;
|
|
4
|
+
exports.DEFAULT_VARIATION_ID = 0;
|
|
31
5
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrowserEventSourceConstructor = void 0;
|
|
4
|
+
var BrowserEventSourceConstructor = /** @class */ (function () {
|
|
5
|
+
function BrowserEventSourceConstructor() {
|
|
6
|
+
}
|
|
7
|
+
BrowserEventSourceConstructor.prototype.initialize = function (url) {
|
|
8
|
+
return new ExternalEventSource(url);
|
|
9
|
+
};
|
|
10
|
+
return BrowserEventSourceConstructor;
|
|
11
|
+
}());
|
|
12
|
+
exports.BrowserEventSourceConstructor = BrowserEventSourceConstructor;
|
|
13
|
+
// --- Note ---
|
|
14
|
+
// - `EventSource` has no dedicated tests because same browser instance
|
|
15
|
+
// is tested thoroughly inside core and would just duplicate tests
|
|
16
|
+
// - Moreover we would have to import some unexposed details like constructed url
|
|
17
|
+
// or the `eventType` from the core
|
|
18
|
+
var ExternalEventSource = /** @class */ (function () {
|
|
19
|
+
function ExternalEventSource(url) {
|
|
20
|
+
var eventSource = new EventSource(url);
|
|
21
|
+
this.eventSource = eventSource;
|
|
22
|
+
}
|
|
23
|
+
ExternalEventSource.prototype.open = function (_a) {
|
|
24
|
+
var siteCode = _a.siteCode, eventType = _a.eventType, onEvent = _a.onEvent;
|
|
25
|
+
this.eventSource.addEventListener(eventType, function (message) {
|
|
26
|
+
var event = JSON.parse(message.data);
|
|
27
|
+
var eventSiteCode = event.siteCode, ts = event.ts;
|
|
28
|
+
if (siteCode === eventSiteCode) {
|
|
29
|
+
onEvent(ts);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
ExternalEventSource.prototype.close = function () {
|
|
34
|
+
this.eventSource.close();
|
|
35
|
+
};
|
|
36
|
+
return ExternalEventSource;
|
|
37
|
+
}());
|
|
38
|
+
//# sourceMappingURL=browserEventSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browserEventSource.js","sourceRoot":"","sources":["../../src/eventSource/browserEventSource.ts"],"names":[],"mappings":";;;AAOA;IAAA;IAMA,CAAC;IAHQ,kDAAU,GAAjB,UAAkB,GAAW;QAC3B,OAAO,IAAI,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;IACH,oCAAC;AAAD,CAAC,AAND,IAMC;AANY,sEAA6B;AAQ1C,eAAe;AACf,uEAAuE;AACvE,kEAAkE;AAClE,iFAAiF;AACjF,mCAAmC;AACnC;IAGE,6BAAY,GAAW;QACrB,IAAM,WAAW,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC;QAEzC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAEM,kCAAI,GAAX,UAAY,EAIoB;YAH9B,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,OAAO,aAAA;QAEP,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,SAAS,EAAE,UAAC,OAAO;YACnD,IAAM,KAAK,GAAsB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAClD,IAAU,aAAa,GAAS,KAAK,SAAd,EAAE,EAAE,GAAK,KAAK,GAAV,CAAW;YAE9C,IAAI,QAAQ,KAAK,aAAa,EAAE;gBAC9B,OAAO,CAAC,EAAE,CAAC,CAAC;aACb;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,mCAAK,GAAZ;QACE,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;IACH,0BAAC;AAAD,CAAC,AA3BD,IA2BC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NativeEventSourceConstructor = exports.BrowserEventSourceConstructor = void 0;
|
|
4
|
+
var browserEventSource_1 = require("./browserEventSource");
|
|
5
|
+
Object.defineProperty(exports, "BrowserEventSourceConstructor", { enumerable: true, get: function () { return browserEventSource_1.BrowserEventSourceConstructor; } });
|
|
6
|
+
var nativeEventSource_1 = require("./nativeEventSource");
|
|
7
|
+
Object.defineProperty(exports, "NativeEventSourceConstructor", { enumerable: true, get: function () { return nativeEventSource_1.NativeEventSourceConstructor; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/eventSource/index.ts"],"names":[],"mappings":";;;AAAA,2DAAqE;AAA5D,mIAAA,6BAA6B,OAAA;AACtC,yDAAmE;AAA1D,iIAAA,4BAA4B,OAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.NativeEventSourceConstructor = void 0;
|
|
7
|
+
var react_native_event_source_1 = __importDefault(require("react-native-event-source"));
|
|
8
|
+
var NativeEventSourceConstructor = /** @class */ (function () {
|
|
9
|
+
function NativeEventSourceConstructor() {
|
|
10
|
+
}
|
|
11
|
+
NativeEventSourceConstructor.prototype.initialize = function (url) {
|
|
12
|
+
return new ExternalEventSource(url);
|
|
13
|
+
};
|
|
14
|
+
return NativeEventSourceConstructor;
|
|
15
|
+
}());
|
|
16
|
+
exports.NativeEventSourceConstructor = NativeEventSourceConstructor;
|
|
17
|
+
var ExternalEventSource = /** @class */ (function () {
|
|
18
|
+
function ExternalEventSource(url) {
|
|
19
|
+
var eventSource = new react_native_event_source_1.default(url);
|
|
20
|
+
this.eventSource = eventSource;
|
|
21
|
+
}
|
|
22
|
+
ExternalEventSource.prototype.open = function (_a) {
|
|
23
|
+
var siteCode = _a.siteCode, eventType = _a.eventType, onEvent = _a.onEvent;
|
|
24
|
+
this.eventSource.addEventListener(eventType, function (message) {
|
|
25
|
+
if (message.data) {
|
|
26
|
+
var event_1 = JSON.parse(message.data);
|
|
27
|
+
var eventSiteCode = event_1.siteCode, ts = event_1.ts;
|
|
28
|
+
if (siteCode === eventSiteCode) {
|
|
29
|
+
onEvent(ts);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
ExternalEventSource.prototype.close = function () {
|
|
35
|
+
this.eventSource.close();
|
|
36
|
+
};
|
|
37
|
+
return ExternalEventSource;
|
|
38
|
+
}());
|
|
39
|
+
//# sourceMappingURL=nativeEventSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeEventSource.js","sourceRoot":"","sources":["../../src/eventSource/nativeEventSource.ts"],"names":[],"mappings":";;;;;;AAAA,wFAAoD;AAQpD;IAAA;IAMA,CAAC;IAHQ,iDAAU,GAAjB,UAAkB,GAAW;QAC3B,OAAO,IAAI,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;IACH,mCAAC;AAAD,CAAC,AAND,IAMC;AANY,oEAA4B;AAQzC;IAGE,6BAAY,GAAW;QACrB,IAAM,WAAW,GAAG,IAAI,mCAAW,CAAC,GAAG,CAAC,CAAC;QAEzC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAEM,kCAAI,GAAX,UAAY,EAIoB;YAH9B,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,OAAO,aAAA;QAEP,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,SAAS,EAAE,UAAC,OAAO;YACnD,IAAI,OAAO,CAAC,IAAI,EAAE;gBAChB,IAAM,OAAK,GAAsB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBAClD,IAAU,aAAa,GAAS,OAAK,SAAd,EAAE,EAAE,GAAK,OAAK,GAAV,CAAW;gBAE9C,IAAI,QAAQ,KAAK,aAAa,EAAE;oBAC9B,OAAO,CAAC,EAAE,CAAC,CAAC;iBACb;aACF;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,mCAAK,GAAZ;QACE,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;IACH,0BAAC;AAAD,CAAC,AA7BD,IA6BC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,44 +1,18 @@
|
|
|
1
|
+
export { Device, Browser, PageView, JSONType, Conversion, CustomData, DeviceType, BrowserType, Environment, KameleoonException, KameleoonStorageKey, } from '@kameleoon/javascript-sdk-core';
|
|
1
2
|
export { KameleoonContext } from './KameleoonContext';
|
|
2
|
-
export {
|
|
3
|
-
export { Browser as IBrowser, Conversion as IConversion, Device as IDevice, PageView as IPageView, DeviceType, } from '@kameleoon/javascript-sdk-core/dist/data';
|
|
4
|
-
export { default as compose } from './compose';
|
|
5
|
-
export { default as KameleoonProvider } from './KameleoonProvider';
|
|
6
|
-
export * from './types';
|
|
3
|
+
export { default as KameleoonProvider, IKameleoonProviderProps, } from './KameleoonProvider';
|
|
7
4
|
export { createClient } from './kameleoonClient';
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export { useFeatureVariable } from './useFeatureVariable';
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export { usePageView } from './usePageView';
|
|
23
|
-
export { useConversion } from './useConversion';
|
|
24
|
-
export { useCustomData } from './useCustomData';
|
|
25
|
-
export { useDevice } from './useDevice';
|
|
26
|
-
export { useRunWhenReady } from './useRunWhenReady';
|
|
27
|
-
export { withKameleoon } from './withKameleoon';
|
|
28
|
-
export { withFeature } from './withFeature';
|
|
29
|
-
export { withVisitorCode } from './withVisitorCode';
|
|
30
|
-
export { withAsyncVisitorCode } from './withAsyncVisitorCode';
|
|
31
|
-
export { withTriggerExperiment } from './withTriggerExperiment';
|
|
32
|
-
export { withActivateFeature } from './withActivateFeature';
|
|
33
|
-
export { withVariationAssociatedData } from './withVariationAssociatedData';
|
|
34
|
-
export { withRetrieveDataFromRemoteSource } from './withRetrieveDataFromRemoteSource';
|
|
35
|
-
export { withFeatureVariable } from './withFeatureVariable';
|
|
36
|
-
export { withTrackingConversion } from './withTrackingConversion';
|
|
37
|
-
export { withAddData } from './withAddData';
|
|
38
|
-
export { withFlush } from './withFlush';
|
|
39
|
-
export { withBrowser } from './withBrowser';
|
|
40
|
-
export { withDevice } from './withDevice';
|
|
41
|
-
export { withPageView } from './withPageView';
|
|
42
|
-
export { withConversion } from './withConversion';
|
|
43
|
-
export { withCustomData } from './withCustomData';
|
|
44
|
-
export { withRunWhenReady } from './withRunWhenReady';
|
|
5
|
+
export { useInitialize, IInitializeHookResult } from './useInitialize';
|
|
6
|
+
export { useExperiments, IExperimentsHookResult } from './useExperiments';
|
|
7
|
+
export { useFeatureFlags, IFeatureFlagsHookResult } from './useFeatureFlags';
|
|
8
|
+
export { useVisitorExperiments, IVisitorExperimentsHookResult, } from './useVisitorExperiments';
|
|
9
|
+
export { useVisitorFeatureFlags, IVisitorFeatureFlagsHookResult, } from './useVisitorFeatureFlags';
|
|
10
|
+
export { useFeatureFlagVariationKey, IFeatureFlagVariationKeyHookResult, } from './useFeatureFlagVariationKey';
|
|
11
|
+
export { useTriggerExperiment, ITriggerExperimentHookResult, } from './useTriggerExperiment';
|
|
12
|
+
export { useFeatureFlagActive, IFeatureFlagActiveHookResult, } from './useFeatureFlagActive';
|
|
13
|
+
export { useFeatureVariable, IFeatureVariableHookResult, } from './useFeatureVariable';
|
|
14
|
+
export { useTrackConversion, ITrackConversionHookResult, } from './useTrackConversion';
|
|
15
|
+
export { useConfigurationUpdate, IConfigurationUpdateHookResult, } from './useConfigurationUpdate';
|
|
16
|
+
export { useRemoteData, IRemoteDataHookResult } from './useRemoteData';
|
|
17
|
+
export { useAddData, IAddDataHookResult } from './useAddData';
|
|
18
|
+
export { useFlushData, IFlushDataHookResult } from './useFlushData';
|
package/dist/index.js
CHANGED
|
@@ -1,110 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
4
|
};
|
|
15
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.
|
|
6
|
+
exports.useFlushData = exports.useAddData = exports.useRemoteData = exports.useConfigurationUpdate = exports.useTrackConversion = exports.useFeatureVariable = exports.useFeatureFlagActive = exports.useTriggerExperiment = exports.useFeatureFlagVariationKey = exports.useVisitorFeatureFlags = exports.useVisitorExperiments = exports.useFeatureFlags = exports.useExperiments = exports.useInitialize = exports.createClient = exports.KameleoonProvider = exports.KameleoonContext = exports.KameleoonStorageKey = exports.KameleoonException = exports.Environment = exports.BrowserType = exports.DeviceType = exports.CustomData = exports.Conversion = exports.PageView = exports.Browser = exports.Device = void 0;
|
|
7
|
+
var javascript_sdk_core_1 = require("@kameleoon/javascript-sdk-core");
|
|
8
|
+
Object.defineProperty(exports, "Device", { enumerable: true, get: function () { return javascript_sdk_core_1.Device; } });
|
|
9
|
+
Object.defineProperty(exports, "Browser", { enumerable: true, get: function () { return javascript_sdk_core_1.Browser; } });
|
|
10
|
+
Object.defineProperty(exports, "PageView", { enumerable: true, get: function () { return javascript_sdk_core_1.PageView; } });
|
|
11
|
+
Object.defineProperty(exports, "Conversion", { enumerable: true, get: function () { return javascript_sdk_core_1.Conversion; } });
|
|
12
|
+
Object.defineProperty(exports, "CustomData", { enumerable: true, get: function () { return javascript_sdk_core_1.CustomData; } });
|
|
13
|
+
Object.defineProperty(exports, "DeviceType", { enumerable: true, get: function () { return javascript_sdk_core_1.DeviceType; } });
|
|
14
|
+
Object.defineProperty(exports, "BrowserType", { enumerable: true, get: function () { return javascript_sdk_core_1.BrowserType; } });
|
|
15
|
+
Object.defineProperty(exports, "Environment", { enumerable: true, get: function () { return javascript_sdk_core_1.Environment; } });
|
|
16
|
+
Object.defineProperty(exports, "KameleoonException", { enumerable: true, get: function () { return javascript_sdk_core_1.KameleoonException; } });
|
|
17
|
+
Object.defineProperty(exports, "KameleoonStorageKey", { enumerable: true, get: function () { return javascript_sdk_core_1.KameleoonStorageKey; } });
|
|
17
18
|
var KameleoonContext_1 = require("./KameleoonContext");
|
|
18
19
|
Object.defineProperty(exports, "KameleoonContext", { enumerable: true, get: function () { return KameleoonContext_1.KameleoonContext; } });
|
|
19
|
-
var constants_1 = require("./constants");
|
|
20
|
-
Object.defineProperty(exports, "KAMELEOON_SDK_LOCAL_STORAGE_KEY", { enumerable: true, get: function () { return constants_1.KAMELEOON_SDK_LOCAL_STORAGE_KEY; } });
|
|
21
|
-
Object.defineProperty(exports, "Browser", { enumerable: true, get: function () { return constants_1.Browser; } });
|
|
22
|
-
Object.defineProperty(exports, "KameleoonException", { enumerable: true, get: function () { return constants_1.KameleoonException; } });
|
|
23
|
-
var data_1 = require("@kameleoon/javascript-sdk-core/dist/data");
|
|
24
|
-
Object.defineProperty(exports, "IBrowser", { enumerable: true, get: function () { return data_1.Browser; } });
|
|
25
|
-
Object.defineProperty(exports, "IConversion", { enumerable: true, get: function () { return data_1.Conversion; } });
|
|
26
|
-
Object.defineProperty(exports, "IDevice", { enumerable: true, get: function () { return data_1.Device; } });
|
|
27
|
-
Object.defineProperty(exports, "IPageView", { enumerable: true, get: function () { return data_1.PageView; } });
|
|
28
|
-
Object.defineProperty(exports, "DeviceType", { enumerable: true, get: function () { return data_1.DeviceType; } });
|
|
29
|
-
var compose_1 = require("./compose");
|
|
30
|
-
Object.defineProperty(exports, "compose", { enumerable: true, get: function () { return __importDefault(compose_1).default; } });
|
|
31
20
|
var KameleoonProvider_1 = require("./KameleoonProvider");
|
|
32
21
|
Object.defineProperty(exports, "KameleoonProvider", { enumerable: true, get: function () { return __importDefault(KameleoonProvider_1).default; } });
|
|
33
|
-
__exportStar(require("./types"), exports);
|
|
34
22
|
var kameleoonClient_1 = require("./kameleoonClient");
|
|
35
23
|
Object.defineProperty(exports, "createClient", { enumerable: true, get: function () { return kameleoonClient_1.createClient; } });
|
|
36
|
-
var
|
|
37
|
-
Object.defineProperty(exports, "
|
|
38
|
-
var
|
|
39
|
-
Object.defineProperty(exports, "
|
|
40
|
-
var
|
|
41
|
-
Object.defineProperty(exports, "
|
|
42
|
-
var
|
|
43
|
-
Object.defineProperty(exports, "
|
|
44
|
-
var
|
|
45
|
-
Object.defineProperty(exports, "
|
|
24
|
+
var useInitialize_1 = require("./useInitialize");
|
|
25
|
+
Object.defineProperty(exports, "useInitialize", { enumerable: true, get: function () { return useInitialize_1.useInitialize; } });
|
|
26
|
+
var useExperiments_1 = require("./useExperiments");
|
|
27
|
+
Object.defineProperty(exports, "useExperiments", { enumerable: true, get: function () { return useExperiments_1.useExperiments; } });
|
|
28
|
+
var useFeatureFlags_1 = require("./useFeatureFlags");
|
|
29
|
+
Object.defineProperty(exports, "useFeatureFlags", { enumerable: true, get: function () { return useFeatureFlags_1.useFeatureFlags; } });
|
|
30
|
+
var useVisitorExperiments_1 = require("./useVisitorExperiments");
|
|
31
|
+
Object.defineProperty(exports, "useVisitorExperiments", { enumerable: true, get: function () { return useVisitorExperiments_1.useVisitorExperiments; } });
|
|
32
|
+
var useVisitorFeatureFlags_1 = require("./useVisitorFeatureFlags");
|
|
33
|
+
Object.defineProperty(exports, "useVisitorFeatureFlags", { enumerable: true, get: function () { return useVisitorFeatureFlags_1.useVisitorFeatureFlags; } });
|
|
34
|
+
var useFeatureFlagVariationKey_1 = require("./useFeatureFlagVariationKey");
|
|
35
|
+
Object.defineProperty(exports, "useFeatureFlagVariationKey", { enumerable: true, get: function () { return useFeatureFlagVariationKey_1.useFeatureFlagVariationKey; } });
|
|
46
36
|
var useTriggerExperiment_1 = require("./useTriggerExperiment");
|
|
47
37
|
Object.defineProperty(exports, "useTriggerExperiment", { enumerable: true, get: function () { return useTriggerExperiment_1.useTriggerExperiment; } });
|
|
48
|
-
var
|
|
49
|
-
Object.defineProperty(exports, "
|
|
50
|
-
var useVariationAssociatedData_1 = require("./useVariationAssociatedData");
|
|
51
|
-
Object.defineProperty(exports, "useVariationAssociatedData", { enumerable: true, get: function () { return useVariationAssociatedData_1.useVariationAssociatedData; } });
|
|
38
|
+
var useFeatureFlagActive_1 = require("./useFeatureFlagActive");
|
|
39
|
+
Object.defineProperty(exports, "useFeatureFlagActive", { enumerable: true, get: function () { return useFeatureFlagActive_1.useFeatureFlagActive; } });
|
|
52
40
|
var useFeatureVariable_1 = require("./useFeatureVariable");
|
|
53
41
|
Object.defineProperty(exports, "useFeatureVariable", { enumerable: true, get: function () { return useFeatureVariable_1.useFeatureVariable; } });
|
|
54
|
-
var
|
|
55
|
-
Object.defineProperty(exports, "
|
|
56
|
-
var
|
|
57
|
-
Object.defineProperty(exports, "
|
|
42
|
+
var useTrackConversion_1 = require("./useTrackConversion");
|
|
43
|
+
Object.defineProperty(exports, "useTrackConversion", { enumerable: true, get: function () { return useTrackConversion_1.useTrackConversion; } });
|
|
44
|
+
var useConfigurationUpdate_1 = require("./useConfigurationUpdate");
|
|
45
|
+
Object.defineProperty(exports, "useConfigurationUpdate", { enumerable: true, get: function () { return useConfigurationUpdate_1.useConfigurationUpdate; } });
|
|
46
|
+
var useRemoteData_1 = require("./useRemoteData");
|
|
47
|
+
Object.defineProperty(exports, "useRemoteData", { enumerable: true, get: function () { return useRemoteData_1.useRemoteData; } });
|
|
58
48
|
var useAddData_1 = require("./useAddData");
|
|
59
49
|
Object.defineProperty(exports, "useAddData", { enumerable: true, get: function () { return useAddData_1.useAddData; } });
|
|
60
|
-
var
|
|
61
|
-
Object.defineProperty(exports, "
|
|
62
|
-
var useBrowser_1 = require("./useBrowser");
|
|
63
|
-
Object.defineProperty(exports, "useBrowser", { enumerable: true, get: function () { return useBrowser_1.useBrowser; } });
|
|
64
|
-
var usePageView_1 = require("./usePageView");
|
|
65
|
-
Object.defineProperty(exports, "usePageView", { enumerable: true, get: function () { return usePageView_1.usePageView; } });
|
|
66
|
-
var useConversion_1 = require("./useConversion");
|
|
67
|
-
Object.defineProperty(exports, "useConversion", { enumerable: true, get: function () { return useConversion_1.useConversion; } });
|
|
68
|
-
var useCustomData_1 = require("./useCustomData");
|
|
69
|
-
Object.defineProperty(exports, "useCustomData", { enumerable: true, get: function () { return useCustomData_1.useCustomData; } });
|
|
70
|
-
var useDevice_1 = require("./useDevice");
|
|
71
|
-
Object.defineProperty(exports, "useDevice", { enumerable: true, get: function () { return useDevice_1.useDevice; } });
|
|
72
|
-
var useRunWhenReady_1 = require("./useRunWhenReady");
|
|
73
|
-
Object.defineProperty(exports, "useRunWhenReady", { enumerable: true, get: function () { return useRunWhenReady_1.useRunWhenReady; } });
|
|
74
|
-
var withKameleoon_1 = require("./withKameleoon");
|
|
75
|
-
Object.defineProperty(exports, "withKameleoon", { enumerable: true, get: function () { return withKameleoon_1.withKameleoon; } });
|
|
76
|
-
var withFeature_1 = require("./withFeature");
|
|
77
|
-
Object.defineProperty(exports, "withFeature", { enumerable: true, get: function () { return withFeature_1.withFeature; } });
|
|
78
|
-
var withVisitorCode_1 = require("./withVisitorCode");
|
|
79
|
-
Object.defineProperty(exports, "withVisitorCode", { enumerable: true, get: function () { return withVisitorCode_1.withVisitorCode; } });
|
|
80
|
-
var withAsyncVisitorCode_1 = require("./withAsyncVisitorCode");
|
|
81
|
-
Object.defineProperty(exports, "withAsyncVisitorCode", { enumerable: true, get: function () { return withAsyncVisitorCode_1.withAsyncVisitorCode; } });
|
|
82
|
-
var withTriggerExperiment_1 = require("./withTriggerExperiment");
|
|
83
|
-
Object.defineProperty(exports, "withTriggerExperiment", { enumerable: true, get: function () { return withTriggerExperiment_1.withTriggerExperiment; } });
|
|
84
|
-
var withActivateFeature_1 = require("./withActivateFeature");
|
|
85
|
-
Object.defineProperty(exports, "withActivateFeature", { enumerable: true, get: function () { return withActivateFeature_1.withActivateFeature; } });
|
|
86
|
-
var withVariationAssociatedData_1 = require("./withVariationAssociatedData");
|
|
87
|
-
Object.defineProperty(exports, "withVariationAssociatedData", { enumerable: true, get: function () { return withVariationAssociatedData_1.withVariationAssociatedData; } });
|
|
88
|
-
var withRetrieveDataFromRemoteSource_1 = require("./withRetrieveDataFromRemoteSource");
|
|
89
|
-
Object.defineProperty(exports, "withRetrieveDataFromRemoteSource", { enumerable: true, get: function () { return withRetrieveDataFromRemoteSource_1.withRetrieveDataFromRemoteSource; } });
|
|
90
|
-
var withFeatureVariable_1 = require("./withFeatureVariable");
|
|
91
|
-
Object.defineProperty(exports, "withFeatureVariable", { enumerable: true, get: function () { return withFeatureVariable_1.withFeatureVariable; } });
|
|
92
|
-
var withTrackingConversion_1 = require("./withTrackingConversion");
|
|
93
|
-
Object.defineProperty(exports, "withTrackingConversion", { enumerable: true, get: function () { return withTrackingConversion_1.withTrackingConversion; } });
|
|
94
|
-
var withAddData_1 = require("./withAddData");
|
|
95
|
-
Object.defineProperty(exports, "withAddData", { enumerable: true, get: function () { return withAddData_1.withAddData; } });
|
|
96
|
-
var withFlush_1 = require("./withFlush");
|
|
97
|
-
Object.defineProperty(exports, "withFlush", { enumerable: true, get: function () { return withFlush_1.withFlush; } });
|
|
98
|
-
var withBrowser_1 = require("./withBrowser");
|
|
99
|
-
Object.defineProperty(exports, "withBrowser", { enumerable: true, get: function () { return withBrowser_1.withBrowser; } });
|
|
100
|
-
var withDevice_1 = require("./withDevice");
|
|
101
|
-
Object.defineProperty(exports, "withDevice", { enumerable: true, get: function () { return withDevice_1.withDevice; } });
|
|
102
|
-
var withPageView_1 = require("./withPageView");
|
|
103
|
-
Object.defineProperty(exports, "withPageView", { enumerable: true, get: function () { return withPageView_1.withPageView; } });
|
|
104
|
-
var withConversion_1 = require("./withConversion");
|
|
105
|
-
Object.defineProperty(exports, "withConversion", { enumerable: true, get: function () { return withConversion_1.withConversion; } });
|
|
106
|
-
var withCustomData_1 = require("./withCustomData");
|
|
107
|
-
Object.defineProperty(exports, "withCustomData", { enumerable: true, get: function () { return withCustomData_1.withCustomData; } });
|
|
108
|
-
var withRunWhenReady_1 = require("./withRunWhenReady");
|
|
109
|
-
Object.defineProperty(exports, "withRunWhenReady", { enumerable: true, get: function () { return withRunWhenReady_1.withRunWhenReady; } });
|
|
50
|
+
var useFlushData_1 = require("./useFlushData");
|
|
51
|
+
Object.defineProperty(exports, "useFlushData", { enumerable: true, get: function () { return useFlushData_1.useFlushData; } });
|
|
110
52
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,sEAYwC;AAXtC,6GAAA,MAAM,OAAA;AACN,8GAAA,OAAO,OAAA;AACP,+GAAA,QAAQ,OAAA;AAER,iHAAA,UAAU,OAAA;AACV,iHAAA,UAAU,OAAA;AACV,iHAAA,UAAU,OAAA;AACV,kHAAA,WAAW,OAAA;AACX,kHAAA,WAAW,OAAA;AACX,yHAAA,kBAAkB,OAAA;AAClB,0HAAA,mBAAmB,OAAA;AAErB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,yDAG6B;AAF3B,uIAAA,OAAO,OAAqB;AAG9B,qDAAiD;AAAxC,+GAAA,YAAY,OAAA;AACrB,iDAAuE;AAA9D,8GAAA,aAAa,OAAA;AACtB,mDAA0E;AAAjE,gHAAA,cAAc,OAAA;AACvB,qDAA6E;AAApE,kHAAA,eAAe,OAAA;AACxB,iEAGiC;AAF/B,8HAAA,qBAAqB,OAAA;AAGvB,mEAGkC;AAFhC,gIAAA,sBAAsB,OAAA;AAGxB,2EAGsC;AAFpC,wIAAA,0BAA0B,OAAA;AAG5B,+DAGgC;AAF9B,4HAAA,oBAAoB,OAAA;AAGtB,+DAGgC;AAF9B,4HAAA,oBAAoB,OAAA;AAGtB,2DAG8B;AAF5B,wHAAA,kBAAkB,OAAA;AAGpB,2DAG8B;AAF5B,wHAAA,kBAAkB,OAAA;AAGpB,mEAGkC;AAFhC,gIAAA,sBAAsB,OAAA;AAGxB,iDAAuE;AAA9D,8GAAA,aAAa,OAAA;AACtB,2CAA8D;AAArD,wGAAA,UAAU,OAAA;AACnB,+CAAoE;AAA3D,4GAAA,YAAY,OAAA"}
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { KameleoonClient } from '@kameleoon/javascript-sdk-core';
|
|
3
|
-
export interface ICreateClientParams {
|
|
4
|
-
/** Code of the website you want to run experiments on */
|
|
5
|
-
siteCode: string;
|
|
6
|
-
/** Visitor code is an optional parameter, if used it will automatically
|
|
7
|
-
* create custom data to check if visitor is targeted
|
|
8
|
-
*/
|
|
9
|
-
visitorCode?: string;
|
|
10
|
-
/** JSON object filled with configuration parameters */
|
|
11
|
-
options?: SDKConfiguration;
|
|
12
|
-
}
|
|
1
|
+
import { KameleoonCore, SDKConfigurationType } from '@kameleoon/javascript-sdk-core';
|
|
13
2
|
/**
|
|
14
3
|
* Creates an instance of KameleoonClient
|
|
4
|
+
* @param {string} siteCode - client's siteCode defined on Kameleoon platform
|
|
5
|
+
* @param {Partial<SDKConfigurationType> | undefined} configuration - client's configuration
|
|
15
6
|
*/
|
|
16
|
-
export declare function createClient(
|
|
7
|
+
export declare function createClient(siteCode: string, configuration?: Partial<SDKConfigurationType>): KameleoonCore;
|
package/dist/kameleoonClient.js
CHANGED
|
@@ -1,83 +1,29 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.createClient = void 0;
|
|
40
4
|
var javascript_sdk_core_1 = require("@kameleoon/javascript-sdk-core");
|
|
5
|
+
var eventSource_1 = require("./eventSource");
|
|
6
|
+
var storage_1 = require("./storage");
|
|
41
7
|
/**
|
|
42
8
|
* Creates an instance of KameleoonClient
|
|
9
|
+
* @param {string} siteCode - client's siteCode defined on Kameleoon platform
|
|
10
|
+
* @param {Partial<SDKConfigurationType> | undefined} configuration - client's configuration
|
|
43
11
|
*/
|
|
44
|
-
function createClient(
|
|
45
|
-
var siteCode = _a.siteCode, visitorCode = _a.visitorCode, options = _a.options;
|
|
46
|
-
var client = new javascript_sdk_core_1.KameleoonClient(siteCode, options);
|
|
12
|
+
function createClient(siteCode, configuration) {
|
|
47
13
|
var isBrowser = window && window.document;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
if (visitorCode) {
|
|
63
|
-
addTargeting(client, visitorCode);
|
|
64
|
-
return client;
|
|
65
|
-
}
|
|
66
|
-
if (isBrowser) {
|
|
67
|
-
addTargeting(client, client.obtainVisitorCode(''));
|
|
68
|
-
return client;
|
|
69
|
-
}
|
|
70
|
-
var generatedVisitorCode = '';
|
|
71
|
-
client
|
|
72
|
-
.obtainAsyncVisitorCode('')
|
|
73
|
-
.then(function (code) {
|
|
74
|
-
generatedVisitorCode = code;
|
|
75
|
-
})
|
|
76
|
-
.catch(function () {
|
|
77
|
-
generatedVisitorCode = '';
|
|
78
|
-
})
|
|
79
|
-
.finally(function () {
|
|
80
|
-
addTargeting(client, generatedVisitorCode);
|
|
14
|
+
var storage = isBrowser
|
|
15
|
+
? new storage_1.LocalStorageConstructor()
|
|
16
|
+
: new storage_1.NativeStorageConstructor();
|
|
17
|
+
var eventSource = isBrowser
|
|
18
|
+
? new eventSource_1.BrowserEventSourceConstructor()
|
|
19
|
+
: new eventSource_1.NativeEventSourceConstructor();
|
|
20
|
+
var client = new javascript_sdk_core_1.KameleoonCore({
|
|
21
|
+
siteCode: siteCode,
|
|
22
|
+
configuration: configuration,
|
|
23
|
+
internalConfiguration: {
|
|
24
|
+
externalStorage: storage,
|
|
25
|
+
externalEventSource: eventSource,
|
|
26
|
+
},
|
|
81
27
|
});
|
|
82
28
|
return client;
|
|
83
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kameleoonClient.js","sourceRoot":"","sources":["../src/kameleoonClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"kameleoonClient.js","sourceRoot":"","sources":["../src/kameleoonClient.ts"],"names":[],"mappings":";;;AAAA,sEAKwC;AACxC,6CAGuB;AACvB,qCAA8E;AAE9E;;;;GAIG;AACH,SAAgB,YAAY,CAC1B,QAAgB,EAChB,aAA6C;IAE7C,IAAM,SAAS,GAAG,MAAM,IAAI,MAAM,CAAC,QAAQ,CAAC;IAC5C,IAAM,OAAO,GAAgC,SAAS;QACpD,CAAC,CAAC,IAAI,iCAAuB,EAAE;QAC/B,CAAC,CAAC,IAAI,kCAAwB,EAAE,CAAC;IACnC,IAAM,WAAW,GAAoC,SAAS;QAC5D,CAAC,CAAC,IAAI,2CAA6B,EAAE;QACrC,CAAC,CAAC,IAAI,0CAA4B,EAAE,CAAC;IAEvC,IAAM,MAAM,GAAG,IAAI,mCAAa,CAAC;QAC/B,QAAQ,UAAA;QACR,aAAa,eAAA;QACb,qBAAqB,EAAE;YACrB,eAAe,EAAE,OAAO;YACxB,mBAAmB,EAAE,WAAW;SACjC;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAtBD,oCAsBC"}
|