@kameleoon/javascript-sdk-core 2.8.0 → 2.8.2

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.
@@ -2,10 +2,9 @@ import { Result } from 'ts-res';
2
2
  import { KameleoonError } from '../kameleoonError/kameleoonError';
3
3
  import { CustomData, KameleoonDataType } from '../kameleoonData';
4
4
  import { SegmentType, TargetingDataType, TargetingTree } from '../targeting';
5
- import { IExternalEventSourceConstructor } from '../eventSource';
6
5
  import { CampaignConfigurationParametersType, ConfigurationType, ExperimentItemType, FeatureFlagType, UnsentTargetingDataType } from './types';
7
6
  interface ICampaignConfiguration {
8
- initialize: (eventSource: IExternalEventSourceConstructor, useCache?: boolean) => Promise<Result<void, KameleoonError>>;
7
+ initialize: (useCache?: boolean) => Promise<Result<void, KameleoonError>>;
9
8
  addTargetingData: (visitorCode: string, ...data: KameleoonDataType[]) => Result<void, KameleoonError>;
10
9
  getUnsentData: (visitorCode: string) => UnsentTargetingDataType[string] | undefined;
11
10
  clearUnsentData: (visitorCode: string) => void;
@@ -20,6 +19,7 @@ interface ICampaignConfiguration {
20
19
  export declare class CampaignConfiguration implements ICampaignConfiguration {
21
20
  private configurationUpdateCallback?;
22
21
  private updateConfigurationIntervalId;
22
+ private updateType;
23
23
  private targetingDataIntervalId;
24
24
  private unsentTargetingData;
25
25
  private targetingData;
@@ -31,12 +31,17 @@ export declare class CampaignConfiguration implements ICampaignConfiguration {
31
31
  private offlineTrackingStorage;
32
32
  private requester;
33
33
  private eventSource?;
34
+ private externalEventSource;
34
35
  private externalClientConfiguration?;
35
36
  private targetingDataLifetime;
36
37
  private localCustomDataIndexes;
37
38
  private persistentCustomDataIndexes;
38
- constructor({ settings, storage, requester, externalClientConfiguration, targetingCleanupInterval, offlineTrackingStorage, }: CampaignConfigurationParametersType);
39
- initialize(externalEventSource: IExternalEventSourceConstructor, useCache?: boolean): Promise<Result<void, KameleoonError>>;
39
+ constructor({ settings, storage, requester, externalClientConfiguration, targetingCleanupInterval, offlineTrackingStorage, externalEventSource, }: CampaignConfigurationParametersType);
40
+ initialize(useCache?: boolean): Promise<Result<void, KameleoonError>>;
41
+ private cleanupHandlers;
42
+ private handleExternalUpdates;
43
+ private handleRealTimeUpdates;
44
+ private handlePollingUpdates;
40
45
  addTargetingData(visitorCode: string, ...data: KameleoonDataType[]): Result<void, KameleoonError>;
41
46
  getUnsentData(visitorCode: string): UnsentTargetingDataType[string] | undefined;
42
47
  clearUnsentData(visitorCode: string): void;
@@ -52,6 +57,14 @@ export declare class CampaignConfiguration implements ICampaignConfiguration {
52
57
  private cleanupOutdatedTargetingData;
53
58
  private readStorageData;
54
59
  private clearTargetingTrees;
60
+ /**
61
+ * Updates client configuration
62
+ *
63
+ * @param useCache - if true, will not update configuration if it is already present (for _offline_ mode)
64
+ * @param timeStamp - timestamp for real-time configuration update
65
+ *
66
+ * @returns `true` if current update type should be toggled (SSE/Polling)
67
+ */
55
68
  private updateClientConfiguration;
56
69
  private updateStorageData;
57
70
  }
@@ -1,10 +1,24 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CampaignConfiguration=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../kameleoonData"),_targeting=require("../targeting"),_eventSource=require("../eventSource"),_types=require("../types"),_constants=require("./constants"),_types2=require("./types"),_utilities=require("../utilities"),_excluded=["customData"];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 _objectWithoutProperties(a,b){if(null==a)return{};var c,d,e=_objectWithoutPropertiesLoose(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||Object.prototype.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c,d,e={},f=Object.keys(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||(e[c]=a[c]);return e}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 _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 _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function e(a){throw a},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function e(a){h=!0,f=a},f:function f(){try{g||null==c.return||c.return()}finally{if(h)throw f}}}}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 ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */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 CampaignConfiguration=/*#__PURE__*/function(){function a(b){var c=b.settings,d=b.storage,e=b.requester,f=b.externalClientConfiguration,g=b.targetingCleanupInterval,h=b.offlineTrackingStorage;if(_classCallCheck(this,a),_defineProperty(this,"configurationUpdateCallback",void 0),_defineProperty(this,"updateConfigurationIntervalId",null),_defineProperty(this,"targetingDataIntervalId",null),_defineProperty(this,"unsentTargetingData",{}),_defineProperty(this,"targetingData",{}),_defineProperty(this,"targetingTrees",new Map),_defineProperty(this,"configurationData",_constants.DEFAULT_CONFIGURATION_DATA),_defineProperty(this,"settings",void 0),_defineProperty(this,"lastUpdate",void 0),_defineProperty(this,"storage",void 0),_defineProperty(this,"offlineTrackingStorage",void 0),_defineProperty(this,"requester",void 0),_defineProperty(this,"eventSource",void 0),_defineProperty(this,"externalClientConfiguration",void 0),_defineProperty(this,"targetingDataLifetime",_constants.CLEANUP_TARGETING_DATA_INTERVAL*_types.Milliseconds.Minute),_defineProperty(this,"localCustomDataIndexes",new Set),_defineProperty(this,"persistentCustomDataIndexes",new Set),this.requester=e,this.settings=c,this.lastUpdate=new Date,this.storage=d,this.readStorageData(),this.externalClientConfiguration=f,this.offlineTrackingStorage=h,g){this.targetingDataLifetime=g*_types.Milliseconds.Minute;var i=0>g?1:g;// --- Note ---
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CampaignConfiguration=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../kameleoonData"),_targeting=require("../targeting"),_eventSource=require("../eventSource"),_types=require("../types"),_constants=require("./constants"),_types2=require("./types"),_utilities=require("../utilities"),_excluded=["customData"];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 _objectWithoutProperties(a,b){if(null==a)return{};var c,d,e=_objectWithoutPropertiesLoose(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||Object.prototype.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c,d,e={},f=Object.keys(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||(e[c]=a[c]);return e}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 _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 _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function e(a){throw a},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function e(a){h=!0,f=a},f:function f(){try{g||null==c.return||c.return()}finally{if(h)throw f}}}}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 ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */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 CampaignConfiguration=/*#__PURE__*/function(){function a(b){var c=b.settings,d=b.storage,e=b.requester,f=b.externalClientConfiguration,g=b.targetingCleanupInterval,h=b.offlineTrackingStorage,i=b.externalEventSource;if(_classCallCheck(this,a),_defineProperty(this,"configurationUpdateCallback",void 0),_defineProperty(this,"updateConfigurationIntervalId",null),_defineProperty(this,"updateType",_types2.UpdateType.Idle),_defineProperty(this,"targetingDataIntervalId",null),_defineProperty(this,"unsentTargetingData",{}),_defineProperty(this,"targetingData",{}),_defineProperty(this,"targetingTrees",new Map),_defineProperty(this,"configurationData",_constants.DEFAULT_CONFIGURATION_DATA),_defineProperty(this,"settings",void 0),_defineProperty(this,"lastUpdate",void 0),_defineProperty(this,"storage",void 0),_defineProperty(this,"offlineTrackingStorage",void 0),_defineProperty(this,"requester",void 0),_defineProperty(this,"eventSource",void 0),_defineProperty(this,"externalEventSource",void 0),_defineProperty(this,"externalClientConfiguration",void 0),_defineProperty(this,"targetingDataLifetime",_constants.CLEANUP_TARGETING_DATA_INTERVAL*_types.Milliseconds.Minute),_defineProperty(this,"localCustomDataIndexes",new Set),_defineProperty(this,"persistentCustomDataIndexes",new Set),this.requester=e,this.settings=c,this.lastUpdate=new Date,this.storage=d,this.readStorageData(),this.externalClientConfiguration=f,this.offlineTrackingStorage=h,this.externalEventSource=i,g){this.targetingDataLifetime=g*_types.Milliseconds.Minute;var j=0>g?1:g;// --- Note ---
2
2
  // We can not make delayed code execution recoverable, as it might lead
3
3
  // to targeting data storage size overflow
4
- try{this.targetingDataIntervalId=setInterval(this.cleanupOutdatedTargetingData.bind(this),i*_types.Milliseconds.Minute)}catch(a){throw this.targetingDataIntervalId&&clearInterval(this.targetingDataIntervalId),a}}}return _createClass(a,[{key:"initialize",value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function c(a,b){var d,e,f,g=this;return _regeneratorRuntime().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(d=this.checkShouldUpdate(),!d){c.next=7;break}return c.next=4,this.updateClientConfiguration({useCache:b});case 4:if(e=c.sent,e.ok){c.next=7;break}return c.abrupt("return",e);case 7:if(!this.configurationData.configuration.realTimeUpdate||this.externalClientConfiguration){c.next=14;break}this.updateConfigurationIntervalId&&clearInterval(this.updateConfigurationIntervalId),this.eventSource=new _eventSource.ExternalEventSource(this.settings.siteCode,a),f=function(a){g.updateClientConfiguration({useCache:b,timeStamp:a}),g.configurationUpdateCallback&&g.configurationUpdateCallback()},this.eventSource.open(f),c.next=24;break;case 14:this.eventSource&&this.eventSource.close(),this.updateConfigurationIntervalId&&clearInterval(this.updateConfigurationIntervalId),c.prev=16,this.updateConfigurationIntervalId=setInterval(function(){return g.updateClientConfiguration.bind(g)({useCache:b})},this.settings.updateInterval),c.next=24;break;case 20:throw c.prev=20,c.t0=c["catch"](16),this.updateConfigurationIntervalId&&clearInterval(this.updateConfigurationIntervalId),c.t0;case 24:return c.abrupt("return",(0,_tsRes.Ok)());case 25:case"end":return c.stop();}},c,this,[[16,20]])}));return a}()},{key:"addTargetingData",value:function addTargetingData(a){var b=this;a in this.targetingData||(this.targetingData[a]={});for(var c=arguments.length,d=Array(1<c?c-1:0),e=1;e<c;e++)d[e-1]=arguments[e];d.forEach(function(c){// --- Custom data case ---
4
+ try{this.targetingDataIntervalId=setInterval(this.cleanupOutdatedTargetingData.bind(this),j*_types.Milliseconds.Minute)}catch(a){throw this.targetingDataIntervalId&&clearInterval(this.targetingDataIntervalId),a}}}return _createClass(a,[{key:"initialize",value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d,e,f;return _regeneratorRuntime().wrap(function g(b){for(;1;)switch(b.prev=b.next){case 0:if(c=!!this.externalClientConfiguration,d=this.checkShouldUpdate(c),!d){b.next=11;break}return b.next=5,this.updateClientConfiguration({useCache:a});case 5:if(e=b.sent,e.ok){b.next=8;break}return b.abrupt("return",e);case 8:if(f=e.data,!f){b.next=11;break}return b.abrupt("return",(0,_tsRes.Ok)());case 11:if(!c){b.next=14;break}return this.handleExternalUpdates(),b.abrupt("return",(0,_tsRes.Ok)());case 14:if(this.updateType!==_types2.UpdateType.RealTime||this.eventSource){b.next=18;break}return this.updateType=_types2.UpdateType.Idle,this.handleRealTimeUpdates(a),b.abrupt("return",(0,_tsRes.Ok)());case 18:return this.updateType===_types2.UpdateType.Polling&&this.handlePollingUpdates(a),b.abrupt("return",(0,_tsRes.Ok)());case 20:case"end":return b.stop();}},b,this)}));return a}()},{key:"cleanupHandlers",value:function cleanupHandlers(){this.eventSource&&this.eventSource.close(),this.updateConfigurationIntervalId&&clearInterval(this.updateConfigurationIntervalId)}},{key:"handleExternalUpdates",value:function handleExternalUpdates(){this.cleanupHandlers();var a=this.externalClientConfiguration,b=a.configuration,c=a.customData,d=a.experiments,e=a.featureFlagConfigurations;this.configurationData={customData:c,configuration:b,experiments:d,featureFlags:e}}},{key:"handleRealTimeUpdates",value:function handleRealTimeUpdates(a){var b=this;this.cleanupHandlers(),this.eventSource=new _eventSource.ExternalEventSource(this.settings.siteCode,this.externalEventSource);var c=function updateEventCallback(c){b.updateClientConfiguration({useCache:a,timeStamp:c}),b.configurationUpdateCallback&&b.configurationUpdateCallback()};this.eventSource.open(c)}},{key:"handlePollingUpdates",value:function handlePollingUpdates(a){var b=this;this.cleanupHandlers();// --- Note ---
5
+ // Same as targeting data interval we don't want to make failed configuration
6
+ // retrieval recoverable
7
+ try{this.updateConfigurationIntervalId=setInterval(function(){return b.updateClientConfiguration.bind(b)({useCache:a})},this.settings.updateInterval)}catch(a){throw this.updateConfigurationIntervalId&&clearInterval(this.updateConfigurationIntervalId),a}}},{key:"addTargetingData",value:function addTargetingData(a){var b=this;a in this.targetingData||(this.targetingData[a]={});for(var c=arguments.length,d=Array(1<c?c-1:0),e=1;e<c;e++)d[e-1]=arguments[e];d.forEach(function(c){// --- Custom data case ---
5
8
  if(_utilities.Utilities.isCustomData(c)){var d=_objectSpread(_objectSpread({},c.data),{},{lastActivityTime:Date.now()}),e=(_kameleoonData.KameleoonData.CustomData in b.targetingData[a]);e?b.targetingData[a][d.type][d.index]=d:b.targetingData[a]=_objectSpread(_objectSpread({},b.targetingData[a]),{},_defineProperty({},d.type,_objectSpread(_objectSpread({},b.targetingData[a][d.type]),{},_defineProperty({},d.index,d))))}else{var f=_objectSpread(_objectSpread({},c.data),{},{lastActivityTime:Date.now()}),g=(c.data.type in b.targetingData[a]);g?b.targetingData[a][c.data.type]=f:b.targetingData[a]=_objectSpread(_objectSpread({},b.targetingData[a]),{},_defineProperty({},c.data.type,f))}});// --- Note ---
6
9
  // `targetingData` should not refresh `lastUpdate` time
7
- var f=this.updateStorageData(this.lastUpdate);return f.ok&&d.forEach(function(c){b.unsentTargetingData[a]||(b.unsentTargetingData[a]=new Map);var d;if(_utilities.Utilities.isCustomData(c)){if(b.localCustomDataIndexes.has(c.data.index))return;d=c.data.index}else d=c.data.type;b.unsentTargetingData[a].set(d,c)}),f}},{key:"getUnsentData",value:function getUnsentData(a){return this.unsentTargetingData[a]}},{key:"clearUnsentData",value:function clearUnsentData(a){var b,c=null===(b=this.unsentTargetingData[a])||void 0===b?void 0:b.values();if(c&&this.persistentCustomDataIndexes.size){var d,e=new Map,f=_createForOfIteratorHelper(c);try{for(f.s();!(d=f.n()).done;){var g=d.value;this.isPersistentCustomData(g)&&e.set(g.data.index,g)}}catch(a){f.e(a)}finally{f.f()}if(e.size)return void(this.unsentTargetingData[a]=e)}delete this.unsentTargetingData[a]}},{key:"getTargetingTree",value:function getTargetingTree(a){if(!this.targetingTrees.has(a.id)){var b=new _targeting.TargetingTree(a);return this.targetingTrees.set(a.id,new _targeting.TargetingTree(a)),b}return this.targetingTrees.get(a.id)}},{key:"onConfigurationUpdate",value:function onConfigurationUpdate(a){this.configurationUpdateCallback=a}},{key:"isPersistentCustomData",value:function isPersistentCustomData(a){return!!this.persistentCustomDataIndexes.size&&!!_utilities.Utilities.isCustomData(a)&&this.persistentCustomDataIndexes.has(a.data.index)}},{key:"unsentDataVisitors",get:function get(){return Object.keys(this.unsentTargetingData)}},{key:"storedTargetingData",get:function get(){return this.targetingData}},{key:"experiments",get:function get(){return this.configurationData.experiments}},{key:"featureFlags",get:function get(){return this.configurationData.featureFlags}},{key:"configuration",get:function get(){return this.configurationData.configuration}},{key:"checkShouldUpdate",value:function checkShouldUpdate(){var a=this.configurationData,b=a.featureFlags,c=a.experiments,d=a.configuration,e=this.settings.updateInterval;if(!b.length&&!c.length)return!0;if(d.realTimeUpdate)return!0;var f=this.lastUpdate.getTime(),g=Date.now()-e;return f<g}},{key:"cleanupOutdatedTargetingData",value:function cleanupOutdatedTargetingData(){for(var a=Date.now(),b=0,c=Object.entries(this.targetingData);b<c.length;b++){var d=_slicedToArray(c[b],2),e=d[0],f=d[1],g=f.customData,h=_objectWithoutProperties(f,_excluded);if(g)for(var i=0,j=Object.entries(g);i<j.length;i++){var k=_slicedToArray(j[i],2),l=k[0],m=k[1];if(m){var n=m.lastActivityTime+this.targetingDataLifetime<a,o=f[_kameleoonData.KameleoonData.CustomData];n&&o&&delete o[+l],o&&!Object.keys(o).length&&delete f[_kameleoonData.KameleoonData.CustomData]}}for(var p=0,q=Object.entries(h);p<q.length;p++){var r=_slicedToArray(q[p],2),s=r[0],t=r[1],u=t.lastActivityTime+this.targetingDataLifetime<a;u&&delete f[s]}Object.keys(this.targetingData[e]).length||delete this.targetingData[e]}// --- Note ---
10
+ var f=this.updateStorageData(this.lastUpdate);return f.ok&&d.forEach(function(c){b.unsentTargetingData[a]||(b.unsentTargetingData[a]=new Map);var d;if(_utilities.Utilities.isCustomData(c)){if(b.localCustomDataIndexes.has(c.data.index))return;d=c.data.index}else d=c.data.type;b.unsentTargetingData[a].set(d,c)}),f}},{key:"getUnsentData",value:function getUnsentData(a){return this.unsentTargetingData[a]}},{key:"clearUnsentData",value:function clearUnsentData(a){var b,c=null===(b=this.unsentTargetingData[a])||void 0===b?void 0:b.values();if(c&&this.persistentCustomDataIndexes.size){var d,e=new Map,f=_createForOfIteratorHelper(c);try{for(f.s();!(d=f.n()).done;){var g=d.value;this.isPersistentCustomData(g)&&e.set(g.data.index,g)}}catch(a){f.e(a)}finally{f.f()}if(e.size)return void(this.unsentTargetingData[a]=e)}delete this.unsentTargetingData[a]}},{key:"getTargetingTree",value:function getTargetingTree(a){if(!this.targetingTrees.has(a.id)){var b=new _targeting.TargetingTree(a);return this.targetingTrees.set(a.id,new _targeting.TargetingTree(a)),b}return this.targetingTrees.get(a.id)}},{key:"onConfigurationUpdate",value:function onConfigurationUpdate(a){this.configurationUpdateCallback=a}},{key:"isPersistentCustomData",value:function isPersistentCustomData(a){return!!this.persistentCustomDataIndexes.size&&!!_utilities.Utilities.isCustomData(a)&&this.persistentCustomDataIndexes.has(a.data.index)}},{key:"unsentDataVisitors",get:function get(){return Object.keys(this.unsentTargetingData)}},{key:"storedTargetingData",get:function get(){return this.targetingData}},{key:"experiments",get:function get(){return this.configurationData.experiments}},{key:"featureFlags",get:function get(){return this.configurationData.featureFlags}},{key:"configuration",get:function get(){return this.configurationData.configuration}},{key:"checkShouldUpdate",value:function checkShouldUpdate(){var a=!!(0<arguments.length&&void 0!==arguments[0])&&arguments[0],b=this.configurationData,c=b.featureFlags,d=b.experiments,e=b.configuration,f=this.settings.updateInterval;// --- Note ---
11
+ // Following `updateType` logic is done for client side
12
+ // edge cases where we have previous campaigns on storage already, but we still want
13
+ // to initialize SSE/Polling after page reload
14
+ if(a)return this.updateType=_types2.UpdateType.Idle,!1;if(this.updateType=e.realTimeUpdate?_types2.UpdateType.RealTime:_types2.UpdateType.Polling,!c.length&&!d.length)return!0;var g=this.lastUpdate.getTime(),h=Date.now()-f;return g<h}},{key:"cleanupOutdatedTargetingData",value:function cleanupOutdatedTargetingData(){for(var a=Date.now(),b=0,c=Object.entries(this.targetingData);b<c.length;b++){var d=_slicedToArray(c[b],2),e=d[0],f=d[1],g=f.customData,h=_objectWithoutProperties(f,_excluded);if(g)for(var i=0,j=Object.entries(g);i<j.length;i++){var k=_slicedToArray(j[i],2),l=k[0],m=k[1];if(m){var n=m.lastActivityTime+this.targetingDataLifetime<a,o=f[_kameleoonData.KameleoonData.CustomData];n&&o&&delete o[+l],o&&!Object.keys(o).length&&delete f[_kameleoonData.KameleoonData.CustomData]}}for(var p=0,q=Object.entries(h);p<q.length;p++){var r=_slicedToArray(q[p],2),s=r[0],t=r[1],u=t.lastActivityTime+this.targetingDataLifetime<a;u&&delete f[s]}Object.keys(this.targetingData[e]).length||delete this.targetingData[e]}// --- Note ---
8
15
  // `targetingData` should not refresh `lastUpdate` time
9
- this.updateStorageData(this.lastUpdate).throw()}},{key:"readStorageData",value:function readStorageData(){var a=this.storage.read();if(a.ok){var b=a.data,c=b.kameleoonTargetingData,d=b.kameleoonConfiguration,e=b.lastUpdate;this.configurationData=d,this.targetingData=c,this.lastUpdate=new Date(Date.parse(e))}}},{key:"clearTargetingTrees",value:function clearTargetingTrees(){this.targetingTrees.clear()}},{key:"updateClientConfiguration",value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w=arguments;return _regeneratorRuntime().wrap(function x(a){for(;1;)switch(a.prev=a.next){case 0:if(b=0<w.length&&void 0!==w[0]?w[0]:{},c=b.useCache,d=void 0!==c&&c,e=b.timeStamp,!this.externalClientConfiguration){a.next=6;break}f=this.externalClientConfiguration,g=f.configuration,h=f.customData,i=f.experiments,j=f.featureFlagConfigurations,this.configurationData={customData:h,configuration:g,experiments:i,featureFlags:j},a.next=18;break;case 6:return a.next=8,this.requester.getClientConfiguration(e);case 8:if(k=a.sent,k.ok){a.next=14;break}if(l=this.configurationData,m=l.featureFlags,n=l.experiments,!(d&&m.length&&n.length)){a.next=13;break}return a.abrupt("return",(0,_tsRes.Ok)(!0));case 13:return a.abrupt("return",k);case 14:_utilities.Utilities.sendOfflineTracking({storage:this.offlineTrackingStorage,requester:this.requester}),o=k.data,p=o.configuration,q=o.experiments,r=o.featureFlagConfigurations,s=o.customData,this.configurationData={configuration:p,experiments:q,featureFlags:r,customData:s},null!==s&&void 0!==s&&s.length&&(t=[],u=[],s.forEach(function(a){a.localOnly&&t.push(a.index),a.scope===_types2.CustomDataScope.Visitor&&u.push(a.index)}),t.length&&(this.localCustomDataIndexes=new Set(t)),u.length&&(this.persistentCustomDataIndexes=new Set(u)));case 18:if(this.clearTargetingTrees(),v=this.updateStorageData(new Date),v.ok){a.next=22;break}return a.abrupt("return",v);case 22:return a.abrupt("return",(0,_tsRes.Ok)(!0));case 23:case"end":return a.stop();}},a,this)}));return a}()},{key:"updateStorageData",value:function updateStorageData(a){var b={kameleoonTargetingData:this.targetingData,kameleoonConfiguration:this.configurationData,lastUpdate:a.toString()};return this.storage.write(b)}}]),a}();exports.CampaignConfiguration=CampaignConfiguration;
16
+ this.updateStorageData(this.lastUpdate).throw()}},{key:"readStorageData",value:function readStorageData(){var a=this.storage.read();if(a.ok){var b=a.data,c=b.kameleoonTargetingData,d=b.kameleoonConfiguration,e=b.lastUpdate;this.configurationData=d,this.targetingData=c,this.lastUpdate=new Date(Date.parse(e))}}},{key:"clearTargetingTrees",value:function clearTargetingTrees(){this.targetingTrees.clear()}/**
17
+ * Updates client configuration
18
+ *
19
+ * @param useCache - if true, will not update configuration if it is already present (for _offline_ mode)
20
+ * @param timeStamp - timestamp for real-time configuration update
21
+ *
22
+ * @returns `true` if current update type should be toggled (SSE/Polling)
23
+ */},{key:"updateClientConfiguration",value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t=arguments;return _regeneratorRuntime().wrap(function u(a){for(;1;)switch(a.prev=a.next){case 0:return b=0<t.length&&void 0!==t[0]?t[0]:{},c=b.useCache,d=void 0!==c&&c,e=b.timeStamp,a.next=3,this.requester.getClientConfiguration(e);case 3:if(f=a.sent,f.ok){a.next=9;break}if(g=this.configurationData,h=g.featureFlags,i=g.experiments,!(d&&h.length&&i.length)){a.next=8;break}return a.abrupt("return",(0,_tsRes.Ok)(!0));case 8:return a.abrupt("return",f);case 9:if(_utilities.Utilities.sendOfflineTracking({storage:this.offlineTrackingStorage,requester:this.requester}),j=f.data,k=j.configuration,l=j.experiments,m=j.featureFlagConfigurations,n=j.customData,this.configurationData={configuration:k,experiments:l,featureFlags:m,customData:n},null!==n&&void 0!==n&&n.length&&(o=[],p=[],n.forEach(function(a){a.localOnly&&o.push(a.index),a.scope===_types2.CustomDataScope.Visitor&&p.push(a.index)}),o.length&&(this.localCustomDataIndexes=new Set(o)),p.length&&(this.persistentCustomDataIndexes=new Set(p))),this.clearTargetingTrees(),q=this.updateStorageData(new Date),q.ok){a.next=17;break}return a.abrupt("return",q);case 17:if(r=k.realTimeUpdate?_types2.UpdateType.RealTime:_types2.UpdateType.Polling,s=r!==this.updateType,!s){a.next=23;break}return this.updateType=r,a.next=23,this.initialize(d);case 23:return a.abrupt("return",(0,_tsRes.Ok)(s));case 24:case"end":return a.stop();}},a,this)}));return a}()},{key:"updateStorageData",value:function updateStorageData(a){this.lastUpdate=a;var b={kameleoonTargetingData:this.targetingData,kameleoonConfiguration:this.configurationData,lastUpdate:a.toString()};return this.storage.write(b)}}]),a}();exports.CampaignConfiguration=CampaignConfiguration;
10
24
  //# sourceMappingURL=campaignConfiguration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"campaignConfiguration.js","names":["a","b","c","Object","defineProperty","value","enumerable","configurable","writable","e","f","prototype","d","g","create","h","m","s","i","type","arg","call","forEach","_invoke","j","k","_typeof","r","resolve","__await","then","Error","o","method","delegate","x","sent","_sent","dispatchException","abrupt","done","iterator","return","TypeError","resultName","next","nextLoc","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","l","completion","reset","n","u","isNaN","length","_regeneratorRuntime","p","q","hasOwnProperty","t","Symbol","v","asyncIterator","w","toStringTag","wrap","y","z","getPrototypeOf","A","B","displayName","isGeneratorFunction","constructor","name","mark","setPrototypeOf","__proto__","awrap","AsyncIterator","async","Promise","keys","reverse","pop","values","prev","charAt","slice","stop","rval","complete","finish","catch","_catch","delegateYield","asyncGeneratorStep","_asyncToGenerator","arguments","apply","_classCallCheck","_defineProperties","_toPropertyKey","key","_createClass","_defineProperty","_toPrimitive","toPrimitive","String","Number","CampaignConfiguration","settings","storage","requester","externalClientConfiguration","targetingCleanupInterval","offlineTrackingStorage","Map","DEFAULT_CONFIGURATION_DATA","CLEANUP_TARGETING_DATA_INTERVAL","Milliseconds","Minute","Set","lastUpdate","Date","readStorageData","targetingDataLifetime","cleanupIntervalMinutes","targetingDataIntervalId","setInterval","cleanupOutdatedTargetingData","bind","err","clearInterval","externalEventSource","useCache","shouldUpdate","checkShouldUpdate","updateClientConfiguration","updateResult","ok","configurationData","configuration","realTimeUpdate","updateConfigurationIntervalId","eventSource","ExternalEventSource","siteCode","updateEventCallback","timeStamp","configurationUpdateCallback","open","close","updateInterval","t0","Ok","addTargetingData","visitorCode","targetingData","data","Array","dataItem","Utilities","isCustomData","customData","_objectSpread","lastActivityTime","now","hasCustomDataKey","KameleoonData","CustomData","index","hasDataKey","result","updateStorageData","unsentTargetingData","localCustomDataIndexes","has","set","getUnsentData","clearUnsentData","dataItems","persistentCustomDataIndexes","size","persistentCustomData","_createForOfIteratorHelper","isPersistentCustomData","getTargetingTree","segment","targetingTrees","id","targetingTree","TargetingTree","get","onConfigurationUpdate","callback","experiments","featureFlags","lastUpdateTime","getTime","updateWindowEdge","currentTime","entries","_slicedToArray","kameleoonVisitorData","rest","_objectWithoutProperties","_excluded","isDataExpired","existingData","throw","read","kameleoonTargetingData","kameleoonConfiguration","parse","clearTargetingTrees","clear","featureFlagConfigurations","getClientConfiguration","clientConfigurationResult","sendOfflineTracking","customDataLocalOnlyIndexes","localOnly","scope","CustomDataScope","Visitor","toString","write","exports"],"sources":["../../src/campaignConfiguration/campaignConfiguration.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonError } from 'src/kameleoonError/kameleoonError';\nimport { ClientSettingsType } from 'src/clientSettings/types';\nimport {\n CustomData,\n KameleoonData,\n KameleoonDataType,\n} from 'src/kameleoonData';\nimport { Requester, GetClientConfigurationResultType } from 'src/requester';\nimport { SegmentType, TargetingDataType, TargetingTree } from 'src/targeting';\nimport { IStorage, ClientDataType } from 'src/storage';\nimport {\n ExternalEventSource,\n IEventSource,\n IExternalEventSourceConstructor,\n} from 'src/eventSource';\nimport { Milliseconds } from 'src/types';\nimport {\n CLEANUP_TARGETING_DATA_INTERVAL,\n DEFAULT_CONFIGURATION_DATA,\n} from './constants';\nimport {\n CampaignConfigurationParametersType,\n ConfigurationDataType,\n ConfigurationType,\n CustomDataScope,\n ExperimentItemType,\n FeatureFlagType,\n UnsentTargetingDataType,\n UnsentVisitorTargetingDataType,\n UpdateClientConfigurationParameters,\n} from './types';\nimport { Utilities } from 'src/utilities';\nimport {\n ExistingCustomDataType,\n ExistingDataType,\n} from 'src/kameleoonData/types';\nimport { OfflineTracking } from 'src/storage/types';\n\ninterface ICampaignConfiguration {\n initialize: (\n eventSource: IExternalEventSourceConstructor,\n useCache?: boolean,\n ) => Promise<Result<void, KameleoonError>>;\n addTargetingData: (\n visitorCode: string,\n ...data: KameleoonDataType[]\n ) => Result<void, KameleoonError>;\n getUnsentData: (\n visitorCode: string,\n ) => UnsentTargetingDataType[string] | undefined;\n clearUnsentData: (visitorCode: string) => void;\n isPersistentCustomData: (dataItem: KameleoonDataType) => boolean;\n onConfigurationUpdate: (callback: () => void) => void;\n readonly experiments: ExperimentItemType[];\n readonly storedTargetingData: TargetingDataType;\n readonly featureFlags: FeatureFlagType[];\n readonly configuration: ConfigurationType;\n readonly unsentDataVisitors: string[];\n}\n\nexport class CampaignConfiguration implements ICampaignConfiguration {\n private configurationUpdateCallback?: () => void;\n private updateConfigurationIntervalId: NodeJS.Timer | null = null;\n private targetingDataIntervalId: NodeJS.Timer | null = null;\n private unsentTargetingData: UnsentTargetingDataType = {};\n private targetingData: TargetingDataType = {};\n private targetingTrees: Map<string, TargetingTree> = new Map();\n private configurationData: ConfigurationDataType = DEFAULT_CONFIGURATION_DATA;\n private settings: ClientSettingsType;\n private lastUpdate: Date;\n private storage: IStorage<ClientDataType>;\n private offlineTrackingStorage: IStorage<OfflineTracking>;\n private requester: Requester;\n private eventSource?: IEventSource;\n private externalClientConfiguration?: GetClientConfigurationResultType;\n private targetingDataLifetime: number =\n CLEANUP_TARGETING_DATA_INTERVAL * Milliseconds.Minute;\n private localCustomDataIndexes: Set<number> = new Set();\n private persistentCustomDataIndexes: Set<number> = new Set();\n\n constructor({\n settings,\n storage,\n requester,\n externalClientConfiguration,\n targetingCleanupInterval,\n offlineTrackingStorage,\n }: CampaignConfigurationParametersType) {\n this.requester = requester;\n this.settings = settings;\n this.lastUpdate = new Date();\n this.storage = storage;\n this.readStorageData();\n this.externalClientConfiguration = externalClientConfiguration;\n this.offlineTrackingStorage = offlineTrackingStorage;\n\n if (targetingCleanupInterval) {\n this.targetingDataLifetime =\n targetingCleanupInterval * Milliseconds.Minute;\n\n const cleanupIntervalMinutes =\n targetingCleanupInterval < 0 ? 1 : targetingCleanupInterval;\n\n // --- Note ---\n // We can not make delayed code execution recoverable, as it might lead\n // to targeting data storage size overflow\n try {\n this.targetingDataIntervalId = setInterval(\n this.cleanupOutdatedTargetingData.bind(this),\n cleanupIntervalMinutes * Milliseconds.Minute,\n );\n } catch (err) {\n if (this.targetingDataIntervalId) {\n clearInterval(this.targetingDataIntervalId);\n }\n\n throw err;\n }\n }\n }\n\n public async initialize(\n externalEventSource: IExternalEventSourceConstructor,\n useCache?: boolean,\n ): Promise<Result<void, KameleoonError>> {\n const shouldUpdate = this.checkShouldUpdate();\n\n // --- Initial data fetch ---\n if (shouldUpdate) {\n const updateResult = await this.updateClientConfiguration({ useCache });\n\n if (!updateResult.ok) {\n return updateResult;\n }\n }\n\n // --- Note ---\n // Interval is cleaned up in case real time update\n // was activated while initialized client already exists\n if (\n this.configurationData.configuration.realTimeUpdate &&\n !this.externalClientConfiguration\n ) {\n if (this.updateConfigurationIntervalId) {\n clearInterval(this.updateConfigurationIntervalId);\n }\n\n this.eventSource = new ExternalEventSource(\n this.settings.siteCode,\n externalEventSource,\n );\n\n const updateEventCallback = (timeStamp: number) => {\n this.updateClientConfiguration({ useCache, timeStamp });\n\n if (this.configurationUpdateCallback) {\n this.configurationUpdateCallback();\n }\n };\n\n this.eventSource.open(updateEventCallback);\n } else {\n // --- Note ---\n // Event Source is cleaned up in case real time update\n // was disabled while initialized client already exists\n if (this.eventSource) {\n this.eventSource.close();\n }\n\n if (this.updateConfigurationIntervalId) {\n clearInterval(this.updateConfigurationIntervalId);\n }\n\n // --- Note ---\n // Same as targeting data interval we don't want to make failed configuration\n // retrieval recoverable\n try {\n this.updateConfigurationIntervalId = setInterval(\n () => this.updateClientConfiguration.bind(this)({ useCache }),\n this.settings.updateInterval,\n );\n } catch (err) {\n if (this.updateConfigurationIntervalId) {\n clearInterval(this.updateConfigurationIntervalId);\n }\n\n throw err;\n }\n }\n\n return Ok();\n }\n\n public addTargetingData(\n visitorCode: string,\n ...data: KameleoonDataType[]\n ): Result<void, KameleoonError> {\n if (!(visitorCode in this.targetingData)) {\n this.targetingData[visitorCode] = {};\n }\n\n // --- Note ---\n // Following code is optimized for performance:\n // - We don't want to copy the whole object every time we add new data\n // - So we are manually checking the keys existence and mutating targeting data directly\n // - Numerous type casts are required because we can't narrow down nested `this.targetingData` types by using assertion functions\n data.forEach((dataItem) => {\n // --- Custom data case ---\n if (Utilities.isCustomData(dataItem)) {\n const customData = {\n ...dataItem.data,\n lastActivityTime: Date.now(),\n };\n const hasCustomDataKey =\n KameleoonData.CustomData in this.targetingData[visitorCode];\n\n // -- Change directly if `[key]` exists\n if (hasCustomDataKey) {\n (\n this.targetingData[visitorCode][\n customData.type\n ] as ExistingCustomDataType\n )[customData.index] = customData;\n } else {\n // -- Change data by creating new `[key]` and `[index]`\n this.targetingData[visitorCode] = {\n ...this.targetingData[visitorCode],\n [customData.type]: {\n ...this.targetingData[visitorCode][customData.type],\n [customData.index]: customData,\n },\n };\n }\n // --- Other data types case ---\n } else {\n const data = { ...dataItem.data, lastActivityTime: Date.now() };\n const hasDataKey =\n dataItem.data.type in this.targetingData[visitorCode];\n\n // -- Changing data by `[key]` if it exists\n if (hasDataKey) {\n (this.targetingData[visitorCode][\n dataItem.data.type\n ] as ExistingDataType<typeof dataItem.data.type>) = data;\n } else {\n // -- Change data by creating new `[key]`\n this.targetingData[visitorCode] = {\n ...this.targetingData[visitorCode],\n [dataItem.data.type]: data,\n };\n }\n }\n });\n\n // --- Note ---\n // `targetingData` should not refresh `lastUpdate` time\n const result = this.updateStorageData(this.lastUpdate);\n\n if (result.ok) {\n data.forEach((dataItem) => {\n // --- Note ---\n // We assume `this.unsentTargetingData[visitorCode]` is always defined further in the code\n if (!this.unsentTargetingData[visitorCode]) {\n this.unsentTargetingData[visitorCode] = new Map();\n }\n\n let key: KameleoonData | number;\n\n if (Utilities.isCustomData(dataItem)) {\n if (this.localCustomDataIndexes.has(dataItem.data.index)) {\n return;\n }\n\n key = dataItem.data.index;\n } else {\n key = dataItem.data.type;\n }\n\n this.unsentTargetingData[visitorCode]!.set(key, dataItem);\n });\n }\n\n return result;\n }\n\n public getUnsentData(\n visitorCode: string,\n ): UnsentTargetingDataType[string] | undefined {\n return this.unsentTargetingData[visitorCode];\n }\n\n public clearUnsentData(visitorCode: string): void {\n const dataItems = this.unsentTargetingData[visitorCode]?.values();\n\n if (dataItems && this.persistentCustomDataIndexes.size) {\n const persistentCustomData: UnsentVisitorTargetingDataType = new Map();\n\n for (const dataItem of dataItems) {\n if (this.isPersistentCustomData(dataItem)) {\n persistentCustomData.set(dataItem.data.index, dataItem);\n }\n }\n\n if (persistentCustomData.size) {\n this.unsentTargetingData[visitorCode] = persistentCustomData;\n return;\n }\n }\n\n delete this.unsentTargetingData[visitorCode];\n }\n\n public getTargetingTree(segment: SegmentType): TargetingTree {\n if (!this.targetingTrees.has(segment.id)) {\n const targetingTree = new TargetingTree(segment);\n\n this.targetingTrees.set(segment.id, new TargetingTree(segment));\n\n return targetingTree;\n }\n\n return this.targetingTrees.get(segment.id) as TargetingTree;\n }\n\n public onConfigurationUpdate(callback: () => void): void {\n this.configurationUpdateCallback = callback;\n }\n\n public isPersistentCustomData(\n dataItem: KameleoonDataType,\n ): dataItem is CustomData {\n if (!this.persistentCustomDataIndexes.size) {\n return false;\n }\n\n if (Utilities.isCustomData(dataItem)) {\n return this.persistentCustomDataIndexes.has(dataItem.data.index);\n }\n\n return false;\n }\n\n get unsentDataVisitors(): string[] {\n return Object.keys(this.unsentTargetingData);\n }\n\n get storedTargetingData(): TargetingDataType {\n return this.targetingData;\n }\n\n get experiments(): ExperimentItemType[] {\n return this.configurationData.experiments;\n }\n\n get featureFlags(): FeatureFlagType[] {\n return this.configurationData.featureFlags;\n }\n\n get configuration(): ConfigurationType {\n return this.configurationData.configuration;\n }\n\n private checkShouldUpdate(): boolean {\n const { featureFlags, experiments, configuration } = this.configurationData;\n const { updateInterval } = this.settings;\n\n if (!featureFlags.length && !experiments.length) {\n return true;\n }\n\n if (configuration.realTimeUpdate) {\n return true;\n }\n\n const lastUpdateTime = this.lastUpdate.getTime();\n const updateWindowEdge = Date.now() - updateInterval;\n\n return lastUpdateTime < updateWindowEdge;\n }\n\n private cleanupOutdatedTargetingData(): void {\n const currentTime = Date.now();\n\n for (const [visitorCode, kameleoonVisitorData] of Object.entries(\n this.targetingData,\n )) {\n const { customData, ...rest } = kameleoonVisitorData;\n\n if (customData) {\n for (const [index, dataItem] of Object.entries(customData)) {\n if (dataItem) {\n const isDataExpired =\n dataItem.lastActivityTime + this.targetingDataLifetime <\n currentTime;\n const existingData = kameleoonVisitorData[KameleoonData.CustomData];\n\n if (isDataExpired && existingData) {\n delete existingData[Number(index)];\n }\n\n if (existingData && !Object.keys(existingData).length) {\n delete kameleoonVisitorData[KameleoonData.CustomData];\n }\n }\n }\n }\n\n for (const [key, dataItem] of Object.entries(rest)) {\n const isDataExpired =\n dataItem.lastActivityTime + this.targetingDataLifetime < currentTime;\n\n if (isDataExpired) {\n delete kameleoonVisitorData[key as KameleoonData];\n }\n }\n\n if (!Object.keys(this.targetingData[visitorCode]).length) {\n delete this.targetingData[visitorCode];\n }\n }\n\n // --- Note ---\n // `targetingData` should not refresh `lastUpdate` time\n this.updateStorageData(this.lastUpdate).throw();\n }\n\n private readStorageData(): void {\n const result = this.storage.read();\n\n if (result.ok) {\n const { kameleoonTargetingData, kameleoonConfiguration, lastUpdate } =\n result.data;\n\n this.configurationData = kameleoonConfiguration;\n this.targetingData = kameleoonTargetingData;\n this.lastUpdate = new Date(Date.parse(lastUpdate));\n }\n }\n\n private clearTargetingTrees(): void {\n this.targetingTrees.clear();\n }\n\n private async updateClientConfiguration({\n useCache = false,\n timeStamp,\n }: UpdateClientConfigurationParameters = {}): Promise<\n Result<boolean, KameleoonError>\n > {\n // --- Note ---\n // if `externalClientConfiguration` is passed, fetching is disabled and passed config is used instead\n if (this.externalClientConfiguration) {\n // --- Note ---\n // `featureFlags` field is omitted (v1)\n // instead `featureFlagConfigurations` is used (v2)\n const {\n configuration,\n customData,\n experiments,\n featureFlagConfigurations,\n } = this.externalClientConfiguration;\n\n this.configurationData = {\n customData,\n configuration,\n experiments,\n featureFlags: featureFlagConfigurations,\n };\n } else {\n const clientConfigurationResult =\n await this.requester.getClientConfiguration(timeStamp);\n\n if (!clientConfigurationResult.ok) {\n const { featureFlags, experiments } = this.configurationData;\n\n if (useCache && featureFlags.length && experiments.length) {\n return Ok(true);\n }\n\n return clientConfigurationResult;\n }\n\n Utilities.sendOfflineTracking({\n storage: this.offlineTrackingStorage,\n requester: this.requester,\n });\n\n // --- Note ---\n // `featureFlags` field is omitted (v1)\n // instead `featureFlagConfigurations` is used (v2)\n const {\n configuration,\n experiments,\n featureFlagConfigurations,\n customData,\n } = clientConfigurationResult.data;\n\n this.configurationData = {\n configuration,\n experiments,\n featureFlags: featureFlagConfigurations,\n customData,\n };\n\n if (customData?.length) {\n const customDataLocalOnlyIndexes: number[] = [];\n const persistentCustomDataIndexes: number[] = [];\n\n customData.forEach((customData) => {\n if (customData.localOnly) {\n customDataLocalOnlyIndexes.push(customData.index);\n }\n\n if (customData.scope === CustomDataScope.Visitor) {\n persistentCustomDataIndexes.push(customData.index);\n }\n });\n\n if (customDataLocalOnlyIndexes.length) {\n this.localCustomDataIndexes = new Set(customDataLocalOnlyIndexes);\n }\n\n if (persistentCustomDataIndexes.length) {\n this.persistentCustomDataIndexes = new Set(\n persistentCustomDataIndexes,\n );\n }\n }\n }\n\n this.clearTargetingTrees();\n\n const result = this.updateStorageData(new Date());\n\n if (!result.ok) {\n return result;\n }\n\n return Ok(true);\n }\n\n private updateStorageData(lastUpdate: Date): Result<void, KameleoonError> {\n const data: ClientDataType = {\n kameleoonTargetingData: this.targetingData,\n kameleoonConfiguration: this.configurationData,\n lastUpdate: lastUpdate.toString(),\n };\n\n return this.storage.write(data);\n }\n}\n"],"mappings":"mqHACA,6JAAAA,GAAA,CAAAC,CAAA,CAAAC,CAAA,SAAAC,MAAA,CAAAC,cAAA,CAAAJ,CAAA,CAAAC,CAAA,EAAAI,KAAA,CAAAH,CAAA,CAAAI,UAAA,IAAAC,YAAA,IAAAC,QAAA,MAAAR,CAAA,CAAAC,CAAA,WAAAA,EAAAD,CAAA,CAAAC,CAAA,CAAAC,CAAA,CAAAO,CAAA,MAAAC,CAAA,CAAAT,CAAA,EAAAA,CAAA,CAAAU,SAAA,YAAAC,CAAA,CAAAX,CAAA,CAAAW,CAAA,CAAAC,CAAA,CAAAV,MAAA,CAAAW,MAAA,CAAAJ,CAAA,CAAAC,SAAA,EAAAI,CAAA,KAAAC,CA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K,CAErD,CAAC,CAAC,CAEEkD,CAA0B,CAACvK,MAAM,GACnC,IAAI,CAAC0H,sBAAsB,CAAG,GAAI,CAAAtD,GAAG,CAACmG,CAA0B,CAAC,EAG/DvC,CAA2B,CAAChI,MAAM,GACpC,IAAI,CAACgI,2BAA2B,CAAG,GAAI,CAAA5D,GAAG,CACxC4D,CAA2B,CAC5B,cAKP,IAAI,CAACiC,mBAAmB,EAAE,CAEpB1C,CAAM,CAAG,IAAI,CAACC,iBAAiB,CAAC,GAAI,CAAAlD,IAAM,CAAC,CAE5CiD,CAAM,CAACjC,EAAE,EAAAjJ,CAAA,CAAA6C,IAAA,iBAAA7C,CAAA,CAAAuC,MAAA,UACL2I,CAAM,iBAAAlL,CAAA,CAAAuC,MAAA,UAGR,GAAAyH,SAAE,KAAM,2BAAAhK,CAAA,CAAA8F,IAAA,MAAA9F,CAAA,OAChB,UAAAA,CAAA,MAAA4G,GAAA,qBAAAvG,KAAA,CAED,SAAA8K,kBAA0BnD,CAAgB,CAAgC,CACxE,GAAM,CAAAoC,CAAoB,CAAG,CAC3BqD,sBAAsB,CAAE,IAAI,CAACtD,aAAa,CAC1CuD,sBAAsB,CAAE,IAAI,CAACxE,iBAAiB,CAC9ClB,UAAU,CAAEA,CAAU,CAACuG,QAAQ,EACjC,CAAC,CAED,MAAO,KAAI,CAAClH,OAAO,CAACmH,KAAK,CAACpE,CAAI,CAChC,CAAC,IAAApK,CAAA,IAAAyO,OAAA,CAAAtH,qBAAA,CAAAA,qBAAA"}
