@kameleoon/javascript-sdk-core 2.9.1 → 2.10.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/package.json +1 -1
- package/dist/cacheManager/cacheManager.d.ts +0 -38
- package/dist/cacheManager/cacheManager.js +0 -12
- package/dist/cacheManager/cacheManager.js.map +0 -1
- package/dist/cacheManager/index.d.ts +0 -2
- package/dist/cacheManager/index.js +0 -2
- package/dist/cacheManager/index.js.map +0 -1
- package/dist/cacheManager/types.d.ts +0 -14
- package/dist/cacheManager/types.js +0 -2
- package/dist/cacheManager/types.js.map +0 -1
- package/dist/campaignConfiguration/campaignConfiguration.d.ts +0 -71
- package/dist/campaignConfiguration/campaignConfiguration.js +0 -24
- package/dist/campaignConfiguration/campaignConfiguration.js.map +0 -1
- package/dist/campaignConfiguration/constants.d.ts +0 -6
- package/dist/campaignConfiguration/constants.js +0 -4
- package/dist/campaignConfiguration/constants.js.map +0 -1
- package/dist/campaignConfiguration/index.d.ts +0 -3
- package/dist/campaignConfiguration/index.js +0 -2
- package/dist/campaignConfiguration/index.js.map +0 -1
- package/dist/campaignConfiguration/types.d.ts +0 -155
- package/dist/campaignConfiguration/types.js +0 -2
- package/dist/campaignConfiguration/types.js.map +0 -1
- package/dist/clientSettings/clientSettings.d.ts +0 -12
- package/dist/clientSettings/clientSettings.js +0 -2
- package/dist/clientSettings/clientSettings.js.map +0 -1
- package/dist/clientSettings/index.d.ts +0 -2
- package/dist/clientSettings/index.js +0 -2
- package/dist/clientSettings/index.js.map +0 -1
- package/dist/clientSettings/types.d.ts +0 -6
- package/dist/clientSettings/types.js +0 -2
- package/dist/clientSettings/types.js.map +0 -1
- package/dist/constants.d.ts +0 -32
- package/dist/constants.js +0 -5
- package/dist/constants.js.map +0 -1
- package/dist/eventSource/constants.d.ts +0 -1
- package/dist/eventSource/constants.js +0 -2
- package/dist/eventSource/constants.js.map +0 -1
- package/dist/eventSource/externalEventSource.d.ts +0 -12
- package/dist/eventSource/externalEventSource.js +0 -2
- package/dist/eventSource/externalEventSource.js.map +0 -1
- package/dist/eventSource/index.d.ts +0 -3
- package/dist/eventSource/index.js +0 -2
- package/dist/eventSource/index.js.map +0 -1
- package/dist/eventSource/types.d.ts +0 -47
- package/dist/eventSource/types.js +0 -2
- package/dist/eventSource/types.js.map +0 -1
- package/dist/hasher/hasher.d.ts +0 -6
- package/dist/hasher/hasher.js +0 -7
- package/dist/hasher/hasher.js.map +0 -1
- package/dist/hasher/index.d.ts +0 -1
- package/dist/hasher/index.js +0 -2
- package/dist/hasher/index.js.map +0 -1
- package/dist/hasher/types.d.ts +0 -12
- package/dist/hasher/types.js +0 -2
- package/dist/hasher/types.js.map +0 -1
- package/dist/index.d.ts +0 -12
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/dist/kameleoonClient.d.ts +0 -253
- package/dist/kameleoonClient.js +0 -19
- package/dist/kameleoonClient.js.map +0 -1
- package/dist/kameleoonData/browser.d.ts +0 -26
- package/dist/kameleoonData/browser.js +0 -18
- package/dist/kameleoonData/browser.js.map +0 -1
- package/dist/kameleoonData/conversion.d.ts +0 -23
- package/dist/kameleoonData/conversion.js +0 -14
- package/dist/kameleoonData/conversion.js.map +0 -1
- package/dist/kameleoonData/customData.d.ts +0 -33
- package/dist/kameleoonData/customData.js +0 -25
- package/dist/kameleoonData/customData.js.map +0 -1
- package/dist/kameleoonData/device.d.ts +0 -21
- package/dist/kameleoonData/device.js +0 -14
- package/dist/kameleoonData/device.js.map +0 -1
- package/dist/kameleoonData/index.d.ts +0 -7
- package/dist/kameleoonData/index.js +0 -2
- package/dist/kameleoonData/index.js.map +0 -1
- package/dist/kameleoonData/pageView.d.ts +0 -23
- package/dist/kameleoonData/pageView.js +0 -14
- package/dist/kameleoonData/pageView.js.map +0 -1
- package/dist/kameleoonData/types.d.ts +0 -117
- package/dist/kameleoonData/types.js +0 -15
- package/dist/kameleoonData/types.js.map +0 -1
- package/dist/kameleoonData/userAgent.d.ts +0 -18
- package/dist/kameleoonData/userAgent.js +0 -9
- package/dist/kameleoonData/userAgent.js.map +0 -1
- package/dist/kameleoonError/constants.d.ts +0 -27
- package/dist/kameleoonError/constants.js +0 -2
- package/dist/kameleoonError/constants.js.map +0 -1
- package/dist/kameleoonError/helpers.d.ts +0 -1
- package/dist/kameleoonError/helpers.js +0 -2
- package/dist/kameleoonError/helpers.js.map +0 -1
- package/dist/kameleoonError/index.d.ts +0 -3
- package/dist/kameleoonError/index.js +0 -2
- package/dist/kameleoonError/index.js.map +0 -1
- package/dist/kameleoonError/kameleoonError.d.ts +0 -25
- package/dist/kameleoonError/kameleoonError.js +0 -5
- package/dist/kameleoonError/kameleoonError.js.map +0 -1
- package/dist/kameleoonError/types.d.ts +0 -25
- package/dist/kameleoonError/types.js +0 -2
- package/dist/kameleoonError/types.js.map +0 -1
- package/dist/kameleoonUtils.d.ts +0 -13
- package/dist/kameleoonUtils.js +0 -5
- package/dist/kameleoonUtils.js.map +0 -1
- package/dist/requester/constants.d.ts +0 -17
- package/dist/requester/constants.js +0 -2
- package/dist/requester/constants.js.map +0 -1
- package/dist/requester/index.d.ts +0 -3
- package/dist/requester/index.js +0 -2
- package/dist/requester/index.js.map +0 -1
- package/dist/requester/requester.d.ts +0 -23
- package/dist/requester/requester.js +0 -2
- package/dist/requester/requester.js.map +0 -1
- package/dist/requester/types.d.ts +0 -100
- package/dist/requester/types.js +0 -2
- package/dist/requester/types.js.map +0 -1
- package/dist/storage/constants.d.ts +0 -10
- package/dist/storage/constants.js +0 -5
- package/dist/storage/constants.js.map +0 -1
- package/dist/storage/index.d.ts +0 -2
- package/dist/storage/index.js +0 -2
- package/dist/storage/index.js.map +0 -1
- package/dist/storage/types.d.ts +0 -68
- package/dist/storage/types.js +0 -2
- package/dist/storage/types.js.map +0 -1
- package/dist/targeting/conditions/browserCondition.d.ts +0 -13
- package/dist/targeting/conditions/browserCondition.js +0 -2
- package/dist/targeting/conditions/browserCondition.js.map +0 -1
- package/dist/targeting/conditions/conditionFactory.d.ts +0 -6
- package/dist/targeting/conditions/conditionFactory.js +0 -2
- package/dist/targeting/conditions/conditionFactory.js.map +0 -1
- package/dist/targeting/conditions/conversionCondition.d.ts +0 -10
- package/dist/targeting/conditions/conversionCondition.js +0 -4
- package/dist/targeting/conditions/conversionCondition.js.map +0 -1
- package/dist/targeting/conditions/customDataCondition.d.ts +0 -14
- package/dist/targeting/conditions/customDataCondition.js +0 -8
- package/dist/targeting/conditions/customDataCondition.js.map +0 -1
- package/dist/targeting/conditions/deviceCondition.d.ts +0 -9
- package/dist/targeting/conditions/deviceCondition.js +0 -2
- package/dist/targeting/conditions/deviceCondition.js.map +0 -1
- package/dist/targeting/conditions/exclusiveExperimentCondition.d.ts +0 -7
- package/dist/targeting/conditions/exclusiveExperimentCondition.js +0 -2
- package/dist/targeting/conditions/exclusiveExperimentCondition.js.map +0 -1
- package/dist/targeting/conditions/index.d.ts +0 -12
- package/dist/targeting/conditions/index.js +0 -2
- package/dist/targeting/conditions/index.js.map +0 -1
- package/dist/targeting/conditions/pageTitleCondition.d.ts +0 -11
- package/dist/targeting/conditions/pageTitleCondition.js +0 -2
- package/dist/targeting/conditions/pageTitleCondition.js.map +0 -1
- package/dist/targeting/conditions/pageUrlCondition.d.ts +0 -11
- package/dist/targeting/conditions/pageUrlCondition.js +0 -2
- package/dist/targeting/conditions/pageUrlCondition.js.map +0 -1
- package/dist/targeting/conditions/sdkLanguageCondition.d.ts +0 -15
- package/dist/targeting/conditions/sdkLanguageCondition.js +0 -2
- package/dist/targeting/conditions/sdkLanguageCondition.js.map +0 -1
- package/dist/targeting/conditions/targetExperimentCondition.d.ts +0 -12
- package/dist/targeting/conditions/targetExperimentCondition.js +0 -2
- package/dist/targeting/conditions/targetExperimentCondition.js.map +0 -1
- package/dist/targeting/conditions/types.d.ts +0 -42
- package/dist/targeting/conditions/types.js +0 -2
- package/dist/targeting/conditions/types.js.map +0 -1
- package/dist/targeting/conditions/visitorCodeCondition.d.ts +0 -11
- package/dist/targeting/conditions/visitorCodeCondition.js +0 -2
- package/dist/targeting/conditions/visitorCodeCondition.js.map +0 -1
- package/dist/targeting/index.d.ts +0 -3
- package/dist/targeting/index.js +0 -2
- package/dist/targeting/index.js.map +0 -1
- package/dist/targeting/targetingNode.d.ts +0 -23
- package/dist/targeting/targetingNode.js +0 -2
- package/dist/targeting/targetingNode.js.map +0 -1
- package/dist/targeting/targetingTree.d.ts +0 -19
- package/dist/targeting/targetingTree.js +0 -35
- package/dist/targeting/targetingTree.js.map +0 -1
- package/dist/targeting/types.d.ts +0 -142
- package/dist/targeting/types.js +0 -2
- package/dist/targeting/types.js.map +0 -1
- package/dist/types.d.ts +0 -175
- package/dist/types.js +0 -42
- package/dist/types.js.map +0 -1
- package/dist/utilities/constants.d.ts +0 -2
- package/dist/utilities/constants.js +0 -2
- package/dist/utilities/constants.js.map +0 -1
- package/dist/utilities/index.d.ts +0 -2
- package/dist/utilities/index.js +0 -2
- package/dist/utilities/index.js.map +0 -1
- package/dist/utilities/types.d.ts +0 -64
- package/dist/utilities/types.js +0 -2
- package/dist/utilities/types.js.map +0 -1
- package/dist/utilities/utilities.d.ts +0 -27
- package/dist/utilities/utilities.js +0 -2
- package/dist/utilities/utilities.js.map +0 -1
- package/dist/variationConfiguration/index.d.ts +0 -2
- package/dist/variationConfiguration/index.js +0 -2
- package/dist/variationConfiguration/index.js.map +0 -1
- package/dist/variationConfiguration/types.d.ts +0 -28
- package/dist/variationConfiguration/types.js +0 -2
- package/dist/variationConfiguration/types.js.map +0 -1
- package/dist/variationConfiguration/variation.d.ts +0 -13
- package/dist/variationConfiguration/variation.js +0 -7
- package/dist/variationConfiguration/variation.js.map +0 -1
- package/dist/variationConfiguration/variationConfiguration.d.ts +0 -35
- package/dist/variationConfiguration/variationConfiguration.js +0 -66
- package/dist/variationConfiguration/variationConfiguration.js.map +0 -1
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { SDKConfigurationType } from '../types';
|
|
2
|
-
import { ClientSettingsType } from './types';
|
|
3
|
-
export interface IClientSettings {
|
|
4
|
-
readonly settings: ClientSettingsType;
|
|
5
|
-
}
|
|
6
|
-
export declare class ClientSettings implements IClientSettings {
|
|
7
|
-
private updateInterval;
|
|
8
|
-
private environment?;
|
|
9
|
-
private siteCode;
|
|
10
|
-
constructor(siteCode: string, configuration?: Partial<SDKConfigurationType>);
|
|
11
|
-
get settings(): ClientSettingsType;
|
|
12
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var _types=require("../types");Object.defineProperty(exports,"__esModule",{value:!0}),exports.ClientSettings=void 0;function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var ClientSettings=/*#__PURE__*/function(){function a(b,c){_classCallCheck(this,a),_defineProperty(this,"updateInterval",60*_types.Milliseconds.Minute),_defineProperty(this,"environment",void 0),_defineProperty(this,"siteCode",void 0),this.siteCode=b,null!==c&&void 0!==c&&c.environment&&(this.environment=c.environment),null!==c&&void 0!==c&&c.updateInterval&&(1>c.updateInterval&&(this.updateInterval=1*_types.Milliseconds.Minute),this.updateInterval=c.updateInterval*_types.Milliseconds.Minute)}return _createClass(a,[{key:"settings",get:function get(){return{updateInterval:this.updateInterval,environment:this.environment,siteCode:this.siteCode}}}]),a}();exports.ClientSettings=ClientSettings;
|
|
2
|
-
//# sourceMappingURL=clientSettings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clientSettings.js","names":["_types","require","Object","defineProperty","exports","value","ClientSettings","_typeof","a","Symbol","iterator","constructor","prototype","_classCallCheck","b","TypeError","_defineProperties","c","d","length","enumerable","configurable","writable","_toPropertyKey","key","_createClass","_defineProperty","_toPrimitive","toPrimitive","call","String","Number","siteCode","configuration","Milliseconds","Minute","environment","updateInterval","get"],"sources":["../../src/clientSettings/clientSettings.ts"],"sourcesContent":["import { Environment, Milliseconds, SDKConfigurationType } from 'src/types';\nimport { ClientSettingsType } from './types';\n\nexport interface IClientSettings {\n readonly settings: ClientSettingsType;\n}\n\nexport class ClientSettings implements IClientSettings {\n private updateInterval: number = 60 * Milliseconds.Minute;\n private environment?: Environment;\n private siteCode: string;\n\n constructor(siteCode: string, configuration?: Partial<SDKConfigurationType>) {\n this.siteCode = siteCode;\n\n if (configuration?.environment) {\n this.environment = configuration.environment;\n }\n\n if (configuration?.updateInterval) {\n if (configuration.updateInterval < 1) {\n this.updateInterval = 1 * Milliseconds.Minute;\n }\n\n this.updateInterval = configuration.updateInterval * Milliseconds.Minute;\n }\n }\n\n get settings(): ClientSettingsType {\n return {\n updateInterval: this.updateInterval,\n environment: this.environment,\n siteCode: this.siteCode,\n };\n }\n}\n"],"mappings":"aAAA,IAAAA,MAAA,CAAAC,OAAA,aAA4EC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,c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,CAACA,QACjB,CACF,CAAC,IAAAxB,CAAA,IAAAJ,OAAA,CAAAE,cAAA,CAAAA,cAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ClientSettings",{enumerable:!0,get:function get(){return _clientSettings.ClientSettings}}),Object.defineProperty(exports,"ClientSettingsType",{enumerable:!0,get:function get(){return _types.ClientSettingsType}});var _clientSettings=require("./clientSettings"),_types=require("./types");
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/clientSettings/index.ts"],"sourcesContent":["export { ClientSettings } from './clientSettings';\nexport { ClientSettingsType } from './types';\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/clientSettings/types.ts"],"sourcesContent":["import { Environment } from 'src/types';\n\nexport type ClientSettingsType = {\n updateInterval: number;\n environment?: Environment;\n siteCode: string;\n};\n"],"mappings":""}
|
package/dist/constants.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export declare const UNALLOCATED_VARIATION_ID = 0;
|
|
2
|
-
export declare const OFF_VARIATION_KEY = "off";
|
|
3
|
-
export declare const KAMELEOON_COOKIE_KEY = "kameleoonVisitorCode";
|
|
4
|
-
export declare const VISITOR_CODE_LENGTH = 16;
|
|
5
|
-
export declare const CACHE_CLEANUP_TIMEOUT = 10;
|
|
6
|
-
export declare const CACHE_ITEM_LIFETIME = 5;
|
|
7
|
-
export declare enum Cookie {
|
|
8
|
-
PairsDelimiter = "; ",
|
|
9
|
-
KeyValueDelimiter = "=",
|
|
10
|
-
MaxAge = "Max-Age",
|
|
11
|
-
Path = "Path",
|
|
12
|
-
Domain = "Domain"
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* @readonly
|
|
16
|
-
* @enum {string} an Enum of all the possible Kameleoon SDK types
|
|
17
|
-
* */
|
|
18
|
-
export declare enum SdkLanguageType {
|
|
19
|
-
ANDROID = "ANDROID",
|
|
20
|
-
IOS = "IOS",
|
|
21
|
-
JAVA = "JAVA",
|
|
22
|
-
CSHARP = "CSHARP",
|
|
23
|
-
NODEJS = "NODEJS",
|
|
24
|
-
PHP = "PHP",
|
|
25
|
-
RUBY = "RUBY",
|
|
26
|
-
GO = "GO",
|
|
27
|
-
FLUTTER = "FLUTTER",
|
|
28
|
-
REACT = "REACT",
|
|
29
|
-
PYTHON = "PYTHON",
|
|
30
|
-
JAVASCRIPT = "JAVASCRIPT",
|
|
31
|
-
RUST = "RUST"
|
|
32
|
-
}
|
package/dist/constants.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.VISITOR_CODE_LENGTH=exports.UNALLOCATED_VARIATION_ID=exports.SdkLanguageType=exports.OFF_VARIATION_KEY=exports.KAMELEOON_COOKIE_KEY=exports.Cookie=exports.CACHE_ITEM_LIFETIME=exports.CACHE_CLEANUP_TIMEOUT=void 0;var UNALLOCATED_VARIATION_ID=0;exports.UNALLOCATED_VARIATION_ID=0;var OFF_VARIATION_KEY="off";exports.OFF_VARIATION_KEY="off";var KAMELEOON_COOKIE_KEY="kameleoonVisitorCode";exports.KAMELEOON_COOKIE_KEY="kameleoonVisitorCode";var VISITOR_CODE_LENGTH=16;exports.VISITOR_CODE_LENGTH=16;var CACHE_CLEANUP_TIMEOUT=10;exports.CACHE_CLEANUP_TIMEOUT=10;var CACHE_ITEM_LIFETIME=5;exports.CACHE_ITEM_LIFETIME=5;var Cookie=/*#__PURE__*/function(a){return a.PairsDelimiter="; ",a.KeyValueDelimiter="=",a.MaxAge="Max-Age",a.Path="Path",a.Domain="Domain",a}({});/**
|
|
2
|
-
* @readonly
|
|
3
|
-
* @enum {string} an Enum of all the possible Kameleoon SDK types
|
|
4
|
-
* */exports.Cookie=Cookie;var SdkLanguageType=/*#__PURE__*/function(a){return a.ANDROID="ANDROID",a.IOS="IOS",a.JAVA="JAVA",a.CSHARP="CSHARP",a.NODEJS="NODEJS",a.PHP="PHP",a.RUBY="RUBY",a.GO="GO",a.FLUTTER="FLUTTER",a.REACT="REACT",a.PYTHON="PYTHON",a.JAVASCRIPT="JAVASCRIPT",a.RUST="RUST",a}({});exports.SdkLanguageType=SdkLanguageType;
|
|
5
|
-
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["UNALLOCATED_VARIATION_ID","exports","OFF_VARIATION_KEY","KAMELEOON_COOKIE_KEY","VISITOR_CODE_LENGTH","CACHE_CLEANUP_TIMEOUT","CACHE_ITEM_LIFETIME","Cookie","PairsDelimiter","KeyValueDelimiter","MaxAge","Path","Domain","SdkLanguageType","ANDROID","IOS","JAVA","CSHARP","NODEJS","PHP","RUBY","GO","FLUTTER","REACT","PYTHON","JAVASCRIPT","RUST"],"sources":["../src/constants.ts"],"sourcesContent":["export const UNALLOCATED_VARIATION_ID = 0;\nexport const OFF_VARIATION_KEY = 'off';\nexport const KAMELEOON_COOKIE_KEY = 'kameleoonVisitorCode';\nexport const VISITOR_CODE_LENGTH = 16;\nexport const CACHE_CLEANUP_TIMEOUT = 10;\nexport const CACHE_ITEM_LIFETIME = 5;\n\nexport enum Cookie {\n PairsDelimiter = '; ',\n KeyValueDelimiter = '=',\n MaxAge = 'Max-Age',\n Path = 'Path',\n Domain = 'Domain',\n}\n\n/**\n * @readonly\n * @enum {string} an Enum of all the possible Kameleoon SDK types\n * */\nexport enum SdkLanguageType {\n ANDROID = 'ANDROID',\n IOS = 'IOS',\n JAVA = 'JAVA',\n CSHARP = 'CSHARP',\n NODEJS = 'NODEJS',\n PHP = 'PHP',\n RUBY = 'RUBY',\n GO = 'GO',\n FLUTTER = 'FLUTTER',\n REACT = 'REACT',\n PYTHON = 'PYTHON',\n JAVASCRI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|
|
1
|
-
{"version":3,"file":"constants.js","names":["REAL_TIME_EVENT","exports"],"sources":["../../src/eventSource/constants.ts"],"sourcesContent":["export const REAL_TIME_EVENT = 'configuration-update-event';\n"],"mappings":"mGAAO,GAAM,CAAAA,eAAe,CAAG,4BAA4B,CAACC,OAAA,CAAAD,eAAA"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IExternalEventSourceConstructor } from './types';
|
|
2
|
-
export interface IEventSource {
|
|
3
|
-
open: (onEvent: (timestamp: number) => void) => void;
|
|
4
|
-
close: () => void;
|
|
5
|
-
}
|
|
6
|
-
export declare class ExternalEventSource implements IEventSource {
|
|
7
|
-
private eventSource;
|
|
8
|
-
private siteCode;
|
|
9
|
-
constructor(siteCode: string, externalEventSource: IExternalEventSourceConstructor);
|
|
10
|
-
open(onEvent: (timestamp: number) => void): void;
|
|
11
|
-
close(): void;
|
|
12
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ExternalEventSource=void 0;var _requester=require("../requester"),_constants=require("../requester/constants"),_constants2=require("./constants");function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var ExternalEventSource=/*#__PURE__*/function(){function a(b,c){_classCallCheck(this,a),_defineProperty(this,"eventSource",void 0),_defineProperty(this,"siteCode",void 0);var d=_requester.URL.SERVER_SENT_EVENTS+_constants.UrlQuery.Sse+b,e=c.initialize(d);this.eventSource=e,this.siteCode=b}return _createClass(a,[{key:"open",value:function open(a){this.eventSource.open({onEvent:a,siteCode:this.siteCode,eventType:_constants2.REAL_TIME_EVENT})}},{key:"close",value:function close(){this.eventSource.close()}}]),a}();exports.ExternalEventSource=ExternalEventSource;
|
|
2
|
-
//# sourceMappingURL=externalEventSource.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"externalEventSource.js","names":["ExternalEventSource","a","siteCode","externalEventSource","_classCallCheck","_defineProperty","url","URL","SERVER_SENT_EVENTS","UrlQuery","Sse","eventSource","initialize","_createClass","key","value","open","onEvent","eventType","REAL_TIME_EVENT","close","exports"],"sources":["../../src/eventSource/externalEventSource.ts"],"sourcesContent":["import { URL } from 'src/requester';\nimport { UrlQuery } from 'src/requester/constants';\nimport { REAL_TIME_EVENT } from './constants';\nimport { IExternalEventSource, IExternalEventSourceConstructor } from './types';\n\nexport interface IEventSource {\n open: (onEvent: (timestamp: number) => void) => void;\n close: () => void;\n}\n\nexport class ExternalEventSource implements IEventSource {\n private eventSource: IExternalEventSource;\n private siteCode: string;\n\n constructor(\n siteCode: string,\n externalEventSource: IExternalEventSourceConstructor,\n ) {\n const url = URL.SERVER_SENT_EVENTS + UrlQuery.Sse + siteCode;\n const eventSource = externalEventSource.initialize(url);\n\n this.eventSource = eventSource;\n this.siteCode = siteCode;\n }\n\n public open(onEvent: (timestamp: number) => void): void {\n this.eventSource.open({\n onEvent,\n siteCode: this.siteCode,\n eventType: REAL_TIME_EVENT,\n });\n }\n\n public close(): void {\n this.eventSource.close();\n }\n}\n"],"mappings":"08CAUa,CAAAA,mBAAmB,yBAI9B,SAAAC,EACEC,CAAgB,CAChBC,CAAoD,CACpD,CAAAC,eAAA,MAAAH,CAAA,EAAAI,eAAA,4BAAAA,eAAA,4BACM,CAAAC,CAAG,CAAGC,cAAG,CAACC,kBAAkB,CAAGC,mBAAQ,CAACC,GAAG,CAAGR,CAAQ,CACtDS,CAAW,CAAGR,CAAmB,CAACS,UAAU,CAACN,CAAG,CAAC,CAEvD,IAAI,CAACK,WAAW,CAAGA,CAAW,CAC9B,IAAI,CAACT,QAAQ,CAAGA,CAClB,CAAC,OAAAW,YAAA,CAAAZ,CAAA,GAAAa,GAAA,QAAAC,KAAA,CAED,SAAAC,KAAYC,CAAoC,CAAQ,CACtD,IAAI,CAACN,WAAW,CAACK,IAAI,CAAC,CACpBC,OAAO,CAAPA,CAAO,CACPf,QAAQ,CAAE,IAAI,CAACA,QAAQ,CACvBgB,SAAS,CAAEC,2BACb,CAAC,CACH,CAAC,GAAAL,GAAA,SAAAC,KAAA,CAED,SAAAK,MAAA,CAAqB,CACnB,IAAI,CAACT,WAAW,CAACS,KAAK,EACxB,CAAC,IAAAnB,CAAA,IAAAoB,OAAA,CAAArB,mBAAA,CAAAA,mBAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"EventSourceOpenParametersType",{enumerable:!0,get:function get(){return _types.EventSourceOpenParametersType}}),Object.defineProperty(exports,"ExternalEventSource",{enumerable:!0,get:function get(){return _externalEventSource.ExternalEventSource}}),Object.defineProperty(exports,"IEventSource",{enumerable:!0,get:function get(){return _externalEventSource.IEventSource}}),Object.defineProperty(exports,"IExternalEventSource",{enumerable:!0,get:function get(){return _types.IExternalEventSource}}),Object.defineProperty(exports,"IExternalEventSourceConstructor",{enumerable:!0,get:function get(){return _types.IExternalEventSourceConstructor}}),Object.defineProperty(exports,"REAL_TIME_EVENT",{enumerable:!0,get:function get(){return _constants.REAL_TIME_EVENT}}),Object.defineProperty(exports,"RealTimeEventType",{enumerable:!0,get:function get(){return _types.RealTimeEventType}});var _types=require("./types"),_externalEventSource=require("./externalEventSource"),_constants=require("./constants");
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/eventSource/index.ts"],"sourcesContent":["export {\n IExternalEventSourceConstructor,\n EventSourceOpenParametersType,\n IExternalEventSource,\n RealTimeEventType,\n} from './types';\nexport { ExternalEventSource, IEventSource } from './externalEventSource';\nexport { REAL_TIME_EVENT } from './constants';\n"],"mappings":""}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @interface an interface of External Constructor for External Event Source which must be implemented by the wrapper constructor to initialize new `IExternalEventSource` in order to pass the necessary `url` parameter
|
|
3
|
-
* */
|
|
4
|
-
export interface IExternalEventSourceConstructor {
|
|
5
|
-
/**
|
|
6
|
-
* @method initialize - creates and instance of `IExternalEventSource` and returns it
|
|
7
|
-
* @param {string} url - url of server sent event server which will be pasted by consumer
|
|
8
|
-
* @returns {IExternalEventSource} an initialized instance of `IExternalEventSource`
|
|
9
|
-
* */
|
|
10
|
-
initialize: (url: string) => IExternalEventSource;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* @param {string} siteCode - site code from the event
|
|
14
|
-
* @param {string} eventType - type of event to be listened for
|
|
15
|
-
* @param {(timestamp: number) => void} onEvent - callback to be executed upon event if the site code from event matches the site code of EvenetSource
|
|
16
|
-
* */
|
|
17
|
-
export type EventSourceOpenParametersType = {
|
|
18
|
-
siteCode: string;
|
|
19
|
-
eventType: string;
|
|
20
|
-
onEvent: (timestamp: number) => void;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* @interface an interface of External Event Source which will be used in server sent events operations
|
|
24
|
-
* */
|
|
25
|
-
export interface IExternalEventSource {
|
|
26
|
-
/**
|
|
27
|
-
* @method open - opens event source live connection
|
|
28
|
-
* @param {(timestamp: number) => void} callback - callback function that will be executed on each obtainment of server event
|
|
29
|
-
* */
|
|
30
|
-
open: ({ siteCode, eventType, onEvent, }: EventSourceOpenParametersType) => void;
|
|
31
|
-
/**
|
|
32
|
-
* @method close - closes event source live connection
|
|
33
|
-
* */
|
|
34
|
-
close: () => void;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* @param {string} siteCode - site code from the event
|
|
38
|
-
* @param {number} ts - timestamp of when the event has happened
|
|
39
|
-
* */
|
|
40
|
-
export type RealTimeEventType = {
|
|
41
|
-
siteCode: string;
|
|
42
|
-
ts: number;
|
|
43
|
-
};
|
|
44
|
-
export type CreateEventSourceParamsType = {
|
|
45
|
-
siteCode: string;
|
|
46
|
-
externalEventSource?: IExternalEventSourceConstructor;
|
|
47
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/eventSource/types.ts"],"sourcesContent":["/**\n * @interface an interface of External Constructor for External Event Source which must be implemented by the wrapper constructor to initialize new `IExternalEventSource` in order to pass the necessary `url` parameter\n * */\nexport interface IExternalEventSourceConstructor {\n /**\n * @method initialize - creates and instance of `IExternalEventSource` and returns it\n * @param {string} url - url of server sent event server which will be pasted by consumer\n * @returns {IExternalEventSource} an initialized instance of `IExternalEventSource`\n * */\n initialize: (url: string) => IExternalEventSource;\n}\n\n/**\n * @param {string} siteCode - site code from the event\n * @param {string} eventType - type of event to be listened for\n * @param {(timestamp: number) => void} onEvent - callback to be executed upon event if the site code from event matches the site code of EvenetSource\n * */\nexport type EventSourceOpenParametersType = {\n siteCode: string;\n eventType: string;\n onEvent: (timestamp: number) => void;\n};\n\n/**\n * @interface an interface of External Event Source which will be used in server sent events operations\n * */\nexport interface IExternalEventSource {\n /**\n * @method open - opens event source live connection\n * @param {(timestamp: number) => void} callback - callback function that will be executed on each obtainment of server event\n * */\n open: ({\n siteCode,\n eventType,\n onEvent,\n }: EventSourceOpenParametersType) => void;\n /**\n * @method close - closes event source live connection\n * */\n close: () => void;\n}\n\n/**\n * @param {string} siteCode - site code from the event\n * @param {number} ts - timestamp of when the event has happened\n * */\nexport type RealTimeEventType = {\n siteCode: string;\n ts: number;\n};\n\nexport type CreateEventSourceParamsType = {\n siteCode: string;\n externalEventSource?: IExternalEventSourceConstructor;\n};\n"],"mappings":""}
|
package/dist/hasher/hasher.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ObtainExperimentHashDoubleParamsType, ObtainFeatureFlagHashDoubleParamsType } from './types';
|
|
2
|
-
export declare class Hasher {
|
|
3
|
-
static obtainExperimentHashDouble({ visitorCode, campaignId, respoolTime, }: ObtainExperimentHashDoubleParamsType): number;
|
|
4
|
-
static obtainFeatureFlagHashDouble({ visitorCode, campaignId, respoolTime, }: ObtainFeatureFlagHashDoubleParamsType): number;
|
|
5
|
-
static calculateHash(seed: string): number;
|
|
6
|
-
}
|
package/dist/hasher/hasher.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";var _sha=_interopRequireDefault(require("crypto-js/sha256"));Object.defineProperty(exports,"__esModule",{value:!0}),exports.Hasher=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var Hasher=/*#__PURE__*/function(){function a(){_classCallCheck(this,a)}return _createClass(a,null,[{key:"obtainExperimentHashDouble",value:function obtainExperimentHashDouble(a){var b=a.visitorCode,c=a.campaignId,d=a.respoolTime,e="";return d.length&&d.forEach(function(a){e+=a.value+""}),this.calculateHash(b+c+e)}},{key:"obtainFeatureFlagHashDouble",value:function obtainFeatureFlagHashDouble(a){var b=a.visitorCode,c=a.campaignId,d=a.respoolTime,e="";return d&&(e+=d+""),this.calculateHash(b+c+e)}// --- Note ---
|
|
2
|
-
// `hashDouble` is a seeded pseudo-random number between 0 and 1
|
|
3
|
-
// used for deciding what variation to assign
|
|
4
|
-
// `calculateHash` algorithm is consistent between every SDK
|
|
5
|
-
// and will always provide same pseudo-random value for the same input parameters
|
|
6
|
-
},{key:"calculateHash",value:function calculateHash(a){var b=(0,_sha.default)(a).toString();return parseInt(b,16)/Math.pow(2,256)}}]),a}();exports.Hasher=Hasher;
|
|
7
|
-
//# sourceMappingURL=hasher.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hasher.js","names":["_sha","_interopRequireDefault","require","Object","defineProperty","exports","value","Hasher","a","__esModule","default","_typeof","Symbol","iterator","constructor","prototype","_classCallCheck","b","TypeError","_defineProperties","c","d","length","enumerable","configurable","writable","_toPropertyKey","key","_createClass","_toPrimitive","toPrimitive","call","String","Number","obtainExperimentHashDouble","visitorCode","campaignId","respoolTime","respoolTimeString","forEach","respoolObject","calculateHash","obtainFeatureFlagHashDouble","suffix","seed","hashDigest","sha256","toString","parseInt","Math","pow"],"sources":["../../src/hasher/hasher.ts"],"sourcesContent":["import sha256 from 'crypto-js/sha256';\nimport {\n ObtainExperimentHashDoubleParamsType,\n ObtainFeatureFlagHashDoubleParamsType,\n} from './types';\n\nexport class Hasher {\n static obtainExperimentHashDouble({\n visitorCode,\n campaignId,\n respoolTime,\n }: ObtainExperimentHashDoubleParamsType): number {\n let respoolTimeString = '';\n\n if (respoolTime.length) {\n respoolTime.forEach((respoolObject) => {\n respoolTimeString += String(respoolObject.value);\n });\n }\n\n return this.calculateHash(visitorCode + campaignId + respoolTimeString);\n }\n\n static obtainFeatureFlagHashDouble({\n visitorCode,\n campaignId,\n respoolTime,\n }: ObtainFeatureFlagHashDoubleParamsType): number {\n let suffix = '';\n\n if (respoolTime) {\n suffix += String(respoolTime);\n }\n\n return this.calculateHash(visitorCode + campaignId + suffix);\n }\n\n // --- Note ---\n // `hashDouble` is a seeded pseudo-random number between 0 and 1\n // used for deciding what variation to assign\n // `calculateHash` algorithm is consistent between every SDK\n // and will always provide same pseudo-random value for the same input parameters\n static calculateHash(seed: string): number {\n const hashDigest = sha256(seed).toString();\n\n return parseInt(hashDigest, 16) / Math.pow(2, 256);\n }\n}\n"],"mappings":"aAAA,IAAAA,IAAA,CAAAC,sBAAA,CAAAC,OAAA,sBAAsCC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,MAAA,iBAAAN,uBAAAO,CAAA,SAAAA,CAAA,EAAAA,CAAA,CAAAC,UAAA,CAAAD,CAAA,EAAAE,OAAA,CAAAF,CAAA,WAAAG,QAAAH,CAAA,mCAAAG,OAAA,oBAAAC,MAAA,mBAAAA,MAAA,CAAAC,QAAA,UAAAL,CAAA,gBAAAA,CAAA,WAAAA,CAAA,SAAAA,CAAA,qBAAAI,MAAA,EAAAJ,CAAA,CAAAM,WAAA,GAAAF,MAAA,EAAAJ,CAAA,GAAAI,MAAA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 -1 +0,0 @@
|
|
|
1
|
-
export { Hasher } from './hasher';
|
package/dist/hasher/index.js
DELETED
package/dist/hasher/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_hasher","require","Object","defineProperty","exports","value","enumerable","get","Hasher"],"sources":["../../src/hasher/index.ts"],"sourcesContent":["export { Hasher } from './hasher';\n"],"mappings":"aAAA,IAAAA,OAAA,CAAAC,OAAA,aAAkCC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAH,MAAA,CAAAC,cAAA,CAAAC,OAAA,WAAAE,UAAA,IAAAC,GAAA,UAAAA,IAAA,SAAAP,OAAA,CAAAQ,MAAA"}
|
package/dist/hasher/types.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { RespoolTimeType } from '../campaignConfiguration/types';
|
|
2
|
-
type ObtainHashDoubleParamsType = {
|
|
3
|
-
visitorCode: string;
|
|
4
|
-
campaignId: string;
|
|
5
|
-
};
|
|
6
|
-
export type ObtainExperimentHashDoubleParamsType = ObtainHashDoubleParamsType & {
|
|
7
|
-
respoolTime: RespoolTimeType[];
|
|
8
|
-
};
|
|
9
|
-
export type ObtainFeatureFlagHashDoubleParamsType = ObtainHashDoubleParamsType & {
|
|
10
|
-
respoolTime: number | null;
|
|
11
|
-
};
|
|
12
|
-
export {};
|
package/dist/hasher/types.js
DELETED
package/dist/hasher/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/hasher/types.ts"],"sourcesContent":["import { RespoolTimeType } from 'src/campaignConfiguration/types';\n\ntype ObtainHashDoubleParamsType = {\n visitorCode: string;\n campaignId: string;\n};\n\nexport type ObtainExperimentHashDoubleParamsType =\n ObtainHashDoubleParamsType & {\n respoolTime: RespoolTimeType[];\n };\n\nexport type ObtainFeatureFlagHashDoubleParamsType =\n ObtainHashDoubleParamsType & {\n respoolTime: number | null;\n };\n"],"mappings":""}
|
package/dist/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { Ok, Result, Err } from 'ts-res';
|
|
2
|
-
export { KameleoonClient as KameleoonCore, IKameleoonClient as IKameleoonCore, } from './kameleoonClient';
|
|
3
|
-
export { KameleoonUtils as KameleoonCoreUtils } from './kameleoonUtils';
|
|
4
|
-
export { KameleoonException, KameleoonError } from './kameleoonError';
|
|
5
|
-
export { KameleoonStorageKey, ExperimentVariationsType, StorageDataType, IExternalStorage, IExternalStorageConstructor, } from './storage';
|
|
6
|
-
export { Cookie, VISITOR_CODE_LENGTH, SdkLanguageType } from './constants';
|
|
7
|
-
export { CLEANUP_TARGETING_DATA_INTERVAL } from './campaignConfiguration';
|
|
8
|
-
export { JSONType } from './campaignConfiguration';
|
|
9
|
-
export { Environment, VariableType, ExperimentType, FeatureFlagType, SDKCoreParameters, SDKConfigurationType, ExternalPackageInfoType, TrackConversionParamsType, FeatureVariableResultType, InternalSDKConfigurationType, GetFeatureFlagVariableParamsType, ServerGetVisitorCodeParametersType, ClientGetVisitorCodeParametersType, MobileGetVisitorCodeParametersType, Milliseconds, } from './types';
|
|
10
|
-
export { CustomData, Conversion, Device, Browser, UserAgent, DeviceType, BrowserType, PageView, KameleoonData, KameleoonDataType, PageViewParametersType, ConversionParametersType, } from './kameleoonData';
|
|
11
|
-
export { RealTimeEventType, IExternalEventSource, EventSourceOpenParametersType, IExternalEventSourceConstructor, } from './eventSource';
|
|
12
|
-
export { Header, HttpMethod, TrackParametersType, IExternalRequestDispatcher, GetClientConfigurationResultType, } from './requester';
|
package/dist/index.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"Browser",{enumerable:!0,get:function get(){return _kameleoonData.Browser}}),Object.defineProperty(exports,"BrowserType",{enumerable:!0,get:function get(){return _kameleoonData.BrowserType}}),Object.defineProperty(exports,"CLEANUP_TARGETING_DATA_INTERVAL",{enumerable:!0,get:function get(){return _campaignConfiguration.CLEANUP_TARGETING_DATA_INTERVAL}}),Object.defineProperty(exports,"ClientGetVisitorCodeParametersType",{enumerable:!0,get:function get(){return _types.ClientGetVisitorCodeParametersType}}),Object.defineProperty(exports,"Conversion",{enumerable:!0,get:function get(){return _kameleoonData.Conversion}}),Object.defineProperty(exports,"ConversionParametersType",{enumerable:!0,get:function get(){return _kameleoonData.ConversionParametersType}}),Object.defineProperty(exports,"Cookie",{enumerable:!0,get:function get(){return _constants.Cookie}}),Object.defineProperty(exports,"CustomData",{enumerable:!0,get:function get(){return _kameleoonData.CustomData}}),Object.defineProperty(exports,"Device",{enumerable:!0,get:function get(){return _kameleoonData.Device}}),Object.defineProperty(exports,"DeviceType",{enumerable:!0,get:function get(){return _kameleoonData.DeviceType}}),Object.defineProperty(exports,"Environment",{enumerable:!0,get:function get(){return _types.Environment}}),Object.defineProperty(exports,"Err",{enumerable:!0,get:function get(){return _tsRes.Err}}),Object.defineProperty(exports,"EventSourceOpenParametersType",{enumerable:!0,get:function get(){return _eventSource.EventSourceOpenParametersType}}),Object.defineProperty(exports,"ExperimentType",{enumerable:!0,get:function get(){return _types.ExperimentType}}),Object.defineProperty(exports,"ExperimentVariationsType",{enumerable:!0,get:function get(){return _storage.ExperimentVariationsType}}),Object.defineProperty(exports,"ExternalPackageInfoType",{enumerable:!0,get:function get(){return _types.ExternalPackageInfoType}}),Object.defineProperty(exports,"FeatureFlagType",{enumerable:!0,get:function get(){return _types.FeatureFlagType}}),Object.defineProperty(exports,"FeatureVariableResultType",{enumerable:!0,get:function get(){return _types.FeatureVariableResultType}}),Object.defineProperty(exports,"GetClientConfigurationResultType",{enumerable:!0,get:function get(){return _requester.GetClientConfigurationResultType}}),Object.defineProperty(exports,"GetFeatureFlagVariableParamsType",{enumerable:!0,get:function get(){return _types.GetFeatureFlagVariableParamsType}}),Object.defineProperty(exports,"Header",{enumerable:!0,get:function get(){return _requester.Header}}),Object.defineProperty(exports,"HttpMethod",{enumerable:!0,get:function get(){return _requester.HttpMethod}}),Object.defineProperty(exports,"IExternalEventSource",{enumerable:!0,get:function get(){return _eventSource.IExternalEventSource}}),Object.defineProperty(exports,"IExternalEventSourceConstructor",{enumerable:!0,get:function get(){return _eventSource.IExternalEventSourceConstructor}}),Object.defineProperty(exports,"IExternalRequestDispatcher",{enumerable:!0,get:function get(){return _requester.IExternalRequestDispatcher}}),Object.defineProperty(exports,"IExternalStorage",{enumerable:!0,get:function get(){return _storage.IExternalStorage}}),Object.defineProperty(exports,"IExternalStorageConstructor",{enumerable:!0,get:function get(){return _storage.IExternalStorageConstructor}}),Object.defineProperty(exports,"IKameleoonCore",{enumerable:!0,get:function get(){return _kameleoonClient.IKameleoonClient}}),Object.defineProperty(exports,"InternalSDKConfigurationType",{enumerable:!0,get:function get(){return _types.InternalSDKConfigurationType}}),Object.defineProperty(exports,"JSONType",{enumerable:!0,get:function get(){return _campaignConfiguration.JSONType}}),Object.defineProperty(exports,"KameleoonCore",{enumerable:!0,get:function get(){return _kameleoonClient.KameleoonClient}}),Object.defineProperty(exports,"KameleoonCoreUtils",{enumerable:!0,get:function get(){return _kameleoonUtils.KameleoonUtils}}),Object.defineProperty(exports,"KameleoonData",{enumerable:!0,get:function get(){return _kameleoonData.KameleoonData}}),Object.defineProperty(exports,"KameleoonDataType",{enumerable:!0,get:function get(){return _kameleoonData.KameleoonDataType}}),Object.defineProperty(exports,"KameleoonError",{enumerable:!0,get:function get(){return _kameleoonError.KameleoonError}}),Object.defineProperty(exports,"KameleoonException",{enumerable:!0,get:function get(){return _kameleoonError.KameleoonException}}),Object.defineProperty(exports,"KameleoonStorageKey",{enumerable:!0,get:function get(){return _storage.KameleoonStorageKey}}),Object.defineProperty(exports,"Milliseconds",{enumerable:!0,get:function get(){return _types.Milliseconds}}),Object.defineProperty(exports,"MobileGetVisitorCodeParametersType",{enumerable:!0,get:function get(){return _types.MobileGetVisitorCodeParametersType}}),Object.defineProperty(exports,"Ok",{enumerable:!0,get:function get(){return _tsRes.Ok}}),Object.defineProperty(exports,"PageView",{enumerable:!0,get:function get(){return _kameleoonData.PageView}}),Object.defineProperty(exports,"PageViewParametersType",{enumerable:!0,get:function get(){return _kameleoonData.PageViewParametersType}}),Object.defineProperty(exports,"RealTimeEventType",{enumerable:!0,get:function get(){return _eventSource.RealTimeEventType}}),Object.defineProperty(exports,"Result",{enumerable:!0,get:function get(){return _tsRes.Result}}),Object.defineProperty(exports,"SDKConfigurationType",{enumerable:!0,get:function get(){return _types.SDKConfigurationType}}),Object.defineProperty(exports,"SDKCoreParameters",{enumerable:!0,get:function get(){return _types.SDKCoreParameters}}),Object.defineProperty(exports,"SdkLanguageType",{enumerable:!0,get:function get(){return _constants.SdkLanguageType}}),Object.defineProperty(exports,"ServerGetVisitorCodeParametersType",{enumerable:!0,get:function get(){return _types.ServerGetVisitorCodeParametersType}}),Object.defineProperty(exports,"StorageDataType",{enumerable:!0,get:function get(){return _storage.StorageDataType}}),Object.defineProperty(exports,"TrackConversionParamsType",{enumerable:!0,get:function get(){return _types.TrackConversionParamsType}}),Object.defineProperty(exports,"TrackParametersType",{enumerable:!0,get:function get(){return _requester.TrackParametersType}}),Object.defineProperty(exports,"UserAgent",{enumerable:!0,get:function get(){return _kameleoonData.UserAgent}}),Object.defineProperty(exports,"VISITOR_CODE_LENGTH",{enumerable:!0,get:function get(){return _constants.VISITOR_CODE_LENGTH}}),Object.defineProperty(exports,"VariableType",{enumerable:!0,get:function get(){return _types.VariableType}});var _tsRes=require("ts-res"),_kameleoonClient=require("./kameleoonClient"),_kameleoonUtils=require("./kameleoonUtils"),_kameleoonError=require("./kameleoonError"),_storage=require("./storage"),_constants=require("./constants"),_campaignConfiguration=require("./campaignConfiguration"),_types=require("./types"),_kameleoonData=require("./kameleoonData"),_eventSource=require("./eventSource"),_requester=require("./requester");
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["export { Ok, Result, Err } from 'ts-res';\nexport {\n KameleoonClient as KameleoonCore,\n IKameleoonClient as IKameleoonCore,\n} from './kameleoonClient';\nexport { KameleoonUtils as KameleoonCoreUtils } from './kameleoonUtils';\nexport { KameleoonException, KameleoonError } from './kameleoonError';\nexport {\n KameleoonStorageKey,\n ExperimentVariationsType,\n StorageDataType,\n IExternalStorage,\n IExternalStorageConstructor,\n} from './storage';\nexport { Cookie, VISITOR_CODE_LENGTH, SdkLanguageType } from './constants';\nexport { CLEANUP_TARGETING_DATA_INTERVAL } from './campaignConfiguration';\nexport { JSONType } from './campaignConfiguration';\nexport {\n Environment,\n VariableType,\n ExperimentType,\n FeatureFlagType,\n SDKCoreParameters,\n SDKConfigurationType,\n ExternalPackageInfoType,\n TrackConversionParamsType,\n FeatureVariableResultType,\n InternalSDKConfigurationType,\n GetFeatureFlagVariableParamsType,\n ServerGetVisitorCodeParametersType,\n ClientGetVisitorCodeParametersType,\n MobileGetVisitorCodeParametersType,\n Milliseconds,\n} from './types';\nexport {\n CustomData,\n Conversion,\n Device,\n Browser,\n UserAgent,\n DeviceType,\n BrowserType,\n PageView,\n KameleoonData,\n KameleoonDataType,\n PageViewParametersType,\n ConversionParametersType,\n} from './kameleoonData';\nexport {\n RealTimeEventType,\n IExternalEventSource,\n EventSourceOpenParametersType,\n IExternalEventSourceConstructor,\n} from './eventSource';\nexport {\n Header,\n HttpMethod,\n TrackParametersType,\n IExternalRequestDispatcher,\n GetClientConfigurationResultType,\n} from './requester';\n"],"mappings":""}
|
|
@@ -1,253 +0,0 @@
|
|
|
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
|
-
* @param {boolean | undefined} useCache - optional parameter for activating SDK offline mode, if `true` is passed failed polls will not return error and will use cached data if such data is available, default value is `false`. Note: if offline mode is on, SDK will still try to retrieve the latest data.
|
|
11
|
-
* @returns {Promise<boolean>} Promise resolved into boolean field indicating success or fail
|
|
12
|
-
* @throws `KameleoonError` with one of the following `type` s:
|
|
13
|
-
*
|
|
14
|
-
* - `KameleoonException.StorageWrite` Couldn't update storage data
|
|
15
|
-
* - `KameleoonException.ClientConfiguration` Couldn't retrieve client configuration from Kameleoon Api
|
|
16
|
-
* - `KameleoonException.MaximumRetriesReached` Maximum retries reached, request failed
|
|
17
|
-
*/
|
|
18
|
-
initialize(useCache?: boolean): Promise<boolean>;
|
|
19
|
-
initialize(): Promise<boolean>;
|
|
20
|
-
/**
|
|
21
|
-
* @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.
|
|
22
|
-
* @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length
|
|
23
|
-
* @param {KameleoonDataType[]} kameleoonData - number of instances of any type of `KameleoonData`, can be added solely in array or as a sequential arguments
|
|
24
|
-
* @returns {void}
|
|
25
|
-
* @throws `KameleoonError` with one of the following `type` s:
|
|
26
|
-
*
|
|
27
|
-
* - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded
|
|
28
|
-
* - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
|
|
29
|
-
* - `KameleoonException.StorageWrite` Couldn't update storage data
|
|
30
|
-
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
31
|
-
*/
|
|
32
|
-
addData: (visitorCode: string, ...data: KameleoonDataType[]) => void;
|
|
33
|
-
/**
|
|
34
|
-
* @method getRemoteVisitorData - an asynchronous method for retrieving custom data for the latest visit of `visitorCode` from Kameleoon Data API and optionally adding it to the storage so that other methods could decide whether the current visitor is targeted or not.
|
|
35
|
-
* @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length
|
|
36
|
-
* @param {boolean | undefined} shouldAddData - optional parameter for adding retrieved data to the storage like `addData` method does, default value is `true`
|
|
37
|
-
* @returns {KameleoonDataType[]} promise resolved to an array of `KameleoonData` instances, only includes custom data
|
|
38
|
-
* @throws `KameleoonError` with one of the following `type` s:
|
|
39
|
-
*
|
|
40
|
-
* - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded
|
|
41
|
-
* - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
|
|
42
|
-
* - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server
|
|
43
|
-
*/
|
|
44
|
-
getRemoteVisitorData: (visitorCode: string, shouldAddData?: boolean) => Promise<KameleoonDataType[]>;
|
|
45
|
-
/**
|
|
46
|
-
* @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 sends tracking request.
|
|
47
|
-
* @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length
|
|
48
|
-
* @param {number} experimentId - id of experiment running for the current visitor
|
|
49
|
-
* @returns {number} associated variationId which is successfully searched/assigned
|
|
50
|
-
* @throws `KameleoonError` with one of the following `type` s:
|
|
51
|
-
*
|
|
52
|
-
* - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded
|
|
53
|
-
* - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
|
|
54
|
-
* - `KameleoonException.ExperimentConfigurationNotFound` No configuration found for provided `experimentId`
|
|
55
|
-
* - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded
|
|
56
|
-
* - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
|
|
57
|
-
* - `KameleoonException.StorageRead` Couldn't find associated experiment by provided `experimentId` and `visitorCode` inside the storage
|
|
58
|
-
* - `KameleoonException.NotTargeted` Current visitor is not targeted
|
|
59
|
-
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
60
|
-
*/
|
|
61
|
-
triggerExperiment: (visitorCode: string, experimentId: number) => number;
|
|
62
|
-
/**
|
|
63
|
-
* @method trackConversion - creates and adds `Conversion` data to the visitor with specified parameters and executes `flush`. 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
|
|
64
|
-
* @param {TrackConversionParamsType} conversionParameters - `visitorCode`, `goalId` and `revenue` parameters for data tracking
|
|
65
|
-
* @returns {void}
|
|
66
|
-
* @throws `KameleoonError` with one of the following `type` s:
|
|
67
|
-
*
|
|
68
|
-
* - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded
|
|
69
|
-
* - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
|
|
70
|
-
* - `KameleoonException.StorageWrite` Couldn't update storage data
|
|
71
|
-
*/
|
|
72
|
-
trackConversion: ({ visitorCode, goalId, revenue, }: TrackConversionParamsType) => void;
|
|
73
|
-
/**
|
|
74
|
-
* @method flush - takes visitor associated kameleoon data and sends the data tracking request with collected data,
|
|
75
|
-
* sent data is removed from `KameleoonClient` instance but not from the storage for correct targeting checks. If no visitor is passed,
|
|
76
|
-
* then data for all visitors is sent and removed from `KameleoonClient` instance. Moreover, regardless of visitor code input
|
|
77
|
-
* the method first attemps to send all previously failed tracking requests which were stored locally during the offline mode.
|
|
78
|
-
* @param {string | undefined} visitorCode - unique visitor identification string, can't exceed 255 characters length
|
|
79
|
-
* @returns {void}
|
|
80
|
-
* @throws `KameleoonError` with one of the following `type` s:
|
|
81
|
-
*
|
|
82
|
-
* - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded
|
|
83
|
-
* - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
|
|
84
|
-
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
85
|
-
*/
|
|
86
|
-
flush: (visitorCode: string) => void;
|
|
87
|
-
/**
|
|
88
|
-
* @deprecated Use flush method instead.
|
|
89
|
-
*/
|
|
90
|
-
flushData: (visitorCode: string) => void;
|
|
91
|
-
/**
|
|
92
|
-
* @method getExperiments - returns a list of experiments stored in the client configuration
|
|
93
|
-
* @returns {ExperimentType[]} a list of all experiments items with `id` and `name` fields
|
|
94
|
-
* @throws `KameleoonError` with one of the following `type` s:
|
|
95
|
-
*
|
|
96
|
-
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
97
|
-
*/
|
|
98
|
-
getExperiments: () => ExperimentType[];
|
|
99
|
-
/**
|
|
100
|
-
* @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).
|
|
101
|
-
* @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length
|
|
102
|
-
* @param {boolean | undefined} isAllocated - boolean value indicating that only experiments *allocated* for visitor will be returned. Default value is `true`
|
|
103
|
-
* @returns {ExperimentType[]} a list of all experiments items with `id` and `name` fields
|
|
104
|
-
* @throws `KameleoonError` with one of the following `type` s:
|
|
105
|
-
*
|
|
106
|
-
* - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
|
|
107
|
-
* - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
|
|
108
|
-
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
109
|
-
*/
|
|
110
|
-
getVisitorExperiments: (visitorCode: string, isAllocated?: boolean) => ExperimentType[];
|
|
111
|
-
/**
|
|
112
|
-
* @method getExperimentVariationData - returns variation data in JSON format for the variation with `variationId`
|
|
113
|
-
* @param {number} variationId - id of variation
|
|
114
|
-
* @returns {JSONType} variation data in JSON format
|
|
115
|
-
* @throws `KameleoonError` with one of the following `type` s:
|
|
116
|
-
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
117
|
-
* - `KameleoonException.JSONParse` - Couldn't pass JSON value
|
|
118
|
-
* - `KameleoonException.VariationNotFound` - No variation found for provided `variationId`
|
|
119
|
-
*/
|
|
120
|
-
getExperimentVariationData: (variationId: number) => JSONType | null;
|
|
121
|
-
/**
|
|
122
|
-
* @method getFeatureFlags - returns a list of feature flags stored in the client configuration
|
|
123
|
-
* @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields
|
|
124
|
-
* @throws `KameleoonError` with one of the following `type` s:
|
|
125
|
-
*
|
|
126
|
-
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
127
|
-
*/
|
|
128
|
-
getFeatureFlags: () => FeatureFlagType[];
|
|
129
|
-
/**
|
|
130
|
-
* @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).
|
|
131
|
-
* @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length
|
|
132
|
-
* @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields
|
|
133
|
-
* @throws `KameleoonError` with one of the following `type` s:
|
|
134
|
-
*
|
|
135
|
-
* - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
|
|
136
|
-
* - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
|
|
137
|
-
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
138
|
-
* - `KameleoonException.NotTargeted` - Current visitor is not targeted
|
|
139
|
-
*/
|
|
140
|
-
getVisitorFeatureFlags: (visitorCode: string) => FeatureFlagType[];
|
|
141
|
-
/**
|
|
142
|
-
* @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
|
|
143
|
-
* @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length
|
|
144
|
-
* @param {string} featureKey - a unique key for feature flag
|
|
145
|
-
* @returns {boolean} a boolean indicator of whether the feature flag with `featureKey` is active for visitor with `visitorCode`
|
|
146
|
-
* @throws `KameleoonError` with one of the following `type` s:
|
|
147
|
-
*
|
|
148
|
-
* - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
|
|
149
|
-
* - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
|
|
150
|
-
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
151
|
-
* - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`
|
|
152
|
-
* - `KameleoonException.DataInconsistency` - Allocated variation was found but there is no feature flag with according `featureKey`.
|
|
153
|
-
* - `KameleoonException.NotTargeted` - Current visitor is not targeted
|
|
154
|
-
*/
|
|
155
|
-
isFeatureFlagActive: (visitorCode: string, featureKey: string) => boolean;
|
|
156
|
-
/**
|
|
157
|
-
* @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
|
|
158
|
-
* @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length
|
|
159
|
-
* @param {string} featureKey - a unique key for feature flag
|
|
160
|
-
* @returns {string} a string containing variable key for the allocated feature flag variation for the provided visitor
|
|
161
|
-
* @throws `KameleoonError` with one of the following `type` s:
|
|
162
|
-
*
|
|
163
|
-
* - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
|
|
164
|
-
* - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
|
|
165
|
-
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
166
|
-
* - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`
|
|
167
|
-
* - `KameleoonException.NotTargeted` - Current visitor is not targeted
|
|
168
|
-
*/
|
|
169
|
-
getFeatureFlagVariationKey: (visitorCode: string, featureKey: string) => string;
|
|
170
|
-
/**
|
|
171
|
-
* @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
|
|
172
|
-
* @param {GetFeatureFlagVariableParamsType} parameters - an object with parameters of a type `GetFeatureFlagVariableParamsType`, see the type for details.
|
|
173
|
-
* @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.
|
|
174
|
-
* @throws `KameleoonError` with one of the following `type` s:
|
|
175
|
-
*
|
|
176
|
-
* - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
|
|
177
|
-
* - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
|
|
178
|
-
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
179
|
-
* - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`
|
|
180
|
-
* - `KameleoonException.FeatureFlagVariableNotFound` - No feature variable was found for provided `visitorCode` and `variableKey`
|
|
181
|
-
* - `KameleoonException.NotTargeted` - Current visitor is not targeted
|
|
182
|
-
* - `KameleoonException.JSONParse` - Couldn't pass JSON value
|
|
183
|
-
* - `KameleoonException.NumberParse` - Couldn't pass Number value
|
|
184
|
-
*/
|
|
185
|
-
getFeatureFlagVariable: ({ visitorCode, featureKey, variableKey, }: GetFeatureFlagVariableParamsType) => FeatureVariableResultType;
|
|
186
|
-
/**
|
|
187
|
-
* @method getRemoteData - returns a data which is stored for specified siteCode on a remote Kameleoon server.
|
|
188
|
-
* @param {string} key - unique key that the data you try to get is associated with.
|
|
189
|
-
* @returns {JSONType} - promise with retrieving data for specific key.
|
|
190
|
-
* @throws `KameleoonError` with one of the following `type` s:
|
|
191
|
-
*
|
|
192
|
-
* - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server
|
|
193
|
-
*/
|
|
194
|
-
getRemoteData: (key: string) => Promise<JSONType>;
|
|
195
|
-
/**
|
|
196
|
-
* @method getEngineTrackingCode - returns Kameleoon tracking code for the current visitor. Tracking code is built of the experiments that were triggered and feature flag variations that were assigned during the last 5 seconds
|
|
197
|
-
* See [Kameleoon Automation API](https://developers.kameleoon.com/apis/activation-api-js/api-reference#trigger-1) for the details
|
|
198
|
-
* @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length
|
|
199
|
-
* @returns {string} Kameleoon tracking code
|
|
200
|
-
* @throws `KameleoonError` with one of the following `type` s:
|
|
201
|
-
*
|
|
202
|
-
* - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
|
|
203
|
-
* - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
|
|
204
|
-
*/
|
|
205
|
-
getEngineTrackingCode: (visitorCode: string) => string;
|
|
206
|
-
/**
|
|
207
|
-
* @method onConfigurationUpdate - fires a callback on client configuration update. Note: this method only works for server sent events of real time update.
|
|
208
|
-
* @param {() => void} callback - callback function with no parameters that will be called upon configuration update
|
|
209
|
-
* @returns {void}
|
|
210
|
-
* @throws `KameleoonError` with one of the following `type` s:
|
|
211
|
-
*
|
|
212
|
-
* - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
|
|
213
|
-
*/
|
|
214
|
-
onConfigurationUpdate: (callback: () => void) => void;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* @class
|
|
218
|
-
* KameleoonClient - a class for creating kameleoon client instance
|
|
219
|
-
* for communicating with Kameleoon JavaScript SDK Core, when new instance is created
|
|
220
|
-
*/
|
|
221
|
-
export declare class KameleoonClient implements IKameleoonClient {
|
|
222
|
-
private variationConfiguration?;
|
|
223
|
-
private campaignConfiguration;
|
|
224
|
-
private variationDataStorage;
|
|
225
|
-
private offlineTrackingStorage;
|
|
226
|
-
private trackingCache;
|
|
227
|
-
private requester;
|
|
228
|
-
private externalPackageInfo;
|
|
229
|
-
private isOfflineModeOn?;
|
|
230
|
-
/**
|
|
231
|
-
* @param {SDKCoreParameters} sdkCoreParameters - parameters for initializing sdk core
|
|
232
|
-
*/
|
|
233
|
-
constructor({ siteCode, configuration, internalConfiguration, }: SDKCoreParameters);
|
|
234
|
-
initialize(useCache?: boolean): Promise<boolean>;
|
|
235
|
-
addData(visitorCode: string, ...data: KameleoonDataType[]): void;
|
|
236
|
-
getRemoteVisitorData(visitorCode: string, shouldAddData?: boolean): Promise<KameleoonDataType[]>;
|
|
237
|
-
triggerExperiment(visitorCode: string, experimentId: number): number;
|
|
238
|
-
trackConversion({ visitorCode, goalId, revenue, }: TrackConversionParamsType): void;
|
|
239
|
-
flush(visitorCode?: string): void;
|
|
240
|
-
flushData(visitorCode?: string): void;
|
|
241
|
-
getExperiments(): ExperimentType[];
|
|
242
|
-
getVisitorExperiments(visitorCode: string, isActive?: boolean): ExperimentType[];
|
|
243
|
-
getExperimentVariationData(variationId: number): JSONType;
|
|
244
|
-
getFeatureFlags(): FeatureFlagType[];
|
|
245
|
-
getVisitorFeatureFlags(visitorCode: string): FeatureFlagType[];
|
|
246
|
-
getFeatureFlagVariationKey(visitorCode: string, featureKey: string): string;
|
|
247
|
-
getFeatureFlagVariable({ visitorCode, featureKey, variableKey, }: GetFeatureFlagVariableParamsType): FeatureVariableResultType;
|
|
248
|
-
isFeatureFlagActive(visitorCode: string, featureKey: string): boolean;
|
|
249
|
-
getRemoteData(key: string): Promise<JSONType>;
|
|
250
|
-
onConfigurationUpdate(callback: () => void): void;
|
|
251
|
-
getEngineTrackingCode(visitorCode: string): string;
|
|
252
|
-
private _getFeatureFlagVariation;
|
|
253
|
-
}
|