@kameleoon/javascript-sdk-core 2.10.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cacheManager/cacheManager.js +1 -11
- package/dist/cacheManager/cacheManager.js.map +1 -1
- package/dist/clientConfiguration/clientConfiguration.d.ts +55 -0
- package/dist/clientConfiguration/clientConfiguration.js +2 -0
- package/dist/clientConfiguration/clientConfiguration.js.map +1 -0
- package/dist/clientConfiguration/constants.d.ts +2 -0
- package/dist/clientConfiguration/constants.js +2 -0
- package/dist/clientConfiguration/constants.js.map +1 -0
- package/dist/clientConfiguration/index.d.ts +2 -0
- package/dist/clientConfiguration/index.js +2 -0
- package/dist/clientConfiguration/index.js.map +1 -0
- package/dist/{campaignConfiguration → clientConfiguration}/types.d.ts +24 -57
- package/dist/clientConfiguration/types.js +2 -0
- package/dist/clientConfiguration/types.js.map +1 -0
- package/dist/clientSettings/clientSettings.js +1 -1
- package/dist/clientSettings/clientSettings.js.map +1 -1
- package/dist/constants.d.ts +3 -2
- package/dist/constants.js +1 -4
- package/dist/constants.js.map +1 -1
- package/dist/cookieManager/cookieManager.d.ts +16 -0
- package/dist/cookieManager/cookieManager.js +2 -0
- package/dist/cookieManager/cookieManager.js.map +1 -0
- package/dist/cookieManager/index.d.ts +1 -0
- package/dist/cookieManager/index.js +2 -0
- package/dist/cookieManager/index.js.map +1 -0
- package/dist/eventSource/externalEventSource.js +1 -1
- package/dist/eventSource/externalEventSource.js.map +1 -1
- package/dist/hasher/hasher.d.ts +2 -3
- package/dist/hasher/hasher.js +1 -6
- package/dist/hasher/hasher.js.map +1 -1
- package/dist/hasher/types.d.ts +3 -10
- package/dist/hasher/types.js.map +1 -1
- package/dist/index.d.ts +9 -7
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/kameleoonClient.d.ts +75 -80
- package/dist/kameleoonClient.js +1 -18
- package/dist/kameleoonClient.js.map +1 -1
- package/dist/kameleoonData/applicationVersion.d.ts +26 -0
- package/dist/kameleoonData/applicationVersion.js +2 -0
- package/dist/kameleoonData/applicationVersion.js.map +1 -0
- package/dist/kameleoonData/browser.d.ts +16 -1
- package/dist/kameleoonData/browser.js +1 -17
- package/dist/kameleoonData/browser.js.map +1 -1
- package/dist/kameleoonData/constants.d.ts +4 -0
- package/dist/kameleoonData/constants.js +2 -0
- package/dist/kameleoonData/constants.js.map +1 -0
- package/dist/kameleoonData/conversion.d.ts +14 -1
- package/dist/kameleoonData/conversion.js +1 -13
- package/dist/kameleoonData/conversion.js.map +1 -1
- package/dist/kameleoonData/cookie.d.ts +33 -0
- package/dist/kameleoonData/cookie.js +2 -0
- package/dist/kameleoonData/cookie.js.map +1 -0
- package/dist/kameleoonData/customData.d.ts +14 -1
- package/dist/kameleoonData/customData.js +1 -24
- package/dist/kameleoonData/customData.js.map +1 -1
- package/dist/kameleoonData/dataManager.d.ts +39 -0
- package/dist/kameleoonData/dataManager.js +2 -0
- package/dist/kameleoonData/dataManager.js.map +1 -0
- package/dist/kameleoonData/dataProcessor.d.ts +26 -0
- package/dist/kameleoonData/dataProcessor.js +2 -0
- package/dist/kameleoonData/dataProcessor.js.map +1 -0
- package/dist/kameleoonData/device.d.ts +14 -1
- package/dist/kameleoonData/device.js +1 -13
- package/dist/kameleoonData/device.js.map +1 -1
- package/dist/kameleoonData/geolocation.d.ts +52 -0
- package/dist/kameleoonData/geolocation.js +2 -0
- package/dist/kameleoonData/geolocation.js.map +1 -0
- package/dist/kameleoonData/helpers.d.ts +1 -0
- package/dist/kameleoonData/helpers.js +2 -0
- package/dist/kameleoonData/helpers.js.map +1 -0
- package/dist/kameleoonData/index.d.ts +10 -3
- package/dist/kameleoonData/index.js +1 -1
- package/dist/kameleoonData/index.js.map +1 -1
- package/dist/kameleoonData/operatingSystem.d.ts +34 -0
- package/dist/kameleoonData/operatingSystem.js +2 -0
- package/dist/kameleoonData/operatingSystem.js.map +1 -0
- package/dist/kameleoonData/pageView.d.ts +20 -1
- package/dist/kameleoonData/pageView.js +1 -13
- package/dist/kameleoonData/pageView.js.map +1 -1
- package/dist/kameleoonData/types.d.ts +118 -9
- package/dist/kameleoonData/types.js +1 -14
- package/dist/kameleoonData/types.js.map +1 -1
- package/dist/kameleoonData/userAgent.d.ts +6 -1
- package/dist/kameleoonData/userAgent.js +1 -8
- package/dist/kameleoonData/userAgent.js.map +1 -1
- package/dist/kameleoonData/visitsData.d.ts +34 -0
- package/dist/{variationConfiguration/variation.js → kameleoonData/visitsData.js} +2 -7
- package/dist/kameleoonData/visitsData.js.map +1 -0
- package/dist/kameleoonError/constants.d.ts +6 -4
- package/dist/kameleoonError/constants.js +1 -1
- package/dist/kameleoonError/constants.js.map +1 -1
- package/dist/kameleoonError/kameleoonError.d.ts +6 -4
- package/dist/kameleoonError/kameleoonError.js +1 -4
- package/dist/kameleoonError/kameleoonError.js.map +1 -1
- package/dist/kameleoonError/types.d.ts +9 -3
- package/dist/kameleoonError/types.js +1 -1
- package/dist/kameleoonError/types.js.map +1 -1
- package/dist/kameleoonUtils.d.ts +0 -6
- package/dist/kameleoonUtils.js +1 -4
- package/dist/kameleoonUtils.js.map +1 -1
- package/dist/requester/constants.d.ts +5 -3
- package/dist/requester/constants.js +1 -1
- package/dist/requester/constants.js.map +1 -1
- package/dist/requester/index.d.ts +2 -2
- package/dist/requester/index.js +1 -1
- package/dist/requester/index.js.map +1 -1
- package/dist/requester/requester.d.ts +8 -7
- package/dist/requester/requester.js +1 -1
- package/dist/requester/requester.js.map +1 -1
- package/dist/requester/types.d.ts +79 -12
- package/dist/requester/types.js +1 -1
- package/dist/requester/types.js.map +1 -1
- package/dist/storage/constants.d.ts +3 -1
- package/dist/storage/constants.js +1 -4
- package/dist/storage/constants.js.map +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.js +1 -1
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/types.d.ts +15 -9
- package/dist/storage/types.js.map +1 -1
- package/dist/targeting/conditions/applicationVersion.d.ts +10 -0
- package/dist/targeting/conditions/applicationVersion.js +2 -0
- package/dist/targeting/conditions/applicationVersion.js.map +1 -0
- package/dist/targeting/conditions/{browserCondition.d.ts → browser.d.ts} +1 -1
- package/dist/targeting/conditions/browser.js +2 -0
- package/dist/targeting/conditions/browser.js.map +1 -0
- package/dist/targeting/conditions/conditionFactory.js +1 -1
- package/dist/targeting/conditions/conditionFactory.js.map +1 -1
- package/dist/targeting/conditions/{conversionCondition.d.ts → conversion.d.ts} +1 -2
- package/dist/targeting/conditions/conversion.js +2 -0
- package/dist/targeting/conditions/conversion.js.map +1 -0
- package/dist/targeting/conditions/cookie.d.ts +15 -0
- package/dist/targeting/conditions/cookie.js +2 -0
- package/dist/targeting/conditions/cookie.js.map +1 -0
- package/dist/targeting/conditions/{customDataCondition.d.ts → customData.d.ts} +1 -1
- package/dist/targeting/conditions/customData.js +2 -0
- package/dist/targeting/conditions/customData.js.map +1 -0
- package/dist/targeting/conditions/{deviceCondition.d.ts → device.d.ts} +1 -1
- package/dist/targeting/conditions/{targetExperimentCondition.js → device.js} +2 -2
- package/dist/targeting/conditions/device.js.map +1 -0
- package/dist/targeting/conditions/{exclusiveExperimentCondition.d.ts → exclusiveCampaign.d.ts} +2 -2
- package/dist/targeting/conditions/exclusiveCampaign.js +2 -0
- package/dist/targeting/conditions/exclusiveCampaign.js.map +1 -0
- package/dist/targeting/conditions/firstVisit.d.ts +12 -0
- package/dist/targeting/conditions/firstVisit.js +2 -0
- package/dist/targeting/conditions/firstVisit.js.map +1 -0
- package/dist/targeting/conditions/geolocation.d.ts +11 -0
- package/dist/targeting/conditions/geolocation.js +2 -0
- package/dist/targeting/conditions/geolocation.js.map +1 -0
- package/dist/targeting/conditions/index.d.ts +22 -10
- package/dist/targeting/conditions/index.js +1 -1
- package/dist/targeting/conditions/index.js.map +1 -1
- package/dist/targeting/conditions/lastVisit.d.ts +12 -0
- package/dist/targeting/conditions/lastVisit.js +2 -0
- package/dist/targeting/conditions/lastVisit.js.map +1 -0
- package/dist/targeting/conditions/newVisitor.d.ts +9 -0
- package/dist/targeting/conditions/newVisitor.js +2 -0
- package/dist/targeting/conditions/newVisitor.js.map +1 -0
- package/dist/targeting/conditions/operatingSystem.d.ts +9 -0
- package/dist/targeting/conditions/{deviceCondition.js → operatingSystem.js} +2 -2
- package/dist/targeting/conditions/operatingSystem.js.map +1 -0
- package/dist/targeting/conditions/{pageTitleCondition.d.ts → pageTitle.d.ts} +1 -1
- package/dist/targeting/conditions/pageTitle.js +2 -0
- package/dist/targeting/conditions/pageTitle.js.map +1 -0
- package/dist/targeting/conditions/{pageUrlCondition.d.ts → pageUrl.d.ts} +1 -1
- package/dist/targeting/conditions/pageUrl.js +2 -0
- package/dist/targeting/conditions/pageUrl.js.map +1 -0
- package/dist/targeting/conditions/previousPage.d.ts +12 -0
- package/dist/targeting/conditions/previousPage.js +2 -0
- package/dist/targeting/conditions/previousPage.js.map +1 -0
- package/dist/targeting/conditions/sameDayVisits.d.ts +11 -0
- package/dist/targeting/conditions/sameDayVisits.js +2 -0
- package/dist/targeting/conditions/sameDayVisits.js.map +1 -0
- package/dist/targeting/conditions/{sdkLanguageCondition.d.ts → sdkLanguage.d.ts} +1 -4
- package/dist/targeting/conditions/sdkLanguage.js +2 -0
- package/dist/targeting/conditions/sdkLanguage.js.map +1 -0
- package/dist/targeting/conditions/segment.d.ts +9 -0
- package/dist/targeting/conditions/segment.js +2 -0
- package/dist/targeting/conditions/segment.js.map +1 -0
- package/dist/targeting/conditions/targetFeatureFlag.d.ts +11 -0
- package/dist/targeting/conditions/targetFeatureFlag.js +2 -0
- package/dist/targeting/conditions/targetFeatureFlag.js.map +1 -0
- package/dist/targeting/conditions/types.d.ts +20 -13
- package/dist/targeting/conditions/types.js.map +1 -1
- package/dist/targeting/conditions/visitedPages.d.ts +11 -0
- package/dist/targeting/conditions/visitedPages.js +2 -0
- package/dist/targeting/conditions/visitedPages.js.map +1 -0
- package/dist/targeting/conditions/{visitorCodeCondition.d.ts → visitorCode.d.ts} +1 -1
- package/dist/targeting/conditions/visitorCode.js +2 -0
- package/dist/targeting/conditions/visitorCode.js.map +1 -0
- package/dist/targeting/conditions/visits.d.ts +11 -0
- package/dist/targeting/conditions/visits.js +2 -0
- package/dist/targeting/conditions/visits.js.map +1 -0
- package/dist/targeting/index.d.ts +3 -3
- package/dist/targeting/index.js +1 -1
- package/dist/targeting/index.js.map +1 -1
- package/dist/targeting/{targetingNode.d.ts → node.d.ts} +7 -7
- package/dist/targeting/node.js +2 -0
- package/dist/targeting/node.js.map +1 -0
- package/dist/targeting/{targetingTree.d.ts → tree.d.ts} +6 -3
- package/dist/targeting/tree.js +2 -0
- package/dist/targeting/tree.js.map +1 -0
- package/dist/targeting/types.d.ts +30 -8
- package/dist/targeting/types.js +1 -1
- package/dist/targeting/types.js.map +1 -1
- package/dist/types.d.ts +61 -18
- package/dist/types.js +1 -41
- package/dist/types.js.map +1 -1
- package/dist/utilities/index.d.ts +1 -0
- package/dist/utilities/index.js +1 -1
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/types.d.ts +71 -6
- package/dist/utilities/types.js +1 -1
- package/dist/utilities/types.js.map +1 -1
- package/dist/utilities/utilities.d.ts +30 -11
- package/dist/utilities/utilities.js +1 -1
- package/dist/utilities/utilities.js.map +1 -1
- package/dist/variationConfiguration/index.d.ts +1 -1
- package/dist/variationConfiguration/index.js +1 -1
- package/dist/variationConfiguration/index.js.map +1 -1
- package/dist/variationConfiguration/types.d.ts +6 -12
- package/dist/variationConfiguration/types.js.map +1 -1
- package/dist/variationConfiguration/variationConfiguration.d.ts +13 -21
- package/dist/variationConfiguration/variationConfiguration.js +1 -65
- package/dist/variationConfiguration/variationConfiguration.js.map +1 -1
- package/package.json +1 -1
- package/dist/campaignConfiguration/campaignConfiguration.d.ts +0 -71
- package/dist/campaignConfiguration/campaignConfiguration.js +0 -24
- package/dist/campaignConfiguration/campaignConfiguration.js.map +0 -1
- package/dist/campaignConfiguration/constants.d.ts +0 -6
- package/dist/campaignConfiguration/constants.js +0 -4
- package/dist/campaignConfiguration/constants.js.map +0 -1
- package/dist/campaignConfiguration/index.d.ts +0 -3
- package/dist/campaignConfiguration/index.js +0 -2
- package/dist/campaignConfiguration/index.js.map +0 -1
- package/dist/campaignConfiguration/types.js +0 -2
- package/dist/campaignConfiguration/types.js.map +0 -1
- package/dist/targeting/conditions/browserCondition.js +0 -2
- package/dist/targeting/conditions/browserCondition.js.map +0 -1
- package/dist/targeting/conditions/conversionCondition.js +0 -4
- package/dist/targeting/conditions/conversionCondition.js.map +0 -1
- package/dist/targeting/conditions/customDataCondition.js +0 -8
- package/dist/targeting/conditions/customDataCondition.js.map +0 -1
- package/dist/targeting/conditions/deviceCondition.js.map +0 -1
- package/dist/targeting/conditions/exclusiveExperimentCondition.js +0 -2
- package/dist/targeting/conditions/exclusiveExperimentCondition.js.map +0 -1
- package/dist/targeting/conditions/pageTitleCondition.js +0 -2
- package/dist/targeting/conditions/pageTitleCondition.js.map +0 -1
- package/dist/targeting/conditions/pageUrlCondition.js +0 -2
- package/dist/targeting/conditions/pageUrlCondition.js.map +0 -1
- package/dist/targeting/conditions/sdkLanguageCondition.js +0 -2
- package/dist/targeting/conditions/sdkLanguageCondition.js.map +0 -1
- package/dist/targeting/conditions/targetExperimentCondition.d.ts +0 -12
- package/dist/targeting/conditions/targetExperimentCondition.js.map +0 -1
- package/dist/targeting/conditions/visitorCodeCondition.js +0 -2
- package/dist/targeting/conditions/visitorCodeCondition.js.map +0 -1
- package/dist/targeting/targetingNode.js +0 -2
- package/dist/targeting/targetingNode.js.map +0 -1
- package/dist/targeting/targetingTree.js +0 -35
- package/dist/targeting/targetingTree.js.map +0 -1
- package/dist/variationConfiguration/variation.d.ts +0 -13
- package/dist/variationConfiguration/variation.js.map +0 -1
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
// We can not make delayed code execution recoverable, as it might lead
|
|
3
|
-
// to targeting data storage size overflow
|
|
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 ---
|
|
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 ---
|
|
9
|
-
// `targetingData` should not refresh `lastUpdate` time
|
|
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 ---
|
|
15
|
-
// `targetingData` should not refresh `lastUpdate` time
|
|
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;
|
|
24
|
-
//# sourceMappingURL=campaignConfiguration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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 { 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 { IExternalStorage, 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: IExternalStorage<ClientDataType>;\n private offlineTrackingStorage: IExternalStorage<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,IAA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AAU,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 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DEFAULT_CONFIGURATION_DATA=exports.CLEANUP_TARGETING_DATA_INTERVAL=void 0;/**
|
|
2
|
-
* @constant default cleanup interval in minutes
|
|
3
|
-
* */var CLEANUP_TARGETING_DATA_INTERVAL=30;exports.CLEANUP_TARGETING_DATA_INTERVAL=30;var DEFAULT_CONFIGURATION_DATA={experiments:[],featureFlags:[],customData:[],configuration:{realTimeUpdate:!1}};exports.DEFAULT_CONFIGURATION_DATA=DEFAULT_CONFIGURATION_DATA;
|
|
4
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["CLEANUP_TARGETING_DATA_INTERVAL","exports","DEFAULT_CONFIGURATION_DATA","experiments","featureFlags","customData","configuration","realTimeUpdate"],"sources":["../../src/campaignConfiguration/constants.ts"],"sourcesContent":["import { ConfigurationDataType } from 'src/campaignConfiguration';\n\n/**\n * @constant default cleanup interval in minutes\n * */\nexport const CLEANUP_TARGETING_DATA_INTERVAL = 30;\n\nexport const DEFAULT_CONFIGURATION_DATA: ConfigurationDataType = {\n experiments: [],\n featureFlags: [],\n customData: [],\n configuration: {\n realTimeUpdate: false,\n },\n};\n"],"mappings":"sJAEA;AACA;AACA,KACO,GAAM,CAAAA,+BAA+B,CAAG,EAAE,CAACC,OAAA,CAAAD,+BAAA,IAE3C,GAAM,CAAAE,0BAAiD,CAAG,CAC/DC,WAAW,CAAE,EAAE,CACfC,YAAY,CAAE,EAAE,CAChBC,UAAU,CAAE,EAAE,CACdC,aAAa,CAAE,CACbC,cAAc,GAChB,CACF,CAAC,CAACN,OAAA,CAAAC,0BAAA,CAAAA,0BAAA"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { ConfigurationDataType, CampaignConfigurationType, CustomDataConfigurationType, CustomDataScope, VariationByExpositionType, FeatureVariableType, ExperimentItemType, RespoolTimeType, FeatureFlagType, RuleItemType, JSONValue, RuleType, JSONType, } from './types';
|
|
2
|
-
export { CampaignConfiguration } from './campaignConfiguration';
|
|
3
|
-
export { CLEANUP_TARGETING_DATA_INTERVAL } from './constants';
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"CLEANUP_TARGETING_DATA_INTERVAL",{enumerable:!0,get:function get(){return _constants.CLEANUP_TARGETING_DATA_INTERVAL}}),Object.defineProperty(exports,"CampaignConfiguration",{enumerable:!0,get:function get(){return _campaignConfiguration.CampaignConfiguration}}),Object.defineProperty(exports,"CampaignConfigurationType",{enumerable:!0,get:function get(){return _types.CampaignConfigurationType}}),Object.defineProperty(exports,"ConfigurationDataType",{enumerable:!0,get:function get(){return _types.ConfigurationDataType}}),Object.defineProperty(exports,"CustomDataConfigurationType",{enumerable:!0,get:function get(){return _types.CustomDataConfigurationType}}),Object.defineProperty(exports,"CustomDataScope",{enumerable:!0,get:function get(){return _types.CustomDataScope}}),Object.defineProperty(exports,"ExperimentItemType",{enumerable:!0,get:function get(){return _types.ExperimentItemType}}),Object.defineProperty(exports,"FeatureFlagType",{enumerable:!0,get:function get(){return _types.FeatureFlagType}}),Object.defineProperty(exports,"FeatureVariableType",{enumerable:!0,get:function get(){return _types.FeatureVariableType}}),Object.defineProperty(exports,"JSONType",{enumerable:!0,get:function get(){return _types.JSONType}}),Object.defineProperty(exports,"JSONValue",{enumerable:!0,get:function get(){return _types.JSONValue}}),Object.defineProperty(exports,"RespoolTimeType",{enumerable:!0,get:function get(){return _types.RespoolTimeType}}),Object.defineProperty(exports,"RuleItemType",{enumerable:!0,get:function get(){return _types.RuleItemType}}),Object.defineProperty(exports,"RuleType",{enumerable:!0,get:function get(){return _types.RuleType}}),Object.defineProperty(exports,"VariationByExpositionType",{enumerable:!0,get:function get(){return _types.VariationByExpositionType}});var _types=require("./types"),_campaignConfiguration=require("./campaignConfiguration"),_constants=require("./constants");
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/campaignConfiguration/index.ts"],"sourcesContent":["export {\n ConfigurationDataType,\n CampaignConfigurationType,\n CustomDataConfigurationType,\n CustomDataScope,\n VariationByExpositionType,\n FeatureVariableType,\n ExperimentItemType,\n RespoolTimeType,\n FeatureFlagType,\n RuleItemType,\n JSONValue,\n RuleType,\n JSONType,\n} from './types';\nexport { CampaignConfiguration } from './campaignConfiguration';\nexport { CLEANUP_TARGETING_DATA_INTERVAL } from './constants';\n"],"mappings":""}
|
|
@@ -1,2 +0,0 @@
|
|
|
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
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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 } from 'src/storage';\nimport { IExternalStorage, 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: IExternalStorage<ClientDataType>;\n requester: Requester;\n offlineTrackingStorage: IExternalStorage<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"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BrowserCondition=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../../kameleoonData"),_kameleoonError=require("../../kameleoonError"),_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 BrowserCondition=/*#__PURE__*/function(){function a(b){var c=b.browser,d=b.version,e=b.versionMatchType;_classCallCheck(this,a),_defineProperty(this,"browser",void 0),_defineProperty(this,"version",void 0),_defineProperty(this,"versionMatchType",void 0),_defineProperty(this,"error",void 0),this.browser=c,this.version=d,this.versionMatchType=e}return _createClass(a,[{key:"evaluate",value:function evaluate(a){var b=a.targetingData,c=null===b||void 0===b?void 0:b[_kameleoonData.KameleoonData.Browser];if(c){var d=this.checkCondition(c);return this.error?(0,_tsRes.Err)(this.error):(0,_tsRes.Ok)(d)}return(0,_tsRes.Ok)(!1)}},{key:"checkCondition",value:function checkCondition(a){var b=a.browser,c=a.version;if("string"!=typeof this.browser)return!1;if("string"!=typeof this.version)return b===this.browser;if(!this.versionMatchType||"number"!=typeof c)return!1;var d=parseFloat(this.version);switch(isNaN(d)&&(this.error=new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.VersionParse,this.version)),this.versionMatchType){case _types.VersionMatchType.EQUAL:return b===this.browser&&c===d;case _types.VersionMatchType.GREATER:return b===this.browser&&c>d;case _types.VersionMatchType.LOWER:return b===this.browser&&c<d;default:(0,_kameleoonError.exhaustCheck)(this.versionMatchType);}}}]),a}();exports.BrowserCondition=BrowserCondition;
|
|
2
|
-
//# sourceMappingURL=browserCondition.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browserCondition.js","names":["BrowserCondition","a","b","browser","version","versionMatchType","_classCallCheck","_defineProperty","_createClass","key","value","evaluate","targetingData","browserData","KameleoonData","Browser","result","checkCondition","error","Err","Ok","parsedVersion","parseFloat","isNaN","KameleoonError","KameleoonException","VersionParse","VersionMatchType","EQUAL","GREATER","LOWER","exhaustCheck","exports"],"sources":["../../../src/targeting/conditions/browserCondition.ts"],"sourcesContent":["import { Err, Ok, Result } from 'ts-res';\nimport { KameleoonData, BrowserType, BrowserDataType } from 'src/kameleoonData';\nimport {\n exhaustCheck,\n KameleoonError,\n KameleoonException,\n} from 'src/kameleoonError';\nimport { EvaluationDataType, VersionMatchType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class BrowserCondition implements ICondition {\n private browser?: BrowserType | null;\n private version?: string | null;\n private versionMatchType?: VersionMatchType | null;\n private error?: KameleoonError;\n\n constructor({ browser, version, versionMatchType }: ConditionDataType) {\n this.browser = browser;\n this.version = version;\n this.versionMatchType = versionMatchType;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const browserData = targetingData?.[KameleoonData.Browser];\n\n if (browserData) {\n const result = this.checkCondition(browserData);\n\n if (this.error) {\n return Err(this.error);\n }\n\n return Ok(result);\n }\n\n return Ok(false);\n }\n\n private checkCondition(browserData: BrowserDataType): boolean {\n const { browser, version } = browserData;\n\n if (typeof this.browser !== 'string') {\n return false;\n }\n\n if (typeof this.version !== 'string') {\n return browser === this.browser;\n }\n\n if (!this.versionMatchType || typeof version !== 'number') {\n return false;\n }\n\n const parsedVersion = parseFloat(this.version);\n\n if (isNaN(parsedVersion)) {\n this.error = new KameleoonError(\n KameleoonException.VersionParse,\n this.version,\n );\n }\n\n switch (this.versionMatchType) {\n case VersionMatchType.EQUAL:\n return browser === this.browser && version === parsedVersion;\n case VersionMatchType.GREATER:\n return browser === this.browser && version > parsedVersion;\n case VersionMatchType.LOWER:\n return browser === this.browser && version < parsedVersion;\n default:\n exhaustCheck(this.versionMatchType);\n }\n }\n}\n"],"mappings":"s+CAUa,CAAAA,gBAAgB,yBAM3B,SAAAC,EAAAC,CAAA,CAAuE,IAAzD,CAAAC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C,UAAU,CAAC,IAAI,CAAClB,OAAO,CAAC,CAS9C,OAPImB,KAAK,CAACF,CAAa,CAAC,GACtB,IAAI,CAACH,KAAK,CAAG,GAAI,CAAAM,8BAAc,CAC7BC,kCAAkB,CAACC,YAAY,CAC/B,IAAI,CAACtB,OAAO,CACb,EAGK,IAAI,CAACC,gBAAgB,EAC3B,IAAK,CAAAsB,uBAAgB,CAACC,KAAK,CACzB,MAAO,CAAAzB,CAAO,GAAK,IAAI,CAACA,OAAO,EAAIC,CAAO,GAAKiB,CAAa,CAC9D,IAAK,CAAAM,uBAAgB,CAACE,OAAO,CAC3B,MAAO,CAAA1B,CAAO,GAAK,IAAI,CAACA,OAAO,EAAIC,CAAO,CAAGiB,CAAa,CAC5D,IAAK,CAAAM,uBAAgB,CAACG,KAAK,CACzB,MAAO,CAAA3B,CAAO,GAAK,IAAI,CAACA,OAAO,EAAIC,CAAO,CAAGiB,CAAa,CAC5D,QACE,GAAAU,4BAAY,EAAC,IAAI,CAAC1B,gBAAgB,CAAC,CAAC,CAE1C,CAAC,IAAAJ,CAAA,IAAA+B,OAAA,CAAAhC,gBAAA,CAAAA,gBAAA"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConversionCondition=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../../kameleoonData");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 ConversionCondition=/*#__PURE__*/function(){function a(b){var c=b.goalId;_classCallCheck(this,a),_defineProperty(this,"conditionValue",void 0),this.conditionValue=c}return _createClass(a,[{key:"evaluate",value:function evaluate(a){var b=a.targetingData,c=null===b||void 0===b?void 0:b[_kameleoonData.KameleoonData.Conversion];if(c){var d=c.goalId;return(0,_tsRes.Ok)(this.checkCondition(d))}return(0,_tsRes.Ok)(!1)}},{key:"checkCondition",value:function checkCondition(a){return!!this.conditionValue&&(-1===this.conditionValue||a===this.conditionValue);// --- Note ---
|
|
2
|
-
// `goalId` with value `-1` means any goal conversion
|
|
3
|
-
}}]),a}();exports.ConversionCondition=ConversionCondition;
|
|
4
|
-
//# sourceMappingURL=conversionCondition.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conversionCondition.js","names":["ConversionCondition","a","b","goalId","_classCallCheck","_defineProperty","conditionValue","_createClass","key","value","evaluate","targetingData","conversionData","KameleoonData","Conversion","Ok","checkCondition","exports"],"sources":["../../../src/targeting/conditions/conversionCondition.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonData } from 'src/kameleoonData';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { EvaluationDataType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class ConversionCondition implements ICondition {\n private conditionValue?: number | null;\n\n constructor({ goalId }: ConditionDataType) {\n this.conditionValue = goalId;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const conversionData = targetingData?.[KameleoonData.Conversion];\n\n if (conversionData) {\n const { goalId } = conversionData;\n\n return Ok(this.checkCondition(goalId));\n }\n\n return Ok(false);\n }\n\n private checkCondition(goalId: number): boolean {\n if (!this.conditionValue) {\n return false;\n }\n\n // --- Note ---\n // `goalId` with value `-1` means any goal conversion\n if (this.conditionValue === -1) {\n return true;\n }\n\n return goalId === this.conditionValue;\n }\n}\n"],"mappings":"85CAMa,CAAAA,mBAAmB,yBAG9B,SAAAC,EAAAC,CAAA,CAA2C,IAA7B,CAAAC,CAAM,CAAAD,CAAA,CAANC,MAAM,CAAAC,eAAA,MAAAH,CAAA,EAAAI,eAAA,+BAClB,IAAI,CAACC,cAAc,CAAGH,CACxB,CAAC,OAAAI,YAAA,CAAAN,CAAA,GAAAO,GAAA,YAAAC,KAAA,CAED,SAAAC,SAAAT,CAAA,CAEwD,IADtD,CAAAU,CAAa,CAAAV,CAAA,CAAbU,aAAa,CAEPC,CAAc,QAAGD,CAAa,WAAbA,CAAa,QAAbA,CAAa,CAAGE,4BAAa,CAACC,UAAU,CAAC,CAEhE,GAAIF,CAAc,CAAE,CAClB,GAAQ,CAAAT,CAAM,CAAKS,CAAc,CAAzBT,MAAM,CAEd,MAAO,GAAAY,SAAE,EAAC,IAAI,CAACC,cAAc,CAACb,CAAM,CAAC,CACvC,CAEA,MAAO,GAAAY,SAAE,KACX,CAAC,GAAAP,GAAA,kBAAAC,KAAA,CAED,SAAAO,eAAuBb,CAAc,CAAW,SACzC,IAAI,CAACG,cAAc,GAMI,CAAC,CAAC,GAA1B,IAAI,CAACA,cAAqB,EAIvBH,CAAM,GAAK,IAAI,CAACG,cAAc,EANrC;AACA;AAMF,CAAC,IAAAL,CAAA,IAAAgB,OAAA,CAAAjB,mBAAA,CAAAA,mBAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
// `MatchTypeCustomData.TRUE` and `MatchTypeCustomData.FALSE` do not use condition value
|
|
3
|
-
// so we can safely assume that `this.conditionValue` is a string at this point
|
|
4
|
-
var c=this.conditionValue;// --- Note ---
|
|
5
|
-
// `AMONG_VALUES` is checked separately to avoid recursion overhead
|
|
6
|
-
// for `JSON.parse` inside `this.parseArray`
|
|
7
|
-
if(this.matchType===_types.MatchTypeCustomData.AMONG_VALUES){var d=this.parseArray(c);if(!d.ok)return this.error=d.error,!1;var e=new Set(d.data);return Array.isArray(a)?a.some(function(a){return e.has(a)}):d.data.includes(a)}if(Array.isArray(a))return a.some(function(a){return b.checkCondition(a)});switch(this.matchType){case _types.MatchTypeCustomData.CONTAINS:return a.includes(c);case _types.MatchTypeCustomData.EXACT:return a===this.conditionValue;case _types.MatchTypeCustomData.REGULAR_EXPRESSION:return _utilities.Utilities.parseRegExp(c).test(a);case _types.MatchTypeCustomData.LOWER:return+a<+this.conditionValue;case _types.MatchTypeCustomData.EQUAL:return+a===+this.conditionValue;case _types.MatchTypeCustomData.GREATER:return+a>+this.conditionValue;case _types.MatchTypeCustomData.TRUE:return"true"===a.toLowerCase();case _types.MatchTypeCustomData.FALSE:return"false"===a.toLowerCase();default:return!1;}}},{key:"parseArray",value:function parseArray(a){try{var b=JSON.parse(a);if(Array.isArray(b))return(0,_tsRes.Ok)(b)}catch(b){return(0,_tsRes.Err)(new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.AmongValuesCheck,b,a))}return(0,_tsRes.Ok)([])}}]),a}();exports.CustomDataCondition=CustomDataCondition;
|
|
8
|
-
//# sourceMappingURL=customDataCondition.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,CAA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AAK,CAC5B,MAAO,CAAO3B,CAAe,EAAW,IAAI,CAACT,cAAe,CAC9D,IAAK,CAAAe,0BAAmB,CAACsB,KAAK,CAC5B,MAAO,CAAO5B,CAAe,IAAa,IAAI,CAACT,cAAe,CAChE,IAAK,CAAAe,0BAAmB,CAACuB,OAAO,CAC9B,MAAO,CAAO7B,CAAe,EAAW,IAAI,CAACT,cAAe,CAC9D,IAAK,CAAAe,0BAAmB,CAACE,IAAI,CAC3B,MAAyC,MAAM,GAAxCR,CAAe,CAAC8B,WAAW,EAAa,CACjD,IAAK,CAAAxB,0BAAmB,CAACG,KAAK,CAC5B,MAAyC,OAAO,GAAzCT,CAAe,CAAC8B,WAAW,EAAc,CAClD,QACE,SAAa,CAEnB,CAAC,GAAArC,GAAA,cAAAN,KAAA,CAED,SAAAwB,WAAmBxB,CAAa,CAAoC,CAClE,GAAI,CACF,GAAM,CAAAc,CAAM,CAAG8B,IAAI,CAACC,KAAK,CAAC7C,CAAK,CAAC,CAEhC,GAAI6B,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,CAAE9C,CAAK,CAAC,CAEvE,CAEA,MAAO,GAAAkB,SAAE,EAAC,EAAE,CACd,CAAC,IAAAtB,CAAA,IAAAsD,OAAA,CAAAvD,mBAAA,CAAAA,mBAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deviceCondition.js","names":["DeviceCondition","a","b","device","_classCallCheck","_defineProperty","_createClass","key","value","evaluate","targetingData","deviceData","KameleoonData","Device","Ok","exports"],"sources":["../../../src/targeting/conditions/deviceCondition.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { DeviceType, KameleoonData } from 'src/kameleoonData';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { EvaluationDataType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class DeviceCondition implements ICondition {\n private device?: DeviceType | null;\n\n constructor({ device }: ConditionDataType) {\n this.device = device;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const deviceData = targetingData?.[KameleoonData.Device];\n\n if (deviceData) {\n const { device } = deviceData;\n\n return Ok(device === this.device);\n }\n\n return Ok(false);\n }\n}\n"],"mappings":"05CAMa,CAAAA,eAAe,yBAG1B,SAAAC,EAAAC,CAAA,CAA2C,IAA7B,CAAAC,CAAM,CAAAD,CAAA,CAANC,MAAM,CAAAC,eAAA,MAAAH,CAAA,EAAAI,eAAA,uBAClB,IAAI,CAACF,MAAM,CAAGA,CAChB,CAAC,OAAAG,YAAA,CAAAL,CAAA,GAAAM,GAAA,YAAAC,KAAA,CAED,SAAAC,SAAAR,CAAA,CAEwD,IADtD,CAAAS,CAAa,CAAAT,CAAA,CAAbS,aAAa,CAEPC,CAAU,QAAGD,CAAa,WAAbA,CAAa,QAAbA,CAAa,CAAGE,4BAAa,CAACC,MAAM,CAAC,CAExD,GAAIF,CAAU,CAAE,CACd,GAAQ,CAAAR,CAAM,CAAKQ,CAAU,CAArBR,MAAM,CAEd,MAAO,GAAAW,SAAE,EAACX,CAAM,GAAK,IAAI,CAACA,MAAM,CAClC,CAEA,MAAO,GAAAW,SAAE,KACX,CAAC,IAAAb,CAAA,IAAAc,OAAA,CAAAf,eAAA,CAAAA,eAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var _tsRes=require("ts-res");Object.defineProperty(exports,"__esModule",{value:!0}),exports.ExclusiveExperimentCondition=void 0;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 _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 ExclusiveExperimentCondition=/*#__PURE__*/function(){function a(){_classCallCheck(this,a)}return _createClass(a,[{key:"evaluate",value:function evaluate(a){var b=a.experimentId,c=a.variationData,d=Object.keys(c),e=!d.length,f=1===d.length&&d[0]===b+"";return(0,_tsRes.Ok)(e||f)}}]),a}();exports.ExclusiveExperimentCondition=ExclusiveExperimentCondition;
|
|
2
|
-
//# sourceMappingURL=exclusiveExperimentCondition.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exclusiveExperimentCondition.js","names":["_tsRes","require","Object","defineProperty","exports","value","ExclusiveExperimentCondition","_typeof","a","Symbol","iterator","constructor","prototype","_classCallCheck","b","TypeError","_defineProperties","c","d","length","enumerable","configurable","writable","_toPropertyKey","key","_createClass","_toPrimitive","toPrimitive","call","String","Number","evaluate","experimentId","variationData","keys","isEmpty","isExclusive","Ok"],"sources":["../../../src/targeting/conditions/exclusiveExperimentCondition.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { EvaluationDataType } from 'src/targeting/types';\nimport { ICondition } from './types';\n\nexport class ExclusiveExperimentCondition implements ICondition {\n evaluate({\n experimentId,\n variationData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const keys = Object.keys(variationData);\n const isEmpty = !keys.length;\n // --- Note ---\n // Meaning the next variation assignment won't add new experiment\n // but rather overwrite the existing one\n const isExclusive = keys.length === 1 && keys[0] === String(experimentId);\n const isSatisfied = isEmpty || isExclusive;\n\n return Ok(isSatisfied);\n }\n}\n"],"mappings":"aAAA,IAAAA,MAAA,CAAAC,OAAA,WAAoCC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,4BAAA,iBAAAC,QAAAC,CAAA,mCAAAD,OAAA,oBAAAE,MAAA,mBAAAA,MAAA,CAAAC,QAAA,UAAAF,CAAA,gBAAAA,CAAA,WAAAA,CAAA,SAAAA,CAAA,qBAAAC,MAAA,EAAAD,CAAA,CAAAG,WAAA,GAAAF,MAAA,EAAAD,CAAA,GAAAC,MAAA,CAAAG,SAAA,iBAAAJ,CAAA,EAAAD,OAAA,CAAAC,CAAA,WAAAK,gBAAAL,CAAA,CAAAM,CAAA,OAAAN,CAAA,YAAAM,CAAA,YAAAC,SAAA,+CAAAC,kBAAAR,CAAA,CAAAM,CAAA,UAAAG,CAAA,CAAAC,CAAA,GAAAA,CAAA,CAAAJ,CAAA,CAAAK,MAAA,CAAAD,CAAA,GAAAD,CAAA,CAAAH,CAAA,CAAAI,CAAA,EAAAD,CAAA,CAAAG,UAAA,CAAAH,CAAA,CAAAG,UAAA,KAAAH,CAAA,CAAAI,YAAA,cAAAJ,CAAA,GAAAA,CAAA,CAAAK,QAAA,KAAApB,MAAA,CAAAC,cAAA,CAAAK,CAAA,CAAAe,cAAA,CAAAN,CAAA,CAAAO,GAAA,EAAAP,CAAA,WAAAQ,aAAAjB,CAAA,CAAAM,CAAA,CAAAG,CAAA,SAAAH,CAAA,EAAAE,iBAAA,CAAAR,CAAA,CAAAI,SAAA,CAAAE,CAAA,EAAAG,CAAA,EAAAD,iBAAA,CAAAR,CAAA,CAAAS,CAAA,EAAAf,MAAA,CAAAC,cAAA,CAAAK,CAAA,cAAAc,QAAA,MAAAd,CAAA,UAAAe,eAAAf,CAAA,MAAAM,CAAA,CAAAY,YAAA,CAAAlB,CAAA,4BAAAD,OAAA,CAAAO,CAAA,EAAAA,CAAA,CAAAA,CAAA,aAAAY,aAAAlB,CAAA,CAAAM,CAAA,gBAAAP,OAAA,CAAAC,CAAA,UAAAA,CAAA,QAAAA,CAAA,KAAAS,CAAA,CAAAT,CAAA,CAAAC,MAAA,CAAAkB,WAAA,KAAAV,CAAA,eAAAC,CAAA,CAAAD,CAAA,CAAAW,IAAA,CAAApB,CAAA,CAAAM,CAAA,2BAAAP,OAAA,CAAAW,CAAA,SAAAA,CAAA,WAAAH,SAAA,mEAAAD,CAAA,CAAAe,MAAA,CAAAC,MAAA,EAAAtB,CAAA,KAKvB,CAAAF,4BAA4B,kCAAAE,EAAA,EAAAK,eAAA,MAAAL,CAAA,SAAAiB,YAAA,CAAAjB,CAAA,GAAAgB,GAAA,YAAAnB,KAAA,CACvC,SAAA0B,SAAAvB,CAAA,CAGwD,IAFtD,CAAAwB,CAAY,CAAAxB,CAAA,CAAZwB,YAAY,CACZC,CAAa,CAAAzB,CAAA,CAAbyB,aAAa,CAEPC,CAAI,CAAGhC,MAAM,CAACgC,IAAI,CAACD,CAAa,CAAC,CACjCE,CAAO,CAAG,CAACD,CAAI,CAACf,MAAM,CAItBiB,CAAW,CAAmB,CAAC,GAAjBF,CAAI,CAACf,MAAY,EAAIe,CAAI,CAAC,CAAC,CAAC,GAAYF,CAAY,GAAC,CAGzE,MAAO,GAAAK,SAAE,EAFWF,CAAO,EAAIC,CAAW,CAG5C,CAAC,IAAA5B,CAAA,IAAAJ,OAAA,CAAAE,4BAAA,CAAAA,4BAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PageTitleCondition=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 PageTitleCondition=/*#__PURE__*/function(){function a(b){var c=b.matchType,d=b.title;_classCallCheck(this,a),_defineProperty(this,"matchType",void 0),_defineProperty(this,"conditionValue",void 0),this.matchType=c,this.conditionValue=d}return _createClass(a,[{key:"evaluate",value:function evaluate(a){var b=a.targetingData,c=null===b||void 0===b?void 0:b[_kameleoonData.KameleoonData.PageView];if(c){var d=c.title;return(0,_tsRes.Ok)(this.checkCondition(d))}return(0,_tsRes.Ok)(!1)}},{key:"checkCondition",value:function checkCondition(a){if(!this.matchType||!this.conditionValue)return!1;switch(this.matchType){case _types.MatchType.CONTAINS:return a.includes(this.conditionValue);case _types.MatchType.EXACT:return a===this.conditionValue;case _types.MatchType.REGULAR_EXPRESSION:return _utilities.Utilities.parseRegExp(this.conditionValue).test(a);default:(0,_kameleoonError.exhaustCheck)(this.matchType);}}}]),a}();exports.PageTitleCondition=PageTitleCondition;
|
|
2
|
-
//# sourceMappingURL=pageTitleCondition.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pageTitleCondition.js","names":["PageTitleCondition","a","b","matchType","title","_classCallCheck","_defineProperty","conditionValue","_createClass","key","value","evaluate","targetingData","pageViewData","KameleoonData","PageView","Ok","checkCondition","MatchType","CONTAINS","includes","EXACT","REGULAR_EXPRESSION","Utilities","parseRegExp","test","exhaustCheck","exports"],"sources":["../../../src/targeting/conditions/pageTitleCondition.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonData } from 'src/kameleoonData';\nimport { exhaustCheck, KameleoonError } from 'src/kameleoonError';\nimport { Utilities } from 'src/utilities';\nimport { EvaluationDataType, MatchType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class PageTitleCondition implements ICondition {\n private matchType?: MatchType | null;\n private conditionValue?: string | null;\n\n constructor({ matchType, title }: ConditionDataType) {\n this.matchType = matchType;\n this.conditionValue = title;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const pageViewData = targetingData?.[KameleoonData.PageView];\n\n if (pageViewData) {\n const { title } = pageViewData;\n\n return Ok(this.checkCondition(title));\n }\n\n return Ok(false);\n }\n\n private checkCondition(title: string): boolean {\n if (!this.matchType || !this.conditionValue) {\n return false;\n }\n\n switch (this.matchType) {\n case MatchType.CONTAINS:\n return title.includes(this.conditionValue);\n case MatchType.EXACT:\n return title === this.conditionValue;\n case MatchType.REGULAR_EXPRESSION:\n return Utilities.parseRegExp(this.conditionValue).test(title);\n default:\n exhaustCheck(this.matchType);\n }\n }\n}\n"],"mappings":"8gDAOa,CAAAA,kBAAkB,yBAI7B,SAAAC,EAAAC,CAAA,CAAqD,IAAvC,CAAAC,CAAS,CAAAD,C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AA,CAAAA,kBAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PageUrlCondition=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 PageUrlCondition=/*#__PURE__*/function(){function a(b){var c=b.matchType,d=b.url;_classCallCheck(this,a),_defineProperty(this,"matchType",void 0),_defineProperty(this,"conditionValue",void 0),this.matchType=c,this.conditionValue=d}return _createClass(a,[{key:"evaluate",value:function evaluate(a){var b=a.targetingData,c=null===b||void 0===b?void 0:b[_kameleoonData.KameleoonData.PageView];if(c){var d=c.urlAddress;return(0,_tsRes.Ok)(this.checkCondition(d))}return(0,_tsRes.Ok)(!1)}},{key:"checkCondition",value:function checkCondition(a){if(!this.matchType||!this.conditionValue)return!1;switch(this.matchType){case _types.MatchType.CONTAINS:return a.includes(this.conditionValue);case _types.MatchType.EXACT:return a===this.conditionValue;case _types.MatchType.REGULAR_EXPRESSION:return _utilities.Utilities.parseRegExp(this.conditionValue).test(a);default:(0,_kameleoonError.exhaustCheck)(this.matchType);}}}]),a}();exports.PageUrlCondition=PageUrlCondition;
|
|
2
|
-
//# sourceMappingURL=pageUrlCondition.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pageUrlCondition.js","names":["PageUrlCondition","a","b","matchType","url","_classCallCheck","_defineProperty","conditionValue","_createClass","key","value","evaluate","targetingData","pageViewData","KameleoonData","PageView","urlAddress","Ok","checkCondition","MatchType","CONTAINS","includes","EXACT","REGULAR_EXPRESSION","Utilities","parseRegExp","test","exhaustCheck","exports"],"sources":["../../../src/targeting/conditions/pageUrlCondition.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonData } from 'src/kameleoonData';\nimport { exhaustCheck, KameleoonError } from 'src/kameleoonError';\nimport { Utilities } from 'src/utilities';\nimport { EvaluationDataType, MatchType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class PageUrlCondition implements ICondition {\n private matchType?: MatchType | null;\n private conditionValue?: string | null;\n\n constructor({ matchType, url }: ConditionDataType) {\n this.matchType = matchType;\n this.conditionValue = url;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const pageViewData = targetingData?.[KameleoonData.PageView];\n\n if (pageViewData) {\n const { urlAddress } = pageViewData;\n\n return Ok(this.checkCondition(urlAddress));\n }\n\n return Ok(false);\n }\n\n private checkCondition(url: string): boolean {\n if (!this.matchType || !this.conditionValue) {\n return false;\n }\n\n switch (this.matchType) {\n case MatchType.CONTAINS:\n return url.includes(this.conditionValue);\n case MatchType.EXACT:\n return url === this.conditionValue;\n case MatchType.REG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WAAW,CAAC,IAAI,CAAClB,cAAc,CAAC,CAACmB,IAAI,CAACtB,CAAG,CAAC,CAC7D,QACE,GAAAuB,4BAAY,EAAC,IAAI,CAACxB,SAAS,CAAC,CAAC,CAEnC,CAAC,IAAAF,CAAA,IAAA2B,OAAA,CAAA5B,gBAAA,CAAAA,gBAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SdkLanguageCondition=void 0;var _tsRes=require("ts-res"),_kameleoonError=require("../../kameleoonError"),_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 _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _iterableToArrayLimit(a,b){var c=null==a?null:"undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(null!=c){var d,e,f,g,h=[],i=!0,j=!1;try{if(f=(c=c.call(a)).next,0===b){if(Object(c)!==c)return;i=!1}else for(;!(i=(d=f.call(c)).done)&&(h.push(d.value),h.length!==b);i=!0);}catch(a){j=!0,e=a}finally{try{if(!i&&null!=c.return&&(g=c.return(),Object(g)!==g))return}finally{if(j)throw e}}return h}}function _arrayWithHoles(a){if(Array.isArray(a))return a}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _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 SdkLanguageCondition=/*#__PURE__*/function(){function a(b){var c=b.sdkLanguage,d=b.version,e=b.versionMatchType;_classCallCheck(this,a),_defineProperty(this,"sdkLanguage",void 0),_defineProperty(this,"conditionValue",void 0),_defineProperty(this,"versionMatchType",void 0),_defineProperty(this,"error",void 0),this.sdkLanguage=c,this.conditionValue=d,this.versionMatchType=e}return _createClass(a,[{key:"evaluate",value:function evaluate(a){var b=a.sdkInfo,c=this.checkCondition(b);return this.error?(0,_tsRes.Err)(this.error):(0,_tsRes.Ok)(c)}},{key:"checkCondition",value:function checkCondition(a){var b=a.type,c=a.version;return!!this.sdkLanguage&&("string"==typeof this.conditionValue?!!this.versionMatchType&&b===this.sdkLanguage&&this.compareSemVer({version:c,compareVersion:this.conditionValue,operator:this.versionMatchType}):b===this.sdkLanguage)}},{key:"compareSemVer",value:function compareSemVer(a){var b=a.version,c=a.compareVersion,d=a.operator,e=this.validateVersion(b),f=_slicedToArray(e,3),g=f[0],h=f[1],i=f[2],j=this.validateVersion(c),k=_slicedToArray(j,3),l=k[0],m=k[1],n=k[2],o=g===l,p=h===m;switch(d){case _types.VersionMatchType.EQUAL:return o&&p&&i===n;case _types.VersionMatchType.GREATER:return g>l||o&&h>m||o&&p&&i>n;case _types.VersionMatchType.LOWER:return g<l||o&&h<m||o&&p&&i<n;default:(0,_kameleoonError.exhaustCheck)(d);}}},{key:"validateVersion",value:function validateVersion(a){var b=a.split(".");return b.some(function isBadVersion(a){return isNaN(parseInt(a))||0===a.length})||3!==b.length?(this.error=new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.SemanticVersionParse,a),[0,0,0]):b.map(function(a){return parseInt(a)})}}]),a}();exports.SdkLanguageCondition=SdkLanguageCondition;
|
|
2
|
-
//# sourceMappingURL=sdkLanguageCondition.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sdkLanguageCondition.js","names":["SdkLanguageCondition","a","b","sdkLanguage","version","versionMatchType","_classCallCheck","_defineProperty","conditionValue","_createClass","key","value","evaluate","sdkInfo","result","checkCondition","error","Err","Ok","sdkType","type","compareSemVer","compareVersion","operator","e","validateVersion","f","_slicedToArray","major","minor","patch","j","k","compareMajor","compareMinor","comparePatch","isMajorEqual","isMinorEqual","VersionMatchType","EQUAL","GREATER","LOWER","exhaustCheck","versionSplit","split","some","isBadVersion","item","isNaN","parseInt","length","KameleoonError","KameleoonException","SemanticVersionParse","map","exports"],"sources":["../../../src/targeting/conditions/sdkLanguageCondition.ts"],"sourcesContent":["import { Err, Ok, Result } from 'ts-res';\nimport { SdkLanguageType } from 'src/constants';\nimport {\n exhaustCheck,\n KameleoonError,\n KameleoonException,\n} from 'src/kameleoonError';\nimport { ExternalPackageInfoType } from 'src/types';\nimport { EvaluationDataType, VersionMatchType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class SdkLanguageCondition implements ICondition {\n private sdkLanguage?: SdkLanguageType | null;\n private conditionValue?: string | null;\n private versionMatchType?: VersionMatchType | null;\n private error?: KameleoonError;\n\n constructor({ sdkLanguage, version, versionMatchType }: ConditionDataType) {\n this.sdkLanguage = sdkLanguage;\n this.conditionValue = version;\n this.versionMatchType = versionMatchType;\n }\n\n public evaluate({\n sdkInfo,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const result = this.checkCondition(sdkInfo);\n\n if (this.error) {\n return Err(this.error);\n }\n\n return Ok(result);\n }\n\n private checkCondition(sdkInfo: ExternalPackageInfoType): boolean {\n const { type: sdkType, version } = sdkInfo;\n\n if (!this.sdkLanguage) {\n return false;\n }\n\n if (typeof this.conditionValue !== 'string') {\n return sdkType === this.sdkLanguage;\n }\n\n if (!this.versionMatchType) {\n return false;\n }\n\n return (\n sdkType === this.sdkLanguage &&\n this.compareSemVer({\n version,\n compareVersion: this.conditionValue,\n operator: this.versionMatchType,\n })\n );\n }\n\n private compareSemVer({\n version,\n compareVersion,\n operator,\n }: {\n version: string;\n compareVersion: string;\n operator: VersionMatchType;\n }): boolean {\n const [major, minor, patch] = this.validateVersion(version);\n const [compareMajor, compareMinor, comparePatch] =\n this.validateVersion(compareVersion);\n\n const [isMajorEqual, isMinorEqual, isPatchEqual] = [\n major === compareMajor,\n minor === compareMinor,\n patch === comparePatch,\n ];\n\n switch (operator) {\n case VersionMatchType.EQUAL:\n return isMajorEqual && isMinorEqual && isPatchEqual;\n case VersionMatchType.GREATER:\n return (\n major > compareMajor ||\n (isMajorEqual && minor > compareMinor) ||\n (isMajorEqual && isMinorEqual && patch > comparePatch)\n );\n case VersionMatchType.LOWER:\n return (\n major < compareMajor ||\n (isMajorEqual && minor < compareMinor) ||\n (isMajorEqual && isMinorEqual && patch < comparePatch)\n );\n default:\n exhaustCheck(operator);\n }\n }\n\n private validateVersion(version: string): [number, number, number] {\n const versionSplit = version.split('.');\n const isBadVersion = (item: string) =>\n isNaN(parseInt(item)) || item.length === 0;\n\n if (versionSplit.some(isBadVersion) || versionSplit.length !== 3) {\n this.error = new KameleoonError(\n KameleoonException.SemanticVersionParse,\n version,\n );\n\n return [0, 0, 0];\n }\n\n return versionSplit.map((item) => parseInt(item)) as [\n number,\n number,\n number,\n ];\n }\n}\n"],"mappings":"yqFAWa,CAAAA,oBAAoB,yBAM/B,SAAAC,EAAAC,CAAA,CAA2E,IAA7D,CAAAC,CAAW,CAAAD,CAAA,CAAXC,WAAW,CAAEC,CAAO,CAAAF,CAAA,CAAPE,OAAO,CAAEC,CAAgB,CAAAH,CAAA,CAAhBG,gBAAgB,CAAAC,eAAA,MAAAL,CAAA,EAAAM,eAAA,4BAAAA,eAAA,+BAAAA,eAAA,iCAAAA,eAAA,sBAClD,IAAI,CAACJ,WAAW,CAAGA,CAAW,CAC9B,IAAI,CAACK,cAAc,CAAGJ,CAAO,CAC7B,IAAI,CAACC,gBAAgB,CAAGA,CAC1B,CAAC,OAAAI,YAAA,CAAAR,CAAA,GAAAS,GAAA,YAAAC,KAAA,CAED,SAAAC,SAAAX,CAAA,CAEwD,IADtD,CAAAY,CAAO,CAAAZ,CAAA,CAAPY,OAAO,CAEDC,CAAM,CAAG,IAAI,CAACC,cAAc,CAACF,CAAO,CAAC,OAEvC,KAAI,CAACG,KAAK,CACL,GAAAC,UAAG,EAAC,IAAI,CAACD,KAAK,CAAC,CAGjB,GAAAE,SAAE,EAACJ,CAAM,CAClB,CAAC,GAAAJ,GAAA,kBAAAC,KAAA,CAED,SAAAI,eAAuBF,CAAgC,CAAW,CAChE,GAAc,CAAAM,CAAO,CAAcN,CAAO,CAAlCO,IAAI,CAAWhB,CAAO,CAAKS,CAAO,CAAnBT,OAAO,CAAa,QAEtC,IAAI,CAACD,WAAW,GAIc,QAAQ,EAAvC,MAAO,KAAI,CAACK,cAA2B,GAItC,IAAI,CAACH,gBAAgB,EAKxBc,CAAO,GAAK,IAAI,CAAChB,WAAW,EAC5B,IAAI,CAACkB,aAAa,CAAC,CACjBjB,OAAO,CAAPA,CA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AAa,CAE1D,QACE,GAAAO,4BAAY,EAACnB,CAAQ,CAAC,CAAC,CAE7B,CAAC,GAAAb,GAAA,mBAAAC,KAAA,CAED,SAAAc,gBAAwBrB,CAAe,CAA4B,IAC3D,CAAAuC,CAAY,CAAGvC,CAAO,CAACwC,KAAK,CAAC,GAAG,CAAC,OAInC,CAAAD,CAAY,CAACE,IAAI,CAHA,QAAf,CAAAC,YAAYA,CAAIC,CAAY,QAChC,CAAAC,KAAK,CAACC,QAAQ,CAACF,CAAI,CAAC,CAAC,EAAoB,CAAC,GAAjBA,CAAI,CAACG,MAAY,EAET,EAA4B,CAAC,GAAzBP,CAAY,CAACO,MAAY,EAC9D,IAAI,CAAClC,KAAK,CAAG,GAAI,CAAAmC,8BAAc,CAC7BC,kCAAkB,CAACC,oBAAoB,CACvCjD,CAAO,CACR,CAEM,CAAC,CAAC,CAAE,CAAC,CAAE,CAAC,CAAC,EAGXuC,CAAY,CAACW,GAAG,CAAC,SAACP,CAAI,QAAK,CAAAE,QAAQ,CAACF,CAAI,CAAC,EAKlD,CAAC,IAAA9C,CAAA,IAAAsD,OAAA,CAAAvD,oBAAA,CAAAA,oBAAA"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Result } from 'ts-res';
|
|
2
|
-
import { KameleoonError } from '../../kameleoonError';
|
|
3
|
-
import { EvaluationDataType } from '../../targeting/types';
|
|
4
|
-
import { ConditionDataType, ICondition } from './types';
|
|
5
|
-
export declare class TargetExperimentCondition implements ICondition {
|
|
6
|
-
private experimentId?;
|
|
7
|
-
private variationId?;
|
|
8
|
-
private matchType?;
|
|
9
|
-
constructor({ variation, experiment, variationMatchType, }: ConditionDataType);
|
|
10
|
-
evaluate({ variationData, }: EvaluationDataType): Result<boolean, KameleoonError>;
|
|
11
|
-
private checkCondition;
|
|
12
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"targetExperimentCondition.js","names":["TargetExperimentCondition","a","b","variation","experiment","variationMatchType","_classCallCheck","_defineProperty","experimentId","variationId","matchType","_createClass","key","value","evaluate","variationData","Ok","MatchTypeVariation","EXACT","result","checkCondition","ANY","exports"],"sources":["../../../src/targeting/conditions/targetExperimentCondition.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { ExperimentVariationsType } from 'src/storage';\nimport { EvaluationDataType, MatchTypeVariation } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class TargetExperimentCondition implements ICondition {\n private experimentId?: number | null;\n private variationId?: number | null;\n private matchType?: MatchTypeVariation | null;\n\n constructor({\n variation,\n experiment,\n variationMatchType,\n }: ConditionDataType) {\n this.experimentId = experiment;\n this.variationId = variation;\n this.matchType = variationMatchType;\n }\n\n public evaluate({\n variationData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n if (!this.experimentId) {\n return Ok(false);\n }\n\n if (this.matchType === MatchTypeVariation.EXACT && !this.variationId) {\n Ok(false);\n }\n\n const result = this.checkCondition({\n variationId: this.variationId,\n experimentId: this.experimentId,\n variationData,\n });\n\n return Ok(result);\n }\n\n private checkCondition({\n variationId,\n experimentId,\n variationData,\n }: {\n variationId?: number | null;\n experimentId: number;\n variationData: ExperimentVariationsType;\n }): boolean {\n const experimentIdString = String(experimentId);\n const variation = variationData[experimentIdString];\n\n switch (this.matchType) {\n case MatchTypeVariation.EXACT: {\n return variation?.variationId === variationId;\n }\n case MatchTypeVariation.ANY:\n return Boolean(variation);\n default:\n return false;\n }\n }\n}\n"],"mappings":"i5CAMa,CAAAA,yBAAyB,yBAKpC,SAAAC,EAAAC,CAAA,CAIsB,IAHpB,CAAAC,CAAS,CAAAD,CAAA,CAATC,SAAS,CACTC,CAAU,CAAAF,CAAA,CAAVE,UAAU,CACVC,CAAkB,CAAAH,CAAA,CAAlBG,kBAAkB,CAAAC,eAAA,MAAAL,CAAA,EAAAM,eAAA,6BAAAA,eAAA,4BAAAA,eAAA,0BAElB,IAAI,CA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),exports.VisitorCodeCondition=void 0;var _tsRes=require("ts-res"),_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 VisitorCodeCondition=/*#__PURE__*/function(){function a(b){var c=b.visitorCode,d=b.matchType;_classCallCheck(this,a),_defineProperty(this,"matchType",void 0),_defineProperty(this,"conditionValue",void 0),this.matchType=d,this.conditionValue=c}return _createClass(a,[{key:"evaluate",value:function evaluate(a){var b=a.visitorCode;return(0,_tsRes.Ok)(this.checkCondition(b))}},{key:"checkCondition",value:function checkCondition(a){if(!this.matchType||!this.conditionValue)return!1;switch(this.matchType){case _types.MatchType.CONTAINS:return a.includes(this.conditionValue);case _types.MatchType.EXACT:return a===this.conditionValue;case _types.MatchType.REGULAR_EXPRESSION:return _utilities.Utilities.parseRegExp(this.conditionValue).test(a);default:(0,_kameleoonError.exhaustCheck)(this.matchType);}}}]),a}();exports.VisitorCodeCondition=VisitorCodeCondition;
|
|
2
|
-
//# sourceMappingURL=visitorCodeCondition.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"visitorCodeCondition.js","names":["VisitorCodeCondition","a","b","visitorCode","matchType","_classCallCheck","_defineProperty","conditionValue","_createClass","key","value","evaluate","Ok","checkCondition","MatchType","CONTAINS","includes","EXACT","REGULAR_EXPRESSION","Utilities","parseRegExp","test","exhaustCheck","exports"],"sources":["../../../src/targeting/conditions/visitorCodeCondition.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { exhaustCheck, KameleoonError } from 'src/kameleoonError';\nimport { Utilities } from 'src/utilities';\nimport { EvaluationDataType, MatchType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class VisitorCodeCondition implements ICondition {\n private matchType?: MatchType | null;\n private conditionValue?: string | null;\n\n constructor({ visitorCode, matchType }: ConditionDataType) {\n this.matchType = matchType;\n this.conditionValue = visitorCode;\n }\n\n public evaluate({\n visitorCode,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n return Ok(this.checkCondition(visitorCode));\n }\n\n private checkCondition(visitorCode: string): boolean {\n if (!this.matchType || !this.conditionValue) {\n return false;\n }\n\n switch (this.matchType) {\n case MatchType.CONTAINS:\n return visitorCode.includes(this.conditionValue);\n case MatchType.EXACT:\n return visitorCode === this.conditionValue;\n case MatchType.REGULAR_EXPRESSION:\n return Utilities.parseRegExp(this.conditionValue).test(visitorCode);\n default:\n exhaustCheck(this.matchType);\n }\n }\n}\n"],"mappings":"k+CAMa,CAAAA,oBAAoB,yBAI/B,SAAAC,EAAAC,CAAA,CAA2D,IAA7C,CAAAC,CAAW,CAAAD,CAAA,CAAXC,WAAW,CAAEC,CAAS,CAAAF,CAAA,CAATE,SAAS,CAAAC,eAAA,MAAAJ,CAAA,EAAAK,eAAA,0BAAAA,eAAA,+BAClC,IAAI,CAACF,SAAS,CAAGA,CAAS,CAC1B,IAAI,CAACG,cAAc,CAAGJ,CACxB,CAAC,OAAAK,YAAA,CAAAP,CAAA,GAAAQ,GAAA,YAAAC,KAAA,CAED,SAAAC,SAAAV,CAAA,CAEwD,IADtD,CAAAE,CAAW,CAAAF,CAAA,CAAXE,WAAW,CAEX,MAAO,GAAAS,SAAE,EAAC,IAAI,CAACC,cAAc,CAACV,CAAW,CAAC,CAC5C,CAAC,GAAAM,GAAA,kBAAAC,KAAA,CAED,SAAAG,eAAuBV,CAAmB,CAAW,CACnD,GAAI,CAAC,IAAI,CAACC,SAAS,EAAI,CAAC,IAAI,CAACG,cAAc,CACzC,SAGF,OAAQ,IAAI,CAACH,SAAS,EACpB,IAAK,CAAAU,gBAAS,CAACC,QAAQ,CACrB,MAAO,CAAAZ,CAAW,CAACa,QAAQ,CAAC,IAAI,CAACT,cAAc,CAAC,CAClD,IAAK,CAAAO,gBAAS,CAACG,KAAK,CAClB,MAAO,CAAAd,CAAW,GAAK,IAAI,CAACI,cAAc,CAC5C,IAAK,CAAAO,gBAAS,CAACI,kBAAkB,CAC/B,MAAO,CAAAC,oBAAS,CAACC,WAAW,CAAC,IAAI,CAACb,cAAc,CAAC,CAACc,IAAI,CAAClB,CAAW,CAAC,CACrE,QACE,GAAAmB,4BAAY,EAAC,IAAI,CAAClB,SAAS,CAAC,CAAC,CAEnC,CAAC,IAAAH,CAAA,IAAAsB,OAAA,CAAAvB,oBAAA,CAAAA,oBAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TargetingNode=void 0;var _conditions=require("./conditions"),_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 TargetingNode=/*#__PURE__*/function(){function a(b,c,d){if(_classCallCheck(this,a),_defineProperty(this,"nodeValue",void 0),_defineProperty(this,"nodeError",void 0),_defineProperty(this,"leftChild",void 0),_defineProperty(this,"rightChild",void 0),_defineProperty(this,"inverseResult",!1),this.isOperator(b))this.nodeValue=b;else{var e,f=_conditions.ConditionFactory.createCondition(b);this.inverseResult=null!==(e=b.isInclude)&&void 0!==e&&!e,f.ok?this.nodeValue=f.data:this.nodeError=f.error}this.leftChild=c,this.rightChild=d}return _createClass(a,[{key:"value",get:function get(){return this.nodeValue}},{key:"error",get:function get(){return this.nodeError}},{key:"left",get:function get(){return this.leftChild}},{key:"right",get:function get(){return this.rightChild}},{key:"inverse",get:function get(){return this.inverseResult}},{key:"isOperator",value:function isOperator(a){return a===_types.Operator.And||a===_types.Operator.Or}}]),a}();exports.TargetingNode=TargetingNode;
|
|
2
|
-
//# sourceMappingURL=targetingNode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"targetingNode.js","names":["TargetingNode","a","value","left","right","_classCallCheck","_defineProperty","isOperator","nodeValue","e","result","ConditionFactory","createCondition","inverseResult","isInclude","ok","data","nodeError","error","leftChild","rightChild","_createClass","key","get","Operator","And","Or","exports"],"sources":["../../src/targeting/targetingNode.ts"],"sourcesContent":["import { KameleoonError } from 'src/kameleoonError';\nimport { ConditionFactory, ConditionDataType } from './conditions';\nimport { NodeValueType, Operator } from './types';\n\nexport interface ITargetingNode {\n readonly value?: NodeValueType;\n readonly left?: ITargetingNode;\n readonly right?: ITargetingNode;\n readonly error?: KameleoonError;\n}\n\nexport class TargetingNode implements ITargetingNode {\n private nodeValue?: NodeValueType;\n private nodeError?: KameleoonError;\n private leftChild?: ITargetingNode;\n private rightChild?: ITargetingNode;\n private inverseResult: boolean = false;\n\n constructor(\n value: ConditionDataType | Operator,\n left?: ITargetingNode,\n right?: ITargetingNode,\n ) {\n if (this.isOperator(value)) {\n this.nodeValue = value;\n } else {\n const result = ConditionFactory.createCondition(value);\n this.inverseResult = !(value.isInclude ?? true);\n\n if (result.ok) {\n this.nodeValue = result.data;\n } else {\n this.nodeError = result.error;\n }\n }\n\n this.leftChild = left;\n this.rightChild = right;\n }\n\n get value(): NodeValueType | undefined {\n return this.nodeValue;\n }\n\n get error(): KameleoonError | undefined {\n return this.nodeError;\n }\n\n get left(): ITargetingNode | undefined {\n return this.leftChild;\n }\n\n get right(): ITargetingNode | undefined {\n return this.rightChild;\n }\n\n get inverse(): boolean {\n return this.inverseResult;\n }\n\n private isOperator(value: ConditionDataType | Operator): value is Operator {\n return value === Operator.And || value === Operator.Or;\n }\n}\n"],"mappings":"+4CAWa,CAAAA,aAAa,yBAOxB,SAAAC,EACEC,CAAmC,CACnCC,CAAqB,CACrBC,CAAsB,CACtB,CACA,GAAAC,eAAA,MAAAJ,CAAA,EAAAK,eAAA,0BAAAA,eAAA,0BAAAA,eAAA,0BAAAA,eAAA,2BAAAA,eAAA,0BAAI,IAAI,CAACC,UAAU,CAACL,CAAK,CAAC,CACxB,IAAI,CAACM,SAAS,CAAGN,CAAK,KACjB,KAAAO,CAAA,CACCC,CAAM,CAAGC,4BAAgB,CAACC,eAAe,CAACV,CAAK,CAAC,CACtD,IAAI,CAACW,aAAa,SAAAJ,CAAA,CAAKP,CAAK,CAACY,SAAS,YAAAL,CAAA,GAAAA,CAAS,CAE3CC,CAAM,CAACK,EAAE,CACX,IAAI,CAACP,SAAS,CAAGE,CAAM,CAACM,IAAI,CAE5B,IAAI,CAACC,SAAS,CAAGP,CAAM,CAACQ,KAE5B,CAEA,IAAI,CAACC,SAAS,CAAGhB,CAAI,CACrB,IAAI,CAACiB,UAAU,CAAGhB,CACpB,CAAC,OAAAiB,YAAA,CAAApB,CAAA,GAAAqB,GAAA,SAAAC,GAAA,CAED,SAAAA,IAAA,CAAuC,CACrC,MAAO,KAAI,CAACf,SACd,CAAC,GAAAc,GAAA,SAAAC,GAAA,CAED,SAAAA,IAAA,CAAwC,CACtC,MAAO,KAAI,CAACN,SACd,CAAC,GAAAK,GAAA,QAAAC,GAAA,CAED,SAAAA,IAAA,CAAuC,CACrC,MAAO,KAAI,CAACJ,SACd,CAAC,GAAAG,GAAA,SAAAC,GAAA,CAED,SAAAA,IAAA,CAAwC,CACtC,MAAO,KAAI,CAACH,UACd,CAAC,GAAAE,GAAA,WAAAC,GAAA,CAED,SAAAA,IAAA,CAAuB,CACrB,MAAO,KAAI,CAACV,aACd,CAAC,GAAAS,GAAA,cAAApB,KAAA,CAED,SAAAK,WAAmBL,CAAmC,CAAqB,CACzE,MAAO,CAAAA,CAAK,GAAKsB,eAAQ,CAACC,GAAG,EAAIvB,CAAK,GAAKsB,eAAQ,CAACE,EACtD,CAAC,IAAAzB,CAAA,IAAA0B,OAAA,CAAA3B,aAAA,CAAAA,aAAA"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TargetingTree=void 0;var _tsRes=require("ts-res"),_kameleoonError=require("../kameleoonError"),_targetingNode=require("./targetingNode"),_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 _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 _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 TargetingTree=/*#__PURE__*/function(){function a(b){var c=this;_classCallCheck(this,a),_defineProperty(this,"tree",void 0),_defineProperty(this,"error",null);var d=this.flattenSegment(b),e=d.nestedConditions,f=d.topLevelOperators,g=e.map(function(a){var b=a.conditions,d=a.operators,e=b.map(function(a){return new _targetingNode.TargetingNode(a)});return c.buildTree(e,d)});// --- Note ---
|
|
2
|
-
// - Targeting tree is built bottom-up, it's the only way to both get the consistent logic
|
|
3
|
-
// (grouping nested conditions) and have human readable tree representation.
|
|
4
|
-
// - Here is an example of how tree is built (we use strict complete binary tree)
|
|
5
|
-
// Let's say we have such a condition `value < 10 || value > 20 && value < 30`
|
|
6
|
-
// Following is pseudo code for building tree:
|
|
7
|
-
//
|
|
8
|
-
// `const operators = [Operator.Or, Operator.And]`
|
|
9
|
-
// `const conditions = [
|
|
10
|
-
// {type: Condition.Less, value: 10},
|
|
11
|
-
// {type: Condition.Greater, value: 20},
|
|
12
|
-
// {type: Condition.Less, value: 30},
|
|
13
|
-
// ]`
|
|
14
|
-
//
|
|
15
|
-
// After the first iteration we have node like this:
|
|
16
|
-
// AND
|
|
17
|
-
// / \
|
|
18
|
-
// <30 >20
|
|
19
|
-
//
|
|
20
|
-
// After the second iteration tree looks as follows:
|
|
21
|
-
// OR
|
|
22
|
-
// / \
|
|
23
|
-
// AND <10
|
|
24
|
-
// / \
|
|
25
|
-
// <30 >20
|
|
26
|
-
//
|
|
27
|
-
// As you can see Leaf Nodes contain conditions and Non-Leaf Nodes contain logical operators
|
|
28
|
-
this.tree=this.buildTree(g,f)}return _createClass(a,[{key:"evaluate",value:function evaluate(a){var b=this.evaluateNode(this.tree,a);return this.error?(0,_tsRes.Err)(this.error):(0,_tsRes.Ok)(b)}},{key:"evaluateNode",value:function evaluateNode(a,b){if(this.isLeafNode(a)){if(a.error)// --- Note ---
|
|
29
|
-
// Non-existing condition should not break targeting tree
|
|
30
|
-
// instead it should be treated as `true` condition
|
|
31
|
-
return a.error.type===_kameleoonError.KameleoonException.TargetingCondition;var c=a.value.evaluate(b);return c.ok?a.inverse?!c.data:c.data:(this.error=c.error,!1)}if(this.isNonLeafNode(a))switch(a.value){case _types.Operator.And:return this.evaluateNode(a.left,b)&&this.evaluateNode(a.right,b);case _types.Operator.Or:return this.evaluateNode(a.left,b)||this.evaluateNode(a.right,b);default:}return!1}},{key:"isLeafNode",value:function isLeafNode(a){return!!!(a.left&&a.right)}},{key:"isNonLeafNode",value:function isNonLeafNode(a){return!!(a.left&&a.right&&(a.value===_types.Operator.Or||a.value===_types.Operator.And))}// --- Note ---
|
|
32
|
-
// This method mutates `nodes` array
|
|
33
|
-
// It's done for the sake of performance
|
|
34
|
-
},{key:"buildTree",value:function buildTree(a,b){if(1===a.length)return a[0];var c,d=_createForOfIteratorHelper(b);try{for(d.s();!(c=d.n()).done;){var e=c.value,f=a.shift(),g=a.shift(),h=new _targetingNode.TargetingNode(e,f,g);a.unshift(h)}}catch(a){d.e(a)}finally{d.f()}return a[0]}},{key:"flattenSegment",value:function flattenSegment(a){var b=this,c=a.conditionsData,d=c.firstLevel,e=c.firstLevelOrOperators,f=[];return d.forEach(function(a){var c=a.conditions,d=a.orOperators,e={operators:b.convertOperators(d),conditions:c};f.push(e)}),{topLevelOperators:this.convertOperators(e),nestedConditions:f}}},{key:"convertOperators",value:function convertOperators(a){return a.map(function(a){return a?_types.Operator.Or:_types.Operator.And})}}]),a}();exports.TargetingTree=TargetingTree;
|
|
35
|
-
//# sourceMappingURL=targetingTree.js.map
|