1
+ {"version":3,"file":"campaignConfiguration.js","names":["a","b","c","Object","defineProperty","value","enumerable","configurable","writable","e","f","prototype","d","g","create","h","m","s","i","type","arg","call","forEach","_invoke","j","k","_typeof","r","resolve","__await","then","Error","o","method","delegate","x","sent","_sent","dispatchException","abrupt","done","iterator","return","TypeError","resultName","next","nextLoc","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","l","completion","reset","n","u","isNaN","length","_regeneratorRuntime","p","q","hasOwnProperty","t","Symbol","v","asyncIterator","w","toStringTag","wrap","y","z","getPrototypeOf","A","B","displayName","isGeneratorFunction","constructor","name","mark","setPrototypeOf","__proto__","awrap","AsyncIterator","async","Promise","keys","reverse","pop","values","prev","charAt","slice","stop","rval","complete","finish","catch","_catch","delegateYield","asyncGeneratorStep","_asyncToGenerator","arguments","apply","_classCallCheck","_defineProperties","_toPropertyKey","key","_createClass","_defineProperty","_toPrimitive","toPrimitive","String","Number","CampaignConfiguration","settings","storage","requester","externalClientConfiguration","targetingCleanupInterval","offlineTrackingStorage","externalEventSource","UpdateType","Idle","Map","DEFAULT_CONFIGURATION_DATA","CLEANUP_TARGETING_DATA_INTERVAL","Milliseconds","Minute","Set","lastUpdate","Date","readStorageData","targetingDataLifetime","cleanupIntervalMinutes","targetingDataIntervalId","setInterval","cleanupOutdatedTargetingData","bind","err","clearInterval","useCache","isExternalConfiguration","shouldUpdate","checkShouldUpdate","updateClientConfiguration","updateResult","ok","isUpdateTypeToggled","data","Ok","handleExternalUpdates","updateType","RealTime","eventSource","handleRealTimeUpdates","Polling","handlePollingUpdates","cleanupHandlers","close","updateConfigurationIntervalId","configuration","customData","experiments","featureFlagConfigurations","configurationData","featureFlags","ExternalEventSource","siteCode","updateEventCallback","timeStamp","configurationUpdateCallback","open","updateInterval","addTargetingData","visitorCode","targetingData","Array","dataItem","Utilities","isCustomData","_objectSpread","lastActivityTime","now","hasCustomDataKey","KameleoonData","CustomData","index","hasDataKey","result","updateStorageData","unsentTargetingData","localCustomDataIndexes","has","set","getUnsentData","clearUnsentData","dataItems","persistentCustomDataIndexes","size","persistentCustomData","_createForOfIteratorHelper","isPersistentCustomData","getTargetingTree","segment","targetingTrees","id","targetingTree","TargetingTree","get","onConfigurationUpdate","callback","skipChecks","realTimeUpdate","lastUpdateTime","getTime","updateWindowEdge","currentTime","entries","_slicedToArray","kameleoonVisitorData","rest","_objectWithoutProperties","_excluded","isDataExpired","existingData","throw","read","kameleoonTargetingData","kameleoonConfiguration","parse","clearTargetingTrees","clear","getClientConfiguration","clientConfigurationResult","sendOfflineTracking","customDataLocalOnlyIndexes","localOnly","scope","CustomDataScope","Visitor","toggleUpdateType","initialize","toString","write","exports"],"sources":["../../src/campaignConfiguration/campaignConfiguration.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonError } from 'src/kameleoonError/kameleoonError';\nimport { ClientSettingsType } from 'src/clientSettings/types';\nimport {\n CustomData,\n KameleoonData,\n KameleoonDataType,\n} from 'src/kameleoonData';\nimport { Requester, GetClientConfigurationResultType } from 'src/requester';\nimport { SegmentType, TargetingDataType, TargetingTree } from 'src/targeting';\nimport { IStorage, ClientDataType } from 'src/storage';\nimport {\n ExternalEventSource,\n IEventSource,\n IExternalEventSourceConstructor,\n} from 'src/eventSource';\nimport { Milliseconds } from 'src/types';\nimport {\n CLEANUP_TARGETING_DATA_INTERVAL,\n DEFAULT_CONFIGURATION_DATA,\n} from './constants';\nimport {\n CampaignConfigurationParametersType,\n ConfigurationDataType,\n ConfigurationType,\n CustomDataScope,\n ExperimentItemType,\n FeatureFlagType,\n UnsentTargetingDataType,\n UnsentVisitorTargetingDataType,\n UpdateClientConfigurationParameters,\n UpdateType,\n} from './types';\nimport { Utilities } from 'src/utilities';\nimport {\n ExistingCustomDataType,\n ExistingDataType,\n} from 'src/kameleoonData/types';\nimport { OfflineTracking } from 'src/storage/types';\n\ninterface ICampaignConfiguration {\n initialize: (useCache?: boolean) => Promise<Result<void, KameleoonError>>;\n addTargetingData: (\n visitorCode: string,\n ...data: KameleoonDataType[]\n ) => Result<void, KameleoonError>;\n getUnsentData: (\n visitorCode: string,\n ) => UnsentTargetingDataType[string] | undefined;\n clearUnsentData: (visitorCode: string) => void;\n isPersistentCustomData: (dataItem: KameleoonDataType) => boolean;\n onConfigurationUpdate: (callback: () => void) => void;\n readonly experiments: ExperimentItemType[];\n readonly storedTargetingData: TargetingDataType;\n readonly featureFlags: FeatureFlagType[];\n readonly configuration: ConfigurationType;\n readonly unsentDataVisitors: string[];\n}\n\nexport class CampaignConfiguration implements ICampaignConfiguration {\n private configurationUpdateCallback?: () => void;\n private updateConfigurationIntervalId: NodeJS.Timer | null = null;\n private updateType: UpdateType = UpdateType.Idle;\n private targetingDataIntervalId: NodeJS.Timer | null = null;\n private unsentTargetingData: UnsentTargetingDataType = {};\n private targetingData: TargetingDataType = {};\n private targetingTrees: Map<string, TargetingTree> = new Map();\n private configurationData: ConfigurationDataType = DEFAULT_CONFIGURATION_DATA;\n private settings: ClientSettingsType;\n private lastUpdate: Date;\n private storage: IStorage<ClientDataType>;\n private offlineTrackingStorage: IStorage<OfflineTracking>;\n private requester: Requester;\n private eventSource?: IEventSource;\n private externalEventSource: IExternalEventSourceConstructor;\n private externalClientConfiguration?: GetClientConfigurationResultType;\n private targetingDataLifetime: number =\n CLEANUP_TARGETING_DATA_INTERVAL * Milliseconds.Minute;\n private localCustomDataIndexes: Set<number> = new Set();\n private persistentCustomDataIndexes: Set<number> = new Set();\n\n constructor({\n settings,\n storage,\n requester,\n externalClientConfiguration,\n targetingCleanupInterval,\n offlineTrackingStorage,\n externalEventSource,\n }: CampaignConfigurationParametersType) {\n this.requester = requester;\n this.settings = settings;\n this.lastUpdate = new Date();\n this.storage = storage;\n this.readStorageData();\n this.externalClientConfiguration = externalClientConfiguration;\n this.offlineTrackingStorage = offlineTrackingStorage;\n this.externalEventSource = externalEventSource;\n\n if (targetingCleanupInterval) {\n this.targetingDataLifetime =\n targetingCleanupInterval * Milliseconds.Minute;\n\n const cleanupIntervalMinutes =\n targetingCleanupInterval < 0 ? 1 : targetingCleanupInterval;\n\n // --- Note ---\n // We can not make delayed code execution recoverable, as it might lead\n // to targeting data storage size overflow\n try {\n this.targetingDataIntervalId = setInterval(\n this.cleanupOutdatedTargetingData.bind(this),\n cleanupIntervalMinutes * Milliseconds.Minute,\n );\n } catch (err) {\n if (this.targetingDataIntervalId) {\n clearInterval(this.targetingDataIntervalId);\n }\n\n throw err;\n }\n }\n }\n\n public async initialize(\n useCache?: boolean,\n ): Promise<Result<void, KameleoonError>> {\n const isExternalConfiguration = Boolean(this.externalClientConfiguration);\n const shouldUpdate = this.checkShouldUpdate(isExternalConfiguration);\n\n if (shouldUpdate) {\n const updateResult = await this.updateClientConfiguration({ useCache });\n\n if (!updateResult.ok) {\n return updateResult;\n }\n\n // --- Note ---\n // If update type is being toggled `initialize` will be called again\n // so we don't need to continue execution here\n const isUpdateTypeToggled = updateResult.data;\n\n if (isUpdateTypeToggled) {\n return Ok();\n }\n }\n\n if (isExternalConfiguration) {\n this.handleExternalUpdates();\n\n return Ok();\n }\n\n if (this.updateType === UpdateType.RealTime && !this.eventSource) {\n this.updateType = UpdateType.Idle;\n this.handleRealTimeUpdates(useCache);\n\n return Ok();\n }\n\n if (this.updateType === UpdateType.Polling) {\n this.handlePollingUpdates(useCache);\n }\n\n return Ok();\n }\n\n private cleanupHandlers(): void {\n if (this.eventSource) {\n this.eventSource.close();\n }\n\n if (this.updateConfigurationIntervalId) {\n clearInterval(this.updateConfigurationIntervalId);\n }\n }\n\n private handleExternalUpdates(): void {\n this.cleanupHandlers();\n\n const {\n configuration,\n customData,\n experiments,\n featureFlagConfigurations,\n } = this.externalClientConfiguration!;\n\n this.configurationData = {\n customData,\n configuration,\n experiments,\n featureFlags: featureFlagConfigurations,\n };\n }\n\n private handleRealTimeUpdates(useCache?: boolean): void {\n this.cleanupHandlers();\n\n this.eventSource = new ExternalEventSource(\n this.settings.siteCode,\n this.externalEventSource,\n );\n\n const updateEventCallback = (timeStamp: number) => {\n this.updateClientConfiguration({ useCache, timeStamp });\n\n if (this.configurationUpdateCallback) {\n this.configurationUpdateCallback();\n }\n };\n\n this.eventSource.open(updateEventCallback);\n }\n\n private handlePollingUpdates(useCache?: boolean): void {\n // --- Note ---\n // If `initialize` is called again the interval will be cleared\n // so theoretically we will constantly defer config update\n // but `this.lastUpdate` with `checkShouldUpdate` will prevent that\n this.cleanupHandlers();\n\n // --- Note ---\n // Same as targeting data interval we don't want to make failed configuration\n // retrieval recoverable\n try {\n this.updateConfigurationIntervalId = setInterval(\n () => this.updateClientConfiguration.bind(this)({ useCache }),\n this.settings.updateInterval,\n );\n } catch (err) {\n if (this.updateConfigurationIntervalId) {\n clearInterval(this.updateConfigurationIntervalId);\n }\n\n throw err;\n }\n }\n\n public addTargetingData(\n visitorCode: string,\n ...data: KameleoonDataType[]\n ): Result<void, KameleoonError> {\n if (!(visitorCode in this.targetingData)) {\n this.targetingData[visitorCode] = {};\n }\n\n // --- Note ---\n // Following code is optimized for performance:\n // - We don't want to copy the whole object every time we add new data\n // - So we are manually checking the keys existence and mutating targeting data directly\n // - Numerous type casts are required because we can't narrow down nested `this.targetingData` types by using assertion functions\n data.forEach((dataItem) => {\n // --- Custom data case ---\n if (Utilities.isCustomData(dataItem)) {\n const customData = {\n ...dataItem.data,\n lastActivityTime: Date.now(),\n };\n const hasCustomDataKey =\n KameleoonData.CustomData in this.targetingData[visitorCode];\n\n // -- Change directly if `[key]` exists\n if (hasCustomDataKey) {\n (\n this.targetingData[visitorCode][\n customData.type\n ] as ExistingCustomDataType\n )[customData.index] = customData;\n } else {\n // -- Change data by creating new `[key]` and `[index]`\n this.targetingData[visitorCode] = {\n ...this.targetingData[visitorCode],\n [customData.type]: {\n ...this.targetingData[visitorCode][customData.type],\n [customData.index]: customData,\n },\n };\n }\n // --- Other data types case ---\n } else {\n const data = { ...dataItem.data, lastActivityTime: Date.now() };\n const hasDataKey =\n dataItem.data.type in this.targetingData[visitorCode];\n\n // -- Changing data by `[key]` if it exists\n if (hasDataKey) {\n (this.targetingData[visitorCode][\n dataItem.data.type\n ] as ExistingDataType<typeof dataItem.data.type>) = data;\n } else {\n // -- Change data by creating new `[key]`\n this.targetingData[visitorCode] = {\n ...this.targetingData[visitorCode],\n [dataItem.data.type]: data,\n };\n }\n }\n });\n\n // --- Note ---\n // `targetingData` should not refresh `lastUpdate` time\n const result = this.updateStorageData(this.lastUpdate);\n\n if (result.ok) {\n data.forEach((dataItem) => {\n // --- Note ---\n // We assume `this.unsentTargetingData[visitorCode]` is always defined further in the code\n if (!this.unsentTargetingData[visitorCode]) {\n this.unsentTargetingData[visitorCode] = new Map();\n }\n\n let key: KameleoonData | number;\n\n if (Utilities.isCustomData(dataItem)) {\n if (this.localCustomDataIndexes.has(dataItem.data.index)) {\n return;\n }\n\n key = dataItem.data.index;\n } else {\n key = dataItem.data.type;\n }\n\n this.unsentTargetingData[visitorCode]!.set(key, dataItem);\n });\n }\n\n return result;\n }\n\n public getUnsentData(\n visitorCode: string,\n ): UnsentTargetingDataType[string] | undefined {\n return this.unsentTargetingData[visitorCode];\n }\n\n public clearUnsentData(visitorCode: string): void {\n const dataItems = this.unsentTargetingData[visitorCode]?.values();\n\n if (dataItems && this.persistentCustomDataIndexes.size) {\n const persistentCustomData: UnsentVisitorTargetingDataType = new Map();\n\n for (const dataItem of dataItems) {\n if (this.isPersistentCustomData(dataItem)) {\n persistentCustomData.set(dataItem.data.index, dataItem);\n }\n }\n\n if (persistentCustomData.size) {\n this.unsentTargetingData[visitorCode] = persistentCustomData;\n return;\n }\n }\n\n delete this.unsentTargetingData[visitorCode];\n }\n\n public getTargetingTree(segment: SegmentType): TargetingTree {\n if (!this.targetingTrees.has(segment.id)) {\n const targetingTree = new TargetingTree(segment);\n\n this.targetingTrees.set(segment.id, new TargetingTree(segment));\n\n return targetingTree;\n }\n\n return this.targetingTrees.get(segment.id) as TargetingTree;\n }\n\n public onConfigurationUpdate(callback: () => void): void {\n this.configurationUpdateCallback = callback;\n }\n\n public isPersistentCustomData(\n dataItem: KameleoonDataType,\n ): dataItem is CustomData {\n if (!this.persistentCustomDataIndexes.size) {\n return false;\n }\n\n if (Utilities.isCustomData(dataItem)) {\n return this.persistentCustomDataIndexes.has(dataItem.data.index);\n }\n\n return false;\n }\n\n get unsentDataVisitors(): string[] {\n return Object.keys(this.unsentTargetingData);\n }\n\n get storedTargetingData(): TargetingDataType {\n return this.targetingData;\n }\n\n get experiments(): ExperimentItemType[] {\n return this.configurationData.experiments;\n }\n\n get featureFlags(): FeatureFlagType[] {\n return this.configurationData.featureFlags;\n }\n\n get configuration(): ConfigurationType {\n return this.configurationData.configuration;\n }\n\n private checkShouldUpdate(skipChecks = false): boolean {\n const { featureFlags, experiments, configuration } = this.configurationData;\n const { updateInterval } = this.settings;\n\n // --- Note ---\n // Following `updateType` logic is done for client side\n // edge cases where we have previous campaigns on storage already, but we still want\n // to initialize SSE/Polling after page reload\n if (skipChecks) {\n this.updateType = UpdateType.Idle;\n\n return false;\n }\n\n this.updateType = configuration.realTimeUpdate\n ? UpdateType.RealTime\n : UpdateType.Polling;\n\n if (!featureFlags.length && !experiments.length) {\n return true;\n }\n\n const lastUpdateTime = this.lastUpdate.getTime();\n const updateWindowEdge = Date.now() - updateInterval;\n\n return lastUpdateTime < updateWindowEdge;\n }\n\n private cleanupOutdatedTargetingData(): void {\n const currentTime = Date.now();\n\n for (const [visitorCode, kameleoonVisitorData] of Object.entries(\n this.targetingData,\n )) {\n const { customData, ...rest } = kameleoonVisitorData;\n\n if (customData) {\n for (const [index, dataItem] of Object.entries(customData)) {\n if (dataItem) {\n const isDataExpired =\n dataItem.lastActivityTime + this.targetingDataLifetime <\n currentTime;\n const existingData = kameleoonVisitorData[KameleoonData.CustomData];\n\n if (isDataExpired && existingData) {\n delete existingData[Number(index)];\n }\n\n if (existingData && !Object.keys(existingData).length) {\n delete kameleoonVisitorData[KameleoonData.CustomData];\n }\n }\n }\n }\n\n for (const [key, dataItem] of Object.entries(rest)) {\n const isDataExpired =\n dataItem.lastActivityTime + this.targetingDataLifetime < currentTime;\n\n if (isDataExpired) {\n delete kameleoonVisitorData[key as KameleoonData];\n }\n }\n\n if (!Object.keys(this.targetingData[visitorCode]).length) {\n delete this.targetingData[visitorCode];\n }\n }\n\n // --- Note ---\n // `targetingData` should not refresh `lastUpdate` time\n this.updateStorageData(this.lastUpdate).throw();\n }\n\n private readStorageData(): void {\n const result = this.storage.read();\n\n if (result.ok) {\n const { kameleoonTargetingData, kameleoonConfiguration, lastUpdate } =\n result.data;\n\n this.configurationData = kameleoonConfiguration;\n this.targetingData = kameleoonTargetingData;\n this.lastUpdate = new Date(Date.parse(lastUpdate));\n }\n }\n\n private clearTargetingTrees(): void {\n this.targetingTrees.clear();\n }\n\n /**\n * Updates client configuration\n *\n * @param useCache - if true, will not update configuration if it is already present (for _offline_ mode)\n * @param timeStamp - timestamp for real-time configuration update\n *\n * @returns `true` if current update type should be toggled (SSE/Polling)\n */\n private async updateClientConfiguration({\n useCache = false,\n timeStamp,\n }: UpdateClientConfigurationParameters = {}): Promise<\n Result<boolean, KameleoonError>\n > {\n const clientConfigurationResult =\n await this.requester.getClientConfiguration(timeStamp);\n\n if (!clientConfigurationResult.ok) {\n const { featureFlags, experiments } = this.configurationData;\n\n if (useCache && featureFlags.length && experiments.length) {\n return Ok(true);\n }\n\n return clientConfigurationResult;\n }\n\n Utilities.sendOfflineTracking({\n storage: this.offlineTrackingStorage,\n requester: this.requester,\n });\n\n // --- Note ---\n // `featureFlags` field is omitted (v1)\n // instead `featureFlagConfigurations` is used (v2)\n const {\n configuration,\n experiments,\n featureFlagConfigurations,\n customData,\n } = clientConfigurationResult.data;\n\n this.configurationData = {\n configuration,\n experiments,\n featureFlags: featureFlagConfigurations,\n customData,\n };\n\n if (customData?.length) {\n const customDataLocalOnlyIndexes: number[] = [];\n const persistentCustomDataIndexes: number[] = [];\n\n customData.forEach((customData) => {\n if (customData.localOnly) {\n customDataLocalOnlyIndexes.push(customData.index);\n }\n\n if (customData.scope === CustomDataScope.Visitor) {\n persistentCustomDataIndexes.push(customData.index);\n }\n });\n\n if (customDataLocalOnlyIndexes.length) {\n this.localCustomDataIndexes = new Set(customDataLocalOnlyIndexes);\n }\n\n if (persistentCustomDataIndexes.length) {\n this.persistentCustomDataIndexes = new Set(persistentCustomDataIndexes);\n }\n }\n\n this.clearTargetingTrees();\n\n const result = this.updateStorageData(new Date());\n\n if (!result.ok) {\n return result;\n }\n\n const updateType = configuration.realTimeUpdate\n ? UpdateType.RealTime\n : UpdateType.Polling;\n\n const toggleUpdateType = updateType !== this.updateType;\n\n if (toggleUpdateType) {\n this.updateType = updateType;\n await this.initialize(useCache);\n }\n\n return Ok(toggleUpdateType);\n }\n\n private updateStorageData(lastUpdate: Date): Result<void, KameleoonError> {\n this.lastUpdate = lastUpdate;\n\n const data: ClientDataType = {\n kameleoonTargetingData: this.targetingData,\n kameleoonConfiguration: this.configurationData,\n lastUpdate: lastUpdate.toString(),\n };\n\n return this.storage.write(data);\n }\n}\n"],"mappings":"mqHACA,6JAAAA,GAAA,CAAAC,CAAA,CAAAC,CAAA,SAAAC,MAAA,CAAAC,cAAA,CAAAJ,CAAA,CAAAC,CAAA,EAAAI,KAAA,CAAAH,CAAA,CAAAI,UAAA,IAAAC,YAAA,IAAAC,QAAA,MAAAR,CAAA,CAAAC,CAAA,WAAAA,EAAAD,CAAA,CAAAC,CAAA,CAAAC,CAAA,CAAAO,CAAA,MAAAC,CAAA,CAAAT,CAAA,EAAAA,CAAA,CAAAU,SAAA,YAAAC,CAAA,CAAAX,CAAA,CAAAW,CAAA,CAAAC,CAAA,CAAAV,MAAA,CAAAW,MAAA,CAAAJ,CAAA,CAAAC,SAAA,EAAAI,CAAA,KAAAC,CAAA,CAAAP,CAAA,aAAAQ,CAAA,CAAAJ,CAAA,YAAAR,KAAA,CAAAa,CAAA,CAAAlB,CAAA,CAAAE,CAAA,CAAAa,CAAA,IAAAF,CAAA,UAAAX,EAAAF,CAAA,CAAAC,CAAA,CAAAC,CAAA,aAAAiB,IAAA,UAAAC,GAAA,CAAApB,CAAA,CAAAqB,IAAA,CAAApB,CAAA,CAAAC,CAAA,SAAAF,CAAA,SAAAmB,IAAA,SAAAC,GAAA,CAAApB,CAAA,YAAAY,EAAA,YAAAH,EAAA,YAAAC,EAAA,YAAAG,EAAAZ,CAAA,4BAAAqB,OAAA,UAAApB,CAAA,EAAAF,CAAA,CAAAC,CAAA,CAAAC,CAAA,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AAC+B,QAAQ,CACnB/B,kBAAU,CAACkC,OAAO,CAEhBqF,CAAgB,CAAGzF,CAAU,GAAK,IAAI,CAACA,UAAU,EAEnDyF,CAAgB,EAAAlP,CAAA,CAAA6C,IAAA,gBAClB,KAAI,CAAC4G,UAAU,CAAGA,CAAU,CAAAzJ,CAAA,CAAA6C,IAAA,IACtB,IAAI,CAACsM,UAAU,CAACrG,CAAQ,CAAC,gBAAA9I,CAAA,CAAAuC,MAAA,UAG1B,GAAAgH,SAAE,EAAC2F,CAAgB,CAAC,2BAAAlP,CAAA,CAAA8F,IAAA,MAAA9F,CAAA,OAC5B,UAAAA,CAAA,MAAA4G,GAAA,qBAAAvG,KAAA,CAED,SAAA0L,kBAA0B5D,CAAgB,CAAgC,CACxE,IAAI,CAACA,UAAU,CAAGA,CAAU,CAE5B,GAAM,CAAAmB,CAAoB,CAAG,CAC3B+E,sBAAsB,CAAE,IAAI,CAACpD,aAAa,CAC1CqD,sBAAsB,CAAE,IAAI,CAAChE,iBAAiB,CAC9CnC,UAAU,CAAEA,CAAU,CAACiH,QAAQ,EACjC,CAAC,CAED,MAAO,KAAI,CAAC/H,OAAO,CAACgI,KAAK,CAAC/F,CAAI,CAChC,CAAC,IAAAtJ,CAAA,IAAAsP,OAAA,CAAAnI,qBAAA,CAAAA,qBAAA"}
@@ -1,4 +1,5 @@
1
1
  import { ClientSettingsType } from '../clientSettings';
