@kameleoon/javascript-sdk-core 1.1.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/dist/campaignConfiguration/campaignConfiguration.d.ts +2 -1
  2. package/dist/campaignConfiguration/campaignConfiguration.js +239 -197
  3. package/dist/campaignConfiguration/campaignConfiguration.js.map +1 -1
  4. package/dist/campaignConfiguration/constants.js +20 -14
  5. package/dist/campaignConfiguration/constants.js.map +1 -1
  6. package/dist/campaignConfiguration/index.js +78 -6
  7. package/dist/campaignConfiguration/index.js.map +1 -1
  8. package/dist/campaignConfiguration/types.d.ts +3 -2
  9. package/dist/campaignConfiguration/types.js +53 -45
  10. package/dist/campaignConfiguration/types.js.map +1 -1
  11. package/dist/clientSettings/clientSettings.d.ts +1 -1
  12. package/dist/clientSettings/clientSettings.js +28 -21
  13. package/dist/clientSettings/clientSettings.js.map +1 -1
  14. package/dist/clientSettings/index.js +18 -4
  15. package/dist/clientSettings/index.js.map +1 -1
  16. package/dist/clientSettings/types.d.ts +1 -1
  17. package/dist/clientSettings/types.js +4 -1
  18. package/dist/clientSettings/types.js.map +1 -1
  19. package/dist/constants.js +22 -14
  20. package/dist/constants.js.map +1 -1
  21. package/dist/eventSource/constants.js +6 -2
  22. package/dist/eventSource/constants.js.map +1 -1
  23. package/dist/eventSource/externalEventSource.js +28 -20
  24. package/dist/eventSource/externalEventSource.js.map +1 -1
  25. package/dist/eventSource/index.js +49 -6
  26. package/dist/eventSource/index.js.map +1 -1
  27. package/dist/eventSource/types.d.ts +1 -1
  28. package/dist/eventSource/types.js +4 -1
  29. package/dist/eventSource/types.js.map +1 -1
  30. package/dist/hasher/constants.js +6 -2
  31. package/dist/hasher/constants.js.map +1 -1
  32. package/dist/hasher/hasher.js +35 -24
  33. package/dist/hasher/hasher.js.map +1 -1
  34. package/dist/hasher/index.js +11 -4
  35. package/dist/hasher/index.js.map +1 -1
  36. package/dist/hasher/types.js +4 -1
  37. package/dist/hasher/types.js.map +1 -1
  38. package/dist/index.d.ts +2 -1
  39. package/dist/index.js +297 -28
  40. package/dist/index.js.map +1 -1
  41. package/dist/kameleoonClient.d.ts +16 -16
  42. package/dist/kameleoonClient.js +307 -236
  43. package/dist/kameleoonClient.js.map +1 -1
  44. package/dist/kameleoonData/browser.js +37 -32
  45. package/dist/kameleoonData/browser.js.map +1 -1
  46. package/dist/kameleoonData/constants.js +6 -2
  47. package/dist/kameleoonData/constants.js.map +1 -1
  48. package/dist/kameleoonData/conversion.js +47 -40
  49. package/dist/kameleoonData/conversion.js.map +1 -1
  50. package/dist/kameleoonData/customData.js +62 -58
  51. package/dist/kameleoonData/customData.js.map +1 -1
  52. package/dist/kameleoonData/device.js +37 -32
  53. package/dist/kameleoonData/device.js.map +1 -1
  54. package/dist/kameleoonData/index.js +101 -18
  55. package/dist/kameleoonData/index.js.map +1 -1
  56. package/dist/kameleoonData/nonce.js +25 -13
  57. package/dist/kameleoonData/nonce.js.map +1 -1
  58. package/dist/kameleoonData/pageView.js +52 -44
  59. package/dist/kameleoonData/pageView.js.map +1 -1
  60. package/dist/kameleoonData/types.js +41 -26
  61. package/dist/kameleoonData/types.js.map +1 -1
  62. package/dist/kameleoonData/userAgent.js +33 -24
  63. package/dist/kameleoonData/userAgent.js.map +1 -1
  64. package/dist/kameleoonError/constants.js +25 -21
  65. package/dist/kameleoonError/constants.js.map +1 -1
  66. package/dist/kameleoonError/helpers.js +6 -4
  67. package/dist/kameleoonError/helpers.js.map +1 -1
  68. package/dist/kameleoonError/index.js +25 -8
  69. package/dist/kameleoonError/index.js.map +1 -1
  70. package/dist/kameleoonError/kameleoonError.js +64 -53
  71. package/dist/kameleoonError/kameleoonError.js.map +1 -1
  72. package/dist/kameleoonError/types.js +26 -22
  73. package/dist/kameleoonError/types.js.map +1 -1
  74. package/dist/kameleoonUtils.js +34 -33
  75. package/dist/kameleoonUtils.js.map +1 -1
  76. package/dist/requester/constants.d.ts +6 -7
  77. package/dist/requester/constants.js +58 -45
  78. package/dist/requester/constants.js.map +1 -1
  79. package/dist/requester/index.d.ts +2 -2
  80. package/dist/requester/index.js +67 -8
  81. package/dist/requester/index.js.map +1 -1
  82. package/dist/requester/requester.d.ts +7 -7
  83. package/dist/requester/requester.js +100 -113
  84. package/dist/requester/requester.js.map +1 -1
  85. package/dist/requester/types.d.ts +38 -10
  86. package/dist/requester/types.js +14 -36
  87. package/dist/requester/types.js.map +1 -1
  88. package/dist/storage/constants.js +11 -7
  89. package/dist/storage/constants.js.map +1 -1
  90. package/dist/storage/externalStorage.js +33 -26
  91. package/dist/storage/externalStorage.js.map +1 -1
  92. package/dist/storage/index.js +55 -6
  93. package/dist/storage/index.js.map +1 -1
  94. package/dist/storage/types.js +4 -1
  95. package/dist/storage/types.js.map +1 -1
  96. package/dist/targeting/conditions/conditionFactory.js +24 -19
  97. package/dist/targeting/conditions/conditionFactory.js.map +1 -1
  98. package/dist/targeting/conditions/customDataCondition.js +99 -88
  99. package/dist/targeting/conditions/customDataCondition.js.map +1 -1
  100. package/dist/targeting/conditions/exclusiveExperimentCondition.js +27 -15
  101. package/dist/targeting/conditions/exclusiveExperimentCondition.js.map +1 -1
  102. package/dist/targeting/conditions/index.js +45 -10
  103. package/dist/targeting/conditions/index.js.map +1 -1
  104. package/dist/targeting/conditions/targetExperimentCondition.js +54 -32
  105. package/dist/targeting/conditions/targetExperimentCondition.js.map +1 -1
  106. package/dist/targeting/conditions/types.js +4 -1
  107. package/dist/targeting/conditions/types.js.map +1 -1
  108. package/dist/targeting/index.js +79 -13
  109. package/dist/targeting/index.js.map +1 -1
  110. package/dist/targeting/targetingNode.js +41 -33
  111. package/dist/targeting/targetingNode.js.map +1 -1
  112. package/dist/targeting/targetingTree.js +125 -104
  113. package/dist/targeting/targetingTree.js.map +1 -1
  114. package/dist/targeting/types.js +99 -91
  115. package/dist/targeting/types.js.map +1 -1
  116. package/dist/types.d.ts +17 -2
  117. package/dist/types.js +50 -21
  118. package/dist/types.js.map +1 -1
  119. package/dist/utilities/constants.js +6 -2
  120. package/dist/utilities/constants.js.map +1 -1
  121. package/dist/utilities/index.js +11 -4
  122. package/dist/utilities/index.js.map +1 -1
  123. package/dist/utilities/types.d.ts +1 -1
  124. package/dist/utilities/types.js +4 -1
  125. package/dist/utilities/types.js.map +1 -1
  126. package/dist/utilities/utilities.d.ts +2 -2
  127. package/dist/utilities/utilities.js +117 -105
  128. package/dist/utilities/utilities.js.map +1 -1
  129. package/dist/variationConfiguration/index.js +24 -4
  130. package/dist/variationConfiguration/index.js.map +1 -1
  131. package/dist/variationConfiguration/types.js +4 -1
  132. package/dist/variationConfiguration/types.js.map +1 -1
  133. package/dist/variationConfiguration/variation.js +35 -28
  134. package/dist/variationConfiguration/variation.js.map +1 -1
  135. package/dist/variationConfiguration/variationConfiguration.d.ts +5 -5
  136. package/dist/variationConfiguration/variationConfiguration.js +270 -228
  137. package/dist/variationConfiguration/variationConfiguration.js.map +1 -1
  138. package/package.json +6 -4
