@kameleoon/javascript-sdk-core 3.6.0 → 3.6.1

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.
@@ -21,6 +21,7 @@ export declare const ERROR_MESSAGES: {
21
21
  StorageWrite: (err: unknown) => string;
22
22
  StorageRead: (key: KameleoonStorageKey) => string;
23
23
  StorageParse: (err: unknown, key: KameleoonStorageKey) => string;
24
+ StorageEmpty: () => string;
24
25
  ClientConfiguration: () => string;
25
26
  TargetingCondition: (targetingType: TargetingType) => string;
26
27
  AmongValuesCheck: (err: unknown, value: string) => string;
@@ -1,2 +1,2 @@
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.CookieParse,function(a){return"Couldn't parse cookie string: ".concat(a)}),_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.Credentials,function(){return"KameleoonClient can not be created without credentials"}),_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.FeatureFlagConfigurationNotFound,function(a){return"No feature flag with key ".concat(a," was found.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.FeatureFlagEnvironmentDisabled,function(a,b){return"Feature flag with key ".concat(a," is disabled in ").concat(b," environment.")}),_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.FeatureFlagVariationNotFound,function(a,b){return"No feature flag variation with key ".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.VisitAmount,function(){return"Visit amount must be a number between 1 and 25"}),_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;
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.CookieParse,function(a){return"Couldn't parse cookie string: ".concat(a)}),_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.Credentials,function(){return"KameleoonClient can not be created without credentials"}),_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.FeatureFlagConfigurationNotFound,function(a){return"No feature flag with key ".concat(a," was found.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.FeatureFlagEnvironmentDisabled,function(a,b){return"Feature flag with key ".concat(a," is disabled in ").concat(b," environment.")}),_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.FeatureFlagVariationNotFound,function(a,b){return"No feature flag variation with key ".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.VisitAmount,function(){return"Visit amount must be a number between 1 and 25"}),_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.StorageEmpty,function(){return"The storage is empty"}),_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;
2
2
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["ERROR_MESSAGES","_ERROR_MESSAGES","_defineProperty","KameleoonException","CookieParse","reason","concat","JSONParse","err","NumberParse","value","VersionParse","SemanticVersionParse","Initialization","Credentials","StorageInitialization","EventSourceInitialization","FeatureFlagConfigurationNotFound","featureKey","FeatureFlagEnvironmentDisabled","environment","FeatureFlagVariableNotFound","variableKey","visitorCode","FeatureFlagVariationNotFound","variationKey","NotTargeted","VisitAmount","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.CookieParse]: (reason: string) =>\n `Couldn't parse cookie string: ${reason}`,\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.Credentials]: () =>\n 'KameleoonClient can not be created without credentials',\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.FeatureFlagConfigurationNotFound]: (featureKey: string) =>\n `No feature flag with key ${featureKey} was found.`,\n [KameleoonException.FeatureFlagEnvironmentDisabled]: (\n featureKey: string,\n environment: string,\n ) =>\n `Feature flag with key ${featureKey} is disabled in ${environment} environment.`,\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.FeatureFlagVariationNotFound]: (\n variationKey: string,\n visitorCode: string,\n ) =>\n `No feature flag variation with key ${variationKey} was found for ${visitorCode} visitorCode.`,\n [KameleoonException.NotTargeted]: (visitorCode: string) =>\n `Visitor code ${visitorCode} is not targeted`,\n [KameleoonException.VisitAmount]: () =>\n 'Visit amount must be a number between 1 and 25',\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,WAAW,CAAG,SAACC,CAAc,yCAAAC,MAAA,CACdD,CAAM,EAAE,EAAAH,eAAA,CAAAD,eAAA,CAC1CE,yBAAkB,CAACI,SAAS,CAAG,SAACC,CAAY,yCAAAF,MAAA,CACVE,CAAG,EAAE,EAAAN,eAAA,CAAAD,eAAA,CACvCE,yBAAkB,CAACM,WAAW,C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AAAA,cAAA"}
1
+ {"version":3,"file":"constants.js","names":["ERROR_MESSAGES","_ERROR_MESSAGES","_defineProperty","KameleoonException","CookieParse","reason","concat","JSONParse","err","NumberParse","value","VersionParse","SemanticVersionParse","Initialization","Credentials","StorageInitialization","EventSourceInitialization","FeatureFlagConfigurationNotFound","featureKey","FeatureFlagEnvironmentDisabled","environment","FeatureFlagVariableNotFound","variableKey","visitorCode","FeatureFlagVariationNotFound","variationKey","NotTargeted","VisitAmount","VisitorCodeMaxLength","VisitorCodeEmpty","StorageWrite","StorageRead","key","StorageParse","StorageEmpty","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.CookieParse]: (reason: string) =>\n `Couldn't parse cookie string: ${reason}`,\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.Credentials]: () =>\n 'KameleoonClient can not be created without credentials',\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.FeatureFlagConfigurationNotFound]: (featureKey: string) =>\n `No feature flag with key ${featureKey} was found.`,\n [KameleoonException.FeatureFlagEnvironmentDisabled]: (\n featureKey: string,\n environment: string,\n ) =>\n `Feature flag with key ${featureKey} is disabled in ${environment} environment.`,\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.FeatureFlagVariationNotFound]: (\n variationKey: string,\n visitorCode: string,\n ) =>\n `No feature flag variation with key ${variationKey} was found for ${visitorCode} visitorCode.`,\n [KameleoonException.NotTargeted]: (visitorCode: string) =>\n `Visitor code ${visitorCode} is not targeted`,\n [KameleoonException.VisitAmount]: () =>\n 'Visit amount must be a number between 1 and 25',\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.StorageEmpty]: () => `The storage is empty`,\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,WAAW,CAAG,SAACC,CAAc,yCAAAC,MAAA,CACdD,CAAM,EAAE,EAAAH,e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K,SAAAJ,MAAA,CAAME,CAAG,EAAE,EAAAN,eAAA,CAAAD,eAAA,CAC1CE,yBAAkB,CAACoC,UAAU,CAAG,gEACe,EAAArC,eAAA,CAAAD,eAAA,CAC/CE,yBAAkB,CAACqC,qBAAqB,CAAG,2DACD,EAAAvC,eAAA,CAC5C,CAACwC,OAAA,CAAAzC,cAAA,CAAAA,cAAA"}
@@ -10,7 +10,7 @@ export declare class KameleoonError extends Error {
10
10
  /**
11
11
  * @param {KameleoonException} type - type of KameleoonError represented by `KameleoonException` enum
12
12
  * */
13
- constructor(type: KameleoonException.Initialization | KameleoonException.Credentials | KameleoonException.ClientConfiguration | KameleoonException.VisitorCodeMaxLength | KameleoonException.VisitorCodeEmpty | KameleoonException.VisitAmount | KameleoonException.StorageInitialization | KameleoonException.EventSourceInitialization | KameleoonException.RemoteData | KameleoonException.MaximumRetriesReached);
13
+ constructor(type: KameleoonException.Initialization | KameleoonException.Credentials | KameleoonException.ClientConfiguration | KameleoonException.VisitorCodeMaxLength | KameleoonException.VisitorCodeEmpty | KameleoonException.VisitAmount | KameleoonException.StorageInitialization | KameleoonException.EventSourceInitialization | KameleoonException.RemoteData | KameleoonException.MaximumRetriesReached | KameleoonException.StorageEmpty);
14
14
  constructor(type: KameleoonException.FeatureFlagConfigurationNotFound | KameleoonException.FeatureFlagEnvironmentDisabled, featureKey: string);
15
15
  constructor(type: KameleoonException.FeatureFlagConfigurationNotFound | KameleoonException.FeatureFlagEnvironmentDisabled, featureKey: string, environment: string);
16
16
  constructor(type: KameleoonException.FeatureFlagVariableNotFound, variableKey: string, visitorCode: string);
@@ -1,2 +1,2 @@
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)}var KameleoonError=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.Credentials||a===_types.KameleoonException.ClientConfiguration||a===_types.KameleoonException.VisitorCodeMaxLength||a===_types.KameleoonException.VisitorCodeEmpty||a===_types.KameleoonException.StorageInitialization||a===_types.KameleoonException.VisitAmount||a===_types.KameleoonException.EventSourceInitialization||a===_types.KameleoonException.RemoteData||a===_types.KameleoonException.MaximumRetriesReached?f.message=_constants.ERROR_MESSAGES[a]():a===_types.KameleoonException.CookieParse||a===_types.KameleoonException.NotTargeted||a===_types.KameleoonException.FeatureFlagConfigurationNotFound||a===_types.KameleoonException.NumberParse||a===_types.KameleoonException.VersionParse||a===_types.KameleoonException.SemanticVersionParse?f.message=_constants.ERROR_MESSAGES[a](d):a===_types.KameleoonException.FeatureFlagVariationNotFound||a===_types.KameleoonException.FeatureFlagEnvironmentDisabled||a===_types.KameleoonException.FeatureFlagVariableNotFound?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.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}(_wrapNativeSuper(Error));exports.KameleoonError=KameleoonError;
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)}var KameleoonError=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.Credentials||a===_types.KameleoonException.ClientConfiguration||a===_types.KameleoonException.VisitorCodeMaxLength||a===_types.KameleoonException.VisitorCodeEmpty||a===_types.KameleoonException.StorageInitialization||a===_types.KameleoonException.VisitAmount||a===_types.KameleoonException.EventSourceInitialization||a===_types.KameleoonException.RemoteData||a===_types.KameleoonException.MaximumRetriesReached||a===_types.KameleoonException.StorageEmpty?f.message=_constants.ERROR_MESSAGES[a]():a===_types.KameleoonException.CookieParse||a===_types.KameleoonException.NotTargeted||a===_types.KameleoonException.FeatureFlagConfigurationNotFound||a===_types.KameleoonException.NumberParse||a===_types.KameleoonException.VersionParse||a===_types.KameleoonException.SemanticVersionParse?f.message=_constants.ERROR_MESSAGES[a](d):a===_types.KameleoonException.FeatureFlagVariationNotFound||a===_types.KameleoonException.FeatureFlagEnvironmentDisabled||a===_types.KameleoonException.FeatureFlagVariableNotFound?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.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}(_wrapNativeSuper(Error));exports.KameleoonError=KameleoonError;
2
2
  //# sourceMappingURL=kameleoonError.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"kameleoonError.js","names":["KameleoonError","a","b","type","secondParam","thirdParam","f","_classCallCheck","c","call","concat","_defineProperty","_assertThisInitialized","name","errorType","KameleoonException","Initialization","Credentials","ClientConfiguration","VisitorCodeMaxLength","VisitorCodeEmpty","StorageInitialization","VisitAmount","EventSourceInitialization","RemoteData","MaximumRetriesReached","message","ERROR_MESSAGES","CookieParse","NotTargeted","FeatureFlagConfigurationNotFound","NumberParse","VersionParse","SemanticVersionParse","FeatureFlagVariationNotFound","FeatureFlagEnvironmentDisabled","FeatureFlagVariableNotFound","StorageWrite","JSONParse","StorageRead","StorageParse","TargetingCondition","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.Credentials\n | KameleoonException.ClientConfiguration\n | KameleoonException.VisitorCodeMaxLength\n | KameleoonException.VisitorCodeEmpty\n | KameleoonException.VisitAmount\n | KameleoonException.StorageInitialization\n | KameleoonException.EventSourceInitialization\n | KameleoonException.RemoteData\n | KameleoonException.MaximumRetriesReached,\n );\n constructor(\n type:\n | KameleoonException.FeatureFlagConfigurationNotFound\n | KameleoonException.FeatureFlagEnvironmentDisabled,\n featureKey: string,\n );\n constructor(\n type:\n | KameleoonException.FeatureFlagConfigurationNotFound\n | KameleoonException.FeatureFlagEnvironmentDisabled,\n featureKey: string,\n environment: string,\n );\n constructor(\n type: KameleoonException.FeatureFlagVariableNotFound,\n variableKey: string,\n visitorCode: string,\n );\n constructor(\n type: KameleoonException.FeatureFlagVariationNotFound,\n variationKey: string,\n visitorCode: string,\n );\n constructor(type: KameleoonException.NotTargeted, visitorCode: string);\n constructor(type: KameleoonException.CookieParse, message: string);\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.Credentials:\n case KameleoonException.ClientConfiguration:\n case KameleoonException.VisitorCodeMaxLength:\n case KameleoonException.VisitorCodeEmpty:\n case KameleoonException.StorageInitialization:\n case KameleoonException.VisitAmount:\n case KameleoonException.EventSourceInitialization:\n case KameleoonException.RemoteData:\n case KameleoonException.MaximumRetriesReached:\n this.message = ERROR_MESSAGES[type]();\n break;\n case KameleoonException.CookieParse:\n case KameleoonException.NotTargeted:\n case KameleoonException.FeatureFlagConfigurationNotFound:\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.FeatureFlagVariationNotFound:\n case KameleoonException.FeatureFlagEnvironmentDisabled:\n case KameleoonException.FeatureFlagVariableNotFound:\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.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":"4zHAUa,CAAAA,cAAc,UAAAC,CAAA,EAsEzB,SAAAC,EACEC,CAAwB,CACxBC,CAKiB,CACjBC,CAAyC,CACzC,KAAAC,CAAA,QAAAC,eAAA,MAAAL,CAAA,EAAAI,CAAA,CAAAE,CAAA,CAAAC,IAAA,gBAAAC,MAAA,CACgBP,CAAI,GAAAQ,eAAA,CAAAC,sBAAA,CAAAN,CAAA,sBAEpBA,CAAA,CAAKO,IAAI,CAAG,gBAAgB,CAC5BP,CAAA,CAAKQ,SAAS,CAAGX,CAAI,EAEbA,CAAI,GACLY,yBAAkB,CAACC,cAAc,EADhCb,CAAI,GAELY,yBAAkB,CAACE,WAAW,EAF7Bd,CAAI,GAGLY,yBAAkB,CAACG,mBAAmB,EAHrCf,CAAI,GAILY,yBAAkB,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,CAAwB,CAlCnED,CAAI,GAoCLY,yBAAkB,CAACyB,YAAY,CAClClC,CAAA,CAAKoB,OAAO,CAAGC,yBAAc,CAACxB,CAAI,CAAC,CACjCC,CAAW,CACXC,CAAU,CACX,CAxCGF,CAAI,GA0CLY,yBAAkB,CAAC0B,kBAAkB,CACxCnC,CAAA,CAAKoB,OAAO,CAAGC,yBAAc,CAACxB,CAAI,CAAC,CAACC,CAAW,CAAkB,CA3C7DD,CAAI,GA6CLY,yBAAkB,CAAC2B,gBAAgB,CACtCpC,CAAA,CAAKoB,OAAO,CAAGC,yBAAc,CAACxB,CAAI,CAAC,CAACC,CAAW,CAAEC,CAAU,CAAW,CAGtE,GAAAsC,qBAAY,EAACxC,CAAI,CAAC,CAAAG,CAAA,CAExB,CAACsC,SAAA,CAAA1C,CAAA,CAAAD,CAAA,MAAAO,CAAA,CAAAqC,YAAA,CAAA3C,CAAA,SAAA4C,YAAA,CAAA5C,CAAA,GAAA6C,GAAA,QAAAC,GAAA,CAED,SAAAA,IAAA,CAA+B,CAC7B,MAAO,KAAI,CAAClC,SACd,CAAC,IAAAZ,CAAA,EAAA+C,gBAAA,CA5IiCC,KAAK,GAAAC,OAAA,CAAAnD,cAAA,CAAAA,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","Credentials","ClientConfiguration","VisitorCodeMaxLength","VisitorCodeEmpty","StorageInitialization","VisitAmount","EventSourceInitialization","RemoteData","MaximumRetriesReached","StorageEmpty","message","ERROR_MESSAGES","CookieParse","NotTargeted","FeatureFlagConfigurationNotFound","NumberParse","VersionParse","SemanticVersionParse","FeatureFlagVariationNotFound","FeatureFlagEnvironmentDisabled","FeatureFlagVariableNotFound","StorageWrite","JSONParse","StorageRead","StorageParse","TargetingCondition","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.Credentials\n | KameleoonException.ClientConfiguration\n | KameleoonException.VisitorCodeMaxLength\n | KameleoonException.VisitorCodeEmpty\n | KameleoonException.VisitAmount\n | KameleoonException.StorageInitialization\n | KameleoonException.EventSourceInitialization\n | KameleoonException.RemoteData\n | KameleoonException.MaximumRetriesReached\n | KameleoonException.StorageEmpty,\n );\n constructor(\n type:\n | KameleoonException.FeatureFlagConfigurationNotFound\n | KameleoonException.FeatureFlagEnvironmentDisabled,\n featureKey: string,\n );\n constructor(\n type:\n | KameleoonException.FeatureFlagConfigurationNotFound\n | KameleoonException.FeatureFlagEnvironmentDisabled,\n featureKey: string,\n environment: string,\n );\n constructor(\n type: KameleoonException.FeatureFlagVariableNotFound,\n variableKey: string,\n visitorCode: string,\n );\n constructor(\n type: KameleoonException.FeatureFlagVariationNotFound,\n variationKey: string,\n visitorCode: string,\n );\n constructor(type: KameleoonException.NotTargeted, visitorCode: string);\n constructor(type: KameleoonException.CookieParse, message: string);\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.Credentials:\n case KameleoonException.ClientConfiguration:\n case KameleoonException.VisitorCodeMaxLength:\n case KameleoonException.VisitorCodeEmpty:\n case KameleoonException.StorageInitialization:\n case KameleoonException.VisitAmount:\n case KameleoonException.EventSourceInitialization:\n case KameleoonException.RemoteData:\n case KameleoonException.MaximumRetriesReached:\n case KameleoonException.StorageEmpty:\n this.message = ERROR_MESSAGES[type]();\n break;\n case KameleoonException.CookieParse:\n case KameleoonException.NotTargeted:\n case KameleoonException.FeatureFlagConfigurationNotFound:\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.FeatureFlagVariationNotFound:\n case KameleoonException.FeatureFlagEnvironmentDisabled:\n case KameleoonException.FeatureFlagVariableNotFound:\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.AmongValuesCheck:\n this.message = ERROR_MESSAGES[type](secondParam, thirdParam as string);\n break;\n default:\n exhaustCheck(type);\n }\n }\n\n get type(): Kameleo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CAACnC,SACd,CAAC,IAAAZ,CAAA,EAAAgD,gBAAA,CA9IiCC,KAAK,GAAAC,OAAA,CAAApD,cAAA,CAAAA,cAAA"}
