From 3e7894a0153f2abb309c7f9fc7aa95fa9bdf9b49 Mon Sep 17 00:00:00 2001 From: Abhi591 Date: Wed, 4 Dec 2024 22:24:12 +0530 Subject: [PATCH] fix: Integration callback in typescript definitions file --- CHANGELOG.md | 5 +++++ dist/vwo-javascript-sdk.js | 4 ++-- dist/vwo-javascript-sdk.min.js | 4 ++-- lib/index.d.ts | 11 +++++++++++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4671e2c..ba0efb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.71.0] - 2024-12-04 + +### Fix +- Fixed issue where integrations callback was missing in the typescript definitions file. + ## [1.70.1] - 2024-10-07 ### Fix diff --git a/dist/vwo-javascript-sdk.js b/dist/vwo-javascript-sdk.js index 3c77558..0930b78 100644 --- a/dist/vwo-javascript-sdk.js +++ b/dist/vwo-javascript-sdk.js @@ -1,5 +1,5 @@ /*! - * vwo-javascript-sdk - v1.70.0 + * vwo-javascript-sdk - v1.70.1 * URL - https://github.com/wingify/vwo-node-sdk * * Copyright 2019-2022 Wingify Software Pvt. Ltd. @@ -2330,7 +2330,7 @@ var packageFile = {}; // For javascript-sdk, to keep the build size low if (true) { packageFile = { name: "vwo-javascript-sdk", - version: "1.70.0" + version: "1.70.1" }; } else {} diff --git a/dist/vwo-javascript-sdk.min.js b/dist/vwo-javascript-sdk.min.js index 939cbf8..c468d17 100644 --- a/dist/vwo-javascript-sdk.min.js +++ b/dist/vwo-javascript-sdk.min.js @@ -1,5 +1,5 @@ /*! - * vwo-javascript-sdk - v1.70.0 + * vwo-javascript-sdk - v1.70.1 * URL - https://github.com/wingify/vwo-node-sdk * * Copyright 2019-2022 Wingify Software Pvt. Ltd. @@ -22,5 +22,5 @@ * 3. uuid - ^3.3.2 * 4. vwo-sdk-log-messages - ^0.12.0 */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.vwoSdk=t():e.vwoSdk=t()}(this,(function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(i,a,function(t){return e[t]}.bind(null,a));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=25)}([function(e,t,n){var i=n(32);e.exports=i},function(e,t){var n={_toStringValue:function(e){return Object.prototype.toString.call(e)},isNumber:function(e){return"[object Number]"===n._toStringValue(e)},isString:function(e){return"[object String]"===n._toStringValue(e)},isObject:function(e){return"[object Object]"===n._toStringValue(e)},isFunction:function(e){return"[object Function]"===n._toStringValue(e)},isBoolean:function(e){return"[object Boolean]"===n._toStringValue(e)},isPromise:function(e){return"[object Promise]"===n._toStringValue(e)},isUndefined:function(e){return"[object Undefined]"===n._toStringValue(e)||void 0===e},isNull:function(e){return"[object Null]"===n._toStringValue(e)},isArray:function(e){return"[object Array]"===n._toStringValue(e)}};e.exports=n},function(e,t){e.exports={INDEX:"".concat("lib","/index"),VWO:"".concat("lib","/VWO"),API:"".concat("lib","/api/index"),Activate:"".concat("lib","/api/activate"),GetVariation:"".concat("lib","/api/getVariation"),Track:"".concat("lib","/api/track"),IsFeatureEnabled:"".concat("lib","/api/isFeatureEnabled"),GetFeatureVariableValue:"".concat("lib","/api/getFeatureVariableValue"),Push:"".concat("lib","/api/push"),SegmentEvaluator:"".concat("lib/core","/SegmentEvaluator"),BucketingService:"".concat("lib/core","/BucketingService"),VariationDecider:"".concat("lib/core","/VariationDecider"),ConsoleLogManager:"".concat("lib/services","/ConsoleLogManager"),EventQueue:"".concat("lib/services","/EventQueue"),LoggingManager:"".concat("lib/services","/LoggingManager"),SettingsFileManager:"".concat("lib/services","/SettingsFileManager"),BatchEventsQueue:"".concat("lib/services","/BatchEventsQueue"),CampaignUtil:"".concat("lib/util","/CampaignUtil"),DataTypeUtil:"".concat("lib/util","/DataTypeUtil"),EventDispatcher:"".concat("lib/util","/EventDispatcher"),EventDispatcherUtil:"".concat("lib/util","/EventDispatcherUtil"),FeatureUtil:"".concat("lib/util","/FeatureUtil"),Functionutil:"".concat("lib/util","/Functionutil"),ImpressionUtil:"".concat("lib/util","/ImpressionUtil"),UuidUtil:"".concat("lib/util","/UuidUtil"),ValidateUtil:"".concat("lib/util","/ValidateUtil"),DecisionUtil:"".concat("lib/util","/DecisionUtils"),HttpHandlerUtil:"".concat("lib/util","/HttpHandlerUtil"),HttpImageUtil:"".concat("lib/util","/HttpImageUtil"),HttpXMLUtil:"".concat("lib/util","/HttpXMLUtil"),UsageStatsUtil:"".concat("lib/services","/UsageStats")}},function(e,t,n){var i={};i={name:"vwo-javascript-sdk",version:"1.70.0"},e.exports={SDK_NAME:i.name,SDK_VERSION:i.version,PLATFORM:"server",SEED_VALUE:1,MAX_TRAFFIC_PERCENT:100,MAX_TRAFFIC_VALUE:1e4,MAX_EVENTS_PER_REQUEST:5e3,DEFAULT_EVENTS_PER_REQUEST:100,DEFAULT_REQUEST_TIME_INTERVAL:600,STATUS_RUNNING:"RUNNING",SEED_URL:"https://vwo.com",HTTP_PROTOCOL:"http://",HTTPS_PROTOCOL:"https://",SDK_QUERY_PARAM:"sdk",SDK_VERSION_QUERY_PARAM:"sdk-v"}},function(e,t,n){var i={cloneObject:function(e){return e?JSON.parse(JSON.stringify(e)):e},getRandomNumber:function(){return Math.random()},getCurrentUnixTimestamp:function(){return Math.ceil(+new Date/1e3)},getCurrentUnixTimestampInMillis:function(){return+new Date},matchWithRegex:function(e,t){try{return e.match(new RegExp(t))}catch(e){var i=n(0),a=n(2),r=i.getLogger(),o=i.LogLevelEnum,s=i.LogMessageEnum,l=i.LogMessageUtil,u=a.FunctionUtil;return r.log(o.ERROR,l.build(s.ERROR_MESSAGES.SEGMENTATION_REGEX_CREATION_FAILED,{file:u,regex:t})),null}},getCurrentTime:function(){return(new Date).toISOString()},convertObjectKeysToString:function(e,t){var n="";for(var i in t=t||[],e)e.hasOwnProperty(i)&&-1===t.indexOf(i)&&(n+=i+"="+e[i]+"&");return n},objectValues:function(e){var t=[];for(var n in e)t.push(e[n]);return t}};e.exports=i},function(e,t){e.exports={LAUNCH:"launch",ACTIVATE:"activate",GET_VARIATION_NAME:"getVariation",TRACK:"track",IS_FEATURE_ENABLED:"isFeatureEnabled",GET_FEATURE_VARIABLE_VALUE:"getFeatureVariableValue",PUSH:"push"}},function(e,t,n){var i;function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var r=n(1),o=n(30),s=n(5),l=n(9),u=(a(i={},s.ACTIVATE,(function(e){var t=e.campaignKey,n=e.userId,i=e.customVariables,a=void 0===i?{}:i,r=e.variationTargetingVariables,s=void 0===r?{}:r,l=e.userStorageData,u=void 0===l?{}:l,c=e.shouldTrackReturningUser,g=void 0!==c&&c,E=e.metaData,f=void 0===E?{}:E;return[{key:"campaignKey",value:t,type:o.STRING},{key:"userId",value:n,type:o.STRING},{key:"customVariables",value:a,type:o.OBJECT},{key:"variationTargetingVariables",value:s,type:o.OBJECT},{key:"userStorageData",value:u,type:o.OBJECT},{key:"shouldTrackReturningUser",value:g,type:o.BOOLEAN},{key:"metaData",value:f,type:o.OBJECT}]})),a(i,s.TRACK,(function(e){var t=e.campaignKey,n=e.userId,i=e.goalIdentifier,a=e.customVariables,r=void 0===a?{}:a,s=e.variationTargetingVariables,u=void 0===s?{}:s,c=e.userStorageData,g=void 0===c?{}:c,E=e.goalTypeToTrack,f=void 0===E?l.ALL:E,d=e.shouldTrackReturningUser,S=void 0!==d&&d,p=e.metaData,v=void 0===p?{}:p;return[{key:"campaignKey",value:t,type:o.STRING_NULL_UNDEFINED_ARRAY},{key:"userId",value:n,type:o.STRING},{key:"goalIdentifier",value:i,type:o.STRING},{key:"customVariables",value:r,type:o.OBJECT},{key:"variationTargetingVariables",value:u,type:o.OBJECT},{key:"userStorageData",value:g,type:o.OBJECT},{key:"goalTypeToTrack",value:f,type:o.STRING},{key:"shouldTrackReturningUser",value:S,type:o.BOOLEAN},{key:"metaData",value:v,type:o.OBJECT}]})),a(i,s.IS_FEATURE_ENABLED,(function(e){var t=e.campaignKey,n=e.userId,i=e.customVariables,a=void 0===i?{}:i,r=e.variationTargetingVariables,s=void 0===r?{}:r,l=e.userStorageData,u=void 0===l?{}:l,c=e.shouldTrackReturningUser,g=void 0!==c&&c,E=e.metaData,f=void 0===E?{}:E;return[{key:"campaignKey",value:t,type:o.STRING},{key:"userId",value:n,type:o.STRING},{key:"customVariables",value:a,type:o.OBJECT},{key:"variationTargetingVariables",value:s,type:o.OBJECT},{key:"userStorageData",value:u,type:o.OBJECT},{key:"shouldTrackReturningUser",value:g,type:o.BOOLEAN},{key:"metaData",value:f,type:o.OBJECT}]})),a(i,s.GET_FEATURE_VARIABLE_VALUE,(function(e){var t=e.campaignKey,n=e.variableKey,i=e.userId,a=e.customVariables,r=void 0===a?{}:a,s=e.variationTargetingVariables,l=void 0===s?{}:s,u=e.userStorageData,c=void 0===u?{}:u,g=e.metaData,E=void 0===g?{}:g;return[{key:"campaignKey",value:t,type:o.STRING},{key:"variableKey",value:n,type:o.STRING},{key:"userId",value:i,type:o.STRING},{key:"customVariables",value:r,type:o.OBJECT},{key:"variationTargetingVariables",value:l,type:o.OBJECT},{key:"userStorageData",value:c,type:o.OBJECT},{key:"metaData",value:E,type:o.OBJECT}]})),a(i,s.PUSH,(function(e){var t=e.tagKey,n=e.tagValue,i=e.userId,a=e.customDimensionMap;return[{key:"tagKey",value:t,type:o.STRING},{key:"tagValue",value:n,type:o.STRING},{key:"userId",value:i,type:o.STRING},{key:"customDimensionMap",value:a,type:o.OBJECT}]})),i);u[s.GET_VARIATION_NAME]=u[s.ACTIVATE];var c={isValidValue:function(e){return!(void 0===e||!e)},isValidString:function(e){return c.isValidValue(e)&&r.isString(e)},isValidNumber:function(e){return c.isValidValue(e)&&r.isNumber(e)},isValidFunction:function(e){return c.isValidValue(e)&&r.isFunction(e)},isValidBoolean:function(e){return void 0!==e&&r.isBoolean(e)},isValidObject:function(e){return void 0!==e&&r.isObject(e)},areValidParamsForAPIMethod:function(e){for(var t=u[e.method](e),n=[],i=0;i0},setVariationAllocation:function(e){for(var t=e.variations.length,n=0,i=0;n6&&void 0!==arguments[6]?arguments[6]:{},c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},S=arguments.length>8?arguments[8]:void 0,p=arguments.length>9?arguments[9]:void 0,A=arguments.length>10?arguments[10]:void 0,O=arguments.length>11?arguments[11]:void 0,R=arguments.length>12&&void 0!==arguments[12]?arguments[12]:"",T=_.generateFor(a,t.accountId);d.log(g.DEBUG,f.build(E.DEBUG_MESSAGES.USER_UUID,{file:u.UuidUtil,userId:a,accountId:t.accountId,uuid:T}));var N={campaignId:n.id,campaignKey:i,campaignType:n.type,campaignName:n.name,customVariables:s,event:v.DECISION_TYPES.CAMPAIGN_DECISION,goalIdentifier:O,isForcedVariationEnabled:n.isForcedVariationEnabled,sdkVersion:I.SDK_VERSION,source:R,userId:a,variationTargetingVariables:l,vwoUserId:T},h=r.isPartOfGroup(t,n.id),b=h.groupId,y=h.groupName;b&&(N.groupId=b,N.groupName=y),l=Object.assign({},l,{_vwoUserId:n.isUserListEnabled?T:a});var U=m._checkForWhitelisting(e,n,i,a,l,N);return U?o.isPromise(U)?U.then((function(e){if(Object.keys(e).length>0)return e})):U:e.asyncStorageConfig?new Promise((function(r){return m._checkForUserStorage(e,t,n,i,a,c,p,N).then((function(u){if(u&&o.isObject(u)&&Object.keys(u).length>0)r(Object.assign({},{isStoredVariation:!0},u));else if(A)r(Object.assign({}));else{var g=m.evaluateAndGetVariationWithoutStorage(e,t,n,i,a,s,l,c,S,p,O,N,b,y);r(g)}}))})):m._checkForUserStorage(e,t,n,i,a,c,p,N)||m.evaluateAndGetVariationWithoutStorage(e,t,n,i,a,s,l,c,S,p,O,N,b,y)},evaluateAndGetVariationWithoutStorage:function(e,t,n,i,s,l,u,c,S,p,v,_,I,A){if(!m._checkForPreSegmentation(n,i,s,l,_)||!a.isUserPartOfCampaign(s,n,!0))return{};if(I){var O=r.getGroupCampaigns(t,I);if(0===O.length)return{};var T=m._checkForStorageAndWhitelisting(e,t,A,O,n,s,c,u,p);if(T)return d.log(g.INFO,f.build(E.INFO_MESSAGES.MEG_CALLED_CAMPAIGN_NOT_WINNER,{userId:s,groupName:A,file:R,campaignKey:i})),o.isPromise(T)?new Promise((function(e){e(Object.assign({}))})):{};var N="",h="",b=m.getEligbleCampaigns(O,s,l),y=b.eligibleCampaigns,U=b.inEligibleCampaigns;U.forEach((function(e){N=N+e.key+","})),y.forEach((function(e){h=h+e.key+","})),d.log(g.DEBUG,f.build(E.DEBUG_MESSAGES.MEG_ELIGIBLE_CAMPAIGNS,{userId:s,groupName:A,file:R,eligibleCampaignKeys:h.slice(0,-1),inEligibleText:""===N?"no campaigns":"campaigns: ".concat(N.slice(0,-1))})),d.log(g.INFO,f.build(E.INFO_MESSAGES.MEG_ELIGIBLE_CAMPAIGNS,{userId:s,groupName:A,file:R,noOfEligibleCampaigns:y.length,noOfGroupCampaigns:U.length+y.length}));var G=void 0!==t.groups[I].et?t.groups[I].et:1;return 1===y.length?m.evaluateTrafficAndGetVariation(e,y[0],y[0].key,s,S,v,_):1===G?m._normalizeAndFindWinningCampaign(e,n,y,s,A,I,S,v,_):m._advancedAlgoFindWinningCampaign(e,t,n,y,s,A,I,S,v,_)}return m.evaluateTrafficAndGetVariation(e,n,i,s,S,v,_)},_evaluateWhitelisting:function(e,t,n,i){var l,u,p=arguments.length>4&&void 0!==arguments[4]&&arguments[4],v=[];if(e.variations.forEach((function(a){!o.isObject(a.segments)||Object.keys(a.segments).length?(o.isObject(a.segments)&&S(a.segments,i,t,n,a.name)?(u=c.PASSED,v.push(s.cloneObject(a))):u=c.FAILED,d.log(g.DEBUG,f.build(E.DEBUG_MESSAGES.SEGMENTATION_STATUS,{campaignKey:t,userId:n,customVariables:JSON.stringify(i),file:R,status:u,segmentationType:T,variation:e.type===A.FEATURE_ROLLOUT&&u===c.PASSED?"and becomes part of the rollout":"for ".concat(a.name)}),p)):d.log(g.DEBUG,f.build(E.DEBUG_MESSAGES.SEGMENTATION_SKIPPED,{campaignKey:t,userId:n,file:R,variation:e.type===A.FEATURE_ROLLOUT?"":", for ".concat(a.name)}),p)})),v.length>1){r.scaleVariationWeights(v);for(var _=0,I=0;_0?(c=!0,d.log(g.INFO,f.build(E.INFO_MESSAGES.OTHER_CAMPAIGN_SATISFIES_WHITELISTING_STORAGE,{file:R,campaignKey:i.key,groupName:n,userId:r,type:"user storage"})),!0):void 0}})),e.asyncStorageConfig?new Promise((function(e){e(c)})):c},_checkForPreSegmentation:function(e,t,n,i,a){var r;return o.isObject(e.segments)&&!Object.keys(e.segments).length?(d.log(g.DEBUG,f.build(E.DEBUG_MESSAGES.SEGMENTATION_SKIPPED,{campaignKey:t,userId:n,file:R}),!a),!0):(r=S(e.segments,i,t,n,!a)?c.PASSED:c.FAILED,d.log(g.INFO,f.build(E.INFO_MESSAGES.SEGMENTATION_STATUS,{campaignKey:t,userId:n,customVariables:JSON.stringify(i||{}),file:R,status:r,segmentationType:N,variation:""}),!a),r!==c.FAILED)},evaluateTrafficAndGetVariation:function(e,t,n,a,r,o,s){var l,u,c,S=i.getVariationAllotted(a,t,e.settingsFile.accountId);return l=S.variation,u=S.variationName,c=S.variationId,d.log(g.INFO,f.build(E.INFO_MESSAGES.USER_VARIATION_ALLOCATION_STATUS,{file:R,campaignKey:n,userId:a,status:u?"got variation:".concat(u):"did not get any variation"})),u&&m._saveUserData(e,t,u,a,r,o),p.execute(Object.assign({fromUserStorageService:!1,isUserWhitelisted:!1},t.type===A.FEATURE_ROLLOUT?{isFeatureEnabled:!!u}:{variationName:u,variationId:c},s)),{variation:l&&l.variation,variationName:u,variationId:c}},_checkForWhitelisting:function(e,t,n,i,a,r){var o,s,l;if(t.isForcedVariationEnabled){var u,S=m._evaluateWhitelisting(t,n,i,a,!r);if(S?(o=c.PASSED,u=S.variationName):(o=c.FAILED,u=""),d.log(g.INFO,f.build(E.INFO_MESSAGES.SEGMENTATION_STATUS,{campaignKey:n,userId:i,customVariables:JSON.stringify(a),file:R,status:o,segmentationType:T,variation:t.type===A.FEATURE_ROLLOUT?"":"for variation: ".concat(u)}),!r),S)return s=S.variationName,l=S.variationId,r&&p.execute(Object.assign({fromUserStorageService:!1,isUserWhitelisted:!!s},t.type===A.FEATURE_ROLLOUT?{isFeatureEnabled:!!s}:{variationName:s,variationId:l},r)),e.asyncStorageConfig?new Promise((function(e){return e(S)})):S}else d.log(g.DEBUG,f.build(E.DEBUG_MESSAGES.WHITELISTING_SKIPPED,{campaignKey:n,userId:i,file:R}),!r)},_checkForUserStorage:function(e,t,n,i,a,r,o,s){var l;return e.asyncStorageConfig?m._getStoredUserData(e,a,i,r,!s).then((function(r){return r=r||{variationName:null,goalIdentifier:null},m._processAfterGettingFromStorage(e,t,n,i,a,o,s,r)})):(l=m._getStoredUserData(e,a,i,r,!s),m._processAfterGettingFromStorage(e,t,n,i,a,o,s,l))},_processAfterGettingFromStorage:function(e,t,n,i,a,s,l,u){var c,S,v=u.variationName,_=u.goalIdentifier;return u&&u.campaignKey&&v?c=r.getCampaignVariation(t,i,v):d.log(g.DEBUG,f.build(E.DEBUG_MESSAGES.USER_STORAGE_SERVICE_NO_STORED_DATA,{file:R,campaignKey:i,userId:a}),!l),c?(v=c.name,S=c.id,d.log(g.INFO,f.build(E.INFO_MESSAGES.GOT_STORED_VARIATION,{file:R,campaignKey:i,userId:a,variationName:v}),!l),l&&p.execute(Object.assign({fromUserStorageService:!!v,isUserWhitelisted:!1},n.type===A.FEATURE_ROLLOUT?{isFeatureEnabled:!!v}:{variationName:v,variationId:S},l)),{variation:c,variationName:v,variationId:S,storedGoalIdentifier:_,isStoredVariation:!0}):o.isUndefined(e.userStorageService)||s||!o.isUndefined(c)?void 0:(d.log(g.WARN,f.build(E.WARNING_MESSAGES.CAMPAIGN_NOT_ACTIVATED,{file:R,campaignKey:i,userId:a,api:e.apiName}),!l),d.log(g.INFO,f.build(E.INFO_MESSAGES.CAMPAIGN_NOT_ACTIVATED,{file:R,campaignKey:i,userId:a,reason:e.apiName===O.TRACK?"track it":"get the decision/value"}),!l),{})},getEligbleCampaigns:function(e,t,n){var i=[],r=[];return e.forEach((function(e){m._checkForPreSegmentation(e,e.key,t,n)&&a.isUserPartOfCampaign(t,e,!0)?(e=s.cloneObject(e),i.push(e)):r.push(e)})),{eligibleCampaigns:i,inEligibleCampaigns:r}},_normalizeAndFindWinningCampaign:function(e,t,n,i,o,s,l,u,c){n.forEach((function(e){e.weight=Math.floor(100/n.length)})),r.setCampaignAllocation(n);var S=a._getVariation(n,a.calculateBucketValue(r.getBucketingSeed(i,void 0,s)));return d.log(g.INFO,f.build(E.INFO_MESSAGES.MEG_GOT_WINNER_CAMPAIGN,{userId:i,groupName:o,file:R,campaignKey:S.key})),S.id===t.id?m.evaluateTrafficAndGetVariation(e,S,S.key,i,l,u,c):(d.log(g.INFO,f.build(E.INFO_MESSAGES.MEG_CALLED_CAMPAIGN_NOT_WINNER,{userId:i,groupName:o,file:R,campaignKey:t.key})),{})},_advancedAlgoFindWinningCampaign:function(e,t,n,i,o,l,u,c,S,p){for(var v=null,_=!1,I=void 0!==t.groups[u].p?t.groups[u].p:{},A=void 0!==t.groups[u].wt?t.groups[u].wt:{},O=0;O0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(e).length},getKeyValue:function(e){if(n.areObjectKeys(e)){var t=Object.keys(e)[0];return{key:t,value:e[t]}}},objectValues:function(e){return Object.keys(e).map((function(t){return e[t]}))}};e.exports=n},function(e,t,n){function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=n(3),r=n(14),o=n(9),s=n(20),l=n(6),u=n(4),c=n(0),g=n(2),E=n(1),f=c.LogLevelEnum,d=c.LogMessageEnum,S=c.LogMessageUtil,p=c.getLogger(),v=n(21);function _(e,t){var n=e.accountId;return Object.assign({},function(e,t){return{sId:u.getCurrentUnixTimestamp(),u:s.generateFor(t,e.accountId)}}(e,t),I.getReportingProperties(e),{account_id:n,random:u.getRandomNumber(),ap:a.PLATFORM})}var I={buildEventForPushing:function(e,t,n,o){var s=Object.assign({},_(e,o));return s.url=a.HTTPS_PROTOCOL+v.getBaseUrl()+r.PUSH,s.tags=JSON.stringify({u:i({},encodeURIComponent(t),encodeURIComponent(n))}),p.log(f.DEBUG,S.build(d.DEBUG_MESSAGES.IMPRESSION_FOR_PUSH,{file:g.ImpressionUtil,properties:this._getStringifiedLogProperties(s)})),s},buildBatchEventForPushing:function(e,t,n,i){},buildEventForTrackingUser:function(e,t,n,i,o){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"",u=Object.assign({experiment_id:t,combination:n,visitor_ua:s,visitor_ip:l},_(e,i),o);return u.ed=JSON.stringify({p:"server"}),u.url=a.HTTPS_PROTOCOL+v.getBaseUrl()+r.TRACK_USER,p.log(f.DEBUG,S.build(d.DEBUG_MESSAGES.IMPRESSION_FOR_TRACK_USER,{file:g.ImpressionUtil,properties:this._getStringifiedLogProperties(u)})),u},buildBatchEventForTrackingUser:function(e,t,n,i){},buildEventForTrackingGoal:function(e,t,n,i){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"",E=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"",I=s.id,A=Object.assign({experiment_id:t,combination:n},_(e,i));return A.visitor_ua=c,A.visitor_ip=E,A.url=a.HTTPS_PROTOCOL+v.getBaseUrl()+r.TRACK_GOAL,A.goal_id=I,s.type===o.REVENUE&&l.isValidValue(u)&&(A.r=u),p.log(f.DEBUG,S.build(d.DEBUG_MESSAGES.IMPRESSION_FOR_TRACK_GOAL,{file:g.ImpressionUtil,properties:this._getStringifiedLogProperties(A)})),A},buildBatchEventForTrackingGoal:function(e,t,n,i){},getReportingProperties:function(e){var t,n=e.sdkKey;return i(t={},a.SDK_QUERY_PARAM,a.SDK_NAME),i(t,a.SDK_VERSION_QUERY_PARAM,a.SDK_VERSION),i(t,"env",n),t},getEventsBaseProperties:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",s=e.sdkKey,l=Object.assign({en:t,a:e.accountId,env:s,eTime:u.getCurrentUnixTimestampInMillis(),random:u.getRandomNumber(),p:"FS",visitor_ua:i,visitor_ip:o},n);return l.url=a.HTTPS_PROTOCOL+v.getBaseUrl()+r.EVENTS,l},getEventBasePayload:function(e,t,n){var i=s.generateFor(t,e.accountId),r=e.sdkKey,o={vwo_sdkName:a.SDK_NAME,vwo_sdkVersion:a.SDK_VERSION,vwo_envKey:r};return{d:{msgId:"".concat(i,"-").concat(u.getCurrentUnixTimestampInMillis()),visId:i,sessionId:u.getCurrentUnixTimestamp(),event:{props:o,name:n,time:u.getCurrentUnixTimestampInMillis()},visitor:{props:{vwo_fs_environment:r}}}}},getTrackUserPayloadData:function(e,t,n,i,a){var r=this.getEventBasePayload(e,t,n);return r.d.event.props.id=i,r.d.event.props.variation=a,r.d.event.props.isFirst=1,p.log(f.DEBUG,S.build(d.DEBUG_MESSAGES.IMPRESSION_FOR_EVENT_ARCH_TRACK_USER,{file:g.ImpressionUtil,accountId:e.accountId,userId:t,campaignId:i})),r},getTrackGoalPayloadData:function(e,t,n,i,a,r){var o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},s=this.getEventBasePayload(e,t,n),l={};if(Object.keys(i).forEach((function(a){l["id_".concat(a)]=["g_".concat(i[a].goal.id)],p.log(f.DEBUG,S.build(d.DEBUG_MESSAGES.IMPRESSION_FOR_EVENT_ARCH_TRACK_GOAL,{file:g.ImpressionUtil,goalName:n,accountId:e.accountId,u:t,campaignId:a}))})),s.d.event.props.vwoMeta={metric:l},r&&a&&r.size>0&&r.forEach((function(e){s.d.event.props.vwoMeta[e]=a})),s.d.event.props.isCustomEvent=!0,Object.keys(o).length>0)for(var u in o)s.d.event.props[u]=o[u];return s},getPushPayloadData:function(e,t,n,i){var a=this.getEventBasePayload(e,t,n);return a.d.event.props.isCustomEvent=!0,Object.keys(i).forEach((function(e){var t=E.isString(i[e])?i[e]:JSON.stringify(i[e]);a.d.visitor.props[e]=t})),p.log(f.DEBUG,S.build(d.DEBUG_MESSAGES.IMPRESSION_FOR_EVENT_ARCH_PUSH,{file:g.ImpressionUtil,accountId:e.accountId,userId:t,property:JSON.stringify(i)})),a},_getStringifiedLogProperties:function(e){var t=Object.assign({},e);return delete t.env,JSON.stringify(t)}};e.exports=I},function(e,t){e.exports={VWO_VARIATION_SHOWN:"vwo_variationShown",VWO_SYNC_VISITOR_PROP:"vwo_syncVisitorProp"}},function(e,t){var n={init:function(e){n.isEventArchEnabled=e.isEventArchEnabled,n.isNB=e.isNB,n.isNBv2=e.isNBv2},getAll:function(){return{isEventArchEnabled:n.isEventArchEnabled,isNB:n.isNB,isNBv2:n.isNBv2}}};e.exports=n},function(e,t){e.exports={BASE_URL:"dev.visualwebsiteoptimizer.com",SETTINGS_URL:"/server-side/settings",WEBHOOK_SETTINGS_URL:"/server-side/pull",TRACK_USER:"/server-side/track-user",TRACK_GOAL:"/server-side/track-goal",PUSH:"/server-side/push",BATCH_EVENTS:"/server-side/batch-events",EVENTS:"/events/t"}},function(e,t,n){var i=n(31),a=n(3),r=n(6),o=n(13),s=n(0),l=n(2),u=n(7),c=s.LogLevelEnum,g=s.LogMessageEnum,E=s.LogMessageUtil,f=s.getLogger(),d=l.BucketingService,S={_generateBucketValue:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=e/Math.pow(2,32),a=(t*i+1)*n,r=Math.floor(a);return r},_getVariation:function(e,t){for(var n=0;n=i.startVariationAllocation&&t<=i.endVariationAllocation)return i}return null},_getBucketValueForUser:function(e,t,n){var r=i.v3(e,a.SEED_VALUE),o=S._generateBucketValue(r,a.MAX_TRAFFIC_PERCENT);return f.log(c.DEBUG,E.build(g.DEBUG_MESSAGES.USER_HASH_BUCKET_VALUE,{file:d,hashValue:r,bucketValue:o,userId:t}),n),o},isUserPartOfCampaign:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!t)return!1;var i=t.percentTraffic,a=S._getBucketValueForUser(u.getBucketingSeed(e,t),e,n),r=0!==a&&a<=i;return f.log(c.INFO,E.build(g.INFO_MESSAGES.USER_CAMPAIGN_ELIGIBILITY,{file:d,userId:e,campaignKey:t.key,status:r?"eligible":"not eligible"}),n),r},bucketUserToVariation:function(e,t,n){var i,s,l=o.getAll().isNB,p=o.getAll().isNBv2;if(!r.isValidValue(e))return null;if(!t)return null;(!l&&!p||l&&t.isOB)&&t.percentTraffic?(i=a.MAX_TRAFFIC_VALUE/t.percentTraffic/100,s=u.getBucketingSeed(e,t)):l&&!t.isOB&&!p||p&&t.isOBv2?(i=1,s=e):(i=1,s=u.getBucketingSeed(n+"_"+e,t));var v=S._generateHashValue(s),_=S._generateBucketValue(v,a.MAX_TRAFFIC_VALUE,i);return f.log(c.DEBUG,E.build(g.DEBUG_MESSAGES.USER_CAMPAIGN_BUCKET_VALUES,{file:d,userId:e,campaignKey:t.key,percentTraffic:t.percentTraffic,bucketValue:_,hashValue:v})),S._getVariation(t.variations,_)},calculateBucketValue:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=S._generateHashValue(e);return S._generateBucketValue(n,a.MAX_TRAFFIC_VALUE,t)},_generateHashValue:function(e){return i.v3(e,a.SEED_VALUE)}};e.exports=S},function(e,t,n){var i,a;function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var o=n(37),s={NOTSET:0,DEBUG:1,INFO:2,WARN:3,ERROR:4},l=(r(i={},s.NOTSET,"".concat(o.BOLD).concat(o.WHITE,"[NOTSET]:").concat(o.RESET)),r(i,s.DEBUG,"".concat(o.BOLD).concat(o.LIGHTBLUE,"[DEBUG]: ").concat(o.RESET)),r(i,s.INFO,"".concat(o.BOLD).concat(o.CYAN,"[INFO]: ").concat(o.RESET)),r(i,s.WARN,"".concat(o.BOLD).concat(o.YELLOW,"[WARN]: ").concat(o.RESET)),r(i,s.ERROR,"".concat(o.BOLD).concat(o.RED,"[ERROR]: ").concat(o.RESET)),i),u=(r(a={},s.NOTSET,"[NOTSET]:"),r(a,s.DEBUG,"[DEBUG]: "),r(a,s.INFO,"[INFO]: "),r(a,s.WARN,"[WARN]: "),r(a,s.ERROR,"[ERROR]: "),a);e.exports={LogLevelEnum:s,LogNumberLevel:{_0:"NOTSET",_1:"DEBUG",_2:"INFO",_3:"WARN",_4:"ERROR"},LogLevelInfoEnum:u,LogLevelColorInfoEnum:l}},function(e,t){e.exports={FEATURE_TEST:"FEATURE_TEST",FEATURE_ROLLOUT:"FEATURE_ROLLOUT",AB:"VISUAL_AB"}},function(e,t,n){var i={SegmentOperandTypes:n(42),SegmentOperatorTypes:n(43),SegmentOperandValueTypeRegexes:n(44),SegmentOperandValues:n(45)};e.exports=i},function(e,t,n){var i=n(1),a={init:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.callback=e.integrations&&e.integrations.callback},execute:function(e){i.isFunction(this.callback)&&this.callback(e)}};e.exports=a},function(e,t,n){var i=n(48),a=n(3),r=i(a.SEED_URL,i.URL),o={generateFor:function(e,t){e="".concat(e);var n="".concat(t),i=o.generate(n,r);return o.generate(e,i).replace(/-/gi,"").toUpperCase()},generate:function(e,t){if(e&&t)return i(e,t)}};e.exports=o},function(e,t,n){var i=n(14),a=n(1).isString,r={init:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collectionPrefix;return t&&a(t)&&(r.collectionPrefix=t),r},getBaseUrl:function(){var e=i.BASE_URL;return r.collectionPrefix?"".concat(e,"/").concat(r.collectionPrefix):e}};e.exports=r},function(e,t,n){var i=n(4).getCurrentTime,a=n(1),r=a.isObject,o=a.isFunction,s={_getStoredSettings:function(e){var t,n=!1;if(e&&r(e)&&o(e.getSettings))try{var a=e.getSettings();if((t=JSON.parse(a))&&r(t)&&Object.keys(t).length>3){var s="VWO-SDK - [INFO]: ".concat(i()," VWO settings found in Storage Service.");console.info(s),n=!0}else if(t){var l="VWO-SDK - [ERROR]: ".concat(i()," VWO settings found in Storage Service is not valid.");console.error(l)}else{var u="VWO-SDK - [WARNING]: ".concat(i()," VWO settings is empty in Storage Service.");console.warn(u)}}catch(e){var c="VWO-SDK - [ERROR]: ".concat(i()," VWO settings found in Storage Service is not valid. ").concat(e);console.error(c),n=!1}return{isStoredData:n,parsedSettings:t}},send:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.method,n=e.url,a=e.payload,l=e.userStorageService,u=e.customHeaders,c=void 0===u?{}:u;if(n&&t)return new Promise((function(e,u){var g=s._getStoredSettings(l),E=g.isStoredData,f=g.parsedSettings;if(!E){var d={method:t,headers:c};return"POST"===t&&(d.body=JSON.stringify(a)),fetch(n,d).then((function(t){return t.text().then((function(n){var a={};try{a=JSON.parse(n)}catch(e){console.info("VWO-SDK - [INFO]: ".concat(i()," VWO didn't send JSON response which is expected: ").concat(e))}if(l&&r(l)&&o(l.setSettings)&&l.setSettings(a),200===t.status)e(a);else{var s="VWO-SDK - [ERROR]: ".concat(i()," Request failed for fetching account settings. Got Status Code: ").concat(t.status);console.error(s),u(s)}}))})).catch((function(e){var t="VWO-SDK - [ERROR]: ".concat(i()," Request failed for fetching account settings. Got Status Code: ").concat(e);console.error(t),u(t)}))}e(f)}))}};e.exports=s},function(e,t,n){var i=n(0).LogLevelEnum,a=n(4).getCurrentTime,r=n(1),o=r.isObject,s=r.isFunction,l={_getStoredSettings:function(e){var t,n=!1;if(e&&o(e)&&s(e.getSettings))try{var i=e.getSettings();if((t=JSON.parse(i))&&o(t)&&Object.keys(t).length>3){var r="VWO-SDK - [INFO]: ".concat(a()," VWO settings found in Storage Service.");console.info(r),n=!0}else if(t){var l="VWO-SDK - [ERROR]: ".concat(a()," VWO settings found in Storage Service is not valid.");console.error(l)}else{var u="VWO-SDK - [WARNING]: ".concat(a()," VWO settings is empty in Storage Service.");console.warn(u)}}catch(e){var c="VWO-SDK - [ERROR]: ".concat(a()," VWO settings found in Storage Service is not valid. ").concat(e);console.error(c),n=!1}return{isStoredData:n,parsedSettings:t}},send:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.method,i=t.url,a=t.payload,r=t.userStorageService,o=t.customHeaders,s=t.logger;if(i&&n)return new Promise((function(t,u){var c=l._getStoredSettings(r),g=c.isStoredData,E=c.parsedSettings;if(g)t(E);else{var f=new XMLHttpRequest;e.xhrHandler(f,n,i,a,r,o,s,t,u)}}))},sendRequest:function(e,t,n,a,r,o,s,l,u){var c=this,g=1e3*(e+1),E=new XMLHttpRequest;for(var f in E.timeout=5e3,E.onload=function(){E.status<200||E.status>=300?e5&&void 0!==arguments[5]?arguments[5]:{},s=arguments.length>6?arguments[6]:void 0,l=arguments.length>7?arguments[7]:void 0,u=arguments.length>8?arguments[8]:void 0;if("GET"===t)try{for(var c in e.onload=function(){r.xhrOnLoad(e,a,l)},e.onerror=function(){r.xhrOnError(e,u)},e.open(t,n),o)o.hasOwnProperty(c)&&e.setRequestHeader(c,o[c]);e.send()}catch(e){console.log(e.message)}else if("POST"===t){var g=0,E=5;this.sendRequest(g,E,s,o,i,t,n,l,u)}},xhrOnLoad:function(e,t,n){try{var i=JSON.parse(e.response);t&&o(t)&&s(t.setSettings)&&t.setSettings(e.response),n(i)}catch(e){console.error(e)}},xhrOnError:function(e,t){var n="VWO-SDK - [ERROR]: ".concat(a()," Request failed for fetching account settings. Got Status Code: ").concat(e.status);console.error(n),t(n)}};e.exports=l},function(e,t,n){var i=n(3),a=n(14),r=n(4),o=r.getRandomNumber,s=r.getCurrentTime,l={get:function(e,t,r){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(e&&t){var l="https",u=a.BASE_URL,c=a.SETTINGS_URL;return s.isViaWebhook&&(c=a.WEBHOOK_SETTINGS_URL),c+="?a=".concat(e,"&")+"i=".concat(t,"&")+"r=".concat(o(),"&")+"platform=".concat(i.PLATFORM,"&")+"".concat(i.SDK_QUERY_PARAM,"=").concat(i.SDK_NAME,"&")+"".concat(i.SDK_VERSION_QUERY_PARAM,"=").concat(i.SDK_VERSION),s.hostname&&s.path&&(l=s.protocol,s.port,u=s.hostname||u,c=s.path||c),"undefined"==typeof XMLHttpRequest?n(22).send({method:"GET",url:"".concat(l,"://").concat(u).concat(c),userStorageService:r}):n(23).send({method:"GET",url:"".concat(l,"://").concat(u).concat(c),userStorageService:r})}console.error("AccountId and sdkKey are required for fetching account settings. Aborting!")},handleHttpRequest:function(e,t,n){var i,a=e.statusCode,r=e.headers["content-type"],o="";if(/^application\/json/.test(r)||(i="Invalid content-type.\nExpected application/json but received ".concat(r)),i)return console.error(i.message),e.resume(),void n(i);e.setEncoding("utf8"),e.on("data",(function(e){o+=e})),e.on("end",(function(){l.handleHttpResponse(a,o,t,n)}))},handleHttpResponse:function(e,t,n,i){try{var a=JSON.parse(t);if(200!==e){var r="VWO-SDK - [ERROR]: ".concat(s()," Request failed for fetching account settings. Got Status Code: ").concat(e," and message: ").concat(t);return console.error(r),void i(r)}n(a)}catch(e){console.error("VWO-SDK - [ERROR]: ".concat(s()," Request failed for fetching account settings - ").concat(e.message)),i(e)}}};e.exports=l},function(e,t,n){var i=n(26),a=n(1),r=n(4),o=n(10).objectValues,s=n(24),l=n(9),u=(n(3).MAX_EVENTS_PER_REQUEST,n(0)),c=n(5),g=n(2).INDEX,E=u.setLogHandler,f=u.setLogLevel,d=u.LogLevelEnum,S=u.LogNumberLevel,p=u.LogMessageEnum,v=u.LogMessageUtil,_=u.getLogger();function I(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=v.build(p.ERROR_MESSAGES.CONFIG_PARAMETER_INVALID,{file:g,parameter:e,type:t,api:c.LAUNCH});throw new Error(_.log(d.ERROR,n))}function A(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=v.build(p.INFO_MESSAGES.CONFIG_PARAMETER_USED,{file:g,parameter:e,type:t});console.info("VWO-SDK - [INFO]: ".concat(r.getCurrentTime()," ").concat(n))}u.setLogLevel(d.ERROR),e.exports={logging:u,setLogger:E,setLogLevel:f,getSettingsFile:s.get,GoalTypeEnum:l,LogLevelEnum:d,launch:function(e){var t={};try{r.cloneObject(e),a.isUndefined(e.shouldTrackReturningUser)||a.isBoolean(e.shouldTrackReturningUser)?a.isUndefined(e.shouldTrackReturningUser)||A("shouldTrackReturningUser","boolean"):I("shouldTrackReturningUser","boolean"),a.isUndefined(e.isDevelopmentMode)||a.isBoolean(e.isDevelopmentMode)?a.isUndefined(e.isDevelopmentMode)||A("isDevelopmentMode","boolean"):I("isDevelopmentMode","boolean"),e.goalTypeToTrack&&!o(l).includes(e.goalTypeToTrack)?I("goalTypeToTrack","string(REVENUE_TRACKING, CUSTOM_GOAL, ALL)"):e.goalTypeToTrack&&A("goalTypeToTrack","string(REVENUE_TRACKING, CUSTOM_GOAL, ALL)"),e.logging&&e.logging.level&&!o(d).includes(e.logging.level)?I("logLevel","number(1,2,3,4)"):e.logging&&e.logging.level&&A("logLevel","number(1,2,3,4)"),e.pollingInterval&&!a.isNumber(e.pollingInterval)?I("pollingInterval","number(in miliiseconds)"):e.pollingInterval&&A("pollingInterval","number(in miliiseconds)"),e.pollingInterval&&a.isUndefined(e.sdkKey)&&I("sdkKey(required for polling)","string"),e.pollingInterval&&!a.isString(e.sdkKey)&&I("sdkKey","string"),a.isUndefined(e.batchEvents)||a.isObject(e.batchEvents)?a.isUndefined(e.batchEvents)||A("batchEvents","object"):I("batchEvents","object"),a.isUndefined(e.returnPromiseFor)||a.isObject(e.returnPromiseFor)?a.isUndefined(e.returnPromiseFor)||A("returnPromiseFor","object"):I("returnPromiseFor","object"),a.isUndefined(e.asyncStorageConfig)||a.isObject(e.asyncStorageConfig)?a.isUndefined(e.asyncStorageConfig)||A("asyncStorageConfig","object"):I("asyncStorageConfig","object"),a.isUndefined(e.integrations)||a.isObject(e.integrations)?a.isUndefined(e.integrations)||A("integrations","object"):I("integrations","object"),a.isUndefined(e.userStorageService)||a.isObject(e.userStorageService)?a.isUndefined(e.userStorageService)||A("userStorageService","object"):I("userStorageService","object"),a.isObject(e.batchEvents)&&(e.batchEvents=null),t=e}catch(e){_.log(d.ERROR,v.build(p.ERROR_MESSAGES.CONFIG_CORRUPTED,{file:g,api:c.LAUNCH})),t={}}return t.isDevelopmentMode&&u.setLogColorMode(!0),t.logging&&a.isObject(t.logging)&&(void 0!==t.logging.haveColoredLogs&&u.setLogColorMode(t.logging.haveColoredLogs),t.logging.logger&&a.isObject(t.logging.logger)&&a.isFunction(t.logging.logger.log)?(u.setLogHandler(t.logging.logger),u.setLogLevel(u.LogLevelEnum.NOTSET),_.log(d.DEBUG,v.build(p.DEBUG_MESSAGES.CONFIG_CUSTOM_LOGGER_USED,{file:g}))):t.logging.logger&&I("logging.logger","object"),void 0!==t.logging.level&&(u.setLogLevel(t.logging.level),_.log(d.DEBUG,v.build(p.DEBUG_MESSAGES.CONFIG_LOG_LEVEL_SET,{file:g,level:S["_"+t.logging.level]})))),t.isDevelopmentMode&&_.log(d.DEBUG,v.build(p.DEBUG_MESSAGES.CONFIG_DEVELOPMENT_MODE_STATUS,{file:g})),t.logger=t.logging&&t.logging.logger||_,new i(t)}}},function(e,t,n){function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};i(this,e),this.getVariation=this.getVariationName,this.userStorageService=t.userStorageService,this.logger=t.logger,this.returnPromiseFor=t.returnPromiseFor,this.asyncStorageConfig=t.asyncStorageConfig,this.optOut=!1,void 0===this.userStorageService&&t.asyncStorageConfig&&(this.userStorageService=t.asyncStorageConfig.redisStorage,t.userStorageService=this.userStorageService);var n=new E(t);n.isSettingsFileValid()?(this.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_VALID,{file:A})),d.init(t),this.eventQueue=new g,this.usageStats=new p,this.SettingsFileManager=n,n.checkAndPoll(),t.isDevelopmentMode||this.usageStats.collectUsageStats(n.getConfig()),this.SettingsFileManager.processSettingsFile(),this.logger.log(v.INFO,I.build(_.INFO_MESSAGES.SDK_INITIALIZED,{file:A})),this.UrlService=S.init(t.settingsFile),this.VWOFeatureFlags=c.init(t.settingsFile)):this.logger.log(v.ERROR,I.build(_.ERROR_MESSAGES.SETTINGS_FILE_INVALID,{file:A}))}var t,n,o;return t=e,(n=[{key:"activate",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{var a=this;if(a.asyncStorageConfig&&l.isObject(a.asyncStorageConfig))return a.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_ASYNC_RETURN_PROMISE,{file:A,method:s.ACTIVATE})),new Promise((function(o){if(!n.optOut)return r.activate(a,e,t,i).then((function(e){l.isObject(e)?o(e.variationName):o(e)}));n.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.ACTIVATE})),o(null)}));if(a.returnPromiseFor&&(a.returnPromiseFor.activate||a.returnPromiseFor.all))return a.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_RETURN_PROMISE,{file:A,method:s.ACTIVATE})),new Promise((function(o){var u;n.optOut?(n.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.ACTIVATE})),o(null)):(i.responseCallback=function(e,t){o(u)},(u=r.activate(a,e,t,i))?l.isObject(u)&&o(u.variationName):o(u))}));if(this.optOut)return this.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.ACTIVATE})),null;var o=r.activate(a,e,t,i);return l.isObject(o)?o.variationName:o}catch(e){return this.logger.log(v.ERROR,e.message),null}}},{key:"getVariationName",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{var a=this;return a.asyncStorageConfig&&l.isObject(a.asyncStorageConfig)?(a.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_ASYNC_RETURN_PROMISE,{file:A,method:s.GET_VARIATION_NAME})),new Promise((function(o){if(!n.optOut)return r.getVariation(a,e,t,i).then((function(e){l.isObject(e)?o(e.variationName):o(e)}));n.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.GET_VARIATION_NAME})),o(null)}))):a.returnPromiseFor&&(a.returnPromiseFor.getVariationName||a.returnPromiseFor.all)?(a.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_RETURN_PROMISE,{file:A,method:s.GET_VARIATION_NAME})),new Promise((function(o){n.optOut?(n.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.GET_VARIATION_NAME})),o(null)):o(r.getVariation(a,e,t,i))}))):this.optOut?(this.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.GET_VARIATION_NAME})),null):r.getVariation(a,e,t,i)}catch(e){return this.logger.log(v.ERROR,e.message),null}}},{key:"track",value:function(e,t,n){var i=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};try{var o=this;return o.asyncStorageConfig&&l.isObject(o.asyncStorageConfig)?(o.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_ASYNC_RETURN_PROMISE,{file:A,method:s.TRACK})),new Promise((function(l){if(!i.optOut)return r.track(o,e,t,n,a).then((function(e){l(e)}));i.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.TRACK})),l(null)}))):o.returnPromiseFor&&(o.returnPromiseFor.track||o.returnPromiseFor.all)?(o.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_RETURN_PROMISE,{file:A,method:s.TRACK})),new Promise((function(c){if(i.optOut)i.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.TRACK})),c(null);else{var g,E=0;a.responseCallback=function(t,n){E+=1,(o.isEventArchEnabled||l.isArray(e)||(l.isUndefined(e)||l.isNull(e))&&u.objectValues(g).filter(Boolean).length||E===u.objectValues(g).filter(Boolean).length)&&c(g)},(g=r.track(o,e,t,n,a))&&u.objectValues(g).some(Boolean)?g&&g.isDevelopmentMode&&(delete g.isDevelopmentMode,c(g)):c(g)}}))):this.optOut?(this.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.TRACK})),null):r.track(o,e,t,n,a)}catch(e){return this.logger.log(v.ERROR,e.message),null}}},{key:"isFeatureEnabled",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{var a=this;if(a.asyncStorageConfig&&l.isObject(a.asyncStorageConfig))return a.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_ASYNC_RETURN_PROMISE,{file:A,method:s.IS_FEATURE_ENABLED})),new Promise((function(o){if(!n.optOut)return r.isFeatureEnabled(a,e,t,i).then((function(e){l.isObject(e)?o(e.isFeatureEnabled):o(e)}));n.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.IS_FEATURE_ENABLED})),o(null)}));if(a.returnPromiseFor&&(a.returnPromiseFor.isFeatureEnabled||a.returnPromiseFor.all))return a.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_RETURN_PROMISE,{file:A,method:s.IS_FEATURE_ENABLED})),new Promise((function(o){var u;n.optOut?(n.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.IS_FEATURE_ENABLED})),o(!1)):(i.responseCallback=function(e,t){o(!!u)},u=r.isFeatureEnabled(a,e,t,i),l.isNull(u)?o(!1):l.isObject(u)&&o(!!u.isFeatureEnabled))}));if(this.optOut)return this.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.IS_FEATURE_ENABLED})),!1;var o=r.isFeatureEnabled(a,e,t,i);return l.isObject(o)?!!o.isFeatureEnabled:!!o}catch(e){return this.logger.log(v.ERROR,e.message),!1}}},{key:"getFeatureVariableValue",value:function(e,t,n){var i=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};try{var o=this;return o.asyncStorageConfig&&l.isObject(o.asyncStorageConfig)?(o.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_ASYNC_RETURN_PROMISE,{file:A,method:s.GET_FEATURE_VARIABLE_VALUE})),new Promise((function(u){if(!i.optOut)return r.getFeatureVariableValue(o,e,t,n,a).then((function(e){l.isObject(e)?u(e.typeCastedValue):u(e)}));i.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.GET_FEATURE_VARIABLE_VALUE})),u(null)}))):o.returnPromiseFor&&(o.returnPromiseFor.getFeatureVariableValue||o.returnPromiseFor.all)?(o.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_RETURN_PROMISE,{file:A,method:s.GET_FEATURE_VARIABLE_VALUE})),new Promise((function(l){i.optOut?(i.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.GET_FEATURE_VARIABLE_VALUE})),l(null)):l(r.getFeatureVariableValue(o,e,t,n,a))}))):this.optOut?(this.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.GET_FEATURE_VARIABLE_VALUE})),null):r.getFeatureVariableValue(o,e,t,n,a)}catch(e){return this.logger.log(v.ERROR,e.message),null}}},{key:"push",value:function(e,t,n){var i=this;try{var a,o=this;if(2===arguments.length)a=e,n=t,e=" ",t=" ";else{if(3!==arguments.length)return this.logger.log(v.ERROR,I.build(_.ERROR_MESSAGES.API_BAD_PARAMETERS,{file:A,api:s.PUSH})),!1;a={}}return o.returnPromiseFor&&(o.returnPromiseFor.push||o.returnPromiseFor.all)?(o.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_RETURN_PROMISE,{file:A,method:s.PUSH})),new Promise((function(c){if(i.optOut)i.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.PUSH})),c(null);else{var g,E=0,f={responseCallback:function(e,t){E+=1,(a&&l.isObject(a)&&u.objectValues(a).filter(Boolean).length>1||E===u.objectValues(g).filter(Boolean).length)&&c(g)}};(g=r.push(o,e,t,n,a,f))?g&&g.isDevelopmentMode&&(delete g.isDevelopmentMode,c(g)):c(!1)}}))):this.optOut?(this.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.PUSH})),null):r.push(o,e,t,n,a)}catch(e){return this.logger.log(v.ERROR,e.message),!1}}},{key:"setOptOut",value:function(){var e=this;return this.logger.log(v.INFO,I.build(_.INFO_MESSAGES.OPT_OUT_API_CALLED,{file:A})),this.returnPromiseFor&&(this.returnPromiseFor.optOut||this.returnPromiseFor.all)?new Promise((function(t){e._destroyInstanceVariables(),e.batchEventsQueue?e.flushEvents().then((function(){e.batchEventsQueue=void 0,t(!0)})):t(!0)})):(this.batchEventsQueue&&this.flushEvents().then((function(){e.batchEventsQueue=void 0})),this._destroyInstanceVariables(),!0)}},{key:"flushEvents",value:function(){this.SettingsFileManager.getSettingsFile().accountId}},{key:"getAndUpdateSettingsFile",value:function(e,t){return this.optOut?(this.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:"getAndUpdateSettingsFile"})),new Promise((function(e){e(null)}))):this.SettingsFileManager.getAndUpdateSettingsFile(e,t)}},{key:"_destroyInstanceVariables",value:function(){this.userStorageService=void 0,this.SettingsFileManager=void 0,this.usageStats=void 0,this.eventQueue=void 0,this.optOut=!0}}])&&a(t.prototype,n),o&&a(t,o),e}();e.exports=O},function(e,t,n){var i=n(28),a=n(52),r=n(53),o=n(54),s=n(55),l=n(58);e.exports={activate:i,getVariation:a,track:r,isFeatureEnabled:o,getFeatureVariableValue:s,push:l}},function(e,t,n){var i=n(3),a=n(5),r=n(8),o=n(7),s=n(11),l=n(6),u=n(1),c=n(0),g=n(2),E=n(12),f=c.LogLevelEnum,d=c.LogMessageEnum,S=c.LogMessageUtil,p=g.Activate;function v(e,t,n,i,a,r,o,u,c,g,v,_){var I=_.variationId,A=_.variationName,O=_.isStoredVariation;if(!l.isValidValue(A))return e.logger.log(f.INFO,S.build(d.INFO_MESSAGES.DECISION_NO_VARIATION_ALLOTED,{file:p,userId:n,campaignKey:t})),null;if(O&&!r)return e.logger.log(f.INFO,S.build(d.INFO_MESSAGES.CAMPAIGN_USER_ALREADY_TRACKED,{file:p,userId:n,campaignKey:t,api:a})),{variationName:A};if(i.batchEvents){var R=s.buildBatchEventForTrackingUser(o,u.id,I,n,c,g);e.batchEventsQueue.enqueue(R)}else if(o.isEventArchEnabled){var T=s.getEventsBaseProperties(o,E.VWO_VARIATION_SHOWN,e.usageStats.getUsageStats(),c,g),N=s.getTrackUserPayloadData(o,n,E.VWO_VARIATION_SHOWN,u.id,I);e.eventQueue.process(i,T,e,{payload:N,responseCallback:v})}else{var m=s.buildEventForTrackingUser(o,u.id,I,n,e.usageStats.getUsageStats(),c,g);e.eventQueue.process(i,m,e,{responseCallback:v})}return i.isDevelopmentMode?{variationName:A}:A}e.exports=function(e,t,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},c=a.ACTIVATE,g=!1;if(u.isObject(s)){var E=s.customVariables,_=s.variationTargetingVariables,I=s.userStorageData,A=s.shouldTrackReturningUser,O=s.metaData,R=s.responseCallback,T=s.userAgent,N=s.userIpAddress,m=T;l.areValidParamsForAPIMethod({method:a.ACTIVATE,campaignKey:t,userId:n,customVariables:E,variationTargetingVariables:_,userStorageData:I,shouldTrackReturningUser:A,metaData:O,responseCallback:R,visitorUserAgent:m,userIpAddress:N})&&(g=!0)}if(!1===g)return e.logger.log(f.ERROR,S.build(d.ERROR_MESSAGES.API_BAD_PARAMETERS,{file:p,api:a.ACTIVATE})),null;var h=e.SettingsFileManager.getConfig(),b=e.SettingsFileManager.getSettingsFile(c);if(!b)return null;A=A||h.shouldTrackReturningUser||!1;var y=o.getCampaign(b,t);if(y&&y.hasOwnProperty("isMAB")&&!0===y.isMAB&&void 0===e.userStorageService)return e.logger.log(f.ERROR,"("+p+") This campaign: "+t+" has MAB configured. Please configure User Storage to proceed."),null;if(!y||y.status!==i.STATUS_RUNNING)return e.logger.log(f.WARN,S.build(d.WARNING_MESSAGES.CAMPAIGN_NOT_RUNNING,{file:p,campaignKey:t,api:c})),null;if(!o.isAbCampaign(y))return e.logger.log(f.ERROR,S.build(d.ERROR_MESSAGES.API_NOT_APPLICABLE,{file:p,campaignKey:t,campaignType:y.type,userId:n,api:c})),null;var U=r.getVariation(h,b,y,t,n,E,_,I,O,!0,!1,void 0,c);return u.isPromise(U)?U.then((function(i){return v(e,t,n,h,c,A,b,y,m,N,R,i)})):v(e,t,n,h,c,A,b,y,m,N,R,U)}},function(e,t,n){var i=n(6),a=n(15),r=n(0),o=n(2),s=r.LogLevelEnum,l=r.LogMessageEnum,u=r.LogMessageUtil,c=r.getLogger(),g=o.VariationDecider,E={getVariationAllotted:function(e,t,n){var r={variation:null,variationId:null,variationName:null};if(!i.isValidValue(e))return c.log(s.ERROR,u.build(l.ERROR_MESSAGES.USER_ID_INVALID,{file:g,userId:e})),r;if(a.isUserPartOfCampaign(e,t)){var o=E.getVariationOfCampaignForUser(e,t,n)||{};r.variation=o,r.variationId=o.id,r.variationName=o.name}else c.log(s.INFO,u.build(l.INFO_MESSAGES.USER_NOT_PART_OF_CAMPAIGN,{file:g,userId:e,campaignKey:t.key}));return r},getVariationOfCampaignForUser:function(e,t,n){if(!t)return null;var i=a.bucketUserToVariation(e,t,n);return i&&i.name?(c.log(s.INFO,u.build(l.INFO_MESSAGES.USER_VARIATION_STATUS,{file:g,userId:e,campaignKey:t.key,status:"got Varation:".concat(i.name)})),{variation:i,name:i.name,id:i.id}):(c.log(s.INFO,u.build(l.INFO_MESSAGES.USER_VARIATION_STATUS,{file:g,userId:e,campaignKey:t.key,status:"got no variation"})),null)}};e.exports=E},function(e,t){e.exports={NUMBER:"number",STRING:"string",BOOLEAN:"boolean",OBJECT:"object"}},function(e,t,n){!function(){function t(e,t){var n,i,a,r,o,s,l,u;for(n=3&e.length,i=e.length-n,a=t,o=3432918353,s=461845907,u=0;u>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|a>>>19))+((5*(a>>>16)&65535)<<16)&4294967295))+((58964+(r>>>16)&65535)<<16);switch(l=0,n){case 3:l^=(255&e.charCodeAt(u+2))<<16;case 2:l^=(255&e.charCodeAt(u+1))<<8;case 1:a^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(u)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return a^=e.length,a=2246822507*(65535&(a^=a>>>16))+((2246822507*(a>>>16)&65535)<<16)&4294967295,a=3266489909*(65535&(a^=a>>>13))+((3266489909*(a>>>16)&65535)<<16)&4294967295,(a^=a>>>16)>>>0}var n=t;n.v2=function(e,t){for(var n,i=e.length,a=t^i,r=0;i>=4;)n=1540483477*(65535&(n=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+((1540483477*(n>>>16)&65535)<<16),a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),i-=4,++r;switch(i){case 3:a^=(255&e.charCodeAt(r+2))<<16;case 2:a^=(255&e.charCodeAt(r+1))<<8;case 1:a=1540483477*(65535&(a^=255&e.charCodeAt(r)))+((1540483477*(a>>>16)&65535)<<16)}return a=1540483477*(65535&(a^=a>>>13))+((1540483477*(a>>>16)&65535)<<16),(a^=a>>>15)>>>0},n.v3=t,e.exports=n}()},function(e,t,n){function i(e,t){for(var n=0;n2&&void 0!==arguments[2]&&arguments[2];if(!n)try{this._customLog(e,t)}catch(e){console.error("VWO: Could not log.",e)}}},{key:"info",value:function(e){this._customLog(o.INFO,e)}},{key:"debug",value:function(e){this._customLog(o.DEBUG,e)}},{key:"warn",value:function(e){this._customLog(o.WARN,e)}},{key:"error",value:function(e){this._customLog(o.ERROR,e)}}])&&i(t.prototype,n),a&&i(t,a),e}();e.exports={LogLevelEnum:o,LogNumberLevel:s,LogMessageUtil:l,LogMessageEnum:a,getLogger:function(e){return new f(e)},setLogHandler:function(e){E=e},setLogLevel:function(e){c=void 0===e?o.ERROR:e},getLogLevel:function(){return c},LogManager:f,setLogColorMode:function(e){g=e,E.isColoredLogEnabled=g},getLogColorMode:function(){return g},globalLogHandler:E}},function(e){e.exports=JSON.parse('{"CONFIG_BATCH_EVENT_LIMIT_EXCEEDED":"({file}): Impression event - {endPoint} failed due to exceeding payload size. Parameter eventsPerRequest in batchEvents config in launch API has value:{eventsPerRequest} for account ID:{accountId}. Please read the official documentation for knowing the size limits","CONFIG_LOG_LEVEL_SET":"({file}): Log level set to {level}","CONFIG_CUSTOM_LOGGER_USED":"({file}): Custom logger used","CONFIG_DEVELOPMENT_MODE_STATUS":"({file}): DEVELOPMENT mode is ON. No tracking call will be made to VWO Server","POLLING_SETTINGS_FILE_REGISTERED":"({file}): Polling of settings-file is registered with a periodic interval of {pollingInterval} ms","SETTINGS_FILE_PROCESSED":"({file}): settings-file matches the schema, validated and properly processed for the Account ID:{accountId}","IMPRESSION_FOR_TRACK_USER":"({file}): Impression built for tracking user - {properties}","IMPRESSION_FOR_TRACK_GOAL":"({file}): Impression built for tracking goal - {properties}","IMPRESSION_FOR_PUSH":"({file}): Impression built for pushing custom dimension - {properties}","IMPRESSION_FOR_EVENT_ARCH_TRACK_USER":"({file}): Impression built for vwo_variationShown event for Account ID:{accountId}, User ID:{userId}, and Campaign ID:{campaignId}","IMPRESSION_FOR_EVENT_ARCH_TRACK_GOAL":"({file}): Impression built for {goalName} event for Account ID:{accountId}, User ID:{userId}, and Campaign ID:{campaignId}","IMPRESSION_FOR_EVENT_ARCH_PUSH":"({file}): Impression built for visitor-property:{property} for Account ID:{accountId} and User ID:{userId}","EVENT_BATCH_BEFORE_FLUSHING":"({file}): flushing event queue {manually} having {length} events for Account ID:{accountId}. {timer}","EVENT_BATCH_FLUSH":"{{file}}: Manually flushing batch events for Account ID:{accountId} having {queueLength} events","USER_STORAGE_SERVICE_NOT_CONFIGURED":"({file}): User Storage Service is not configured to get/set the data","USER_STORAGE_SERVICE_NO_STORED_DATA":"({file}): No stored variation for User ID:{userId} for Campaign:{campaignKey} found in User Storage Service","VARIATION_RANGE_ALLOCATION":"({file}): Variation:{variationName} of Campaign:{campaignKey} having weight:{variationWeight} got bucketing range: ( {start} - {end} )","MEG_ELIGIBLE_CAMPAIGNS":"({file}): Campaigns: {eligibleCampaignKeys} are eligible, {inEligibleText} are ineligible from the Group:{groupName} for the User ID:{userId}","SEGMENTATION_SKIPPED":"({file}): Segmentation is not used for Campaign:{campaignKey}, hence skipping evaluating segmentation{variation} for User ID:{userId}","SEGMENTATION_STATUS":"({file}): User ID:{userId} for Campaign:{campaignKey} with variables:{customVariables} {status} {segmentationType} {variation}","WHITELISTING_SKIPPED":"({file}): Whitelisting is not used for Campaign:{campaignKey}, hence skipping evaluating whitelisting for User ID:{userId}","USER_UUID":"({file}): VWO UUID generated for Account Id:{accountId} and User ID:{userId} is {uuid}","USER_HASH_BUCKET_VALUE":"({file}): User ID:{userId} having hash:{hashValue} got bucketValue:{bucketValue}","USER_CAMPAIGN_BUCKET_VALUES":"({file}): User ID:{userId} for Campaign:{campaignKey} having percent-traffic:{percentTraffic} got hash-value:{hashValue} and bucket-value:{bucketValue}"}')},function(e){e.exports=JSON.parse('{"CONFIG_VALID":"({file}): SDK configuration and account settings-file are valid","CONFIG_PARAMETER_USED":"({file}): {parameter} paased in launch API having type:{type}","CONFIG_RETURN_PROMISE":"({file}): {method} API returns a promise as returnPromiseFor is set to true for this API","SDK_INITIALIZED":"({file}): SDK is properly initialzed with the passed configuration","POLLING_SUCCESS":"({file}): settings-file fetched successfully via polling for the accountId:{accountId}","POLLING_SETTINGS_FILE_UPDATED":"({file}): SDK instance is updated with the latest settings-file for the accountId:{accountId}","POLLING_SETTINGS_FILE_NOT_UPDATED":"{file}: settings-file fetched via polling is same as earlier fetched settings","DECISION_NO_VARIATION_ALLOTED":"({file}): Variation was not assigned to the User ID:{userId} for Campaign:{campaignKey}","EVENT_BATCH_DEFAULTS":"({file}): {parameter} not passed in SDK configuration, setting it default to {defaultValue}","EVENT_QUEUE":"({file}): Event with payload:{event} pushed to the {queueType} queue","EVENT_BATCH_After_FLUSHING":"({file}): Event queue having {length} events has been flushed {manually}","CAMPAIGN_NOT_ACTIVATED":"({file}): Activate the campaign:{campaignKey} first for User ID:{userId} to {reason}","CAMPAIGN_USER_ALREADY_TRACKED":"({file}): User ID:{userId} for Campaign:{campaignKey} has already been tracked earlier for \\"{api}\\" API. No tracking call is made to VWO server","CAMPAIGN_GOAL_ALREADY_TRACKED":"({file}): Goal:{goalIdentifier} of Campaign:{campaignKey} for User ID:{userId} has already been tracked earlier. No tracking call is made to VWO server","GOT_STORED_VARIATION":"({file}): Got stored variation from User Storage Service for User ID:{userId} for Campaign:{campaignKey} as Variation:{variationName}","GETTING_DATA_USER_STORAGE_SERVICE":"({file}): Read data from User Storage Service for User ID:{userId} and Campaign:{campaignKey}","SETTING_DATA_USER_STORAGE_SERVICE":"({file}): Set data into User Storage Service for User ID:{userId} and Campaign:{campaignKey}","IMPRESSION_SUCCESS":"({file}): Impression event - {endPoint} was successfully received by VWO having main keys: Account ID:{accountId}, {mainKeys}","IMPRESSION_SUCCESS_FOR_EVENT_ARCH":"({file}): Impression for {event} - {endPoint} was successfully received by VWO for Account ID:{accountId}","IMPRESSION_BATCH_SUCCESS":"({file}): Impression event - {endPoint} was successfully received by VWO having Account ID:{accountId}","IMPRESSION_BATCH_FAILED":"({file}): Batch events couldn\\"t be received by VWO. Calling Flush Callback with error and data","MEG_ELIGIBLE_CAMPAIGNS":"({file}): Got {noOfEligibleCampaigns} eligible winners out of {noOfGroupCampaigns} campaigns from the Group:{groupName} and for User ID:{userId}","OTHER_CAMPAIGN_SATISFIES_WHITELISTING_STORAGE":"({file}): Campaign:{campaignKey} of Group:{groupName} satisfies {type} for User ID:{userId}","SEGMENTATION_STATUS":"({file}): User ID:{userId} for Campaign:{campaignKey} with variables:{customVariables} {status} {segmentationType} {variation}","MEG_CALLED_CAMPAIGN_NOT_WINNER":"({file}): Campaign:{campaignKey} does not qualify from the mutually exclusive group:{groupName} for User ID:{userId}","MEG_GOT_WINNER_CAMPAIGN":"({file}): Campaign:{campaignKey} is selected from the mutually exclusive group:{groupName} for the User ID:{userId}","FEATURE_STATUS":"({file}): Campaign:{campaignKey} is {status} for user ID:{userId}","FEATURE_VARIABLE_VALUE":"({file}): For User ID:{userId}, value for variable:{variableKey} of feature:{campaignKey} is:{variableValue}","FEATURE_VARIABLE_DEFAULT_VALUE":"({file}): Feature is not enabled for variation:{variationName}. Returning default value for the variable:{variableKey}","USER_NOT_PART_OF_CAMPAIGN":"({file}): User ID:{userId} did not qualify for Campaign:{campaignKey}","USER_VARIATION_STATUS":"({file}): User ID:{userId} for Campaign:{campaignKey} {status}","USER_CAMPAIGN_ELIGIBILITY":"({file}): User ID:{userId} for Campaign:{campaignKey} is {status} to become part of campaign","USER_VARIATION_ALLOCATION_STATUS":"({file}): User ID:{userId} for Campaign:{campaignKey} {status}","OPT_OUT_API_CALLED":"({file}): You have opted out for not tracking i.e. all API calls will stop functioning and will simply early return","API_NOT_ENABLED":"({file}): {api} API is disabled as you opted out for tracking. Reinitialize the SDK to enable the normal functioning of all APIs.","INITIATING_ACTIVATE":"({file}): Initiating activation of user {userId} for campaign {campaignKey}.","INITIATING_GET_VARIATION":"({file}): Initiating getVariation of user \'{userId}\' for campaign \'{campaignKey}\'.","INITIATING_GET_FEATURE_VARIATION":"({file}): Initiating getFeatureVariable for variable key \'{variableKey}\' of user \'{userId}\' for campaign \'{campaignKey}\'.","INITIATING_IS_FEATURE_ENABLED":"({file}): Initiating isFeatureEnabled of user \'{userId}\' for campaign \'{campaignKey}\'.","INITIATING_PUSH_DIMENSION":"({file}): Initiating push segment of user \'{userId}\' with tag name `{tagKey}` and tag value \'{tagValue}\'."}')},function(e){e.exports=JSON.parse('{"CAMPAIGN_NOT_RUNNING":"({file}): {api} API called with Campaign:{campaignKey} but the campaign is not RUNNING. Please verify from VWO App","CAMPAIGN_NOT_ACTIVATED":"({file}): Campaign:{campaignKey} for User ID:{userId} is not yet activated for API:{api}. Use activate API to activate A/B test or isFeatureEnabled API to activate Feature Test"}')},function(e){e.exports=JSON.parse('{"CONFIG_PARAMETER_INVALID":"({file}): {parameter} paased in {api} API is not correct. It should be of type:{type}","CONFIG_POLLING_SDK_KEY_NOT_PROVIVED":"({file}): SDK Key is required along with pollingInterval to poll the settings-file","CONFIG_CORRUPTED":"({file}): Config passed to {api} API is invalid. Please refer developer docs","SETTINGS_FILE_INVALID":"({file}): Settings file passed while instantiating SDK instance is invalid","SETTINGS_FILE_CORRUPTED":"({file}): Fetched settings-file doesn\'t match the desired schema. Please contact VWO Support for help","BATCH_QUEUE_EMPTY":"{{file}}: No batch queue present for account:{accountId} when calling flushEvents API. Check batchEvents config in launch API","API_HAS_CORRUPTED_SETTINGS_FILE":"({file}): {api} API has corrupted settings-file. Please check or reach out to VWO support","API_BAD_PARAMETERS":"({file}): {api} API got bad parameters. Refer the developer docs","API_NOT_APPLICABLE":"({file}): {api} API is not valid for Campaign:{campaignKey} having type:{campaignType} for User ID:{userId}","USER_ID_INVALID":"({file}): Invalid User Id:{userId} passed to the API","CAMPAIGN_NOT_FOUND_FOR_GOAL":"({file}): No such campaign found corresponding to goalIdentifier:{goalIdentifier}. Please verify from VWO app","POLLING_FAILED":"({file}): Fetching of settings-file failed via polling for the accountId:{accountId}","SEGMENTATION_REGEX_CREATION_FAILED":"({file}): Regular expression:{regex} used for targeting cound not be evaluated","SEGMENTATION_ERROR":"({file}): Could not segment the User ID:{userId} for Campaign:{campaignKey}{variation} with customVariables:{customVariables}. Error message: {err}","USER_STORAGE_SERVICE_GET_FAILED":"({file}): Getting data from User Storage Service failed for User ID:{userId}. Error: {error}","USER_STORAGE_SERVICE_SET_FAILED":"({file}): Saving data into User Storage Service failed for User ID:{userId}. Error: {error}","IMPRESSION_FAILED":"({file}): Impression event could not be sent to VWO - {endPoint}. Reason: {err}","TAG_KEY_LENGTH_EXCEEDED":"({file}): Length of custom dimension key:{tagKey} for User Id:{userId} can not be greater than 255","TAG_VALUE_LENGTH_EXCEEDED":"({file}): Length of custom dimension value:{tagValue} of tagKey:{tagKey} for User Id:{userId} can not be greater than 255","TRACK_API_GOAL_NOT_FOUND":"({file}): Goal:{goalIdentifier} not found for Campaign:{campaignKey} and User Id:{userId}","TRACK_API_REVENUE_NOT_PASSED_FOR_REVENUE_GOAL":"({file}): Revenue value should be passed for revenue goal:{goalIdentifier} for Campaign:{campaignKey} and User Id:{userId}","TRACK_API_EVENTS_REVENUE_NOT_PASSED":"({file}): Revenue value should be passed either in options or as an event property for revenue goal:{goalIdentifier} for Campaign:{campaignKey} and User Id:{userId}","UNABLE_TO_CAST_VALUE":"({file}): Unable to cast value:{variableValue} to type:{variableType}, returning null","VARIABLE_NOT_FOUND":"({file}): Variable:{variableKey} for User ID:{userId} is not found in settings-file, returning null","MISSING_IMPORT_SETTINGS_MANDATORY_PARAMS":"AccountId and sdkKey are required for fetching account settings. Aborting!","ACCOUNT_SETTINGS_NOT_FOUND":"({file}): Request failed for fetching account settings. Got Status Code: ${statusCode} and message: ${message}"}')},function(e,t){e.exports={BOLD:"",CYAN:"",GREEN:"",LIGHTBLUE:"",RED:"",RESET:"",WHITE:"",YELLOW:""}},function(e,t,n){var i=n(1),a=/\{([0-9a-zA-Z_]+)\}/g,r={build:function(e,t){try{return e.replace(a,(function(n,a,r){var o;if("{"===e[r-1]&&"}"===e[r+n.length])return a;if(t.hasOwnProperty(a)){var s=t[a];i.isFunction(s)&&(s=t[a]()),o=s}else o=null;return null==o?"":o}))}catch(t){return e}}};e.exports=r},function(e,t,n){function i(e,t){for(var n=0;n=this.logLevel}},{key:"setLogLevel",value:function(e){this.logLevel=void 0===e?o.ERROR:e}},{key:"consoleLog",value:function(e,t){switch(e){case o.INFO:console.info.apply(console,t);break;case o.WARN:console.warn.apply(console,t);break;case o.ERROR:console.error.apply(console,t);break;default:console.log.apply(console,t)}}}])&&i(t.prototype,n),r&&i(t,r),e}();e.exports=u},function(e,t){e.exports={PASSED:"passed",FAILED:"failed"}},function(e,t,n){var i=n(18),a=n(10).getKeyValue,r=n(46),o=r.operandCustomVariablesParser,s=r.operandUserParser,l=n(0),u=n(1),c=n(2),g=i.SegmentOperatorTypes,E=g.AND,f=g.OR,d=g.NOT,S=i.SegmentOperandTypes,p=S.CUSTOM_VARIABLE,v=S.USER,_=l.LogLevelEnum,I=l.LogMessageEnum,A=l.LogMessageUtil,O=c.SegmentEvaluator,R=l.getLogger();function T(e,t){var n=a(e),i=n.key,r=n.value;if(i===d)return!T(r,t);if(i===E){for(var l=[],u=0;u1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5&&void 0!==arguments[5]&&arguments[5];try{return u.isObject(e)&&!Object.keys(e).length?(R.log(_.DEBUG,A.build(I.DEBUG_MESSAGES.SEGMENTATION_SKIPPED,{campaignKey:n,userId:i,file:O}),r),!0):!u.isObject(e)||!Object.keys(e).length||T(e,t)}catch(e){return R.log(_.ERROR,A.build(I.ERROR_MESSAGES.SEGMENTATION_ERROR,{campaignKey:n,userId:i,customVariables:JSON.stringify(t),file:O,err:e,variation:a}),r),!1}}},function(e,t){e.exports={CUSTOM_VARIABLE:"custom_variable",USER:"user"}},function(e,t){e.exports={AND:"and",NOT:"not",OR:"or"}},function(e,t){e.exports={LOWER:/^lower/,LOWER_MATCH:/^lower\((.*)\)/,WILDCARD:/^wildcard/,WILDCARD_MATCH:/^wildcard\((.*)\)/,REGEX:/^regex/,REGEX_MATCH:/^regex\((.*)\)/,STARTING_STAR:/^\*/,ENDING_STAR:/\*$/,GREATER_THAN_MATCH:/^gt\(((\d+\.?\d*)|(\.\d+))\)/,GREATER_THAN_EQUAL_TO_MATCH:/^gte\(((\d+\.?\d*)|(\.\d+))\)/,LESS_THAN_MATCH:/^lt\(((\d+\.?\d*)|(\.\d+))\)/,LESS_THAN_EQUAL_TO_MATCH:/^lte\(((\d+\.?\d*)|(\.\d+))\)/}},function(e,t){e.exports={LOWER_VALUE:1,STARTING_ENDING_STAR_VALUE:2,STARTING_STAR_VALUE:3,ENDING_STAR_VALUE:4,REGEX_VALUE:5,EQUAL_VALUE:6,GREATER_THAN_VALUE:7,GREATER_THAN_EQUAL_TO_VALUE:8,LESS_THAN_VALUE:9,LESS_THAN_EQUAL_TO_VALUE:10}},function(e,t,n){var i=n(1),a=n(4).matchWithRegex,r=n(10).getKeyValue,o=n(18),s=o.SegmentOperandValueTypeRegexes,l=s.LOWER_MATCH,u=s.WILDCARD_MATCH,c=s.REGEX_MATCH,g=s.STARTING_STAR,E=s.ENDING_STAR,f=s.GREATER_THAN_MATCH,d=s.GREATER_THAN_EQUAL_TO_MATCH,S=s.LESS_THAN_MATCH,p=s.LESS_THAN_EQUAL_TO_MATCH,v=o.SegmentOperandValues,_=v.LOWER_VALUE,I=v.STARTING_ENDING_STAR_VALUE,A=v.STARTING_STAR_VALUE,O=v.ENDING_STAR_VALUE,R=v.REGEX_VALUE,T=v.EQUAL_VALUE,N=v.GREATER_THAN_VALUE,m=v.GREATER_THAN_EQUAL_TO_VALUE,h=v.LESS_THAN_VALUE,b=v.LESS_THAN_EQUAL_TO_VALUE;function y(e,t){return a(e,t)&&a(e,t)[1]}function U(e,t){var n=parseFloat(e,10),i=parseFloat(t,10);return n&&i?(n===Math.floor(n)&&(n=parseInt(n,10)),i===Math.floor(i)&&(i=parseInt(i,10)),{operandValue:n.toString(),tagValue:i.toString()}):{operandValue:e,tagValue:t}}function G(e){return void 0===e&&(e=""),i.isBoolean(e)&&(e=!!e),null!==e&&(e=e.toString()),e}function L(e){var t,n,i,r;return a(e,l)?(t=_,n=y(e,l)):a(e,u)?(n=y(e,u),i=a(n,g),r=a(n,E),i&&r?t=I:i?t=A:r&&(t=O),n=n.replace(g,"").replace(E,"")):a(e,c)?(t=R,n=y(e,c)):a(e,f)?(t=N,n=y(e,f)):a(e,d)?(t=m,n=y(e,d)):a(e,S)?(t=h,n=y(e,S)):a(e,p)?(t=b,n=y(e,p)):(t=T,n=e),{operandType:t,operandValue:n}}e.exports={extractOperandValue:y,processValues:U,preProcessTagValue:G,preProcessOperandValue:L,operandCustomVariablesParser:function(e,t){var n=r(e),i=n.key,a=i;if(e=n.value,!t.hasOwnProperty(i))return!1;var o=t[a];o=G(o);var s=L(e),l=s.operandType,u=U(s.operandValue,o);return o=u.tagValue,function(e,t,n){var i;switch(e){case _:null!==n&&(i=t.toLowerCase()===n.toLowerCase());break;case I:null!==n&&(i=n.indexOf(t)>-1);break;case A:null!==n&&(i=n.endsWith(t));break;case O:null!==n&&(i=n.startsWith(t));break;case R:try{var a=new RegExp(t,"g");i=!!a.test(n)}catch(e){i=!1}break;case N:if(null!==n)try{i=parseFloat(t)parseFloat(n)}catch(e){i=!1}break;case b:if(null!==n)try{i=parseFloat(t)>=parseFloat(n)}catch(e){i=!1}break;default:i=n===t}return i}(l,u.operandValue,o)},operandUserParser:function(e,t){for(var n=e.split(","),i=0;i>>32-t}e.exports=function(e){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var r=unescape(encodeURIComponent(e));e=new Array(r.length);for(var o=0;o>>0;v=p,p=S,S=a(d,30)>>>0,d=f,f=I}n[0]=n[0]+f>>>0,n[1]=n[1]+d>>>0,n[2]=n[2]+S>>>0,n[3]=n[3]+p>>>0,n[4]=n[4]+v>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}},function(e,t,n){var i=n(3),a=n(5),r=n(8),o=n(7),s=n(6),l=n(1),u=n(0),c=n(2),g=u.LogLevelEnum,E=u.LogMessageEnum,f=u.LogMessageUtil,d=c.GetVariation;e.exports=function(e,t,n){var u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},c=a.GET_VARIATION_NAME,S=!1;if(l.isObject(u)){var p=u.customVariables,v=u.variationTargetingVariables,_=u.userStorageData,I=u.metaData;s.areValidParamsForAPIMethod({method:a.GET_VARIATION_NAME,campaignKey:t,userId:n,customVariables:p,variationTargetingVariables:v,userStorageData:_,metaData:I})&&(S=!0)}if(!1===S)return e.logger.log(g.ERROR,f.build(E.ERROR_MESSAGES.API_BAD_PARAMETERS,{file:d,api:a.GET_VARIATION_NAME})),null;var A=e.SettingsFileManager.getConfig(),O=e.SettingsFileManager.getSettingsFile(c);if(A.apiName=c,!O)return null;var R=o.getCampaign(O,t);if(!R||R.status!==i.STATUS_RUNNING)return e.logger.log(g.WARN,f.build(E.WARNING_MESSAGES.CAMPAIGN_NOT_RUNNING,{file:d,campaignKey:t,api:c})),null;if(o.isFeatureRolloutCampaign(R))return e.logger.log(g.ERROR,f.build(E.ERROR_MESSAGES.API_NOT_APPLICABLE,{file:d,campaignKey:t,campaignType:R.type,userId:n,api:c})),null;var T=r.getVariation(A,O,R,t,n,p,v,_,I,!1,!1,void 0,c);return l.isPromise(T)?T.then((function(e){return e})):T.variationName?T.variationName:null}},function(e,t,n){function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=n(3),r=n(9),o=n(5),s=n(8),l=n(7),u=n(10).objectValues,c=n(11),g=n(6),E=n(1),f=n(0),d=n(2),S=f.LogLevelEnum,p=f.LogMessageEnum,v=f.LogMessageUtil,_=d.Track,I=r.ALL,A=o.TRACK;function O(e,t,n,i,a,r,o,l,u,g,E,f,d,S,p){if(!Object.keys(p).length)return null;if(u&&u.length)for(var v=0;v0){var _=c.getEventsBaseProperties(n,r,{},d,S),I=c.getTrackGoalPayloadData(n,a,r,l,o,i,f);e.eventQueue.process(t,_,e,{payload:I,responseCallback:E}),n.isEventArchEnabled||Object.keys(l).forEach((function(e){s._saveUserData(t,l[e].campaign,l[e].variationName,l[e].userId,l[e].metaData,r)}))}return t.isDevelopmentMode?Object.assign({},p,{isDevelopmentMode:t.isDevelopmentMode}):p}function R(e,t,n,i,o,u,c,f,d,O,R,m,h,b,y,U,G,L,F,C,V){if(!t||t.status!==a.STATUS_RUNNING)return e.logger.log(S.WARN,v.build(p.WARNING_MESSAGES.CAMPAIGN_NOT_RUNNING,{file:_,campaignKey:n,api:A})),!1;if(l.isFeatureRolloutCampaign(t))return e.logger.log(S.ERROR,v.build(p.ERROR_MESSAGES.API_NOT_APPLICABLE,{file:_,campaignKey:n,campaignType:t.type,userId:i,api:A})),!1;var P=t.id,M=l.getCampaignGoal(o,t.key,u);if(!M)return e.logger.log(S.ERROR,v.build(p.ERROR_MESSAGES.TRACK_API_GOAL_NOT_FOUND,{file:_,userId:i,goalIdentifier:u,campaignKey:n})),!1;if(m!==I&&M.type!==m)return!1;if(M.type===r.REVENUE&&!g.isValidValue(c)){if(!o.isEventArchEnabled)return N(e,i,u,n),!1;if(-1!==M.mca){if(E.isUndefined(F)||!F.hasOwnProperty(M.revenueProp))return N(e,i,u,n),!1}else if(M.revenueProp&&(E.isUndefined(F)||!F.hasOwnProperty(M.revenueProp)))return N(e,i,u,n),!1}M.type===r.REVENUE&&M.revenueProp&&U.add(M.revenueProp);var D=s.getVariation(f,o,t,n,i,d,O,R,b,!1,!0,u,A);return E.isPromise(D)?D.then((function(a){return Object.keys(a).length?T(e,n,P,i,f,M,h,o,t,u,c,b,y,G,L,F,C,V,a):null})):T(e,n,P,i,f,M,h,o,t,u,c,b,y,G,L,F,C,V,D)}function T(e,t,n,i,a,r,o,l,u,g,E,f,d,I,A,O,R,T,N){var m=N.variationId,h=N.variationName,b=N.storedGoalIdentifier;if(h){if(b)if(b.split("_vwo_").includes(g)){if(!o&&-1!==r.mca)return e.logger.log(S.INFO,v.build(p.INFO_MESSAGES.CAMPAIGN_GOAL_ALREADY_TRACKED,{file:_,userId:i,goalIdentifier:g,campaignKey:t})),!1}else b+="_vwo_"+g,l.isEventArchEnabled||s._saveUserData(a,u,h,i,f,b);if(a.batchEvents){var y=c.buildBatchEventForTrackingGoal(l,n,m,i,r,E,O,R,T);e.batchEventsQueue.enqueue(y)}else{if(l.isEventArchEnabled)return d[u.id]={config:a,campaign:u,variationName:h,userId:i,metaData:f,goal:r},!0;var U={};U=A?c.buildBatchEventForTrackingGoal(l,n,m,i,r,E,R,T):c.buildEventForTrackingGoal(l,n,m,i,r,E,R,T),I.push(U)}return l.isEventArchEnabled||s._saveUserData(a,u,h,i,f,g),!0}return!1}function N(e,t,n,i){e.logger.log(S.ERROR,v.build(p.ERROR_MESSAGES.TRACK_API_REVENUE_NOT_PASSED_FOR_REVENUE_GOAL,{file:_,userId:t,goalIdentifier:n,campaignKey:i}))}e.exports=function(e,t,n,a){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},c=!1;if(E.isObject(s)){var f=s.revenueValue,d=s.customVariables,T=s.variationTargetingVariables,N=s.userStorageData,m=s.goalTypeToTrack,h=s.shouldTrackReturningUser,b=s.metaData,y=s.responseCallback,U=s.eventProperties,G=s.userAgent,L=s.userIpAddress,F=G;g.areValidParamsForAPIMethod({method:o.TRACK,campaignKey:t,userId:n,goalIdentifier:a,customVariables:d,variationTargetingVariables:T,userStorageData:N,goalTypeToTrack:m,shouldTrackReturningUser:h,metaData:b,responseCallback:y,eventProperties:U,visitorUserAgent:F,userIpAddress:L})&&(!m||m&&u(r).includes(m))&&(c=!0)}if(!1===c)return e.logger.log(S.ERROR,v.build(p.ERROR_MESSAGES.API_BAD_PARAMETERS,{file:_,api:o.TRACK})),null;var C=e.SettingsFileManager.getConfig(),V=e.SettingsFileManager.getSettingsFile(A);C.apiName=A;var P=new Set;if(!V)return null;var M=l.getCampaign(V,t);if(M&&M.hasOwnProperty("isMAB")&&!0===M.isMAB&&void 0===e.userStorageService)return e.logger.log(S.ERROR,"("+_+") This campaign: "+t+" has MAB configured. Please configure User Storage to proceed."),null;var D=[];if(m=m||C.goalTypeToTrack||I,E.isUndefined(h)&&(h=!!E.isBoolean(C.shouldTrackReturningUser)&&C.shouldTrackReturningUser),E.isString(t)){var k=l.getCampaign(V,t);D.push(k||{key:t})}else D=E.isArray(t)?l.getCampaignsForKeys(V,t):l.getCampaignsForGoal(V,a,m);var B={},K={},j=[],w=!1;D.forEach((function(t){return B[t.key]=R(e,t,t.key,n,V,a,f,C,d,T,N,m,h,b,K,P,j,w,U,F,L)}));var x=!!(B&&Object.keys(B).length>0)&&Object.values(B).every((function(e){return E.isPromise(e)}));return x?Promise.all(Object.values(B)).then((function(t){return t.forEach((function(t,r){var o=Object.keys(B)[r],s=O(e,C,V,P,n,a,f,K,j,w,y,U,F,L,i({},o,t));B[o]=s[o]})),B})):O(e,C,V,P,n,a,f,K,j,w,y,U,F,L,B)}},function(e,t,n){var i=n(3),a=n(5),r=n(8),o=n(7),s=n(11),l=n(6),u=n(1),c=n(0),g=n(2),E=n(12),f=c.LogLevelEnum,d=c.LogMessageEnum,S=c.LogMessageUtil,p=g.IsFeatureEnabled;function v(e,t,n,i,a,r,l,u,c,g,v,_){var I=_.variation,A=_.variationId,O=_.variationName,R=_.isStoredVariation,T=!1;if(O){if(T=o.isFeatureRolloutCampaign(u)||I.isFeatureEnabled,!R||r){if(i.batchEvents){var N=s.buildBatchEventForTrackingUser(l,u.id,A,n,g,v);e.batchEventsQueue.enqueue(N)}else if(l.isEventArchEnabled){var m=s.getEventsBaseProperties(l,E.VWO_VARIATION_SHOWN,e.usageStats.getUsageStats(),g,v),h=s.getTrackUserPayloadData(l,n,E.VWO_VARIATION_SHOWN,u.id,A);e.eventQueue.process(i,m,e,{payload:h,responseCallback:c})}else{var b=s.buildEventForTrackingUser(l,u.id,A,n,e.usageStats.getUsageStats(),g,v);e.eventQueue.process(i,b,e,{responseCallback:c})}return e.logger.log(f.INFO,S.build(d.INFO_MESSAGES.FEATURE_STATUS,{file:p,campaignKey:t,userId:n,status:T?"enabled":"disabled"})),i.isDevelopmentMode?{isFeatureEnabled:T}:T}e.logger.log(f.INFO,S.build(d.INFO_MESSAGES.CAMPAIGN_USER_ALREADY_TRACKED,{file:p,userId:n,campaignKey:t,api:a}))}return e.logger.log(f.INFO,S.build(d.INFO_MESSAGES.FEATURE_STATUS,{file:p,campaignKey:t,userId:n,status:T?"enabled":"disabled"})),R||i.isDevelopmentMode,{isFeatureEnabled:T}}e.exports=function(e,t,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},c=a.IS_FEATURE_ENABLED,g=!1;if(u.isObject(s)){var E=s.customVariables,_=s.variationTargetingVariables,I=s.userStorageData,A=s.shouldTrackReturningUser,O=s.metaData,R=s.responseCallback,T=s.userAgent,N=s.userIpAddress,m=T;l.areValidParamsForAPIMethod({method:a.IS_FEATURE_ENABLED,campaignKey:t,userId:n,customVariables:E,variationTargetingVariables:_,userStorageData:I,shouldTrackReturningUser:A,metaData:O,responseCallback:R,visitorUserAgent:m,userIpAddress:N})&&(g=!0)}if(!1===g)return e.logger.log(f.ERROR,S.build(d.ERROR_MESSAGES.API_BAD_PARAMETERS,{file:p,api:a.isFeatureEnabled})),null;var h=e.SettingsFileManager.getConfig(),b=e.SettingsFileManager.getSettingsFile(c);if(!b)return null;A=A||h.shouldTrackReturningUser||!1;var y=o.getCampaign(b,t);if(y&&y.hasOwnProperty("isMAB")&&!0===y.isMAB&&void 0===e.userStorageService)return e.logger.log(f.ERROR,"("+p+") This campaign: "+t+" has MAB configured. Please configure User Storage to proceed."),null;if(!y||y.status!==i.STATUS_RUNNING)return e.logger.log(f.WARN,S.build(d.WARNING_MESSAGES.CAMPAIGN_NOT_RUNNING,{file:p,campaignKey:t,api:c})),null;if(o.isAbCampaign(y))return e.logger.log(f.ERROR,S.build(d.ERROR_MESSAGES.API_NOT_APPLICABLE,{file:p,campaignKey:t,campaignType:y.type,userId:n,api:c})),null;var U=r.getVariation(h,b,y,t,n,E,_,I,O,!0,!1,void 0,c);return u.isPromise(U)?U.then((function(i){return v(e,t,n,h,c,A,b,y,R,m,N,i)})):v(e,t,n,h,c,A,b,y,R,m,N,U)}},function(e,t,n){var i=n(3),a=n(5),r=n(8),o=n(7),s=n(6),l=n(56),u=n(1),c=n(10),g=n(0),E=n(2),f=g.LogLevelEnum,d=g.LogMessageEnum,S=g.LogMessageUtil,p=E.GetFeatureVariableValue;function v(e,t,n,i,a,r){var s,u=r.variation,g=r.variationName;if(!g)return e.logger.log(f.INFO,S.build(d.INFO_MESSAGES.FEATURE_STATUS,{file:p,campaignKey:t,userId:i,status:"disabled"})),null;if(o.isFeatureRolloutCampaign(a)?s=l.getVariableForFeature(a,n):o.isFeatureTestCampaign(a)&&(s=l.getVariableValueForVariation(a,u,n),c.areObjectKeys(s)&&u.isFeatureEnabled?e.logger.log(f.INFO,S.build(d.INFO_MESSAGES.FEATURE_VARIABLE_VALUE,{file:p,variableKey:n,campaignKey:a.key,variableValue:s.value,userId:i})):c.areObjectKeys(s)&&!u.isFeatureEnabled&&e.logger.log(f.INFO,S.build(d.INFO_MESSAGES.FEATURE_VARIABLE_DEFAULT_VALUE,{file:p,variableKey:n,variationName:g}))),!c.areObjectKeys(s))return e.logger.log(f.ERROR,S.build(d.ERROR_MESSAGES.VARIABLE_NOT_FOUND,{file:p,variableKey:n,userId:i})),null;var E=s.value;return l.getTypeCastVariableValue(E,s.type)}e.exports=function(e,t,n,l){var c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};try{var g=a.GET_FEATURE_VARIABLE_VALUE,E=!1;if(u.isObject(c)){var _=c.customVariables,I=c.variationTargetingVariables,A=c.userStorageData,O=c.metaData;s.areValidParamsForAPIMethod({method:a.GET_FEATURE_VARIABLE_VALUE,campaignKey:t,variableKey:n,userId:l,customVariables:_,variationTargetingVariables:I,userStorageData:A,metaData:O})&&(E=!0)}if(!1===E)return e.logger.log(f.ERROR,S.build(d.ERROR_MESSAGES.API_BAD_PARAMETERS,{file:p,api:a.GetFeatureVariableValue})),null;var R=e.SettingsFileManager.getConfig(),T=e.SettingsFileManager.getSettingsFile(g);if(R.apiName=g,!T)return null;var N=o.getCampaign(T,t);if(!N||N.status!==i.STATUS_RUNNING)return e.logger.log(f.WARN,S.build(d.WARNING_MESSAGES.CAMPAIGN_NOT_RUNNING,{file:p,campaignKey:t,api:g})),null;if(o.isAbCampaign(N))return e.logger.log(f.ERROR,S.build(d.ERROR_MESSAGES.API_NOT_APPLICABLE,{file:p,campaignKey:t,campaignType:N.type,userId:l,api:g})),null;var m=r.getVariation(R,T,N,t,l,_,I,A,O,!1,!1,void 0,g);return u.isPromise(m)?m.then((function(i){return v(e,t,n,l,N,i)})):v(e,t,n,l,N,m)}catch(t){return e.logger.log(f.ERROR,t.message),null}}},function(e,t,n){var i=n(7),a=n(1),r=n(57),o=n(0),s=n(2),l=o.LogLevelEnum,u=o.LogMessageEnum,c=o.LogMessageUtil,g=o.getLogger(),E=s.FeatureUtil,f={getVariableForFeature:function(e,t){var n={};if(i.isFeatureRolloutCampaign(e)){for(var a=e.variables||[],r=0;r5&&void 0!==arguments[5]?arguments[5]:{},S=d.responseCallback,p=i.PUSH;if(!s.areValidParamsForAPIMethod({method:i.PUSH,tagKey:t,tagValue:n,userId:a,customDimensionMap:r,responseCallback:S}))return e.logger.log(c.ERROR,E.build(g.ERROR_MESSAGES.PUSH_INVALID_PARAMS,{file:f,method:p})),!1;if(t.length>255)return e.logger.log(c.ERROR,E.build(g.ERROR_MESSAGES.TAG_KEY_LENGTH_EXCEEDED,{file:f,tagKey:t,userId:a})),!1;if(n.length>255)return e.logger.log(c.ERROR,E.build(g.ERROR_MESSAGES.TAG_VALUE_LENGTH_EXCEEDED,{file:f,tagKey:t,userId:a,tagValue:n})),!1;if(" "===t&&" "===n&&(!r||0===Object.keys(r).length))return e.logger.log(c.ERROR,E.build(g.ERROR_MESSAGES.PUSH_INVALID_PARAMS,{file:f,method:p})),!1;" "!==t&&" "!==n&&(r[t]=n);var v=e.SettingsFileManager.getConfig(),_=e.SettingsFileManager.getSettingsFile(p);if(!_)return!1;var I={};if(v.batchEvents)Object.keys(r).forEach((function(t){var n=u.isString(r[t])?r[t]:JSON.stringify(r[t]),i=l.buildBatchEventForPushing(_,t,n,a);e.batchEventsQueue.enqueue(i),I[t]=!0}));else if(_.isEventArchEnabled){var A=l.getEventsBaseProperties(_,o.VWO_SYNC_VISITOR_PROP),O=l.getPushPayloadData(_,a,o.VWO_SYNC_VISITOR_PROP,r);e.eventQueue.process(v,A,e,{payload:O,responseCallback:S}),I.success=!0}else{var R=[],T=Object.keys(r);T.forEach((function(t){var n,i=u.isString(r[t])?r[t]:JSON.stringify(r[t]);n=l.buildEventForPushing(_,t,i,a),e.eventQueue.process(v,n,e,{responseCallback:S}),R.push(n),I[t]=!0}))}return v.isDevelopmentMode?Object.assign({},I,{isDevelopmentMode:v.isDevelopmentMode}):I}},function(e,t,n){function i(e,t){for(var n=0;n3&&void 0!==arguments[3]?arguments[3]:{},a=i.payload,r=i.responseCallback,o={};t&&t.visitor_ua&&(o[l.USER_AGENT]=encodeURIComponent(t.visitor_ua),t.visitor_ua=o[l.USER_AGENT]),t&&t.visitor_ip&&(o[l.IP]=encodeURIComponent(t.visitor_ip),t.visitor_ip=o[l.IP]),e&&e.isDevelopmentMode?E.log(u.DEBUG,g.build(c.DEBUG_MESSAGES.CONFIG_DEVELOPMENT_MODE_STATUS,{file:f})):this.enqueue(t,n,{payload:a,responseCallback:r},o)}},{key:"enqueue",value:function(e,t,n){var i=n.payload,a=n.responseCallback,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.queue.push({eventName:e.eventName,properties:e,callback:function(){i?r.dispatchPostCall(e,i,{responseCallback:a},o):r.dispatchGetCall(e,{responseCallback:a},o)}}),E.log(u.INFO,g.build(c.INFO_MESSAGES.EVENT_QUEUE,{file:f,queueType:"normal",event:"VWO_MASKED_PAYLOAD"})),t.eventQueue.executeNext(e),this.running||this.executeNext(e),this}},{key:"executeNext",value:function(e){if(this.running=!1,this.queue&&this.queue.length){var t=this.queue.shift();t&&(this.running=!0,t.callback&&a.isFunction(t.callback)&&t.callback(e))}}}])&&i(t.prototype,n),o&&i(t,o),e}();e.exports=d},function(e,t,n){var i=n(0),a=n(2),r=i.LogLevelEnum,o=i.LogMessageEnum,s=i.LogMessageUtil,l=i.getLogger(),u=n(4),c=n(12),g=["url"],E=a.EventDispatcherUtil,f={dispatchGetCall:function(e,t){var i=t.responseCallback,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},E="?";E+=u.convertObjectKeysToString(e,g);try{n(61).sendCall(e,E,{successCallback:i},c)}catch(t){var f=e.url;l.log(r.ERROR,s.build(o.ERROR_MESSAGES.IMPRESSION_FAILED,{file:a.EventDispatcher,endPoint:f,err:t}))}return!1},handleGetResponse:function(e,t,n){if(t)return l.log(r.ERROR,s.build(o.ERROR_MESSAGES.IMPRESSION_FAILED,{file:E,endPoint:n.endPoint,err:t})),!1;var i={file:E,endPoint:n.endPoint,accountId:e&&e.account_id},a={};if(i.endPoint.includes("push")){var u=JSON.parse(e.tags).u;(a=Object.assign({},i,{customVariables:u})).mainKeys="customDimension:".concat(JSON.stringify(a.customVariables))}else(a=Object.assign({},i,{campaignId:e&&e.experiment_id,variationId:e&&e.combination})).mainKeys="campaignId:".concat(a.campaignId," and variationId:").concat(a.variationId);return l.log(r.INFO,s.build(o.INFO_MESSAGES.IMPRESSION_SUCCESS,a)),!0},dispatchPostCall:function(e,t,i){var c=this,E=i.responseCallback,f=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},d="?";d+=u.convertObjectKeysToString(e,g);try{return"undefined"==typeof XMLHttpRequest?n(22).send({method:"POST",url:"".concat(e.url).concat(d),payload:t,customHeaders:f}).then((function(){c.handlePostResponse(e,t),E&&E(null,{status:"success"})})).catch((function(n){c.handlePostResponse(e,t,n),E(n,{status:"failure"})})):n(23).send({method:"POST",url:"".concat(e.url).concat(d),payload:t,customHeaders:f,logger:l}).then((function(){c.handlePostResponse(e,t),E&&E(null,{status:"success"})})).catch((function(n){c.handlePostResponse(e,t,n),E(n,{status:"failure"})}))}catch(t){var S=e.url;l.log(r.ERROR,s.build(o.ERROR_MESSAGES.IMPRESSION_FAILED,{file:a.EventDispatcherUtil,endPoint:S,err:t}))}return Promise.resolve(!1)},handlePostResponse:function(e,t,n){var i=e.url;if(n)return l.log(r.ERROR,s.build(o.ERROR_MESSAGES.IMPRESSION_FAILED,{file:E,endPoint:i,err:n})),!1;var a="".concat(e.en," event");return e.en===c.VWO_SYNC_VISITOR_PROP&&(delete t.d.visitor.props.vwo_fs_environment,a="visitor property:".concat(JSON.stringify(t.d.visitor.props))),l.log(r.INFO,s.build(o.INFO_MESSAGES.IMPRESSION_SUCCESS_FOR_EVENT_ARCH,{file:E,endPoint:i,accountId:e.a,event:a})),!0}};e.exports=f},function(e,t,n){var i=n(0),a=n(2),r=i.LogLevelEnum,o=i.LogMessageEnum,s=i.LogMessageUtil,l=i.getLogger(),u=a.HttpXMLUtil,c=function(){},g=function(e){var t={file:u,endPoint:e.url,accountId:e&&e.account_id},n={};if(t.endPoint.includes("push")){var i=JSON.parse(e.tags).u;(n=Object.assign({},t,{customVariables:i})).mainKeys="customDimension:".concat(JSON.stringify(n.customVariables))}else(n=Object.assign({},t,{campaignId:e&&e.experiment_id,variationId:e&&e.combination})).mainKeys="campaignId:".concat(n.campaignId," and variationId:").concat(n.variationId);l.log(r.INFO,s.build(o.INFO_MESSAGES.IMPRESSION_SUCCESS,n))},E={sendCall:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a="".concat(e.url).concat(t),r=n.successCallback,o=n.errorCallback;o=o||r;var s=!1;"undefined"!=typeof XMLHttpRequest?this.handleGetCall(e,t,r,o,a,s,i):fetch(a,{method:"GET",headers:i}).then((function(){s||(s=!0,r(null,{status:"success"}))})).catch((function(t){s||(s=!0,o(null,{status:"success"}),g(e))}))},handleGetCall:function(e,t,n,i,a,r){var o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{};n=n||c,i=i||c;var s=new XMLHttpRequest;for(var l in s.open("GET",a,!0),o)o.hasOwnProperty(l)&&s.setRequestHeader(l,o[l]);s.onload=function(){if(s.status>=200&&s.status<300){var t=s.responseText;n(t),g(e)}else i(s.statusText),g(e)},s.onerror=function(){i(s.statusText),g(e)},s.send()}};e.exports=E},function(e,t){e.exports={USER_AGENT:"X-Device-User-Agent",IP:"VWO-X-Forwarded-For"}},function(e,t,n){function i(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:this._clonedSettingsFile.accountId,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._clonedSettingsFile.sdkKey;return new Promise((function(i,a){o.get(t,n,null,{isViaWebhook:!0}).then((function(t){e.updateSettingsFile(t),i(t)})).catch((function(e){}))}))}},{key:"updateSettingsFile",value:function(e){this._clonedSettingsFile=r.cloneObject(e),this.processSettingsFile()}},{key:"getConfig",value:function(){return this._configObj}},{key:"getSettingsFile",value:function(e){return this._clonedSettingsFile||this._configObj.logger.log(g.ERROR,f.build(E.ERROR_MESSAGES.API_HAS_CORRUPTED_SETTINGS_FILE,{file:d,api:e})),this._clonedSettingsFile}}])&&i(t.prototype,n),s&&i(t,s),e}();e.exports=S},function(e,t,n){function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e))&&"[object Arguments]"!==Object.prototype.toString.call(e))return;var n=[],i=!0,a=!1,r=void 0;try{for(var o,s=e[Symbol.iterator]();!(i=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);i=!0);}catch(e){a=!0,r=e}finally{try{i||null==s.return||s.return()}finally{if(a)throw r}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var a=n(65),r=a.validate,o=a.number,s=a.string,l=a.boolean,u=a.array,c=a.object,g=a.optional,E=a.union,f=a.type,d=a.record,S=f({id:E([o(),s()]),identifier:s(),type:s(),revenueProp:g(s()),mca:g(E([o(),s()]))}),p=f({id:E([o(),s()]),type:s(),key:s(),value:E([o(),s(),l()])}),v=f({id:E([o(),s()]),name:s(),weight:E([o(),s()]),changes:g(c()),segments:g(c()),variables:g(E([c(),u(p)])),isFeatureEnabled:g(l()),startVariationAllocation:g(o()),endVariationAllocation:g(o())}),_=f({id:E([o(),s()]),type:s(),key:s(),status:s(),name:g(s()),isBucketingSeedEnabled:g(l()),percentTraffic:o(),goals:E([c(),u(S)]),variations:E([c(),u(v)]),variables:g(E([c(),u(p)])),segments:c(),isForcedVariationEnabled:g(l()),isUserListEnabled:g(l()),isMAB:g(l())}),I=f({et:g(s()),p:g(u(o())),wt:g(d(s(),o())),groupName:s(),campaigns:u(o())}),A=f({sdkKey:g(s()),version:E([o(),s()]),accountId:E([o(),s()]),campaigns:u(_),campaignGroups:g(d(s(),o())),isEventArchEnabled:g(l()),collectionPrefix:g(s()),groups:g(E([c(),d(s(),I)]))});e.exports=function(e){return!i(r(e,A),1)[0]}},function(e,t,n){"use strict";function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function*s(e,t){!0===e||(!1===e?yield t.fail():yield*e)}function l(e){const{done:t,value:n}=e.next();return t?void 0:n}n.r(t),n.d(t,"Struct",(function(){return u})),n.d(t,"StructError",(function(){return c})),n.d(t,"any",(function(){return T})),n.d(t,"array",(function(){return N})),n.d(t,"assert",(function(){return g})),n.d(t,"boolean",(function(){return m})),n.d(t,"coerce",(function(){return E})),n.d(t,"coercion",(function(){return S})),n.d(t,"date",(function(){return h})),n.d(t,"defaulted",(function(){return p})),n.d(t,"dynamic",(function(){return b})),n.d(t,"empty",(function(){return I})),n.d(t,"enums",(function(){return y})),n.d(t,"func",(function(){return U})),n.d(t,"instance",(function(){return G})),n.d(t,"intersection",(function(){return L})),n.d(t,"is",(function(){return f})),n.d(t,"lazy",(function(){return F})),n.d(t,"length",(function(){return A})),n.d(t,"literal",(function(){return C})),n.d(t,"map",(function(){return V})),n.d(t,"masked",(function(){return v})),n.d(t,"never",(function(){return P})),n.d(t,"nullable",(function(){return M})),n.d(t,"number",(function(){return D})),n.d(t,"object",(function(){return k})),n.d(t,"optional",(function(){return B})),n.d(t,"partial",(function(){return K})),n.d(t,"pattern",(function(){return O})),n.d(t,"record",(function(){return j})),n.d(t,"refinement",(function(){return R})),n.d(t,"set",(function(){return w})),n.d(t,"string",(function(){return x})),n.d(t,"struct",(function(){return H})),n.d(t,"tuple",(function(){return W})),n.d(t,"type",(function(){return J})),n.d(t,"union",(function(){return q})),n.d(t,"validate",(function(){return d}));class u{constructor(e){const{type:t,schema:n,coercer:i=(e=>e),validator:a=(()=>[]),refiner:r=(()=>[])}=e;this.type=t,this.schema=n,this.coercer=i,this.validator=a,this.refiner=r}}class c extends TypeError{constructor(e,t){const{path:n,value:i,type:a,branch:r}=e,s=o(e,["path","value","type","branch"]);let l;super(`Expected a value of type \`${a}\`${n.length?` for \`${n.join(".")}\``:""} but received \`${JSON.stringify(i)}\`.`),this.value=i,Object.assign(this,s),this.type=a,this.path=n,this.branch=r,this.failures=function(){return l||(l=[e,...t]),l},this.stack=(new Error).stack,this.__proto__=c.prototype}}function g(e,t){const n=d(e,t);if(n[0])throw n[0]}function E(e,t){const n=t.coercer(e);return g(n,t),n}function f(e,t){return!d(e,t)[0]}function d(e,t,n=!1){n&&(e=t.coercer(e));const i=function*e(t,n,i=[],a=[]){const{type:o}=n,u={value:t,type:o,branch:a,path:i,fail:(e={})=>r({value:t,type:o,path:i,branch:[...a,t]},e),check(t,n,r,o){const s=void 0!==r?[...i,o]:i,l=void 0!==r?[...a,r]:a;return e(t,n,s,l)}},c=s(n.validator(t,u),u),g=l(c);g?(yield g,yield*c):yield*s(n.refiner(t,u),u)}(e,t),a=l(i);if(a){return[new c(a,i),void 0]}return[void 0,e]}function S(e,t){const n=e.coercer;return new u(r(r({},e),{},{coercer:e=>n(t(e))}))}function p(e,t,n){return S(e,e=>{const i="function"==typeof t?t():t;if(void 0===e)return i;if(!0!==n&&_(e)&&_(i)){const t=r({},e);let n=!1;for(const e in i)void 0===t[e]&&(t[e]=i[e],n=!0);if(n)return t}return e})}function v(e){return S(e,t=>{if(!_(t))return t;const n={};for(const i in e.schema)n[i]=t[i];return n})}function _(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function I(e){return R(e,e.type+" & Empty",e=>0===e.length)}function A(e,t,n){return R(e,`${e.type} & Length<${t},${n}>`,e=>t`,e=>t.test(e))}function R(e,t,n){const i=e.refiner;return new u(r(r({},e),{},{type:t,*refiner(e,t){yield*s(i(e,t),t),yield*s(n(e,t),t)}}))}function T(){return H("any",()=>!0)}function N(e){return new u({type:`Array<${e?e.type:"unknown"}>`,schema:e,coercer:t=>e&&Array.isArray(t)?t.map(t=>E(t,e)):t,*validator(t,n){if(Array.isArray(t)){if(e)for(const[i,a]of t.entries())yield*n.check(a,e,t,i)}else yield n.fail()}})}function m(){return H("boolean",e=>"boolean"==typeof e)}function h(){return H("Date",e=>e instanceof Date&&!isNaN(e.getTime()))}function b(e){return H("Dynamic<...>",(t,n)=>n.check(t,e(t,n)))}function y(e){return H(`Enum<${e.map(Q)}>`,t=>e.includes(t))}function U(){return H("Function",e=>"function"==typeof e)}function G(e){return H(`InstanceOf<${e.name}>`,t=>t instanceof e)}function L(e){return H(e.map(e=>e.type).join(" & "),(function*(t,n){for(const i of e)yield*n.check(t,i)}))}function F(e){let t;return H("Lazy<...>",(n,i)=>(t||(t=e()),i.check(n,t)))}function C(e){return H(`Literal<${Q(e)}>`,t=>t===e)}function V(e,t){return H(`Map<${e.type},${t.type}>`,(function*(n,i){if(n instanceof Map)for(const[a,r]of n.entries())yield*i.check(a,e,n,a),yield*i.check(r,t,n,a);else yield i.fail()}))}function P(){return H("never",()=>!1)}function M(e){return new u({type:e.type+" | null",schema:e.schema,validator:(t,n)=>null===t||n.check(t,e)})}function D(){return H("number",e=>"number"==typeof e&&!isNaN(e))}function k(e){const t=e?Object.keys(e):[],n=P();return new u({type:e?`Object<{${t.join(",")}}>`:"Object",schema:e||null,coercer:e?Y(e):e=>e,*validator(i,a){if("object"==typeof i&&null!=i){if(e){const r=new Set(Object.keys(i));for(const n of t){r.delete(n);const t=e[n],o=i[n];yield*a.check(o,t,i,n)}for(const e of r){const t=i[e];yield*a.check(t,n,i,e)}}}else yield a.fail()}})}function B(e){return new u({type:e.type+"?",schema:e.schema,validator:(t,n)=>void 0===t||n.check(t,e)})}function K(e){e instanceof u&&(e=e.schema);const t=Object.keys(e),n=P();return new u({type:`Partial<{${t.join(",")}}>`,schema:e,coercer:Y(e),*validator(i,a){if("object"!=typeof i||null==i)return void(yield a.fail());const r=new Set(Object.keys(i));for(const n of t){if(r.delete(n),!(n in i))continue;const t=e[n],o=i[n];yield*a.check(o,t,i,n)}for(const e of r){const t=i[e];yield*a.check(t,n,i,e)}}})}function j(e,t){return H(`Record<${e.type},${t.type}>`,(function*(n,i){if("object"==typeof n&&null!=n)for(const a in n){const r=n[a];yield*i.check(a,e,n,a),yield*i.check(r,t,n,a)}else yield i.fail()}))}function w(e){return H(`Set<${e.type}>`,(t,n)=>{if(!(t instanceof Set))return!1;for(const i of t){const[t]=n.check(i,e);if(t)return!1}return!0})}function x(){return H("string",e=>"string"==typeof e)}function H(e,t){return new u({type:e,validator:t,schema:null})}function W(e){const t=P();return H(`[${e.map(e=>e.type).join(",")}]`,(function*(n,i){if(Array.isArray(n)){for(const[t,a]of e.entries()){const e=n[t];yield*i.check(e,a,n,t)}if(n.length>e.length){const a=e.length,r=n[a];yield*i.check(r,t,n,a)}}else yield i.fail()}))}function J(e){const t=Object.keys(e);return H(`Type<{${t.join(",")}}>`,(function*(n,i){if("object"==typeof n&&null!=n)for(const a of t){const t=e[a],r=n[a];yield*i.check(r,t,n,a)}else yield i.fail()}))}function q(e){return H(""+e.map(e=>e.type).join(" | "),(function*(t,n){for(const i of e){const[...e]=n.check(t,i);if(0===e.length)return}yield n.fail()}))}function Q(e){return"string"==typeof e?`"${e.replace(/"/g,'"')}"`:""+e}function Y(e){const t=Object.keys(e);return n=>{if("object"!=typeof n||null==n)return n;const i={},a=new Set(Object.keys(n));for(const r of t){a.delete(r);const t=e[r],o=n[r];i[r]=E(o,t)}for(const e of a)i[e]=n[e];return i}}},function(e,t,n){function i(e,t){for(var n=0;n0&&(this.data._l=1),this.data}}])&&i(t.prototype,n),r&&i(t,r),e}();e.exports=r}])})); +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.vwoSdk=t():e.vwoSdk=t()}(this,(function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(i,a,function(t){return e[t]}.bind(null,a));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=25)}([function(e,t,n){var i=n(32);e.exports=i},function(e,t){var n={_toStringValue:function(e){return Object.prototype.toString.call(e)},isNumber:function(e){return"[object Number]"===n._toStringValue(e)},isString:function(e){return"[object String]"===n._toStringValue(e)},isObject:function(e){return"[object Object]"===n._toStringValue(e)},isFunction:function(e){return"[object Function]"===n._toStringValue(e)},isBoolean:function(e){return"[object Boolean]"===n._toStringValue(e)},isPromise:function(e){return"[object Promise]"===n._toStringValue(e)},isUndefined:function(e){return"[object Undefined]"===n._toStringValue(e)||void 0===e},isNull:function(e){return"[object Null]"===n._toStringValue(e)},isArray:function(e){return"[object Array]"===n._toStringValue(e)}};e.exports=n},function(e,t){e.exports={INDEX:"".concat("lib","/index"),VWO:"".concat("lib","/VWO"),API:"".concat("lib","/api/index"),Activate:"".concat("lib","/api/activate"),GetVariation:"".concat("lib","/api/getVariation"),Track:"".concat("lib","/api/track"),IsFeatureEnabled:"".concat("lib","/api/isFeatureEnabled"),GetFeatureVariableValue:"".concat("lib","/api/getFeatureVariableValue"),Push:"".concat("lib","/api/push"),SegmentEvaluator:"".concat("lib/core","/SegmentEvaluator"),BucketingService:"".concat("lib/core","/BucketingService"),VariationDecider:"".concat("lib/core","/VariationDecider"),ConsoleLogManager:"".concat("lib/services","/ConsoleLogManager"),EventQueue:"".concat("lib/services","/EventQueue"),LoggingManager:"".concat("lib/services","/LoggingManager"),SettingsFileManager:"".concat("lib/services","/SettingsFileManager"),BatchEventsQueue:"".concat("lib/services","/BatchEventsQueue"),CampaignUtil:"".concat("lib/util","/CampaignUtil"),DataTypeUtil:"".concat("lib/util","/DataTypeUtil"),EventDispatcher:"".concat("lib/util","/EventDispatcher"),EventDispatcherUtil:"".concat("lib/util","/EventDispatcherUtil"),FeatureUtil:"".concat("lib/util","/FeatureUtil"),Functionutil:"".concat("lib/util","/Functionutil"),ImpressionUtil:"".concat("lib/util","/ImpressionUtil"),UuidUtil:"".concat("lib/util","/UuidUtil"),ValidateUtil:"".concat("lib/util","/ValidateUtil"),DecisionUtil:"".concat("lib/util","/DecisionUtils"),HttpHandlerUtil:"".concat("lib/util","/HttpHandlerUtil"),HttpImageUtil:"".concat("lib/util","/HttpImageUtil"),HttpXMLUtil:"".concat("lib/util","/HttpXMLUtil"),UsageStatsUtil:"".concat("lib/services","/UsageStats")}},function(e,t,n){var i={};i={name:"vwo-javascript-sdk",version:"1.70.1"},e.exports={SDK_NAME:i.name,SDK_VERSION:i.version,PLATFORM:"server",SEED_VALUE:1,MAX_TRAFFIC_PERCENT:100,MAX_TRAFFIC_VALUE:1e4,MAX_EVENTS_PER_REQUEST:5e3,DEFAULT_EVENTS_PER_REQUEST:100,DEFAULT_REQUEST_TIME_INTERVAL:600,STATUS_RUNNING:"RUNNING",SEED_URL:"https://vwo.com",HTTP_PROTOCOL:"http://",HTTPS_PROTOCOL:"https://",SDK_QUERY_PARAM:"sdk",SDK_VERSION_QUERY_PARAM:"sdk-v"}},function(e,t,n){var i={cloneObject:function(e){return e?JSON.parse(JSON.stringify(e)):e},getRandomNumber:function(){return Math.random()},getCurrentUnixTimestamp:function(){return Math.ceil(+new Date/1e3)},getCurrentUnixTimestampInMillis:function(){return+new Date},matchWithRegex:function(e,t){try{return e.match(new RegExp(t))}catch(e){var i=n(0),a=n(2),r=i.getLogger(),o=i.LogLevelEnum,s=i.LogMessageEnum,l=i.LogMessageUtil,u=a.FunctionUtil;return r.log(o.ERROR,l.build(s.ERROR_MESSAGES.SEGMENTATION_REGEX_CREATION_FAILED,{file:u,regex:t})),null}},getCurrentTime:function(){return(new Date).toISOString()},convertObjectKeysToString:function(e,t){var n="";for(var i in t=t||[],e)e.hasOwnProperty(i)&&-1===t.indexOf(i)&&(n+=i+"="+e[i]+"&");return n},objectValues:function(e){var t=[];for(var n in e)t.push(e[n]);return t}};e.exports=i},function(e,t){e.exports={LAUNCH:"launch",ACTIVATE:"activate",GET_VARIATION_NAME:"getVariation",TRACK:"track",IS_FEATURE_ENABLED:"isFeatureEnabled",GET_FEATURE_VARIABLE_VALUE:"getFeatureVariableValue",PUSH:"push"}},function(e,t,n){var i;function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var r=n(1),o=n(30),s=n(5),l=n(9),u=(a(i={},s.ACTIVATE,(function(e){var t=e.campaignKey,n=e.userId,i=e.customVariables,a=void 0===i?{}:i,r=e.variationTargetingVariables,s=void 0===r?{}:r,l=e.userStorageData,u=void 0===l?{}:l,c=e.shouldTrackReturningUser,g=void 0!==c&&c,E=e.metaData,f=void 0===E?{}:E;return[{key:"campaignKey",value:t,type:o.STRING},{key:"userId",value:n,type:o.STRING},{key:"customVariables",value:a,type:o.OBJECT},{key:"variationTargetingVariables",value:s,type:o.OBJECT},{key:"userStorageData",value:u,type:o.OBJECT},{key:"shouldTrackReturningUser",value:g,type:o.BOOLEAN},{key:"metaData",value:f,type:o.OBJECT}]})),a(i,s.TRACK,(function(e){var t=e.campaignKey,n=e.userId,i=e.goalIdentifier,a=e.customVariables,r=void 0===a?{}:a,s=e.variationTargetingVariables,u=void 0===s?{}:s,c=e.userStorageData,g=void 0===c?{}:c,E=e.goalTypeToTrack,f=void 0===E?l.ALL:E,d=e.shouldTrackReturningUser,S=void 0!==d&&d,p=e.metaData,v=void 0===p?{}:p;return[{key:"campaignKey",value:t,type:o.STRING_NULL_UNDEFINED_ARRAY},{key:"userId",value:n,type:o.STRING},{key:"goalIdentifier",value:i,type:o.STRING},{key:"customVariables",value:r,type:o.OBJECT},{key:"variationTargetingVariables",value:u,type:o.OBJECT},{key:"userStorageData",value:g,type:o.OBJECT},{key:"goalTypeToTrack",value:f,type:o.STRING},{key:"shouldTrackReturningUser",value:S,type:o.BOOLEAN},{key:"metaData",value:v,type:o.OBJECT}]})),a(i,s.IS_FEATURE_ENABLED,(function(e){var t=e.campaignKey,n=e.userId,i=e.customVariables,a=void 0===i?{}:i,r=e.variationTargetingVariables,s=void 0===r?{}:r,l=e.userStorageData,u=void 0===l?{}:l,c=e.shouldTrackReturningUser,g=void 0!==c&&c,E=e.metaData,f=void 0===E?{}:E;return[{key:"campaignKey",value:t,type:o.STRING},{key:"userId",value:n,type:o.STRING},{key:"customVariables",value:a,type:o.OBJECT},{key:"variationTargetingVariables",value:s,type:o.OBJECT},{key:"userStorageData",value:u,type:o.OBJECT},{key:"shouldTrackReturningUser",value:g,type:o.BOOLEAN},{key:"metaData",value:f,type:o.OBJECT}]})),a(i,s.GET_FEATURE_VARIABLE_VALUE,(function(e){var t=e.campaignKey,n=e.variableKey,i=e.userId,a=e.customVariables,r=void 0===a?{}:a,s=e.variationTargetingVariables,l=void 0===s?{}:s,u=e.userStorageData,c=void 0===u?{}:u,g=e.metaData,E=void 0===g?{}:g;return[{key:"campaignKey",value:t,type:o.STRING},{key:"variableKey",value:n,type:o.STRING},{key:"userId",value:i,type:o.STRING},{key:"customVariables",value:r,type:o.OBJECT},{key:"variationTargetingVariables",value:l,type:o.OBJECT},{key:"userStorageData",value:c,type:o.OBJECT},{key:"metaData",value:E,type:o.OBJECT}]})),a(i,s.PUSH,(function(e){var t=e.tagKey,n=e.tagValue,i=e.userId,a=e.customDimensionMap;return[{key:"tagKey",value:t,type:o.STRING},{key:"tagValue",value:n,type:o.STRING},{key:"userId",value:i,type:o.STRING},{key:"customDimensionMap",value:a,type:o.OBJECT}]})),i);u[s.GET_VARIATION_NAME]=u[s.ACTIVATE];var c={isValidValue:function(e){return!(void 0===e||!e)},isValidString:function(e){return c.isValidValue(e)&&r.isString(e)},isValidNumber:function(e){return c.isValidValue(e)&&r.isNumber(e)},isValidFunction:function(e){return c.isValidValue(e)&&r.isFunction(e)},isValidBoolean:function(e){return void 0!==e&&r.isBoolean(e)},isValidObject:function(e){return void 0!==e&&r.isObject(e)},areValidParamsForAPIMethod:function(e){for(var t=u[e.method](e),n=[],i=0;i0},setVariationAllocation:function(e){for(var t=e.variations.length,n=0,i=0;n6&&void 0!==arguments[6]?arguments[6]:{},c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},S=arguments.length>8?arguments[8]:void 0,p=arguments.length>9?arguments[9]:void 0,A=arguments.length>10?arguments[10]:void 0,O=arguments.length>11?arguments[11]:void 0,R=arguments.length>12&&void 0!==arguments[12]?arguments[12]:"",T=_.generateFor(a,t.accountId);d.log(g.DEBUG,f.build(E.DEBUG_MESSAGES.USER_UUID,{file:u.UuidUtil,userId:a,accountId:t.accountId,uuid:T}));var N={campaignId:n.id,campaignKey:i,campaignType:n.type,campaignName:n.name,customVariables:s,event:v.DECISION_TYPES.CAMPAIGN_DECISION,goalIdentifier:O,isForcedVariationEnabled:n.isForcedVariationEnabled,sdkVersion:I.SDK_VERSION,source:R,userId:a,variationTargetingVariables:l,vwoUserId:T},h=r.isPartOfGroup(t,n.id),b=h.groupId,y=h.groupName;b&&(N.groupId=b,N.groupName=y),l=Object.assign({},l,{_vwoUserId:n.isUserListEnabled?T:a});var U=m._checkForWhitelisting(e,n,i,a,l,N);return U?o.isPromise(U)?U.then((function(e){if(Object.keys(e).length>0)return e})):U:e.asyncStorageConfig?new Promise((function(r){return m._checkForUserStorage(e,t,n,i,a,c,p,N).then((function(u){if(u&&o.isObject(u)&&Object.keys(u).length>0)r(Object.assign({},{isStoredVariation:!0},u));else if(A)r(Object.assign({}));else{var g=m.evaluateAndGetVariationWithoutStorage(e,t,n,i,a,s,l,c,S,p,O,N,b,y);r(g)}}))})):m._checkForUserStorage(e,t,n,i,a,c,p,N)||m.evaluateAndGetVariationWithoutStorage(e,t,n,i,a,s,l,c,S,p,O,N,b,y)},evaluateAndGetVariationWithoutStorage:function(e,t,n,i,s,l,u,c,S,p,v,_,I,A){if(!m._checkForPreSegmentation(n,i,s,l,_)||!a.isUserPartOfCampaign(s,n,!0))return{};if(I){var O=r.getGroupCampaigns(t,I);if(0===O.length)return{};var T=m._checkForStorageAndWhitelisting(e,t,A,O,n,s,c,u,p);if(T)return d.log(g.INFO,f.build(E.INFO_MESSAGES.MEG_CALLED_CAMPAIGN_NOT_WINNER,{userId:s,groupName:A,file:R,campaignKey:i})),o.isPromise(T)?new Promise((function(e){e(Object.assign({}))})):{};var N="",h="",b=m.getEligbleCampaigns(O,s,l),y=b.eligibleCampaigns,U=b.inEligibleCampaigns;U.forEach((function(e){N=N+e.key+","})),y.forEach((function(e){h=h+e.key+","})),d.log(g.DEBUG,f.build(E.DEBUG_MESSAGES.MEG_ELIGIBLE_CAMPAIGNS,{userId:s,groupName:A,file:R,eligibleCampaignKeys:h.slice(0,-1),inEligibleText:""===N?"no campaigns":"campaigns: ".concat(N.slice(0,-1))})),d.log(g.INFO,f.build(E.INFO_MESSAGES.MEG_ELIGIBLE_CAMPAIGNS,{userId:s,groupName:A,file:R,noOfEligibleCampaigns:y.length,noOfGroupCampaigns:U.length+y.length}));var G=void 0!==t.groups[I].et?t.groups[I].et:1;return 1===y.length?m.evaluateTrafficAndGetVariation(e,y[0],y[0].key,s,S,v,_):1===G?m._normalizeAndFindWinningCampaign(e,n,y,s,A,I,S,v,_):m._advancedAlgoFindWinningCampaign(e,t,n,y,s,A,I,S,v,_)}return m.evaluateTrafficAndGetVariation(e,n,i,s,S,v,_)},_evaluateWhitelisting:function(e,t,n,i){var l,u,p=arguments.length>4&&void 0!==arguments[4]&&arguments[4],v=[];if(e.variations.forEach((function(a){!o.isObject(a.segments)||Object.keys(a.segments).length?(o.isObject(a.segments)&&S(a.segments,i,t,n,a.name)?(u=c.PASSED,v.push(s.cloneObject(a))):u=c.FAILED,d.log(g.DEBUG,f.build(E.DEBUG_MESSAGES.SEGMENTATION_STATUS,{campaignKey:t,userId:n,customVariables:JSON.stringify(i),file:R,status:u,segmentationType:T,variation:e.type===A.FEATURE_ROLLOUT&&u===c.PASSED?"and becomes part of the rollout":"for ".concat(a.name)}),p)):d.log(g.DEBUG,f.build(E.DEBUG_MESSAGES.SEGMENTATION_SKIPPED,{campaignKey:t,userId:n,file:R,variation:e.type===A.FEATURE_ROLLOUT?"":", for ".concat(a.name)}),p)})),v.length>1){r.scaleVariationWeights(v);for(var _=0,I=0;_0?(c=!0,d.log(g.INFO,f.build(E.INFO_MESSAGES.OTHER_CAMPAIGN_SATISFIES_WHITELISTING_STORAGE,{file:R,campaignKey:i.key,groupName:n,userId:r,type:"user storage"})),!0):void 0}})),e.asyncStorageConfig?new Promise((function(e){e(c)})):c},_checkForPreSegmentation:function(e,t,n,i,a){var r;return o.isObject(e.segments)&&!Object.keys(e.segments).length?(d.log(g.DEBUG,f.build(E.DEBUG_MESSAGES.SEGMENTATION_SKIPPED,{campaignKey:t,userId:n,file:R}),!a),!0):(r=S(e.segments,i,t,n,!a)?c.PASSED:c.FAILED,d.log(g.INFO,f.build(E.INFO_MESSAGES.SEGMENTATION_STATUS,{campaignKey:t,userId:n,customVariables:JSON.stringify(i||{}),file:R,status:r,segmentationType:N,variation:""}),!a),r!==c.FAILED)},evaluateTrafficAndGetVariation:function(e,t,n,a,r,o,s){var l,u,c,S=i.getVariationAllotted(a,t,e.settingsFile.accountId);return l=S.variation,u=S.variationName,c=S.variationId,d.log(g.INFO,f.build(E.INFO_MESSAGES.USER_VARIATION_ALLOCATION_STATUS,{file:R,campaignKey:n,userId:a,status:u?"got variation:".concat(u):"did not get any variation"})),u&&m._saveUserData(e,t,u,a,r,o),p.execute(Object.assign({fromUserStorageService:!1,isUserWhitelisted:!1},t.type===A.FEATURE_ROLLOUT?{isFeatureEnabled:!!u}:{variationName:u,variationId:c},s)),{variation:l&&l.variation,variationName:u,variationId:c}},_checkForWhitelisting:function(e,t,n,i,a,r){var o,s,l;if(t.isForcedVariationEnabled){var u,S=m._evaluateWhitelisting(t,n,i,a,!r);if(S?(o=c.PASSED,u=S.variationName):(o=c.FAILED,u=""),d.log(g.INFO,f.build(E.INFO_MESSAGES.SEGMENTATION_STATUS,{campaignKey:n,userId:i,customVariables:JSON.stringify(a),file:R,status:o,segmentationType:T,variation:t.type===A.FEATURE_ROLLOUT?"":"for variation: ".concat(u)}),!r),S)return s=S.variationName,l=S.variationId,r&&p.execute(Object.assign({fromUserStorageService:!1,isUserWhitelisted:!!s},t.type===A.FEATURE_ROLLOUT?{isFeatureEnabled:!!s}:{variationName:s,variationId:l},r)),e.asyncStorageConfig?new Promise((function(e){return e(S)})):S}else d.log(g.DEBUG,f.build(E.DEBUG_MESSAGES.WHITELISTING_SKIPPED,{campaignKey:n,userId:i,file:R}),!r)},_checkForUserStorage:function(e,t,n,i,a,r,o,s){var l;return e.asyncStorageConfig?m._getStoredUserData(e,a,i,r,!s).then((function(r){return r=r||{variationName:null,goalIdentifier:null},m._processAfterGettingFromStorage(e,t,n,i,a,o,s,r)})):(l=m._getStoredUserData(e,a,i,r,!s),m._processAfterGettingFromStorage(e,t,n,i,a,o,s,l))},_processAfterGettingFromStorage:function(e,t,n,i,a,s,l,u){var c,S,v=u.variationName,_=u.goalIdentifier;return u&&u.campaignKey&&v?c=r.getCampaignVariation(t,i,v):d.log(g.DEBUG,f.build(E.DEBUG_MESSAGES.USER_STORAGE_SERVICE_NO_STORED_DATA,{file:R,campaignKey:i,userId:a}),!l),c?(v=c.name,S=c.id,d.log(g.INFO,f.build(E.INFO_MESSAGES.GOT_STORED_VARIATION,{file:R,campaignKey:i,userId:a,variationName:v}),!l),l&&p.execute(Object.assign({fromUserStorageService:!!v,isUserWhitelisted:!1},n.type===A.FEATURE_ROLLOUT?{isFeatureEnabled:!!v}:{variationName:v,variationId:S},l)),{variation:c,variationName:v,variationId:S,storedGoalIdentifier:_,isStoredVariation:!0}):o.isUndefined(e.userStorageService)||s||!o.isUndefined(c)?void 0:(d.log(g.WARN,f.build(E.WARNING_MESSAGES.CAMPAIGN_NOT_ACTIVATED,{file:R,campaignKey:i,userId:a,api:e.apiName}),!l),d.log(g.INFO,f.build(E.INFO_MESSAGES.CAMPAIGN_NOT_ACTIVATED,{file:R,campaignKey:i,userId:a,reason:e.apiName===O.TRACK?"track it":"get the decision/value"}),!l),{})},getEligbleCampaigns:function(e,t,n){var i=[],r=[];return e.forEach((function(e){m._checkForPreSegmentation(e,e.key,t,n)&&a.isUserPartOfCampaign(t,e,!0)?(e=s.cloneObject(e),i.push(e)):r.push(e)})),{eligibleCampaigns:i,inEligibleCampaigns:r}},_normalizeAndFindWinningCampaign:function(e,t,n,i,o,s,l,u,c){n.forEach((function(e){e.weight=Math.floor(100/n.length)})),r.setCampaignAllocation(n);var S=a._getVariation(n,a.calculateBucketValue(r.getBucketingSeed(i,void 0,s)));return d.log(g.INFO,f.build(E.INFO_MESSAGES.MEG_GOT_WINNER_CAMPAIGN,{userId:i,groupName:o,file:R,campaignKey:S.key})),S.id===t.id?m.evaluateTrafficAndGetVariation(e,S,S.key,i,l,u,c):(d.log(g.INFO,f.build(E.INFO_MESSAGES.MEG_CALLED_CAMPAIGN_NOT_WINNER,{userId:i,groupName:o,file:R,campaignKey:t.key})),{})},_advancedAlgoFindWinningCampaign:function(e,t,n,i,o,l,u,c,S,p){for(var v=null,_=!1,I=void 0!==t.groups[u].p?t.groups[u].p:{},A=void 0!==t.groups[u].wt?t.groups[u].wt:{},O=0;O0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(e).length},getKeyValue:function(e){if(n.areObjectKeys(e)){var t=Object.keys(e)[0];return{key:t,value:e[t]}}},objectValues:function(e){return Object.keys(e).map((function(t){return e[t]}))}};e.exports=n},function(e,t,n){function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=n(3),r=n(14),o=n(9),s=n(20),l=n(6),u=n(4),c=n(0),g=n(2),E=n(1),f=c.LogLevelEnum,d=c.LogMessageEnum,S=c.LogMessageUtil,p=c.getLogger(),v=n(21);function _(e,t){var n=e.accountId;return Object.assign({},function(e,t){return{sId:u.getCurrentUnixTimestamp(),u:s.generateFor(t,e.accountId)}}(e,t),I.getReportingProperties(e),{account_id:n,random:u.getRandomNumber(),ap:a.PLATFORM})}var I={buildEventForPushing:function(e,t,n,o){var s=Object.assign({},_(e,o));return s.url=a.HTTPS_PROTOCOL+v.getBaseUrl()+r.PUSH,s.tags=JSON.stringify({u:i({},encodeURIComponent(t),encodeURIComponent(n))}),p.log(f.DEBUG,S.build(d.DEBUG_MESSAGES.IMPRESSION_FOR_PUSH,{file:g.ImpressionUtil,properties:this._getStringifiedLogProperties(s)})),s},buildBatchEventForPushing:function(e,t,n,i){},buildEventForTrackingUser:function(e,t,n,i,o){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"",u=Object.assign({experiment_id:t,combination:n,visitor_ua:s,visitor_ip:l},_(e,i),o);return u.ed=JSON.stringify({p:"server"}),u.url=a.HTTPS_PROTOCOL+v.getBaseUrl()+r.TRACK_USER,p.log(f.DEBUG,S.build(d.DEBUG_MESSAGES.IMPRESSION_FOR_TRACK_USER,{file:g.ImpressionUtil,properties:this._getStringifiedLogProperties(u)})),u},buildBatchEventForTrackingUser:function(e,t,n,i){},buildEventForTrackingGoal:function(e,t,n,i){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"",E=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"",I=s.id,A=Object.assign({experiment_id:t,combination:n},_(e,i));return A.visitor_ua=c,A.visitor_ip=E,A.url=a.HTTPS_PROTOCOL+v.getBaseUrl()+r.TRACK_GOAL,A.goal_id=I,s.type===o.REVENUE&&l.isValidValue(u)&&(A.r=u),p.log(f.DEBUG,S.build(d.DEBUG_MESSAGES.IMPRESSION_FOR_TRACK_GOAL,{file:g.ImpressionUtil,properties:this._getStringifiedLogProperties(A)})),A},buildBatchEventForTrackingGoal:function(e,t,n,i){},getReportingProperties:function(e){var t,n=e.sdkKey;return i(t={},a.SDK_QUERY_PARAM,a.SDK_NAME),i(t,a.SDK_VERSION_QUERY_PARAM,a.SDK_VERSION),i(t,"env",n),t},getEventsBaseProperties:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",s=e.sdkKey,l=Object.assign({en:t,a:e.accountId,env:s,eTime:u.getCurrentUnixTimestampInMillis(),random:u.getRandomNumber(),p:"FS",visitor_ua:i,visitor_ip:o},n);return l.url=a.HTTPS_PROTOCOL+v.getBaseUrl()+r.EVENTS,l},getEventBasePayload:function(e,t,n){var i=s.generateFor(t,e.accountId),r=e.sdkKey,o={vwo_sdkName:a.SDK_NAME,vwo_sdkVersion:a.SDK_VERSION,vwo_envKey:r};return{d:{msgId:"".concat(i,"-").concat(u.getCurrentUnixTimestampInMillis()),visId:i,sessionId:u.getCurrentUnixTimestamp(),event:{props:o,name:n,time:u.getCurrentUnixTimestampInMillis()},visitor:{props:{vwo_fs_environment:r}}}}},getTrackUserPayloadData:function(e,t,n,i,a){var r=this.getEventBasePayload(e,t,n);return r.d.event.props.id=i,r.d.event.props.variation=a,r.d.event.props.isFirst=1,p.log(f.DEBUG,S.build(d.DEBUG_MESSAGES.IMPRESSION_FOR_EVENT_ARCH_TRACK_USER,{file:g.ImpressionUtil,accountId:e.accountId,userId:t,campaignId:i})),r},getTrackGoalPayloadData:function(e,t,n,i,a,r){var o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},s=this.getEventBasePayload(e,t,n),l={};if(Object.keys(i).forEach((function(a){l["id_".concat(a)]=["g_".concat(i[a].goal.id)],p.log(f.DEBUG,S.build(d.DEBUG_MESSAGES.IMPRESSION_FOR_EVENT_ARCH_TRACK_GOAL,{file:g.ImpressionUtil,goalName:n,accountId:e.accountId,u:t,campaignId:a}))})),s.d.event.props.vwoMeta={metric:l},r&&a&&r.size>0&&r.forEach((function(e){s.d.event.props.vwoMeta[e]=a})),s.d.event.props.isCustomEvent=!0,Object.keys(o).length>0)for(var u in o)s.d.event.props[u]=o[u];return s},getPushPayloadData:function(e,t,n,i){var a=this.getEventBasePayload(e,t,n);return a.d.event.props.isCustomEvent=!0,Object.keys(i).forEach((function(e){var t=E.isString(i[e])?i[e]:JSON.stringify(i[e]);a.d.visitor.props[e]=t})),p.log(f.DEBUG,S.build(d.DEBUG_MESSAGES.IMPRESSION_FOR_EVENT_ARCH_PUSH,{file:g.ImpressionUtil,accountId:e.accountId,userId:t,property:JSON.stringify(i)})),a},_getStringifiedLogProperties:function(e){var t=Object.assign({},e);return delete t.env,JSON.stringify(t)}};e.exports=I},function(e,t){e.exports={VWO_VARIATION_SHOWN:"vwo_variationShown",VWO_SYNC_VISITOR_PROP:"vwo_syncVisitorProp"}},function(e,t){var n={init:function(e){n.isEventArchEnabled=e.isEventArchEnabled,n.isNB=e.isNB,n.isNBv2=e.isNBv2},getAll:function(){return{isEventArchEnabled:n.isEventArchEnabled,isNB:n.isNB,isNBv2:n.isNBv2}}};e.exports=n},function(e,t){e.exports={BASE_URL:"dev.visualwebsiteoptimizer.com",SETTINGS_URL:"/server-side/settings",WEBHOOK_SETTINGS_URL:"/server-side/pull",TRACK_USER:"/server-side/track-user",TRACK_GOAL:"/server-side/track-goal",PUSH:"/server-side/push",BATCH_EVENTS:"/server-side/batch-events",EVENTS:"/events/t"}},function(e,t,n){var i=n(31),a=n(3),r=n(6),o=n(13),s=n(0),l=n(2),u=n(7),c=s.LogLevelEnum,g=s.LogMessageEnum,E=s.LogMessageUtil,f=s.getLogger(),d=l.BucketingService,S={_generateBucketValue:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=e/Math.pow(2,32),a=(t*i+1)*n,r=Math.floor(a);return r},_getVariation:function(e,t){for(var n=0;n=i.startVariationAllocation&&t<=i.endVariationAllocation)return i}return null},_getBucketValueForUser:function(e,t,n){var r=i.v3(e,a.SEED_VALUE),o=S._generateBucketValue(r,a.MAX_TRAFFIC_PERCENT);return f.log(c.DEBUG,E.build(g.DEBUG_MESSAGES.USER_HASH_BUCKET_VALUE,{file:d,hashValue:r,bucketValue:o,userId:t}),n),o},isUserPartOfCampaign:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!t)return!1;var i=t.percentTraffic,a=S._getBucketValueForUser(u.getBucketingSeed(e,t),e,n),r=0!==a&&a<=i;return f.log(c.INFO,E.build(g.INFO_MESSAGES.USER_CAMPAIGN_ELIGIBILITY,{file:d,userId:e,campaignKey:t.key,status:r?"eligible":"not eligible"}),n),r},bucketUserToVariation:function(e,t,n){var i,s,l=o.getAll().isNB,p=o.getAll().isNBv2;if(!r.isValidValue(e))return null;if(!t)return null;(!l&&!p||l&&t.isOB)&&t.percentTraffic?(i=a.MAX_TRAFFIC_VALUE/t.percentTraffic/100,s=u.getBucketingSeed(e,t)):l&&!t.isOB&&!p||p&&t.isOBv2?(i=1,s=e):(i=1,s=u.getBucketingSeed(n+"_"+e,t));var v=S._generateHashValue(s),_=S._generateBucketValue(v,a.MAX_TRAFFIC_VALUE,i);return f.log(c.DEBUG,E.build(g.DEBUG_MESSAGES.USER_CAMPAIGN_BUCKET_VALUES,{file:d,userId:e,campaignKey:t.key,percentTraffic:t.percentTraffic,bucketValue:_,hashValue:v})),S._getVariation(t.variations,_)},calculateBucketValue:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=S._generateHashValue(e);return S._generateBucketValue(n,a.MAX_TRAFFIC_VALUE,t)},_generateHashValue:function(e){return i.v3(e,a.SEED_VALUE)}};e.exports=S},function(e,t,n){var i,a;function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var o=n(37),s={NOTSET:0,DEBUG:1,INFO:2,WARN:3,ERROR:4},l=(r(i={},s.NOTSET,"".concat(o.BOLD).concat(o.WHITE,"[NOTSET]:").concat(o.RESET)),r(i,s.DEBUG,"".concat(o.BOLD).concat(o.LIGHTBLUE,"[DEBUG]: ").concat(o.RESET)),r(i,s.INFO,"".concat(o.BOLD).concat(o.CYAN,"[INFO]: ").concat(o.RESET)),r(i,s.WARN,"".concat(o.BOLD).concat(o.YELLOW,"[WARN]: ").concat(o.RESET)),r(i,s.ERROR,"".concat(o.BOLD).concat(o.RED,"[ERROR]: ").concat(o.RESET)),i),u=(r(a={},s.NOTSET,"[NOTSET]:"),r(a,s.DEBUG,"[DEBUG]: "),r(a,s.INFO,"[INFO]: "),r(a,s.WARN,"[WARN]: "),r(a,s.ERROR,"[ERROR]: "),a);e.exports={LogLevelEnum:s,LogNumberLevel:{_0:"NOTSET",_1:"DEBUG",_2:"INFO",_3:"WARN",_4:"ERROR"},LogLevelInfoEnum:u,LogLevelColorInfoEnum:l}},function(e,t){e.exports={FEATURE_TEST:"FEATURE_TEST",FEATURE_ROLLOUT:"FEATURE_ROLLOUT",AB:"VISUAL_AB"}},function(e,t,n){var i={SegmentOperandTypes:n(42),SegmentOperatorTypes:n(43),SegmentOperandValueTypeRegexes:n(44),SegmentOperandValues:n(45)};e.exports=i},function(e,t,n){var i=n(1),a={init:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.callback=e.integrations&&e.integrations.callback},execute:function(e){i.isFunction(this.callback)&&this.callback(e)}};e.exports=a},function(e,t,n){var i=n(48),a=n(3),r=i(a.SEED_URL,i.URL),o={generateFor:function(e,t){e="".concat(e);var n="".concat(t),i=o.generate(n,r);return o.generate(e,i).replace(/-/gi,"").toUpperCase()},generate:function(e,t){if(e&&t)return i(e,t)}};e.exports=o},function(e,t,n){var i=n(14),a=n(1).isString,r={init:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collectionPrefix;return t&&a(t)&&(r.collectionPrefix=t),r},getBaseUrl:function(){var e=i.BASE_URL;return r.collectionPrefix?"".concat(e,"/").concat(r.collectionPrefix):e}};e.exports=r},function(e,t,n){var i=n(4).getCurrentTime,a=n(1),r=a.isObject,o=a.isFunction,s={_getStoredSettings:function(e){var t,n=!1;if(e&&r(e)&&o(e.getSettings))try{var a=e.getSettings();if((t=JSON.parse(a))&&r(t)&&Object.keys(t).length>3){var s="VWO-SDK - [INFO]: ".concat(i()," VWO settings found in Storage Service.");console.info(s),n=!0}else if(t){var l="VWO-SDK - [ERROR]: ".concat(i()," VWO settings found in Storage Service is not valid.");console.error(l)}else{var u="VWO-SDK - [WARNING]: ".concat(i()," VWO settings is empty in Storage Service.");console.warn(u)}}catch(e){var c="VWO-SDK - [ERROR]: ".concat(i()," VWO settings found in Storage Service is not valid. ").concat(e);console.error(c),n=!1}return{isStoredData:n,parsedSettings:t}},send:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.method,n=e.url,a=e.payload,l=e.userStorageService,u=e.customHeaders,c=void 0===u?{}:u;if(n&&t)return new Promise((function(e,u){var g=s._getStoredSettings(l),E=g.isStoredData,f=g.parsedSettings;if(!E){var d={method:t,headers:c};return"POST"===t&&(d.body=JSON.stringify(a)),fetch(n,d).then((function(t){return t.text().then((function(n){var a={};try{a=JSON.parse(n)}catch(e){console.info("VWO-SDK - [INFO]: ".concat(i()," VWO didn't send JSON response which is expected: ").concat(e))}if(l&&r(l)&&o(l.setSettings)&&l.setSettings(a),200===t.status)e(a);else{var s="VWO-SDK - [ERROR]: ".concat(i()," Request failed for fetching account settings. Got Status Code: ").concat(t.status);console.error(s),u(s)}}))})).catch((function(e){var t="VWO-SDK - [ERROR]: ".concat(i()," Request failed for fetching account settings. Got Status Code: ").concat(e);console.error(t),u(t)}))}e(f)}))}};e.exports=s},function(e,t,n){var i=n(0).LogLevelEnum,a=n(4).getCurrentTime,r=n(1),o=r.isObject,s=r.isFunction,l={_getStoredSettings:function(e){var t,n=!1;if(e&&o(e)&&s(e.getSettings))try{var i=e.getSettings();if((t=JSON.parse(i))&&o(t)&&Object.keys(t).length>3){var r="VWO-SDK - [INFO]: ".concat(a()," VWO settings found in Storage Service.");console.info(r),n=!0}else if(t){var l="VWO-SDK - [ERROR]: ".concat(a()," VWO settings found in Storage Service is not valid.");console.error(l)}else{var u="VWO-SDK - [WARNING]: ".concat(a()," VWO settings is empty in Storage Service.");console.warn(u)}}catch(e){var c="VWO-SDK - [ERROR]: ".concat(a()," VWO settings found in Storage Service is not valid. ").concat(e);console.error(c),n=!1}return{isStoredData:n,parsedSettings:t}},send:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.method,i=t.url,a=t.payload,r=t.userStorageService,o=t.customHeaders,s=t.logger;if(i&&n)return new Promise((function(t,u){var c=l._getStoredSettings(r),g=c.isStoredData,E=c.parsedSettings;if(g)t(E);else{var f=new XMLHttpRequest;e.xhrHandler(f,n,i,a,r,o,s,t,u)}}))},sendRequest:function(e,t,n,a,r,o,s,l,u){var c=this,g=1e3*(e+1),E=new XMLHttpRequest;for(var f in E.timeout=5e3,E.onload=function(){E.status<200||E.status>=300?e5&&void 0!==arguments[5]?arguments[5]:{},s=arguments.length>6?arguments[6]:void 0,l=arguments.length>7?arguments[7]:void 0,u=arguments.length>8?arguments[8]:void 0;if("GET"===t)try{for(var c in e.onload=function(){r.xhrOnLoad(e,a,l)},e.onerror=function(){r.xhrOnError(e,u)},e.open(t,n),o)o.hasOwnProperty(c)&&e.setRequestHeader(c,o[c]);e.send()}catch(e){console.log(e.message)}else if("POST"===t){var g=0,E=5;this.sendRequest(g,E,s,o,i,t,n,l,u)}},xhrOnLoad:function(e,t,n){try{var i=JSON.parse(e.response);t&&o(t)&&s(t.setSettings)&&t.setSettings(e.response),n(i)}catch(e){console.error(e)}},xhrOnError:function(e,t){var n="VWO-SDK - [ERROR]: ".concat(a()," Request failed for fetching account settings. Got Status Code: ").concat(e.status);console.error(n),t(n)}};e.exports=l},function(e,t,n){var i=n(3),a=n(14),r=n(4),o=r.getRandomNumber,s=r.getCurrentTime,l={get:function(e,t,r){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(e&&t){var l="https",u=a.BASE_URL,c=a.SETTINGS_URL;return s.isViaWebhook&&(c=a.WEBHOOK_SETTINGS_URL),c+="?a=".concat(e,"&")+"i=".concat(t,"&")+"r=".concat(o(),"&")+"platform=".concat(i.PLATFORM,"&")+"".concat(i.SDK_QUERY_PARAM,"=").concat(i.SDK_NAME,"&")+"".concat(i.SDK_VERSION_QUERY_PARAM,"=").concat(i.SDK_VERSION),s.hostname&&s.path&&(l=s.protocol,s.port,u=s.hostname||u,c=s.path||c),"undefined"==typeof XMLHttpRequest?n(22).send({method:"GET",url:"".concat(l,"://").concat(u).concat(c),userStorageService:r}):n(23).send({method:"GET",url:"".concat(l,"://").concat(u).concat(c),userStorageService:r})}console.error("AccountId and sdkKey are required for fetching account settings. Aborting!")},handleHttpRequest:function(e,t,n){var i,a=e.statusCode,r=e.headers["content-type"],o="";if(/^application\/json/.test(r)||(i="Invalid content-type.\nExpected application/json but received ".concat(r)),i)return console.error(i.message),e.resume(),void n(i);e.setEncoding("utf8"),e.on("data",(function(e){o+=e})),e.on("end",(function(){l.handleHttpResponse(a,o,t,n)}))},handleHttpResponse:function(e,t,n,i){try{var a=JSON.parse(t);if(200!==e){var r="VWO-SDK - [ERROR]: ".concat(s()," Request failed for fetching account settings. Got Status Code: ").concat(e," and message: ").concat(t);return console.error(r),void i(r)}n(a)}catch(e){console.error("VWO-SDK - [ERROR]: ".concat(s()," Request failed for fetching account settings - ").concat(e.message)),i(e)}}};e.exports=l},function(e,t,n){var i=n(26),a=n(1),r=n(4),o=n(10).objectValues,s=n(24),l=n(9),u=(n(3).MAX_EVENTS_PER_REQUEST,n(0)),c=n(5),g=n(2).INDEX,E=u.setLogHandler,f=u.setLogLevel,d=u.LogLevelEnum,S=u.LogNumberLevel,p=u.LogMessageEnum,v=u.LogMessageUtil,_=u.getLogger();function I(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=v.build(p.ERROR_MESSAGES.CONFIG_PARAMETER_INVALID,{file:g,parameter:e,type:t,api:c.LAUNCH});throw new Error(_.log(d.ERROR,n))}function A(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=v.build(p.INFO_MESSAGES.CONFIG_PARAMETER_USED,{file:g,parameter:e,type:t});console.info("VWO-SDK - [INFO]: ".concat(r.getCurrentTime()," ").concat(n))}u.setLogLevel(d.ERROR),e.exports={logging:u,setLogger:E,setLogLevel:f,getSettingsFile:s.get,GoalTypeEnum:l,LogLevelEnum:d,launch:function(e){var t={};try{r.cloneObject(e),a.isUndefined(e.shouldTrackReturningUser)||a.isBoolean(e.shouldTrackReturningUser)?a.isUndefined(e.shouldTrackReturningUser)||A("shouldTrackReturningUser","boolean"):I("shouldTrackReturningUser","boolean"),a.isUndefined(e.isDevelopmentMode)||a.isBoolean(e.isDevelopmentMode)?a.isUndefined(e.isDevelopmentMode)||A("isDevelopmentMode","boolean"):I("isDevelopmentMode","boolean"),e.goalTypeToTrack&&!o(l).includes(e.goalTypeToTrack)?I("goalTypeToTrack","string(REVENUE_TRACKING, CUSTOM_GOAL, ALL)"):e.goalTypeToTrack&&A("goalTypeToTrack","string(REVENUE_TRACKING, CUSTOM_GOAL, ALL)"),e.logging&&e.logging.level&&!o(d).includes(e.logging.level)?I("logLevel","number(1,2,3,4)"):e.logging&&e.logging.level&&A("logLevel","number(1,2,3,4)"),e.pollingInterval&&!a.isNumber(e.pollingInterval)?I("pollingInterval","number(in miliiseconds)"):e.pollingInterval&&A("pollingInterval","number(in miliiseconds)"),e.pollingInterval&&a.isUndefined(e.sdkKey)&&I("sdkKey(required for polling)","string"),e.pollingInterval&&!a.isString(e.sdkKey)&&I("sdkKey","string"),a.isUndefined(e.batchEvents)||a.isObject(e.batchEvents)?a.isUndefined(e.batchEvents)||A("batchEvents","object"):I("batchEvents","object"),a.isUndefined(e.returnPromiseFor)||a.isObject(e.returnPromiseFor)?a.isUndefined(e.returnPromiseFor)||A("returnPromiseFor","object"):I("returnPromiseFor","object"),a.isUndefined(e.asyncStorageConfig)||a.isObject(e.asyncStorageConfig)?a.isUndefined(e.asyncStorageConfig)||A("asyncStorageConfig","object"):I("asyncStorageConfig","object"),a.isUndefined(e.integrations)||a.isObject(e.integrations)?a.isUndefined(e.integrations)||A("integrations","object"):I("integrations","object"),a.isUndefined(e.userStorageService)||a.isObject(e.userStorageService)?a.isUndefined(e.userStorageService)||A("userStorageService","object"):I("userStorageService","object"),a.isObject(e.batchEvents)&&(e.batchEvents=null),t=e}catch(e){_.log(d.ERROR,v.build(p.ERROR_MESSAGES.CONFIG_CORRUPTED,{file:g,api:c.LAUNCH})),t={}}return t.isDevelopmentMode&&u.setLogColorMode(!0),t.logging&&a.isObject(t.logging)&&(void 0!==t.logging.haveColoredLogs&&u.setLogColorMode(t.logging.haveColoredLogs),t.logging.logger&&a.isObject(t.logging.logger)&&a.isFunction(t.logging.logger.log)?(u.setLogHandler(t.logging.logger),u.setLogLevel(u.LogLevelEnum.NOTSET),_.log(d.DEBUG,v.build(p.DEBUG_MESSAGES.CONFIG_CUSTOM_LOGGER_USED,{file:g}))):t.logging.logger&&I("logging.logger","object"),void 0!==t.logging.level&&(u.setLogLevel(t.logging.level),_.log(d.DEBUG,v.build(p.DEBUG_MESSAGES.CONFIG_LOG_LEVEL_SET,{file:g,level:S["_"+t.logging.level]})))),t.isDevelopmentMode&&_.log(d.DEBUG,v.build(p.DEBUG_MESSAGES.CONFIG_DEVELOPMENT_MODE_STATUS,{file:g})),t.logger=t.logging&&t.logging.logger||_,new i(t)}}},function(e,t,n){function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};i(this,e),this.getVariation=this.getVariationName,this.userStorageService=t.userStorageService,this.logger=t.logger,this.returnPromiseFor=t.returnPromiseFor,this.asyncStorageConfig=t.asyncStorageConfig,this.optOut=!1,void 0===this.userStorageService&&t.asyncStorageConfig&&(this.userStorageService=t.asyncStorageConfig.redisStorage,t.userStorageService=this.userStorageService);var n=new E(t);n.isSettingsFileValid()?(this.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_VALID,{file:A})),d.init(t),this.eventQueue=new g,this.usageStats=new p,this.SettingsFileManager=n,n.checkAndPoll(),t.isDevelopmentMode||this.usageStats.collectUsageStats(n.getConfig()),this.SettingsFileManager.processSettingsFile(),this.logger.log(v.INFO,I.build(_.INFO_MESSAGES.SDK_INITIALIZED,{file:A})),this.UrlService=S.init(t.settingsFile),this.VWOFeatureFlags=c.init(t.settingsFile)):this.logger.log(v.ERROR,I.build(_.ERROR_MESSAGES.SETTINGS_FILE_INVALID,{file:A}))}var t,n,o;return t=e,(n=[{key:"activate",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{var a=this;if(a.asyncStorageConfig&&l.isObject(a.asyncStorageConfig))return a.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_ASYNC_RETURN_PROMISE,{file:A,method:s.ACTIVATE})),new Promise((function(o){if(!n.optOut)return r.activate(a,e,t,i).then((function(e){l.isObject(e)?o(e.variationName):o(e)}));n.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.ACTIVATE})),o(null)}));if(a.returnPromiseFor&&(a.returnPromiseFor.activate||a.returnPromiseFor.all))return a.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_RETURN_PROMISE,{file:A,method:s.ACTIVATE})),new Promise((function(o){var u;n.optOut?(n.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.ACTIVATE})),o(null)):(i.responseCallback=function(e,t){o(u)},(u=r.activate(a,e,t,i))?l.isObject(u)&&o(u.variationName):o(u))}));if(this.optOut)return this.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.ACTIVATE})),null;var o=r.activate(a,e,t,i);return l.isObject(o)?o.variationName:o}catch(e){return this.logger.log(v.ERROR,e.message),null}}},{key:"getVariationName",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{var a=this;return a.asyncStorageConfig&&l.isObject(a.asyncStorageConfig)?(a.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_ASYNC_RETURN_PROMISE,{file:A,method:s.GET_VARIATION_NAME})),new Promise((function(o){if(!n.optOut)return r.getVariation(a,e,t,i).then((function(e){l.isObject(e)?o(e.variationName):o(e)}));n.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.GET_VARIATION_NAME})),o(null)}))):a.returnPromiseFor&&(a.returnPromiseFor.getVariationName||a.returnPromiseFor.all)?(a.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_RETURN_PROMISE,{file:A,method:s.GET_VARIATION_NAME})),new Promise((function(o){n.optOut?(n.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.GET_VARIATION_NAME})),o(null)):o(r.getVariation(a,e,t,i))}))):this.optOut?(this.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.GET_VARIATION_NAME})),null):r.getVariation(a,e,t,i)}catch(e){return this.logger.log(v.ERROR,e.message),null}}},{key:"track",value:function(e,t,n){var i=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};try{var o=this;return o.asyncStorageConfig&&l.isObject(o.asyncStorageConfig)?(o.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_ASYNC_RETURN_PROMISE,{file:A,method:s.TRACK})),new Promise((function(l){if(!i.optOut)return r.track(o,e,t,n,a).then((function(e){l(e)}));i.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.TRACK})),l(null)}))):o.returnPromiseFor&&(o.returnPromiseFor.track||o.returnPromiseFor.all)?(o.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_RETURN_PROMISE,{file:A,method:s.TRACK})),new Promise((function(c){if(i.optOut)i.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.TRACK})),c(null);else{var g,E=0;a.responseCallback=function(t,n){E+=1,(o.isEventArchEnabled||l.isArray(e)||(l.isUndefined(e)||l.isNull(e))&&u.objectValues(g).filter(Boolean).length||E===u.objectValues(g).filter(Boolean).length)&&c(g)},(g=r.track(o,e,t,n,a))&&u.objectValues(g).some(Boolean)?g&&g.isDevelopmentMode&&(delete g.isDevelopmentMode,c(g)):c(g)}}))):this.optOut?(this.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.TRACK})),null):r.track(o,e,t,n,a)}catch(e){return this.logger.log(v.ERROR,e.message),null}}},{key:"isFeatureEnabled",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{var a=this;if(a.asyncStorageConfig&&l.isObject(a.asyncStorageConfig))return a.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_ASYNC_RETURN_PROMISE,{file:A,method:s.IS_FEATURE_ENABLED})),new Promise((function(o){if(!n.optOut)return r.isFeatureEnabled(a,e,t,i).then((function(e){l.isObject(e)?o(e.isFeatureEnabled):o(e)}));n.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.IS_FEATURE_ENABLED})),o(null)}));if(a.returnPromiseFor&&(a.returnPromiseFor.isFeatureEnabled||a.returnPromiseFor.all))return a.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_RETURN_PROMISE,{file:A,method:s.IS_FEATURE_ENABLED})),new Promise((function(o){var u;n.optOut?(n.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.IS_FEATURE_ENABLED})),o(!1)):(i.responseCallback=function(e,t){o(!!u)},u=r.isFeatureEnabled(a,e,t,i),l.isNull(u)?o(!1):l.isObject(u)&&o(!!u.isFeatureEnabled))}));if(this.optOut)return this.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.IS_FEATURE_ENABLED})),!1;var o=r.isFeatureEnabled(a,e,t,i);return l.isObject(o)?!!o.isFeatureEnabled:!!o}catch(e){return this.logger.log(v.ERROR,e.message),!1}}},{key:"getFeatureVariableValue",value:function(e,t,n){var i=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};try{var o=this;return o.asyncStorageConfig&&l.isObject(o.asyncStorageConfig)?(o.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_ASYNC_RETURN_PROMISE,{file:A,method:s.GET_FEATURE_VARIABLE_VALUE})),new Promise((function(u){if(!i.optOut)return r.getFeatureVariableValue(o,e,t,n,a).then((function(e){l.isObject(e)?u(e.typeCastedValue):u(e)}));i.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.GET_FEATURE_VARIABLE_VALUE})),u(null)}))):o.returnPromiseFor&&(o.returnPromiseFor.getFeatureVariableValue||o.returnPromiseFor.all)?(o.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_RETURN_PROMISE,{file:A,method:s.GET_FEATURE_VARIABLE_VALUE})),new Promise((function(l){i.optOut?(i.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.GET_FEATURE_VARIABLE_VALUE})),l(null)):l(r.getFeatureVariableValue(o,e,t,n,a))}))):this.optOut?(this.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.GET_FEATURE_VARIABLE_VALUE})),null):r.getFeatureVariableValue(o,e,t,n,a)}catch(e){return this.logger.log(v.ERROR,e.message),null}}},{key:"push",value:function(e,t,n){var i=this;try{var a,o=this;if(2===arguments.length)a=e,n=t,e=" ",t=" ";else{if(3!==arguments.length)return this.logger.log(v.ERROR,I.build(_.ERROR_MESSAGES.API_BAD_PARAMETERS,{file:A,api:s.PUSH})),!1;a={}}return o.returnPromiseFor&&(o.returnPromiseFor.push||o.returnPromiseFor.all)?(o.logger.log(v.INFO,I.build(_.INFO_MESSAGES.CONFIG_RETURN_PROMISE,{file:A,method:s.PUSH})),new Promise((function(c){if(i.optOut)i.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.PUSH})),c(null);else{var g,E=0,f={responseCallback:function(e,t){E+=1,(a&&l.isObject(a)&&u.objectValues(a).filter(Boolean).length>1||E===u.objectValues(g).filter(Boolean).length)&&c(g)}};(g=r.push(o,e,t,n,a,f))?g&&g.isDevelopmentMode&&(delete g.isDevelopmentMode,c(g)):c(!1)}}))):this.optOut?(this.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:s.PUSH})),null):r.push(o,e,t,n,a)}catch(e){return this.logger.log(v.ERROR,e.message),!1}}},{key:"setOptOut",value:function(){var e=this;return this.logger.log(v.INFO,I.build(_.INFO_MESSAGES.OPT_OUT_API_CALLED,{file:A})),this.returnPromiseFor&&(this.returnPromiseFor.optOut||this.returnPromiseFor.all)?new Promise((function(t){e._destroyInstanceVariables(),e.batchEventsQueue?e.flushEvents().then((function(){e.batchEventsQueue=void 0,t(!0)})):t(!0)})):(this.batchEventsQueue&&this.flushEvents().then((function(){e.batchEventsQueue=void 0})),this._destroyInstanceVariables(),!0)}},{key:"flushEvents",value:function(){this.SettingsFileManager.getSettingsFile().accountId}},{key:"getAndUpdateSettingsFile",value:function(e,t){return this.optOut?(this.logger.log(v.INFO,I.build(_.INFO_MESSAGES.API_NOT_ENABLED,{file:A,api:"getAndUpdateSettingsFile"})),new Promise((function(e){e(null)}))):this.SettingsFileManager.getAndUpdateSettingsFile(e,t)}},{key:"_destroyInstanceVariables",value:function(){this.userStorageService=void 0,this.SettingsFileManager=void 0,this.usageStats=void 0,this.eventQueue=void 0,this.optOut=!0}}])&&a(t.prototype,n),o&&a(t,o),e}();e.exports=O},function(e,t,n){var i=n(28),a=n(52),r=n(53),o=n(54),s=n(55),l=n(58);e.exports={activate:i,getVariation:a,track:r,isFeatureEnabled:o,getFeatureVariableValue:s,push:l}},function(e,t,n){var i=n(3),a=n(5),r=n(8),o=n(7),s=n(11),l=n(6),u=n(1),c=n(0),g=n(2),E=n(12),f=c.LogLevelEnum,d=c.LogMessageEnum,S=c.LogMessageUtil,p=g.Activate;function v(e,t,n,i,a,r,o,u,c,g,v,_){var I=_.variationId,A=_.variationName,O=_.isStoredVariation;if(!l.isValidValue(A))return e.logger.log(f.INFO,S.build(d.INFO_MESSAGES.DECISION_NO_VARIATION_ALLOTED,{file:p,userId:n,campaignKey:t})),null;if(O&&!r)return e.logger.log(f.INFO,S.build(d.INFO_MESSAGES.CAMPAIGN_USER_ALREADY_TRACKED,{file:p,userId:n,campaignKey:t,api:a})),{variationName:A};if(i.batchEvents){var R=s.buildBatchEventForTrackingUser(o,u.id,I,n,c,g);e.batchEventsQueue.enqueue(R)}else if(o.isEventArchEnabled){var T=s.getEventsBaseProperties(o,E.VWO_VARIATION_SHOWN,e.usageStats.getUsageStats(),c,g),N=s.getTrackUserPayloadData(o,n,E.VWO_VARIATION_SHOWN,u.id,I);e.eventQueue.process(i,T,e,{payload:N,responseCallback:v})}else{var m=s.buildEventForTrackingUser(o,u.id,I,n,e.usageStats.getUsageStats(),c,g);e.eventQueue.process(i,m,e,{responseCallback:v})}return i.isDevelopmentMode?{variationName:A}:A}e.exports=function(e,t,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},c=a.ACTIVATE,g=!1;if(u.isObject(s)){var E=s.customVariables,_=s.variationTargetingVariables,I=s.userStorageData,A=s.shouldTrackReturningUser,O=s.metaData,R=s.responseCallback,T=s.userAgent,N=s.userIpAddress,m=T;l.areValidParamsForAPIMethod({method:a.ACTIVATE,campaignKey:t,userId:n,customVariables:E,variationTargetingVariables:_,userStorageData:I,shouldTrackReturningUser:A,metaData:O,responseCallback:R,visitorUserAgent:m,userIpAddress:N})&&(g=!0)}if(!1===g)return e.logger.log(f.ERROR,S.build(d.ERROR_MESSAGES.API_BAD_PARAMETERS,{file:p,api:a.ACTIVATE})),null;var h=e.SettingsFileManager.getConfig(),b=e.SettingsFileManager.getSettingsFile(c);if(!b)return null;A=A||h.shouldTrackReturningUser||!1;var y=o.getCampaign(b,t);if(y&&y.hasOwnProperty("isMAB")&&!0===y.isMAB&&void 0===e.userStorageService)return e.logger.log(f.ERROR,"("+p+") This campaign: "+t+" has MAB configured. Please configure User Storage to proceed."),null;if(!y||y.status!==i.STATUS_RUNNING)return e.logger.log(f.WARN,S.build(d.WARNING_MESSAGES.CAMPAIGN_NOT_RUNNING,{file:p,campaignKey:t,api:c})),null;if(!o.isAbCampaign(y))return e.logger.log(f.ERROR,S.build(d.ERROR_MESSAGES.API_NOT_APPLICABLE,{file:p,campaignKey:t,campaignType:y.type,userId:n,api:c})),null;var U=r.getVariation(h,b,y,t,n,E,_,I,O,!0,!1,void 0,c);return u.isPromise(U)?U.then((function(i){return v(e,t,n,h,c,A,b,y,m,N,R,i)})):v(e,t,n,h,c,A,b,y,m,N,R,U)}},function(e,t,n){var i=n(6),a=n(15),r=n(0),o=n(2),s=r.LogLevelEnum,l=r.LogMessageEnum,u=r.LogMessageUtil,c=r.getLogger(),g=o.VariationDecider,E={getVariationAllotted:function(e,t,n){var r={variation:null,variationId:null,variationName:null};if(!i.isValidValue(e))return c.log(s.ERROR,u.build(l.ERROR_MESSAGES.USER_ID_INVALID,{file:g,userId:e})),r;if(a.isUserPartOfCampaign(e,t)){var o=E.getVariationOfCampaignForUser(e,t,n)||{};r.variation=o,r.variationId=o.id,r.variationName=o.name}else c.log(s.INFO,u.build(l.INFO_MESSAGES.USER_NOT_PART_OF_CAMPAIGN,{file:g,userId:e,campaignKey:t.key}));return r},getVariationOfCampaignForUser:function(e,t,n){if(!t)return null;var i=a.bucketUserToVariation(e,t,n);return i&&i.name?(c.log(s.INFO,u.build(l.INFO_MESSAGES.USER_VARIATION_STATUS,{file:g,userId:e,campaignKey:t.key,status:"got Varation:".concat(i.name)})),{variation:i,name:i.name,id:i.id}):(c.log(s.INFO,u.build(l.INFO_MESSAGES.USER_VARIATION_STATUS,{file:g,userId:e,campaignKey:t.key,status:"got no variation"})),null)}};e.exports=E},function(e,t){e.exports={NUMBER:"number",STRING:"string",BOOLEAN:"boolean",OBJECT:"object"}},function(e,t,n){!function(){function t(e,t){var n,i,a,r,o,s,l,u;for(n=3&e.length,i=e.length-n,a=t,o=3432918353,s=461845907,u=0;u>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|a>>>19))+((5*(a>>>16)&65535)<<16)&4294967295))+((58964+(r>>>16)&65535)<<16);switch(l=0,n){case 3:l^=(255&e.charCodeAt(u+2))<<16;case 2:l^=(255&e.charCodeAt(u+1))<<8;case 1:a^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(u)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return a^=e.length,a=2246822507*(65535&(a^=a>>>16))+((2246822507*(a>>>16)&65535)<<16)&4294967295,a=3266489909*(65535&(a^=a>>>13))+((3266489909*(a>>>16)&65535)<<16)&4294967295,(a^=a>>>16)>>>0}var n=t;n.v2=function(e,t){for(var n,i=e.length,a=t^i,r=0;i>=4;)n=1540483477*(65535&(n=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+((1540483477*(n>>>16)&65535)<<16),a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),i-=4,++r;switch(i){case 3:a^=(255&e.charCodeAt(r+2))<<16;case 2:a^=(255&e.charCodeAt(r+1))<<8;case 1:a=1540483477*(65535&(a^=255&e.charCodeAt(r)))+((1540483477*(a>>>16)&65535)<<16)}return a=1540483477*(65535&(a^=a>>>13))+((1540483477*(a>>>16)&65535)<<16),(a^=a>>>15)>>>0},n.v3=t,e.exports=n}()},function(e,t,n){function i(e,t){for(var n=0;n2&&void 0!==arguments[2]&&arguments[2];if(!n)try{this._customLog(e,t)}catch(e){console.error("VWO: Could not log.",e)}}},{key:"info",value:function(e){this._customLog(o.INFO,e)}},{key:"debug",value:function(e){this._customLog(o.DEBUG,e)}},{key:"warn",value:function(e){this._customLog(o.WARN,e)}},{key:"error",value:function(e){this._customLog(o.ERROR,e)}}])&&i(t.prototype,n),a&&i(t,a),e}();e.exports={LogLevelEnum:o,LogNumberLevel:s,LogMessageUtil:l,LogMessageEnum:a,getLogger:function(e){return new f(e)},setLogHandler:function(e){E=e},setLogLevel:function(e){c=void 0===e?o.ERROR:e},getLogLevel:function(){return c},LogManager:f,setLogColorMode:function(e){g=e,E.isColoredLogEnabled=g},getLogColorMode:function(){return g},globalLogHandler:E}},function(e){e.exports=JSON.parse('{"CONFIG_BATCH_EVENT_LIMIT_EXCEEDED":"({file}): Impression event - {endPoint} failed due to exceeding payload size. Parameter eventsPerRequest in batchEvents config in launch API has value:{eventsPerRequest} for account ID:{accountId}. Please read the official documentation for knowing the size limits","CONFIG_LOG_LEVEL_SET":"({file}): Log level set to {level}","CONFIG_CUSTOM_LOGGER_USED":"({file}): Custom logger used","CONFIG_DEVELOPMENT_MODE_STATUS":"({file}): DEVELOPMENT mode is ON. No tracking call will be made to VWO Server","POLLING_SETTINGS_FILE_REGISTERED":"({file}): Polling of settings-file is registered with a periodic interval of {pollingInterval} ms","SETTINGS_FILE_PROCESSED":"({file}): settings-file matches the schema, validated and properly processed for the Account ID:{accountId}","IMPRESSION_FOR_TRACK_USER":"({file}): Impression built for tracking user - {properties}","IMPRESSION_FOR_TRACK_GOAL":"({file}): Impression built for tracking goal - {properties}","IMPRESSION_FOR_PUSH":"({file}): Impression built for pushing custom dimension - {properties}","IMPRESSION_FOR_EVENT_ARCH_TRACK_USER":"({file}): Impression built for vwo_variationShown event for Account ID:{accountId}, User ID:{userId}, and Campaign ID:{campaignId}","IMPRESSION_FOR_EVENT_ARCH_TRACK_GOAL":"({file}): Impression built for {goalName} event for Account ID:{accountId}, User ID:{userId}, and Campaign ID:{campaignId}","IMPRESSION_FOR_EVENT_ARCH_PUSH":"({file}): Impression built for visitor-property:{property} for Account ID:{accountId} and User ID:{userId}","EVENT_BATCH_BEFORE_FLUSHING":"({file}): flushing event queue {manually} having {length} events for Account ID:{accountId}. {timer}","EVENT_BATCH_FLUSH":"{{file}}: Manually flushing batch events for Account ID:{accountId} having {queueLength} events","USER_STORAGE_SERVICE_NOT_CONFIGURED":"({file}): User Storage Service is not configured to get/set the data","USER_STORAGE_SERVICE_NO_STORED_DATA":"({file}): No stored variation for User ID:{userId} for Campaign:{campaignKey} found in User Storage Service","VARIATION_RANGE_ALLOCATION":"({file}): Variation:{variationName} of Campaign:{campaignKey} having weight:{variationWeight} got bucketing range: ( {start} - {end} )","MEG_ELIGIBLE_CAMPAIGNS":"({file}): Campaigns: {eligibleCampaignKeys} are eligible, {inEligibleText} are ineligible from the Group:{groupName} for the User ID:{userId}","SEGMENTATION_SKIPPED":"({file}): Segmentation is not used for Campaign:{campaignKey}, hence skipping evaluating segmentation{variation} for User ID:{userId}","SEGMENTATION_STATUS":"({file}): User ID:{userId} for Campaign:{campaignKey} with variables:{customVariables} {status} {segmentationType} {variation}","WHITELISTING_SKIPPED":"({file}): Whitelisting is not used for Campaign:{campaignKey}, hence skipping evaluating whitelisting for User ID:{userId}","USER_UUID":"({file}): VWO UUID generated for Account Id:{accountId} and User ID:{userId} is {uuid}","USER_HASH_BUCKET_VALUE":"({file}): User ID:{userId} having hash:{hashValue} got bucketValue:{bucketValue}","USER_CAMPAIGN_BUCKET_VALUES":"({file}): User ID:{userId} for Campaign:{campaignKey} having percent-traffic:{percentTraffic} got hash-value:{hashValue} and bucket-value:{bucketValue}"}')},function(e){e.exports=JSON.parse('{"CONFIG_VALID":"({file}): SDK configuration and account settings-file are valid","CONFIG_PARAMETER_USED":"({file}): {parameter} paased in launch API having type:{type}","CONFIG_RETURN_PROMISE":"({file}): {method} API returns a promise as returnPromiseFor is set to true for this API","SDK_INITIALIZED":"({file}): SDK is properly initialzed with the passed configuration","POLLING_SUCCESS":"({file}): settings-file fetched successfully via polling for the accountId:{accountId}","POLLING_SETTINGS_FILE_UPDATED":"({file}): SDK instance is updated with the latest settings-file for the accountId:{accountId}","POLLING_SETTINGS_FILE_NOT_UPDATED":"{file}: settings-file fetched via polling is same as earlier fetched settings","DECISION_NO_VARIATION_ALLOTED":"({file}): Variation was not assigned to the User ID:{userId} for Campaign:{campaignKey}","EVENT_BATCH_DEFAULTS":"({file}): {parameter} not passed in SDK configuration, setting it default to {defaultValue}","EVENT_QUEUE":"({file}): Event with payload:{event} pushed to the {queueType} queue","EVENT_BATCH_After_FLUSHING":"({file}): Event queue having {length} events has been flushed {manually}","CAMPAIGN_NOT_ACTIVATED":"({file}): Activate the campaign:{campaignKey} first for User ID:{userId} to {reason}","CAMPAIGN_USER_ALREADY_TRACKED":"({file}): User ID:{userId} for Campaign:{campaignKey} has already been tracked earlier for \\"{api}\\" API. No tracking call is made to VWO server","CAMPAIGN_GOAL_ALREADY_TRACKED":"({file}): Goal:{goalIdentifier} of Campaign:{campaignKey} for User ID:{userId} has already been tracked earlier. No tracking call is made to VWO server","GOT_STORED_VARIATION":"({file}): Got stored variation from User Storage Service for User ID:{userId} for Campaign:{campaignKey} as Variation:{variationName}","GETTING_DATA_USER_STORAGE_SERVICE":"({file}): Read data from User Storage Service for User ID:{userId} and Campaign:{campaignKey}","SETTING_DATA_USER_STORAGE_SERVICE":"({file}): Set data into User Storage Service for User ID:{userId} and Campaign:{campaignKey}","IMPRESSION_SUCCESS":"({file}): Impression event - {endPoint} was successfully received by VWO having main keys: Account ID:{accountId}, {mainKeys}","IMPRESSION_SUCCESS_FOR_EVENT_ARCH":"({file}): Impression for {event} - {endPoint} was successfully received by VWO for Account ID:{accountId}","IMPRESSION_BATCH_SUCCESS":"({file}): Impression event - {endPoint} was successfully received by VWO having Account ID:{accountId}","IMPRESSION_BATCH_FAILED":"({file}): Batch events couldn\\"t be received by VWO. Calling Flush Callback with error and data","MEG_ELIGIBLE_CAMPAIGNS":"({file}): Got {noOfEligibleCampaigns} eligible winners out of {noOfGroupCampaigns} campaigns from the Group:{groupName} and for User ID:{userId}","OTHER_CAMPAIGN_SATISFIES_WHITELISTING_STORAGE":"({file}): Campaign:{campaignKey} of Group:{groupName} satisfies {type} for User ID:{userId}","SEGMENTATION_STATUS":"({file}): User ID:{userId} for Campaign:{campaignKey} with variables:{customVariables} {status} {segmentationType} {variation}","MEG_CALLED_CAMPAIGN_NOT_WINNER":"({file}): Campaign:{campaignKey} does not qualify from the mutually exclusive group:{groupName} for User ID:{userId}","MEG_GOT_WINNER_CAMPAIGN":"({file}): Campaign:{campaignKey} is selected from the mutually exclusive group:{groupName} for the User ID:{userId}","FEATURE_STATUS":"({file}): Campaign:{campaignKey} is {status} for user ID:{userId}","FEATURE_VARIABLE_VALUE":"({file}): For User ID:{userId}, value for variable:{variableKey} of feature:{campaignKey} is:{variableValue}","FEATURE_VARIABLE_DEFAULT_VALUE":"({file}): Feature is not enabled for variation:{variationName}. Returning default value for the variable:{variableKey}","USER_NOT_PART_OF_CAMPAIGN":"({file}): User ID:{userId} did not qualify for Campaign:{campaignKey}","USER_VARIATION_STATUS":"({file}): User ID:{userId} for Campaign:{campaignKey} {status}","USER_CAMPAIGN_ELIGIBILITY":"({file}): User ID:{userId} for Campaign:{campaignKey} is {status} to become part of campaign","USER_VARIATION_ALLOCATION_STATUS":"({file}): User ID:{userId} for Campaign:{campaignKey} {status}","OPT_OUT_API_CALLED":"({file}): You have opted out for not tracking i.e. all API calls will stop functioning and will simply early return","API_NOT_ENABLED":"({file}): {api} API is disabled as you opted out for tracking. Reinitialize the SDK to enable the normal functioning of all APIs.","INITIATING_ACTIVATE":"({file}): Initiating activation of user {userId} for campaign {campaignKey}.","INITIATING_GET_VARIATION":"({file}): Initiating getVariation of user \'{userId}\' for campaign \'{campaignKey}\'.","INITIATING_GET_FEATURE_VARIATION":"({file}): Initiating getFeatureVariable for variable key \'{variableKey}\' of user \'{userId}\' for campaign \'{campaignKey}\'.","INITIATING_IS_FEATURE_ENABLED":"({file}): Initiating isFeatureEnabled of user \'{userId}\' for campaign \'{campaignKey}\'.","INITIATING_PUSH_DIMENSION":"({file}): Initiating push segment of user \'{userId}\' with tag name `{tagKey}` and tag value \'{tagValue}\'."}')},function(e){e.exports=JSON.parse('{"CAMPAIGN_NOT_RUNNING":"({file}): {api} API called with Campaign:{campaignKey} but the campaign is not RUNNING. Please verify from VWO App","CAMPAIGN_NOT_ACTIVATED":"({file}): Campaign:{campaignKey} for User ID:{userId} is not yet activated for API:{api}. Use activate API to activate A/B test or isFeatureEnabled API to activate Feature Test"}')},function(e){e.exports=JSON.parse('{"CONFIG_PARAMETER_INVALID":"({file}): {parameter} paased in {api} API is not correct. It should be of type:{type}","CONFIG_POLLING_SDK_KEY_NOT_PROVIVED":"({file}): SDK Key is required along with pollingInterval to poll the settings-file","CONFIG_CORRUPTED":"({file}): Config passed to {api} API is invalid. Please refer developer docs","SETTINGS_FILE_INVALID":"({file}): Settings file passed while instantiating SDK instance is invalid","SETTINGS_FILE_CORRUPTED":"({file}): Fetched settings-file doesn\'t match the desired schema. Please contact VWO Support for help","BATCH_QUEUE_EMPTY":"{{file}}: No batch queue present for account:{accountId} when calling flushEvents API. Check batchEvents config in launch API","API_HAS_CORRUPTED_SETTINGS_FILE":"({file}): {api} API has corrupted settings-file. Please check or reach out to VWO support","API_BAD_PARAMETERS":"({file}): {api} API got bad parameters. Refer the developer docs","API_NOT_APPLICABLE":"({file}): {api} API is not valid for Campaign:{campaignKey} having type:{campaignType} for User ID:{userId}","USER_ID_INVALID":"({file}): Invalid User Id:{userId} passed to the API","CAMPAIGN_NOT_FOUND_FOR_GOAL":"({file}): No such campaign found corresponding to goalIdentifier:{goalIdentifier}. Please verify from VWO app","POLLING_FAILED":"({file}): Fetching of settings-file failed via polling for the accountId:{accountId}","SEGMENTATION_REGEX_CREATION_FAILED":"({file}): Regular expression:{regex} used for targeting cound not be evaluated","SEGMENTATION_ERROR":"({file}): Could not segment the User ID:{userId} for Campaign:{campaignKey}{variation} with customVariables:{customVariables}. Error message: {err}","USER_STORAGE_SERVICE_GET_FAILED":"({file}): Getting data from User Storage Service failed for User ID:{userId}. Error: {error}","USER_STORAGE_SERVICE_SET_FAILED":"({file}): Saving data into User Storage Service failed for User ID:{userId}. Error: {error}","IMPRESSION_FAILED":"({file}): Impression event could not be sent to VWO - {endPoint}. Reason: {err}","TAG_KEY_LENGTH_EXCEEDED":"({file}): Length of custom dimension key:{tagKey} for User Id:{userId} can not be greater than 255","TAG_VALUE_LENGTH_EXCEEDED":"({file}): Length of custom dimension value:{tagValue} of tagKey:{tagKey} for User Id:{userId} can not be greater than 255","TRACK_API_GOAL_NOT_FOUND":"({file}): Goal:{goalIdentifier} not found for Campaign:{campaignKey} and User Id:{userId}","TRACK_API_REVENUE_NOT_PASSED_FOR_REVENUE_GOAL":"({file}): Revenue value should be passed for revenue goal:{goalIdentifier} for Campaign:{campaignKey} and User Id:{userId}","TRACK_API_EVENTS_REVENUE_NOT_PASSED":"({file}): Revenue value should be passed either in options or as an event property for revenue goal:{goalIdentifier} for Campaign:{campaignKey} and User Id:{userId}","UNABLE_TO_CAST_VALUE":"({file}): Unable to cast value:{variableValue} to type:{variableType}, returning null","VARIABLE_NOT_FOUND":"({file}): Variable:{variableKey} for User ID:{userId} is not found in settings-file, returning null","MISSING_IMPORT_SETTINGS_MANDATORY_PARAMS":"AccountId and sdkKey are required for fetching account settings. Aborting!","ACCOUNT_SETTINGS_NOT_FOUND":"({file}): Request failed for fetching account settings. Got Status Code: ${statusCode} and message: ${message}"}')},function(e,t){e.exports={BOLD:"",CYAN:"",GREEN:"",LIGHTBLUE:"",RED:"",RESET:"",WHITE:"",YELLOW:""}},function(e,t,n){var i=n(1),a=/\{([0-9a-zA-Z_]+)\}/g,r={build:function(e,t){try{return e.replace(a,(function(n,a,r){var o;if("{"===e[r-1]&&"}"===e[r+n.length])return a;if(t.hasOwnProperty(a)){var s=t[a];i.isFunction(s)&&(s=t[a]()),o=s}else o=null;return null==o?"":o}))}catch(t){return e}}};e.exports=r},function(e,t,n){function i(e,t){for(var n=0;n=this.logLevel}},{key:"setLogLevel",value:function(e){this.logLevel=void 0===e?o.ERROR:e}},{key:"consoleLog",value:function(e,t){switch(e){case o.INFO:console.info.apply(console,t);break;case o.WARN:console.warn.apply(console,t);break;case o.ERROR:console.error.apply(console,t);break;default:console.log.apply(console,t)}}}])&&i(t.prototype,n),r&&i(t,r),e}();e.exports=u},function(e,t){e.exports={PASSED:"passed",FAILED:"failed"}},function(e,t,n){var i=n(18),a=n(10).getKeyValue,r=n(46),o=r.operandCustomVariablesParser,s=r.operandUserParser,l=n(0),u=n(1),c=n(2),g=i.SegmentOperatorTypes,E=g.AND,f=g.OR,d=g.NOT,S=i.SegmentOperandTypes,p=S.CUSTOM_VARIABLE,v=S.USER,_=l.LogLevelEnum,I=l.LogMessageEnum,A=l.LogMessageUtil,O=c.SegmentEvaluator,R=l.getLogger();function T(e,t){var n=a(e),i=n.key,r=n.value;if(i===d)return!T(r,t);if(i===E){for(var l=[],u=0;u1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5&&void 0!==arguments[5]&&arguments[5];try{return u.isObject(e)&&!Object.keys(e).length?(R.log(_.DEBUG,A.build(I.DEBUG_MESSAGES.SEGMENTATION_SKIPPED,{campaignKey:n,userId:i,file:O}),r),!0):!u.isObject(e)||!Object.keys(e).length||T(e,t)}catch(e){return R.log(_.ERROR,A.build(I.ERROR_MESSAGES.SEGMENTATION_ERROR,{campaignKey:n,userId:i,customVariables:JSON.stringify(t),file:O,err:e,variation:a}),r),!1}}},function(e,t){e.exports={CUSTOM_VARIABLE:"custom_variable",USER:"user"}},function(e,t){e.exports={AND:"and",NOT:"not",OR:"or"}},function(e,t){e.exports={LOWER:/^lower/,LOWER_MATCH:/^lower\((.*)\)/,WILDCARD:/^wildcard/,WILDCARD_MATCH:/^wildcard\((.*)\)/,REGEX:/^regex/,REGEX_MATCH:/^regex\((.*)\)/,STARTING_STAR:/^\*/,ENDING_STAR:/\*$/,GREATER_THAN_MATCH:/^gt\(((\d+\.?\d*)|(\.\d+))\)/,GREATER_THAN_EQUAL_TO_MATCH:/^gte\(((\d+\.?\d*)|(\.\d+))\)/,LESS_THAN_MATCH:/^lt\(((\d+\.?\d*)|(\.\d+))\)/,LESS_THAN_EQUAL_TO_MATCH:/^lte\(((\d+\.?\d*)|(\.\d+))\)/}},function(e,t){e.exports={LOWER_VALUE:1,STARTING_ENDING_STAR_VALUE:2,STARTING_STAR_VALUE:3,ENDING_STAR_VALUE:4,REGEX_VALUE:5,EQUAL_VALUE:6,GREATER_THAN_VALUE:7,GREATER_THAN_EQUAL_TO_VALUE:8,LESS_THAN_VALUE:9,LESS_THAN_EQUAL_TO_VALUE:10}},function(e,t,n){var i=n(1),a=n(4).matchWithRegex,r=n(10).getKeyValue,o=n(18),s=o.SegmentOperandValueTypeRegexes,l=s.LOWER_MATCH,u=s.WILDCARD_MATCH,c=s.REGEX_MATCH,g=s.STARTING_STAR,E=s.ENDING_STAR,f=s.GREATER_THAN_MATCH,d=s.GREATER_THAN_EQUAL_TO_MATCH,S=s.LESS_THAN_MATCH,p=s.LESS_THAN_EQUAL_TO_MATCH,v=o.SegmentOperandValues,_=v.LOWER_VALUE,I=v.STARTING_ENDING_STAR_VALUE,A=v.STARTING_STAR_VALUE,O=v.ENDING_STAR_VALUE,R=v.REGEX_VALUE,T=v.EQUAL_VALUE,N=v.GREATER_THAN_VALUE,m=v.GREATER_THAN_EQUAL_TO_VALUE,h=v.LESS_THAN_VALUE,b=v.LESS_THAN_EQUAL_TO_VALUE;function y(e,t){return a(e,t)&&a(e,t)[1]}function U(e,t){var n=parseFloat(e,10),i=parseFloat(t,10);return n&&i?(n===Math.floor(n)&&(n=parseInt(n,10)),i===Math.floor(i)&&(i=parseInt(i,10)),{operandValue:n.toString(),tagValue:i.toString()}):{operandValue:e,tagValue:t}}function G(e){return void 0===e&&(e=""),i.isBoolean(e)&&(e=!!e),null!==e&&(e=e.toString()),e}function L(e){var t,n,i,r;return a(e,l)?(t=_,n=y(e,l)):a(e,u)?(n=y(e,u),i=a(n,g),r=a(n,E),i&&r?t=I:i?t=A:r&&(t=O),n=n.replace(g,"").replace(E,"")):a(e,c)?(t=R,n=y(e,c)):a(e,f)?(t=N,n=y(e,f)):a(e,d)?(t=m,n=y(e,d)):a(e,S)?(t=h,n=y(e,S)):a(e,p)?(t=b,n=y(e,p)):(t=T,n=e),{operandType:t,operandValue:n}}e.exports={extractOperandValue:y,processValues:U,preProcessTagValue:G,preProcessOperandValue:L,operandCustomVariablesParser:function(e,t){var n=r(e),i=n.key,a=i;if(e=n.value,!t.hasOwnProperty(i))return!1;var o=t[a];o=G(o);var s=L(e),l=s.operandType,u=U(s.operandValue,o);return o=u.tagValue,function(e,t,n){var i;switch(e){case _:null!==n&&(i=t.toLowerCase()===n.toLowerCase());break;case I:null!==n&&(i=n.indexOf(t)>-1);break;case A:null!==n&&(i=n.endsWith(t));break;case O:null!==n&&(i=n.startsWith(t));break;case R:try{var a=new RegExp(t,"g");i=!!a.test(n)}catch(e){i=!1}break;case N:if(null!==n)try{i=parseFloat(t)parseFloat(n)}catch(e){i=!1}break;case b:if(null!==n)try{i=parseFloat(t)>=parseFloat(n)}catch(e){i=!1}break;default:i=n===t}return i}(l,u.operandValue,o)},operandUserParser:function(e,t){for(var n=e.split(","),i=0;i>>32-t}e.exports=function(e){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var r=unescape(encodeURIComponent(e));e=new Array(r.length);for(var o=0;o>>0;v=p,p=S,S=a(d,30)>>>0,d=f,f=I}n[0]=n[0]+f>>>0,n[1]=n[1]+d>>>0,n[2]=n[2]+S>>>0,n[3]=n[3]+p>>>0,n[4]=n[4]+v>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}},function(e,t,n){var i=n(3),a=n(5),r=n(8),o=n(7),s=n(6),l=n(1),u=n(0),c=n(2),g=u.LogLevelEnum,E=u.LogMessageEnum,f=u.LogMessageUtil,d=c.GetVariation;e.exports=function(e,t,n){var u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},c=a.GET_VARIATION_NAME,S=!1;if(l.isObject(u)){var p=u.customVariables,v=u.variationTargetingVariables,_=u.userStorageData,I=u.metaData;s.areValidParamsForAPIMethod({method:a.GET_VARIATION_NAME,campaignKey:t,userId:n,customVariables:p,variationTargetingVariables:v,userStorageData:_,metaData:I})&&(S=!0)}if(!1===S)return e.logger.log(g.ERROR,f.build(E.ERROR_MESSAGES.API_BAD_PARAMETERS,{file:d,api:a.GET_VARIATION_NAME})),null;var A=e.SettingsFileManager.getConfig(),O=e.SettingsFileManager.getSettingsFile(c);if(A.apiName=c,!O)return null;var R=o.getCampaign(O,t);if(!R||R.status!==i.STATUS_RUNNING)return e.logger.log(g.WARN,f.build(E.WARNING_MESSAGES.CAMPAIGN_NOT_RUNNING,{file:d,campaignKey:t,api:c})),null;if(o.isFeatureRolloutCampaign(R))return e.logger.log(g.ERROR,f.build(E.ERROR_MESSAGES.API_NOT_APPLICABLE,{file:d,campaignKey:t,campaignType:R.type,userId:n,api:c})),null;var T=r.getVariation(A,O,R,t,n,p,v,_,I,!1,!1,void 0,c);return l.isPromise(T)?T.then((function(e){return e})):T.variationName?T.variationName:null}},function(e,t,n){function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=n(3),r=n(9),o=n(5),s=n(8),l=n(7),u=n(10).objectValues,c=n(11),g=n(6),E=n(1),f=n(0),d=n(2),S=f.LogLevelEnum,p=f.LogMessageEnum,v=f.LogMessageUtil,_=d.Track,I=r.ALL,A=o.TRACK;function O(e,t,n,i,a,r,o,l,u,g,E,f,d,S,p){if(!Object.keys(p).length)return null;if(u&&u.length)for(var v=0;v0){var _=c.getEventsBaseProperties(n,r,{},d,S),I=c.getTrackGoalPayloadData(n,a,r,l,o,i,f);e.eventQueue.process(t,_,e,{payload:I,responseCallback:E}),n.isEventArchEnabled||Object.keys(l).forEach((function(e){s._saveUserData(t,l[e].campaign,l[e].variationName,l[e].userId,l[e].metaData,r)}))}return t.isDevelopmentMode?Object.assign({},p,{isDevelopmentMode:t.isDevelopmentMode}):p}function R(e,t,n,i,o,u,c,f,d,O,R,m,h,b,y,U,G,L,F,C,V){if(!t||t.status!==a.STATUS_RUNNING)return e.logger.log(S.WARN,v.build(p.WARNING_MESSAGES.CAMPAIGN_NOT_RUNNING,{file:_,campaignKey:n,api:A})),!1;if(l.isFeatureRolloutCampaign(t))return e.logger.log(S.ERROR,v.build(p.ERROR_MESSAGES.API_NOT_APPLICABLE,{file:_,campaignKey:n,campaignType:t.type,userId:i,api:A})),!1;var P=t.id,M=l.getCampaignGoal(o,t.key,u);if(!M)return e.logger.log(S.ERROR,v.build(p.ERROR_MESSAGES.TRACK_API_GOAL_NOT_FOUND,{file:_,userId:i,goalIdentifier:u,campaignKey:n})),!1;if(m!==I&&M.type!==m)return!1;if(M.type===r.REVENUE&&!g.isValidValue(c)){if(!o.isEventArchEnabled)return N(e,i,u,n),!1;if(-1!==M.mca){if(E.isUndefined(F)||!F.hasOwnProperty(M.revenueProp))return N(e,i,u,n),!1}else if(M.revenueProp&&(E.isUndefined(F)||!F.hasOwnProperty(M.revenueProp)))return N(e,i,u,n),!1}M.type===r.REVENUE&&M.revenueProp&&U.add(M.revenueProp);var D=s.getVariation(f,o,t,n,i,d,O,R,b,!1,!0,u,A);return E.isPromise(D)?D.then((function(a){return Object.keys(a).length?T(e,n,P,i,f,M,h,o,t,u,c,b,y,G,L,F,C,V,a):null})):T(e,n,P,i,f,M,h,o,t,u,c,b,y,G,L,F,C,V,D)}function T(e,t,n,i,a,r,o,l,u,g,E,f,d,I,A,O,R,T,N){var m=N.variationId,h=N.variationName,b=N.storedGoalIdentifier;if(h){if(b)if(b.split("_vwo_").includes(g)){if(!o&&-1!==r.mca)return e.logger.log(S.INFO,v.build(p.INFO_MESSAGES.CAMPAIGN_GOAL_ALREADY_TRACKED,{file:_,userId:i,goalIdentifier:g,campaignKey:t})),!1}else b+="_vwo_"+g,l.isEventArchEnabled||s._saveUserData(a,u,h,i,f,b);if(a.batchEvents){var y=c.buildBatchEventForTrackingGoal(l,n,m,i,r,E,O,R,T);e.batchEventsQueue.enqueue(y)}else{if(l.isEventArchEnabled)return d[u.id]={config:a,campaign:u,variationName:h,userId:i,metaData:f,goal:r},!0;var U={};U=A?c.buildBatchEventForTrackingGoal(l,n,m,i,r,E,R,T):c.buildEventForTrackingGoal(l,n,m,i,r,E,R,T),I.push(U)}return l.isEventArchEnabled||s._saveUserData(a,u,h,i,f,g),!0}return!1}function N(e,t,n,i){e.logger.log(S.ERROR,v.build(p.ERROR_MESSAGES.TRACK_API_REVENUE_NOT_PASSED_FOR_REVENUE_GOAL,{file:_,userId:t,goalIdentifier:n,campaignKey:i}))}e.exports=function(e,t,n,a){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},c=!1;if(E.isObject(s)){var f=s.revenueValue,d=s.customVariables,T=s.variationTargetingVariables,N=s.userStorageData,m=s.goalTypeToTrack,h=s.shouldTrackReturningUser,b=s.metaData,y=s.responseCallback,U=s.eventProperties,G=s.userAgent,L=s.userIpAddress,F=G;g.areValidParamsForAPIMethod({method:o.TRACK,campaignKey:t,userId:n,goalIdentifier:a,customVariables:d,variationTargetingVariables:T,userStorageData:N,goalTypeToTrack:m,shouldTrackReturningUser:h,metaData:b,responseCallback:y,eventProperties:U,visitorUserAgent:F,userIpAddress:L})&&(!m||m&&u(r).includes(m))&&(c=!0)}if(!1===c)return e.logger.log(S.ERROR,v.build(p.ERROR_MESSAGES.API_BAD_PARAMETERS,{file:_,api:o.TRACK})),null;var C=e.SettingsFileManager.getConfig(),V=e.SettingsFileManager.getSettingsFile(A);C.apiName=A;var P=new Set;if(!V)return null;var M=l.getCampaign(V,t);if(M&&M.hasOwnProperty("isMAB")&&!0===M.isMAB&&void 0===e.userStorageService)return e.logger.log(S.ERROR,"("+_+") This campaign: "+t+" has MAB configured. Please configure User Storage to proceed."),null;var D=[];if(m=m||C.goalTypeToTrack||I,E.isUndefined(h)&&(h=!!E.isBoolean(C.shouldTrackReturningUser)&&C.shouldTrackReturningUser),E.isString(t)){var k=l.getCampaign(V,t);D.push(k||{key:t})}else D=E.isArray(t)?l.getCampaignsForKeys(V,t):l.getCampaignsForGoal(V,a,m);var B={},K={},j=[],w=!1;D.forEach((function(t){return B[t.key]=R(e,t,t.key,n,V,a,f,C,d,T,N,m,h,b,K,P,j,w,U,F,L)}));var x=!!(B&&Object.keys(B).length>0)&&Object.values(B).every((function(e){return E.isPromise(e)}));return x?Promise.all(Object.values(B)).then((function(t){return t.forEach((function(t,r){var o=Object.keys(B)[r],s=O(e,C,V,P,n,a,f,K,j,w,y,U,F,L,i({},o,t));B[o]=s[o]})),B})):O(e,C,V,P,n,a,f,K,j,w,y,U,F,L,B)}},function(e,t,n){var i=n(3),a=n(5),r=n(8),o=n(7),s=n(11),l=n(6),u=n(1),c=n(0),g=n(2),E=n(12),f=c.LogLevelEnum,d=c.LogMessageEnum,S=c.LogMessageUtil,p=g.IsFeatureEnabled;function v(e,t,n,i,a,r,l,u,c,g,v,_){var I=_.variation,A=_.variationId,O=_.variationName,R=_.isStoredVariation,T=!1;if(O){if(T=o.isFeatureRolloutCampaign(u)||I.isFeatureEnabled,!R||r){if(i.batchEvents){var N=s.buildBatchEventForTrackingUser(l,u.id,A,n,g,v);e.batchEventsQueue.enqueue(N)}else if(l.isEventArchEnabled){var m=s.getEventsBaseProperties(l,E.VWO_VARIATION_SHOWN,e.usageStats.getUsageStats(),g,v),h=s.getTrackUserPayloadData(l,n,E.VWO_VARIATION_SHOWN,u.id,A);e.eventQueue.process(i,m,e,{payload:h,responseCallback:c})}else{var b=s.buildEventForTrackingUser(l,u.id,A,n,e.usageStats.getUsageStats(),g,v);e.eventQueue.process(i,b,e,{responseCallback:c})}return e.logger.log(f.INFO,S.build(d.INFO_MESSAGES.FEATURE_STATUS,{file:p,campaignKey:t,userId:n,status:T?"enabled":"disabled"})),i.isDevelopmentMode?{isFeatureEnabled:T}:T}e.logger.log(f.INFO,S.build(d.INFO_MESSAGES.CAMPAIGN_USER_ALREADY_TRACKED,{file:p,userId:n,campaignKey:t,api:a}))}return e.logger.log(f.INFO,S.build(d.INFO_MESSAGES.FEATURE_STATUS,{file:p,campaignKey:t,userId:n,status:T?"enabled":"disabled"})),R||i.isDevelopmentMode,{isFeatureEnabled:T}}e.exports=function(e,t,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},c=a.IS_FEATURE_ENABLED,g=!1;if(u.isObject(s)){var E=s.customVariables,_=s.variationTargetingVariables,I=s.userStorageData,A=s.shouldTrackReturningUser,O=s.metaData,R=s.responseCallback,T=s.userAgent,N=s.userIpAddress,m=T;l.areValidParamsForAPIMethod({method:a.IS_FEATURE_ENABLED,campaignKey:t,userId:n,customVariables:E,variationTargetingVariables:_,userStorageData:I,shouldTrackReturningUser:A,metaData:O,responseCallback:R,visitorUserAgent:m,userIpAddress:N})&&(g=!0)}if(!1===g)return e.logger.log(f.ERROR,S.build(d.ERROR_MESSAGES.API_BAD_PARAMETERS,{file:p,api:a.isFeatureEnabled})),null;var h=e.SettingsFileManager.getConfig(),b=e.SettingsFileManager.getSettingsFile(c);if(!b)return null;A=A||h.shouldTrackReturningUser||!1;var y=o.getCampaign(b,t);if(y&&y.hasOwnProperty("isMAB")&&!0===y.isMAB&&void 0===e.userStorageService)return e.logger.log(f.ERROR,"("+p+") This campaign: "+t+" has MAB configured. Please configure User Storage to proceed."),null;if(!y||y.status!==i.STATUS_RUNNING)return e.logger.log(f.WARN,S.build(d.WARNING_MESSAGES.CAMPAIGN_NOT_RUNNING,{file:p,campaignKey:t,api:c})),null;if(o.isAbCampaign(y))return e.logger.log(f.ERROR,S.build(d.ERROR_MESSAGES.API_NOT_APPLICABLE,{file:p,campaignKey:t,campaignType:y.type,userId:n,api:c})),null;var U=r.getVariation(h,b,y,t,n,E,_,I,O,!0,!1,void 0,c);return u.isPromise(U)?U.then((function(i){return v(e,t,n,h,c,A,b,y,R,m,N,i)})):v(e,t,n,h,c,A,b,y,R,m,N,U)}},function(e,t,n){var i=n(3),a=n(5),r=n(8),o=n(7),s=n(6),l=n(56),u=n(1),c=n(10),g=n(0),E=n(2),f=g.LogLevelEnum,d=g.LogMessageEnum,S=g.LogMessageUtil,p=E.GetFeatureVariableValue;function v(e,t,n,i,a,r){var s,u=r.variation,g=r.variationName;if(!g)return e.logger.log(f.INFO,S.build(d.INFO_MESSAGES.FEATURE_STATUS,{file:p,campaignKey:t,userId:i,status:"disabled"})),null;if(o.isFeatureRolloutCampaign(a)?s=l.getVariableForFeature(a,n):o.isFeatureTestCampaign(a)&&(s=l.getVariableValueForVariation(a,u,n),c.areObjectKeys(s)&&u.isFeatureEnabled?e.logger.log(f.INFO,S.build(d.INFO_MESSAGES.FEATURE_VARIABLE_VALUE,{file:p,variableKey:n,campaignKey:a.key,variableValue:s.value,userId:i})):c.areObjectKeys(s)&&!u.isFeatureEnabled&&e.logger.log(f.INFO,S.build(d.INFO_MESSAGES.FEATURE_VARIABLE_DEFAULT_VALUE,{file:p,variableKey:n,variationName:g}))),!c.areObjectKeys(s))return e.logger.log(f.ERROR,S.build(d.ERROR_MESSAGES.VARIABLE_NOT_FOUND,{file:p,variableKey:n,userId:i})),null;var E=s.value;return l.getTypeCastVariableValue(E,s.type)}e.exports=function(e,t,n,l){var c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};try{var g=a.GET_FEATURE_VARIABLE_VALUE,E=!1;if(u.isObject(c)){var _=c.customVariables,I=c.variationTargetingVariables,A=c.userStorageData,O=c.metaData;s.areValidParamsForAPIMethod({method:a.GET_FEATURE_VARIABLE_VALUE,campaignKey:t,variableKey:n,userId:l,customVariables:_,variationTargetingVariables:I,userStorageData:A,metaData:O})&&(E=!0)}if(!1===E)return e.logger.log(f.ERROR,S.build(d.ERROR_MESSAGES.API_BAD_PARAMETERS,{file:p,api:a.GetFeatureVariableValue})),null;var R=e.SettingsFileManager.getConfig(),T=e.SettingsFileManager.getSettingsFile(g);if(R.apiName=g,!T)return null;var N=o.getCampaign(T,t);if(!N||N.status!==i.STATUS_RUNNING)return e.logger.log(f.WARN,S.build(d.WARNING_MESSAGES.CAMPAIGN_NOT_RUNNING,{file:p,campaignKey:t,api:g})),null;if(o.isAbCampaign(N))return e.logger.log(f.ERROR,S.build(d.ERROR_MESSAGES.API_NOT_APPLICABLE,{file:p,campaignKey:t,campaignType:N.type,userId:l,api:g})),null;var m=r.getVariation(R,T,N,t,l,_,I,A,O,!1,!1,void 0,g);return u.isPromise(m)?m.then((function(i){return v(e,t,n,l,N,i)})):v(e,t,n,l,N,m)}catch(t){return e.logger.log(f.ERROR,t.message),null}}},function(e,t,n){var i=n(7),a=n(1),r=n(57),o=n(0),s=n(2),l=o.LogLevelEnum,u=o.LogMessageEnum,c=o.LogMessageUtil,g=o.getLogger(),E=s.FeatureUtil,f={getVariableForFeature:function(e,t){var n={};if(i.isFeatureRolloutCampaign(e)){for(var a=e.variables||[],r=0;r5&&void 0!==arguments[5]?arguments[5]:{},S=d.responseCallback,p=i.PUSH;if(!s.areValidParamsForAPIMethod({method:i.PUSH,tagKey:t,tagValue:n,userId:a,customDimensionMap:r,responseCallback:S}))return e.logger.log(c.ERROR,E.build(g.ERROR_MESSAGES.PUSH_INVALID_PARAMS,{file:f,method:p})),!1;if(t.length>255)return e.logger.log(c.ERROR,E.build(g.ERROR_MESSAGES.TAG_KEY_LENGTH_EXCEEDED,{file:f,tagKey:t,userId:a})),!1;if(n.length>255)return e.logger.log(c.ERROR,E.build(g.ERROR_MESSAGES.TAG_VALUE_LENGTH_EXCEEDED,{file:f,tagKey:t,userId:a,tagValue:n})),!1;if(" "===t&&" "===n&&(!r||0===Object.keys(r).length))return e.logger.log(c.ERROR,E.build(g.ERROR_MESSAGES.PUSH_INVALID_PARAMS,{file:f,method:p})),!1;" "!==t&&" "!==n&&(r[t]=n);var v=e.SettingsFileManager.getConfig(),_=e.SettingsFileManager.getSettingsFile(p);if(!_)return!1;var I={};if(v.batchEvents)Object.keys(r).forEach((function(t){var n=u.isString(r[t])?r[t]:JSON.stringify(r[t]),i=l.buildBatchEventForPushing(_,t,n,a);e.batchEventsQueue.enqueue(i),I[t]=!0}));else if(_.isEventArchEnabled){var A=l.getEventsBaseProperties(_,o.VWO_SYNC_VISITOR_PROP),O=l.getPushPayloadData(_,a,o.VWO_SYNC_VISITOR_PROP,r);e.eventQueue.process(v,A,e,{payload:O,responseCallback:S}),I.success=!0}else{var R=[],T=Object.keys(r);T.forEach((function(t){var n,i=u.isString(r[t])?r[t]:JSON.stringify(r[t]);n=l.buildEventForPushing(_,t,i,a),e.eventQueue.process(v,n,e,{responseCallback:S}),R.push(n),I[t]=!0}))}return v.isDevelopmentMode?Object.assign({},I,{isDevelopmentMode:v.isDevelopmentMode}):I}},function(e,t,n){function i(e,t){for(var n=0;n3&&void 0!==arguments[3]?arguments[3]:{},a=i.payload,r=i.responseCallback,o={};t&&t.visitor_ua&&(o[l.USER_AGENT]=encodeURIComponent(t.visitor_ua),t.visitor_ua=o[l.USER_AGENT]),t&&t.visitor_ip&&(o[l.IP]=encodeURIComponent(t.visitor_ip),t.visitor_ip=o[l.IP]),e&&e.isDevelopmentMode?E.log(u.DEBUG,g.build(c.DEBUG_MESSAGES.CONFIG_DEVELOPMENT_MODE_STATUS,{file:f})):this.enqueue(t,n,{payload:a,responseCallback:r},o)}},{key:"enqueue",value:function(e,t,n){var i=n.payload,a=n.responseCallback,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.queue.push({eventName:e.eventName,properties:e,callback:function(){i?r.dispatchPostCall(e,i,{responseCallback:a},o):r.dispatchGetCall(e,{responseCallback:a},o)}}),E.log(u.INFO,g.build(c.INFO_MESSAGES.EVENT_QUEUE,{file:f,queueType:"normal",event:"VWO_MASKED_PAYLOAD"})),t.eventQueue.executeNext(e),this.running||this.executeNext(e),this}},{key:"executeNext",value:function(e){if(this.running=!1,this.queue&&this.queue.length){var t=this.queue.shift();t&&(this.running=!0,t.callback&&a.isFunction(t.callback)&&t.callback(e))}}}])&&i(t.prototype,n),o&&i(t,o),e}();e.exports=d},function(e,t,n){var i=n(0),a=n(2),r=i.LogLevelEnum,o=i.LogMessageEnum,s=i.LogMessageUtil,l=i.getLogger(),u=n(4),c=n(12),g=["url"],E=a.EventDispatcherUtil,f={dispatchGetCall:function(e,t){var i=t.responseCallback,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},E="?";E+=u.convertObjectKeysToString(e,g);try{n(61).sendCall(e,E,{successCallback:i},c)}catch(t){var f=e.url;l.log(r.ERROR,s.build(o.ERROR_MESSAGES.IMPRESSION_FAILED,{file:a.EventDispatcher,endPoint:f,err:t}))}return!1},handleGetResponse:function(e,t,n){if(t)return l.log(r.ERROR,s.build(o.ERROR_MESSAGES.IMPRESSION_FAILED,{file:E,endPoint:n.endPoint,err:t})),!1;var i={file:E,endPoint:n.endPoint,accountId:e&&e.account_id},a={};if(i.endPoint.includes("push")){var u=JSON.parse(e.tags).u;(a=Object.assign({},i,{customVariables:u})).mainKeys="customDimension:".concat(JSON.stringify(a.customVariables))}else(a=Object.assign({},i,{campaignId:e&&e.experiment_id,variationId:e&&e.combination})).mainKeys="campaignId:".concat(a.campaignId," and variationId:").concat(a.variationId);return l.log(r.INFO,s.build(o.INFO_MESSAGES.IMPRESSION_SUCCESS,a)),!0},dispatchPostCall:function(e,t,i){var c=this,E=i.responseCallback,f=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},d="?";d+=u.convertObjectKeysToString(e,g);try{return"undefined"==typeof XMLHttpRequest?n(22).send({method:"POST",url:"".concat(e.url).concat(d),payload:t,customHeaders:f}).then((function(){c.handlePostResponse(e,t),E&&E(null,{status:"success"})})).catch((function(n){c.handlePostResponse(e,t,n),E(n,{status:"failure"})})):n(23).send({method:"POST",url:"".concat(e.url).concat(d),payload:t,customHeaders:f,logger:l}).then((function(){c.handlePostResponse(e,t),E&&E(null,{status:"success"})})).catch((function(n){c.handlePostResponse(e,t,n),E(n,{status:"failure"})}))}catch(t){var S=e.url;l.log(r.ERROR,s.build(o.ERROR_MESSAGES.IMPRESSION_FAILED,{file:a.EventDispatcherUtil,endPoint:S,err:t}))}return Promise.resolve(!1)},handlePostResponse:function(e,t,n){var i=e.url;if(n)return l.log(r.ERROR,s.build(o.ERROR_MESSAGES.IMPRESSION_FAILED,{file:E,endPoint:i,err:n})),!1;var a="".concat(e.en," event");return e.en===c.VWO_SYNC_VISITOR_PROP&&(delete t.d.visitor.props.vwo_fs_environment,a="visitor property:".concat(JSON.stringify(t.d.visitor.props))),l.log(r.INFO,s.build(o.INFO_MESSAGES.IMPRESSION_SUCCESS_FOR_EVENT_ARCH,{file:E,endPoint:i,accountId:e.a,event:a})),!0}};e.exports=f},function(e,t,n){var i=n(0),a=n(2),r=i.LogLevelEnum,o=i.LogMessageEnum,s=i.LogMessageUtil,l=i.getLogger(),u=a.HttpXMLUtil,c=function(){},g=function(e){var t={file:u,endPoint:e.url,accountId:e&&e.account_id},n={};if(t.endPoint.includes("push")){var i=JSON.parse(e.tags).u;(n=Object.assign({},t,{customVariables:i})).mainKeys="customDimension:".concat(JSON.stringify(n.customVariables))}else(n=Object.assign({},t,{campaignId:e&&e.experiment_id,variationId:e&&e.combination})).mainKeys="campaignId:".concat(n.campaignId," and variationId:").concat(n.variationId);l.log(r.INFO,s.build(o.INFO_MESSAGES.IMPRESSION_SUCCESS,n))},E={sendCall:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a="".concat(e.url).concat(t),r=n.successCallback,o=n.errorCallback;o=o||r;var s=!1;"undefined"!=typeof XMLHttpRequest?this.handleGetCall(e,t,r,o,a,s,i):fetch(a,{method:"GET",headers:i}).then((function(){s||(s=!0,r(null,{status:"success"}))})).catch((function(t){s||(s=!0,o(null,{status:"success"}),g(e))}))},handleGetCall:function(e,t,n,i,a,r){var o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{};n=n||c,i=i||c;var s=new XMLHttpRequest;for(var l in s.open("GET",a,!0),o)o.hasOwnProperty(l)&&s.setRequestHeader(l,o[l]);s.onload=function(){if(s.status>=200&&s.status<300){var t=s.responseText;n(t),g(e)}else i(s.statusText),g(e)},s.onerror=function(){i(s.statusText),g(e)},s.send()}};e.exports=E},function(e,t){e.exports={USER_AGENT:"X-Device-User-Agent",IP:"VWO-X-Forwarded-For"}},function(e,t,n){function i(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:this._clonedSettingsFile.accountId,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._clonedSettingsFile.sdkKey;return new Promise((function(i,a){o.get(t,n,null,{isViaWebhook:!0}).then((function(t){e.updateSettingsFile(t),i(t)})).catch((function(e){}))}))}},{key:"updateSettingsFile",value:function(e){this._clonedSettingsFile=r.cloneObject(e),this.processSettingsFile()}},{key:"getConfig",value:function(){return this._configObj}},{key:"getSettingsFile",value:function(e){return this._clonedSettingsFile||this._configObj.logger.log(g.ERROR,f.build(E.ERROR_MESSAGES.API_HAS_CORRUPTED_SETTINGS_FILE,{file:d,api:e})),this._clonedSettingsFile}}])&&i(t.prototype,n),s&&i(t,s),e}();e.exports=S},function(e,t,n){function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e))&&"[object Arguments]"!==Object.prototype.toString.call(e))return;var n=[],i=!0,a=!1,r=void 0;try{for(var o,s=e[Symbol.iterator]();!(i=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);i=!0);}catch(e){a=!0,r=e}finally{try{i||null==s.return||s.return()}finally{if(a)throw r}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var a=n(65),r=a.validate,o=a.number,s=a.string,l=a.boolean,u=a.array,c=a.object,g=a.optional,E=a.union,f=a.type,d=a.record,S=f({id:E([o(),s()]),identifier:s(),type:s(),revenueProp:g(s()),mca:g(E([o(),s()]))}),p=f({id:E([o(),s()]),type:s(),key:s(),value:E([o(),s(),l()])}),v=f({id:E([o(),s()]),name:s(),weight:E([o(),s()]),changes:g(c()),segments:g(c()),variables:g(E([c(),u(p)])),isFeatureEnabled:g(l()),startVariationAllocation:g(o()),endVariationAllocation:g(o())}),_=f({id:E([o(),s()]),type:s(),key:s(),status:s(),name:g(s()),isBucketingSeedEnabled:g(l()),percentTraffic:o(),goals:E([c(),u(S)]),variations:E([c(),u(v)]),variables:g(E([c(),u(p)])),segments:c(),isForcedVariationEnabled:g(l()),isUserListEnabled:g(l()),isMAB:g(l())}),I=f({et:g(s()),p:g(u(o())),wt:g(d(s(),o())),groupName:s(),campaigns:u(o())}),A=f({sdkKey:g(s()),version:E([o(),s()]),accountId:E([o(),s()]),campaigns:u(_),campaignGroups:g(d(s(),o())),isEventArchEnabled:g(l()),collectionPrefix:g(s()),groups:g(E([c(),d(s(),I)]))});e.exports=function(e){return!i(r(e,A),1)[0]}},function(e,t,n){"use strict";function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function*s(e,t){!0===e||(!1===e?yield t.fail():yield*e)}function l(e){const{done:t,value:n}=e.next();return t?void 0:n}n.r(t),n.d(t,"Struct",(function(){return u})),n.d(t,"StructError",(function(){return c})),n.d(t,"any",(function(){return T})),n.d(t,"array",(function(){return N})),n.d(t,"assert",(function(){return g})),n.d(t,"boolean",(function(){return m})),n.d(t,"coerce",(function(){return E})),n.d(t,"coercion",(function(){return S})),n.d(t,"date",(function(){return h})),n.d(t,"defaulted",(function(){return p})),n.d(t,"dynamic",(function(){return b})),n.d(t,"empty",(function(){return I})),n.d(t,"enums",(function(){return y})),n.d(t,"func",(function(){return U})),n.d(t,"instance",(function(){return G})),n.d(t,"intersection",(function(){return L})),n.d(t,"is",(function(){return f})),n.d(t,"lazy",(function(){return F})),n.d(t,"length",(function(){return A})),n.d(t,"literal",(function(){return C})),n.d(t,"map",(function(){return V})),n.d(t,"masked",(function(){return v})),n.d(t,"never",(function(){return P})),n.d(t,"nullable",(function(){return M})),n.d(t,"number",(function(){return D})),n.d(t,"object",(function(){return k})),n.d(t,"optional",(function(){return B})),n.d(t,"partial",(function(){return K})),n.d(t,"pattern",(function(){return O})),n.d(t,"record",(function(){return j})),n.d(t,"refinement",(function(){return R})),n.d(t,"set",(function(){return w})),n.d(t,"string",(function(){return x})),n.d(t,"struct",(function(){return H})),n.d(t,"tuple",(function(){return W})),n.d(t,"type",(function(){return J})),n.d(t,"union",(function(){return q})),n.d(t,"validate",(function(){return d}));class u{constructor(e){const{type:t,schema:n,coercer:i=(e=>e),validator:a=(()=>[]),refiner:r=(()=>[])}=e;this.type=t,this.schema=n,this.coercer=i,this.validator=a,this.refiner=r}}class c extends TypeError{constructor(e,t){const{path:n,value:i,type:a,branch:r}=e,s=o(e,["path","value","type","branch"]);let l;super(`Expected a value of type \`${a}\`${n.length?` for \`${n.join(".")}\``:""} but received \`${JSON.stringify(i)}\`.`),this.value=i,Object.assign(this,s),this.type=a,this.path=n,this.branch=r,this.failures=function(){return l||(l=[e,...t]),l},this.stack=(new Error).stack,this.__proto__=c.prototype}}function g(e,t){const n=d(e,t);if(n[0])throw n[0]}function E(e,t){const n=t.coercer(e);return g(n,t),n}function f(e,t){return!d(e,t)[0]}function d(e,t,n=!1){n&&(e=t.coercer(e));const i=function*e(t,n,i=[],a=[]){const{type:o}=n,u={value:t,type:o,branch:a,path:i,fail:(e={})=>r({value:t,type:o,path:i,branch:[...a,t]},e),check(t,n,r,o){const s=void 0!==r?[...i,o]:i,l=void 0!==r?[...a,r]:a;return e(t,n,s,l)}},c=s(n.validator(t,u),u),g=l(c);g?(yield g,yield*c):yield*s(n.refiner(t,u),u)}(e,t),a=l(i);if(a){return[new c(a,i),void 0]}return[void 0,e]}function S(e,t){const n=e.coercer;return new u(r(r({},e),{},{coercer:e=>n(t(e))}))}function p(e,t,n){return S(e,e=>{const i="function"==typeof t?t():t;if(void 0===e)return i;if(!0!==n&&_(e)&&_(i)){const t=r({},e);let n=!1;for(const e in i)void 0===t[e]&&(t[e]=i[e],n=!0);if(n)return t}return e})}function v(e){return S(e,t=>{if(!_(t))return t;const n={};for(const i in e.schema)n[i]=t[i];return n})}function _(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function I(e){return R(e,e.type+" & Empty",e=>0===e.length)}function A(e,t,n){return R(e,`${e.type} & Length<${t},${n}>`,e=>t`,e=>t.test(e))}function R(e,t,n){const i=e.refiner;return new u(r(r({},e),{},{type:t,*refiner(e,t){yield*s(i(e,t),t),yield*s(n(e,t),t)}}))}function T(){return H("any",()=>!0)}function N(e){return new u({type:`Array<${e?e.type:"unknown"}>`,schema:e,coercer:t=>e&&Array.isArray(t)?t.map(t=>E(t,e)):t,*validator(t,n){if(Array.isArray(t)){if(e)for(const[i,a]of t.entries())yield*n.check(a,e,t,i)}else yield n.fail()}})}function m(){return H("boolean",e=>"boolean"==typeof e)}function h(){return H("Date",e=>e instanceof Date&&!isNaN(e.getTime()))}function b(e){return H("Dynamic<...>",(t,n)=>n.check(t,e(t,n)))}function y(e){return H(`Enum<${e.map(Q)}>`,t=>e.includes(t))}function U(){return H("Function",e=>"function"==typeof e)}function G(e){return H(`InstanceOf<${e.name}>`,t=>t instanceof e)}function L(e){return H(e.map(e=>e.type).join(" & "),(function*(t,n){for(const i of e)yield*n.check(t,i)}))}function F(e){let t;return H("Lazy<...>",(n,i)=>(t||(t=e()),i.check(n,t)))}function C(e){return H(`Literal<${Q(e)}>`,t=>t===e)}function V(e,t){return H(`Map<${e.type},${t.type}>`,(function*(n,i){if(n instanceof Map)for(const[a,r]of n.entries())yield*i.check(a,e,n,a),yield*i.check(r,t,n,a);else yield i.fail()}))}function P(){return H("never",()=>!1)}function M(e){return new u({type:e.type+" | null",schema:e.schema,validator:(t,n)=>null===t||n.check(t,e)})}function D(){return H("number",e=>"number"==typeof e&&!isNaN(e))}function k(e){const t=e?Object.keys(e):[],n=P();return new u({type:e?`Object<{${t.join(",")}}>`:"Object",schema:e||null,coercer:e?Y(e):e=>e,*validator(i,a){if("object"==typeof i&&null!=i){if(e){const r=new Set(Object.keys(i));for(const n of t){r.delete(n);const t=e[n],o=i[n];yield*a.check(o,t,i,n)}for(const e of r){const t=i[e];yield*a.check(t,n,i,e)}}}else yield a.fail()}})}function B(e){return new u({type:e.type+"?",schema:e.schema,validator:(t,n)=>void 0===t||n.check(t,e)})}function K(e){e instanceof u&&(e=e.schema);const t=Object.keys(e),n=P();return new u({type:`Partial<{${t.join(",")}}>`,schema:e,coercer:Y(e),*validator(i,a){if("object"!=typeof i||null==i)return void(yield a.fail());const r=new Set(Object.keys(i));for(const n of t){if(r.delete(n),!(n in i))continue;const t=e[n],o=i[n];yield*a.check(o,t,i,n)}for(const e of r){const t=i[e];yield*a.check(t,n,i,e)}}})}function j(e,t){return H(`Record<${e.type},${t.type}>`,(function*(n,i){if("object"==typeof n&&null!=n)for(const a in n){const r=n[a];yield*i.check(a,e,n,a),yield*i.check(r,t,n,a)}else yield i.fail()}))}function w(e){return H(`Set<${e.type}>`,(t,n)=>{if(!(t instanceof Set))return!1;for(const i of t){const[t]=n.check(i,e);if(t)return!1}return!0})}function x(){return H("string",e=>"string"==typeof e)}function H(e,t){return new u({type:e,validator:t,schema:null})}function W(e){const t=P();return H(`[${e.map(e=>e.type).join(",")}]`,(function*(n,i){if(Array.isArray(n)){for(const[t,a]of e.entries()){const e=n[t];yield*i.check(e,a,n,t)}if(n.length>e.length){const a=e.length,r=n[a];yield*i.check(r,t,n,a)}}else yield i.fail()}))}function J(e){const t=Object.keys(e);return H(`Type<{${t.join(",")}}>`,(function*(n,i){if("object"==typeof n&&null!=n)for(const a of t){const t=e[a],r=n[a];yield*i.check(r,t,n,a)}else yield i.fail()}))}function q(e){return H(""+e.map(e=>e.type).join(" | "),(function*(t,n){for(const i of e){const[...e]=n.check(t,i);if(0===e.length)return}yield n.fail()}))}function Q(e){return"string"==typeof e?`"${e.replace(/"/g,'"')}"`:""+e}function Y(e){const t=Object.keys(e);return n=>{if("object"!=typeof n||null==n)return n;const i={},a=new Set(Object.keys(n));for(const r of t){a.delete(r);const t=e[r],o=n[r];i[r]=E(o,t)}for(const e of a)i[e]=n[e];return i}}},function(e,t,n){function i(e,t){for(var n=0;n0&&(this.data._l=1),this.data}}])&&i(t.prototype,n),r&&i(t,r),e}();e.exports=r}])})); //# sourceMappingURL=vwo-javascript-sdk.min.js.map \ No newline at end of file diff --git a/lib/index.d.ts b/lib/index.d.ts index ac937bd..0e1e161 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -380,6 +380,17 @@ declare module 'vwo-node-sdk' { * This key should be passed along with pollingInterval to fetch settigns file at regular intervals. */ sdkKey?: string; + + /** + * Integration configurations for callback functionality + */ + integrations?: { + /** + * Callback function that receives VWO specific properties + * @param properties Object containing VWO specific information + */ + callback?: (properties: Record) => void; + }; } // For synchronous code