@@ -1,10 +1,27 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.exhaustCheck = exports.KameleoonException = exports.KameleoonError = void 0;
4
- var kameleoonError_1 = require("./kameleoonError");
5
- Object.defineProperty(exports, "KameleoonError", { enumerable: true, get: function () { return kameleoonError_1.KameleoonError; } });
6
- var types_1 = require("./types");
7
- Object.defineProperty(exports, "KameleoonException", { enumerable: true, get: function () { return types_1.KameleoonException; } });
8
- var helpers_1 = require("./helpers");
9
- Object.defineProperty(exports, "exhaustCheck", { enumerable: true, get: function () { return helpers_1.exhaustCheck; } });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "KameleoonError", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _kameleoonError.KameleoonError;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "KameleoonException", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _types.KameleoonException;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "exhaustCheck", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _helpers.exhaustCheck;
22
+ }
23
+ });
24
+ var _kameleoonError = require("./kameleoonError");
25
+ var _types = require("./types");
26
+ var _helpers = require("./helpers");
10
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/kameleoonError/index.ts"],"names":[],"mappings":";;;AAAA,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,iCAA6C;AAApC,2GAAA,kBAAkB,OAAA;AAC3B,qCAAyC;AAAhC,uGAAA,YAAY,OAAA"}
1
+ {"version":3,"file":"index.js","names":["_kameleoonError","require","_types","_helpers"],"sources":["../../src/kameleoonError/index.ts"],"sourcesContent":["export { KameleoonError } from './kameleoonError';\nexport { KameleoonException } from './types';\nexport { exhaustCheck } from './helpers';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA"}
@@ -1,64 +1,75 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.KameleoonError = void 0;
4
- const constants_1 = require("./constants");
5
- const helpers_1 = require("./helpers");
6
- const types_1 = require("./types");
7
+ var _constants = require("./constants");
8
+ var _helpers = require("./helpers");
9
+ var _types = require("./types");
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
  /**
8
14
  * @class
9
15
  * KameleoonError - extends standard `Error` by adding custom `type` property with the type of `KameleoonException`
10
16
  * */
11
17
  class KameleoonError extends Error {
12
- constructor(type, secondParam, thirdParam) {
13
- super(`Error: ${type}`);
14
- this.name = 'KameleoonError';
15
- this.errorType = type;
16
- switch (type) {
17
- case types_1.KameleoonException.Initialization:
18
- case types_1.KameleoonException.ClientConfiguration:
19
- case types_1.KameleoonException.VisitorCodeMaxLength:
20
- case types_1.KameleoonException.DataInconsistency:
21
- case types_1.KameleoonException.StorageInitialization:
22
- case types_1.KameleoonException.EventSourceInitialization:
23
- case types_1.KameleoonException.RemoteData:
24
- this.message = constants_1.ERROR_MESSAGES[type]();
25
- break;
26
- case types_1.KameleoonException.NotAllocated:
27
- case types_1.KameleoonException.NotTargeted:
28
- this.message = constants_1.ERROR_MESSAGES[type](secondParam);
29
- break;
30
- case types_1.KameleoonException.ExperimentConfigurationNotFound:
31
- this.message = constants_1.ERROR_MESSAGES[type](secondParam, thirdParam);
32
- break;
33
- case types_1.KameleoonException.FeatureFlagConfigurationNotFound:
34
- this.message = constants_1.ERROR_MESSAGES[type](secondParam, thirdParam);
35
- break;
36
- case types_1.KameleoonException.StorageWrite:
37
- case types_1.KameleoonException.JSONParse:
38
- this.message = constants_1.ERROR_MESSAGES[type](secondParam);
39
- break;
40
- case types_1.KameleoonException.StorageRead:
41
- this.message = constants_1.ERROR_MESSAGES[type](secondParam);
42
- break;
43
- case types_1.KameleoonException.StorageParse:
44
- this.message = constants_1.ERROR_MESSAGES[type](secondParam, thirdParam);
45
- break;
46
- case types_1.KameleoonException.TargetingCondition:
47
- this.message = constants_1.ERROR_MESSAGES[type](secondParam);
48
- break;
49
- case types_1.KameleoonException.NumberParse:
50
- this.message = constants_1.ERROR_MESSAGES[type](secondParam);
51
- break;
52
- case types_1.KameleoonException.AmongValuesCheck:
53
- this.message = constants_1.ERROR_MESSAGES[type](secondParam, thirdParam);
54
- break;
55
- default:
56
- (0, helpers_1.exhaustCheck)(type);
57
- }
58
- }
59
- get type() {
60
- return this.errorType;
18
+ /**
19
+ * @param {KameleoonException} type - type of KameleoonError represented by `KameleoonException` enum
20
+ * */
21
+
22
+ constructor(type, secondParam, thirdParam) {
23
+ super(`Error: ${type}`);
24
+ _defineProperty(this, "errorType", void 0);
25
+ this.name = 'KameleoonError';
26
+ this.errorType = type;
27
+ switch (type) {
28
+ case _types.KameleoonException.Initialization:
29
+ case _types.KameleoonException.ClientConfiguration:
30
+ case _types.KameleoonException.VisitorCodeMaxLength:
31
+ case _types.KameleoonException.DataInconsistency:
32
+ case _types.KameleoonException.StorageInitialization:
33
+ case _types.KameleoonException.EventSourceInitialization:
34
+ case _types.KameleoonException.RemoteData:
35
+ this.message = _constants.ERROR_MESSAGES[type]();
36
+ break;
37
+ case _types.KameleoonException.NotAllocated:
38
+ case _types.KameleoonException.NotTargeted:
39
+ this.message = _constants.ERROR_MESSAGES[type](secondParam);
40
+ break;
41
+ case _types.KameleoonException.ExperimentConfigurationNotFound:
42
+ this.message = _constants.ERROR_MESSAGES[type](secondParam, thirdParam);
43
+ break;
44
+ case _types.KameleoonException.FeatureFlagConfigurationNotFound:
45
+ this.message = _constants.ERROR_MESSAGES[type](secondParam, thirdParam);
46
+ break;
47
+ case _types.KameleoonException.StorageWrite:
48
+ case _types.KameleoonException.JSONParse:
49
+ this.message = _constants.ERROR_MESSAGES[type](secondParam);
50
+ break;
51
+ case _types.KameleoonException.StorageRead:
52
+ this.message = _constants.ERROR_MESSAGES[type](secondParam);
53
+ break;
54
+ case _types.KameleoonException.StorageParse:
55
+ this.message = _constants.ERROR_MESSAGES[type](secondParam, thirdParam);
56
+ break;
57
+ case _types.KameleoonException.TargetingCondition:
58
+ this.message = _constants.ERROR_MESSAGES[type](secondParam);
59
+ break;
60
+ case _types.KameleoonException.NumberParse:
61
+ this.message = _constants.ERROR_MESSAGES[type](secondParam);
62
+ break;
63
+ case _types.KameleoonException.AmongValuesCheck:
64
+ this.message = _constants.ERROR_MESSAGES[type](secondParam, thirdParam);
65
+ break;
66
+ default:
67
+ (0, _helpers.exhaustCheck)(type);
61
68
  }
69
+ }
70
+ get type() {
71
+ return this.errorType;
72
+ }
62
73
  }
63
74
  exports.KameleoonError = KameleoonError;
64
75
  //# sourceMappingURL=kameleoonError.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"kameleoonError.js","sourceRoot":"","sources":["../../src/kameleoonError/kameleoonError.ts"],"names":[],"mappings":";;;AAEA,2CAA6C;AAC7C,uCAAyC;AACzC,mCAA6C;AAE7C;;;KAGK;AACL,MAAa,cAAe,SAAQ,KAAK;IAkDvC,YACE,IAAwB,EACxB,WAKiB,EACjB,UAAyC;QAEzC,KAAK,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;QAExB,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAEtB,QAAQ,IAAI,EAAE;YACZ,KAAK,0BAAkB,CAAC,cAAc,CAAC;YACvC,KAAK,0BAAkB,CAAC,mBAAmB,CAAC;YAC5C,KAAK,0BAAkB,CAAC,oBAAoB,CAAC;YAC7C,KAAK,0BAAkB,CAAC,iBAAiB,CAAC;YAC1C,KAAK,0BAAkB,CAAC,qBAAqB,CAAC;YAC9C,KAAK,0BAAkB,CAAC,yBAAyB,CAAC;YAClD,KAAK,0BAAkB,CAAC,UAAU;gBAChC,IAAI,CAAC,OAAO,GAAG,0BAAc,CAAC,IAAI,CAAC,EAAE,CAAC;gBACtC,MAAM;YACR,KAAK,0BAAkB,CAAC,YAAY,CAAC;YACrC,KAAK,0BAAkB,CAAC,WAAW;gBACjC,IAAI,CAAC,OAAO,GAAG,0BAAc,CAAC,IAAI,CAAC,CAAC,WAAqB,CAAC,CAAC;gBAC3D,MAAM;YACR,KAAK,0BAAkB,CAAC,+BA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 {"version":3,"file":"kameleoonError.js","names":["_constants","require","_helpers","_types","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","KameleoonError","Error","constructor","type","secondParam","thirdParam","name","errorType","KameleoonException","Initialization","ClientConfiguration","VisitorCodeMaxLength","DataInconsistency","StorageInitialization","EventSourceInitialization","RemoteData","message","ERROR_MESSAGES","NotAllocated","NotTargeted","ExperimentConfigurationNotFound","FeatureFlagConfigurationNotFound","StorageWrite","JSONParse","StorageRead","StorageParse","TargetingCondition","NumberParse","AmongValuesCheck","exhaustCheck","exports"],"sources":["../../src/kameleoonError/kameleoonError.ts"],"sourcesContent":["import { KameleoonStorageKey } from '../storage';\nimport { TargetingType } from '../targeting';\nimport { ERROR_MESSAGES } from './constants';\nimport { exhaustCheck } from './helpers';\nimport { KameleoonException } from './types';\n\n/**\n * @class\n * KameleoonError - extends standard `Error` by adding custom `type` property with the type of `KameleoonException`\n * */\nexport class KameleoonError extends Error {\n private errorType: KameleoonException;\n\n /**\n * @param {KameleoonException} type - type of KameleoonError represented by `KameleoonException` enum\n * */\n constructor(\n type:\n | KameleoonException.Initialization\n | KameleoonException.ClientConfiguration\n | KameleoonException.VisitorCodeMaxLength\n | KameleoonException.DataInconsistency\n | KameleoonException.StorageInitialization\n | KameleoonException.EventSourceInitialization\n | KameleoonException.RemoteData,\n );\n constructor(\n type: KameleoonException.FeatureFlagConfigurationNotFound,\n featureKey: string,\n visitorCode: string,\n );\n constructor(\n type: KameleoonException.NotTargeted | KameleoonException.NotAllocated,\n visitorCode: string,\n );\n constructor(\n type: KameleoonException.ExperimentConfigurationNotFound,\n experimentId: number,\n visitorCode: string,\n );\n constructor(\n type: KameleoonException.StorageWrite | KameleoonException.JSONParse,\n err: unknown,\n );\n constructor(type: KameleoonException.StorageRead, storageKey: string);\n constructor(\n type: KameleoonException.StorageParse,\n err: unknown,\n key: KameleoonStorageKey,\n );\n constructor(\n type: KameleoonException.TargetingCondition,\n targetingType: TargetingType,\n );\n constructor(\n type: KameleoonException.AmongValuesCheck,\n err: unknown,\n value: string,\n );\n constructor(type: KameleoonException.NumberParse, value: string);\n constructor(\n type: KameleoonException,\n secondParam?:\n | number\n | string\n | unknown\n | KameleoonStorageKey\n | TargetingType,\n thirdParam?: string | KameleoonStorageKey,\n ) {\n super(`Error: ${type}`);\n\n this.name = 'KameleoonError';\n this.errorType = type;\n\n switch (type) {\n case KameleoonException.Initialization:\n case KameleoonException.ClientConfiguration:\n case KameleoonException.VisitorCodeMaxLength:\n case KameleoonException.DataInconsistency:\n case KameleoonException.StorageInitialization:\n case KameleoonException.EventSourceInitialization:\n case KameleoonException.RemoteData:\n this.message = ERROR_MESSAGES[type]();\n break;\n case KameleoonException.NotAllocated:\n case KameleoonException.NotTargeted:\n this.message = ERROR_MESSAGES[type](secondParam as string);\n break;\n case KameleoonException.ExperimentConfigurationNotFound:\n this.message = ERROR_MESSAGES[type](\n secondParam as number,\n thirdParam as string,\n );\n break;\n case KameleoonException.FeatureFlagConfigurationNotFound:\n this.message = ERROR_MESSAGES[type](\n secondParam as string,\n thirdParam as string,\n );\n break;\n case KameleoonException.StorageWrite:\n case KameleoonException.JSONParse:\n this.message = ERROR_MESSAGES[type](secondParam);\n break;\n case KameleoonException.StorageRead:\n this.message = ERROR_MESSAGES[type](secondParam as KameleoonStorageKey);\n break;\n case KameleoonException.StorageParse:\n this.message = ERROR_MESSAGES[type](\n secondParam,\n thirdParam as KameleoonStorageKey,\n );\n break;\n case KameleoonException.TargetingCondition:\n this.message = ERROR_MESSAGES[type](secondParam as TargetingType);\n break;\n case KameleoonException.NumberParse:\n this.message = ERROR_MESSAGES[type](secondParam as string);\n break;\n case KameleoonException.AmongValuesCheck:\n this.message = ERROR_MESSAGES[type](secondParam, thirdParam as string);\n break;\n default:\n exhaustCheck(type);\n }\n }\n\n get type(): KameleoonException {\n return this.errorType;\n }\n}\n"],"mappings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,WAAW,CAAW;QAC1D;MACF,KAAKI,yBAAkB,CAACoB,gBAAgB;QACtC,IAAI,CAACZ,OAAO,GAAGC,yBAAc,CAACd,IAAI,CAAC,CAACC,WAAW,EAAEC,UAAU,CAAW;QACtE;MACF;QACE,IAAAwB,qBAAY,EAAC1B,IAAI,CAAC;IAAC;EAEzB;EAEA,IAAIA,IAAIA,CAAA,EAAuB;IAC7B,OAAO,IAAI,CAACI,SAAS;EACvB;AACF;AAACuB,OAAA,CAAA9B,cAAA,GAAAA,cAAA"}
@@ -1,25 +1,29 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.KameleoonException = void 0;
4
- var KameleoonException;
5
- (function (KameleoonException) {
6
- KameleoonException["ExperimentConfigurationNotFound"] = "ExperimentConfigurationNotFound";
7
- KameleoonException["EventSourceInitialization"] = "EventSourceInitialization";
8
- KameleoonException["FeatureFlagConfigurationNotFound"] = "FeatureFlagConfigurationNotFound";
9
- KameleoonException["NotTargeted"] = "NotTargeted";
10
- KameleoonException["NotAllocated"] = "NotAllocated";
11
- KameleoonException["VisitorCodeMaxLength"] = "VisitorCodeMaxLength";
12
- KameleoonException["StorageInitialization"] = "StorageInitialization";
13
- KameleoonException["StorageWrite"] = "StorageWrite";
14
- KameleoonException["StorageRead"] = "StorageRead";
15
- KameleoonException["StorageParse"] = "StorageParse";
16
- KameleoonException["ClientConfiguration"] = "ClientConfiguration";
17
- KameleoonException["TargetingCondition"] = "TargetingCondition";
18
- KameleoonException["AmongValuesCheck"] = "AmongValuesCheck";
19
- KameleoonException["Initialization"] = "Initialization";
20
- KameleoonException["DataInconsistency"] = "DataInconsistency";
21
- KameleoonException["JSONParse"] = "JSONParse";
22
- KameleoonException["NumberParse"] = "NumberParse";
23
- KameleoonException["RemoteData"] = "RemoteData";
24
- })(KameleoonException = exports.KameleoonException || (exports.KameleoonException = {}));
7
+ let KameleoonException = /*#__PURE__*/function (KameleoonException) {
8
+ KameleoonException["ExperimentConfigurationNotFound"] = "ExperimentConfigurationNotFound";
9
+ KameleoonException["EventSourceInitialization"] = "EventSourceInitialization";
10
+ KameleoonException["FeatureFlagConfigurationNotFound"] = "FeatureFlagConfigurationNotFound";
11
+ KameleoonException["NotTargeted"] = "NotTargeted";
12
+ KameleoonException["NotAllocated"] = "NotAllocated";
13
+ KameleoonException["VisitorCodeMaxLength"] = "VisitorCodeMaxLength";
14
+ KameleoonException["StorageInitialization"] = "StorageInitialization";
15
+ KameleoonException["StorageWrite"] = "StorageWrite";
16
+ KameleoonException["StorageRead"] = "StorageRead";
17
+ KameleoonException["StorageParse"] = "StorageParse";
18
+ KameleoonException["ClientConfiguration"] = "ClientConfiguration";
19
+ KameleoonException["TargetingCondition"] = "TargetingCondition";
20
+ KameleoonException["AmongValuesCheck"] = "AmongValuesCheck";
21
+ KameleoonException["Initialization"] = "Initialization";
22
+ KameleoonException["DataInconsistency"] = "DataInconsistency";
23
+ KameleoonException["JSONParse"] = "JSONParse";
24
+ KameleoonException["NumberParse"] = "NumberParse";
25
+ KameleoonException["RemoteData"] = "RemoteData";
26
+ return KameleoonException;
27
+ }({});
28
+ exports.KameleoonException = KameleoonException;
25
29
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/kameleoonError/types.ts"],"names":[],"mappings":";;;AAAA,IAAY,kBAmBX;AAnBD,WAAY,kBAAkB;IAC5B,yFAAmE,CAAA;IACnE,6EAAuD,CAAA;IACvD,2FAAqE,CAAA;IACrE,iDAA2B,CAAA;IAC3B,mDAA6B,CAAA;IAC7B,mEAA6C,CAAA;IAC7C,qEAA+C,CAAA;IAC/C,mDAA6B,CAAA;IAC7B,iDAA2B,CAAA;IAC3B,mDAA6B,CAAA;IAC7B,iEAA2C,CAAA;IAC3C,+DAAyC,CAAA;IACzC,2DAAqC,CAAA;IACrC,uDAAiC,CAAA;IACjC,6DAAuC,CAAA;IACvC,6CAAuB,CAAA;IACvB,iDAA2B,CAAA;IAC3B,+CAAyB,CAAA;AAC3B,CAAC,EAnBW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAmB7B"}
1
+ {"version":3,"file":"types.js","names":["KameleoonException","exports"],"sources":["../../src/kameleoonError/types.ts"],"sourcesContent":["export enum KameleoonException {\n ExperimentConfigurationNotFound = 'ExperimentConfigurationNotFound',\n EventSourceInitialization = 'EventSourceInitialization',\n FeatureFlagConfigurationNotFound = 'FeatureFlagConfigurationNotFound',\n NotTargeted = 'NotTargeted',\n NotAllocated = 'NotAllocated',\n VisitorCodeMaxLength = 'VisitorCodeMaxLength',\n StorageInitialization = 'StorageInitialization',\n StorageWrite = 'StorageWrite',\n StorageRead = 'StorageRead',\n StorageParse = 'StorageParse',\n ClientConfiguration = 'ClientConfiguration',\n TargetingCondition = 'TargetingCondition',\n AmongValuesCheck = 'AmongValuesCheck',\n Initialization = 'Initialization',\n DataInconsistency = 'DataInconsistency',\n JSONParse = 'JSONParse',\n NumberParse = 'NumberParse',\n RemoteData = 'RemoteData',\n}\n"],"mappings":";;;;;;IAAYA,kBAAkB,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;AAAAC,OAAA,CAAAD,kBAAA,GAAAA,kBAAA"}
@@ -1,46 +1,47 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.KameleoonUtils = void 0;
4
- const ts_res_1 = require("ts-res");
5
- const constants_1 = require("./constants");
7
+ var _tsRes = require("ts-res");
8
+ var _constants = require("./constants");
6
9
  /**
7
10
  * @abstract
8
11
  * KameleoonUtils - an abstract class for extending kameleoon utils with pre-defined method signatures
9
12
  * */
10
13
  class KameleoonUtils {
11
- generateRandomString(length) {
12
- const characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
13
- let randomString = '';
14
- if (length < 0) {
15
- return randomString;
16
- }
17
- for (let i = 0; i < length; i++) {
18
- randomString += characters[Math.floor(Math.random() * characters.length)];
19
- }
20
- return randomString;
14
+ generateRandomString(length) {
15
+ const characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
16
+ let randomString = '';
17
+ if (length < 0) {
18
+ return randomString;
21
19
  }
22
- getCookieVisitorCode(cookie) {
23
- const pairs = cookie.split(constants_1.Cookie.PairsDelimiter);
24
- const pair = pairs === null || pairs === void 0 ? void 0 : pairs.find((pair) => {
25
- const [key, _] = pair.split(constants_1.Cookie.KeyValueDelimiter);
26
- return key === constants_1.KAMELEOON_COOKIE_KEY;
27
- });
28
- if (pair) {
29
- const [_, value] = pair.split(constants_1.Cookie.KeyValueDelimiter);
30
- return (0, ts_res_1.Ok)(value);
31
- }
32
- return (0, ts_res_1.Err)();
20
+ for (let i = 0; i < length; i++) {
21
+ randomString += characters[Math.floor(Math.random() * characters.length)];
33
22
  }
34
- getResultCookie({ domain, visitorCode, }) {
35
- const yearSeconds = 60 * 60 * 24 * 365;
36
- const cookieArray = [
37
- constants_1.KAMELEOON_COOKIE_KEY + constants_1.Cookie.KeyValueDelimiter + visitorCode,
38
- constants_1.Cookie.MaxAge + constants_1.Cookie.KeyValueDelimiter + yearSeconds,
39
- constants_1.Cookie.Path + constants_1.Cookie.KeyValueDelimiter + '/',
40
- constants_1.Cookie.Domain + constants_1.Cookie.KeyValueDelimiter + domain,
41
- ];
42
- return cookieArray.join(constants_1.Cookie.PairsDelimiter);
23
+ return randomString;
24
+ }
25
+ getCookieVisitorCode(cookie) {
26
+ const pairs = cookie.split(_constants.Cookie.PairsDelimiter);
27
+ const pair = pairs?.find(pair => {
28
+ const [key, _] = pair.split(_constants.Cookie.KeyValueDelimiter);
29
+ return key === _constants.KAMELEOON_COOKIE_KEY;
30
+ });
31
+ if (pair) {
32
+ const [_, value] = pair.split(_constants.Cookie.KeyValueDelimiter);
33
+ return (0, _tsRes.Ok)(value);
43
34
  }
35
+ return (0, _tsRes.Err)();
36
+ }
37
+ getResultCookie({
38
+ domain,
39
+ visitorCode
40
+ }) {
41
+ const yearSeconds = 60 * 60 * 24 * 365;
42
+ const cookieArray = [_constants.KAMELEOON_COOKIE_KEY + _constants.Cookie.KeyValueDelimiter + visitorCode, _constants.Cookie.MaxAge + _constants.Cookie.KeyValueDelimiter + yearSeconds, _constants.Cookie.Path + _constants.Cookie.KeyValueDelimiter + '/', _constants.Cookie.Domain + _constants.Cookie.KeyValueDelimiter + domain];
43
+ return cookieArray.join(_constants.Cookie.PairsDelimiter);
44
+ }
44
45
  }
45
46
  exports.KameleoonUtils = KameleoonUtils;
46
47
  //# sourceMappingURL=kameleoonUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"kameleoonUtils.js","sourceRoot":"","sources":["../src/kameleoonUtils.ts"],"names":[],"mappings":";;;AAAA,mCAAyC;AACzC,2CAA2D;AAQ3D;;;KAGK;AACL,MAAsB,cAAc;IAQxB,oBAAoB,CAAC,MAAc;QAC3C,MAAM,UAAU,GAAG,sCAAsC,CAAC;QAC1D,IAAI,YAAY,GAAG,EAAE,CAAC;QAEtB,IAAI,MAAM,GAAG,CAAC,EAAE;YACd,OAAO,YAAY,CAAC;SACrB;QAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;YAC/B,YAAY,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG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require","_constants","KameleoonUtils","generateRandomString","length","characters","randomString","i","Math","floor","random","getCookieVisitorCode","cookie","pairs","split","Cookie","PairsDelimiter","pair","find","key","_","KeyValueDelimiter","KAMELEOON_COOKIE_KEY","value","Ok","Err","getResultCookie","domain","visitorCode","yearSeconds","cookieArray","MaxAge","Path","Domain","join","exports"],"sources":["../src/kameleoonUtils.ts"],"sourcesContent":["import { Err, Ok, Result } from 'ts-res';\nimport { Cookie, KAMELEOON_COOKIE_KEY } from './constants';\nimport {\n GetResultCookieParametersType,\n ClientGetVisitorCodeParametersType,\n ServerGetVisitorCodeParametersType,\n MobileGetVisitorCodeParametersType,\n} from './types';\n\n/**\n * @abstract\n * KameleoonUtils - an abstract class for extending kameleoon utils with pre-defined method signatures\n * */\nexport abstract class KameleoonUtils {\n abstract getVisitorCode(\n param:\n | ClientGetVisitorCodeParametersType\n | ServerGetVisitorCodeParametersType\n | MobileGetVisitorCodeParametersType,\n ): string;\n\n protected generateRandomString(length: number): string {\n const characters = 'abcdefghijklmnopqrstuvwxyz0123456789';\n let randomString = '';\n\n if (length < 0) {\n return randomString;\n }\n\n for (let i = 0; i < length; i++) {\n randomString += characters[Math.floor(Math.random() * characters.length)];\n }\n\n return randomString;\n }\n\n protected getCookieVisitorCode(cookie: string): Result<string, void> {\n const pairs = cookie.split(Cookie.PairsDelimiter);\n const pair = pairs?.find((pair) => {\n const [key, _] = pair.split(Cookie.KeyValueDelimiter) as [string, string];\n\n return key === KAMELEOON_COOKIE_KEY;\n });\n\n if (pair) {\n const [_, value] = pair.split(Cookie.KeyValueDelimiter);\n\n return Ok(value);\n }\n\n return Err();\n }\n\n protected getResultCookie({\n domain,\n visitorCode,\n }: GetResultCookieParametersType): string {\n const yearSeconds = 60 * 60 * 24 * 365;\n const cookieArray = [\n KAMELEOON_COOKIE_KEY + Cookie.KeyValueDelimiter + visitorCode,\n Cookie.MaxAge + Cookie.KeyValueDelimiter + yearSeconds,\n Cookie.Path + Cookie.KeyValueDelimiter + '/',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W,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG;IACtC,MAAMC,WAAW,GAAG,CAClBR,+BAAoB,GAAGP,iBAAM,CAACM,iBAAiB,GAAGO,WAAW,EAC7Db,iBAAM,CAACgB,MAAM,GAAGhB,iBAAM,CAACM,iBAAiB,GAAGQ,WAAW,EACtDd,iBAAM,CAACiB,IAAI,GAAGjB,iBAAM,CAACM,iBAAiB,GAAG,GAAG,EAC5CN,iBAAM,CAACkB,MAAM,GAAGlB,iBAAM,CAACM,iBAAiB,GAAGM,MAAM,CAClD;IAED,OAAOG,WAAW,CAACI,IAAI,CAACnB,iBAAM,CAACC,cAAc,CAAC;EAChD;AACF;AAACmB,OAAA,CAAAjC,cAAA,GAAAA,cAAA"}
@@ -1,15 +1,14 @@
1
1
  import { EventType, ParameterType, QueryType, StrictEventTypeRecord, StrictParameterRecord, StrictQueryRecord, StrictTrackingRecord, TrackingType } from './types';
2
2
  export declare enum Header {
3
- KameleoonClient = "Kameleoon-Client",
4
3
  UserAgent = "User-Agent"
5
4
  }
6
- export declare const URL: {
7
- EVENTS: string;
8
- API_SSX: string;
9
- API_DATA: string;
10
- CLIENT_CONFIGURATION: string;
11
- };
12
5
  export declare const UrlEventType: StrictEventTypeRecord<EventType>;
13
6
  export declare const UrlParameter: StrictParameterRecord<ParameterType>;
14
7
  export declare const UrlQuery: StrictQueryRecord<QueryType>;
15
8
  export declare const UrlTracking: StrictTrackingRecord<TrackingType>;
9
+ export declare const URL: {
10
+ EVENTS: string;
11
+ TRACKING: string;
12
+ DATA: string;
13
+ CLIENT_CONFIGURATION: string;
14
+ };
@@ -1,53 +1,66 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.UrlTracking = exports.UrlQuery = exports.UrlParameter = exports.UrlEventType = exports.URL = exports.Header = void 0;
4
- var Header;
5
- (function (Header) {
6
- Header["KameleoonClient"] = "Kameleoon-Client";
7
- Header["UserAgent"] = "User-Agent";
8
- })(Header = exports.Header || (exports.Header = {}));
9
- const topLevelDomain = process.env.NODE_ENV === 'test' ? 'net' : 'com';
10
- exports.URL = {
11
- EVENTS: `https://events.kameleoon.${topLevelDomain}:8110/`,
12
- API_SSX: `https://api-ssx.kameleoon.${topLevelDomain}/`,
13
- API_DATA: `https://api-data.kameleoon.${topLevelDomain}/`,
14
- CLIENT_CONFIGURATION: `https://client-config.kameleoon.${topLevelDomain}/`,
7
+ let Header = /*#__PURE__*/function (Header) {
8
+ Header["UserAgent"] = "User-Agent";
9
+ return Header;
10
+ }({});
11
+ exports.Header = Header;
12
+ const topLevelDomain = undefined === 'test' ? 'net' : 'com';
13
+ const dataTopLevelDomain = undefined === 'test' ? 'net' : 'io';
14
+ const UrlEventType = {
15
+ CustomData: 'eventType=customData',
16
+ StaticData: 'eventType=staticData',
17
+ Page: 'eventType=page',
18
+ Conversion: 'eventType=conversion',
19
+ Activity: 'eventType=activity',
20
+ Experiment: 'eventType=experiment'
15
21
  };
16
- exports.UrlEventType = {
17
- CustomData: 'eventType=customData',
18
- StaticData: 'eventType=staticData',
19
- Page: 'eventType=page',
20
- Conversion: 'eventType=conversion',
22
+ exports.UrlEventType = UrlEventType;
23
+ const UrlParameter = {
24
+ Title: '&title=',
25
+ ReferrersIndices: '&referrersIndices=',
26
+ Negative: '&negative=',
27
+ Revenue: '&revenue=',
28
+ Overwrite: '&overwrite=',
29
+ Index: '&index=',
30
+ BrowserIndex: '&browserIndex=',
31
+ Href: '&href=',
32
+ DeviceType: '&deviceType=',
33
+ SiteCode: '&siteCode=',
34
+ GoalId: '&goalId=',
35
+ VisitorCode: '&visitorCode=',
36
+ Environment: '&environment=',
37
+ VariationId: '&variationId=',
38
+ Ts: '&ts=',
39
+ Key: '&key=',
40
+ SdkName: '&sdkName=',
41
+ SdkVersion: '&sdkVersion=',
42
+ ValuesCountMap: '&valuesCountMap=',
43
+ Nonce: '&nonce=',
44
+ Id: '&id='
21
45
  };
22
- exports.UrlParameter = {
23
- ValueToCount: '&valueToCount=',
24
- Nonce: '&nonce=',
25
- Title: '&title=',
26
- ReferrersIndices: '&referrersIndices=',
27
- Negative: '&negative=',
28
- Revenue: '&revenue=',
29
- Overwrite: '&overwrite=',
30
- Index: '&index=',
31
- BrowserIndex: '&browserIndex=',
32
- Href: '&href=',
33
- DeviceType: '&deviceType=',
34
- SiteCode: '&siteCode=',
35
- GoalId: '&goalId=',
36
- VisitorCode: '&visitorCode=',
37
- ExperimentId: '&experimentId=',
38
- Environment: '&environment=',
39
- VariationId: '&variationId=',
40
- NoneVariation: '&noneVariation=',
41
- Ts: '&ts=',
42
- Key: '&key=',
46
+ exports.UrlParameter = UrlParameter;
47
+ const UrlQuery = {
48
+ Sse: 'sse?siteCode=',
49
+ Mobile: 'mobile?siteCode=',
50
+ Map: 'map?siteCode=',
51
+ Events: 'events?siteCode='
43
52
  };
44
- exports.UrlQuery = {
45
- Data: 'data?siteCode=',
46
- Sse: 'sse?siteCode=',
47
- Mobile: 'mobile?siteCode=',
53
+ exports.UrlQuery = UrlQuery;
54
+ const UrlTracking = {
55
+ Visit: 'visit/',
56
+ Map: 'map/'
48
57
  };
49
- exports.UrlTracking = {
50
- Experiment: 'experimentTracking?',
51
- Data: 'dataTracking?',
58
+ exports.UrlTracking = UrlTracking;
59
+ const URL = {
60
+ EVENTS: `https://events.kameleoon.${topLevelDomain}:8110/`,
61
+ TRACKING: `https://data.kameleoon.${dataTopLevelDomain}/${UrlTracking.Visit + UrlQuery.Events}`,
62
+ DATA: `https://data.kameleoon.${dataTopLevelDomain}/${UrlTracking.Map + UrlQuery.Map}`,
63
+ CLIENT_CONFIGURATION: `https://client-config.kameleoon.${topLevelDomain}/`
52
64
  };
65
+ exports.URL = URL;
53
66
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/requester/constants.ts"],"names":[],"mappings":";;;AAWA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B;CAC3B,CAAC;AACW,QAAA,WAAW,GAAuC;IAC7D,UAAU,EAAE,qBAAqB;IACjC,IAAI,EAAE,eAAe;CACtB,CAAC"}
1
+ {"version":3,"file":"constants.js","names":["Header","exports","topLevelDomain","undefined","dataTopLevelDomain","UrlEventType","CustomData","StaticData","Page","Conversion","Activity","Experiment","UrlParameter","Title","ReferrersIndices","Negative","Revenue","Overwrite","Index","BrowserIndex","Href","DeviceType","SiteCode","GoalId","VisitorCode","Environment","VariationId","Ts","Key","SdkName","SdkVersion","ValuesCountMap","Nonce","Id","UrlQuery","Sse","Mobile","Map","Events","UrlTracking","Visit","URL","EVENTS","TRACKING","DATA","CLIENT_CONFIGURATION"],"sources":["../../src/requester/constants.ts"],"sourcesContent":["import {\n EventType,\n ParameterType,\n QueryType,\n StrictEventTypeRecord,\n StrictParameterRecord,\n StrictQueryRecord,\n StrictTrackingRecord,\n TrackingType,\n} from './types';\n\nexport enum Header {\n UserAgent = 'User-Agent',\n}\nconst topLevelDomain = process.env.NODE_ENV === 'test' ? 'net' : 'com';\nconst dataTopLevelDomain = process.env.NODE_ENV === 'test' ? 'net' : 'io';\n\nexport const UrlEventType: StrictEventTypeRecord<EventType> = {\n CustomData: 'eventType=customData',\n StaticData: 'eventType=staticData',\n Page: 'eventType=page',\n Conversion: 'eventType=conversion',\n Activity: 'eventType=activity',\n Experiment: 'eventType=experiment',\n};\nexport const UrlParameter: StrictParameterRecord<ParameterType> = {\n Title: '&title=',\n ReferrersIndices: '&referrersIndices=',\n Negative: '&negative=',\n Revenue: '&revenue=',\n Overwrite: '&overwrite=',\n Index: '&index=',\n BrowserIndex: '&browserIndex=',\n Href: '&href=',\n DeviceType: '&deviceType=',\n SiteCode: '&siteCode=',\n GoalId: '&goalId=',\n VisitorCode: '&visitorCode=',\n Environment: '&environment=',\n VariationId: '&variationId=',\n Ts: '&ts=',\n Key: '&key=',\n SdkName: '&sdkName=',\n SdkVersion: '&sdkVersion=',\n ValuesCountMap: '&valuesCountMap=',\n Nonce: '&nonce=',\n Id: '&id=',\n};\nexport const UrlQuery: StrictQueryRecord<QueryType> = {\n Sse: 'sse?siteCode=',\n Mobile: 'mobile?siteCode=',\n Map: 'map?siteCode=',\n Events: 'events?siteCode=',\n};\nexport const UrlTracking: StrictTrackingRecord<TrackingType> = {\n Visit: 'visit/',\n Map: 'map/',\n};\n\nexport const URL = {\n EVENTS: `https://events.kameleoon.${topLevelDomain}:8110/`,\n TRACKING: `https://data.kameleoon.${dataTopLevelDomain}/${\n UrlTracking.Visit + UrlQuery.Events\n }`,\n DATA: `https://data.kameleoon.${dataTopLevelDomain}/${\n UrlTracking.Map + UrlQuery.Map\n }`,\n CLIENT_CONFIGURATION: `https://client-config.kameleoon.${topLevelDomain}/`,\n};\n"],"mappings":";;;;;;IAWYA,MAAM,0BAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA;AAAAC,OAAA,CAAAD,MAAA,GAAAA,MAAA;AAGlB,MAAME,cAAc,GAAGC,SAAA,KAAyB,MAAM,GAAG,KAAK,GAAG,KAAK;AACtE,MAAMC,kBAAkB,GAAGD,SAAA,KAAyB,MAAM,GAAG,KAAK,GAAG,IAAI;AAElE,MAAME,YAA8C,GAAG;EAC5DC,UAAU,EAAE,sBAAsB;EAClCC,UAAU,EAAE,sBAAsB;EAClCC,IAAI,EAAE,gBAAgB;EACtBC,UAAU,EAAE,sBAAsB;EAClCC,QAAQ,EAAE,oBAAoB;EAC9BC,UAAU,EAAE;AACd,CAAC;AAACV,OAAA,CAAAI,YAAA,GAAAA,YAAA;AACK,MAAMO,YAAkD,GAAG;EAChEC,KAAK,EAAE,SAAS;EAChBC,gBAAgB,EAAE,oBAAoB;EACtCC,QAAQ,EAAE,YAAY;EACtBC,OAAO,EAAE,WAAW;EACpBC,SAAS,EAAE,aAAa;EACxBC,KAAK,EAAE,SAAS;EAChBC,YAAY,EAAE,gBAAgB;EAC9BC,IAAI,EAAE,QAAQ;EACdC,UAAU,EAAE,cAAc;EAC1BC,QAAQ,EAAE,YAAY;EACtBC,MAAM,EAAE,UAAU;EAClBC,WAAW,EAAE,eAAe;EAC5BC,WAAW,EAAE,eAAe;EAC5BC,WAAW,EAAE,eAAe;EAC5BC,EAAE,EAAE,MAAM;EACVC,GAAG,EAAE,OAAO;EACZC,OAAO,EAAE,WAAW;EACpBC,UAAU,EAAE,cAAc;EAC1BC,cAAc,EAAE,kBAAkB;EAClCC,KAAK,EAAE,SAAS;EAChBC,EAAE,EAAE;AACN,CAAC;AAAChC,OAAA,CAAAW,YAAA,GAAAA,YAAA;AACK,MAAMsB,QAAsC,GAAG;EACpDC,GAAG,EAAE,eAAe;EACpBC,MAAM,EAAE,kBAAkB;EAC1BC,GAAG,EAAE,eAAe;EACpBC,MAAM,EAAE;AACV,CAAC;AAACrC,OAAA,CAAAiC,QAAA,GAAAA,QAAA;AACK,MAAMK,WAA+C,GAAG;EAC7DC,KAAK,EAAE,QAAQ;EACfH,GAAG,EAAE;AACP,CAAC;AAACpC,OAAA,CAAAsC,WAAA,GAAAA,WAAA;AAEK,MAAME,GAAG,GAAG;EACjBC,MAAM,EAAG,4BAA2BxC,cAAe,QAAO;EAC1DyC,QAAQ,EAAG,0BAAyBvC,kBAAmB,IACrDmC,WAAW,CAACC,KAAK,GAAGN,QAAQ,CAACI,MAC9B,EAAC;EACFM,IAAI,EAAG,0BAAyBxC,kBAAmB,IACjDmC,WAAW,CAACF,GAAG,GAAGH,QAAQ,CAACG,GAC5B,EAAC;EACFQ,oBAAoB,EAAG,mCAAkC3C,cAAe;AAC1E,CAAC;AAACD,OAAA,CAAAwC,GAAA,GAAAA,GAAA"}
@@ -1,3 +1,3 @@
1
1
  export { Requester } from './requester';
2
- export { URL, UrlEventType, UrlParameter } from './constants';
3
- export { TrackExperimentParamsType } from './types';
2
+ export { URL, UrlEventType, UrlParameter, Header, } from './constants';
3
+ export { HttpMethod, TrackParametersType, TrackExperimentParamsType, IExternalRequestDispatcher, GetClientConfigurationResultType, } from './types';
@@ -1,10 +1,69 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UrlParameter = exports.UrlEventType = exports.URL = exports.Requester = void 0;
4
- var requester_1 = require("./requester");
5
- Object.defineProperty(exports, "Requester", { enumerable: true, get: function () { return requester_1.Requester; } });
6
- var constants_1 = require("./constants");
7
- Object.defineProperty(exports, "URL", { enumerable: true, get: function () { return constants_1.URL; } });
8
- Object.defineProperty(exports, "UrlEventType", { enumerable: true, get: function () { return constants_1.UrlEventType; } });
9
- Object.defineProperty(exports, "UrlParameter", { enumerable: true, get: function () { return constants_1.UrlParameter; } });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "GetClientConfigurationResultType", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _types.GetClientConfigurationResultType;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "Header", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _constants.Header;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "HttpMethod", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _types.HttpMethod;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "IExternalRequestDispatcher", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _types.IExternalRequestDispatcher;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "Requester", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _requester.Requester;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "TrackExperimentParamsType", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _types.TrackExperimentParamsType;
40
+ }
41
+ });
42
+ Object.defineProperty(exports, "TrackParametersType", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _types.TrackParametersType;
46
+ }
47
+ });
48
+ Object.defineProperty(exports, "URL", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _constants.URL;
52
+ }
53
+ });
54
+ Object.defineProperty(exports, "UrlEventType", {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _constants.UrlEventType;
58
+ }
59
+ });
60
+ Object.defineProperty(exports, "UrlParameter", {
61
+ enumerable: true,
62
+ get: function () {
63
+ return _constants.UrlParameter;
64
+ }
65
+ });
66
+ var _requester = require("./requester");
67
+ var _constants = require("./constants");
68
+ var _types = require("./types");
10
69
  //# sourceMappingURL=index.js.map