@@ -16,6 +16,7 @@ export declare enum KameleoonException {
16
16
  StorageInitialization = "StorageInitialization",
17
17
  StorageWrite = "StorageWrite",
18
18
  StorageRead = "StorageRead",
19
+ StorageEmpty = "StorageEmpty",
19
20
  StorageParse = "StorageParse",
20
21
  ClientConfiguration = "ClientConfiguration",
21
22
  TargetingCondition = "TargetingCondition",
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonException=void 0;var KameleoonException=function(a){return a.Credentials="Credentials",a.EventSourceInitialization="EventSourceInitialization",a.FeatureFlagConfigurationNotFound="FeatureFlagConfigurationNotFound",a.FeatureFlagVariableNotFound="FeatureFlagVariableNotFound",a.FeatureFlagVariationNotFound="FeatureFlagVariationNotFound",a.FeatureFlagEnvironmentDisabled="FeatureFlagEnvironmentDisabled",a.NotTargeted="NotTargeted",a.VisitAmount="VisitAmount",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.CookieParse="CookieParse",a.SemanticVersionParse="SemanticVersionParse",a.RemoteData="RemoteData",a.MaximumRetriesReached="MaximumRetriesReached",a}({});exports.KameleoonException=KameleoonException;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonException=void 0;var KameleoonException=function(a){return a.Credentials="Credentials",a.EventSourceInitialization="EventSourceInitialization",a.FeatureFlagConfigurationNotFound="FeatureFlagConfigurationNotFound",a.FeatureFlagVariableNotFound="FeatureFlagVariableNotFound",a.FeatureFlagVariationNotFound="FeatureFlagVariationNotFound",a.FeatureFlagEnvironmentDisabled="FeatureFlagEnvironmentDisabled",a.NotTargeted="NotTargeted",a.VisitAmount="VisitAmount",a.VisitorCodeMaxLength="VisitorCodeMaxLength",a.VisitorCodeEmpty="VisitorCodeEmpty",a.StorageInitialization="StorageInitialization",a.StorageWrite="StorageWrite",a.StorageRead="StorageRead",a.StorageEmpty="StorageEmpty",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.CookieParse="CookieParse",a.SemanticVersionParse="SemanticVersionParse",a.RemoteData="RemoteData",a.MaximumRetriesReached="MaximumRetriesReached",a}({});exports.KameleoonException=KameleoonException;
2
2
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":["KameleoonException","Credentials","EventSourceInitialization","FeatureFlagConfigurationNotFound","FeatureFlagVariableNotFound","FeatureFlagVariationNotFound","FeatureFlagEnvironmentDisabled","NotTargeted","VisitAmount","VisitorCodeMaxLength","VisitorCodeEmpty","StorageInitialization","StorageWrite","StorageRead","StorageParse","ClientConfiguration","TargetingCondition","AmongValuesCheck","Initialization","JSONParse","NumberParse","VersionParse","CookieParse","SemanticVersionParse","RemoteData","MaximumRetriesReached","exports"],"sources":["../../src/kameleoonError/types.ts"],"sourcesContent":["/**\n * @readonly\n * @enum {string} an Enum containing all possible variants of exception types `KameleoonError`\n * */\nexport enum KameleoonException {\n Credentials = 'Credentials',\n EventSourceInitialization = 'EventSourceInitialization',\n FeatureFlagConfigurationNotFound = 'FeatureFlagConfigurationNotFound',\n FeatureFlagVariableNotFound = 'FeatureFlagVariableNotFound',\n FeatureFlagVariationNotFound = 'FeatureFlagVariationNotFound',\n FeatureFlagEnvironmentDisabled = 'FeatureFlagEnvironmentDisabled',\n NotTargeted = 'NotTargeted',\n VisitAmount = 'VisitAmount',\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 CookieParse = 'CookieParse',\n SemanticVersionParse = 'SemanticVersionParse',\n RemoteData = 'RemoteData',\n MaximumRetriesReached = 'MaximumRetriesReached',\n}\n"],"mappings":"yGAIY,CAAAA,kBAAkB,UAAlBA,CAAkB,QAAlB,CAAAA,CAAkB,CAAAC,WAAA,eAAlBD,CAAkB,CAAAE,yBAAA,6BAAlBF,CAAkB,CAAAG,gCAAA,oCAAlBH,CAAkB,CAAAI,2BAAA,+BAAlBJ,CAAkB,CAAAK,4BAAA,gCAAlBL,CAAkB,CAAAM,8BAAA,kCAAlBN,CAAkB,CAAAO,WAAA,eAAlBP,CAAkB,CAAAQ,WAAA,eAAlBR,CAAkB,CAAAS,oBAAA,wBAAlBT,CAAkB,CAAAU,gBAAA,oBAAlBV,CAAkB,CAAAW,qBAAA,yBAAlBX,CAAkB,CAAAY,YAAA,gBAAlBZ,CAAkB,CAAAa,WAAA,eAAlBb,CAAkB,CAAAc,YAAA,gBAAlBd,CAAkB,CAAAe,mBAAA,uBAAlBf,CAAkB,CAAAgB,kBAAA,sBAAlBhB,CAAkB,CAAAiB,gBAAA,oBAAlBjB,CAAkB,CAAAkB,cAAA,kBAAlBlB,CAAkB,CAAAmB,SAAA,aAAlBnB,CAAkB,CAAAoB,WAAA,eAAlBpB,CAAkB,CAAAqB,YAAA,gBAAlBrB,CAAkB,CAAAsB,WAAA,eAAlBtB,CAAkB,CAAAuB,oBAAA,wBAAlBvB,CAAkB,CAAAwB,UAAA,cAAlBxB,CAAkB,CAAAyB,qBAAA,yBAAlBzB,CAAkB,MAAA0B,OAAA,CAAA1B,kBAAA,CAAAA,kBAAA"}
1
+ {"version":3,"file":"types.js","names":["KameleoonException","Credentials","EventSourceInitialization","FeatureFlagConfigurationNotFound","FeatureFlagVariableNotFound","FeatureFlagVariationNotFound","FeatureFlagEnvironmentDisabled","NotTargeted","VisitAmount","VisitorCodeMaxLength","VisitorCodeEmpty","StorageInitialization","StorageWrite","StorageRead","StorageEmpty","StorageParse","ClientConfiguration","TargetingCondition","AmongValuesCheck","Initialization","JSONParse","NumberParse","VersionParse","CookieParse","SemanticVersionParse","RemoteData","MaximumRetriesReached","exports"],"sources":["../../src/kameleoonError/types.ts"],"sourcesContent":["/**\n * @readonly\n * @enum {string} an Enum containing all possible variants of exception types `KameleoonError`\n * */\nexport enum KameleoonException {\n Credentials = 'Credentials',\n EventSourceInitialization = 'EventSourceInitialization',\n FeatureFlagConfigurationNotFound = 'FeatureFlagConfigurationNotFound',\n FeatureFlagVariableNotFound = 'FeatureFlagVariableNotFound',\n FeatureFlagVariationNotFound = 'FeatureFlagVariationNotFound',\n FeatureFlagEnvironmentDisabled = 'FeatureFlagEnvironmentDisabled',\n NotTargeted = 'NotTargeted',\n VisitAmount = 'VisitAmount',\n VisitorCodeMaxLength = 'VisitorCodeMaxLength',\n VisitorCodeEmpty = 'VisitorCodeEmpty',\n StorageInitialization = 'StorageInitialization',\n StorageWrite = 'StorageWrite',\n StorageRead = 'StorageRead',\n StorageEmpty = 'StorageEmpty',\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 CookieParse = 'CookieParse',\n SemanticVersionParse = 'SemanticVersionParse',\n RemoteData = 'RemoteData',\n MaximumRetriesReached = 'MaximumRetriesReached',\n}\n"],"mappings":"yGAIY,CAAAA,kBAAkB,UAAlBA,CAAkB,QAAlB,CAAAA,CAAkB,CAAAC,WAAA,eAAlBD,CAAkB,CAAAE,yBAAA,6BAAlBF,CAAkB,CAAAG,gCAAA,oCAAlBH,CAAkB,CAAAI,2BAAA,+BAAlBJ,CAAkB,CAAAK,4BAAA,gCAAlBL,CAAkB,CAAAM,8BAAA,kCAAlBN,CAAkB,CAAAO,WAAA,eAAlBP,CAAkB,CAAAQ,WAAA,eAAlBR,CAAkB,CAAAS,oBAAA,wBAAlBT,CAAkB,CAAAU,gBAAA,oBAAlBV,CAAkB,CAAAW,qBAAA,yBAAlBX,CAAkB,CAAAY,YAAA,gBAAlBZ,CAAkB,CAAAa,WAAA,eAAlBb,CAAkB,CAAAc,YAAA,gBAAlBd,CAAkB,CAAAe,YAAA,gBAAlBf,CAAkB,CAAAgB,mBAAA,uBAAlBhB,CAAkB,CAAAiB,kBAAA,sBAAlBjB,CAAkB,CAAAkB,gBAAA,oBAAlBlB,CAAkB,CAAAmB,cAAA,kBAAlBnB,CAAkB,CAAAoB,SAAA,aAAlBpB,CAAkB,CAAAqB,WAAA,eAAlBrB,CAAkB,CAAAsB,YAAA,gBAAlBtB,CAAkB,CAAAuB,WAAA,eAAlBvB,CAAkB,CAAAwB,oBAAA,wBAAlBxB,CAAkB,CAAAyB,UAAA,cAAlBzB,CAAkB,CAAA0B,qBAAA,yBAAlB1B,CAAkB,MAAA2B,OAAA,CAAA3B,kBAAA,CAAAA,kBAAA"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Requester=void 0;var _tsRes=require("ts-res"),_kameleoonError=require("../kameleoonError"),_utilities=require("../utilities"),_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 _regeneratorRuntime(){"use strict";function a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,c,e){var f=b&&b.prototype instanceof d?b:d,g=Object.create(f.prototype),h=new m(e||[]);return s(g,"_invoke",{value:i(a,c,h)}),g}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&r.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;s(this,"_invoke",{value:function value(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}})}function i(a,b,d){var e="suspendedStart";return function(f,g){if("executing"==e)throw new Error("Generator is already running");if("completed"==e){if("throw"===f)throw g;return o()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=j(h,d);if(i){if(i===x)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"==e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===x)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function j(a,b){var d=b.method,e=a.iterator[d];if(void 0===e)return b.delegate=null,"throw"===d&&a.iterator.return&&(b.method="return",b.arg=void 0,j(a,b),"throw"===b.method)||"return"!==d&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+d+"' method")),x;var f=c(e,a.iterator,b.arg);if("throw"===f.type)return b.method="throw",b.arg=f.arg,b.delegate=null,x;var g=f.arg;return g?g.done?(b[a.resultName]=g.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,x):g:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,x)}function k(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function l(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function m(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(k,this),this.reset(!0)}function n(a){if(a){var b=a[u];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(r.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:o}}function o(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return p};var p={},q=Object.prototype,r=q.hasOwnProperty,s=Object.defineProperty||function(a,b,c){a[b]=c.value},t="function"==typeof Symbol?Symbol:{},u=t.iterator||"@@iterator",v=t.asyncIterator||"@@asyncIterator",w=t.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}p.wrap=b;var x={},y={};a(y,u,function(){return this});var z=Object.getPrototypeOf,A=z&&z(z(n([])));A&&A!==q&&r.call(A,u)&&(y=A);var B=f.prototype=d.prototype=Object.create(y);return e.prototype=f,s(B,"constructor",{value:f,configurable:!0}),s(f,"constructor",{value:e,configurable:!0}),e.displayName=a(f,w,"GeneratorFunction"),p.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},p.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,w,"GeneratorFunction")),b.prototype=Object.create(B),b},p.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,v,function(){return this}),p.AsyncIterator=h,p.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return p.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(B),a(B,w,"Generator"),a(B,u,function(){return this}),a(B,"toString",function(){return"[object Generator]"}),p.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},p.values=n,m.prototype={constructor:m,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(l),!a)for(var b in this)"t"===b.charAt(0)&&r.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=r.call(e,"catchLoc"),h=r.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&r.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,x):this.complete(f)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),x},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),l(b),x},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var e=d.arg;l(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:n(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),x}},p}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var Requester=function(){function a(b){var c=b.siteCode,d=b.environment,e=b.packageInfo,f=b.requestDispatcher;_classCallCheck(this,a),_defineProperty(this,"siteCode",void 0),_defineProperty(this,"environment",void 0),_defineProperty(this,"requestDispatcher",void 0),_defineProperty(this,"packageInfo",void 0),this.requestDispatcher=f,this.siteCode=c,this.environment=d,this.packageInfo=e}return _createClass(a,[{key:"getClientConfiguration",value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(_regeneratorRuntime().mark(function b(a){var c,d,e,f,g,h;return _regeneratorRuntime().wrap(function i(b){for(;1;)switch(b.prev=b.next){case 0:return d=this.environment?_constants.UrlFirstParameter.Environment+this.environment:"",e="",a&&(d?e=_constants.UrlParameter.Ts+a:e=_constants.UrlFirstParameter.Ts+a),f=_constants.URL.CLIENT_CONFIGURATION+this.siteCode+d+e,g=(c={},_defineProperty(c,_constants.Header.SdkType,this.packageInfo.type.toLowerCase()),_defineProperty(c,_constants.Header.SdkVersion,this.packageInfo.version),c),b.prev=5,b.next=8,this.requestDispatcher.getClientConfiguration(f,g);case 8:if(h=b.sent,!h){b.next=11;break}return b.abrupt("return",(0,_tsRes.Ok)(h));case 11:return b.abrupt("return",(0,_tsRes.Err)(new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.MaximumRetriesReached)));case 14:return b.prev=14,b.t0=b["catch"](5),b.abrupt("return",(0,_tsRes.Err)(b.t0));case 17:case"end":return b.stop();}},b,this,[[5,14]])}));return a}()},{key:"getRemoteData",value:function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(_regeneratorRuntime().mark(function b(a){var c,d;return _regeneratorRuntime().wrap(function e(b){for(;1;)switch(b.prev=b.next){case 0:return c=_constants.URL.DATA_MAP+this.siteCode+_constants.UrlParameter.Key+encodeURI(a),b.prev=1,b.next=4,this.requestDispatcher.getRemoteData(c);case 4:return d=b.sent,b.abrupt("return",(0,_tsRes.Ok)(d));case 8:return b.prev=8,b.t0=b["catch"](1),b.abrupt("return",(0,_tsRes.Err)(b.t0));case 11:case"end":return b.stop();}},b,this,[[1,8]])}));return a}()},{key:"getVisitorData",value:function(){function a(a,c){return b.apply(this,arguments)}var b=_asyncToGenerator(_regeneratorRuntime().mark(function c(a,b){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;return _regeneratorRuntime().wrap(function w(c){for(;1;)switch(c.prev=c.next){case 0:return d=b.customData,e=b.previousVisitAmount,f=b.currentVisit,g=b.conversions,h=b.geolocation,i=b.experiments,j=b.pageViews,k=b.device,l=b.browser,m=b.operatingSystem,n=d?_constants.UrlParameter.CustomData+!0:"",o=g?_constants.UrlParameter.Conversion+!0:"",p=h?_constants.UrlParameter.Geolocation+!0:"",q=i?_constants.UrlParameter.Experiment+!0:"",r=j?_constants.UrlParameter.Page+!0:"",s=k||l||m?_constants.UrlParameter.StaticData+!0:"",t=f?_constants.UrlParameter.CurrentVisit+!0:"",u=_constants.URL.VISIT_DATA+this.siteCode+_constants.UrlParameter.VisitorCode+a+_constants.UrlParameter.MaxNumberPreviousVisits+e+n+o+p+q+r+s+t,c.prev=9,c.next=12,this.requestDispatcher.getRemoteData(u);case 12:return v=c.sent,c.abrupt("return",(0,_tsRes.Ok)(v));case 16:return c.prev=16,c.t0=c["catch"](9),c.abrupt("return",(0,_tsRes.Err)(c.t0));case 19:case"end":return c.stop();}},c,this,[[9,16]])}));return a}()},{key:"trackExperiment",value:function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(_regeneratorRuntime().mark(function b(a){var c,d,e,f,g,h,i,j,k,l,m;return _regeneratorRuntime().wrap(function n(b){for(;1;)switch(b.prev=b.next){case 0:return c=a.visitorCode,d=a.dataUrl,e=a.variationDataUrl,f=a.userAgent,g=a.isUnallocated,h=this.getTrackingUrl(c),i=d?"":_constants.UrlEventType.Activity+_constants.UrlParameter.Nonce+_utilities.Utilities.getNonce(),j=g?i:e,k=j?d+"\n"+j:d,l=f?_defineProperty({},_constants.Header.UserAgent,f):void 0,b.prev=6,b.next=9,this.requestDispatcher.track({url:h,headers:l,body:k});case 9:return m=b.sent,b.abrupt("return",(0,_tsRes.Ok)(m));case 13:return b.prev=13,b.t0=b["catch"](6),b.abrupt("return",(0,_tsRes.Err)());case 16:case"end":return b.stop();}},b,this,[[6,13]])}));return a}()},{key:"trackData",value:function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(_regeneratorRuntime().mark(function b(a){var c,d,e,f,g,h,i,j;return _regeneratorRuntime().wrap(function k(b){for(;1;)switch(b.prev=b.next){case 0:return c=a.visitorCode,d=a.body,e=a.userAgent,f=a.isMappingIdentifier,g=this.getTrackingUrl(c,f),h=d||_constants.UrlEventType.Activity+_constants.UrlParameter.Nonce+_utilities.Utilities.getNonce(),i=e?_defineProperty({},_constants.Header.UserAgent,e):void 0,b.prev=4,b.next=7,this.requestDispatcher.track({url:g,headers:i,body:h});case 7:return j=b.sent,b.abrupt("return",(0,_tsRes.Ok)(j));case 11:return b.prev=11,b.t0=b["catch"](4),b.abrupt("return",(0,_tsRes.Err)());case 14:case"end":return b.stop();}},b,this,[[4,11]])}));return a}()},{key:"getTrackingUrl",value:function getTrackingUrl(a,b){var c=this.packageInfo,d=c.type,e=c.version,f=encodeURIComponent("".concat(e,"/").concat("3.6.0")),g=b?_constants.UrlParameter.MappingValue:_constants.UrlParameter.VisitorCode;return _constants.URL.VISIT_EVENT+this.siteCode+g+a+_constants.UrlParameter.SdkName+d.toLowerCase()+_constants.UrlParameter.SdkVersion+f}}]),a}();exports.Requester=Requester;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Requester=void 0;var _tsRes=require("ts-res"),_kameleoonError=require("../kameleoonError"),_utilities=require("../utilities"),_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 _regeneratorRuntime(){"use strict";function a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,c,e){var f=b&&b.prototype instanceof d?b:d,g=Object.create(f.prototype),h=new m(e||[]);return s(g,"_invoke",{value:i(a,c,h)}),g}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&r.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;s(this,"_invoke",{value:function value(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}})}function i(a,b,d){var e="suspendedStart";return function(f,g){if("executing"==e)throw new Error("Generator is already running");if("completed"==e){if("throw"===f)throw g;return o()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=j(h,d);if(i){if(i===x)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"==e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===x)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function j(a,b){var d=b.method,e=a.iterator[d];if(void 0===e)return b.delegate=null,"throw"===d&&a.iterator.return&&(b.method="return",b.arg=void 0,j(a,b),"throw"===b.method)||"return"!==d&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+d+"' method")),x;var f=c(e,a.iterator,b.arg);if("throw"===f.type)return b.method="throw",b.arg=f.arg,b.delegate=null,x;var g=f.arg;return g?g.done?(b[a.resultName]=g.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,x):g:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,x)}function k(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function l(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function m(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(k,this),this.reset(!0)}function n(a){if(a){var b=a[u];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(r.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:o}}function o(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return p};var p={},q=Object.prototype,r=q.hasOwnProperty,s=Object.defineProperty||function(a,b,c){a[b]=c.value},t="function"==typeof Symbol?Symbol:{},u=t.iterator||"@@iterator",v=t.asyncIterator||"@@asyncIterator",w=t.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}p.wrap=b;var x={},y={};a(y,u,function(){return this});var z=Object.getPrototypeOf,A=z&&z(z(n([])));A&&A!==q&&r.call(A,u)&&(y=A);var B=f.prototype=d.prototype=Object.create(y);return e.prototype=f,s(B,"constructor",{value:f,configurable:!0}),s(f,"constructor",{value:e,configurable:!0}),e.displayName=a(f,w,"GeneratorFunction"),p.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},p.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,w,"GeneratorFunction")),b.prototype=Object.create(B),b},p.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,v,function(){return this}),p.AsyncIterator=h,p.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return p.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(B),a(B,w,"Generator"),a(B,u,function(){return this}),a(B,"toString",function(){return"[object Generator]"}),p.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},p.values=n,m.prototype={constructor:m,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(l),!a)for(var b in this)"t"===b.charAt(0)&&r.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=r.call(e,"catchLoc"),h=r.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&r.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,x):this.complete(f)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),x},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),l(b),x},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var e=d.arg;l(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:n(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),x}},p}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var Requester=function(){function a(b){var c=b.siteCode,d=b.environment,e=b.packageInfo,f=b.requestDispatcher;_classCallCheck(this,a),_defineProperty(this,"siteCode",void 0),_defineProperty(this,"environment",void 0),_defineProperty(this,"requestDispatcher",void 0),_defineProperty(this,"packageInfo",void 0),this.requestDispatcher=f,this.siteCode=c,this.environment=d,this.packageInfo=e}return _createClass(a,[{key:"getClientConfiguration",value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(_regeneratorRuntime().mark(function b(a){var c,d,e,f,g,h;return _regeneratorRuntime().wrap(function i(b){for(;1;)switch(b.prev=b.next){case 0:return d=this.environment?_constants.UrlFirstParameter.Environment+this.environment:"",e="",a&&(d?e=_constants.UrlParameter.Ts+a:e=_constants.UrlFirstParameter.Ts+a),f=_constants.URL.CLIENT_CONFIGURATION+this.siteCode+d+e,g=(c={},_defineProperty(c,_constants.Header.SdkType,this.packageInfo.type.toLowerCase()),_defineProperty(c,_constants.Header.SdkVersion,this.packageInfo.version),c),b.prev=5,b.next=8,this.requestDispatcher.getClientConfiguration(f,g);case 8:if(h=b.sent,!h){b.next=11;break}return b.abrupt("return",(0,_tsRes.Ok)(h));case 11:return b.abrupt("return",(0,_tsRes.Err)(new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.MaximumRetriesReached)));case 14:return b.prev=14,b.t0=b["catch"](5),b.abrupt("return",(0,_tsRes.Err)(b.t0));case 17:case"end":return b.stop();}},b,this,[[5,14]])}));return a}()},{key:"getRemoteData",value:function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(_regeneratorRuntime().mark(function b(a){var c,d;return _regeneratorRuntime().wrap(function e(b){for(;1;)switch(b.prev=b.next){case 0:return c=_constants.URL.DATA_MAP+this.siteCode+_constants.UrlParameter.Key+encodeURI(a),b.prev=1,b.next=4,this.requestDispatcher.getRemoteData(c);case 4:return d=b.sent,b.abrupt("return",(0,_tsRes.Ok)(d));case 8:return b.prev=8,b.t0=b["catch"](1),b.abrupt("return",(0,_tsRes.Err)(b.t0));case 11:case"end":return b.stop();}},b,this,[[1,8]])}));return a}()},{key:"getVisitorData",value:function(){function a(a,c){return b.apply(this,arguments)}var b=_asyncToGenerator(_regeneratorRuntime().mark(function c(a,b){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;return _regeneratorRuntime().wrap(function w(c){for(;1;)switch(c.prev=c.next){case 0:return d=b.customData,e=b.previousVisitAmount,f=b.currentVisit,g=b.conversions,h=b.geolocation,i=b.experiments,j=b.pageViews,k=b.device,l=b.browser,m=b.operatingSystem,n=d?_constants.UrlParameter.CustomData+!0:"",o=g?_constants.UrlParameter.Conversion+!0:"",p=h?_constants.UrlParameter.Geolocation+!0:"",q=i?_constants.UrlParameter.Experiment+!0:"",r=j?_constants.UrlParameter.Page+!0:"",s=k||l||m?_constants.UrlParameter.StaticData+!0:"",t=f?_constants.UrlParameter.CurrentVisit+!0:"",u=_constants.URL.VISIT_DATA+this.siteCode+_constants.UrlParameter.VisitorCode+a+_constants.UrlParameter.MaxNumberPreviousVisits+e+n+o+p+q+r+s+t,c.prev=9,c.next=12,this.requestDispatcher.getRemoteData(u);case 12:return v=c.sent,c.abrupt("return",(0,_tsRes.Ok)(v));case 16:return c.prev=16,c.t0=c["catch"](9),c.abrupt("return",(0,_tsRes.Err)(c.t0));case 19:case"end":return c.stop();}},c,this,[[9,16]])}));return a}()},{key:"trackExperiment",value:function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(_regeneratorRuntime().mark(function b(a){var c,d,e,f,g,h,i,j,k,l,m;return _regeneratorRuntime().wrap(function n(b){for(;1;)switch(b.prev=b.next){case 0:return c=a.visitorCode,d=a.dataUrl,e=a.variationDataUrl,f=a.userAgent,g=a.isUnallocated,h=this.getTrackingUrl(c),i=d?"":_constants.UrlEventType.Activity+_constants.UrlParameter.Nonce+_utilities.Utilities.getNonce(),j=g?i:e,k=j?d+"\n"+j:d,l=f?_defineProperty({},_constants.Header.UserAgent,f):void 0,b.prev=6,b.next=9,this.requestDispatcher.track({url:h,headers:l,body:k});case 9:return m=b.sent,b.abrupt("return",(0,_tsRes.Ok)(m));case 13:return b.prev=13,b.t0=b["catch"](6),b.abrupt("return",(0,_tsRes.Err)());case 16:case"end":return b.stop();}},b,this,[[6,13]])}));return a}()},{key:"trackData",value:function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(_regeneratorRuntime().mark(function b(a){var c,d,e,f,g,h,i,j;return _regeneratorRuntime().wrap(function k(b){for(;1;)switch(b.prev=b.next){case 0:return c=a.visitorCode,d=a.body,e=a.userAgent,f=a.isMappingIdentifier,g=this.getTrackingUrl(c,f),h=d||_constants.UrlEventType.Activity+_constants.UrlParameter.Nonce+_utilities.Utilities.getNonce(),i=e?_defineProperty({},_constants.Header.UserAgent,e):void 0,b.prev=4,b.next=7,this.requestDispatcher.track({url:g,headers:i,body:h});case 7:return j=b.sent,b.abrupt("return",(0,_tsRes.Ok)(j));case 11:return b.prev=11,b.t0=b["catch"](4),b.abrupt("return",(0,_tsRes.Err)());case 14:case"end":return b.stop();}},b,this,[[4,11]])}));return a}()},{key:"getTrackingUrl",value:function getTrackingUrl(a,b){var c=this.packageInfo,d=c.type,e=c.version,f=encodeURIComponent("".concat(e,"/").concat("3.6.1")),g=b?_constants.UrlParameter.MappingValue:_constants.UrlParameter.VisitorCode;return _constants.URL.VISIT_EVENT+this.siteCode+g+a+_constants.UrlParameter.SdkName+d.toLowerCase()+_constants.UrlParameter.SdkVersion+f}}]),a}();exports.Requester=Requester;
2
2
  //# sourceMappingURL=requester.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kameleoon/javascript-sdk-core",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "description": "Kameleoon JS SDK Core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",