@kameleoon/javascript-sdk-core 0.0.3 → 1.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 +7 -3
- package/dist/campaignConfiguration/campaignConfiguration.d.ts +46 -0
- package/dist/campaignConfiguration/campaignConfiguration.js +217 -0
- package/dist/campaignConfiguration/campaignConfiguration.js.map +1 -0
- package/dist/campaignConfiguration/constants.d.ts +18 -0
- package/dist/campaignConfiguration/constants.js +23 -0
- package/dist/campaignConfiguration/constants.js.map +1 -0
- package/dist/campaignConfiguration/index.d.ts +2 -0
- package/dist/campaignConfiguration/index.js +8 -0
- package/dist/campaignConfiguration/index.js.map +1 -0
- package/dist/campaignConfiguration/types.d.ts +126 -0
- package/dist/campaignConfiguration/types.js +47 -0
- package/dist/campaignConfiguration/types.js.map +1 -0
- package/dist/clientSettings/clientSettings.d.ts +12 -0
- package/dist/clientSettings/clientSettings.js +29 -0
- package/dist/clientSettings/clientSettings.js.map +1 -0
- package/dist/clientSettings/index.d.ts +2 -0
- package/dist/clientSettings/index.js +6 -0
- package/dist/clientSettings/index.js.map +1 -0
- package/dist/clientSettings/types.d.ts +6 -0
- package/dist/{interfaces/interfaces.js → clientSettings/types.js} +1 -1
- package/dist/clientSettings/types.js.map +1 -0
- package/dist/constants.d.ts +10 -16
- package/dist/constants.js +13 -20
- package/dist/constants.js.map +1 -1
- package/dist/eventSource/constants.d.ts +1 -0
- package/dist/eventSource/constants.js +5 -0
- package/dist/eventSource/constants.js.map +1 -0
- package/dist/eventSource/externalEventSource.d.ts +12 -0
- package/dist/eventSource/externalEventSource.js +26 -0
- package/dist/eventSource/externalEventSource.js.map +1 -0
- package/dist/eventSource/index.d.ts +3 -0
- package/dist/eventSource/index.js +8 -0
- package/dist/eventSource/index.js.map +1 -0
- package/dist/eventSource/types.d.ts +47 -0
- package/dist/eventSource/types.js +3 -0
- package/dist/eventSource/types.js.map +1 -0
- package/dist/hasher/constants.d.ts +1 -0
- package/dist/hasher/constants.js +5 -0
- package/dist/hasher/constants.js.map +1 -0
- package/dist/hasher/hasher.d.ts +6 -0
- package/dist/hasher/hasher.js +34 -0
- package/dist/hasher/hasher.js.map +1 -0
- package/dist/hasher/index.d.ts +1 -0
- package/dist/hasher/index.js +6 -0
- package/dist/hasher/index.js.map +1 -0
- package/dist/hasher/types.d.ts +12 -0
- package/dist/hasher/types.js +3 -0
- package/dist/hasher/types.js.map +1 -0
- package/dist/index.d.ts +10 -3
- package/dist/index.js +25 -7
- package/dist/index.js.map +1 -1
- package/dist/kameleoonClient.d.ts +189 -100
- package/dist/kameleoonClient.js +238 -701
- package/dist/kameleoonClient.js.map +1 -1
- package/dist/kameleoonData/browser.d.ts +21 -0
- package/dist/kameleoonData/browser.js +41 -0
- package/dist/kameleoonData/browser.js.map +1 -0
- package/dist/kameleoonData/constants.d.ts +1 -0
- package/dist/kameleoonData/constants.js +5 -0
- package/dist/kameleoonData/constants.js.map +1 -0
- package/dist/kameleoonData/conversion.d.ts +23 -0
- package/dist/kameleoonData/conversion.js +49 -0
- package/dist/kameleoonData/conversion.js.map +1 -0
- package/dist/kameleoonData/customData.d.ts +33 -0
- package/dist/kameleoonData/customData.js +68 -0
- package/dist/kameleoonData/customData.js.map +1 -0
- package/dist/kameleoonData/device.d.ts +21 -0
- package/dist/kameleoonData/device.js +41 -0
- package/dist/kameleoonData/device.js.map +1 -0
- package/dist/kameleoonData/index.d.ts +7 -0
- package/dist/kameleoonData/index.js +20 -0
- package/dist/kameleoonData/index.js.map +1 -0
- package/dist/kameleoonData/nonce.d.ts +5 -0
- package/dist/kameleoonData/nonce.js +20 -0
- package/dist/kameleoonData/nonce.js.map +1 -0
- package/dist/kameleoonData/pageView.d.ts +24 -0
- package/dist/kameleoonData/pageView.js +54 -0
- package/dist/kameleoonData/pageView.js.map +1 -0
- package/dist/kameleoonData/types.d.ts +100 -0
- package/dist/kameleoonData/types.js +36 -0
- package/dist/kameleoonData/types.js.map +1 -0
- package/dist/kameleoonData/userAgent.d.ts +18 -0
- package/dist/kameleoonData/userAgent.js +33 -0
- package/dist/kameleoonData/userAgent.js.map +1 -0
- package/dist/kameleoonError/constants.d.ts +22 -0
- package/dist/kameleoonError/constants.js +25 -0
- package/dist/kameleoonError/constants.js.map +1 -0
- package/dist/kameleoonError/helpers.d.ts +1 -0
- package/dist/kameleoonError/helpers.js +8 -0
- package/dist/kameleoonError/helpers.js.map +1 -0
- package/dist/kameleoonError/index.d.ts +3 -0
- package/dist/kameleoonError/index.js +10 -0
- package/dist/kameleoonError/index.js.map +1 -0
- package/dist/kameleoonError/kameleoonError.d.ts +24 -0
- package/dist/kameleoonError/kameleoonError.js +64 -0
- package/dist/kameleoonError/kameleoonError.js.map +1 -0
- package/dist/kameleoonError/types.d.ts +20 -0
- package/dist/kameleoonError/types.js +25 -0
- package/dist/kameleoonError/types.js.map +1 -0
- package/dist/kameleoonUtils.d.ts +11 -10
- package/dist/kameleoonUtils.js +42 -128
- package/dist/kameleoonUtils.js.map +1 -1
- package/dist/requester/constants.d.ts +15 -0
- package/dist/requester/constants.js +53 -0
- package/dist/requester/constants.js.map +1 -0
- package/dist/requester/index.d.ts +3 -0
- package/dist/requester/index.js +10 -0
- package/dist/requester/index.js.map +1 -0
- package/dist/requester/requester.d.ts +23 -0
- package/dist/requester/requester.js +121 -0
- package/dist/requester/requester.js.map +1 -0
- package/dist/requester/types.d.ts +43 -0
- package/dist/requester/types.js +39 -0
- package/dist/requester/types.js.map +1 -0
- package/dist/storage/constants.d.ts +9 -0
- package/dist/storage/constants.js +14 -0
- package/dist/storage/constants.js.map +1 -0
- package/dist/storage/externalStorage.d.ts +11 -0
- package/dist/storage/externalStorage.js +34 -0
- package/dist/storage/externalStorage.js.map +1 -0
- package/dist/storage/index.d.ts +3 -0
- package/dist/storage/index.js +8 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/types.d.ts +52 -11
- package/dist/targeting/conditions/conditionFactory.d.ts +6 -0
- package/dist/targeting/conditions/conditionFactory.js +26 -0
- package/dist/targeting/conditions/conditionFactory.js.map +1 -0
- package/dist/targeting/conditions/customDataCondition.d.ts +16 -0
- package/dist/targeting/conditions/customDataCondition.js +99 -0
- package/dist/targeting/conditions/customDataCondition.js.map +1 -0
- package/dist/targeting/conditions/exclusiveExperimentCondition.d.ts +9 -0
- package/dist/targeting/conditions/exclusiveExperimentCondition.js +21 -0
- package/dist/targeting/conditions/exclusiveExperimentCondition.js.map +1 -0
- package/dist/targeting/conditions/index.d.ts +5 -0
- package/dist/targeting/conditions/index.js +12 -0
- package/dist/targeting/conditions/index.js.map +1 -0
- package/dist/targeting/conditions/targetExperimentCondition.d.ts +13 -0
- package/dist/targeting/conditions/targetExperimentCondition.js +42 -0
- package/dist/targeting/conditions/targetExperimentCondition.js.map +1 -0
- package/dist/targeting/conditions/types.d.ts +22 -11
- package/dist/targeting/index.d.ts +3 -0
- package/dist/targeting/index.js +15 -0
- package/dist/targeting/index.js.map +1 -0
- package/dist/targeting/targetingNode.d.ts +21 -0
- package/dist/targeting/targetingNode.js +40 -0
- package/dist/targeting/targetingNode.js.map +1 -0
- package/dist/targeting/targetingTree.d.ts +16 -8
- package/dist/targeting/targetingTree.js +112 -10
- package/dist/targeting/targetingTree.js.map +1 -1
- package/dist/targeting/types.d.ts +127 -0
- package/dist/targeting/types.js +93 -0
- package/dist/targeting/types.js.map +1 -0
- package/dist/types.d.ts +135 -5
- package/dist/types.js +28 -0
- package/dist/types.js.map +1 -1
- package/dist/utilities/constants.d.ts +1 -0
- package/dist/utilities/constants.js +5 -0
- package/dist/utilities/constants.js.map +1 -0
- package/dist/utilities/index.d.ts +1 -0
- package/dist/utilities/index.js +6 -0
- package/dist/utilities/index.js.map +1 -0
- package/dist/utilities/types.d.ts +18 -0
- package/dist/utilities/types.js +3 -0
- package/dist/utilities/types.js.map +1 -0
- package/dist/utilities/utilities.d.ts +13 -0
- package/dist/utilities/utilities.js +119 -0
- package/dist/utilities/utilities.js.map +1 -0
- package/dist/variationConfiguration/index.d.ts +2 -0
- package/dist/variationConfiguration/index.js +6 -0
- package/dist/variationConfiguration/index.js.map +1 -0
- package/dist/variationConfiguration/types.d.ts +25 -0
- package/dist/variationConfiguration/types.js +3 -0
- package/dist/variationConfiguration/types.js.map +1 -0
- package/dist/variationConfiguration/variation.d.ts +13 -0
- package/dist/variationConfiguration/variation.js +38 -0
- package/dist/variationConfiguration/variation.js.map +1 -0
- package/dist/variationConfiguration/variationConfiguration.d.ts +36 -0
- package/dist/variationConfiguration/variationConfiguration.js +248 -0
- package/dist/variationConfiguration/variationConfiguration.js.map +1 -0
- package/package.json +19 -9
- package/dist/configurations/configuration.d.ts +0 -15
- package/dist/configurations/configuration.js +0 -31
- package/dist/configurations/configuration.js.map +0 -1
- package/dist/configurations/experiment.d.ts +0 -13
- package/dist/configurations/experiment.js +0 -54
- package/dist/configurations/experiment.js.map +0 -1
- package/dist/configurations/featureFlag.d.ts +0 -23
- package/dist/configurations/featureFlag.js +0 -105
- package/dist/configurations/featureFlag.js.map +0 -1
- package/dist/configurations/variation.d.ts +0 -15
- package/dist/configurations/variation.js +0 -14
- package/dist/configurations/variation.js.map +0 -1
- package/dist/data.d.ts +0 -67
- package/dist/data.js +0 -127
- package/dist/data.js.map +0 -1
- package/dist/exceptions/credentialsNotFound.d.ts +0 -6
- package/dist/exceptions/credentialsNotFound.js +0 -29
- package/dist/exceptions/credentialsNotFound.js.map +0 -1
- package/dist/exceptions/experimentConfigurationNotFound.d.ts +0 -6
- package/dist/exceptions/experimentConfigurationNotFound.js +0 -29
- package/dist/exceptions/experimentConfigurationNotFound.js.map +0 -1
- package/dist/exceptions/featureConfigurationNotFound.d.ts +0 -6
- package/dist/exceptions/featureConfigurationNotFound.js +0 -29
- package/dist/exceptions/featureConfigurationNotFound.js.map +0 -1
- package/dist/exceptions/notActivated.d.ts +0 -6
- package/dist/exceptions/notActivated.js +0 -29
- package/dist/exceptions/notActivated.js.map +0 -1
- package/dist/exceptions/notTargeted.d.ts +0 -6
- package/dist/exceptions/notTargeted.js +0 -29
- package/dist/exceptions/notTargeted.js.map +0 -1
- package/dist/exceptions/siteCodeDisabled.d.ts +0 -5
- package/dist/exceptions/siteCodeDisabled.js +0 -30
- package/dist/exceptions/siteCodeDisabled.js.map +0 -1
- package/dist/exceptions/variationConfigurationNotFound.d.ts +0 -6
- package/dist/exceptions/variationConfigurationNotFound.js +0 -29
- package/dist/exceptions/variationConfigurationNotFound.js.map +0 -1
- package/dist/exceptions/visitorCodeNotValid.d.ts +0 -5
- package/dist/exceptions/visitorCodeNotValid.js +0 -30
- package/dist/exceptions/visitorCodeNotValid.js.map +0 -1
- package/dist/interfaces/interfaces.d.ts +0 -81
- package/dist/interfaces/interfaces.js.map +0 -1
- package/dist/nonce.d.ts +0 -1
- package/dist/nonce.js +0 -16
- package/dist/nonce.js.map +0 -1
- package/dist/realTimeConfigurationService.d.ts +0 -12
- package/dist/realTimeConfigurationService.js +0 -24
- package/dist/realTimeConfigurationService.js.map +0 -1
- package/dist/storage/variationStorage.d.ts +0 -11
- package/dist/storage/variationStorage.js +0 -159
- package/dist/storage/variationStorage.js.map +0 -1
- package/dist/storage/visitorVariation.d.ts +0 -9
- package/dist/storage/visitorVariation.js +0 -22
- package/dist/storage/visitorVariation.js.map +0 -1
- package/dist/targeting/conditions/customDatum.d.ts +0 -12
- package/dist/targeting/conditions/customDatum.js +0 -129
- package/dist/targeting/conditions/customDatum.js.map +0 -1
- package/dist/targeting/conditions/exclusiveExperiment.d.ts +0 -9
- package/dist/targeting/conditions/exclusiveExperiment.js +0 -45
- package/dist/targeting/conditions/exclusiveExperiment.js.map +0 -1
- package/dist/targeting/conditions/targetExperiment.d.ts +0 -14
- package/dist/targeting/conditions/targetExperiment.js +0 -57
- package/dist/targeting/conditions/targetExperiment.js.map +0 -1
- package/dist/targeting/targetingCondition.d.ts +0 -7
- package/dist/targeting/targetingCondition.js +0 -9
- package/dist/targeting/targetingCondition.js.map +0 -1
- package/dist/targeting/targetingConditionsFactory.d.ts +0 -7
- package/dist/targeting/targetingConditionsFactory.js +0 -30
- package/dist/targeting/targetingConditionsFactory.js.map +0 -1
- package/dist/targeting/targetingData.d.ts +0 -7
- package/dist/targeting/targetingData.js +0 -11
- package/dist/targeting/targetingData.js.map +0 -1
- package/dist/targeting/targetingEngine.d.ts +0 -6
- package/dist/targeting/targetingEngine.js +0 -130
- package/dist/targeting/targetingEngine.js.map +0 -1
- package/dist/targeting/targetingSegment.d.ts +0 -5
- package/dist/targeting/targetingSegment.js +0 -9
- package/dist/targeting/targetingSegment.js.map +0 -1
- package/dist/targeting/targetingTreeBuilder.d.ts +0 -8
- package/dist/targeting/targetingTreeBuilder.js +0 -127
- package/dist/targeting/targetingTreeBuilder.js.map +0 -1
|
@@ -1,102 +1,191 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
import { JSONType } from './campaignConfiguration';
|
|
2
|
+
import { KameleoonDataType } from './kameleoonData';
|
|
3
|
+
import { TrackConversionParamsType, ExperimentType, FeatureFlagType, GetFeatureFlagVariableParamsType, FeatureVariableResultType, SDKCoreParameters } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* @interface an interface of KameleoonClient instance
|
|
6
|
+
* */
|
|
7
|
+
export interface IKameleoonClient {
|
|
8
|
+
/**
|
|
9
|
+
* @method initialize - an asynchronous method for KameleoonClient initialization by fetching Kameleoon SDK related data from server or by retrieving data from local source if data is up-to-date or update interval has not been reached
|
|
10
|
+
* @returns {Promise<boolean>} Promise resolved into boolean field indicating success or fail
|
|
11
|
+
* @throws `KameleoonError` with one of the following `type` s:
|
|
12
|
+
*
|
|
13
|
+
* - `KameleoonException.StorageWrite` Couldn't update storage data
|
|
14
|
+
* - `KameleoonException.ClientConfiguration` Couldn't retrieve client configuration from Kameleoon Api
|
|
15
|
+
* */
|
|
16
|
+
initialize: () => Promise<boolean>;
|
|
17
|
+
/**
|
|
18
|
+
* @method addData - method for adding targeting data to the storage so that other methods could decide whether the current visitor is targeted or not. Note: userAgent data will not be stored in storage like other data, and it will be sent with every tracking request for bot filtration.
|
|
19
|
+
* @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length
|
|
20
|
+
* @param {KameleoonDataType[]} kameleoonData - number of instances of any type of `KameleoonData`, can be added solely in array or as a sequential arguments
|
|
21
|
+
* @returns {void}
|
|
22
|
+
* @throws `KameleoonError` with one of the following `type` s:
|
|
23
|
+
*
|
|
24
|
+
* - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded
|
|
25
|
+
* - `KameleoonException.StorageWrite` Couldn't update storage data
|
|
26
|
+
* - `KameleoonException.Initialization` Couldn't update storage data
|
|
27
|
+
* */
|
|
28
|
+
addData: (visitorCode: string, ...data: KameleoonDataType[]) => void;
|
|
29
|
+
/**
|
|
30
|
+
* @method triggerExperiment - triggers experiment by assigning the variation to the user with `visitorCode`, if the variation is already assigned just returns it's id. Note: returned id `0` indicates default variation. At the same time executes `flushData` without sending extra request.
|
|
31
|
+
* @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length
|
|
32
|
+
* @param {number} experimentId - id of experiment running for the current visitor
|
|
33
|
+
* @returns {number} associated variationId which is successfully searched/assigned
|
|
34
|
+
* @throws `KameleoonError` with one of the following `type` s:
|
|
35
|
+
*
|
|
36
|
+
* - `KameleoonException.ExperimentConfigurationNotFound` No configuration found for provided `experimentId`
|
|
37
|
+
* - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded
|
|
38
|
+
* - `KameleoonException.StorageRead` Couldn't find associated experiment by provided `experimentId` and `visitorCode` inside the storage
|
|
39
|
+
* - `KameleoonException.NotTargeted` Current visitor is not targeted
|
|
40
|
+
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
41
|
+
* */
|
|
37
42
|
triggerExperiment: (visitorCode: string, experimentId: number) => number;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
43
|
+
/**
|
|
44
|
+
* @method trackConversion - creates and adds `Conversion` data to the visitor with specified parameters and executes `flushData`. Note: it's a helper method for the quick and convenient conversion tracking, however creating and adding `Conversion` manually allows more flexible `Conversion` with `negative` parameter
|
|
45
|
+
* @param {TrackConversionParamsType} conversionParameters - `visitorCode`, `goalId` and `revenue` parameters for data tracking
|
|
46
|
+
* @returns {void}
|
|
47
|
+
* @throws `KameleoonError` with one of the following `type` s:
|
|
48
|
+
*
|
|
49
|
+
* - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded
|
|
50
|
+
* - `KameleoonException.StorageWrite` Couldn't update storage data
|
|
51
|
+
* */
|
|
52
|
+
trackConversion: ({ visitorCode, goalId, revenue, }: TrackConversionParamsType) => void;
|
|
53
|
+
/**
|
|
54
|
+
* @method flushData - takes visitor associated kameleoon data and sends the data tracking request with collected data
|
|
55
|
+
* sent data is removed from `KameleoonClient` instance but not from the storage for correct targeting checks
|
|
56
|
+
* @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length
|
|
57
|
+
* @returns {void}
|
|
58
|
+
* @throws `KameleoonError` with one of the following `type` s:
|
|
59
|
+
*
|
|
60
|
+
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
61
|
+
* */
|
|
62
|
+
flushData: (visitorCode: string) => void;
|
|
63
|
+
/**
|
|
64
|
+
* @method getExperiments - returns a list of experiments stored in the client configuration
|
|
65
|
+
* @returns {ExperimentType[]} a list of all experiments items with `id` and `name` fields
|
|
66
|
+
* @throws `KameleoonError` with one of the following `type` s:
|
|
67
|
+
*
|
|
68
|
+
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
69
|
+
* */
|
|
70
|
+
getExperiments: () => ExperimentType[];
|
|
71
|
+
/**
|
|
72
|
+
* @method getVisitorExperiments - returns a list of experiments that the visitor with `visitorCode` is targeted by and that are *active* for the visitor (visitor will have one of the variations allocated if the experiment will be triggered).
|
|
73
|
+
* @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length
|
|
74
|
+
* @param {boolean | undefined} isAllocated - boolean value indicating that only experiments *allocated* for visitor will be returned. Default value is `true`
|
|
75
|
+
* @returns {ExperimentType[]} a list of all experiments items with `id` and `name` fields
|
|
76
|
+
* @throws `KameleoonError` with one of the following `type` s:
|
|
77
|
+
*
|
|
78
|
+
* - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
|
|
79
|
+
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
80
|
+
* */
|
|
81
|
+
getVisitorExperiments: (visitorCode: string, isAllocated?: boolean) => ExperimentType[];
|
|
82
|
+
/**
|
|
83
|
+
* @method getFeatureFlags - returns a list of feature flags stored in the client configuration
|
|
84
|
+
* @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields
|
|
85
|
+
* @throws `KameleoonError` with one of the following `type` s:
|
|
86
|
+
*
|
|
87
|
+
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
88
|
+
* */
|
|
89
|
+
getFeatureFlags: () => FeatureFlagType[];
|
|
90
|
+
/**
|
|
91
|
+
* @method getVisitorFeatureFlags - returns a list of feature flags that the visitor with `visitorCode` that is targeted by and that are *active* for the visitor (visitor will have one of the variations allocated).
|
|
92
|
+
* @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length
|
|
93
|
+
* @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields
|
|
94
|
+
* @throws `KameleoonError` with one of the following `type` s:
|
|
95
|
+
*
|
|
96
|
+
* - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
|
|
97
|
+
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
98
|
+
* - `KameleoonException.NotTargeted` - Current visitor is not targeted
|
|
99
|
+
* */
|
|
100
|
+
getVisitorFeatureFlags: (visitorCode: string) => FeatureFlagType[];
|
|
101
|
+
/**
|
|
102
|
+
* @method isFeatureFlagActive - returns a boolean indicating whether the visitor with `visitorCode` has `featureKey` active for him, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request if the feature rollout rule was of type of `Experimentation`
|
|
103
|
+
* @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length
|
|
104
|
+
* @param {string} featureKey - a unique key for feature flag
|
|
105
|
+
* @returns {boolean} a boolean indicator of whether the feature flag with `featureKey` is active for visitor with `visitorCode`
|
|
106
|
+
* @throws `KameleoonError` with one of the following `type` s:
|
|
107
|
+
*
|
|
108
|
+
* - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
|
|
109
|
+
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
110
|
+
* - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`
|
|
111
|
+
* - `KameleoonException.DataInconsistency` - Allocated variation was found but there is no feature flag with according `featureKey`.
|
|
112
|
+
* - `KameleoonException.NotTargeted` - Current visitor is not targeted
|
|
113
|
+
* */
|
|
114
|
+
isFeatureFlagActive: (visitorCode: string, featureKey: string) => boolean;
|
|
115
|
+
/**
|
|
116
|
+
* @method getFeatureFlagVariationKey - returns variation key for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request if the feature rollout rule was of type of `Experimentation`
|
|
117
|
+
* @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length
|
|
118
|
+
* @param {string} featureKey - a unique key for feature flag
|
|
119
|
+
* @returns {string} a string containing variable key for the allocated feature flag variation for the provided visitor
|
|
120
|
+
* @throws `KameleoonError` with one of the following `type` s:
|
|
121
|
+
*
|
|
122
|
+
* - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
|
|
123
|
+
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
124
|
+
* - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`
|
|
125
|
+
* - `KameleoonException.NotTargeted` - Current visitor is not targeted
|
|
126
|
+
* */
|
|
127
|
+
getFeatureFlagVariationKey: (visitorCode: string, featureKey: string) => string;
|
|
128
|
+
/**
|
|
129
|
+
* @method getFeatureFlagVariable - returns a variable for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request if the feature rollout rule was of type of `Experimentation`
|
|
130
|
+
* @param {GetFeatureFlagVariableParamsType} parameters - an object with parameters of a type `GetFeatureFlagVariableParamsType`, see the type for details.
|
|
131
|
+
* @returns {FeatureVariableResultType} a variable object containing `type` and `value` fields, `type` can be checked against `FeatureVariableType` enum, if the `type` is `FeatureVariableType.BOOLEAN` then the `value` type will be `boolean` and so on.
|
|
132
|
+
* @throws `KameleoonError` with one of the following `type` s:
|
|
133
|
+
*
|
|
134
|
+
* - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
|
|
135
|
+
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
136
|
+
* - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`
|
|
137
|
+
* - `KameleoonException.NotTargeted` - Current visitor is not targeted
|
|
138
|
+
* - `KameleoonException.JSONParse` - Couldn't pass JSON value
|
|
139
|
+
* - `KameleoonException.NumberParse` - Couldn't pass Number value
|
|
140
|
+
* */
|
|
141
|
+
getFeatureFlagVariable: ({ visitorCode, featureKey, variableKey, }: GetFeatureFlagVariableParamsType) => FeatureVariableResultType;
|
|
142
|
+
/**
|
|
143
|
+
* @method getRemoteData - returns a data which is stored for specified siteCode on a remote Kameleoon server.
|
|
144
|
+
* @param {string} key - unique key that the data you try to get is associated with.
|
|
145
|
+
* @returns {JSONType} - promise with retrieving data for specific key.
|
|
146
|
+
* @throws `KameleoonError` with one of the following `type` s:
|
|
147
|
+
*
|
|
148
|
+
* - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server
|
|
149
|
+
* */
|
|
150
|
+
getRemoteData: (key: string) => Promise<JSONType>;
|
|
151
|
+
/**
|
|
152
|
+
* @method onConfigurationUpdate - fires a callback on client configuration update. Note: this method only works for server sent events of real time update.
|
|
153
|
+
* @param {() => void} callback - callback function with no parameters that will be called upon configuration update
|
|
154
|
+
* @returns {void}
|
|
155
|
+
* @throws `KameleoonError` with one of the following `type` s:
|
|
156
|
+
*
|
|
157
|
+
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
158
|
+
* */
|
|
159
|
+
onConfigurationUpdate: (callback: () => void) => void;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* @class
|
|
163
|
+
* KameleoonClient - a class for creating kameleoon client instance
|
|
164
|
+
* for communicating with Kameleoon JavaScript SDK Core, when new instance is created
|
|
165
|
+
* */
|
|
166
|
+
export declare class KameleoonClient implements IKameleoonClient {
|
|
167
|
+
private internalConfiguration;
|
|
168
|
+
private variationConfiguration?;
|
|
169
|
+
private campaignConfiguration?;
|
|
170
|
+
private settings;
|
|
171
|
+
private requester;
|
|
172
|
+
/**
|
|
173
|
+
* @param {SDKCoreParameters} sdkCoreParameters - parameters for initializing sdk core
|
|
174
|
+
*/
|
|
175
|
+
constructor({ siteCode, configuration, internalConfiguration, }: SDKCoreParameters);
|
|
176
|
+
initialize(): Promise<boolean>;
|
|
177
|
+
addData(visitorCode: string, ...data: KameleoonDataType[]): void;
|
|
178
|
+
triggerExperiment(visitorCode: string, experimentId: number): number;
|
|
179
|
+
trackConversion({ visitorCode, goalId, revenue, }: TrackConversionParamsType): void;
|
|
180
|
+
flushData(visitorCode: string): void;
|
|
181
|
+
getExperiments(): ExperimentType[];
|
|
182
|
+
getVisitorExperiments(visitorCode: string, isActive?: boolean): ExperimentType[];
|
|
183
|
+
getFeatureFlags(): FeatureFlagType[];
|
|
184
|
+
getVisitorFeatureFlags(visitorCode: string): FeatureFlagType[];
|
|
185
|
+
getFeatureFlagVariationKey(visitorCode: string, featureKey: string): string;
|
|
186
|
+
getFeatureFlagVariable({ visitorCode, featureKey, variableKey, }: GetFeatureFlagVariableParamsType): FeatureVariableResultType;
|
|
187
|
+
isFeatureFlagActive(visitorCode: string, featureKey: string): boolean;
|
|
188
|
+
getRemoteData(key: string): Promise<JSONType>;
|
|
189
|
+
onConfigurationUpdate(callback: () => void): void;
|
|
190
|
+
private _getFeatureFlagVariation;
|
|
92
191
|
}
|
|
93
|
-
declare const KameleoonException: {
|
|
94
|
-
ExperimentConfigurationNotFound: typeof ExperimentConfigurationNotFound;
|
|
95
|
-
FeatureConfigurationNotFound: typeof FeatureConfigurationNotFound;
|
|
96
|
-
VariationConfigurationNotFound: typeof VariationConfigurationNotFound;
|
|
97
|
-
NotTargeted: typeof NotTargeted;
|
|
98
|
-
NotActivated: typeof NotActivated;
|
|
99
|
-
CredentialsNotFound: typeof CredentialsNotFound;
|
|
100
|
-
};
|
|
101
|
-
export { KameleoonClient };
|
|
102
|
-
export { KameleoonException };
|