@kameleoon/javascript-sdk-core 2.4.6 → 2.5.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 (190) hide show
  1. package/dist/cacheManager/cacheManager.js +3 -65
  2. package/dist/cacheManager/cacheManager.js.map +1 -1
  3. package/dist/cacheManager/index.js +1 -19
  4. package/dist/cacheManager/index.js.map +1 -1
  5. package/dist/cacheManager/types.js +1 -5
  6. package/dist/campaignConfiguration/campaignConfiguration.d.ts +7 -5
  7. package/dist/campaignConfiguration/campaignConfiguration.js +9 -283
  8. package/dist/campaignConfiguration/campaignConfiguration.js.map +1 -1
  9. package/dist/campaignConfiguration/constants.d.ts +2 -10
  10. package/dist/campaignConfiguration/constants.js +2 -21
  11. package/dist/campaignConfiguration/constants.js.map +1 -1
  12. package/dist/campaignConfiguration/index.js +1 -86
  13. package/dist/campaignConfiguration/index.js.map +1 -1
  14. package/dist/campaignConfiguration/types.d.ts +7 -6
  15. package/dist/campaignConfiguration/types.js +1 -54
  16. package/dist/campaignConfiguration/types.js.map +1 -1
  17. package/dist/clientSettings/clientSettings.d.ts +1 -1
  18. package/dist/clientSettings/clientSettings.js +1 -35
  19. package/dist/clientSettings/clientSettings.js.map +1 -1
  20. package/dist/clientSettings/index.js +1 -19
  21. package/dist/clientSettings/index.js.map +1 -1
  22. package/dist/clientSettings/types.d.ts +1 -1
  23. package/dist/clientSettings/types.js +1 -5
  24. package/dist/clientSettings/types.js.map +1 -1
  25. package/dist/constants.d.ts +13 -4
  26. package/dist/constants.js +2 -36
  27. package/dist/constants.js.map +1 -1
  28. package/dist/eventSource/constants.js +1 -8
  29. package/dist/eventSource/constants.js.map +1 -1
  30. package/dist/eventSource/externalEventSource.js +1 -33
  31. package/dist/eventSource/externalEventSource.js.map +1 -1
  32. package/dist/eventSource/index.js +1 -50
  33. package/dist/eventSource/index.js.map +1 -1
  34. package/dist/eventSource/types.js +1 -5
  35. package/dist/hasher/hasher.js +6 -44
  36. package/dist/hasher/hasher.js.map +1 -1
  37. package/dist/hasher/index.js +1 -12
  38. package/dist/hasher/index.js.map +1 -1
  39. package/dist/hasher/types.d.ts +1 -1
  40. package/dist/hasher/types.js +1 -5
  41. package/dist/hasher/types.js.map +1 -1
  42. package/dist/index.d.ts +3 -3
  43. package/dist/index.js +1 -310
  44. package/dist/index.js.map +1 -1
  45. package/dist/kameleoonClient.d.ts +16 -4
  46. package/dist/kameleoonClient.js +10 -384
  47. package/dist/kameleoonClient.js.map +1 -1
  48. package/dist/kameleoonData/browser.d.ts +8 -3
  49. package/dist/kameleoonData/browser.js +9 -40
  50. package/dist/kameleoonData/browser.js.map +1 -1
  51. package/dist/kameleoonData/conversion.d.ts +2 -2
  52. package/dist/kameleoonData/conversion.js +5 -50
  53. package/dist/kameleoonData/conversion.js.map +1 -1
  54. package/dist/kameleoonData/customData.d.ts +2 -2
  55. package/dist/kameleoonData/customData.js +5 -55
  56. package/dist/kameleoonData/customData.js.map +1 -1
  57. package/dist/kameleoonData/device.d.ts +2 -2
  58. package/dist/kameleoonData/device.js +5 -40
  59. package/dist/kameleoonData/device.js.map +1 -1
  60. package/dist/kameleoonData/index.d.ts +1 -1
  61. package/dist/kameleoonData/index.js +1 -102
  62. package/dist/kameleoonData/index.js.map +1 -1
  63. package/dist/kameleoonData/pageView.d.ts +2 -2
  64. package/dist/kameleoonData/pageView.js +5 -56
  65. package/dist/kameleoonData/pageView.js.map +1 -1
  66. package/dist/kameleoonData/types.d.ts +44 -27
  67. package/dist/kameleoonData/types.js +6 -42
  68. package/dist/kameleoonData/types.js.map +1 -1
  69. package/dist/kameleoonData/userAgent.d.ts +2 -2
  70. package/dist/kameleoonData/userAgent.js +4 -37
  71. package/dist/kameleoonData/userAgent.js.map +1 -1
  72. package/dist/kameleoonError/constants.d.ts +4 -2
  73. package/dist/kameleoonError/constants.js +1 -31
  74. package/dist/kameleoonError/constants.js.map +1 -1
  75. package/dist/kameleoonError/helpers.js +1 -9
  76. package/dist/kameleoonError/helpers.js.map +1 -1
  77. package/dist/kameleoonError/index.js +1 -26
  78. package/dist/kameleoonError/index.js.map +1 -1
  79. package/dist/kameleoonError/kameleoonError.d.ts +3 -3
  80. package/dist/kameleoonError/kameleoonError.js +2 -75
  81. package/dist/kameleoonError/kameleoonError.js.map +1 -1
  82. package/dist/kameleoonError/types.d.ts +2 -0
  83. package/dist/kameleoonError/types.js +1 -31
  84. package/dist/kameleoonError/types.js.map +1 -1
  85. package/dist/kameleoonUtils.js +2 -44
  86. package/dist/kameleoonUtils.js.map +1 -1
  87. package/dist/requester/constants.js +4 -73
  88. package/dist/requester/constants.js.map +1 -1
  89. package/dist/requester/index.js +1 -80
  90. package/dist/requester/index.js.map +1 -1
  91. package/dist/requester/requester.d.ts +4 -5
  92. package/dist/requester/requester.js +1 -106
  93. package/dist/requester/requester.js.map +1 -1
  94. package/dist/requester/types.d.ts +8 -7
  95. package/dist/requester/types.js +1 -16
  96. package/dist/requester/types.js.map +1 -1
  97. package/dist/storage/constants.js +2 -15
  98. package/dist/storage/constants.js.map +1 -1
  99. package/dist/storage/externalStorage.d.ts +1 -1
  100. package/dist/storage/externalStorage.js +1 -40
  101. package/dist/storage/externalStorage.js.map +1 -1
  102. package/dist/storage/index.js +1 -56
  103. package/dist/storage/index.js.map +1 -1
  104. package/dist/storage/types.d.ts +4 -4
  105. package/dist/storage/types.js +1 -5
  106. package/dist/storage/types.js.map +1 -1
  107. package/dist/targeting/conditions/browserCondition.d.ts +13 -0
  108. package/dist/targeting/conditions/browserCondition.js +2 -0
  109. package/dist/targeting/conditions/browserCondition.js.map +1 -0
  110. package/dist/targeting/conditions/conditionFactory.d.ts +1 -1
  111. package/dist/targeting/conditions/conditionFactory.js +1 -30
  112. package/dist/targeting/conditions/conditionFactory.js.map +1 -1
  113. package/dist/targeting/conditions/conversionCondition.d.ts +10 -0
  114. package/dist/targeting/conditions/conversionCondition.js +4 -0
  115. package/dist/targeting/conditions/conversionCondition.js.map +1 -0
  116. package/dist/targeting/conditions/customDataCondition.d.ts +5 -7
  117. package/dist/targeting/conditions/customDataCondition.js +7 -114
  118. package/dist/targeting/conditions/customDataCondition.js.map +1 -1
  119. package/dist/targeting/conditions/deviceCondition.d.ts +9 -0
  120. package/dist/targeting/conditions/deviceCondition.js +2 -0
  121. package/dist/targeting/conditions/deviceCondition.js.map +1 -0
  122. package/dist/targeting/conditions/exclusiveExperimentCondition.d.ts +3 -5
  123. package/dist/targeting/conditions/exclusiveExperimentCondition.js +1 -32
  124. package/dist/targeting/conditions/exclusiveExperimentCondition.js.map +1 -1
  125. package/dist/targeting/conditions/index.d.ts +7 -0
  126. package/dist/targeting/conditions/index.js +1 -46
  127. package/dist/targeting/conditions/index.js.map +1 -1
  128. package/dist/targeting/conditions/pageTitleCondition.d.ts +11 -0
  129. package/dist/targeting/conditions/pageTitleCondition.js +2 -0
  130. package/dist/targeting/conditions/pageTitleCondition.js.map +1 -0
  131. package/dist/targeting/conditions/pageUrlCondition.d.ts +11 -0
  132. package/dist/targeting/conditions/pageUrlCondition.js +2 -0
  133. package/dist/targeting/conditions/pageUrlCondition.js.map +1 -0
  134. package/dist/targeting/conditions/sdkLanguageCondition.d.ts +15 -0
  135. package/dist/targeting/conditions/sdkLanguageCondition.js +2 -0
  136. package/dist/targeting/conditions/sdkLanguageCondition.js.map +1 -0
  137. package/dist/targeting/conditions/targetExperimentCondition.d.ts +3 -4
  138. package/dist/targeting/conditions/targetExperimentCondition.js +1 -63
  139. package/dist/targeting/conditions/targetExperimentCondition.js.map +1 -1
  140. package/dist/targeting/conditions/types.d.ts +25 -6
  141. package/dist/targeting/conditions/types.js +1 -5
  142. package/dist/targeting/conditions/types.js.map +1 -1
  143. package/dist/targeting/conditions/visitorCodeCondition.d.ts +11 -0
  144. package/dist/targeting/conditions/visitorCodeCondition.js +2 -0
  145. package/dist/targeting/conditions/visitorCodeCondition.js.map +1 -0
  146. package/dist/targeting/index.d.ts +2 -2
  147. package/dist/targeting/index.js +1 -80
  148. package/dist/targeting/index.js.map +1 -1
  149. package/dist/targeting/targetingNode.d.ts +3 -1
  150. package/dist/targeting/targetingNode.js +1 -47
  151. package/dist/targeting/targetingNode.js.map +1 -1
  152. package/dist/targeting/targetingTree.d.ts +3 -1
  153. package/dist/targeting/targetingTree.js +34 -135
  154. package/dist/targeting/targetingTree.js.map +1 -1
  155. package/dist/targeting/types.d.ts +24 -9
  156. package/dist/targeting/types.js +1 -100
  157. package/dist/targeting/types.js.map +1 -1
  158. package/dist/types.d.ts +9 -4
  159. package/dist/types.js +12 -41
  160. package/dist/types.js.map +1 -1
  161. package/dist/utilities/constants.d.ts +1 -0
  162. package/dist/utilities/constants.js +1 -8
  163. package/dist/utilities/constants.js.map +1 -1
  164. package/dist/utilities/index.d.ts +1 -0
  165. package/dist/utilities/index.js +1 -12
  166. package/dist/utilities/index.js.map +1 -1
  167. package/dist/utilities/types.d.ts +14 -7
  168. package/dist/utilities/types.js +1 -5
  169. package/dist/utilities/types.js.map +1 -1
  170. package/dist/utilities/utilities.d.ts +12 -8
  171. package/dist/utilities/utilities.js +1 -216
  172. package/dist/utilities/utilities.js.map +1 -1
  173. package/dist/variationConfiguration/index.js +1 -25
  174. package/dist/variationConfiguration/index.js.map +1 -1
  175. package/dist/variationConfiguration/types.d.ts +5 -3
  176. package/dist/variationConfiguration/types.js +1 -5
  177. package/dist/variationConfiguration/types.js.map +1 -1
  178. package/dist/variationConfiguration/variation.d.ts +1 -1
  179. package/dist/variationConfiguration/variation.js +6 -44
  180. package/dist/variationConfiguration/variation.js.map +1 -1
  181. package/dist/variationConfiguration/variationConfiguration.d.ts +4 -4
  182. package/dist/variationConfiguration/variationConfiguration.js +65 -290
  183. package/dist/variationConfiguration/variationConfiguration.js.map +1 -1
  184. package/package.json +1 -1
  185. package/dist/kameleoonData/constants.d.ts +0 -1
  186. package/dist/kameleoonData/constants.js +0 -9
  187. package/dist/kameleoonData/constants.js.map +0 -1
  188. package/dist/kameleoonData/nonce.d.ts +0 -5
  189. package/dist/kameleoonData/nonce.js +0 -32
  190. package/dist/kameleoonData/nonce.js.map +0 -1
