@kameleoon/javascript-sdk-core 1.1.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cacheManager/cacheManager.d.ts +38 -0
- package/dist/cacheManager/cacheManager.js +74 -0
- package/dist/cacheManager/cacheManager.js.map +1 -0
- package/dist/cacheManager/index.d.ts +2 -0
- package/dist/cacheManager/index.js +20 -0
- package/dist/cacheManager/index.js.map +1 -0
- package/dist/cacheManager/types.d.ts +14 -0
- package/dist/cacheManager/types.js +6 -0
- package/dist/cacheManager/types.js.map +1 -0
- package/dist/campaignConfiguration/campaignConfiguration.d.ts +2 -1
- package/dist/campaignConfiguration/campaignConfiguration.js +243 -196
- package/dist/campaignConfiguration/campaignConfiguration.js.map +1 -1
- package/dist/campaignConfiguration/constants.d.ts +3 -3
- package/dist/campaignConfiguration/constants.js +22 -16
- package/dist/campaignConfiguration/constants.js.map +1 -1
- package/dist/campaignConfiguration/index.d.ts +1 -0
- package/dist/campaignConfiguration/index.js +85 -6
- package/dist/campaignConfiguration/index.js.map +1 -1
- package/dist/campaignConfiguration/types.d.ts +7 -3
- package/dist/campaignConfiguration/types.js +53 -45
- package/dist/campaignConfiguration/types.js.map +1 -1
- package/dist/clientSettings/clientSettings.d.ts +1 -1
- package/dist/clientSettings/clientSettings.js +28 -21
- package/dist/clientSettings/clientSettings.js.map +1 -1
- package/dist/clientSettings/index.js +18 -4
- package/dist/clientSettings/index.js.map +1 -1
- package/dist/clientSettings/types.d.ts +1 -1
- package/dist/clientSettings/types.js +4 -1
- package/dist/clientSettings/types.js.map +1 -1
- package/dist/constants.d.ts +11 -0
- package/dist/constants.js +37 -14
- package/dist/constants.js.map +1 -1
- package/dist/eventSource/constants.js +6 -2
- package/dist/eventSource/constants.js.map +1 -1
- package/dist/eventSource/externalEventSource.js +28 -20
- package/dist/eventSource/externalEventSource.js.map +1 -1
- package/dist/eventSource/index.js +49 -6
- package/dist/eventSource/index.js.map +1 -1
- package/dist/eventSource/types.d.ts +1 -1
- package/dist/eventSource/types.js +4 -1
- package/dist/eventSource/types.js.map +1 -1
- package/dist/hasher/hasher.d.ts +1 -1
- package/dist/hasher/hasher.js +37 -26
- package/dist/hasher/hasher.js.map +1 -1
- package/dist/hasher/index.js +11 -4
- package/dist/hasher/index.js.map +1 -1
- package/dist/hasher/types.d.ts +1 -1
- package/dist/hasher/types.js +4 -1
- package/dist/hasher/types.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +309 -28
- package/dist/index.js.map +1 -1
- package/dist/kameleoonClient.d.ts +32 -19
- package/dist/kameleoonClient.js +353 -235
- package/dist/kameleoonClient.js.map +1 -1
- package/dist/kameleoonData/browser.js +37 -32
- package/dist/kameleoonData/browser.js.map +1 -1
- package/dist/kameleoonData/constants.js +6 -2
- package/dist/kameleoonData/constants.js.map +1 -1
- package/dist/kameleoonData/conversion.js +47 -40
- package/dist/kameleoonData/conversion.js.map +1 -1
- package/dist/kameleoonData/customData.js +62 -58
- package/dist/kameleoonData/customData.js.map +1 -1
- package/dist/kameleoonData/device.js +37 -32
- package/dist/kameleoonData/device.js.map +1 -1
- package/dist/kameleoonData/index.js +101 -18
- package/dist/kameleoonData/index.js.map +1 -1
- package/dist/kameleoonData/nonce.js +25 -13
- package/dist/kameleoonData/nonce.js.map +1 -1
- package/dist/kameleoonData/pageView.js +52 -44
- package/dist/kameleoonData/pageView.js.map +1 -1
- package/dist/kameleoonData/types.js +41 -26
- package/dist/kameleoonData/types.js.map +1 -1
- package/dist/kameleoonData/userAgent.js +33 -24
- package/dist/kameleoonData/userAgent.js.map +1 -1
- package/dist/kameleoonError/constants.d.ts +1 -1
- package/dist/kameleoonError/constants.js +25 -21
- package/dist/kameleoonError/constants.js.map +1 -1
- package/dist/kameleoonError/helpers.js +6 -4
- package/dist/kameleoonError/helpers.js.map +1 -1
- package/dist/kameleoonError/index.js +25 -8
- package/dist/kameleoonError/index.js.map +1 -1
- package/dist/kameleoonError/kameleoonError.d.ts +1 -1
- package/dist/kameleoonError/kameleoonError.js +64 -53
- package/dist/kameleoonError/kameleoonError.js.map +1 -1
- package/dist/kameleoonError/types.d.ts +1 -1
- package/dist/kameleoonError/types.js +26 -22
- package/dist/kameleoonError/types.js.map +1 -1
- package/dist/kameleoonUtils.js +34 -33
- package/dist/kameleoonUtils.js.map +1 -1
- package/dist/requester/constants.d.ts +6 -7
- package/dist/requester/constants.js +58 -45
- package/dist/requester/constants.js.map +1 -1
- package/dist/requester/index.d.ts +2 -2
- package/dist/requester/index.js +67 -8
- package/dist/requester/index.js.map +1 -1
- package/dist/requester/requester.d.ts +7 -7
- package/dist/requester/requester.js +90 -113
- package/dist/requester/requester.js.map +1 -1
- package/dist/requester/types.d.ts +38 -10
- package/dist/requester/types.js +14 -36
- package/dist/requester/types.js.map +1 -1
- package/dist/storage/constants.js +11 -7
- package/dist/storage/constants.js.map +1 -1
- package/dist/storage/externalStorage.js +33 -26
- package/dist/storage/externalStorage.js.map +1 -1
- package/dist/storage/index.js +55 -6
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/types.js +4 -1
- package/dist/storage/types.js.map +1 -1
- package/dist/targeting/conditions/conditionFactory.js +24 -19
- package/dist/targeting/conditions/conditionFactory.js.map +1 -1
- package/dist/targeting/conditions/customDataCondition.js +99 -88
- package/dist/targeting/conditions/customDataCondition.js.map +1 -1
- package/dist/targeting/conditions/exclusiveExperimentCondition.js +27 -15
- package/dist/targeting/conditions/exclusiveExperimentCondition.js.map +1 -1
- package/dist/targeting/conditions/index.js +45 -10
- package/dist/targeting/conditions/index.js.map +1 -1
- package/dist/targeting/conditions/targetExperimentCondition.js +54 -32
- package/dist/targeting/conditions/targetExperimentCondition.js.map +1 -1
- package/dist/targeting/conditions/types.js +4 -1
- package/dist/targeting/conditions/types.js.map +1 -1
- package/dist/targeting/index.js +79 -13
- package/dist/targeting/index.js.map +1 -1
- package/dist/targeting/targetingNode.js +41 -33
- package/dist/targeting/targetingNode.js.map +1 -1
- package/dist/targeting/targetingTree.js +125 -104
- package/dist/targeting/targetingTree.js.map +1 -1
- package/dist/targeting/types.js +99 -91
- package/dist/targeting/types.js.map +1 -1
- package/dist/types.d.ts +34 -2
- package/dist/types.js +58 -21
- package/dist/types.js.map +1 -1
- package/dist/utilities/constants.js +6 -2
- package/dist/utilities/constants.js.map +1 -1
- package/dist/utilities/index.js +11 -4
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/types.d.ts +9 -1
- package/dist/utilities/types.js +4 -1
- package/dist/utilities/types.js.map +1 -1
- package/dist/utilities/utilities.d.ts +6 -3
- package/dist/utilities/utilities.js +171 -105
- package/dist/utilities/utilities.js.map +1 -1
- package/dist/variationConfiguration/index.js +24 -4
- package/dist/variationConfiguration/index.js.map +1 -1
- package/dist/variationConfiguration/types.d.ts +1 -1
- package/dist/variationConfiguration/types.js +4 -1
- package/dist/variationConfiguration/types.js.map +1 -1
- package/dist/variationConfiguration/variation.js +35 -28
- package/dist/variationConfiguration/variation.js.map +1 -1
- package/dist/variationConfiguration/variationConfiguration.d.ts +5 -6
- package/dist/variationConfiguration/variationConfiguration.js +263 -230
- package/dist/variationConfiguration/variationConfiguration.js.map +1 -1
- package/package.json +6 -4
- package/dist/hasher/constants.d.ts +0 -1
- package/dist/hasher/constants.js +0 -5
- package/dist/hasher/constants.js.map +0 -1
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","
|
|
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","SDKType"],"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 = 'MaxAge',\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 SDKType {\n NodeJS = 'nodejs',\n JavaScript = 'javascript',\n React = 'react',\n}\n"],"mappings":";;;;;;AAAO,MAAMA,wBAAwB,GAAG,CAAC;AAACC,OAAA,CAAAD,wBAAA,GAAAA,wBAAA;AACnC,MAAME,iBAAiB,GAAG,KAAK;AAACD,OAAA,CAAAC,iBAAA,GAAAA,iBAAA;AAChC,MAAMC,oBAAoB,GAAG,sBAAsB;AAACF,OAAA,CAAAE,oBAAA,GAAAA,oBAAA;AACpD,MAAMC,mBAAmB,GAAG,EAAE;AAACH,OAAA,CAAAG,mBAAA,GAAAA,mBAAA;AAC/B,MAAMC,qBAAqB,GAAG,EAAE;AAACJ,OAAA,CAAAI,qBAAA,GAAAA,qBAAA;AACjC,MAAMC,mBAAmB,GAAG,CAAC;AAACL,OAAA,CAAAK,mBAAA,GAAAA,mBAAA;AAAA,IAEzBC,MAAM,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA;AAQlB;AACA;AACA;AACA;AAHAN,OAAA,CAAAM,MAAA,GAAAA,MAAA;AAAA,IAIYC,OAAO,0BAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAA,OAAPA,OAAO;AAAA;AAAAP,OAAA,CAAAO,OAAA,GAAAA,OAAA"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.REAL_TIME_EVENT = void 0;
|
|
4
|
-
|
|
7
|
+
const REAL_TIME_EVENT = 'configuration-update-event';
|
|
8
|
+
exports.REAL_TIME_EVENT = REAL_TIME_EVENT;
|
|
5
9
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","
|
|
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":";;;;;;AAAO,MAAMA,eAAe,GAAG,4BAA4B;AAACC,OAAA,CAAAD,eAAA,GAAAA,eAAA"}
|
|
@@ -1,26 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.ExternalEventSource = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
var _requester = require("../requester");
|
|
8
|
+
var _constants = require("../requester/constants");
|
|
9
|
+
var _constants2 = require("./constants");
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
13
|
class ExternalEventSource {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
constructor(siteCode, externalEventSource) {
|
|
15
|
+
_defineProperty(this, "eventSource", void 0);
|
|
16
|
+
_defineProperty(this, "siteCode", void 0);
|
|
17
|
+
const url = _requester.URL.EVENTS + _constants.UrlQuery.Sse + siteCode;
|
|
18
|
+
const eventSource = externalEventSource.initialize(url);
|
|
19
|
+
this.eventSource = eventSource;
|
|
20
|
+
this.siteCode = siteCode;
|
|
21
|
+
}
|
|
22
|
+
open(onEvent) {
|
|
23
|
+
this.eventSource.open({
|
|
24
|
+
onEvent,
|
|
25
|
+
siteCode: this.siteCode,
|
|
26
|
+
eventType: _constants2.REAL_TIME_EVENT
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
close() {
|
|
30
|
+
this.eventSource.close();
|
|
31
|
+
}
|
|
24
32
|
}
|
|
25
33
|
exports.ExternalEventSource = ExternalEventSource;
|
|
26
34
|
//# sourceMappingURL=externalEventSource.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"externalEventSource.js","
|
|
1
|
+
{"version":3,"file":"externalEventSource.js","names":["_requester","require","_constants","_constants2","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","ExternalEventSource","constructor","siteCode","externalEventSource","url","URL","EVENTS","UrlQuery","Sse","eventSource","initialize","open","onEvent","eventType","REAL_TIME_EVENT","close","exports"],"sources":["../../src/eventSource/externalEventSource.ts"],"sourcesContent":["import { URL } from '../requester';\nimport { UrlQuery } from '../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.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":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAA8C,SAAAG,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAAA,QAAAC,GAAA,GAAAJ,IAAA,CAAAK,IAAA,CAAAP,KAAA,EAAAC,IAAA,2BAAAK,GAAA,sBAAAA,GAAA,YAAAE,SAAA,4DAAAP,IAAA,gBAAAF,MAAA,GAAAU,MAAA,EAAAT,KAAA;AAQvC,MAAMU,mBAAmB,CAAyB;EAIvDC,WAAWA,CACTC,QAAgB,EAChBC,mBAAoD,EACpD;IAAA1B,eAAA;IAAAA,eAAA;IACA,MAAM2B,GAAG,GAAGC,cAAG,CAACC,MAAM,GAAGC,mBAAQ,CAACC,GAAG,GAAGN,QAAQ;IAChD,MAAMO,WAAW,GAAGN,mBAAmB,CAACO,UAAU,CAACN,GAAG,CAAC;IAEvD,IAAI,CAACK,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACP,QAAQ,GAAGA,QAAQ;EAC1B;EAEOS,IAAIA,CAACC,OAAoC,EAAQ;IACtD,IAAI,CAACH,WAAW,CAACE,IAAI,CAAC;MACpBC,OAAO;MACPV,QAAQ,EAAE,IAAI,CAACA,QAAQ;MACvBW,SAAS,EAAEC;IACb,CAAC,CAAC;EACJ;EAEOC,KAAKA,CAAA,EAAS;IACnB,IAAI,CAACN,WAAW,CAACM,KAAK,EAAE;EAC1B;AACF;AAACC,OAAA,CAAAhB,mBAAA,GAAAA,mBAAA"}
|
|
@@ -1,8 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "EventSourceOpenParametersType", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _types.EventSourceOpenParametersType;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "ExternalEventSource", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _externalEventSource.ExternalEventSource;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "IEventSource", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _externalEventSource.IEventSource;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "IExternalEventSource", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _types.IExternalEventSource;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "IExternalEventSourceConstructor", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _types.IExternalEventSourceConstructor;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "REAL_TIME_EVENT", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _constants.REAL_TIME_EVENT;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "RealTimeEventType", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _types.RealTimeEventType;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
var _types = require("./types");
|
|
49
|
+
var _externalEventSource = require("./externalEventSource");
|
|
50
|
+
var _constants = require("./constants");
|
|
8
51
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_types","require","_externalEventSource","_constants"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAMA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @interface an interface of External Constructor for
|
|
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
3
|
* */
|
|
4
4
|
export interface IExternalEventSourceConstructor {
|
|
5
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","
|
|
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ObtainExperimentHashDoubleParamsType, ObtainFeatureFlagHashDoubleParamsType } from './types';
|
|
2
2
|
export declare class Hasher {
|
|
3
3
|
static obtainExperimentHashDouble({ visitorCode, campaignId, respoolTime, }: ObtainExperimentHashDoubleParamsType): number;
|
|
4
|
-
static obtainFeatureFlagHashDouble({ visitorCode, campaignId,
|
|
4
|
+
static obtainFeatureFlagHashDouble({ visitorCode, campaignId, respoolTime, }: ObtainFeatureFlagHashDoubleParamsType): number;
|
|
5
5
|
static calculateHash(seed: string): number;
|
|
6
6
|
}
|
package/dist/hasher/hasher.js
CHANGED
|
@@ -1,34 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.Hasher = void 0;
|
|
4
|
-
|
|
5
|
-
const constants_1 = require("./constants");
|
|
7
|
+
var _cryptoJs = require("crypto-js");
|
|
6
8
|
class Hasher {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
static obtainExperimentHashDouble({
|
|
10
|
+
visitorCode,
|
|
11
|
+
campaignId,
|
|
12
|
+
respoolTime
|
|
13
|
+
}) {
|
|
14
|
+
let respoolTimeString = '';
|
|
15
|
+
if (respoolTime.length) {
|
|
16
|
+
respoolTime.forEach(respoolObject => {
|
|
17
|
+
respoolTimeString += String(respoolObject.value);
|
|
18
|
+
});
|
|
15
19
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// `calculateHash` algorythm is consistent between every SDK
|
|
27
|
-
// and will always provide same pseudo-random value for the same input parameters
|
|
28
|
-
static calculateHash(seed) {
|
|
29
|
-
const hashDigest = (0, crypto_js_1.SHA256)(seed).toString();
|
|
30
|
-
return parseInt(hashDigest, 16) / Math.pow(2, 256);
|
|
20
|
+
return this.calculateHash(visitorCode + campaignId + respoolTimeString);
|
|
21
|
+
}
|
|
22
|
+
static obtainFeatureFlagHashDouble({
|
|
23
|
+
visitorCode,
|
|
24
|
+
campaignId,
|
|
25
|
+
respoolTime
|
|
26
|
+
}) {
|
|
27
|
+
let suffix = '';
|
|
28
|
+
if (respoolTime) {
|
|
29
|
+
suffix += String(respoolTime);
|
|
31
30
|
}
|
|
31
|
+
return this.calculateHash(visitorCode + campaignId + suffix);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// --- Note ---
|
|
35
|
+
// `hashDouble` is a seeded pseudo-random number between 0 and 1
|
|
36
|
+
// used for deciding what variation to assign
|
|
37
|
+
// `calculateHash` algorithm is consistent between every SDK
|
|
38
|
+
// and will always provide same pseudo-random value for the same input parameters
|
|
39
|
+
static calculateHash(seed) {
|
|
40
|
+
const hashDigest = (0, _cryptoJs.SHA256)(seed).toString();
|
|
41
|
+
return parseInt(hashDigest, 16) / Math.pow(2, 256);
|
|
42
|
+
}
|
|
32
43
|
}
|
|
33
44
|
exports.Hasher = Hasher;
|
|
34
45
|
//# sourceMappingURL=hasher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasher.js","
|
|
1
|
+
{"version":3,"file":"hasher.js","names":["_cryptoJs","require","Hasher","obtainExperimentHashDouble","visitorCode","campaignId","respoolTime","respoolTimeString","length","forEach","respoolObject","String","value","calculateHash","obtainFeatureFlagHashDouble","suffix","seed","hashDigest","SHA256","toString","parseInt","Math","pow","exports"],"sources":["../../src/hasher/hasher.ts"],"sourcesContent":["import { SHA256 } from 'crypto-js';\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,SAAA,GAAAC,OAAA;AAMO,MAAMC,MAAM,CAAC;EAClB,OAAOC,0BAA0BA,CAAC;IAChCC,WAAW;IACXC,UAAU;IACVC;EACoC,CAAC,EAAU;IAC/C,IAAIC,iBAAiB,GAAG,EAAE;IAE1B,IAAID,WAAW,CAACE,MAAM,EAAE;MACtBF,WAAW,CAACG,OAAO,CAAEC,aAAa,IAAK;QACrCH,iBAAiB,IAAII,MAAM,CAACD,aAAa,CAACE,KAAK,CAAC;MAClD,CAAC,CAAC;IACJ;IAEA,OAAO,IAAI,CAACC,aAAa,CAACT,WAAW,GAAGC,UAAU,GAAGE,iBAAiB,CAAC;EACzE;EAEA,OAAOO,2BAA2BA,CAAC;IACjCV,WAAW;IACXC,UAAU;IACVC;EACqC,CAAC,EAAU;IAChD,IAAIS,MAAM,GAAG,EAAE;IAEf,IAAIT,WAAW,EAAE;MACfS,MAAM,IAAIJ,MAAM,CAACL,WAAW,CAAC;IAC/B;IAEA,OAAO,IAAI,CAACO,aAAa,CAACT,WAAW,GAAGC,UAAU,GAAGU,MAAM,CAAC;EAC9D;;EAEA;EACA;EACA;EACA;EACA;EACA,OAAOF,aAAaA,CAACG,IAAY,EAAU;IACzC,MAAMC,UAAU,GAAG,IAAAC,gBAAM,EAACF,IAAI,CAAC,CAACG,QAAQ,EAAE;IAE1C,OAAOC,QAAQ,CAACH,UAAU,EAAE,EAAE,CAAC,GAAGI,IAAI,CAACC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC;EACpD;AACF;AAACC,OAAA,CAAArB,MAAA,GAAAA,MAAA"}
|
package/dist/hasher/index.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Hasher", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _hasher.Hasher;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _hasher = require("./hasher");
|
|
6
13
|
//# sourceMappingURL=index.js.map
|
package/dist/hasher/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_hasher","require"],"sources":["../../src/hasher/index.ts"],"sourcesContent":["export { Hasher } from './hasher';\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA"}
|
package/dist/hasher/types.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ export type ObtainExperimentHashDoubleParamsType = ObtainHashDoubleParamsType &
|
|
|
7
7
|
respoolTime: RespoolTimeType[];
|
|
8
8
|
};
|
|
9
9
|
export type ObtainFeatureFlagHashDoubleParamsType = ObtainHashDoubleParamsType & {
|
|
10
|
-
|
|
10
|
+
respoolTime: number | null;
|
|
11
11
|
};
|
|
12
12
|
export {};
|
package/dist/hasher/types.js
CHANGED
package/dist/hasher/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/hasher/types.ts"],"sourcesContent":["import { RespoolTimeType } from '../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
CHANGED
|
@@ -2,9 +2,11 @@ export { KameleoonClient as KameleoonCore, IKameleoonClient as IKameleoonCore, }
|
|
|
2
2
|
export { KameleoonUtils as KameleoonCoreUtils } from './kameleoonUtils';
|
|
3
3
|
export { KameleoonException, KameleoonError } from './kameleoonError';
|
|
4
4
|
export { KameleoonStorageKey, IExternalStorage, IExternalStorageConstructor, } from './storage';
|
|
5
|
-
export { Cookie, VISITOR_CODE_LENGTH } from './constants';
|
|
5
|
+
export { Cookie, VISITOR_CODE_LENGTH, SDKType } from './constants';
|
|
6
|
+
export { CLEANUP_TARGETING_DATA_INTERVAL } from './campaignConfiguration';
|
|
6
7
|
export { JSONType } from './campaignConfiguration';
|
|
7
8
|
export { Ok, Result, Err } from 'ts-res';
|
|
8
|
-
export { Environment, VariableType, ExperimentType, FeatureFlagType, SDKCoreParameters, SDKConfigurationType, TrackConversionParamsType, FeatureVariableResultType, InternalSDKConfigurationType, GetFeatureFlagVariableParamsType, ServerGetVisitorCodeParametersType, ClientGetVisitorCodeParametersType, MobileGetVisitorCodeParametersType, } from './types';
|
|
9
|
+
export { Environment, VariableType, ExperimentType, FeatureFlagType, SDKCoreParameters, SDKConfigurationType, ExternalPackageInfoType, TrackConversionParamsType, FeatureVariableResultType, InternalSDKConfigurationType, GetFeatureFlagVariableParamsType, ServerGetVisitorCodeParametersType, ClientGetVisitorCodeParametersType, MobileGetVisitorCodeParametersType, } from './types';
|
|
9
10
|
export { CustomData, Conversion, Device, Browser, DeviceType, BrowserType, PageView, KameleoonDataType, PageViewParametersType, ConversionParametersType, } from './kameleoonData';
|
|
10
11
|
export { RealTimeEventType, IExternalEventSource, EventSourceOpenParametersType, IExternalEventSourceConstructor, } from './eventSource';
|
|
12
|
+
export { Header, HttpMethod, TrackParametersType, IExternalRequestDispatcher, GetClientConfigurationResultType, } from './requester';
|