2
+ import { IExternalEventSourceConstructor } from '../eventSource';
2
3
  import { KameleoonData, KameleoonDataType } from '../kameleoonData';
3
4
  import { Requester, GetClientConfigurationResultType } from '../requester';
4
5
  import { ClientDataType, ExternalStorage, IStorage } from '../storage';
@@ -13,6 +14,11 @@ export type ScheduleType = {
13
14
  dateStart: string;
14
15
  dateEnd: string;
15
16
  };
17
+ export declare enum UpdateType {
18
+ Polling = 0,
19
+ RealTime = 1,
20
+ Idle = 2
21
+ }
16
22
  export type JSONValue = string | number | boolean | {
17
23
  [x: string]: JSONValue;
18
24
  } | JSONValue[];
@@ -144,5 +150,6 @@ export type CampaignConfigurationParametersType = {
144
150
  requester: Requester;
145
151
  offlineTrackingStorage: ExternalStorage<OfflineTracking>;
146
152
  externalClientConfiguration?: GetClientConfigurationResultType;
153
+ externalEventSource: IExternalEventSourceConstructor;
147
154
  targetingCleanupInterval?: number;
148
155
  };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.RuleType=exports.FeatureStatus=exports.FeatureFlagSdkLanguageType=exports.ExperimentType=exports.ExperimentStatus=exports.CustomDataScope=void 0;var ExperimentType=/*#__PURE__*/function(a){return a.CLASSIC="CLASSIC",a.SERVER_SIDE="SERVER_SIDE",a.DEVELOPER="DEVELOPER",a.MVT="MVT",a.HYBRID="HYBRID",a}({});exports.ExperimentType=ExperimentType;var RuleType=/*#__PURE__*/function(a){return a.PROGRESSIVE_DELIVERY="PROGRESSIVE_DELIVERY",a.TARGETED_DELIVERY="TARGETED_DELIVERY",a.EXPERIMENTATION="EXPERIMENTATION",a}({});exports.RuleType=RuleType;var FeatureFlagSdkLanguageType=/*#__PURE__*/function(a){return a.ANDROID="ANDROID",a.SWIFT="SWIFT",a.JAVA="JAVA",a.CSHARP="CSHARP",a.NODEJS="NODEJS",a.PHP="PHP",a.RUBY="RUBY",a.GO="GO",a.FLUTTER="FLUTTER",a.REACTJS="REACTJS",a}({});exports.FeatureFlagSdkLanguageType=FeatureFlagSdkLanguageType;var FeatureStatus=/*#__PURE__*/function(a){return a.ACTIVATED="ACTIVATED",a.DEACTIVATED="DEACTIVATED",a.SCHEDULED="SCHEDULED",a}({});exports.FeatureStatus=FeatureStatus;var CustomDataScope=/*#__PURE__*/function(a){return a.Visit="VISIT",a.Visitor="VISITOR",a.Page="Page",a}({});exports.CustomDataScope=CustomDataScope;var ExperimentStatus=/*#__PURE__*/function(a){return a.DRAFT="DRAFT",a.ACTIVE="ACTIVE",a.PAUSED="PAUSED",a.SCHEDULED="SCHEDULED",a.STOPPED="STOPPED",a.USED_AS_PERSONALIZATION="USED_AS_PERSONALIZATION",a.DEVIATED="DEVIATED",a}({});exports.ExperimentStatus=ExperimentStatus;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.UpdateType=exports.RuleType=exports.FeatureStatus=exports.FeatureFlagSdkLanguageType=exports.ExperimentType=exports.ExperimentStatus=exports.CustomDataScope=void 0;var UpdateType=/*#__PURE__*/function(a){return a[a.Polling=0]="Polling",a[a.RealTime=1]="RealTime",a[a.Idle=2]="Idle",a}({});exports.UpdateType=UpdateType;var ExperimentType=/*#__PURE__*/function(a){return a.CLASSIC="CLASSIC",a.SERVER_SIDE="SERVER_SIDE",a.DEVELOPER="DEVELOPER",a.MVT="MVT",a.HYBRID="HYBRID",a}({});exports.ExperimentType=ExperimentType;var RuleType=/*#__PURE__*/function(a){return a.PROGRESSIVE_DELIVERY="PROGRESSIVE_DELIVERY",a.TARGETED_DELIVERY="TARGETED_DELIVERY",a.EXPERIMENTATION="EXPERIMENTATION",a}({});exports.RuleType=RuleType;var FeatureFlagSdkLanguageType=/*#__PURE__*/function(a){return a.ANDROID="ANDROID",a.SWIFT="SWIFT",a.JAVA="JAVA",a.CSHARP="CSHARP",a.NODEJS="NODEJS",a.PHP="PHP",a.RUBY="RUBY",a.GO="GO",a.FLUTTER="FLUTTER",a.REACTJS="REACTJS",a}({});exports.FeatureFlagSdkLanguageType=FeatureFlagSdkLanguageType;var FeatureStatus=/*#__PURE__*/function(a){return a.ACTIVATED="ACTIVATED",a.DEACTIVATED="DEACTIVATED",a.SCHEDULED="SCHEDULED",a}({});exports.FeatureStatus=FeatureStatus;var CustomDataScope=/*#__PURE__*/function(a){return a.Visit="VISIT",a.Visitor="VISITOR",a.Page="Page",a}({});exports.CustomDataScope=CustomDataScope;var ExperimentStatus=/*#__PURE__*/function(a){return a.DRAFT="DRAFT",a.ACTIVE="ACTIVE",a.PAUSED="PAUSED",a.SCHEDULED="SCHEDULED",a.STOPPED="STOPPED",a.USED_AS_PERSONALIZATION="USED_AS_PERSONALIZATION",a.DEVIATED="DEVIATED",a}({});exports.ExperimentStatus=ExperimentStatus;