@@ -1,42 +1,9 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.UserAgent = void 0;
7
- var _nonce = require("./nonce");
8
- var _types = require("./types");
9
- 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; }
10
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
11
- 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); }
12
- /**
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.UserAgent=void 0;var _utilities=require("../utilities"),_types=require("./types");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)}/**
13
2
  * @class
14
3
  * UserAgent - a class for creating an instance for user agent
15
- * */
16
- class UserAgent extends _nonce.Nonce {
17
- constructor(value) {
18
- super();
19
- _defineProperty(this, "value", void 0);
20
- this.value = value;
21
- }
22
-
23
- /**
4
+ * */var UserAgent=/*#__PURE__*/function(){function a(b){_classCallCheck(this,a),_defineProperty(this,"value",void 0),_defineProperty(this,"nonce",void 0),this.value=b,this.nonce=_utilities.Utilities.getNonce()}/**
24
5
  * @property url - url for the current data type used for events tracking
25
- * */
26
- get url() {
27
- return '';
28
- }
29
-
30
- /**
6
+ * */return _createClass(a,[{key:"url",get:function get(){return""}/**
31
7
  * @property data - data of the current class instance
32
- * */
33
- get data() {
34
- return {
35
- value: this.value,
36
- type: _types.KameleoonData.UserAgent,
37
- nonce: this.nonce
38
- };
39
- }
40
- }
41
- exports.UserAgent = UserAgent;
8
+ * */},{key:"data",get:function get(){return{value:this.value,type:_types.KameleoonData.UserAgent,nonce:this.nonce}}}]),a}();exports.UserAgent=UserAgent;
42
9
  //# sourceMappingURL=userAgent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"userAgent.js","names":["_nonce","require","_types","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","UserAgent","Nonce","constructor","url","data","type","KameleoonData","nonce","exports"],"sources":["../../src/kameleoonData/userAgent.ts"],"sourcesContent":["import { Nonce } from './nonce';\nimport { UserAgentDataType, IKameleoonData, KameleoonData } from './types';\n\n/**\n * @class\n * UserAgent - a class for creating an instance for user agent\n * */\nexport class UserAgent extends Nonce implements IKameleoonData {\n private value: string;\n\n constructor(value: string) {\n super();\n\n this.value = value;\n }\n\n /**\n * @property url - url for the current data type used for events tracking\n * */\n get url(): string {\n return '';\n }\n\n /**\n * @property data - data of the current class instance\n * */\n get data(): UserAgentDataType {\n return {\n value: this.value,\n type: KameleoonData.UserAgent,\n nonce: this.nonce,\n };\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAA2E,SAAAE,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;AAE3E;AACA;AACA;AACA;AACO,MAAMU,SAAS,SAASC,YAAK,CAA2B;EAG7DC,WAAWA,CAACtB,KAAa,EAAE;IACzB,KAAK,EAAE;IAACH,eAAA;IAER,IAAI,CAACG,KAAK,GAAGA,KAAK;EACpB;;EAEA;AACF;AACA;EACE,IAAIuB,GAAGA,CAAA,EAAW;IAChB,OAAO,EAAE;EACX;;EAEA;AACF;AACA;EACE,IAAIC,IAAIA,CAAA,EAAsB;IAC5B,OAAO;MACLxB,KAAK,EAAE,IAAI,CAACA,KAAK;MACjByB,IAAI,EAAEC,oBAAa,CAACN,SAAS;MAC7BO,KAAK,EAAE,IAAI,CAACA;IACd,CAAC;EACH;AACF;AAACC,OAAA,CAAAR,SAAA,GAAAA,SAAA"}