2
2
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":["ExperimentType","CLASSIC","SERVER_SIDE","DEVELOPER","MVT","HYBRID","exports","RuleType","PROGRESSIVE_DELIVERY","TARGETED_DELIVERY","EXPERIMENTATION","FeatureFlagSdkLanguageType","ANDROID","SWIFT","JAVA","CSHARP","NODEJS","PHP","RUBY","GO","FLUTTER","REACTJS","FeatureStatus","ACTIVATED","DEACTIVATED","SCHEDULED","CustomDataScope","Visit","Visitor","Page","ExperimentStatus","DRAFT","ACTIVE","PAUSED","STOPPED","USED_AS_PERSONALIZATION","DEVIATED"],"sources":["../../src/campaignConfiguration/types.ts"],"sourcesContent":["import { ClientSettingsType } from 'src/clientSettings';\nimport { KameleoonData, KameleoonDataType } from 'src/kameleoonData';\nimport { Requester, GetClientConfigurationResultType } from 'src/requester';\nimport { ClientDataType, ExternalStorage, IStorage } from 'src/storage';\nimport { OfflineTracking } from 'src/storage/types';\nimport { SegmentType, TargetingDataType } from 'src/targeting';\nimport { VariableType } from 'src/types';\n\nexport type UpdateClientConfigurationParameters = {\n timeStamp?: number;\n useCache?: boolean;\n};\n\nexport type ScheduleType = {\n dateStart: string;\n dateEnd: string;\n};\n\nexport type JSONValue =\n | string\n | number\n | boolean\n | { [x: string]: JSONValue }\n | JSONValue[];\n\nexport type JSONType = Record<string | number | symbol, JSONValue> | null;\n\nexport enum ExperimentType {\n CLASSIC = 'CLASSIC',\n SERVER_SIDE = 'SERVER_SIDE',\n DEVELOPER = 'DEVELOPER',\n MVT = 'MVT',\n HYBRID = 'HYBRID',\n}\n\nexport enum RuleType {\n PROGRESSIVE_DELIVERY = 'PROGRESSIVE_DELIVERY',\n TARGETED_DELIVERY = 'TARGETED_DELIVERY',\n EXPERIMENTATION = 'EXPERIMENTATION',\n}\n\nexport enum FeatureFlagSdkLanguageType {\n ANDROID = 'ANDROID',\n SWIFT = 'SWIFT',\n JAVA = 'JAVA',\n CSHARP = 'CSHARP',\n NODEJS = 'NODEJS',\n PHP = 'PHP',\n RUBY = 'RUBY',\n GO = 'GO',\n FLUTTER = 'FLUTTER',\n REACTJS = 'REACTJS',\n}\n\nexport enum FeatureStatus {\n ACTIVATED = 'ACTIVATED',\n DEACTIVATED = 'DEACTIVATED',\n SCHEDULED = 'SCHEDULED',\n}\n\nexport enum CustomDataScope {\n Visit = 'VISIT',\n Visitor = 'VISITOR',\n Page = 'Page',\n}\n\nexport type ExperimentItemType = {\n id: string;\n name: string;\n type: ExperimentType;\n siteId: string;\n siteCode: string;\n status: ExperimentStatus;\n siteEnabled: boolean;\n variations: ExperimentVariationType[];\n deviations: DeviationType[];\n respoolTime: RespoolTimeType[];\n segment: SegmentType | null;\n};\n\nexport type ExperimentVariationType = {\n id: string;\n customJson: string;\n};\n\nexport type DeviationType = {\n variationId: string;\n value: number;\n};\n\nexport type RespoolTimeType = {\n variationId: string;\n value: number;\n};\n\nexport enum ExperimentStatus {\n DRAFT = 'DRAFT',\n ACTIVE = 'ACTIVE',\n PAUSED = 'PAUSED',\n SCHEDULED = 'SCHEDULED',\n STOPPED = 'STOPPED',\n USED_AS_PERSONALIZATION = 'USED_AS_PERSONALIZATION',\n DEVIATED = 'DEVIATED',\n}\n\nexport type FeatureFlagType = {\n id: number;\n featureKey: string;\n variations: FeatureVariationType[];\n defaultVariationKey: string;\n rules: RuleItemType[];\n};\n\nexport type FeatureVariationType = {\n key: string;\n variables: FeatureVariableType[];\n};\n\nexport type FeatureVariableType = {\n key: string;\n type: VariableType;\n value: string | number | boolean;\n};\n\nexport type RuleItemType = {\n type: RuleType;\n id: number;\n respoolTime: number | null;\n order: number;\n exposition: number;\n experimentId: number;\n variationByExposition: VariationByExpositionType[];\n segment: SegmentType | null;\n};\n\nexport type VariationByExpositionType = {\n variationKey: string;\n variationId: number | null;\n exposition: number;\n};\n\nexport type ConfigurationDataType = {\n experiments: ExperimentItemType[];\n featureFlags: FeatureFlagType[];\n configuration: ConfigurationType;\n customData: CustomDataConfigurationType[];\n};\n\nexport type CustomDataConfigurationType = {\n index: number;\n localOnly: boolean;\n scope: CustomDataScope;\n};\n\nexport type ConfigurationType = {\n realTimeUpdate: boolean;\n};\n\nexport type CampaignConfigurationType = {\n targetingData: TargetingDataType;\n configurationData: ConfigurationDataType;\n};\n\nexport type UnsentVisitorTargetingDataType = Map<\n KameleoonData | number,\n KameleoonDataType\n>;\n\nexport type UnsentTargetingDataType = {\n [visitorCode: string]: UnsentVisitorTargetingDataType | undefined;\n};\n\nexport type CampaignConfigurationParametersType = {\n settings: ClientSettingsType;\n storage: IStorage<ClientDataType>;\n requester: Requester;\n offlineTrackingStorage: ExternalStorage<OfflineTracking>;\n externalClientConfiguration?: GetClientConfigurationResultType;\n targetingCleanupInterval?: number;\n};\n"],"mappings":"gOA2BY,CAAAA,cAAc,uBAAdA,CAAc,QAAd,CAAAA,CAAc,CAAAC,OAAA,WAAdD,CAAc,CAAAE,WAAA,eAAdF,CAAc,CAAAG,SAAA,aAAdH,CAAc,CAAAI,GAAA,OAAdJ,CAAc,CAAAK,MAAA,UAAdL,CAAc,MAAAM,OAAA,CAAAN,cAAA,CAAAA,cAAA,IAQd,CAAAO,QAAQ,uBAARA,CAAQ,QAAR,CAAAA,CAAQ,CAAAC,oBAAA,wBAARD,CAAQ,CAAAE,iBAAA,qBAARF,CAAQ,CAAAG,eAAA,mBAARH,CAAQ,MAAAD,OAAA,CAAAC,QAAA,CAAAA,QAAA,IAMR,CAAAI,0BAA0B,uBAA1BA,CAA0B,QAA1B,CAAAA,CAA0B,CAAAC,OAAA,WAA1BD,CAA0B,CAAAE,KAAA,SAA1BF,CAA0B,CAAAG,IAAA,QAA1BH,CAA0B,CAAAI,MAAA,UAA1BJ,CAA0B,CAAAK,MAAA,UAA1BL,CAA0B,CAAAM,GAAA,OAA1BN,CAA0B,CAAAO,IAAA,QAA1BP,CAA0B,CAAAQ,EAAA,MAA1BR,CAA0B,CAAAS,OAAA,WAA1BT,CAA0B,CAAAU,OAAA,WAA1BV,CAA0B,MAAAL,OAAA,CAAAK,0BAAA,CAAAA,0BAAA,IAa1B,CAAAW,aAAa,uBAAbA,CAAa,QAAb,CAAAA,CAAa,CAAAC,SAAA,aAAbD,CAAa,CAAAE,WAAA,eAAbF,CAAa,CAAAG,SAAA,aAAbH,CAAa,MAAAhB,OAAA,CAAAgB,aAAA,CAAAA,aAAA,IAMb,CAAAI,eAAe,uBAAfA,CAAe,QAAf,CAAAA,CAAe,CAAAC,KAAA,SAAfD,CAAe,CAAAE,OAAA,WAAfF,CAAe,CAAAG,IAAA,QAAfH,CAAe,MAAApB,OAAA,CAAAoB,eAAA,CAAAA,eAAA,IAmCf,CAAAI,gBAAgB,uBAAhBA,CAAgB,QAAhB,CAAAA,CAAgB,CAAAC,KAAA,SAAhBD,CAAgB,CAAAE,MAAA,UAAhBF,CAAgB,CAAAG,MAAA,UAAhBH,CAAgB,CAAAL,SAAA,aAAhBK,CAAgB,CAAAI,OAAA,WAAhBJ,CAAgB,CAAAK,uBAAA,2BAAhBL,CAAgB,CAAAM,QAAA,YAAhBN,CAAgB,MAAAxB,OAAA,CAAAwB,gBAAA,CAAAA,gBAAA"}
1
+ {"version":3,"file":"types.js","names":["UpdateType","Polling","RealTime","Idle","exports","ExperimentType","CLASSIC","SERVER_SIDE","DEVELOPER","MVT","HYBRID","RuleType","PROGRESSIVE_DELIVERY","TARGETED_DELIVERY","EXPERIMENTATION","FeatureFlagSdkLanguageType","ANDROID","SWIFT","JAVA","CSHARP","NODEJS","PHP","RUBY","GO","FLUTTER","REACTJS","FeatureStatus","ACTIVATED","DEACTIVATED","SCHEDULED","CustomDataScope","Visit","Visitor","Page","ExperimentStatus","DRAFT","ACTIVE","PAUSED","STOPPED","USED_AS_PERSONALIZATION","DEVIATED"],"sources":["../../src/campaignConfiguration/types.ts"],"sourcesContent":["import { ClientSettingsType } from 'src/clientSettings';\nimport { IExternalEventSourceConstructor } from 'src/eventSource';\nimport { KameleoonData, KameleoonDataType } from 'src/kameleoonData';\nimport { Requester, GetClientConfigurationResultType } from 'src/requester';\nimport { ClientDataType, ExternalStorage, IStorage } from 'src/storage';\nimport { OfflineTracking } from 'src/storage/types';\nimport { SegmentType, TargetingDataType } from 'src/targeting';\nimport { VariableType } from 'src/types';\n\nexport type UpdateClientConfigurationParameters = {\n timeStamp?: number;\n useCache?: boolean;\n};\n\nexport type ScheduleType = {\n dateStart: string;\n dateEnd: string;\n};\n\nexport enum UpdateType {\n Polling,\n RealTime,\n Idle,\n}\n\nexport type JSONValue =\n | string\n | number\n | boolean\n | { [x: string]: JSONValue }\n | JSONValue[];\n\nexport type JSONType = Record<string | number | symbol, JSONValue> | null;\n\nexport enum ExperimentType {\n CLASSIC = 'CLASSIC',\n SERVER_SIDE = 'SERVER_SIDE',\n DEVELOPER = 'DEVELOPER',\n MVT = 'MVT',\n HYBRID = 'HYBRID',\n}\n\nexport enum RuleType {\n PROGRESSIVE_DELIVERY = 'PROGRESSIVE_DELIVERY',\n TARGETED_DELIVERY = 'TARGETED_DELIVERY',\n EXPERIMENTATION = 'EXPERIMENTATION',\n}\n\nexport enum FeatureFlagSdkLanguageType {\n ANDROID = 'ANDROID',\n SWIFT = 'SWIFT',\n JAVA = 'JAVA',\n CSHARP = 'CSHARP',\n NODEJS = 'NODEJS',\n PHP = 'PHP',\n RUBY = 'RUBY',\n GO = 'GO',\n FLUTTER = 'FLUTTER',\n REACTJS = 'REACTJS',\n}\n\nexport enum FeatureStatus {\n ACTIVATED = 'ACTIVATED',\n DEACTIVATED = 'DEACTIVATED',\n SCHEDULED = 'SCHEDULED',\n}\n\nexport enum CustomDataScope {\n Visit = 'VISIT',\n Visitor = 'VISITOR',\n Page = 'Page',\n}\n\nexport type ExperimentItemType = {\n id: string;\n name: string;\n type: ExperimentType;\n siteId: string;\n siteCode: string;\n status: ExperimentStatus;\n siteEnabled: boolean;\n variations: ExperimentVariationType[];\n deviations: DeviationType[];\n respoolTime: RespoolTimeType[];\n segment: SegmentType | null;\n};\n\nexport type ExperimentVariationType = {\n id: string;\n customJson: string;\n};\n\nexport type DeviationType = {\n variationId: string;\n value: number;\n};\n\nexport type RespoolTimeType = {\n variationId: string;\n value: number;\n};\n\nexport enum ExperimentStatus {\n DRAFT = 'DRAFT',\n ACTIVE = 'ACTIVE',\n PAUSED = 'PAUSED',\n SCHEDULED = 'SCHEDULED',\n STOPPED = 'STOPPED',\n USED_AS_PERSONALIZATION = 'USED_AS_PERSONALIZATION',\n DEVIATED = 'DEVIATED',\n}\n\nexport type FeatureFlagType = {\n id: number;\n featureKey: string;\n variations: FeatureVariationType[];\n defaultVariationKey: string;\n rules: RuleItemType[];\n};\n\nexport type FeatureVariationType = {\n key: string;\n variables: FeatureVariableType[];\n};\n\nexport type FeatureVariableType = {\n key: string;\n type: VariableType;\n value: string | number | boolean;\n};\n\nexport type RuleItemType = {\n type: RuleType;\n id: number;\n respoolTime: number | null;\n order: number;\n exposition: number;\n experimentId: number;\n variationByExposition: VariationByExpositionType[];\n segment: SegmentType | null;\n};\n\nexport type VariationByExpositionType = {\n variationKey: string;\n variationId: number | null;\n exposition: number;\n};\n\nexport type ConfigurationDataType = {\n experiments: ExperimentItemType[];\n featureFlags: FeatureFlagType[];\n configuration: ConfigurationType;\n customData: CustomDataConfigurationType[];\n};\n\nexport type CustomDataConfigurationType = {\n index: number;\n localOnly: boolean;\n scope: CustomDataScope;\n};\n\nexport type ConfigurationType = {\n realTimeUpdate: boolean;\n};\n\nexport type CampaignConfigurationType = {\n targetingData: TargetingDataType;\n configurationData: ConfigurationDataType;\n};\n\nexport type UnsentVisitorTargetingDataType = Map<\n KameleoonData | number,\n KameleoonDataType\n>;\n\nexport type UnsentTargetingDataType = {\n [visitorCode: string]: UnsentVisitorTargetingDataType | undefined;\n};\n\nexport type CampaignConfigurationParametersType = {\n settings: ClientSettingsType;\n storage: IStorage<ClientDataType>;\n requester: Requester;\n offlineTrackingStorage: ExternalStorage<OfflineTracking>;\n externalClientConfiguration?: GetClientConfigurationResultType;\n externalEventSource: IExternalEventSourceConstructor;\n targetingCleanupInterval?: number;\n};\n"],"mappings":"mPAmBY,CAAAA,UAAU,uBAAVA,CAAU,QAAV,CAAAA,CAAU,CAAVA,CAAU,CAAAC,OAAA,cAAVD,CAAU,CAAVA,CAAU,CAAAE,QAAA,eAAVF,CAAU,CAAVA,CAAU,CAAAG,IAAA,WAAVH,CAAU,MAAAI,OAAA,CAAAJ,UAAA,CAAAA,UAAA,IAeV,CAAAK,cAAc,uBAAdA,CAAc,QAAd,CAAAA,CAAc,CAAAC,OAAA,WAAdD,CAAc,CAAAE,WAAA,eAAdF,CAAc,CAAAG,SAAA,aAAdH,CAAc,CAAAI,GAAA,OAAdJ,CAAc,CAAAK,MAAA,UAAdL,CAAc,MAAAD,OAAA,CAAAC,cAAA,CAAAA,cAAA,IAQd,CAAAM,QAAQ,uBAARA,CAAQ,QAAR,CAAAA,CAAQ,CAAAC,oBAAA,wBAARD,CAAQ,CAAAE,iBAAA,qBAARF,CAAQ,CAAAG,eAAA,mBAARH,CAAQ,MAAAP,OAAA,CAAAO,QAAA,CAAAA,QAAA,IAMR,CAAAI,0BAA0B,uBAA1BA,CAA0B,QAA1B,CAAAA,CAA0B,CAAAC,OAAA,WAA1BD,CAA0B,CAAAE,KAAA,SAA1BF,CAA0B,CAAAG,IAAA,QAA1BH,CAA0B,CAAAI,MAAA,UAA1BJ,CAA0B,CAAAK,MAAA,UAA1BL,CAA0B,CAAAM,GAAA,OAA1BN,CAA0B,CAAAO,IAAA,QAA1BP,CAA0B,CAAAQ,EAAA,MAA1BR,CAA0B,CAAAS,OAAA,WAA1BT,CAA0B,CAAAU,OAAA,WAA1BV,CAA0B,MAAAX,OAAA,CAAAW,0BAAA,CAAAA,0BAAA,IAa1B,CAAAW,aAAa,uBAAbA,CAAa,QAAb,CAAAA,CAAa,CAAAC,SAAA,aAAbD,CAAa,CAAAE,WAAA,eAAbF,CAAa,CAAAG,SAAA,aAAbH,CAAa,MAAAtB,OAAA,CAAAsB,aAAA,CAAAA,aAAA,IAMb,CAAAI,eAAe,uBAAfA,CAAe,QAAf,CAAAA,CAAe,CAAAC,KAAA,SAAfD,CAAe,CAAAE,OAAA,WAAfF,CAAe,CAAAG,IAAA,QAAfH,CAAe,MAAA1B,OAAA,CAAA0B,eAAA,CAAAA,eAAA,IAmCf,CAAAI,gBAAgB,uBAAhBA,CAAgB,QAAhB,CAAAA,CAAgB,CAAAC,KAAA,SAAhBD,CAAgB,CAAAE,MAAA,UAAhBF,CAAgB,CAAAG,MAAA,UAAhBH,CAAgB,CAAAL,SAAA,aAAhBK,CAAgB,CAAAI,OAAA,WAAhBJ,CAAgB,CAAAK,uBAAA,2BAAhBL,CAAgB,CAAAM,QAAA,YAAhBN,CAAgB,MAAA9B,OAAA,CAAA8B,gBAAA,CAAAA,gBAAA"}
@@ -17,7 +17,7 @@ export declare enum Cookie {
17
17
  * */
18
18
  export declare enum SdkLanguageType {
19
19
  ANDROID = "ANDROID",
20
- SWIFT = "SWIFT",
20
+ IOS = "IOS",
21
21
  JAVA = "JAVA",
22
22
  CSHARP = "CSHARP",
23
23
  NODEJS = "NODEJS",
package/dist/constants.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.VISITOR_CODE_LENGTH=exports.UNALLOCATED_VARIATION_ID=exports.SdkLanguageType=exports.OFF_VARIATION_KEY=exports.KAMELEOON_COOKIE_KEY=exports.Cookie=exports.CACHE_ITEM_LIFETIME=exports.CACHE_CLEANUP_TIMEOUT=void 0;var UNALLOCATED_VARIATION_ID=0;exports.UNALLOCATED_VARIATION_ID=0;var OFF_VARIATION_KEY="off";exports.OFF_VARIATION_KEY="off";var KAMELEOON_COOKIE_KEY="kameleoonVisitorCode";exports.KAMELEOON_COOKIE_KEY="kameleoonVisitorCode";var VISITOR_CODE_LENGTH=16;exports.VISITOR_CODE_LENGTH=16;var CACHE_CLEANUP_TIMEOUT=10;exports.CACHE_CLEANUP_TIMEOUT=10;var CACHE_ITEM_LIFETIME=5;exports.CACHE_ITEM_LIFETIME=5;var Cookie=/*#__PURE__*/function(a){return a.PairsDelimiter="; ",a.KeyValueDelimiter="=",a.MaxAge="Max-Age",a.Path="Path",a.Domain="Domain",a}({});/**
2
2
  * @readonly
3
3
  * @enum {string} an Enum of all the possible Kameleoon SDK types
4
- * */exports.Cookie=Cookie;var SdkLanguageType=/*#__PURE__*/function(a){return a.ANDROID="ANDROID",a.SWIFT="SWIFT",a.JAVA="JAVA",a.CSHARP="CSHARP",a.NODEJS="NODEJS",a.PHP="PHP",a.RUBY="RUBY",a.GO="GO",a.FLUTTER="FLUTTER",a.REACT="REACT",a.PYTHON="PYTHON",a.JAVASCRIPT="JAVASCRIPT",a.RUST="RUST",a}({});exports.SdkLanguageType=SdkLanguageType;
4
+ * */exports.Cookie=Cookie;var SdkLanguageType=/*#__PURE__*/function(a){return a.ANDROID="ANDROID",a.IOS="IOS",a.JAVA="JAVA",a.CSHARP="CSHARP",a.NODEJS="NODEJS",a.PHP="PHP",a.RUBY="RUBY",a.GO="GO",a.FLUTTER="FLUTTER",a.REACT="REACT",a.PYTHON="PYTHON",a.JAVASCRIPT="JAVASCRIPT",a.RUST="RUST",a}({});exports.SdkLanguageType=SdkLanguageType;
5
5
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["UNALLOCATED_VARIATION_ID","exports","OFF_VARIATION_KEY","KAMELEOON_COOKIE_KEY","VISITOR_CODE_LENGTH","CACHE_CLEANUP_TIMEOUT","CACHE_ITEM_LIFETIME","Cookie","PairsDelimiter","KeyValueDelimiter","MaxAge","Path","Domain","SdkLanguageType","ANDROID","SWIFT","JAVA","CSHARP","NODEJS","PHP","RUBY","GO","FLUTTER","REACT","PYTHON","JAVASCRIPT","RUST"],"sources":["../src/constants.ts"],"sourcesContent":["export const UNALLOCATED_VARIATION_ID = 0;\nexport const OFF_VARIATION_KEY = 'off';\nexport const KAMELEOON_COOKIE_KEY = 'kameleoonVisitorCode';\nexport const VISITOR_CODE_LENGTH = 16;\nexport const CACHE_CLEANUP_TIMEOUT = 10;\nexport const CACHE_ITEM_LIFETIME = 5;\n\nexport enum Cookie {\n PairsDelimiter = '; ',\n KeyValueDelimiter = '=',\n MaxAge = 'Max-Age',\n Path = 'Path',\n Domain = 'Domain',\n}\n\n/**\n * @readonly\n * @enum {string} an Enum of all the possible Kameleoon SDK types\n * */\nexport enum SdkLanguageType {\n ANDROID = 'ANDROID',\n SWIFT = 'SWIFT',\n JAVA = 'JAVA',\n CSHARP = 'CSHARP',\n NODEJS = 'NODEJS',\n PHP = 'PHP',\n RUBY = 'RUBY',\n GO = 'GO',\n FLUTTER = 'FLUTTER',\n REACT = 'REACT',\n PYTHON = 'PYTHON',\n JAVASCRIPT = 'JAVASCRIPT',\n RUST = 'RUST',\n}\n"],"mappings":"gSAAO,GAAM,CAAAA,wBAAwB,CAAG,CAAC,CAACC,OAAA,CAAAD,wBAAA,GACnC,GAAM,CAAAE,iBAAiB,CAAG,KAAK,CAACD,OAAA,CAAAC,iBAAA,OAChC,GAAM,CAAAC,oBAAoB,CAAG,sBAAsB,CAACF,OAAA,CAAAE,oBAAA,wBACpD,GAAM,CAAAC,mBAAmB,CAAG,EAAE,CAACH,OAAA,CAAAG,mBAAA,IAC/B,GAAM,CAAAC,qBAAqB,CAAG,EAAE,CAACJ,OAAA,CAAAI,qBAAA,IACjC,GAAM,CAAAC,mBAAmB,CAAG,CAAC,CAACL,OAAA,CAAAK,mBAAA,MAEzB,CAAAC,MAAM,uBAANA,CAAM,QAAN,CAAAA,CAAM,CAAAC,cAAA,MAAND,CAAM,CAAAE,iBAAA,KAANF,CAAM,CAAAG,MAAA,WAANH,CAAM,CAAAI,IAAA,QAANJ,CAAM,CAAAK,MAAA,UAANL,CAAM,MAQlB;AACA;AACA;AACA,KAHAN,OAAA,CAAAM,MAAA,CAAAA,MAAA,IAIY,CAAAM,eAAe,uBAAfA,CAAe,QAAf,CAAAA,CAAe,CAAAC,OAAA,WAAfD,CAAe,CAAAE,KAAA,SAAfF,CAAe,CAAAG,IAAA,QAAfH,CAAe,CAAAI,MAAA,UAAfJ,CAAe,CAAAK,MAAA,UAAfL,CAAe,CAAAM,GAAA,OAAfN,CAAe,CAAAO,IAAA,QAAfP,CAAe,CAAAQ,EAAA,MAAfR,CAAe,CAAAS,OAAA,WAAfT,CAAe,CAAAU,KAAA,SAAfV,CAAe,CAAAW,MAAA,UAAfX,CAAe,CAAAY,UAAA,cAAfZ,CAAe,CAAAa,IAAA,QAAfb,CAAe,MAAAZ,OAAA,CAAAY,eAAA,CAAAA,eAAA"}
1
+ {"version":3,"file":"constants.js","names":["UNALLOCATED_VARIATION_ID","exports","OFF_VARIATION_KEY","KAMELEOON_COOKIE_KEY","VISITOR_CODE_LENGTH","CACHE_CLEANUP_TIMEOUT","CACHE_ITEM_LIFETIME","Cookie","PairsDelimiter","KeyValueDelimiter","MaxAge","Path","Domain","SdkLanguageType","ANDROID","IOS","JAVA","CSHARP","NODEJS","PHP","RUBY","GO","FLUTTER","REACT","PYTHON","JAVASCRIPT","RUST"],"sources":["../src/constants.ts"],"sourcesContent":["export const UNALLOCATED_VARIATION_ID = 0;\nexport const OFF_VARIATION_KEY = 'off';\nexport const KAMELEOON_COOKIE_KEY = 'kameleoonVisitorCode';\nexport const VISITOR_CODE_LENGTH = 16;\nexport const CACHE_CLEANUP_TIMEOUT = 10;\nexport const CACHE_ITEM_LIFETIME = 5;\n\nexport enum Cookie {\n PairsDelimiter = '; ',\n KeyValueDelimiter = '=',\n MaxAge = 'Max-Age',\n Path = 'Path',\n Domain = 'Domain',\n}\n\n/**\n * @readonly\n * @enum {string} an Enum of all the possible Kameleoon SDK types\n * */\nexport enum SdkLanguageType {\n ANDROID = 'ANDROID',\n IOS = 'IOS',\n JAVA = 'JAVA',\n CSHARP = 'CSHARP',\n NODEJS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AAAY,eAAA,CAAAA,eAAA"}
@@ -225,7 +225,6 @@ export declare class KameleoonClient implements IKameleoonClient {
225
225
  private offlineTrackingStorage;
226
226
  private trackingCache;
227
227
  private requester;
228
- private externalEventSource;
229
228
  private externalPackageInfo;
230
229
  private isOfflineModeOn?;
231
230
  /**
@@ -4,7 +4,7 @@
4
4
  * for communicating with Kameleoon JavaScript SDK Core, when new instance is created
5
5
  */var KameleoonClient=/*#__PURE__*/function(){/**
6
6
  * @param {SDKCoreParameters} sdkCoreParameters - parameters for initializing sdk core
7
- */function a(b){var c=b.siteCode,d=b.configuration,e=b.internalConfiguration;_classCallCheck(this,a),_defineProperty(this,"variationConfiguration",void 0),_defineProperty(this,"campaignConfiguration",void 0),_defineProperty(this,"variationDataStorage",void 0),_defineProperty(this,"offlineTrackingStorage",void 0),_defineProperty(this,"trackingCache",void 0),_defineProperty(this,"requester",void 0),_defineProperty(this,"externalEventSource",void 0),_defineProperty(this,"externalPackageInfo",void 0),_defineProperty(this,"isOfflineModeOn",void 0);var f=new _clientSettings.ClientSettings(c,d),g=f.settings,h=e.externalStorage,i=e.externalEventSource,j=e.externalPackageInfo,k=e.externalRequestDispatcher,l=e.externalClientConfiguration,m=new _requester.Requester({siteCode:c,environment:g.environment,packageInfo:j,requestDispatcher:k}),n=new _cacheManager.CacheManager(_constants.CACHE_CLEANUP_TIMEOUT),o=new _externalStorage.ExternalStorage(h.initialize(_storage.KameleoonStorageKey.ClientData)),p=new _externalStorage.ExternalStorage(h.initialize(_storage.KameleoonStorageKey.VariationData)),q=new _externalStorage.ExternalStorage(h.initialize(_storage.KameleoonStorageKey.OfflineTracking)),r=new _campaignConfiguration.CampaignConfiguration({settings:g,storage:o,requester:m,externalClientConfiguration:l,targetingCleanupInterval:null===d||void 0===d?void 0:d.targetingDataCleanupInterval,offlineTrackingStorage:q});this.requester=m,this.trackingCache=n,this.campaignConfiguration=r,this.variationDataStorage=p,this.externalEventSource=i,this.externalPackageInfo=j,this.offlineTrackingStorage=q}return _createClass(a,[{key:"initialize",value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d;return _regeneratorRuntime().wrap(function e(b){for(;1;)switch(b.prev=b.next){case 0:return b.next=2,this.campaignConfiguration.initialize(this.externalEventSource,a);case 2:return c=b.sent,c.throw(),d=new _variationConfiguration.VariationConfiguration(this.campaignConfiguration.experiments,this.variationDataStorage),this.variationConfiguration=d,this.isOfflineModeOn=a,b.abrupt("return",c.ok);case 8:case"end":return b.stop();}},b,this)}));return a}()},{key:"addData",value:function addData(a){var b;if(_utilities.Utilities.validateVisitorCode(a).throw(),!this.campaignConfiguration)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);for(var c=arguments.length,d=Array(1<c?c-1:0),e=1;e<c;e++)d[e-1]=arguments[e];(b=this.campaignConfiguration).addTargetingData.apply(b,[a].concat(d)).throw()}},{key:"getRemoteVisitorData",value:function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d,e,f,g,h,i,j=arguments;return _regeneratorRuntime().wrap(function k(b){for(;1;)switch(b.prev=b.next){case 0:return c=!(1<j.length&&void 0!==j[1])||j[1],b.next=3,this.requester.getVisitorData(a);case 3:d=b.sent,e=d.throw(),f=_utilities.Utilities.parseVisitorData(e),g=_createForOfIteratorHelper(f);try{for(g.s();!(h=g.n()).done;)i=h.value,(c||this.campaignConfiguration.isPersistentCustomData(i))&&this.addData(a,i)}catch(a){g.e(a)}finally{g.f()}return b.abrupt("return",f);case 9:case"end":return b.stop();}},b,this)}));return a}()},{key:"triggerExperiment",value:function triggerExperiment(a,b){var c=this;if(_utilities.Utilities.validateVisitorCode(a).throw(),!this.campaignConfiguration||!this.variationConfiguration)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);var d=this.campaignConfiguration.experiments.find(function(a){return a.id===b+""});if(!d)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.ExperimentConfigurationNotFound,b,a);var e=this.campaignConfiguration.storedTargetingData[a],f=_constants.UNALLOCATED_VARIATION_ID,g=_utilities.Utilities.checkTargeting({visitorCode:a,experimentId:b,targetingData:e,segment:d.segment,campaignConfiguration:this.campaignConfiguration,variationConfiguration:this.variationConfiguration,packageInfo:this.externalPackageInfo}).throw();if(f=this.variationConfiguration.getAssociatedVariationId(a,b).else(function(d){if(d.type===_kameleoonError.KameleoonException.NotAllocated)return _utilities.Utilities.trackExperiment({requester:c.requester,campaignConfiguration:c.campaignConfiguration,isUnallocated:!0,variationId:f,visitorCode:a,experimentId:b,isOfflineModeOn:c.isOfflineModeOn,offlineTrackingStorage:c.offlineTrackingStorage}),_constants.UNALLOCATED_VARIATION_ID;throw d}),_utilities.Utilities.trackExperiment({requester:this.requester,campaignConfiguration:this.campaignConfiguration,isUnallocated:!1,variationId:f,visitorCode:a,experimentId:b,isOfflineModeOn:this.isOfflineModeOn,offlineTrackingStorage:this.offlineTrackingStorage}),!g)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.NotTargeted,a);return _utilities.Utilities.updateCache({cacheManager:this.trackingCache,visitorCode:a,experimentId:b,variationId:f}),f}},{key:"trackConversion",value:function trackConversion(a){var b=a.visitorCode,c=a.goalId,d=a.revenue;this.addData(b,new _kameleoonData.Conversion({goalId:c,revenue:d})),this.flush(b)}},{key:"flush",value:function flush(a){if(!this.campaignConfiguration)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);if("string"==typeof a&&_utilities.Utilities.validateVisitorCode(a).throw(),a)return void _utilities.Utilities.trackData({visitorCode:a,campaignConfiguration:this.campaignConfiguration,requester:this.requester,isOfflineModeOn:this.isOfflineModeOn,offlineTrackingStorage:this.offlineTrackingStorage});// --- Note ---
7
+ */function a(b){var c=b.siteCode,d=b.configuration,e=b.internalConfiguration;_classCallCheck(this,a),_defineProperty(this,"variationConfiguration",void 0),_defineProperty(this,"campaignConfiguration",void 0),_defineProperty(this,"variationDataStorage",void 0),_defineProperty(this,"offlineTrackingStorage",void 0),_defineProperty(this,"trackingCache",void 0),_defineProperty(this,"requester",void 0),_defineProperty(this,"externalPackageInfo",void 0),_defineProperty(this,"isOfflineModeOn",void 0);var f=new _clientSettings.ClientSettings(c,d),g=f.settings,h=e.externalStorage,i=e.externalEventSource,j=e.externalPackageInfo,k=e.externalRequestDispatcher,l=e.externalClientConfiguration,m=new _requester.Requester({siteCode:c,environment:g.environment,packageInfo:j,requestDispatcher:k}),n=new _cacheManager.CacheManager(_constants.CACHE_CLEANUP_TIMEOUT),o=new _externalStorage.ExternalStorage(h.initialize(_storage.KameleoonStorageKey.ClientData)),p=new _externalStorage.ExternalStorage(h.initialize(_storage.KameleoonStorageKey.VariationData)),q=new _externalStorage.ExternalStorage(h.initialize(_storage.KameleoonStorageKey.OfflineTracking)),r=new _campaignConfiguration.CampaignConfiguration({settings:g,storage:o,requester:m,externalClientConfiguration:l,targetingCleanupInterval:null===d||void 0===d?void 0:d.targetingDataCleanupInterval,offlineTrackingStorage:q,externalEventSource:i});this.requester=m,this.trackingCache=n,this.campaignConfiguration=r,this.variationDataStorage=p,this.externalPackageInfo=j,this.offlineTrackingStorage=q}return _createClass(a,[{key:"initialize",value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d;return _regeneratorRuntime().wrap(function e(b){for(;1;)switch(b.prev=b.next){case 0:return b.next=2,this.campaignConfiguration.initialize(a);case 2:return c=b.sent,c.throw(),d=new _variationConfiguration.VariationConfiguration(this.campaignConfiguration.experiments,this.variationDataStorage),this.variationConfiguration=d,this.isOfflineModeOn=a,b.abrupt("return",c.ok);case 8:case"end":return b.stop();}},b,this)}));return a}()},{key:"addData",value:function addData(a){var b;if(_utilities.Utilities.validateVisitorCode(a).throw(),!this.campaignConfiguration)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);for(var c=arguments.length,d=Array(1<c?c-1:0),e=1;e<c;e++)d[e-1]=arguments[e];(b=this.campaignConfiguration).addTargetingData.apply(b,[a].concat(d)).throw()}},{key:"getRemoteVisitorData",value:function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d,e,f,g,h,i,j=arguments;return _regeneratorRuntime().wrap(function k(b){for(;1;)switch(b.prev=b.next){case 0:return c=!(1<j.length&&void 0!==j[1])||j[1],b.next=3,this.requester.getVisitorData(a);case 3:d=b.sent,e=d.throw(),f=_utilities.Utilities.parseVisitorData(e),g=_createForOfIteratorHelper(f);try{for(g.s();!(h=g.n()).done;)i=h.value,(c||this.campaignConfiguration.isPersistentCustomData(i))&&this.addData(a,i)}catch(a){g.e(a)}finally{g.f()}return b.abrupt("return",f);case 9:case"end":return b.stop();}},b,this)}));return a}()},{key:"triggerExperiment",value:function triggerExperiment(a,b){var c=this;if(_utilities.Utilities.validateVisitorCode(a).throw(),!this.campaignConfiguration||!this.variationConfiguration)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);var d=this.campaignConfiguration.experiments.find(function(a){return a.id===b+""});if(!d)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.ExperimentConfigurationNotFound,b,a);var e=this.campaignConfiguration.storedTargetingData[a],f=_constants.UNALLOCATED_VARIATION_ID,g=_utilities.Utilities.checkTargeting({visitorCode:a,experimentId:b,targetingData:e,segment:d.segment,campaignConfiguration:this.campaignConfiguration,variationConfiguration:this.variationConfiguration,packageInfo:this.externalPackageInfo}).throw();if(f=this.variationConfiguration.getAssociatedVariationId(a,b).else(function(d){if(d.type===_kameleoonError.KameleoonException.NotAllocated)return _utilities.Utilities.trackExperiment({requester:c.requester,campaignConfiguration:c.campaignConfiguration,isUnallocated:!0,variationId:f,visitorCode:a,experimentId:b,isOfflineModeOn:c.isOfflineModeOn,offlineTrackingStorage:c.offlineTrackingStorage}),_constants.UNALLOCATED_VARIATION_ID;throw d}),_utilities.Utilities.trackExperiment({requester:this.requester,campaignConfiguration:this.campaignConfiguration,isUnallocated:!1,variationId:f,visitorCode:a,experimentId:b,isOfflineModeOn:this.isOfflineModeOn,offlineTrackingStorage:this.offlineTrackingStorage}),!g)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.NotTargeted,a);return _utilities.Utilities.updateCache({cacheManager:this.trackingCache,visitorCode:a,experimentId:b,variationId:f}),f}},{key:"trackConversion",value:function trackConversion(a){var b=a.visitorCode,c=a.goalId,d=a.revenue;this.addData(b,new _kameleoonData.Conversion({goalId:c,revenue:d})),this.flush(b)}},{key:"flush",value:function flush(a){if(!this.campaignConfiguration)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);if("string"==typeof a&&_utilities.Utilities.validateVisitorCode(a).throw(),a)return void _utilities.Utilities.trackData({visitorCode:a,campaignConfiguration:this.campaignConfiguration,requester:this.requester,isOfflineModeOn:this.isOfflineModeOn,offlineTrackingStorage:this.offlineTrackingStorage});// --- Note ---
8
8
  // `Utilities.trackData` executes `Utilities.sendOfflineTracking` asynchronously at first, but
9
9
  // we need to execute `Utilities.sendOfflineTracking` even if calling `Utilities.trackData` is skipped
10
10
  // due to lack of unsent data
@@ -1 +1 @@
1
- {"version":3,"file":"kameleoonClient.js","names":["a","b","c","Object","defineProperty","value","enumerable","configurable","writable","e","f","prototype","d","g","create","h","m","s","i","type","arg","call","forEach","_invoke","j","k","_typeof","r","resolve","__await","then","Error","o","method","delegate","x","sent","_sent","dispatchException","abrupt","done","iterator","return","TypeError","resultName","next","nextLoc","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","l","completion","reset","n","u","isNaN","length","_regeneratorRuntime","p","q","hasOwnProperty","t","Symbol","v","asyncIterator","w","toStringTag","wrap","y","z","getPrototypeOf","A","B","displayName","isGeneratorFunction","constructor","name","mark","setPrototypeOf","__proto__","awrap","AsyncIterator","async","Promise","keys","reverse","pop","values","prev","charAt","slice","stop","rval","complete","finish","catch","_catch","delegateYield","asyncGeneratorStep","_asyncToGenerator","arguments","apply","_classCallCheck","_defineProperties","_toPropertyKey","key","_createClass","_defineProperty","_toPrimitive","toPrimitive","String","Number","KameleoonClient","siteCode","configuration","internalConfiguration","ClientSettings","clientSettings","settings","externalStorage","externalEventSource","externalPackageInfo","externalRequestDispatcher","externalClientConfiguration","requester","Requester","environment","packageInfo","requestDispatcher","trackingCache","CacheManager","CACHE_CLEANUP_TIMEOUT","clientDataStorage","ExternalStorage","initialize","KameleoonStorageKey","ClientData","variationDataStorage","VariationData","offlineTrackingStorage","OfflineTracking","campaignConfiguration","CampaignConfiguration","storage","targetingCleanupInterval","targetingDataCleanupInterval","useCache","result","throw","variationConfiguration","VariationConfiguration","experiments","isOfflineModeOn","ok","addData","visitorCode","Utilities","validateVisitorCode","KameleoonError","KameleoonException","Initialization","data","Array","addTargetingData","concat","shouldAddData","getVisitorData","visitorData","parseVisitorData","_createForOfIteratorHelper","dataItem","isPersistentCustomData","triggerExperiment","experimentId","experiment","find","item","id","ExperimentConfigurationNotFound","targetingData","storedTargetingData","variationId","UNALLOCATED_VARIATION_ID","targetingResult","checkTargeting","segment","getAssociatedVariationId","else","error","NotAllocated","trackExperiment","isUnallocated","NotTargeted","updateCache","cacheManager","trackConversion","goalId","revenue","Conversion","flush","trackData","unsentDataVisitors","sendOfflineTracking","visitorCodeKey","flushData","getExperiments","map","getVisitorExperiments","isActive","experimentVariations","getAssignedVariations","experimentVariation","variationResult","getExperimentVariation","getExperimentVariationData","variation","variations","JSON","parse","customJson","err","JSONParse","VariationNotFound","getFeatureFlags","featureFlags","featureKey","getVisitorFeatureFlags","resultFeatureFlags","featureFlag","variationData","getFeatureFlagVariation","variationKey","OFF_VARIATION_KEY","featureFlagId","getFeatureFlagVariationKey","_getFeatureFlagVariation","getFeatureFlagVariable","variableKey","FeatureFlagConfigurationNotFound","variable","variables","FeatureFlagVariableNotFound","featureVariable","parseFeatureVariable","isFeatureFlagActive","getRemoteData","remoteData","onConfigurationUpdate","callback","getEngineTrackingCode","getTrackingCode","Err","withAssignment","trackRule","featureFlagVariation","Ok","exports"],"sources":["../src/kameleoonClient.ts"],"sourcesContent":["import { Err, Ok, Result } from 'ts-res';\nimport { CacheManager } from './cacheManager';\nimport { CampaignConfiguration, JSONType } from './campaignConfiguration';\nimport { ClientSettings } from './clientSettings';\nimport {\n CACHE_CLEANUP_TIMEOUT,\n OFF_VARIATION_KEY,\n UNALLOCATED_VARIATION_ID,\n} from './constants';\nimport { IExternalEventSourceConstructor } from './eventSource';\nimport { Conversion, KameleoonDataType } from './kameleoonData';\nimport { KameleoonError, KameleoonException } from './kameleoonError';\nimport { Requester } from './requester';\nimport {\n ClientDataType,\n KameleoonStorageKey,\n VariationDataType,\n} from './storage';\nimport { ExternalStorage } from './storage/externalStorage';\nimport {\n TrackConversionParamsType,\n ExperimentType,\n FeatureFlagType,\n GetFeatureFlagVariableParamsType,\n FeatureVariableResultType,\n SDKCoreParameters,\n TrackingCacheItemType,\n ExternalPackageInfoType,\n} from './types';\nimport { Utilities } from './utilities';\nimport {\n FeatureFlagVariationType,\n VariationConfiguration,\n} from './variationConfiguration';\nimport { OfflineTracking } from './storage/types';\n\n/**\n * @interface an interface of KameleoonClient instance\n */\nexport interface IKameleoonClient {\n /**\n * @method initialize - an asynchronous method for KameleoonClient initialization by fetching Kameleoon SDK related data from server or by retrieving data from local source if data is up-to-date or update interval has not been reached\n * @param {boolean | undefined} useCache - optional parameter for activating SDK offline mode, if `true` is passed failed polls will not return error and will use cached data if such data is available, default value is `false`. Note: if offline mode is on, SDK will still try to retrieve the latest data.\n * @returns {Promise<boolean>} Promise resolved into boolean field indicating success or fail\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.StorageWrite` Couldn't update storage data\n * - `KameleoonException.ClientConfiguration` Couldn't retrieve client configuration from Kameleoon Api\n * - `KameleoonException.MaximumRetriesReached` Maximum retries reached, request failed\n */\n initialize(useCache?: boolean): Promise<boolean>;\n initialize(): Promise<boolean>;\n /**\n * @method addData - method for adding targeting data to the storage so that other methods could decide whether the current visitor is targeted or not. Note: userAgent data will not be stored in storage like other data, and it will be sent with every tracking request for bot filtration.\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {KameleoonDataType[]} kameleoonData - number of instances of any type of `KameleoonData`, can be added solely in array or as a sequential arguments\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.StorageWrite` Couldn't update storage data\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n */\n addData: (visitorCode: string, ...data: KameleoonDataType[]) => void;\n /**\n * @method getRemoteVisitorData - an asynchronous method for retrieving custom data for the latest visit of `visitorCode` from Kameleoon Data API and optionally adding it to the storage so that other methods could decide whether the current visitor is targeted or not.\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {boolean | undefined} shouldAddData - optional parameter for adding retrieved data to the storage like `addData` method does, default value is `true`\n * @returns {KameleoonDataType[]} promise resolved to an array of `KameleoonData` instances, only includes custom data\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server\n */\n getRemoteVisitorData: (\n visitorCode: string,\n shouldAddData?: boolean,\n ) => Promise<KameleoonDataType[]>;\n /**\n * @method triggerExperiment - triggers experiment by assigning the variation to the user with `visitorCode`, if the variation is already assigned just returns it's id. Note: returned id `0` indicates default variation. At the same time sends tracking request.\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {number} experimentId - id of experiment running for the current visitor\n * @returns {number} associated variationId which is successfully searched/assigned\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.ExperimentConfigurationNotFound` No configuration found for provided `experimentId`\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.StorageRead` Couldn't find associated experiment by provided `experimentId` and `visitorCode` inside the storage\n * - `KameleoonException.NotTargeted` Current visitor is not targeted\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n */\n triggerExperiment: (visitorCode: string, experimentId: number) => number;\n /**\n * @method trackConversion - creates and adds `Conversion` data to the visitor with specified parameters and executes `flush`. Note: it's a helper method for the quick and convenient conversion tracking, however creating and adding `Conversion` manually allows more flexible `Conversion` with `negative` parameter\n * @param {TrackConversionParamsType} conversionParameters - `visitorCode`, `goalId` and `revenue` parameters for data tracking\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.StorageWrite` Couldn't update storage data\n */\n trackConversion: ({\n visitorCode,\n goalId,\n revenue,\n }: TrackConversionParamsType) => void;\n /**\n * @method flush - takes visitor associated kameleoon data and sends the data tracking request with collected data,\n * sent data is removed from `KameleoonClient` instance but not from the storage for correct targeting checks. If no visitor is passed,\n * then data for all visitors is sent and removed from `KameleoonClient` instance. Moreover, regardless of visitor code input\n * the method first attemps to send all previously failed tracking requests which were stored locally during the offline mode.\n * @param {string | undefined} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n */\n flush: (visitorCode: string) => void;\n /**\n * @deprecated Use flush method instead.\n */\n flushData: (visitorCode: string) => void;\n /**\n * @method getExperiments - returns a list of experiments stored in the client configuration\n * @returns {ExperimentType[]} a list of all experiments items with `id` and `name` fields\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n */\n getExperiments: () => ExperimentType[];\n /**\n * @method getVisitorExperiments - returns a list of experiments that the visitor with `visitorCode` is targeted by and that are *active* for the visitor (visitor will have one of the variations allocated if the experiment will be triggered).\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {boolean | undefined} isAllocated - boolean value indicating that only experiments *allocated* for visitor will be returned. Default value is `true`\n * @returns {ExperimentType[]} a list of all experiments items with `id` and `name` fields\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n */\n getVisitorExperiments: (\n visitorCode: string,\n isAllocated?: boolean,\n ) => ExperimentType[];\n /**\n * @method getExperimentVariationData - returns variation data in JSON format for the variation with `variationId`\n * @param {number} variationId - id of variation\n * @returns {JSONType} variation data in JSON format\n * @throws `KameleoonError` with one of the following `type` s:\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n * - `KameleoonException.JSONParse` - Couldn't pass JSON value\n * - `KameleoonException.VariationNotFound` - No variation found for provided `variationId`\n */\n getExperimentVariationData: (variationId: number) => JSONType | null;\n /**\n * @method getFeatureFlags - returns a list of feature flags stored in the client configuration\n * @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n */\n getFeatureFlags: () => FeatureFlagType[];\n /**\n * @method getVisitorFeatureFlags - returns a list of feature flags that the visitor with `visitorCode` that is targeted by and that are *active* for the visitor (visitor will have one of the variations allocated).\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n */\n getVisitorFeatureFlags: (visitorCode: string) => FeatureFlagType[];\n /**\n * @method isFeatureFlagActive - returns a boolean indicating whether the visitor with `visitorCode` has `featureKey` active for him, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {string} featureKey - a unique key for feature flag\n * @returns {boolean} a boolean indicator of whether the feature flag with `featureKey` is active for visitor with `visitorCode`\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`\n * - `KameleoonException.DataInconsistency` - Allocated variation was found but there is no feature flag with according `featureKey`.\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n */\n isFeatureFlagActive: (visitorCode: string, featureKey: string) => boolean;\n /**\n * @method getFeatureFlagVariationKey - returns variation key for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {string} featureKey - a unique key for feature flag\n * @returns {string} a string containing variable key for the allocated feature flag variation for the provided visitor\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n */\n getFeatureFlagVariationKey: (\n visitorCode: string,\n featureKey: string,\n ) => string;\n /**\n * @method getFeatureFlagVariable - returns a variable for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request\n * @param {GetFeatureFlagVariableParamsType} parameters - an object with parameters of a type `GetFeatureFlagVariableParamsType`, see the type for details.\n * @returns {FeatureVariableResultType} a variable object containing `type` and `value` fields, `type` can be checked against `FeatureVariableType` enum, if the `type` is `FeatureVariableType.BOOLEAN` then the `value` type will be `boolean` and so on.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`\n * - `KameleoonException.FeatureFlagVariableNotFound` - No feature variable was found for provided `visitorCode` and `variableKey`\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n * - `KameleoonException.JSONParse` - Couldn't pass JSON value\n * - `KameleoonException.NumberParse` - Couldn't pass Number value\n */\n getFeatureFlagVariable: ({\n visitorCode,\n featureKey,\n variableKey,\n }: GetFeatureFlagVariableParamsType) => FeatureVariableResultType;\n /**\n * @method getRemoteData - returns a data which is stored for specified siteCode on a remote Kameleoon server.\n * @param {string} key - unique key that the data you try to get is associated with.\n * @returns {JSONType} - promise with retrieving data for specific key.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server\n */\n getRemoteData: (key: string) => Promise<JSONType>;\n /**\n * @method getEngineTrackingCode - returns Kameleoon tracking code for the current visitor. Tracking code is built of the experiments that were triggered and feature flag variations that were assigned during the last 5 seconds\n * See [Kameleoon Automation API](https://developers.kameleoon.com/apis/activation-api-js/api-reference#trigger-1) for the details\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @returns {string} Kameleoon tracking code\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n */\n getEngineTrackingCode: (visitorCode: string) => string;\n /**\n * @method onConfigurationUpdate - fires a callback on client configuration update. Note: this method only works for server sent events of real time update.\n * @param {() => void} callback - callback function with no parameters that will be called upon configuration update\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n */\n onConfigurationUpdate: (callback: () => void) => void;\n}\n\n/**\n * @class\n * KameleoonClient - a class for creating kameleoon client instance\n * for communicating with Kameleoon JavaScript SDK Core, when new instance is created\n */\nexport class KameleoonClient implements IKameleoonClient {\n private variationConfiguration?: VariationConfiguration;\n private campaignConfiguration: CampaignConfiguration;\n private variationDataStorage: ExternalStorage<VariationDataType>;\n private offlineTrackingStorage: ExternalStorage<OfflineTracking>;\n private trackingCache: CacheManager<TrackingCacheItemType>;\n private requester: Requester;\n private externalEventSource: IExternalEventSourceConstructor;\n private externalPackageInfo: ExternalPackageInfoType;\n private isOfflineModeOn?: boolean;\n\n /**\n * @param {SDKCoreParameters} sdkCoreParameters - parameters for initializing sdk core\n */\n constructor({\n siteCode,\n configuration,\n internalConfiguration,\n }: SDKCoreParameters) {\n const { settings: clientSettings } = new ClientSettings(\n siteCode,\n configuration,\n );\n const {\n externalStorage,\n externalEventSource,\n externalPackageInfo,\n externalRequestDispatcher,\n externalClientConfiguration,\n } = internalConfiguration;\n const requester = new Requester({\n siteCode,\n environment: clientSettings.environment,\n packageInfo: externalPackageInfo,\n requestDispatcher: externalRequestDispatcher,\n });\n const trackingCache = new CacheManager<TrackingCacheItemType>(\n CACHE_CLEANUP_TIMEOUT,\n );\n const clientDataStorage = new ExternalStorage<ClientDataType>(\n externalStorage.initialize(KameleoonStorageKey.ClientData),\n );\n const variationDataStorage = new ExternalStorage<VariationDataType>(\n externalStorage.initialize(KameleoonStorageKey.VariationData),\n );\n const offlineTrackingStorage = new ExternalStorage<OfflineTracking>(\n externalStorage.initialize(KameleoonStorageKey.OfflineTracking),\n );\n const campaignConfiguration = new CampaignConfiguration({\n settings: clientSettings,\n storage: clientDataStorage,\n requester,\n externalClientConfiguration,\n targetingCleanupInterval: configuration?.targetingDataCleanupInterval,\n offlineTrackingStorage,\n });\n\n this.requester = requester;\n this.trackingCache = trackingCache;\n this.campaignConfiguration = campaignConfiguration;\n this.variationDataStorage = variationDataStorage;\n this.externalEventSource = externalEventSource;\n this.externalPackageInfo = externalPackageInfo;\n this.offlineTrackingStorage = offlineTrackingStorage;\n }\n\n public async initialize(useCache?: boolean): Promise<boolean> {\n const result = await this.campaignConfiguration.initialize(\n this.externalEventSource,\n useCache,\n );\n result.throw();\n\n const variationConfiguration = new VariationConfiguration(\n this.campaignConfiguration.experiments,\n this.variationDataStorage,\n );\n\n this.variationConfiguration = variationConfiguration;\n\n this.isOfflineModeOn = useCache;\n\n return result.ok;\n }\n\n public addData(visitorCode: string, ...data: KameleoonDataType[]): void {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n if (!this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n this.campaignConfiguration.addTargetingData(visitorCode, ...data).throw();\n }\n\n public async getRemoteVisitorData(\n visitorCode: string,\n shouldAddData = true,\n ): Promise<KameleoonDataType[]> {\n const result = await this.requester.getVisitorData(visitorCode);\n const data = result.throw();\n\n const visitorData = Utilities.parseVisitorData(data);\n\n for (const dataItem of visitorData) {\n if (\n shouldAddData ||\n this.campaignConfiguration.isPersistentCustomData(dataItem)\n ) {\n this.addData(visitorCode, dataItem);\n }\n }\n\n return visitorData;\n }\n\n public triggerExperiment(visitorCode: string, experimentId: number): number {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n if (!this.campaignConfiguration || !this.variationConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n const experiment = this.campaignConfiguration.experiments.find(\n (item) => item.id === String(experimentId),\n );\n\n if (!experiment) {\n throw new KameleoonError(\n KameleoonException.ExperimentConfigurationNotFound,\n experimentId,\n visitorCode,\n );\n }\n\n const targetingData =\n this.campaignConfiguration.storedTargetingData[visitorCode];\n\n let variationId = UNALLOCATED_VARIATION_ID;\n\n const targetingResult = Utilities.checkTargeting({\n visitorCode,\n experimentId,\n targetingData,\n segment: experiment.segment,\n campaignConfiguration: this.campaignConfiguration,\n variationConfiguration: this.variationConfiguration,\n packageInfo: this.externalPackageInfo,\n }).throw();\n\n variationId = this.variationConfiguration\n .getAssociatedVariationId(visitorCode, experimentId)\n .else((error) => {\n if (error.type === KameleoonException.NotAllocated) {\n Utilities.trackExperiment({\n requester: this.requester,\n campaignConfiguration: this.campaignConfiguration,\n isUnallocated: true,\n variationId,\n visitorCode,\n experimentId,\n isOfflineModeOn: this.isOfflineModeOn,\n offlineTrackingStorage: this.offlineTrackingStorage,\n });\n\n return UNALLOCATED_VARIATION_ID;\n }\n\n throw error;\n });\n\n Utilities.trackExperiment({\n requester: this.requester,\n campaignConfiguration: this.campaignConfiguration,\n isUnallocated: false,\n variationId,\n visitorCode,\n experimentId,\n isOfflineModeOn: this.isOfflineModeOn,\n offlineTrackingStorage: this.offlineTrackingStorage,\n });\n\n if (!targetingResult) {\n throw new KameleoonError(KameleoonException.NotTargeted, visitorCode);\n }\n\n Utilities.updateCache({\n cacheManager: this.trackingCache,\n visitorCode,\n experimentId,\n variationId,\n });\n\n return variationId;\n }\n\n public trackConversion({\n visitorCode,\n goalId,\n revenue,\n }: TrackConversionParamsType): void {\n this.addData(visitorCode, new Conversion({ goalId, revenue }));\n this.flush(visitorCode);\n }\n\n public flush(visitorCode?: string): void {\n if (!this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n if (typeof visitorCode === 'string') {\n Utilities.validateVisitorCode(visitorCode).throw();\n }\n\n if (visitorCode) {\n Utilities.trackData({\n visitorCode,\n campaignConfiguration: this.campaignConfiguration,\n requester: this.requester,\n isOfflineModeOn: this.isOfflineModeOn,\n offlineTrackingStorage: this.offlineTrackingStorage,\n });\n return;\n }\n\n // --- Note ---\n // `Utilities.trackData` executes `Utilities.sendOfflineTracking` asynchronously at first, but\n // we need to execute `Utilities.sendOfflineTracking` even if calling `Utilities.trackData` is skipped\n // due to lack of unsent data\n if (!this.campaignConfiguration.unsentDataVisitors.length) {\n Utilities.sendOfflineTracking({\n requester: this.requester,\n storage: this.offlineTrackingStorage,\n });\n return;\n }\n\n for (const visitorCodeKey of this.campaignConfiguration\n .unsentDataVisitors) {\n Utilities.trackData({\n visitorCode: visitorCodeKey,\n campaignConfiguration: this.campaignConfiguration,\n requester: this.requester,\n isOfflineModeOn: this.isOfflineModeOn,\n offlineTrackingStorage: this.offlineTrackingStorage,\n });\n }\n }\n\n public flushData(visitorCode?: string): void {\n this.flush(visitorCode);\n }\n\n public getExperiments(): ExperimentType[] {\n if (!this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n return this.campaignConfiguration.experiments.map(({ id, name }) => ({\n id: Number(id),\n name,\n }));\n }\n\n public getVisitorExperiments(\n visitorCode: string,\n isActive = true,\n ): ExperimentType[] {\n if (!this.variationConfiguration || !this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const experiments = this.campaignConfiguration.experiments;\n const result: ExperimentType[] = [];\n\n const targetingData =\n this.campaignConfiguration.storedTargetingData[visitorCode];\n\n for (const experiment of experiments) {\n const { id, name, segment } = experiment;\n\n const targetingResult = Utilities.checkTargeting({\n targetingData,\n visitorCode,\n segment,\n variationConfiguration: this.variationConfiguration,\n campaignConfiguration: this.campaignConfiguration,\n experimentId: Number(id),\n packageInfo: this.externalPackageInfo,\n }).throw();\n\n if (!targetingResult) {\n continue;\n }\n\n // -- If `isActive=false` then return every experiment\n if (!isActive) {\n result.push({ id: Number(id), name });\n continue;\n }\n\n // -- Else first check if there are saved variations for the experiment\n // if there is at least one than it's active\n const experimentVariations =\n this.variationConfiguration.getAssignedVariations(visitorCode);\n\n if (experimentVariations.ok) {\n const experimentVariation = experimentVariations.data[experiment.id];\n\n if (experimentVariation) {\n result.push({ id: Number(id), name });\n continue;\n }\n }\n\n // -- Second check if the experiment will have an allocated variation upon triggering\n // if yes than it's active\n const variationResult =\n this.variationConfiguration.getExperimentVariation(\n visitorCode,\n experiment,\n );\n\n if (variationResult.ok) {\n result.push({ id: Number(id), name });\n }\n }\n\n return result;\n }\n\n public getExperimentVariationData(variationId: number): JSONType {\n if (!this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n const experiments = this.campaignConfiguration.experiments;\n\n for (const experiment of experiments) {\n const variation = experiment.variations.find(\n (item) => item.id === String(variationId),\n );\n\n if (variation) {\n try {\n return JSON.parse(variation.customJson);\n } catch (err) {\n throw new KameleoonError(KameleoonException.JSONParse, err);\n }\n }\n }\n\n throw new KameleoonError(KameleoonException.VariationNotFound);\n }\n\n public getFeatureFlags(): FeatureFlagType[] {\n if (!this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n return this.campaignConfiguration.featureFlags.map(\n ({ id, featureKey }) => ({ id, key: featureKey }),\n );\n }\n\n public getVisitorFeatureFlags(visitorCode: string): FeatureFlagType[] {\n if (!this.variationConfiguration || !this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n const featureFlags = this.campaignConfiguration.featureFlags;\n const resultFeatureFlags: FeatureFlagType[] = [];\n\n const targetingData =\n this.campaignConfiguration.storedTargetingData[visitorCode];\n\n for (const featureFlag of featureFlags) {\n const variationData = this.variationConfiguration\n .getFeatureFlagVariation({\n visitorCode,\n targetingData,\n featureFlag,\n campaignConfiguration: this.campaignConfiguration,\n packageInfo: this.externalPackageInfo,\n })\n .throw();\n\n if (variationData.variationKey !== OFF_VARIATION_KEY) {\n const { featureFlagId, featureKey } = variationData;\n\n resultFeatureFlags.push({ id: featureFlagId, key: featureKey });\n }\n }\n\n return resultFeatureFlags;\n }\n\n public getFeatureFlagVariationKey(\n visitorCode: string,\n featureKey: string,\n ): string {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const { variationKey } = this._getFeatureFlagVariation(\n visitorCode,\n featureKey,\n ).throw();\n\n return variationKey;\n }\n\n public getFeatureFlagVariable({\n visitorCode,\n featureKey,\n variableKey,\n }: GetFeatureFlagVariableParamsType): FeatureVariableResultType {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const { variationKey } = this._getFeatureFlagVariation(\n visitorCode,\n featureKey,\n ).throw();\n\n // --- Note ---\n // `_getFeatureFlagVariation` already checks `campaignConfiguration` initialization\n const featureFlags = (this.campaignConfiguration as CampaignConfiguration)\n .featureFlags;\n\n const featureFlag = featureFlags.find(\n (item) => item.featureKey === featureKey,\n );\n\n if (!featureFlag) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagConfigurationNotFound,\n featureKey,\n visitorCode,\n );\n }\n\n const variable = featureFlag.variations\n .find((item) => item.key === variationKey)\n ?.variables.find((item) => item.key === variableKey);\n\n if (!variable) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagVariableNotFound,\n variableKey,\n visitorCode,\n );\n }\n\n const featureVariable = Utilities.parseFeatureVariable(variable).throw();\n\n return featureVariable;\n }\n\n public isFeatureFlagActive(visitorCode: string, featureKey: string): boolean {\n const variationKey = this.getFeatureFlagVariationKey(\n visitorCode,\n featureKey,\n );\n\n return variationKey !== OFF_VARIATION_KEY;\n }\n\n public async getRemoteData(key: string): Promise<JSONType> {\n const remoteData = await this.requester.getRemoteData(key);\n\n return remoteData.throw();\n }\n\n public onConfigurationUpdate(callback: () => void): void {\n if (!this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n this.campaignConfiguration.onConfigurationUpdate(callback);\n }\n\n public getEngineTrackingCode(visitorCode: string): string {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n return Utilities.getTrackingCode(this.trackingCache, visitorCode);\n }\n\n private _getFeatureFlagVariation(\n visitorCode: string,\n featureKey: string,\n ): Result<FeatureFlagVariationType, KameleoonError> {\n if (!this.variationConfiguration || !this.campaignConfiguration) {\n return Err(new KameleoonError(KameleoonException.Initialization));\n }\n\n const featureFlags = this.campaignConfiguration.featureFlags;\n const featureFlag = featureFlags.find(\n (item) => item.featureKey === featureKey,\n );\n\n if (!featureFlag) {\n return Err(\n new KameleoonError(\n KameleoonException.FeatureFlagConfigurationNotFound,\n featureKey,\n visitorCode,\n ),\n );\n }\n\n const targetingData =\n this.campaignConfiguration.storedTargetingData[visitorCode];\n\n const variationData = this.variationConfiguration\n .getFeatureFlagVariation({\n visitorCode,\n featureFlag,\n targetingData,\n withAssignment: true,\n campaignConfiguration: this.campaignConfiguration,\n packageInfo: this.externalPackageInfo,\n })\n .throw();\n\n const { experimentId, variationId } = variationData;\n\n if (typeof variationId === 'number' && typeof experimentId === 'number') {\n Utilities.updateCache({\n cacheManager: this.trackingCache,\n visitorCode,\n experimentId,\n variationId,\n });\n }\n\n Utilities.trackRule({\n visitorCode,\n requester: this.requester,\n featureFlagVariation: variationData,\n campaignConfiguration: this.campaignConfiguration,\n isOfflineModeOn: this.isOfflineModeOn,\n offlineTrackingStorage: this.offlineTrackingStorage,\n });\n\n return Ok(variationData);\n }\n}\n"],"mappings":"uiEACA,6JAAAA,GAAA,CAAAC,CAAA,CAAAC,CAAA,SAAAC,MAAA,CAAAC,cAAA,CAAAJ,CAAA,CAAAC,CAAA,EAAAI,KAAA,CAAAH,CAAA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AQ,EAAhC,MAAO,CAAAR,CAAyB,EACrEjB,oBAAS,CAACqC,WAAW,CAAC,CACpBC,YAAY,CAAE,IAAI,CAACjE,aAAa,CAChC0B,WAAW,CAAXA,CAAW,CACXkB,YAAY,CAAZA,CAAY,CACZQ,WAAW,CAAXA,CACF,CAAC,CAAC,CAGJzB,oBAAS,CAACiG,SAAS,CAAC,CAClBlG,WAAW,CAAXA,CAAW,CACX/B,SAAS,CAAE,IAAI,CAACA,SAAS,CACzBkI,oBAAoB,CAAEzB,CAAa,CACnCxF,qBAAqB,CAAE,IAAI,CAACA,qBAAqB,CACjDW,eAAe,CAAE,IAAI,CAACA,eAAe,CACrCb,sBAAsB,CAAE,IAAI,CAACA,sBAC/B,CAAC,CAAC,CAEK,GAAAoH,SAAE,EAAC1B,CAAa,CACzB,CAAC,IAAAxO,CAAA,IAAAmQ,OAAA,CAAAhJ,eAAA,CAAAA,eAAA"}
1
+ {"version":3,"file":"kameleoonClient.js","names":["a","b","c","Object","defineProperty","value","enumerable","configurable","writable","e","f","prototype","d","g","create","h","m","s","i","type","arg","call","forEach","_invoke","j","k","_typeof","r","resolve","__await","then","Error","o","method","delegate","x","sent","_sent","dispatchException","abrupt","done","iterator","return","TypeError","resultName","next","nextLoc","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","l","completion","reset","n","u","isNaN","length","_regeneratorRuntime","p","q","hasOwnProperty","t","Symbol","v","asyncIterator","w","toStringTag","wrap","y","z","getPrototypeOf","A","B","displayName","isGeneratorFunction","constructor","name","mark","setPrototypeOf","__proto__","awrap","AsyncIterator","async","Promise","keys","reverse","pop","values","prev","charAt","slice","stop","rval","complete","finish","catch","_catch","delegateYield","asyncGeneratorStep","_asyncToGenerator","arguments","apply","_classCallCheck","_defineProperties","_toPropertyKey","key","_createClass","_defineProperty","_toPrimitive","toPrimitive","String","Number","KameleoonClient","siteCode","configuration","internalConfiguration","ClientSettings","clientSettings","settings","externalStorage","externalEventSource","externalPackageInfo","externalRequestDispatcher","externalClientConfiguration","requester","Requester","environment","packageInfo","requestDispatcher","trackingCache","CacheManager","CACHE_CLEANUP_TIMEOUT","clientDataStorage","ExternalStorage","initialize","KameleoonStorageKey","ClientData","variationDataStorage","VariationData","offlineTrackingStorage","OfflineTracking","campaignConfiguration","CampaignConfiguration","storage","targetingCleanupInterval","targetingDataCleanupInterval","useCache","result","throw","variationConfiguration","VariationConfiguration","experiments","isOfflineModeOn","ok","addData","visitorCode","Utilities","validateVisitorCode","KameleoonError","KameleoonException","Initialization","data","Array","addTargetingData","concat","shouldAddData","getVisitorData","visitorData","parseVisitorData","_createForOfIteratorHelper","dataItem","isPersistentCustomData","triggerExperiment","experimentId","experiment","find","item","id","ExperimentConfigurationNotFound","targetingData","storedTargetingData","variationId","UNALLOCATED_VARIATION_ID","targetingResult","checkTargeting","segment","getAssociatedVariationId","else","error","NotAllocated","trackExperiment","isUnallocated","NotTargeted","updateCache","cacheManager","trackConversion","goalId","revenue","Conversion","flush","trackData","unsentDataVisitors","sendOfflineTracking","visitorCodeKey","flushData","getExperiments","map","getVisitorExperiments","isActive","experimentVariations","getAssignedVariations","experimentVariation","variationResult","getExperimentVariation","getExperimentVariationData","variation","variations","JSON","parse","customJson","err","JSONParse","VariationNotFound","getFeatureFlags","featureFlags","featureKey","getVisitorFeatureFlags","resultFeatureFlags","featureFlag","variationData","getFeatureFlagVariation","variationKey","OFF_VARIATION_KEY","featureFlagId","getFeatureFlagVariationKey","_getFeatureFlagVariation","getFeatureFlagVariable","variableKey","FeatureFlagConfigurationNotFound","variable","variables","FeatureFlagVariableNotFound","featureVariable","parseFeatureVariable","isFeatureFlagActive","getRemoteData","remoteData","onConfigurationUpdate","callback","getEngineTrackingCode","getTrackingCode","Err","withAssignment","trackRule","featureFlagVariation","Ok","exports"],"sources":["../src/kameleoonClient.ts"],"sourcesContent":["import { Err, Ok, Result } from 'ts-res';\nimport { CacheManager } from './cacheManager';\nimport { CampaignConfiguration, JSONType } from './campaignConfiguration';\nimport { ClientSettings } from './clientSettings';\nimport {\n CACHE_CLEANUP_TIMEOUT,\n OFF_VARIATION_KEY,\n UNALLOCATED_VARIATION_ID,\n} from './constants';\nimport { Conversion, KameleoonDataType } from './kameleoonData';\nimport { KameleoonError, KameleoonException } from './kameleoonError';\nimport { Requester } from './requester';\nimport {\n ClientDataType,\n KameleoonStorageKey,\n VariationDataType,\n} from './storage';\nimport { ExternalStorage } from './storage/externalStorage';\nimport {\n TrackConversionParamsType,\n ExperimentType,\n FeatureFlagType,\n GetFeatureFlagVariableParamsType,\n FeatureVariableResultType,\n SDKCoreParameters,\n TrackingCacheItemType,\n ExternalPackageInfoType,\n} from './types';\nimport { Utilities } from './utilities';\nimport {\n FeatureFlagVariationType,\n VariationConfiguration,\n} from './variationConfiguration';\nimport { OfflineTracking } from './storage/types';\n\n/**\n * @interface an interface of KameleoonClient instance\n */\nexport interface IKameleoonClient {\n /**\n * @method initialize - an asynchronous method for KameleoonClient initialization by fetching Kameleoon SDK related data from server or by retrieving data from local source if data is up-to-date or update interval has not been reached\n * @param {boolean | undefined} useCache - optional parameter for activating SDK offline mode, if `true` is passed failed polls will not return error and will use cached data if such data is available, default value is `false`. Note: if offline mode is on, SDK will still try to retrieve the latest data.\n * @returns {Promise<boolean>} Promise resolved into boolean field indicating success or fail\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.StorageWrite` Couldn't update storage data\n * - `KameleoonException.ClientConfiguration` Couldn't retrieve client configuration from Kameleoon Api\n * - `KameleoonException.MaximumRetriesReached` Maximum retries reached, request failed\n */\n initialize(useCache?: boolean): Promise<boolean>;\n initialize(): Promise<boolean>;\n /**\n * @method addData - method for adding targeting data to the storage so that other methods could decide whether the current visitor is targeted or not. Note: userAgent data will not be stored in storage like other data, and it will be sent with every tracking request for bot filtration.\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {KameleoonDataType[]} kameleoonData - number of instances of any type of `KameleoonData`, can be added solely in array or as a sequential arguments\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.StorageWrite` Couldn't update storage data\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n */\n addData: (visitorCode: string, ...data: KameleoonDataType[]) => void;\n /**\n * @method getRemoteVisitorData - an asynchronous method for retrieving custom data for the latest visit of `visitorCode` from Kameleoon Data API and optionally adding it to the storage so that other methods could decide whether the current visitor is targeted or not.\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {boolean | undefined} shouldAddData - optional parameter for adding retrieved data to the storage like `addData` method does, default value is `true`\n * @returns {KameleoonDataType[]} promise resolved to an array of `KameleoonData` instances, only includes custom data\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server\n */\n getRemoteVisitorData: (\n visitorCode: string,\n shouldAddData?: boolean,\n ) => Promise<KameleoonDataType[]>;\n /**\n * @method triggerExperiment - triggers experiment by assigning the variation to the user with `visitorCode`, if the variation is already assigned just returns it's id. Note: returned id `0` indicates default variation. At the same time sends tracking request.\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {number} experimentId - id of experiment running for the current visitor\n * @returns {number} associated variationId which is successfully searched/assigned\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.ExperimentConfigurationNotFound` No configuration found for provided `experimentId`\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.StorageRead` Couldn't find associated experiment by provided `experimentId` and `visitorCode` inside the storage\n * - `KameleoonException.NotTargeted` Current visitor is not targeted\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n */\n triggerExperiment: (visitorCode: string, experimentId: number) => number;\n /**\n * @method trackConversion - creates and adds `Conversion` data to the visitor with specified parameters and executes `flush`. Note: it's a helper method for the quick and convenient conversion tracking, however creating and adding `Conversion` manually allows more flexible `Conversion` with `negative` parameter\n * @param {TrackConversionParamsType} conversionParameters - `visitorCode`, `goalId` and `revenue` parameters for data tracking\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.StorageWrite` Couldn't update storage data\n */\n trackConversion: ({\n visitorCode,\n goalId,\n revenue,\n }: TrackConversionParamsType) => void;\n /**\n * @method flush - takes visitor associated kameleoon data and sends the data tracking request with collected data,\n * sent data is removed from `KameleoonClient` instance but not from the storage for correct targeting checks. If no visitor is passed,\n * then data for all visitors is sent and removed from `KameleoonClient` instance. Moreover, regardless of visitor code input\n * the method first attemps to send all previously failed tracking requests which were stored locally during the offline mode.\n * @param {string | undefined} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n */\n flush: (visitorCode: string) => void;\n /**\n * @deprecated Use flush method instead.\n */\n flushData: (visitorCode: string) => void;\n /**\n * @method getExperiments - returns a list of experiments stored in the client configuration\n * @returns {ExperimentType[]} a list of all experiments items with `id` and `name` fields\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n */\n getExperiments: () => ExperimentType[];\n /**\n * @method getVisitorExperiments - returns a list of experiments that the visitor with `visitorCode` is targeted by and that are *active* for the visitor (visitor will have one of the variations allocated if the experiment will be triggered).\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {boolean | undefined} isAllocated - boolean value indicating that only experiments *allocated* for visitor will be returned. Default value is `true`\n * @returns {ExperimentType[]} a list of all experiments items with `id` and `name` fields\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n */\n getVisitorExperiments: (\n visitorCode: string,\n isAllocated?: boolean,\n ) => ExperimentType[];\n /**\n * @method getExperimentVariationData - returns variation data in JSON format for the variation with `variationId`\n * @param {number} variationId - id of variation\n * @returns {JSONType} variation data in JSON format\n * @throws `KameleoonError` with one of the following `type` s:\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n * - `KameleoonException.JSONParse` - Couldn't pass JSON value\n * - `KameleoonException.VariationNotFound` - No variation found for provided `variationId`\n */\n getExperimentVariationData: (variationId: number) => JSONType | null;\n /**\n * @method getFeatureFlags - returns a list of feature flags stored in the client configuration\n * @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n */\n getFeatureFlags: () => FeatureFlagType[];\n /**\n * @method getVisitorFeatureFlags - returns a list of feature flags that the visitor with `visitorCode` that is targeted by and that are *active* for the visitor (visitor will have one of the variations allocated).\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n */\n getVisitorFeatureFlags: (visitorCode: string) => FeatureFlagType[];\n /**\n * @method isFeatureFlagActive - returns a boolean indicating whether the visitor with `visitorCode` has `featureKey` active for him, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {string} featureKey - a unique key for feature flag\n * @returns {boolean} a boolean indicator of whether the feature flag with `featureKey` is active for visitor with `visitorCode`\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`\n * - `KameleoonException.DataInconsistency` - Allocated variation was found but there is no feature flag with according `featureKey`.\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n */\n isFeatureFlagActive: (visitorCode: string, featureKey: string) => boolean;\n /**\n * @method getFeatureFlagVariationKey - returns variation key for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {string} featureKey - a unique key for feature flag\n * @returns {string} a string containing variable key for the allocated feature flag variation for the provided visitor\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n */\n getFeatureFlagVariationKey: (\n visitorCode: string,\n featureKey: string,\n ) => string;\n /**\n * @method getFeatureFlagVariable - returns a variable for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request\n * @param {GetFeatureFlagVariableParamsType} parameters - an object with parameters of a type `GetFeatureFlagVariableParamsType`, see the type for details.\n * @returns {FeatureVariableResultType} a variable object containing `type` and `value` fields, `type` can be checked against `FeatureVariableType` enum, if the `type` is `FeatureVariableType.BOOLEAN` then the `value` type will be `boolean` and so on.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`\n * - `KameleoonException.FeatureFlagVariableNotFound` - No feature variable was found for provided `visitorCode` and `variableKey`\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n * - `KameleoonException.JSONParse` - Couldn't pass JSON value\n * - `KameleoonException.NumberParse` - Couldn't pass Number value\n */\n getFeatureFlagVariable: ({\n visitorCode,\n featureKey,\n variableKey,\n }: GetFeatureFlagVariableParamsType) => FeatureVariableResultType;\n /**\n * @method getRemoteData - returns a data which is stored for specified siteCode on a remote Kameleoon server.\n * @param {string} key - unique key that the data you try to get is associated with.\n * @returns {JSONType} - promise with retrieving data for specific key.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server\n */\n getRemoteData: (key: string) => Promise<JSONType>;\n /**\n * @method getEngineTrackingCode - returns Kameleoon tracking code for the current visitor. Tracking code is built of the experiments that were triggered and feature flag variations that were assigned during the last 5 seconds\n * See [Kameleoon Automation API](https://developers.kameleoon.com/apis/activation-api-js/api-reference#trigger-1) for the details\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @returns {string} Kameleoon tracking code\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n */\n getEngineTrackingCode: (visitorCode: string) => string;\n /**\n * @method onConfigurationUpdate - fires a callback on client configuration update. Note: this method only works for server sent events of real time update.\n * @param {() => void} callback - callback function with no parameters that will be called upon configuration update\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n */\n onConfigurationUpdate: (callback: () => void) => void;\n}\n\n/**\n * @class\n * KameleoonClient - a class for creating kameleoon client instance\n * for communicating with Kameleoon JavaScript SDK Core, when new instance is created\n */\nexport class KameleoonClient implements IKameleoonClient {\n private variationConfiguration?: VariationConfiguration;\n private campaignConfiguration: CampaignConfiguration;\n private variationDataStorage: ExternalStorage<VariationDataType>;\n private offlineTrackingStorage: ExternalStorage<OfflineTracking>;\n private trackingCache: CacheManager<TrackingCacheItemType>;\n private requester: Requester;\n private externalPackageInfo: ExternalPackageInfoType;\n private isOfflineModeOn?: boolean;\n\n /**\n * @param {SDKCoreParameters} sdkCoreParameters - parameters for initializing sdk core\n */\n constructor({\n siteCode,\n configuration,\n internalConfiguration,\n }: SDKCoreParameters) {\n const { settings: clientSettings } = new ClientSettings(\n siteCode,\n configuration,\n );\n const {\n externalStorage,\n externalEventSource,\n externalPackageInfo,\n externalRequestDispatcher,\n externalClientConfiguration,\n } = internalConfiguration;\n const requester = new Requester({\n siteCode,\n environment: clientSettings.environment,\n packageInfo: externalPackageInfo,\n requestDispatcher: externalRequestDispatcher,\n });\n const trackingCache = new CacheManager<TrackingCacheItemType>(\n CACHE_CLEANUP_TIMEOUT,\n );\n const clientDataStorage = new ExternalStorage<ClientDataType>(\n externalStorage.initialize(KameleoonStorageKey.ClientData),\n );\n const variationDataStorage = new ExternalStorage<VariationDataType>(\n externalStorage.initialize(KameleoonStorageKey.VariationData),\n );\n const offlineTrackingStorage = new ExternalStorage<OfflineTracking>(\n externalStorage.initialize(KameleoonStorageKey.OfflineTracking),\n );\n const campaignConfiguration = new CampaignConfiguration({\n settings: clientSettings,\n storage: clientDataStorage,\n requester,\n externalClientConfiguration,\n targetingCleanupInterval: configuration?.targetingDataCleanupInterval,\n offlineTrackingStorage,\n externalEventSource,\n });\n\n this.requester = requester;\n this.trackingCache = trackingCache;\n this.campaignConfiguration = campaignConfiguration;\n this.variationDataStorage = variationDataStorage;\n this.externalPackageInfo = externalPackageInfo;\n this.offlineTrackingStorage = offlineTrackingStorage;\n }\n\n public async initialize(useCache?: boolean): Promise<boolean> {\n const result = await this.campaignConfiguration.initialize(useCache);\n result.throw();\n\n const variationConfiguration = new VariationConfiguration(\n this.campaignConfiguration.experiments,\n this.variationDataStorage,\n );\n\n this.variationConfiguration = variationConfiguration;\n\n this.isOfflineModeOn = useCache;\n\n return result.ok;\n }\n\n public addData(visitorCode: string, ...data: KameleoonDataType[]): void {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n if (!this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n this.campaignConfiguration.addTargetingData(visitorCode, ...data).throw();\n }\n\n public async getRemoteVisitorData(\n visitorCode: string,\n shouldAddData = true,\n ): Promise<KameleoonDataType[]> {\n const result = await this.requester.getVisitorData(visitorCode);\n const data = result.throw();\n\n const visitorData = Utilities.parseVisitorData(data);\n\n for (const dataItem of visitorData) {\n if (\n shouldAddData ||\n this.campaignConfiguration.isPersistentCustomData(dataItem)\n ) {\n this.addData(visitorCode, dataItem);\n }\n }\n\n return visitorData;\n }\n\n public triggerExperiment(visitorCode: string, experimentId: number): number {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n if (!this.campaignConfiguration || !this.variationConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n const experiment = this.campaignConfiguration.experiments.find(\n (item) => item.id === String(experimentId),\n );\n\n if (!experiment) {\n throw new KameleoonError(\n KameleoonException.ExperimentConfigurationNotFound,\n experimentId,\n visitorCode,\n );\n }\n\n const targetingData =\n this.campaignConfiguration.storedTargetingData[visitorCode];\n\n let variationId = UNALLOCATED_VARIATION_ID;\n\n const targetingResult = Utilities.checkTargeting({\n visitorCode,\n experimentId,\n targetingData,\n segment: experiment.segment,\n campaignConfiguration: this.campaignConfiguration,\n variationConfiguration: this.variationConfiguration,\n packageInfo: this.externalPackageInfo,\n }).throw();\n\n variationId = this.variationConfiguration\n .getAssociatedVariationId(visitorCode, experimentId)\n .else((error) => {\n if (error.type === KameleoonException.NotAllocated) {\n Utilities.trackExperiment({\n requester: this.requester,\n campaignConfiguration: this.campaignConfiguration,\n isUnallocated: true,\n variationId,\n visitorCode,\n experimentId,\n isOfflineModeOn: this.isOfflineModeOn,\n offlineTrackingStorage: this.offlineTrackingStorage,\n });\n\n return UNALLOCATED_VARIATION_ID;\n }\n\n throw error;\n });\n\n Utilities.trackExperiment({\n requester: this.requester,\n campaignConfiguration: this.campaignConfiguration,\n isUnallocated: false,\n variationId,\n visitorCode,\n experimentId,\n isOfflineModeOn: this.isOfflineModeOn,\n offlineTrackingStorage: this.offlineTrackingStorage,\n });\n\n if (!targetingResult) {\n throw new KameleoonError(KameleoonException.NotTargeted, visitorCode);\n }\n\n Utilities.updateCache({\n cacheManager: this.trackingCache,\n visitorCode,\n experimentId,\n variationId,\n });\n\n return variationId;\n }\n\n public trackConversion({\n visitorCode,\n goalId,\n revenue,\n }: TrackConversionParamsType): void {\n this.addData(visitorCode, new Conversion({ goalId, revenue }));\n this.flush(visitorCode);\n }\n\n public flush(visitorCode?: string): void {\n if (!this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n if (typeof visitorCode === 'string') {\n Utilities.validateVisitorCode(visitorCode).throw();\n }\n\n if (visitorCode) {\n Utilities.trackData({\n visitorCode,\n campaignConfiguration: this.campaignConfiguration,\n requester: this.requester,\n isOfflineModeOn: this.isOfflineModeOn,\n offlineTrackingStorage: this.offlineTrackingStorage,\n });\n return;\n }\n\n // --- Note ---\n // `Utilities.trackData` executes `Utilities.sendOfflineTracking` asynchronously at first, but\n // we need to execute `Utilities.sendOfflineTracking` even if calling `Utilities.trackData` is skipped\n // due to lack of unsent data\n if (!this.campaignConfiguration.unsentDataVisitors.length) {\n Utilities.sendOfflineTracking({\n requester: this.requester,\n storage: this.offlineTrackingStorage,\n });\n return;\n }\n\n for (const visitorCodeKey of this.campaignConfiguration\n .unsentDataVisitors) {\n Utilities.trackData({\n visitorCode: visitorCodeKey,\n campaignConfiguration: this.campaignConfiguration,\n requester: this.requester,\n isOfflineModeOn: this.isOfflineModeOn,\n offlineTrackingStorage: this.offlineTrackingStorage,\n });\n }\n }\n\n public flushData(visitorCode?: string): void {\n this.flush(visitorCode);\n }\n\n public getExperiments(): ExperimentType[] {\n if (!this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n return this.campaignConfiguration.experiments.map(({ id, name }) => ({\n id: Number(id),\n name,\n }));\n }\n\n public getVisitorExperiments(\n visitorCode: string,\n isActive = true,\n ): ExperimentType[] {\n if (!this.variationConfiguration || !this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const experiments = this.campaignConfiguration.experiments;\n const result: ExperimentType[] = [];\n\n const targetingData =\n this.campaignConfiguration.storedTargetingData[visitorCode];\n\n for (const experiment of experiments) {\n const { id, name, segment } = experiment;\n\n const targetingResult = Utilities.checkTargeting({\n targetingData,\n visitorCode,\n segment,\n variationConfiguration: this.variationConfiguration,\n campaignConfiguration: this.campaignConfiguration,\n experimentId: Number(id),\n packageInfo: this.externalPackageInfo,\n }).throw();\n\n if (!targetingResult) {\n continue;\n }\n\n // -- If `isActive=false` then return every experiment\n if (!isActive) {\n result.push({ id: Number(id), name });\n continue;\n }\n\n // -- Else first check if there are saved variations for the experiment\n // if there is at least one than it's active\n const experimentVariations =\n this.variationConfiguration.getAssignedVariations(visitorCode);\n\n if (experimentVariations.ok) {\n const experimentVariation = experimentVariations.data[experiment.id];\n\n if (experimentVariation) {\n result.push({ id: Number(id), name });\n continue;\n }\n }\n\n // -- Second check if the experiment will have an allocated variation upon triggering\n // if yes than it's active\n const variationResult =\n this.variationConfiguration.getExperimentVariation(\n visitorCode,\n experiment,\n );\n\n if (variationResult.ok) {\n result.push({ id: Number(id), name });\n }\n }\n\n return result;\n }\n\n public getExperimentVariationData(variationId: number): JSONType {\n if (!this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n const experiments = this.campaignConfiguration.experiments;\n\n for (const experiment of experiments) {\n const variation = experiment.variations.find(\n (item) => item.id === String(variationId),\n );\n\n if (variation) {\n try {\n return JSON.parse(variation.customJson);\n } catch (err) {\n throw new KameleoonError(KameleoonException.JSONParse, err);\n }\n }\n }\n\n throw new KameleoonError(KameleoonException.VariationNotFound);\n }\n\n public getFeatureFlags(): FeatureFlagType[] {\n if (!this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n return this.campaignConfiguration.featureFlags.map(\n ({ id, featureKey }) => ({ id, key: featureKey }),\n );\n }\n\n public getVisitorFeatureFlags(visitorCode: string): FeatureFlagType[] {\n if (!this.variationConfiguration || !this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n const featureFlags = this.campaignConfiguration.featureFlags;\n const resultFeatureFlags: FeatureFlagType[] = [];\n\n const targetingData =\n this.campaignConfiguration.storedTargetingData[visitorCode];\n\n for (const featureFlag of featureFlags) {\n const variationData = this.variationConfiguration\n .getFeatureFlagVariation({\n visitorCode,\n targetingData,\n featureFlag,\n campaignConfiguration: this.campaignConfiguration,\n packageInfo: this.externalPackageInfo,\n })\n .throw();\n\n if (variationData.variationKey !== OFF_VARIATION_KEY) {\n const { featureFlagId, featureKey } = variationData;\n\n resultFeatureFlags.push({ id: featureFlagId, key: featureKey });\n }\n }\n\n return resultFeatureFlags;\n }\n\n public getFeatureFlagVariationKey(\n visitorCode: string,\n featureKey: string,\n ): string {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const { variationKey } = this._getFeatureFlagVariation(\n visitorCode,\n featureKey,\n ).throw();\n\n return variationKey;\n }\n\n public getFeatureFlagVariable({\n visitorCode,\n featureKey,\n variableKey,\n }: GetFeatureFlagVariableParamsType): FeatureVariableResultType {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const { variationKey } = this._getFeatureFlagVariation(\n visitorCode,\n featureKey,\n ).throw();\n\n // --- Note ---\n // `_getFeatureFlagVariation` already checks `campaignConfiguration` initialization\n const featureFlags = (this.campaignConfiguration as CampaignConfiguration)\n .featureFlags;\n\n const featureFlag = featureFlags.find(\n (item) => item.featureKey === featureKey,\n );\n\n if (!featureFlag) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagConfigurationNotFound,\n featureKey,\n visitorCode,\n );\n }\n\n const variable = featureFlag.variations\n .find((item) => item.key === variationKey)\n ?.variables.find((item) => item.key === variableKey);\n\n if (!variable) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagVariableNotFound,\n variableKey,\n visitorCode,\n );\n }\n\n const featureVariable = Utilities.parseFeatureVariable(variable).throw();\n\n return featureVariable;\n }\n\n public isFeatureFlagActive(visitorCode: string, featureKey: string): boolean {\n const variationKey = this.getFeatureFlagVariationKey(\n visitorCode,\n featureKey,\n );\n\n return variationKey !== OFF_VARIATION_KEY;\n }\n\n public async getRemoteData(key: string): Promise<JSONType> {\n const remoteData = await this.requester.getRemoteData(key);\n\n return remoteData.throw();\n }\n\n public onConfigurationUpdate(callback: () => void): void {\n if (!this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n this.campaignConfiguration.onConfigurationUpdate(callback);\n }\n\n public getEngineTrackingCode(visitorCode: string): string {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n return Utilities.getTrackingCode(this.trackingCache, visitorCode);\n }\n\n private _getFeatureFlagVariation(\n visitorCode: string,\n featureKey: string,\n ): Result<FeatureFlagVariationType, KameleoonError> {\n if (!this.variationConfiguration || !this.campaignConfiguration) {\n return Err(new KameleoonError(KameleoonException.Initialization));\n }\n\n const featureFlags = this.campaignConfiguration.featureFlags;\n const featureFlag = featureFlags.find(\n (item) => item.featureKey === featureKey,\n );\n\n if (!featureFlag) {\n return Err(\n new KameleoonError(\n KameleoonException.FeatureFlagConfigurationNotFound,\n featureKey,\n visitorCode,\n ),\n );\n }\n\n const targetingData =\n this.campaignConfiguration.storedTargetingData[visitorCode];\n\n const variationData = this.variationConfiguration\n .getFeatureFlagVariation({\n visitorCode,\n featureFlag,\n targetingData,\n withAssignment: true,\n campaignConfiguration: this.campaignConfiguration,\n packageInfo: this.externalPackageInfo,\n })\n .throw();\n\n const { experimentId, variationId } = variationData;\n\n if (typeof variationId === 'number' && typeof experimentId === 'number') {\n Utilities.updateCache({\n cacheManager: this.trackingCache,\n visitorCode,\n experimentId,\n variationId,\n });\n }\n\n Utilities.trackRule({\n visitorCode,\n requester: this.requester,\n featureFlagVariation: variationData,\n campaignConfiguration: this.campaignConfiguration,\n isOfflineModeOn: this.isOfflineModeOn,\n offlineTrackingStorage: this.offlineTrackingStorage,\n });\n\n return Ok(variationData);\n }\n}\n"],"mappings":"uiEACA,6JAAAA,GAAA,CAAAC,CAAA,CAAAC,CAAA,SAAAC,MAAA,CAAAC,cAAA,CAAAJ,CAAA,CAAAC,CAAA,EAAAI,KAAA,CAAAH,CAAA,CAAAI,UAAA,IAAAC,YAAA,IAAAC,QAAA,MAAAR,CAAA,CAAAC,CAAA,WAAAA,EAAAD,CAAA,CAAAC,CAAA,CAAAC,CAAA,CAAAO,CAAA,MAAAC,CAAA,CAAAT,CAAA,EAAAA,CAAA,CAAAU,SAAA,YAAAC,CAAA,CAAAX,CAAA,CAAAW,CAAA,CAAAC,CAAA,CAAAV,MAAA,CAAAW,MAAA,CAAAJ,CAAA,CAAAC,SAAA,EAAAI,CAA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,IAAI,CAACA,qBAAqB,CACjDW,eAAe,CAAE,IAAI,CAACA,eAAe,CACrCb,sBAAsB,CAAE,IAAI,CAACA,sBAC/B,CAAC,CAAC,CAEK,GAAAoH,SAAE,EAAC1B,CAAa,CACzB,CAAC,IAAAxO,CAAA,IAAAmQ,OAAA,CAAAhJ,eAAA,CAAAA,eAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"customData.js","names":["CustomData","a","index","_classCallCheck","_defineProperty","c","arguments","length","value","Array","e","nonce","Utilities","getNonce","_createClass","key","get","uniqueValues","_toConsumableArray","Set","resultValue","forEach","Object","keys","UrlEventType","UrlParameter","Index","ValuesCountMap","encodeURIComponent","JSON","stringify","Overwrite","Nonce","type","KameleoonData","exports"],"sources":["../../src/kameleoonData/customData.ts"],"sourcesContent":["import { UrlEventType, UrlParameter } from 'src/requester';\nimport { Utilities } from 'src/utilities';\nimport { CustomDataType, IKameleoonData, KameleoonData } from './types';\n\n/**\n * @class\n * CustomData - a class for creating an instance for user's custom data\n * */\nexport class CustomData implements IKameleoonData {\n private index: number;\n private value: string[];\n private nonce: string;\n\n /**\n * @param {number} index - an index of custom data to be stored under in a state, an index of custom data can be specified in `Advanced Tools` section of Kameleoon Application\n * @param {string[]} value - custom value to store under the specified id, value can be anything but has to be stringified to match the `string` type. *Note* value is variadic parameter and can be used as follows\n * @example\n * ```ts\n * // - Single value\n * const customData = new CustomData(0, 'value_1');\n * // - Variadic number of values\n * const customData = new CustomData(0, 'value_1', 'value_2', 'value_3');\n * // - Array of values\n * const values = ['value_1', 'value_2', 'value_3'];\n * const customData = new CustomData(0, ...values);\n * ```\n * */\n constructor(index: number, ...value: string[]) {\n this.index = index;\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 // --- Note ---\n // If SDK is used in vanilla JS codebase, then you're also able to create an instance\n // with no required data, we don't want send anything to tracking in that case\n if (typeof this.index !== 'number') {\n return '';\n }\n\n const uniqueValues = [...new Set(this.value)];\n let resultValue: Record<string, 1> = {};\n\n // --- Note ---\n // Final value should look like this `{ value_1: 1, value_2: 1, value_3: 1}`\n // With no duplicates\n uniqueValues.forEach((value) => {\n resultValue[value] = 1;\n });\n\n if (!Object.keys(resultValue).length) {\n return '';\n }\n\n return (\n UrlEventType.CustomData +\n UrlParameter.Index +\n this.index +\n UrlParameter.ValuesCountMap +\n encodeURIComponent(JSON.stringify(resultValue)) +\n UrlParameter.Overwrite +\n String(true) +\n UrlParameter.Nonce +\n this.nonce\n );\n }\n\n /**\n * @property data - data of the current class instance\n * */\n get data(): CustomDataType {\n return {\n index: this.index,\n value: this.value,\n type: KameleoonData.CustomData,\n nonce: this.nonce,\n };\n }\n}\n"],"mappings":"04EAIA;AACA;AACA;AACA,KAHA,GAIa,CAAAA,UAAU,yBAKrB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OACE,SAAAC,EAAYC,CAAa,CAAsB,CAAAC,eAAA,MAAAF,CAAA,EAAAG,eAAA,sBAAAA,eAAA,sBAAAA,eAAA,sBAC7C,IAAI,CAACF,KAAK,CAAGA,CAAK,SAAAG,CAAA,CAAAC,SAAA,CAAAC,MAAA,CADUC,CAAK,CAAAC,KAAA,GAAAJ,CAAA,CAAAA,CAAA,MAAAK,CAAA,GAAAA,CAAA,CAAAL,CAAA,CAAAK,CAAA,GAALF,CAAK,CAAAE,CAAA,IAAAJ,SAAA,CAAAI,CAAA,EAEjC,IAAI,CAACF,KAAK,CAAGA,CAAK,CAClB,IAAI,CAACG,KAAK,CAAGC,oBAAS,CAACC,QAAQ,EACjC,CAEA;AACF;AACA,OAFE,OAAAC,YAAA,CAAAb,CAAA,GAAAc,GAAA,OAAAC,GAAA,CAGA,SAAAA,IAAA,CAAkB,CAChB;AACA;AACA;AACA,GAA0B,QAAQ,EAA9B,MAAO,KAAI,CAACd,KAAkB,CAChC,MAAO,EAAE,CACV,GAEK,CAAAe,CAAY,CAAAC,kBAAA,CAAO,GAAI,CAAAC,GAAG,CAAC,IAAI,CAACX,KAAK,CAAC,CAAC,CACzCY,CAA8B,CAAG,CAAC,CAAC,OAKvC,CAAAH,CAAY,CAACI,OAAO,CAAC,SAACb,CAAK,CAAK,CAC9BY,CAAW,CAACZ,CAAK,CAAC,CAAG,CACvB,CAAC,CAAC,CAEGc,MAAM,CAACC,IAAI,CAACH,CAAW,CAAC,CAACb,MAAM,CAKlCiB,uBAAY,CAACxB,UAAU,CACvByB,uBAAY,CAACC,KAAK,CAClB,IAAI,CAACxB,KAAK,CACVuB,uBAAY,CAACE,cAAc,CAC3BC,kBAAkB,CAACC,IAAI,CAACC,SAAS,CAACV,CAAW,CAAC,CAAC,CAC/CK,uBAAY,CAACM,SAAS,OACV,CACZN,uBAAY,CAACO,KAAK,CAClB,IAAI,CAACrB,KAAK,CAZH,EAcX,CAEA;AACF;AACA,OAFE,GAAAI,GAAA,QAAAC,GAAA,CAGA,SAAAA,IAAA,CAA2B,CACzB,MAAO,CACLd,KAAK,CAAE,IAAI,CAACA,KAAK,CACjBM,KAAK,CAAE,IAAI,CAACA,KAAK,CACjByB,IAAI,CAAEC,oBAAa,CAAClC,UAAU,CAC9BW,KAAK,CAAE,IAAI,CAACA,KACd,CACF,CAAC,IAAAV,CAAA,IAAAkC,OAAA,CAAAnC,UAAA,CAAAA,UAAA"}
1
+ {"version":3,"file":"customData.js","names":["CustomData","a","index","_classCallCheck","_defineProperty","c","arguments","length","value","Array","e","nonce","Utilities","getNonce","_createClass","key","get","uniqueValues","_toConsumableArray","Set","resultValue","forEach","Object","keys","UrlEventType","UrlParameter","Index","ValuesCountMap","encodeURIComponent","JSON","stringify","Overwrite","Nonce","type","KameleoonData","exports"],"sources":["../../src/kameleoonData/customData.ts"],"sourcesContent":["import { UrlEventType, UrlParameter } from 'src/requester';\nimport { Utilities } from 'src/utilities';\nimport { CustomDataType, IKameleoonData, KameleoonData } from './types';\n\n/**\n * @class\n * CustomData - a class for creating an instance for user's custom data\n * */\nexport class CustomData implements IKameleoonData {\n private index: number;\n private value: string[];\n private nonce: string;\n\n /**\n * @param {number} index - an index of custom data to be stored under in a state, an index of custom data can be specified in `Advanced Tools` section of Kameleoon Application\n * @param {string[]} value - custom value to store under the specified id, value can be anything but has to be stringified to match the `string` type. *Note* value is variadic parameter and can be used as follows\n * @example\n * ```ts\n * // - Single value\n * const customData = new CustomData(0, 'value_1');\n * // - Variadic number of values\n * const customData = new CustomData(0, 'value_1', 'value_2', 'value_3');\n * // - Array of values\n * const values = ['value_1', 'value_2', 'value_3'];\n * const customData = new CustomData(0, ...values);\n * ```\n * */\n constructor(index: number, ...value: string[]) {\n this.index = index;\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 // --- Note ---\n // If SDK is used in vanilla JS codebase, then you're also able to create an instance\n // with no required data, we don't want send anything to tracking in that case\n if (typeof this.index !== 'number') {\n return '';\n }\n\n const uniqueValues = [...new Set(this.value)];\n let resultValue: Record<string, 1> = {};\n\n // --- Note ---\n // Final value should look like this `{ \"value_1\": 1, \"value_2\": 1, \"value_3\": 1}`\n // With no duplicates\n uniqueValues.forEach((value) => {\n resultValue[value] = 1;\n });\n\n if (!Object.keys(resultValue).length) {\n return '';\n }\n\n return (\n UrlEventType.CustomData +\n UrlParameter.Index +\n this.index +\n UrlParameter.ValuesCountMap +\n encodeURIComponent(JSON.stringify(resultValue)) +\n UrlParameter.Overwrite +\n String(true) +\n UrlParameter.Nonce +\n this.nonce\n );\n }\n\n /**\n * @property data - data of the current class instance\n * */\n get data(): CustomDataType {\n return {\n index: this.index,\n value: this.value,\n type: KameleoonData.CustomData,\n nonce: this.nonce,\n };\n }\n}\n"],"mappings":"04EAIA;AACA;AACA;AACA,KAHA,GAIa,CAAAA,UAAU,yBAKrB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OACE,SAAAC,EAAYC,CAAa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AA,CAA2B,CACzB,MAAO,CACLd,KAAK,CAAE,IAAI,CAACA,KAAK,CACjBM,KAAK,CAAE,IAAI,CAACA,KAAK,CACjByB,IAAI,CAAEC,oBAAa,CAAClC,UAAU,CAC9BW,KAAK,CAAE,IAAI,CAACA,KACd,CACF,CAAC,IAAAV,CAAA,IAAAkC,OAAA,CAAAnC,UAAA,CAAAA,UAAA"}
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CustomDataCondition=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../../kameleoonData"),_kameleoonError=require("../../kameleoonError"),_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)}var CustomDataCondition=/*#__PURE__*/function(){function a(b){var c=b.customDataIndex,d=b.valueMatchType,e=b.value;_classCallCheck(this,a),_defineProperty(this,"customDataIndex",void 0),_defineProperty(this,"matchType",void 0),_defineProperty(this,"conditionValue",void 0),_defineProperty(this,"error",void 0),this.customDataIndex=+c,this.matchType=d,this.conditionValue=e}return _createClass(a,[{key:"evaluate",value:function evaluate(a){var b,c=a.targetingData,d=null===c||void 0===c||null===(b=c[_kameleoonData.KameleoonData.CustomData])||void 0===b?void 0:b[this.customDataIndex];if(d){var e=d.value,f=this.checkCondition(e);return this.error?(0,_tsRes.Err)(this.error):(0,_tsRes.Ok)(f)}return(0,_tsRes.Ok)(this.matchType===_types.MatchTypeCustomData.UNDEFINED)}},{key:"checkCondition",value:function checkCondition(a){var b=this;if("string"!=typeof this.conditionValue&&this.matchType!==_types.MatchTypeCustomData.TRUE&&this.matchType!==_types.MatchTypeCustomData.FALSE)return!1;// --- Note ---
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CustomDataCondition=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../../kameleoonData"),_kameleoonError=require("../../kameleoonError"),_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)}var CustomDataCondition=/*#__PURE__*/function(){function a(b){var c=b.customDataIndex,d=b.valueMatchType,e=b.value;_classCallCheck(this,a),_defineProperty(this,"customDataIndex",void 0),_defineProperty(this,"matchType",void 0),_defineProperty(this,"conditionValue",void 0),_defineProperty(this,"error",void 0),this.customDataIndex=c?+c:null,this.matchType=d,this.conditionValue=e}return _createClass(a,[{key:"evaluate",value:function evaluate(a){var b=a.targetingData;if("number"==typeof this.customDataIndex){var c,d=null===b||void 0===b||null===(c=b[_kameleoonData.KameleoonData.CustomData])||void 0===c?void 0:c[this.customDataIndex];if(d){var e=d.value,f=this.checkCondition(e);return this.error?(0,_tsRes.Err)(this.error):(0,_tsRes.Ok)(f)}}return(0,_tsRes.Ok)(this.matchType===_types.MatchTypeCustomData.UNDEFINED)}},{key:"checkCondition",value:function checkCondition(a){var b=this;if("string"!=typeof this.conditionValue&&this.matchType!==_types.MatchTypeCustomData.TRUE&&this.matchType!==_types.MatchTypeCustomData.FALSE)return!1;// --- Note ---
2
2
  // `MatchTypeCustomData.TRUE` and `MatchTypeCustomData.FALSE` do not use condition value
3
3
  // so we can safely assume that `this.conditionValue` is a string at this point
4
4
  var c=this.conditionValue;// --- Note ---
@@ -1 +1 @@
1
- {"version":3,"file":"customDataCondition.js","names":["CustomDataCondition","a","b","customDataIndex","valueMatchType","value","_classCallCheck","_defineProperty","matchType","conditionValue","_createClass","key","evaluate","targetingData","customData","KameleoonData","CustomData","customDataValue","result","checkCondition","error","Err","Ok","MatchTypeCustomData","UNDEFINED","TRUE","FALSE","AMONG_VALUES","parseArray","ok","resultData","Set","data","Array","isArray","some","has","includes","CONTAINS","EXACT","REGULAR_EXPRESSION","Utilities","parseRegExp","test","LOWER","EQUAL","GREATER","toLowerCase","JSON","parse","err","KameleoonError","KameleoonException","AmongValuesCheck","exports"],"sources":["../../../src/targeting/conditions/customDataCondition.ts"],"sourcesContent":["import { Err, Ok, Result } from 'ts-res';\nimport { CustomDataType, KameleoonData } from 'src/kameleoonData';\nimport { KameleoonError, KameleoonException } from 'src/kameleoonError';\nimport { Utilities } from 'src/utilities';\nimport { EvaluationDataType, MatchTypeCustomData } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class CustomDataCondition implements ICondition {\n private customDataIndex: number;\n private matchType?: MatchTypeCustomData | null;\n private conditionValue?: string | null;\n private error?: KameleoonError;\n\n constructor({ customDataIndex, valueMatchType, value }: ConditionDataType) {\n this.customDataIndex = Number(customDataIndex);\n this.matchType = valueMatchType;\n this.conditionValue = value;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const customData =\n targetingData?.[KameleoonData.CustomData]?.[this.customDataIndex];\n\n if (customData) {\n const { value: customDataValue } = customData;\n const result = this.checkCondition(customDataValue);\n\n if (this.error) {\n return Err(this.error);\n }\n\n return Ok(result);\n }\n\n return Ok(this.matchType === MatchTypeCustomData.UNDEFINED);\n }\n\n private checkCondition(customDataValue: CustomDataType['value']): boolean {\n if (\n typeof this.conditionValue !== 'string' &&\n this.matchType !== MatchTypeCustomData.TRUE &&\n this.matchType !== MatchTypeCustomData.FALSE\n ) {\n return false;\n }\n\n // --- Note ---\n // `MatchTypeCustomData.TRUE` and `MatchTypeCustomData.FALSE` do not use condition value\n // so we can safely assume that `this.conditionValue` is a string at this point\n const conditionValue = this.conditionValue as string;\n\n // --- Note ---\n // `AMONG_VALUES` is checked separately to avoid recursion overhead\n // for `JSON.parse` inside `this.parseArray`\n if (this.matchType === MatchTypeCustomData.AMONG_VALUES) {\n const result = this.parseArray(conditionValue);\n\n if (!result.ok) {\n this.error = result.error;\n\n return false;\n }\n\n const resultData = new Set(result.data);\n\n return Array.isArray(customDataValue)\n ? customDataValue.some((value) => resultData.has(value))\n : result.data.includes(customDataValue);\n }\n\n if (Array.isArray(customDataValue)) {\n return customDataValue.some((value) => this.checkCondition(value));\n }\n\n switch (this.matchType) {\n case MatchTypeCustomData.CONTAINS:\n return customDataValue.includes(conditionValue);\n case MatchTypeCustomData.EXACT:\n return customDataValue === this.conditionValue;\n case MatchTypeCustomData.REGULAR_EXPRESSION:\n return Utilities.parseRegExp(conditionValue).test(customDataValue);\n case MatchTypeCustomData.LOWER:\n return Number(customDataValue) < Number(this.conditionValue);\n case MatchTypeCustomData.EQUAL:\n return Number(customDataValue) === Number(this.conditionValue);\n case MatchTypeCustomData.GREATER:\n return Number(customDataValue) > Number(this.conditionValue);\n case MatchTypeCustomData.TRUE:\n return customDataValue.toLowerCase() === 'true';\n case MatchTypeCustomData.FALSE:\n return customDataValue.toLowerCase() === 'false';\n default:\n return false;\n }\n }\n\n private parseArray(value: string): Result<string[], KameleoonError> {\n try {\n const result = JSON.parse(value);\n\n if (Array.isArray(result)) {\n return Ok(result);\n }\n } catch (err) {\n return Err(\n new KameleoonError(KameleoonException.AmongValuesCheck, err, value),\n );\n }\n\n return Ok([]);\n }\n}\n"],"mappings":"+gDAOa,CAAAA,mBAAmB,yBAM9B,SAAAC,EAAAC,CAAA,CAA2E,IAA7D,CAAAC,CAAe,CAAAD,CAAA,CAAfC,eAAe,CAAEC,CAAc,CAAAF,CAAA,CAAdE,cAAc,CAAEC,CAAK,CAAAH,CAAA,CAALG,KAAK,CAAAC,eAAA,MAAAL,CAAA,EAAAM,eAAA,gCAAAA,eAAA,0BAAAA,eAAA,+BAAAA,eAAA,sBAClD,IAAI,CAACJ,eAAe,EAAUA,CAAgB,CAC9C,IAAI,CAACK,SAAS,CAAGJ,CAAc,CAC/B,IAAI,CAACK,cAAc,CAAGJ,CACxB,CAAC,OAAAK,YAAA,CAAAT,CAAA,GAAAU,GAAA,YAAAN,KAAA,CAED,SAAAO,SAAAX,CAAA,CAEwD,KAAAC,CAAA,CADtDW,CA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ClE,GAAI,CACF,GAAM,CAAAa,CAAM,CAAG8B,IAAI,CAACC,KAAK,CAAC5C,CAAK,CAAC,CAEhC,GAAI4B,KAAK,CAACC,OAAO,CAAChB,CAAM,CAAC,CACvB,MAAO,GAAAI,SAAE,EAACJ,CAAM,CAEpB,CAAE,MAAOgC,CAAG,CAAE,CACZ,MAAO,GAAA7B,UAAG,EACR,GAAI,CAAA8B,8BAAc,CAACC,kCAAkB,CAACC,gBAAgB,CAAEH,CAAG,CAAE7C,CAAK,CAAC,CAEvE,CAEA,MAAO,GAAAiB,SAAE,EAAC,EAAE,CACd,CAAC,IAAArB,CAAA,IAAAqD,OAAA,CAAAtD,mBAAA,CAAAA,mBAAA"}
1
+ {"version":3,"file":"customDataCondition.js","names":["CustomDataCondition","a","b","customDataIndex","valueMatchType","value","_classCallCheck","_defineProperty","matchType","conditionValue","_createClass","key","evaluate","targetingData","c","customData","KameleoonData","CustomData","customDataValue","result","checkCondition","error","Err","Ok","MatchTypeCustomData","UNDEFINED","TRUE","FALSE","AMONG_VALUES","parseArray","ok","resultData","Set","data","Array","isArray","some","has","includes","CONTAINS","EXACT","REGULAR_EXPRESSION","Utilities","parseRegExp","test","LOWER","EQUAL","GREATER","toLowerCase","JSON","parse","err","KameleoonError","KameleoonException","AmongValuesCheck","exports"],"sources":["../../../src/targeting/conditions/customDataCondition.ts"],"sourcesContent":["import { Err, Ok, Result } from 'ts-res';\nimport { CustomDataType, KameleoonData } from 'src/kameleoonData';\nimport { KameleoonError, KameleoonException } from 'src/kameleoonError';\nimport { Utilities } from 'src/utilities';\nimport { EvaluationDataType, MatchTypeCustomData } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class CustomDataCondition implements ICondition {\n private customDataIndex: number | null;\n private matchType?: MatchTypeCustomData | null;\n private conditionValue?: string | null;\n private error?: KameleoonError;\n\n constructor({ customDataIndex, valueMatchType, value }: ConditionDataType) {\n this.customDataIndex = customDataIndex ? Number(customDataIndex) : null;\n this.matchType = valueMatchType;\n this.conditionValue = value;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n if (typeof this.customDataIndex === 'number') {\n const customData =\n targetingData?.[KameleoonData.CustomData]?.[this.customDataIndex];\n\n if (customData) {\n const { value: customDataValue } = customData;\n const result = this.checkCondition(customDataValue);\n\n if (this.error) {\n return Err(this.error);\n }\n\n return Ok(result);\n }\n }\n\n return Ok(this.matchType === MatchTypeCustomData.UNDEFINED);\n }\n\n private checkCondition(customDataValue: CustomDataType['value']): boolean {\n if (\n typeof this.conditionValue !== 'string' &&\n this.matchType !== MatchTypeCustomData.TRUE &&\n this.matchType !== MatchTypeCustomData.FALSE\n ) {\n return false;\n }\n\n // --- Note ---\n // `MatchTypeCustomData.TRUE` and `MatchTypeCustomData.FALSE` do not use condition value\n // so we can safely assume that `this.conditionValue` is a string at this point\n const conditionValue = this.conditionValue as string;\n\n // --- Note ---\n // `AMONG_VALUES` is checked separately to avoid recursion overhead\n // for `JSON.parse` inside `this.parseArray`\n if (this.matchType === MatchTypeCustomData.AMONG_VALUES) {\n const result = this.parseArray(conditionValue);\n\n if (!result.ok) {\n this.error = result.error;\n\n return false;\n }\n\n const resultData = new Set(result.data);\n\n return Array.isArray(customDataValue)\n ? customDataValue.some((value) => resultData.has(value))\n : result.data.includes(customDataValue);\n }\n\n if (Array.isArray(customDataValue)) {\n return customDataValue.some((value) => this.checkCondition(value));\n }\n\n switch (this.matchType) {\n case MatchTypeCustomData.CONTAINS:\n return customDataValue.includes(conditionValue);\n case MatchTypeCustomData.EXACT:\n return customDataValue === this.conditionValue;\n case MatchTypeCustomData.REGULAR_EXPRESSION:\n return Utilities.parseRegExp(conditionValue).test(customDataValue);\n case MatchTypeCustomData.LOWER:\n return Number(customDataValue) < Number(this.conditionValue);\n case MatchTypeCustomData.EQUAL:\n return Number(customDataValue) === Number(this.conditionValue);\n case MatchTypeCustomData.GREATER:\n return Number(customDataValue) > Number(this.conditionValue);\n case MatchTypeCustomData.TRUE:\n return customDataValue.toLowerCase() === 'true';\n case MatchTypeCustomData.FALSE:\n return customDataValue.toLowerCase() === 'false';\n default:\n return false;\n }\n }\n\n private parseArray(value: string): Result<string[], KameleoonError> {\n try {\n const result = JSON.parse(value);\n\n if (Array.isArray(result)) {\n return Ok(result);\n }\n } catch (err) {\n return Err(\n new KameleoonError(KameleoonException.AmongValuesCheck, err, value),\n );\n }\n\n return Ok([]);\n }\n}\n"],"mappings":"+gDAOa,CAAAA,mBAAmB,yBAM9B,SAAAC,EAAAC,CAAA,CAA2E,IAA7D,CAAAC,CAAe,CAAAD,CAAA,CAAfC,eAAe,CAAEC,CAAc,CAAAF,CAAA,CAAdE,cAAc,CAAEC,CAAK,CAAAH,CAAA,CAALG,KAAK,CAAAC,eAAA,MAAAL,CAAA,EAAAM,eAAA,gCAAAA,eAAA,0BAAAA,eAAA,+BAAAA,eAAA,sBAClD,IAAI,CAACJ,eAAe,CAAGA,CAAe,EAAUA,CAAe,CAAI,IAAI,CACvE,IAAI,CAACK,SAAS,CAAGJ,CAAc,CAC/B,IAAI,CAACK,cAAc,CAAGJ,CACxB,CAAC,OAAAK,YAAA,CAAAT,CAAA,GAAAU,GAAA,YAAAN,KAAA,CAED,SAAAO,SAAAX,CAAA,CAEwD,IADtD,CAAAY,CAAa,CAAAZ,CAAA,CAAbY,aAAa,CAEb,GAAoC,QAAQ,EAAxC,MAAO,KAAI,CAACV,eAA4B,CAAE,KAAAW,CAAA,CACtCC,CAAU,QACdF,CAAa,WAAbA,CAAa,UAAAC,CAAA,CAAbD,CAAa,CAAGG,4BAAa,CAACC,UAAU,CAAC,YAAAH,CAAA,QAAzCA,CAAA,CAA4C,IAAI,CAACX,eAAe,CAAC,CAEnE,GAAIY,CAAU,CAAE,IACC,CAAAG,CAAe,CAAKH,CAAU,CAArCV,KAAK,CACPc,CAAM,CAAG,IAAI,CAACC,cAAc,CAACF,CAAe,CAAC,OAE/C,KAAI,CAACG,KAAK,CACL,GAAAC,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,GAAAkB,SAAE,EAAC,EAAE,CACd,CAAC,IAAAtB,CAAA,IAAAsD,OAAA,CAAAvD,mBAAA,CAAAA,mBAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kameleoon/javascript-sdk-core",
3
- "version": "2.8.0",
3
+ "version": "2.8.2",
4
4
  "description": "Kameleoon JS SDK Core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -44,9 +44,9 @@
44
44
  "@types/crypto-js": "^4.1.1",
45
45
  "@types/jest": "^27.0.2",
46
46
  "@types/node": "^14.17.5",
47
- "@types/node-fetch": "^2.6.2",
47
+ "@types/node-fetch": "^2.6.4",
48
48
  "jest": "^27.3.1",
49
- "node-fetch": "2.6.1",
49
+ "node-fetch": "2.7.0",
50
50
  "ts-jest": "^27.0.7",
51
51
  "tsc-alias": "^1.8.7"
52
52
  }