1
+ {"version":3,"file":"userAgent.js","names":["UserAgent","a","value","_classCallCheck","_defineProperty","nonce","Utilities","getNonce","_createClass","key","get","type","KameleoonData","exports"],"sources":["../../src/kameleoonData/userAgent.ts"],"sourcesContent":["import { Utilities } from 'src/utilities';\nimport { UserAgentDataType, IKameleoonData, KameleoonData } from './types';\n\n/**\n * @class\n * UserAgent - a class for creating an instance for user agent\n * */\nexport class UserAgent implements IKameleoonData {\n private value: string;\n private nonce: string;\n\n constructor(value: string) {\n this.value = value;\n this.nonce = Utilities.getNonce();\n }\n\n /**\n * @property url - url for the current data type used for events tracking\n * */\n get url(): string {\n return '';\n }\n\n /**\n * @property data - data of the current class instance\n * */\n get data(): UserAgentDataType {\n return {\n value: this.value,\n type: KameleoonData.UserAgent,\n nonce: this.nonce,\n };\n }\n}\n"],"mappings":"u4CAGA;AACA;AACA;AACA,KAHA,GAIa,CAAAA,SAAS,yBAIpB,SAAAC,EAAYC,CAAa,CAAE,CAAAC,eAAA,MAAAF,CAAA,EAAAG,eAAA,sBAAAA,eAAA,sBACzB,IAAI,CAACF,KAAK,CAAGA,CAAK,CAClB,IAAI,CAACG,KAAK,CAAGC,oBAAS,CAACC,QAAQ,EACjC,CAEA;AACF;AACA,OAFE,OAAAC,YAAA,CAAAP,CAAA,GAAAQ,GAAA,OAAAC,GAAA,CAGA,SAAAA,IAAA,CAAkB,CAChB,MAAO,EACT,CAEA;AACF;AACA,OAFE,GAAAD,GAAA,QAAAC,GAAA,CAGA,SAAAA,IAAA,CAA8B,CAC5B,MAAO,CACLR,KAAK,CAAE,IAAI,CAACA,KAAK,CACjBS,IAAI,CAAEC,oBAAa,CAACZ,SAAS,CAC7BK,KAAK,CAAE,IAAI,CAACA,KACd,CACF,CAAC,IAAAJ,CAAA,IAAAY,OAAA,CAAAb,SAAA,CAAAA,SAAA"}
@@ -1,8 +1,10 @@
1
- import { KameleoonStorageKey } from '../storage';
2
- import { TargetingType } from '../targeting';
1
+ import { KameleoonStorageKey } from 'src/storage';
2
+ import { TargetingType } from 'src/targeting';
3
3
  export declare const ERROR_MESSAGES: {
4
4
  JSONParse: (err: unknown) => string;
5
5
  NumberParse: (value: string) => string;
6
+ VersionParse: (value: string) => string;
7
+ SemanticVersionParse: (value: string) => string;
6
8
  Initialization: () => string;
7
9
  StorageInitialization: () => string;
8
10
  EventSourceInitialization: () => string;
@@ -1,32 +1,2 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ERROR_MESSAGES = void 0;
7
- var _types = require("./types");
8
- const ERROR_MESSAGES = {
9
- [_types.KameleoonException.JSONParse]: err => `Couldn't parse JSON variable: ${err}`,
10
- [_types.KameleoonException.NumberParse]: value => `It's not possible to parse value ${value} to Number`,
11
- [_types.KameleoonException.Initialization]: () => "It seems that the client wasn't properly initialized, make sure to run `initialize` method before invoking other methods",
12
- [_types.KameleoonException.StorageInitialization]: () => "There was an error while initializing React Native SDK storage, it seems that the storage library dependency wasn't installed",
13
- [_types.KameleoonException.EventSourceInitialization]: () => "There was an error while initializing Real Time Update service, it seems that the event source library dependency wasn't installed",
14
- [_types.KameleoonException.VariationNotFound]: () => "Couldn't find experiment variation",
15
- [_types.KameleoonException.FeatureFlagConfigurationNotFound]: (featureKey, visitorCode) => `No feature flag with key ${featureKey} was found for ${visitorCode} visitorCode.`,
16
- [_types.KameleoonException.FeatureFlagVariableNotFound]: (variableKey, visitorCode) => `No feature flag variable with key ${variableKey} was found for ${visitorCode} visitorCode.`,
17
- [_types.KameleoonException.ExperimentConfigurationNotFound]: (experimentId, visitorCode) => `No experiment with id ${experimentId} was found for ${visitorCode} visitorCode.`,
18
- [_types.KameleoonException.NotTargeted]: visitorCode => `Visitor code ${visitorCode} is not targeted`,
19
- [_types.KameleoonException.NotAllocated]: visitorCode => `Visitor with visitor code ${visitorCode} is in unallocated traffic, there is no variation id to be assigned to the visitor.`,
20
- [_types.KameleoonException.VisitorCodeMaxLength]: () => 'Visitor code can not be more than 255 characters long',
21
- [_types.KameleoonException.VisitorCodeEmpty]: () => 'Visitor code can not be empty',
22
- [_types.KameleoonException.StorageWrite]: err => `Couldn't update storage for kameleoonClient: ${err}`,
23
- [_types.KameleoonException.StorageRead]: key => `No data found in storage under ${key} key`,
24
- [_types.KameleoonException.StorageParse]: (err, key) => `Couldn't parse ${key} storage data, the data may be corrupted. Error: ${err}`,
25
- [_types.KameleoonException.ClientConfiguration]: () => "Couldn't retrieve client configuration from Kameleoon Api",
26
- [_types.KameleoonException.TargetingCondition]: targetingType => `${targetingType} targeting condition is not yet supported.`,
27
- [_types.KameleoonException.AmongValuesCheck]: (err, value) => `Couldn't parse value "${value}": ${err}`,
28
- [_types.KameleoonException.RemoteData]: () => `Couldn't retrieve data from Kameleoon server`,
29
- [_types.KameleoonException.MaximumRetriesReached]: () => `Maximum retries reached, request failed`
30
- };
31
- exports.ERROR_MESSAGES = ERROR_MESSAGES;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ERROR_MESSAGES=void 0;var _ERROR_MESSAGES,_types=require("./types");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 _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 ERROR_MESSAGES=(_ERROR_MESSAGES={},_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.JSONParse,function(a){return"Couldn't parse JSON variable: ".concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.NumberParse,function(a){return"It's not possible to parse value ".concat(a," to Number")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.VersionParse,function(a){return"It's not possible to parse a version value ".concat(a," to Number, version should be in format x.x")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.SemanticVersionParse,function(a){return"It's not possible to parse a version value ".concat(a," to Number, version should be in format x.x.x")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.Initialization,function(){return"It seems that the client wasn't properly initialized, make sure to run `initialize` method before invoking other methods"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.StorageInitialization,function(){return"There was an error while initializing React Native SDK storage, it seems that the storage library dependency wasn't installed"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.EventSourceInitialization,function(){return"There was an error while initializing Real Time Update service, it seems that the event source library dependency wasn't installed"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.VariationNotFound,function(){return"Couldn't find experiment variation"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.FeatureFlagConfigurationNotFound,function(a,b){return"No feature flag with key ".concat(a," was found for ").concat(b," visitorCode.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.FeatureFlagVariableNotFound,function(a,b){return"No feature flag variable with key ".concat(a," was found for ").concat(b," visitorCode.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.ExperimentConfigurationNotFound,function(a,b){return"No experiment with id ".concat(a," was found for ").concat(b," visitorCode.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.NotTargeted,function(a){return"Visitor code ".concat(a," is not targeted")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.NotAllocated,function(a){return"Visitor with visitor code ".concat(a," is in unallocated traffic, there is no variation id to be assigned to the visitor.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.VisitorCodeMaxLength,function(){return"Visitor code can not be more than 255 characters long"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.VisitorCodeEmpty,function(){return"Visitor code can not be empty"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.StorageWrite,function(a){return"Couldn't update storage for kameleoonClient: ".concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.StorageRead,function(a){return"No data found in storage under ".concat(a," key")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.StorageParse,function(a,b){return"Couldn't parse ".concat(b," storage data, the data may be corrupted. Error: ").concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.ClientConfiguration,function(){return"Couldn't retrieve client configuration from Kameleoon Api"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.TargetingCondition,function(a){return"".concat(a," targeting condition is not yet supported.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.AmongValuesCheck,function(a,b){return"Couldn't parse value \"".concat(b,"\": ").concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.RemoteData,function(){return"Couldn't retrieve data from Kameleoon server"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.MaximumRetriesReached,function(){return"Maximum retries reached, request failed"}),_ERROR_MESSAGES);exports.ERROR_MESSAGES=ERROR_MESSAGES;
32
2
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["_types","require","ERROR_MESSAGES","KameleoonException","JSONParse","err","NumberParse","value","Initialization","StorageInitialization","EventSourceInitialization","VariationNotFound","FeatureFlagConfigurationNotFound","featureKey","visitorCode","FeatureFlagVariableNotFound","variableKey","ExperimentConfigurationNotFound","experimentId","NotTargeted","NotAllocated","VisitorCodeMaxLength","VisitorCodeEmpty","StorageWrite","StorageRead","key","StorageParse","ClientConfiguration","TargetingCondition","targetingType","AmongValuesCheck","RemoteData","MaximumRetriesReached","exports"],"sources":["../../src/kameleoonError/constants.ts"],"sourcesContent":["import { KameleoonStorageKey } from '../storage';\nimport { TargetingType } from '../targeting';\nimport { KameleoonException } from './types';\n\nexport const ERROR_MESSAGES = {\n [KameleoonException.JSONParse]: (err: unknown) =>\n `Couldn't parse JSON variable: ${err}`,\n [KameleoonException.NumberParse]: (value: string) =>\n `It's not possible to parse value ${value} to Number`,\n [KameleoonException.Initialization]: () =>\n \"It seems that the client wasn't properly initialized, make sure to run `initialize` method before invoking other methods\",\n [KameleoonException.StorageInitialization]: () =>\n \"There was an error while initializing React Native SDK storage, it seems that the storage library dependency wasn't installed\",\n [KameleoonException.EventSourceInitialization]: () =>\n \"There was an error while initializing Real Time Update service, it seems that the event source library dependency wasn't installed\",\n [KameleoonException.VariationNotFound]: () =>\n \"Couldn't find experiment variation\",\n [KameleoonException.FeatureFlagConfigurationNotFound]: (\n featureKey: string,\n visitorCode: string,\n ) =>\n `No feature flag with key ${featureKey} was found for ${visitorCode} visitorCode.`,\n [KameleoonException.FeatureFlagVariableNotFound]: (\n variableKey: string,\n visitorCode: string,\n ) =>\n `No feature flag variable with key ${variableKey} was found for ${visitorCode} visitorCode.`,\n [KameleoonException.ExperimentConfigurationNotFound]: (\n experimentId: number,\n visitorCode: string,\n ) =>\n `No experiment with id ${experimentId} was found for ${visitorCode} visitorCode.`,\n [KameleoonException.NotTargeted]: (visitorCode: string) =>\n `Visitor code ${visitorCode} is not targeted`,\n [KameleoonException.NotAllocated]: (visitorCode: string) =>\n `Visitor with visitor code ${visitorCode} is in unallocated traffic, there is no variation id to be assigned to the visitor.`,\n [KameleoonException.VisitorCodeMaxLength]: () =>\n 'Visitor code can not be more than 255 characters long',\n [KameleoonException.VisitorCodeEmpty]: () => 'Visitor code can not be empty',\n [KameleoonException.StorageWrite]: (err: unknown) =>\n `Couldn't update storage for kameleoonClient: ${err}`,\n [KameleoonException.StorageRead]: (key: KameleoonStorageKey) =>\n `No data found in storage under ${key} key`,\n [KameleoonException.StorageParse]: (err: unknown, key: KameleoonStorageKey) =>\n `Couldn't parse ${key} storage data, the data may be corrupted. Error: ${err}`,\n [KameleoonException.ClientConfiguration]: () =>\n \"Couldn't retrieve client configuration from Kameleoon Api\",\n [KameleoonException.TargetingCondition]: (targetingType: TargetingType) =>\n `${targetingType} targeting condition is not yet supported.`,\n [KameleoonException.AmongValuesCheck]: (err: unknown, value: string) =>\n `Couldn't parse value \"${value}\": ${err}`,\n [KameleoonException.RemoteData]: () =>\n `Couldn't retrieve data from Kameleoon server`,\n [KameleoonException.MaximumRetriesReached]: () =>\n `Maximum retries reached, request failed`,\n};\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAEO,MAAMC,cAAc,GAAG;EAC5B,CAACC,yBAAkB,CAACC,SAAS,GAAIC,GAAY,IAC1C,iCAAgCA,GAAI,EAAC;EACxC,CAACF,yBAAkB,CAACG,WAAW,GAAIC,KAAa,IAC7C,oCAAmCA,KAAM,YAAW;EACvD,CAACJ,yBAAkB,CAACK,cAAc,GAAG,MACnC,0HAA0H;EAC5H,CAACL,yBAAkB,CAACM,qBAAqB,GAAG,MAC1C,+HAA+H;EACjI,CAACN,yBAAkB,CAACO,yBAAyB,GAAG,MAC9C,oIAAoI;EACtI,CAACP,yBAAkB,CAACQ,iBAAiB,GAAG,MACtC,oCAAoC;EACtC,CAACR,yBAAkB,CAACS,gCAAgC,GAAG,CACrDC,UAAkB,EAClBC,WAAmB,KAElB,4BAA2BD,UAAW,kBAAiBC,WAAY,eAAc;EACpF,CAACX,yBAAkB,CAACY,2BAA2B,GAAG,CAChDC,WAAmB,EACnBF,WAAmB,KAElB,qCAAoCE,WAAY,kBAAiBF,WAAY,eAAc;EAC9F,CAACX,yBAAkB,CAACc,+BAA+B,GAAG,CACpDC,YAAoB,EACpBJ,WAAmB,KAElB,yBAAwBI,YAAa,kBAAiBJ,WAAY,eAAc;EACnF,CAACX,yBAAkB,CAACgB,WAAW,GAAIL,WAAmB,IACnD,gBAAeA,WAAY,kBAAiB;EAC/C,CAACX,yBAAkB,CAACiB,YAAY,GAAIN,WAAmB,IACpD,6BAA4BA,WAAY,qFAAoF;EAC/H,CAACX,yBAAkB,CAACkB,oBAAoB,GAAG,MACzC,uDAAuD;EACzD,CAAClB,yBAAkB,CAACmB,gBAAgB,GAAG,MAAM,+BAA+B;EAC5E,CAACnB,yBAAkB,CAACoB,YAAY,GAAIlB,GAAY,IAC7C,gDAA+CA,GAAI,EAAC;EACvD,CAACF,yBAAkB,CAACqB,WAAW,GAAIC,GAAwB,IACxD,kCAAiCA,GAAI,MAAK;EAC7C,CAACtB,yBAAkB,CAACuB,YAAY,GAAG,CAACrB,GAAY,EAAEoB,GAAwB,KACvE,kBAAiBA,GAAI,oDAAmDpB,GAAI,EAAC;EAChF,CAACF,yBAAkB,CAACwB,mBAAmB,GAAG,MACxC,2DAA2D;EAC7D,CAACxB,yBAAkB,CAACyB,kBAAkB,GAAIC,aAA4B,IACnE,GAAEA,aAAc,4CAA2C;EAC9D,CAAC1B,yBAAkB,CAAC2B,gBAAgB,GAAG,CAACzB,GAAY,EAAEE,KAAa,KAChE,yBAAwBA,KAAM,MAAKF,GAAI,EAAC;EAC3C,CAACF,yBAAkB,CAAC4B,UAAU,GAAG,MAC9B,8CAA6C;EAChD,CAAC5B,yBAAkB,CAAC6B,qBAAqB,GAAG,MACzC;AACL,CAAC;AAACC,OAAA,CAAA/B,cAAA,GAAAA,cAAA"}
1
+ {"version":3,"file":"constants.js","names":["ERROR_MESSAGES","_ERROR_MESSAGES","_defineProperty","KameleoonException","JSONParse","err","concat","NumberParse","value","VersionParse","SemanticVersionParse","Initialization","StorageInitialization","EventSourceInitialization","VariationNotFound","FeatureFlagConfigurationNotFound","featureKey","visitorCode","FeatureFlagVariableNotFound","variableKey","ExperimentConfigurationNotFound","experimentId","NotTargeted","NotAllocated","VisitorCodeMaxLength","VisitorCodeEmpty","StorageWrite","StorageRead","key","StorageParse","ClientConfiguration","TargetingCondition","targetingType","AmongValuesCheck","RemoteData","MaximumRetriesReached","exports"],"sources":["../../src/kameleoonError/constants.ts"],"sourcesContent":["import { KameleoonStorageKey } from 'src/storage';\nimport { TargetingType } from 'src/targeting';\nimport { KameleoonException } from './types';\n\nexport const ERROR_MESSAGES = {\n [KameleoonException.JSONParse]: (err: unknown) =>\n `Couldn't parse JSON variable: ${err}`,\n [KameleoonException.NumberParse]: (value: string) =>\n `It's not possible to parse value ${value} to Number`,\n [KameleoonException.VersionParse]: (value: string) =>\n `It's not possible to parse a version value ${value} to Number, version should be in format x.x`,\n [KameleoonException.SemanticVersionParse]: (value: string) =>\n `It's not possible to parse a version value ${value} to Number, version should be in format x.x.x`,\n [KameleoonException.Initialization]: () =>\n \"It seems that the client wasn't properly initialized, make sure to run `initialize` method before invoking other methods\",\n [KameleoonException.StorageInitialization]: () =>\n \"There was an error while initializing React Native SDK storage, it seems that the storage library dependency wasn't installed\",\n [KameleoonException.EventSourceInitialization]: () =>\n \"There was an error while initializing Real Time Update service, it seems that the event source library dependency wasn't installed\",\n [KameleoonException.VariationNotFound]: () =>\n \"Couldn't find experiment variation\",\n [KameleoonException.FeatureFlagConfigurationNotFound]: (\n featureKey: string,\n visitorCode: string,\n ) =>\n `No feature flag with key ${featureKey} was found for ${visitorCode} visitorCode.`,\n [KameleoonException.FeatureFlagVariableNotFound]: (\n variableKey: string,\n visitorCode: string,\n ) =>\n `No feature flag variable with key ${variableKey} was found for ${visitorCode} visitorCode.`,\n [KameleoonException.ExperimentConfigurationNotFound]: (\n experimentId: number,\n visitorCode: string,\n ) =>\n `No experiment with id ${experimentId} was found for ${visitorCode} visitorCode.`,\n [KameleoonException.NotTargeted]: (visitorCode: string) =>\n `Visitor code ${visitorCode} is not targeted`,\n [KameleoonException.NotAllocated]: (visitorCode: string) =>\n `Visitor with visitor code ${visitorCode} is in unallocated traffic, there is no variation id to be assigned to the visitor.`,\n [KameleoonException.VisitorCodeMaxLength]: () =>\n 'Visitor code can not be more than 255 characters long',\n [KameleoonException.VisitorCodeEmpty]: () => 'Visitor code can not be empty',\n [KameleoonException.StorageWrite]: (err: unknown) =>\n `Couldn't update storage for kameleoonClient: ${err}`,\n [KameleoonException.StorageRead]: (key: KameleoonStorageKey) =>\n `No data found in storage under ${key} key`,\n [KameleoonException.StorageParse]: (err: unknown, key: KameleoonStorageKey) =>\n `Couldn't parse ${key} storage data, the data may be corrupted. Error: ${err}`,\n [KameleoonException.ClientConfiguration]: () =>\n \"Couldn't retrieve client configuration from Kameleoon Api\",\n [KameleoonException.TargetingCondition]: (targetingType: TargetingType) =>\n `${targetingType} targeting condition is not yet supported.`,\n [KameleoonException.AmongValuesCheck]: (err: unknown, value: string) =>\n `Couldn't parse value \"${value}\": ${err}`,\n [KameleoonException.RemoteData]: () =>\n `Couldn't retrieve data from Kameleoon server`,\n [KameleoonException.MaximumRetriesReached]: () =>\n `Maximum retries reached, request failed`,\n};\n"],"mappings":"o7BAIO,GAAM,CAAAA,cAAc,EAAAC,eAAA,IAAAC,eAAA,CAAAD,eAAA,CACxBE,yBAAkB,CAACC,SAAS,CAAG,SAACC,CAAY,yCAAAC,MAAA,CACVD,CAAG,EAAE,EAAAH,eAAA,CAAAD,eAAA,CACvCE,yBAAkB,CAACI,WAAW,CAAG,SAACC,CAAa,4CAAAF,MAAA,CACVE,CAAK,eAAY,EAAAN,eAAA,CAAAD,eAAA,CACtDE,yBAAkB,CAACM,YAAY,CAAG,SAACD,CAAa,sDAAAF,MAAA,CACDE,CAAK,gDAA6C,EAAAN,eAAA,CAAAD,eAAA,CACjGE,yBAAkB,CAACO,oBAAoB,CAAG,SAACF,CAAa,sDAAAF,MAAA,CACTE,CAAK,kDAA+C,EAAAN,eAAA,CAAAD,eAAA,CACnGE,yBAAkB,CAACQ,cAAc,CAAG,iBACnC,0HAA0H,GAAAT,eA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,CAACwB,WAAW,CAAG,SAACC,CAAwB,0CAAAtB,MAAA,CACvBsB,CAAG,SAAM,EAAA1B,eAAA,CAAAD,eAAA,CAC5CE,yBAAkB,CAAC0B,YAAY,CAAG,SAACxB,CAAY,CAAEuB,CAAwB,0BAAAtB,MAAA,CACtDsB,CAAG,sDAAAtB,MAAA,CAAoDD,CAAG,EAAE,EAAAH,eAAA,CAAAD,eAAA,CAC/EE,yBAAkB,CAAC2B,mBAAmB,CAAG,iBACxC,2DAA2D,GAAA5B,eAAA,CAAAD,eAAA,CAC5DE,yBAAkB,CAAC4B,kBAAkB,CAAG,SAACC,CAA4B,WAAA1B,MAAA,CACjE0B,CAAa,+CAA4C,EAAA9B,eAAA,CAAAD,eAAA,CAC7DE,yBAAkB,CAAC8B,gBAAgB,CAAG,SAAC5B,CAAY,CAAEG,CAAa,kCAAAF,MAAA,CACxCE,CAAK,SAAAF,MAAA,CAAMD,CAAG,EAAE,EAAAH,eAAA,CAAAD,eAAA,CAC1CE,yBAAkB,CAAC+B,UAAU,CAAG,gEACe,EAAAhC,eAAA,CAAAD,eAAA,CAC/CE,yBAAkB,CAACgC,qBAAqB,CAAG,2DACD,EAAAlC,eAAA,CAC5C,CAACmC,OAAA,CAAApC,cAAA,CAAAA,cAAA"}
@@ -1,10 +1,2 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.exhaustCheck = exhaustCheck;
7
- function exhaustCheck(option) {
8
- throw new Error(`Reaching an impossible state because of ${option}`);
9
- }
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.exhaustCheck=exhaustCheck;function exhaustCheck(a){throw new Error("Reaching an impossible state because of ".concat(a))}
10
2
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","names":["exhaustCheck","option","Error"],"sources":["../../src/kameleoonError/helpers.ts"],"sourcesContent":["export function exhaustCheck(option: never): never {\n throw new Error(`Reaching an impossible state because of ${option}`);\n}\n"],"mappings":";;;;;;AAAO,SAASA,YAAYA,CAACC,MAAa,EAAS;EACjD,MAAM,IAAIC,KAAK,CAAE,2CAA0CD,MAAO,EAAC,CAAC;AACtE"}
1
+ {"version":3,"file":"helpers.js","names":["exhaustCheck","option","Error","concat"],"sources":["../../src/kameleoonError/helpers.ts"],"sourcesContent":["export function exhaustCheck(option: never): never {\n throw new Error(`Reaching an impossible state because of ${option}`);\n}\n"],"mappings":"sGAAO,QAAS,CAAAA,YAAYA,CAACC,CAAa,CAAS,CACjD,KAAM,IAAI,CAAAC,KAAK,4CAAAC,MAAA,CAA4CF,CAAM,EACnE"}
@@ -1,27 +1,2 @@
1
- "use strict";
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");
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"KameleoonError",{enumerable:!0,get:function get(){return _kameleoonError.KameleoonError}}),Object.defineProperty(exports,"KameleoonException",{enumerable:!0,get:function get(){return _types.KameleoonException}}),Object.defineProperty(exports,"exhaustCheck",{enumerable:!0,get:function get(){return _helpers.exhaustCheck}});var _kameleoonError=require("./kameleoonError"),_types=require("./types"),_helpers=require("./helpers");
27
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/kameleoonError/index.ts"],"sourcesContent":["export { KameleoonError } from './kameleoonError';\nexport { KameleoonException } from './types';\nexport { exhaustCheck } from './helpers';\n"],"mappings":""}
@@ -1,5 +1,5 @@
1
- import { KameleoonStorageKey } from '../storage';
2
- import { TargetingType } from '../targeting';
1
+ import { KameleoonStorageKey } from 'src/storage';
2
+ import { TargetingType } from 'src/targeting';
3
3
  import { KameleoonException } from './types';
4
4
  /**
5
5
  * @class
@@ -20,6 +20,6 @@ export declare class KameleoonError extends Error {
20
20
  constructor(type: KameleoonException.StorageParse, err: unknown, key: KameleoonStorageKey);
21
21
  constructor(type: KameleoonException.TargetingCondition, targetingType: TargetingType);
22
22
  constructor(type: KameleoonException.AmongValuesCheck, err: unknown, value: string);
23
- constructor(type: KameleoonException.NumberParse, value: string);
23
+ constructor(type: KameleoonException.NumberParse | KameleoonException.VersionParse | KameleoonException.SemanticVersionParse, value: string);
24
24
  get type(): KameleoonException;
25
25
  }
@@ -1,78 +1,5 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.KameleoonError = void 0;
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); }
13
- /**
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonError=void 0;var _constants=require("./constants"),_helpers=require("./helpers"),_types=require("./types");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 _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),b&&_setPrototypeOf(a,b)}function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _possibleConstructorReturn(a,b){if(b&&("object"===_typeof(b)||"function"==typeof b))return b;if(void 0!==b)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(a)}function _assertThisInitialized(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function _wrapNativeSuper(a){var b="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function(a){function c(){return _construct(a,arguments,_getPrototypeOf(this).constructor)}if(null===a||!_isNativeFunction(a))return a;if("function"!=typeof a)throw new TypeError("Super expression must either be null or a function");if("undefined"!=typeof b){if(b.has(a))return b.get(a);b.set(a,c)}return c.prototype=Object.create(a.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(c,a)},_wrapNativeSuper(a)}function _construct(){return _construct=_isNativeReflectConstruct()?Reflect.construct.bind():function(b,c,d){var e=[null];e.push.apply(e,c);var a=Function.bind.apply(b,e),f=new a;return d&&_setPrototypeOf(f,d.prototype),f},_construct.apply(null,arguments)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function _isNativeFunction(a){return-1!==Function.toString.call(a).indexOf("[native code]")}function _setPrototypeOf(a,b){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,b){return a.__proto__=b,a},_setPrototypeOf(a,b)}function _getPrototypeOf(a){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},_getPrototypeOf(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)}/**
14
2
  * @class
15
3
  * KameleoonError - extends standard `Error` by adding custom `type` property with the type of `KameleoonException`
16
- * */
17
- class KameleoonError extends Error {
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.VisitorCodeEmpty:
32
- case _types.KameleoonException.StorageInitialization:
33
- case _types.KameleoonException.VariationNotFound:
34
- case _types.KameleoonException.EventSourceInitialization:
35
- case _types.KameleoonException.RemoteData:
36
- case _types.KameleoonException.MaximumRetriesReached:
37
- this.message = _constants.ERROR_MESSAGES[type]();
38
- break;
39
- case _types.KameleoonException.NotAllocated:
40
- case _types.KameleoonException.NotTargeted:
41
- this.message = _constants.ERROR_MESSAGES[type](secondParam);
42
- break;
43
- case _types.KameleoonException.ExperimentConfigurationNotFound:
44
- this.message = _constants.ERROR_MESSAGES[type](secondParam, thirdParam);
45
- break;
46
- case _types.KameleoonException.FeatureFlagVariableNotFound:
47
- case _types.KameleoonException.FeatureFlagConfigurationNotFound:
48
- this.message = _constants.ERROR_MESSAGES[type](secondParam, thirdParam);
49
- break;
50
- case _types.KameleoonException.StorageWrite:
51
- case _types.KameleoonException.JSONParse:
52
- this.message = _constants.ERROR_MESSAGES[type](secondParam);
53
- break;
54
- case _types.KameleoonException.StorageRead:
55
- this.message = _constants.ERROR_MESSAGES[type](secondParam);
56
- break;
57
- case _types.KameleoonException.StorageParse:
58
- this.message = _constants.ERROR_MESSAGES[type](secondParam, thirdParam);
59
- break;
60
- case _types.KameleoonException.TargetingCondition:
61
- this.message = _constants.ERROR_MESSAGES[type](secondParam);
62
- break;
63
- case _types.KameleoonException.NumberParse:
64
- this.message = _constants.ERROR_MESSAGES[type](secondParam);
65
- break;
66
- case _types.KameleoonException.AmongValuesCheck:
67
- this.message = _constants.ERROR_MESSAGES[type](secondParam, thirdParam);
68
- break;
69
- default:
70
- (0, _helpers.exhaustCheck)(type);
71
- }
72
- }
73
- get type() {
74
- return this.errorType;
75
- }
76
- }
77
- exports.KameleoonError = KameleoonError;
4
+ * */var KameleoonError=/*#__PURE__*/function(a){function b(a,d,e){var f;return _classCallCheck(this,b),f=c.call(this,"Error: ".concat(a)),_defineProperty(_assertThisInitialized(f),"errorType",void 0),f.name="KameleoonError",f.errorType=a,(a===_types.KameleoonException.Initialization||a===_types.KameleoonException.ClientConfiguration||a===_types.KameleoonException.VisitorCodeMaxLength||a===_types.KameleoonException.VisitorCodeEmpty||a===_types.KameleoonException.StorageInitialization||a===_types.KameleoonException.VariationNotFound||a===_types.KameleoonException.EventSourceInitialization||a===_types.KameleoonException.RemoteData||a===_types.KameleoonException.MaximumRetriesReached?f.message=_constants.ERROR_MESSAGES[a]():a===_types.KameleoonException.NotAllocated||a===_types.KameleoonException.NotTargeted?f.message=_constants.ERROR_MESSAGES[a](d):a===_types.KameleoonException.ExperimentConfigurationNotFound?f.message=_constants.ERROR_MESSAGES[a](d,e):a===_types.KameleoonException.FeatureFlagVariableNotFound||a===_types.KameleoonException.FeatureFlagConfigurationNotFound?f.message=_constants.ERROR_MESSAGES[a](d,e):a===_types.KameleoonException.StorageWrite||a===_types.KameleoonException.JSONParse?f.message=_constants.ERROR_MESSAGES[a](d):a===_types.KameleoonException.StorageRead?f.message=_constants.ERROR_MESSAGES[a](d):a===_types.KameleoonException.StorageParse?f.message=_constants.ERROR_MESSAGES[a](d,e):a===_types.KameleoonException.TargetingCondition?f.message=_constants.ERROR_MESSAGES[a](d):a===_types.KameleoonException.NumberParse||a===_types.KameleoonException.VersionParse||a===_types.KameleoonException.SemanticVersionParse?f.message=_constants.ERROR_MESSAGES[a](d):a===_types.KameleoonException.AmongValuesCheck?f.message=_constants.ERROR_MESSAGES[a](d,e):(0,_helpers.exhaustCheck)(a),f)}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"type",get:function get(){return this.errorType}}]),b}(/*#__PURE__*/_wrapNativeSuper(Error));exports.KameleoonError=KameleoonError;
78
5
  //# sourceMappingURL=kameleoonError.js.map
@@ -1 +1 @@
1
- {"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","VisitorCodeEmpty","StorageInitialization","VariationNotFound","EventSourceInitialization","RemoteData","MaximumRetriesReached","message","ERROR_MESSAGES","NotAllocated","NotTargeted","ExperimentConfigurationNotFound","FeatureFlagVariableNotFound","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.VisitorCodeEmpty\n | KameleoonException.StorageInitialization\n | KameleoonException.EventSourceInitialization\n | KameleoonException.VariationNotFound\n | KameleoonException.RemoteData\n | KameleoonException.MaximumRetriesReached,\n );\n constructor(\n type: KameleoonException.FeatureFlagConfigurationNotFound,\n featureKey: string,\n visitorCode: string,\n );\n constructor(\n type: KameleoonException.FeatureFlagVariableNotFound,\n variableKey: 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.VisitorCodeEmpty:\n case KameleoonException.StorageInitialization:\n case KameleoonException.VariationNotFound:\n case KameleoonException.EventSourceInitialization:\n case KameleoonException.RemoteData:\n case KameleoonException.MaximumRetriesReached:\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.FeatureFlagVariableNotFound:\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":";;;;;;AAEA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAA6C,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;AAE7C;AACA;AACA;AACA;AACO,MAAMU,cAAc,SAASC,KAAK,CAAC;EAGxC;AACF;AACA;;EAoDEC,WAAWA,CACTC,IAAwB,EACxBC,WAKiB,EACjBC,UAAy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ChB,IAAI,CAAC,CAACC,WAAW,CAAwB;QACvE;MACF,KAAKI,yBAAkB,CAACoB,YAAY;QAClC,IAAI,CAACV,OAAO,GAAGC,yBAAc,CAAChB,IAAI,CAAC,CACjCC,WAAW,EACXC,UAAU,CACX;QACD;MACF,KAAKG,yBAAkB,CAACqB,kBAAkB;QACxC,IAAI,CAACX,OAAO,GAAGC,yBAAc,CAAChB,IAAI,CAAC,CAACC,WAAW,CAAkB;QACjE;MACF,KAAKI,yBAAkB,CAACsB,WAAW;QACjC,IAAI,CAACZ,OAAO,GAAGC,yBAAc,CAAChB,IAAI,CAAC,CAACC,WAAW,CAAW;QAC1D;MACF,KAAKI,yBAAkB,CAACuB,gBAAgB;QACtC,IAAI,CAACb,OAAO,GAAGC,yBAAc,CAAChB,IAAI,CAAC,CAACC,WAAW,EAAEC,UAAU,CAAW;QACtE;MACF;QACE,IAAA2B,qBAAY,EAAC7B,IAAI,CAAC;IAAC;EAEzB;EAEA,IAAIA,IAAIA,CAAA,EAAuB;IAC7B,OAAO,IAAI,CAACI,SAAS;EACvB;AACF;AAAC0B,OAAA,CAAAjC,cAAA,GAAAA,cAAA"}
1
+ {"version":3,"file":"kameleoonError.js","names":["KameleoonError","a","b","type","secondParam","thirdParam","f","_classCallCheck","c","call","concat","_defineProperty","_assertThisInitialized","name","errorType","KameleoonException","Initialization","ClientConfiguration","VisitorCodeMaxLength","VisitorCodeEmpty","StorageInitialization","VariationNotFound","EventSourceInitialization","RemoteData","MaximumRetriesReached","message","ERROR_MESSAGES","NotAllocated","NotTargeted","ExperimentConfigurationNotFound","FeatureFlagVariableNotFound","FeatureFlagConfigurationNotFound","StorageWrite","JSONParse","StorageRead","StorageParse","TargetingCondition","NumberParse","VersionParse","SemanticVersionParse","AmongValuesCheck","exhaustCheck","_inherits","_createSuper","_createClass","key","get","_wrapNativeSuper","Error","exports"],"sources":["../../src/kameleoonError/kameleoonError.ts"],"sourcesContent":["import { KameleoonStorageKey } from 'src/storage';\nimport { TargetingType } from 'src/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.VisitorCodeEmpty\n | KameleoonException.StorageInitialization\n | KameleoonException.EventSourceInitialization\n | KameleoonException.VariationNotFound\n | KameleoonException.RemoteData\n | KameleoonException.MaximumRetriesReached,\n );\n constructor(\n type: KameleoonException.FeatureFlagConfigurationNotFound,\n featureKey: string,\n visitorCode: string,\n );\n constructor(\n type: KameleoonException.FeatureFlagVariableNotFound,\n variableKey: 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(\n type:\n | KameleoonException.NumberParse\n | KameleoonException.VersionParse\n | KameleoonException.SemanticVersionParse,\n value: string,\n );\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.VisitorCodeEmpty:\n case KameleoonException.StorageInitialization:\n case KameleoonException.VariationNotFound:\n case KameleoonException.EventSourceInitialization:\n case KameleoonException.RemoteData:\n case KameleoonException.MaximumRetriesReached:\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.FeatureFlagVariableNotFound:\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 case KameleoonException.VersionParse:\n case KameleoonException.SemanticVersionParse:\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":"yzHAMA;AACA;AACA;AACA,KAHA,GAIa,CAAAA,cAAc,uBAAAC,CAAA,EA+DzB,SAAAC,EACEC,CAAwB,CACxBC,CAKiB,CACjBC,CAAyC,CACzC,KAAAC,CAAA,QAAAC,eAAA,MAAAL,CAAA,EAAAI,CAAA,CAAAE,CAAA,CAAAC,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se = "JSONParse",
20
20
  NumberParse = "NumberParse",
21
+ VersionParse = "VersionParse",
22
+ SemanticVersionParse = "SemanticVersionParse",
21
23
  RemoteData = "RemoteData",
22
24
  MaximumRetriesReached = "MaximumRetriesReached"
23
25
  }
@@ -1,32 +1,2 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.KameleoonException = void 0;
7
- let KameleoonException = /*#__PURE__*/function (KameleoonException) {
8
- KameleoonException["ExperimentConfigurationNotFound"] = "ExperimentConfigurationNotFound";
9
- KameleoonException["EventSourceInitialization"] = "EventSourceInitialization";
10
- KameleoonException["VariationNotFound"] = "VariationNotFound";
11
- KameleoonException["FeatureFlagConfigurationNotFound"] = "FeatureFlagConfigurationNotFound";
12
- KameleoonException["FeatureFlagVariableNotFound"] = "FeatureFlagVariableNotFound";
13
- KameleoonException["NotTargeted"] = "NotTargeted";
14
- KameleoonException["NotAllocated"] = "NotAllocated";
15
- KameleoonException["VisitorCodeMaxLength"] = "VisitorCodeMaxLength";
16
- KameleoonException["VisitorCodeEmpty"] = "VisitorCodeEmpty";
17
- KameleoonException["StorageInitialization"] = "StorageInitialization";
18
- KameleoonException["StorageWrite"] = "StorageWrite";
19
- KameleoonException["StorageRead"] = "StorageRead";
20
- KameleoonException["StorageParse"] = "StorageParse";
21
- KameleoonException["ClientConfiguration"] = "ClientConfiguration";
22
- KameleoonException["TargetingCondition"] = "TargetingCondition";
23
- KameleoonException["AmongValuesCheck"] = "AmongValuesCheck";
24
- KameleoonException["Initialization"] = "Initialization";
25
- KameleoonException["JSONParse"] = "JSONParse";
26
- KameleoonException["NumberParse"] = "NumberParse";
27
- KameleoonException["RemoteData"] = "RemoteData";
28
- KameleoonException["MaximumRetriesReached"] = "MaximumRetriesReached";
29
- return KameleoonException;
30
- }({});
31
- exports.KameleoonException = KameleoonException;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonException=void 0;var KameleoonException=/*#__PURE__*/function(a){return a.ExperimentConfigurationNotFound="ExperimentConfigurationNotFound",a.EventSourceInitialization="EventSourceInitialization",a.VariationNotFound="VariationNotFound",a.FeatureFlagConfigurationNotFound="FeatureFlagConfigurationNotFound",a.FeatureFlagVariableNotFound="FeatureFlagVariableNotFound",a.NotTargeted="NotTargeted",a.NotAllocated="NotAllocated",a.VisitorCodeMaxLength="VisitorCodeMaxLength",a.VisitorCodeEmpty="VisitorCodeEmpty",a.StorageInitialization="StorageInitialization",a.StorageWrite="StorageWrite",a.StorageRead="StorageRead",a.StorageParse="StorageParse",a.ClientConfiguration="ClientConfiguration",a.TargetingCondition="TargetingCondition",a.AmongValuesCheck="AmongValuesCheck",a.Initialization="Initialization",a.JSONParse="JSONParse",a.NumberParse="NumberParse",a.VersionParse="VersionParse",a.SemanticVersionParse="SemanticVersionParse",a.RemoteData="RemoteData",a.MaximumRetriesReached="MaximumRetriesReached",a}({});exports.KameleoonException=KameleoonException;
32
2
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
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 VariationNotFound = 'VariationNotFound',\n FeatureFlagConfigurationNotFound = 'FeatureFlagConfigurationNotFound',\n FeatureFlagVariableNotFound = 'FeatureFlagVariableNotFound',\n NotTargeted = 'NotTargeted',\n NotAllocated = 'NotAllocated',\n VisitorCodeMaxLength = 'VisitorCodeMaxLength',\n VisitorCodeEmpty = 'VisitorCodeEmpty',\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 JSONParse = 'JSONParse',\n NumberParse = 'NumberParse',\n RemoteData = 'RemoteData',\n MaximumRetriesReached = 'MaximumRetriesReached',\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;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;AAAAC,OAAA,CAAAD,kBAAA,GAAAA,kBAAA"}
1
+ {"version":3,"file":"types.js","names":["KameleoonException","ExperimentConfigurationNotFound","EventSourceInitialization","VariationNotFound","FeatureFlagConfigurationNotFound","FeatureFlagVariableNotFound","NotTargeted","NotAllocated","VisitorCodeMaxLength","VisitorCodeEmpty","StorageInitialization","StorageWrite","StorageRead","StorageParse","ClientConfiguration","TargetingCondition","AmongValuesCheck","Initialization","JSONParse","NumberParse","VersionParse","SemanticVersionParse","RemoteData","MaximumRetriesReached","exports"],"sources":["../../src/kameleoonError/types.ts"],"sourcesContent":["export enum KameleoonException {\n ExperimentConfigurationNotFound = 'ExperimentConfigurationNotFound',\n EventSourceInitialization = 'EventSourceInitialization',\n VariationNotFound = 'VariationNotFound',\n FeatureFlagConfigurationNotFound = 'FeatureFlagConfigurationNotFound',\n FeatureFlagVariableNotFound = 'FeatureFlagVariableNotFound',\n NotTargeted = 'NotTargeted',\n NotAllocated = 'NotAllocated',\n VisitorCodeMaxLength = 'VisitorCodeMaxLength',\n VisitorCodeEmpty = 'VisitorCodeEmpty',\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 JSONParse = 'JSONParse',\n NumberParse = 'NumberParse',\n VersionParse = 'VersionParse',\n SemanticVersionParse = 'SemanticVersionParse',\n RemoteData = 'RemoteData',\n MaximumRetriesReached = 'MaximumRetriesReached',\n}\n"],"mappings":"yGAAY,CAAAA,kBAAkB,uBAAlBA,CAAkB,QAAlB,CAAAA,CAAkB,CAAAC,+BAAA,mCAAlBD,CAAkB,CAAAE,yBAAA,6BAAlBF,CAAkB,CAAAG,iBAAA,qBAAlBH,CAAkB,CAAAI,gCAAA,oCAAlBJ,CAAkB,CAAAK,2BAAA,+BAAlBL,CAAkB,CAAAM,WAAA,eAAlBN,CAAkB,CAAAO,YAAA,gBAAlBP,CAAkB,CAAAQ,oBAAA,wBAAlBR,CAAkB,CAAAS,gBAAA,oBAAlBT,CAAkB,CAAAU,qBAAA,yBAAlBV,CAAkB,CAAAW,YAAA,gBAAlBX,CAAkB,CAAAY,WAAA,eAAlBZ,CAAkB,CAAAa,YAAA,gBAAlBb,CAAkB,CAAAc,mBAAA,uBAAlBd,CAAkB,CAAAe,kBAAA,sBAAlBf,CAAkB,CAAAgB,gBAAA,oBAAlBhB,CAAkB,CAAAiB,cAAA,kBAAlBjB,CAAkB,CAAAkB,SAAA,aAAlBlB,CAAkB,CAAAmB,WAAA,eAAlBnB,CAAkB,CAAAoB,YAAA,gBAAlBpB,CAAkB,CAAAqB,oBAAA,wBAAlBrB,CAAkB,CAAAsB,UAAA,cAAlBtB,CAAkB,CAAAuB,qBAAA,yBAAlBvB,CAAkB,MAAAwB,OAAA,CAAAxB,kBAAA,CAAAA,kBAAA"}
@@ -1,47 +1,5 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.KameleoonUtils = void 0;
7
- var _tsRes = require("ts-res");
8
- var _constants = require("./constants");
9
- /**
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonUtils=void 0;var _tsRes=require("ts-res"),_constants=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 _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _iterableToArrayLimit(a,b){var c=null==a?null:"undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(null!=c){var d,e,f,g,h=[],i=!0,j=!1;try{if(f=(c=c.call(a)).next,0===b){if(Object(c)!==c)return;i=!1}else for(;!(i=(d=f.call(c)).done)&&(h.push(d.value),h.length!==b);i=!0);}catch(a){j=!0,e=a}finally{try{if(!i&&null!=c.return&&(g=c.return(),Object(g)!==g))return}finally{if(j)throw e}}return h}}function _arrayWithHoles(a){if(Array.isArray(a))return 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)}/**
10
2
  * @abstract
11
3
  * KameleoonUtils - an abstract class for extending kameleoon utils with pre-defined method signatures
12
- * */
13
- class KameleoonUtils {
14
- generateRandomString(length) {
15
- const characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
16
- let randomString = '';
17
- if (length < 0) {
18
- return randomString;
19
- }
20
- for (let i = 0; i < length; i++) {
21
- randomString += characters[Math.floor(Math.random() * characters.length)];
22
- }
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);
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
- }
45
- }
46
- exports.KameleoonUtils = KameleoonUtils;
4
+ * */var KameleoonUtils=/*#__PURE__*/function(){function a(){_classCallCheck(this,a)}return _createClass(a,[{key:"generateRandomString",value:function generateRandomString(a){var b="";if(0>a)return b;for(var c=0;c<a;c++)b+="abcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(36*Math.random())];return b}},{key:"getCookieVisitorCode",value:function getCookieVisitorCode(a){var b=a.split(_constants.Cookie.PairsDelimiter),c=b.find(function(a){var b=a.split(_constants.Cookie.KeyValueDelimiter),c=_slicedToArray(b,2),d=c[0],e=c[1];return d===_constants.KAMELEOON_COOKIE_KEY});if(c){var d=c.split(_constants.Cookie.KeyValueDelimiter),e=_slicedToArray(d,2),f=e[0],g=e[1];return(0,_tsRes.Ok)(g)}return(0,_tsRes.Err)()}},{key:"getResultCookie",value:function getResultCookie(a){var b=a.domain,c=a.visitorCode,d=[_constants.KAMELEOON_COOKIE_KEY+_constants.Cookie.KeyValueDelimiter+c,_constants.Cookie.MaxAge+_constants.Cookie.KeyValueDelimiter+31536000,_constants.Cookie.Path+_constants.Cookie.KeyValueDelimiter+"/",_constants.Cookie.Domain+_constants.Cookie.KeyValueDelimiter+b];return d.join(_constants.Cookie.PairsDelimiter)}}]),a}();exports.KameleoonUtils=KameleoonUtils;
47
5
  //# sourceMappingURL=kameleoonUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"kameleoonUtils.js","names":["_tsRes","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 + '/',\n Cookie.Domain + Cookie.KeyValueDelimiter + domain,\n ];\n\n return cookieArray.join(Cookie.PairsDelimiter);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAQA;AACA;AACA;AACA;AACO,MAAeE,cAAc,CAAC;EAQzBC,oBAAoBA,CAACC,MAAc,EAAU;IACrD,MAAMC,UAAU,GAAG,sCAAsC;IACzD,IAAIC,YAAY,GAAG,EAAE;IAErB,IAAIF,MAAM,GAAG,CAAC,EAAE;MACd,OAAOE,YAAY;IACrB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AW,CAACI,IAAI,CAACnB,iBAAM,CAACC,cAAc,CAAC;EAChD;AACF;AAACmB,OAAA,CAAAjC,cAAA,GAAAA,cAAA"}
1
+ {"version":3,"file":"kameleoonUtils.js","names":["KameleoonUtils","a","_classCallCheck","_createClass","key","value","generateRandomString","length","randomString","i","Math","floor","random","getCookieVisitorCode","cookie","pairs","split","Cookie","PairsDelimiter","pair","find","b","KeyValueDelimiter","c","_slicedToArray","_","KAMELEOON_COOKIE_KEY","d","e","Ok","Err","getResultCookie","domain","visitorCode","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 + '/',\n Cookie.Domain + Cookie.KeyValueDelimiter + domain,\n ];\n\n return cookieArray.join(Cookie.PairsDelimiter);\n }\n}\n"],"mappings":"69EASA;AACA;AACA;AACA,KAHA,GAIsB,CAAAA,cAAc,kCAAAC,EAAA,EAAAC,eAAA,MAAAD,CAAA,SAAAE,YAAA,CAAAF,CAAA,GAAAG,GAAA,wBAAAC,KAAA,CAQlC,SAAAC,qBAA+BC,CAAc,CAAU,IAEjD,CAAAC,CAAY,CAAG,EAAE,CAErB,GAAa,CAAC,CAAVD,CAAU,CACZ,MAAO,CAAAC,CAAY,CAGrB,IAAK,GAAI,CAAAC,CAAC,CAAG,CAAC,CAAEA,CAAC,CAAGF,CAAM,CAAEE,CAAC,EAAE,CAC7BD,CAAY,EAAI,uCAAWE,IAAI,CAACC,KAAK,CAAC,GAAAD,IAAI,CAACE,MAAM,EAAsB,CAAC,CAAC,CAG3E,MAAO,CAAAJ,CACT,CAAC,GAAAJ,GAAA,wBAAAC,KAAA,CAED,SAAAQ,qBAA+BC,CAAc,CAAwB,IAC7D,CAAAC,CAAK,CAAGD,CAAM,CAACE,KAAK,CAACC,iBAAM,CAACC,cAAc,CAAC,CAC3CC,CAAI,CAAGJ,CAAK,CAACK,IAAI,CAAC,SAACD,CAAI,CAAK,CAChC,IAAAE,CAAA,CAAiBF,CAAI,CAACH,KAAK,CAACC,iBAAM,CAACK,iBAAiB,CAAC,CAAAC,CAAA,CAAAC,cAAA,CAAAH,CAAA,IAA9CjB,CAAG,CAAAmB,CAAA,IAAEE,CAAC,CAAAF,CAAA,IAEb,MAAO,CAAAnB,CAAG,GAAKsB,+BACjB,CAAC,CAAC,CAEF,GAAIP,CAAI,CAAE,CACR,IAAAQ,CAAA,CAAmBR,CAAI,CAAC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