{"version":3,"sources":["webpack://casperEventHub/webpack/bootstrap","webpack://casperEventHub/./src/predicates.ts","webpack://casperEventHub/./src/store.ts","webpack://casperEventHub/./src/rule.ts","webpack://casperEventHub/./src/debugMode.ts","webpack://casperEventHub/./src/session-time.ts","webpack://casperEventHub/./src/xpMismatches.ts","webpack://casperEventHub/./src/salesForceAudience.ts","webpack://casperEventHub/./src/salesforceAudiencePerso.ts","webpack://casperEventHub/./src/experience.ts","webpack://casperEventHub/./src/index.ts"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","modules","parentJsonpFunction","shift","installedModules","9","__webpack_require__","exports","module","l","e","promises","installedChunkData","promise","Promise","resolve","reject","onScriptComplete","script","document","createElement","charset","timeout","nc","setAttribute","src","p","jsonpScriptSrc","error","Error","event","onerror","onload","clearTimeout","chunk","errorType","type","realSrc","target","message","name","request","undefined","setTimeout","head","appendChild","all","m","c","d","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","oe","err","console","jsonpArray","window","oldJsonpFunction","slice","s","isPredicate","isObject","proto","isString","isEqual","expected","evaluate","condition","Array","possibility","buildPredicates","exclude","conditions","possibilities","parseCondition","res","childConditionValue","allOf","oneOf","noneOf","any","regex","isGreaterThanOrEqual","isLessThanOrEqual","olderThan","duration","day","units","days","months","weeks","years","Date","SubConditionIsFalse","urlParamsStorageNamespace","journeySessionStorageNamespace","initStore","pathname","pages","readFromStorage","currentParams","readParams","JSON","storeEntryQueryParams","pageName","time","url","getStableHomePath","saveToStorage","experiences","initDebug","ExperienceStore","this","param","experience","setTriggered","setMismatched","save","path","storage","queryParams","parseQueryString","queryString","pair","namespace","Rule","addPredicates","primitiveConditions","functionConditions","validate","predicates","every","isValid","predicate","logDebug","debugMode","SessionTime","getInstance","addTimeEllapsedCallback","timeEllapsedCallback","removeTimeEllapsedCallback","timeEllapsedCallbacks","indexOf","startTimer","onTimePassed","checkCallbacksOnInterval","casperMismatchEvent","XpMismatches","getState","lastXpName","onXpMismatches","off","boundListener","SalesForceAudience","SalesForceAudiencePerso","then","result","body","recover","Experience","doEval","eventData","tests","userRule","user","basketTotal","totals","basket","products","journey","salesForceAudience","salesForceAudiencePerso","urlParameters","urlParams","dateRange","date","standingOrdersInstance","standingOrders","subscriptionsInstance","subscriptions","xpMistmatchesInstance","xpName","onceRuleInstance","args","arguments","f","isSimpleUserExperience","hasSimpleUserPredicate","unsubscribe","resolvedEventData","trackCasper","experience_name","store","experience_rule","currentRule","join","experience_match","event_raised_by","dispatchXpMismatch","casperEvent","mismatches","xpMistmatches","XpMismatchesRule","standingOrdersContains","orders","StandingOrdersRule","subscriptionsContains","subscriptionsConditions","SubscriptionsRule","isInDateRange","dates","DateRangeRule","urlParameterIs","UrlParametersRule","salesForceAudienceIs","segments","salesForceAudiencePersoIs","visitorIs","UserRule","isSimpleUserPredicate","basketTotalIs","BasketTotalRule","basketContains","BasketRule","visits","pagesUrls","addExpectedJourney","importJourney","since","addExpectedTime","once","onceRule","executeOnMatch","executeOnMismatch","JourneyRule"],"mappings":"kCACE,SAASA,EAAqBC,GAQ7B,IAPA,IAMIC,EAAUC,EANVC,EAAWH,EAAK,GAChBI,EAAcJ,EAAK,GAKAK,EAAI,EAAGC,EAAW,GACpCD,EAAIF,EAASI,OAAQF,IACzBH,EAAUC,EAASE,GAChBG,OAAOC,UAAUC,eAAeC,KAAKC,EAAiBV,IAAYU,EAAgBV,IACpFI,EAASO,KAAKD,EAAgBV,GAAS,IAExCU,EAAgBV,GAAW,EAE5B,IAAID,KAAYG,EACZI,OAAOC,UAAUC,eAAeC,KAAKP,EAAaH,KACpDa,EAAQb,GAAYG,EAAYH,IAKlC,IAFGc,GAAqBA,EAAoBf,GAEtCM,EAASC,QACdD,EAASU,OAATV,GAOF,IAAIW,EAAmB,GAKnBL,EAAkB,CACrBM,EAAG,GAWJ,SAASC,EAAoBlB,GAG5B,GAAG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,gBAU9B,EAV8B,oBAUrC,eACM,EAAP,aAXsC,mCAapC,EAboC,6BAclC,SAC6B,EAD7B,qBAEFnB,eACO,EAAP,cAjBoC,YAmBpC,MAAM,IAAI7J,MAAV,SAnBoC,oCAsBpC,EAtBoC,uBAuBI,EAvBJ,2BAwBtC6L,eACO,EAAP,gC,sCAQGnE,SAAP,YACEC,KACEjF,YACE,4BAA8B0D,KAAKgF,MAAnC,WAFJzD,I,KAwBJ,SAAS4F,IACP,OAAO,mCACL,mBAAiB,IAAIO,EAArB,WC5eJ1I,cAEAwC","file":"main.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t};\n\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t9: 0\n \t};\n\n\n\n \t// script path function\n \tfunction jsonpScriptSrc(chunkId) {\n \t\treturn __webpack_require__.p + \"\" + ({\"0\":\"Basket\",\"1\":\"BasketTotal\",\"2\":\"DateRange\",\"3\":\"Journey\",\"4\":\"Once\",\"5\":\"StandingOrders\",\"6\":\"Subscriptions\",\"7\":\"UrlParameters\",\"8\":\"User\"}[chunkId]||chunkId) + \".js\"\n \t}\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId) {\n \t\tvar promises = [];\n\n\n \t\t// JSONP chunk loading for javascript\n\n \t\tvar installedChunkData = installedChunks[chunkId];\n \t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n \t\t\t// a Promise means \"currently loading\".\n \t\t\tif(installedChunkData) {\n \t\t\t\tpromises.push(installedChunkData[2]);\n \t\t\t} else {\n \t\t\t\t// setup Promise in chunk cache\n \t\t\t\tvar promise = new Promise(function(resolve, reject) {\n \t\t\t\t\tinstalledChunkData = installedChunks[chunkId] = [resolve, reject];\n \t\t\t\t});\n \t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n \t\t\t\t// start chunk loading\n \t\t\t\tvar script = document.createElement('script');\n \t\t\t\tvar onScriptComplete;\n\n \t\t\t\tscript.charset = 'utf-8';\n \t\t\t\tscript.timeout = 120;\n \t\t\t\tif (__webpack_require__.nc) {\n \t\t\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n \t\t\t\t}\n \t\t\t\tscript.src = jsonpScriptSrc(chunkId);\n\n \t\t\t\t// create error before stack unwound to get useful stacktrace later\n \t\t\t\tvar error = new Error();\n \t\t\t\tonScriptComplete = function (event) {\n \t\t\t\t\t// avoid mem leaks in IE.\n \t\t\t\t\tscript.onerror = script.onload = null;\n \t\t\t\t\tclearTimeout(timeout);\n \t\t\t\t\tvar chunk = installedChunks[chunkId];\n \t\t\t\t\tif(chunk !== 0) {\n \t\t\t\t\t\tif(chunk) {\n \t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n \t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n \t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n \t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n \t\t\t\t\t\t\terror.type = errorType;\n \t\t\t\t\t\t\terror.request = realSrc;\n \t\t\t\t\t\t\tchunk[1](error);\n \t\t\t\t\t\t}\n \t\t\t\t\t\tinstalledChunks[chunkId] = undefined;\n \t\t\t\t\t}\n \t\t\t\t};\n \t\t\t\tvar timeout = setTimeout(function(){\n \t\t\t\t\tonScriptComplete({ type: 'timeout', target: script });\n \t\t\t\t}, 120000);\n \t\t\t\tscript.onerror = script.onload = onScriptComplete;\n \t\t\t\tdocument.head.appendChild(script);\n \t\t\t}\n \t\t}\n \t\treturn Promise.all(promises);\n \t};\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/shared_res/agility/casper/eventHub/v1/\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n \tvar jsonpArray = window[\"webpackJsonpcasperEventHub\"] = window[\"webpackJsonpcasperEventHub\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n","import {\n ArrayTestMethods,\n DurationUnit,\n IUnknownObject,\n Possibilities,\n Predicate,\n Conditions,\n Condition,\n Possibility,\n} from './types'\n\nexport function isPredicate(value: Condition): value is Predicate {\n return typeof value === 'function'\n}\n\nexport function isObject(value: Condition): value is IUnknownObject {\n if (\n !(value instanceof Object || (typeof value === 'object' && value !== null))\n ) {\n return false\n }\n const proto = Object.getPrototypeOf(value) as IUnknownObject\n return proto === Object.prototype || proto === null\n}\n\nexport function isString(value: Condition): value is string {\n return (\n typeof value === 'string' ||\n Object.prototype.toString.call(value) === '[object String]'\n )\n}\n\nfunction isEqual(expected: Condition): (value: Possibility) => boolean {\n return (value: Possibility) => expected === value\n}\n\nexport const parseCondition = (\n condition: Condition,\n possibility: Possibility,\n res: boolean[] = []\n): boolean[] => {\n if (isPredicate(condition) || isString(condition)) {\n res.push(evaluate(condition, possibility))\n return res\n }\n for (const property of Object.keys(condition)) {\n if ((possibility as IUnknownObject)[property] === undefined) {\n throw new SubConditionIsFalse()\n }\n const childConditionValue: Condition = (condition as IUnknownObject)[\n property\n ]!\n if (isObject(childConditionValue)) {\n if (isObject((possibility as IUnknownObject)[property]!)) {\n res.push(\n ...parseCondition(\n childConditionValue,\n (possibility as IUnknownObject)[property]!\n )\n )\n } else {\n throw new SubConditionIsFalse()\n }\n } else {\n res.push(\n evaluate(\n childConditionValue,\n (possibility as IUnknownObject)[property]!\n )\n )\n }\n if (res[res.length - 1] === false) {\n throw new SubConditionIsFalse()\n }\n }\n return res\n}\n\nexport const evaluate = (\n condition: Condition,\n possibility: Possibility\n): boolean => {\n if (isPredicate(condition)) {\n return condition(Array.isArray(possibility) ? possibility : [possibility])\n } else if (Array.isArray(possibility)) {\n return possibility.some((valueItem) => isEqual(condition)(valueItem))\n } else {\n return isEqual(condition)(possibility)\n }\n}\n\nexport const buildPredicates = (\n testName: ArrayTestMethods,\n conditions: Conditions,\n exclude = false\n): ((possibilities: Possibilities) => boolean) => {\n return (possibilities: Possibilities): boolean => {\n if (exclude && conditions.length === 0) {\n return possibilities.length === 0\n }\n return conditions[testName]((condition: Condition) =>\n possibilities.some((possibility) => {\n try {\n return parseCondition(condition, possibility).every((test) => test)\n } catch (e) {\n if (!(e instanceof SubConditionIsFalse)) {\n console.log(e)\n }\n return false\n }\n })\n )\n ? !exclude\n : exclude\n }\n}\n\nexport function allOf(...conditions: Conditions): Predicate {\n return buildPredicates('every', conditions)\n}\n\nexport function oneOf(...conditions: Conditions): Predicate {\n return buildPredicates('some', conditions)\n}\n\nexport function noneOf(...conditions: Conditions): Predicate {\n return buildPredicates('some', conditions, true)\n}\n\nexport function any(): Predicate {\n return (possibilities: Possibilities): boolean =>\n possibilities.some((possibility) => possibility)\n}\n\nexport function regex(expected: RegExp): Predicate {\n return (possibilities: Possibilities): boolean =>\n possibilities.some((possibility) => expected.test(possibility as string))\n}\n\nexport function isGreaterThanOrEqual(expected: number): Predicate {\n return (possibilities: Possibilities): boolean =>\n possibilities.some((possibility) => possibility >= expected)\n}\n\nexport function isLessThanOrEqual(expected: number): Predicate {\n return (possibilities: Possibilities): boolean =>\n possibilities.some((possibility) => possibility <= expected)\n}\n\nexport function olderThan(duration: number, unit: DurationUnit): Predicate {\n const day = 1000 * 3600 * 24\n const units: TimeUnit = {\n days: day,\n months: day * 30.4167,\n weeks: day * 7,\n years: day * 365,\n }\n if (Object.keys(units).indexOf(unit) === -1) {\n throw new Error(\n 'Casper Event Hub - predicate error - olderThan - unit ' +\n unit +\n ' is not one of ' +\n Object.keys(units).join(',')\n )\n }\n return (possibilities: Possibilities): boolean =>\n possibilities.some(\n (possibility) =>\n Date.now() >\n new Date(possibility as string).getTime() + units[unit] * duration\n )\n}\n\nexport class SubConditionIsFalse extends Error {}\ninterface TimeUnit {\n days: number\n months: number\n weeks: number\n years: number\n}\n","import { initDebug } from './debugMode'\nimport { IJourneyPage } from './journey'\nimport { IUnknownObject, StorageData, ParamExperience } from './types'\n\nexport const urlParamsStorageNamespace = 'casperEventHub-urlParams'\nconst experiencesSessionStorageNamespace = 'casperEventHub-experiences'\nexport const journeySessionStorageNamespace = 'casperEventHub-journey'\nlet pathname: string\nexport let pages: IJourneyPage[]\nexport let experiences: IExperiences\n\nexport function initStore(): void {\n pathname = window.document.location.pathname\n pages = readFromStorage(journeySessionStorageNamespace, []) as IJourneyPage[]\n storeEntryQueryParams()\n storeJourneyPage()\n experiences = readFromStorage(\n experiencesSessionStorageNamespace,\n {}\n ) as IExperiences\n Object.keys(experiences).forEach(\n (key) => (experiences[key].mismatched = false)\n )\n initDebug()\n}\n\nexport function clearStore(): void {\n window.sessionStorage.removeItem(journeySessionStorageNamespace)\n window.sessionStorage.removeItem(urlParamsStorageNamespace)\n window.sessionStorage.removeItem(experiencesSessionStorageNamespace)\n}\n\nexport default class ExperienceStore {\n public triggered = false\n public mismatched = false\n public name: string\n public noTracking: boolean \n private pageUrl = getStableHomePath(pathname)\n\n constructor(name: string, param?: ParamExperience) {\n this.noTracking = param?.noTracking as boolean\n if (experiences[name]) {\n const experience = experiences[name]\n if (experience.pageUrl === this.pageUrl) {\n this.name = experience.name\n this.triggered = experience.triggered\n // mismatched must remain at the per pageview level and class\n // prop won't be saved in experiences until next evaluate()\n experience.mismatched = false\n } else {\n this.name = name\n }\n } else {\n this.name = name\n this.save()\n }\n }\n public setTriggered(): void {\n this.triggered = true\n this.mismatched = false\n this.save()\n }\n public setMismatched(): void {\n this.mismatched = true\n this.save()\n }\n private save() {\n experiences[this.name] = this\n saveToStorage(experiencesSessionStorageNamespace, experiences)\n }\n}\n\nexport function getStableHomePath(path: string): string {\n path = path.substr(0, 7) === '/mosaic' ? path.substr(8) : path.substr(1)\n if (path.substr(-1) === '/') {\n path = path.slice(0, -1)\n }\n return (\n path +\n (path.length === (path.substr(0, 4) === 'pro/' ? 9 : 5) ? '/home' : '')\n )\n}\n\nfunction readFromStorage(\n namespace: string,\n defaultValue: IJourneyPage[] | IExperiences\n): IJourneyPage[] | IExperiences {\n const storage = window.sessionStorage.getItem(namespace)\n return storage\n ? (JSON.parse(storage) as IJourneyPage[] | IExperiences)\n : defaultValue\n}\n\nfunction storeJourneyPage() {\n pages.push({\n pageName:\n window[window.config.padl.namespace].dataLayer.page.page.pageInfo\n .pageName,\n time: 0,\n url: getStableHomePath(pathname),\n } as IJourneyPage)\n saveToStorage(journeySessionStorageNamespace, pages)\n}\n\nexport function storeEntryQueryParams(): void {\n const sessionParams = window.sessionStorage.getItem(urlParamsStorageNamespace)\n if (sessionParams === null) {\n const currentParams = readParams()\n window.sessionStorage.setItem(\n urlParamsStorageNamespace,\n JSON.stringify(currentParams)\n )\n }\n}\n\nexport function readParams(): IUnknownObject {\n if (window.location.search === '') {\n return {}\n }\n const queryParams = parseQueryString(window.location.search)\n if (window.location.hash !== '') {\n const hashParams = parseQueryString(window.location.hash)\n return { ...hashParams, ...queryParams }\n } else {\n return queryParams\n }\n}\n\nfunction parseQueryString(queryString: string | undefined): IUnknownObject {\n if (queryString == null) return {}\n return queryString\n .slice(1)\n .split('&')\n .map((p) => p.split('='))\n .reduce((obj, pair) => {\n const [key, value] = pair.map(decodeURIComponent)\n return { ...obj, [key]: value ? value : true }\n }, {})\n}\n\nexport interface IExperiences {\n [name: string]: ExperienceStore\n}\n\nexport function saveToStorage(namespace: string, data: StorageData): void {\n window.sessionStorage.setItem(namespace, JSON.stringify(data))\n}\n","import { debugMode } from './debugMode'\nimport { allOf, isObject, isPredicate, isString } from './predicates'\nimport { Conditions, Predicate, Possibilities } from './types'\n\nexport default class Rule {\n protected predicates: Predicate[] = []\n\n public addPredicates(conditions: Conditions): void {\n const primitiveConditions: Conditions = conditions.filter(\n (predicate) =>\n (isObject(predicate) && Object.keys(predicate).length) ||\n isString(predicate)\n )\n const functionConditions: Predicate[] = conditions.filter(isPredicate)\n if (primitiveConditions.length) {\n this.predicates.push(allOf(...primitiveConditions))\n }\n this.predicates.push(...functionConditions)\n }\n protected validate(possibilities: Possibilities): boolean {\n return this.predicates.every((predicate: Predicate) => {\n const isValid = predicate(possibilities)\n this.logDebug(\n 'Rule.validate() - possibilities : ' +\n JSON.stringify(possibilities) +\n ' - isValid : ' +\n isValid.toString()\n )\n return isValid\n })\n }\n get hasPredicates(): boolean {\n return this.predicates.length > 0\n }\n protected logDebug(message: string): void {\n debugMode && console.log('Casper Debug - ' + message)\n }\n}\n\nexport interface IRule {\n off?: () => Promise<void> | void\n getState: () => Promise<IRuleState> | IRuleState\n}\n\nexport interface IRuleState {\n isValid: boolean\n}\n","import { readParams } from './store'\n\nexport let debugMode = false\n\nexport function initDebug(): void {\n const params = readParams()\n if (params.debugCasper) {\n debugMode = true\n }\n}\n","import { journeySessionStorageNamespace, pages, saveToStorage } from './store'\n\nexport default class SessionTime {\n public static getInstance(): SessionTime {\n if (!SessionTime.instance) {\n SessionTime.allowInstanciation = true\n SessionTime.instance = new SessionTime()\n SessionTime.allowInstanciation = false\n }\n return SessionTime.instance\n }\n protected static instance: SessionTime\n protected static allowInstanciation = false\n protected timeEllapsedCallbacks: ITimeEllapsedCallback[] = []\n protected start = 0\n protected checkCallbackIntervalId?: number\n private checkCallbacksIntervalMs = 1000\n\n constructor() {\n if (!SessionTime.allowInstanciation) {\n throw new Error(\"can't use Singleton constructor, use getInstance\")\n }\n this.startTimer()\n window.addEventListener('beforeunload', () => {\n pages[pages.length - 1].time = this.timeInMilliseconds\n saveToStorage(journeySessionStorageNamespace, pages)\n })\n }\n\n get timeInMilliseconds(): number {\n return window.performance.now() - this.start\n }\n\n public addTimeEllapsedCallback(\n timeEllapsedCallback: ITimeEllapsedCallback\n ): void {\n timeEllapsedCallback.pending = true\n this.timeEllapsedCallbacks.push(timeEllapsedCallback)\n }\n\n public removeTimeEllapsedCallback(\n timeEllapsedCallback: ITimeEllapsedCallback\n ): void {\n this.timeEllapsedCallbacks.splice(\n this.timeEllapsedCallbacks.indexOf(timeEllapsedCallback),\n 1\n )\n }\n\n public startTimer(): void {\n if (!this.checkCallbackIntervalId) {\n this.checkCallbacksOnInterval()\n }\n this.start = window.performance.now()\n }\n\n private onTimePassed() {\n this.timeEllapsedCallbacks.forEach((timeEllapsedCallback) => {\n if (\n timeEllapsedCallback.pending &&\n timeEllapsedCallback.time <= this.timeInMilliseconds\n ) {\n timeEllapsedCallback.callback()\n timeEllapsedCallback.pending = false\n }\n })\n }\n\n private checkCallbacksOnInterval() {\n this.checkCallbackIntervalId = window.setInterval(\n () => this.onTimePassed(),\n this.checkCallbacksIntervalMs\n )\n }\n}\n\nexport interface ITimeEllapsedCallback {\n callback: () => void\n time: number\n pending?: boolean\n}\n","import Rule from './rule'\nimport { ITargetingRulesEvaluationResult } from './experience'\nimport { Possibilities, Conditions } from './types'\nimport { isString } from './predicates'\nimport { experiences } from './store'\nexport const casperMismatchEvent = 'casper-mismatch-'\n\nexport default class XpMismatches extends Rule {\n private callback: () => void\n private lastXpName: string | null = null\n private xpToWatch: string\n private boundListener: ((event: Event) => void) | null = null\n constructor(\n callback: () => Promise<ITargetingRulesEvaluationResult>,\n predicates: Conditions\n ) {\n super()\n this.callback = callback\n if (predicates.length !== 1) {\n throw new Error(\n 'Error - Casper - xpHasMismatched requires 1 argument but found ' +\n predicates.length.toString()\n )\n }\n if (!isString(predicates[0])) {\n throw new Error(\n 'Error - Casper - xpHasMismatched requires argument of type string'\n )\n }\n this.xpToWatch = predicates[0]\n if (experiences[this.xpToWatch] && experiences[this.xpToWatch].mismatched) {\n this.logDebug(\n 'mismatches(\"' +\n this.xpToWatch +\n '\") the targeted Experience has already mismatched'\n )\n this.lastXpName = this.xpToWatch\n } else {\n this.logDebug(\n 'mismatches(\"' +\n this.xpToWatch +\n '\") - the targeted Experience hasn\\'t already mismatched, listening'\n )\n try {\n this.boundListener = this.onXpMismatches.bind(this)\n document.addEventListener(\n casperMismatchEvent + this.xpToWatch,\n this.boundListener\n )\n } catch (e) {\n // prevent error\n }\n }\n }\n public getState(): XpMismatchState {\n const res: XpMismatchState = {\n isValid: this.validate(([this.lastXpName] as unknown) as Possibilities),\n }\n if (this.lastXpName !== null) {\n res.xpName = this.lastXpName\n }\n return res\n }\n private onXpMismatches(event: Event): void {\n this.lastXpName = (event as XPEvent).xpName\n this.logDebug(\n 'mismatches(\"' +\n this.xpToWatch +\n '\") - the targeted Experience just mismatched'\n )\n this.callback()\n }\n public off(): void {\n if (this.boundListener !== null) {\n document.removeEventListener(\n casperMismatchEvent + this.xpToWatch,\n this.boundListener\n )\n }\n }\n}\n\ninterface XpMismatchState {\n isValid: boolean\n xpName?: string\n}\n\nexport interface XPEvent extends Event {\n xpName: string\n}\n","// This rule is deprecated so will always return mismatch\n\nimport Rule, { IRule, IRuleState } from './rule'\n\nexport default class SalesForceAudience extends Rule implements IRule {\n public getState(): Promise<IRuleState> {\n const state: IRuleState = {\n isValid: false\n }\n return Promise.resolve(state)\n }\n}","// This rule is deprecated so will always return mismatch\n\nimport Rule, { IRuleState, IRule } from './rule'\n\nexport default class SalesForceAudiencePerso extends Rule implements IRule {\n public getState(): Promise<IRuleState> {\n const state: IRuleState = {\n isValid: false\n }\n return Promise.resolve(state)\n }\n}","import Basket from './basket'\nimport BasketTotal, { IBasketTotals } from './basketTotal'\nimport User from './user'\nimport { IProduct } from './eCapi'\nimport Journey, { IJourneyPage } from './journey'\nimport SalesForceAudience from './salesForceAudience'\nimport ExperienceStore from './store'\nimport {\n IUnknownObject,\n CustomerDetails,\n Conditions,\n ActiveExperiments,\n ParamExperience\n} from './types' \nimport UrlParameters from './urlParameters'\nimport DateRange from './dateRange'\nimport StandingOrders, { IStandingOrder } from './standingOrders'\nimport XpMismatches, { XPEvent, casperMismatchEvent } from './xpMismatches'\nimport SalesForceAudiencePerso from './salesforceAudiencePerso'\nimport { isObject } from './predicates'\nimport { debugMode } from './debugMode'\nimport Subscriptions, { MergedSubscriptions } from './subscriptions'\nimport Once from './once'\n\nexport default class Experience {\n public store: ExperienceStore\n public journey?: Promise<Journey> // visits // includes since?\n public user?: Promise<User> // visitorIs - \n public basketTotal?: Promise<BasketTotal> // basketTotalIs\n public basket?: Promise<Basket> // basketContains\n public salesForceAudience?: Promise<SalesForceAudience> // salesForceAudienceIs\n public salesForceAudiencePerso?: Promise<SalesForceAudiencePerso>\n public urlParameters?: Promise<UrlParameters> // urlParameterIs\n public dateRange?: Promise<DateRange> // isInDateRange\n public standingOrders?: Promise<StandingOrders> // standingOrdersContains\n public subscriptions?: Promise<Subscriptions> // subscriptionsContains\n public xpMistmatches?: Promise<XpMismatches> // mismatches\n public onceRule?: Promise<Once> // once\n private currentEvalReject: (() => void) | null = null\n private hasSimpleUserPredicate = false\n public currentRule: string[] = [] \n\n constructor(name: string, param?: ParamExperience) {\n this.store = new ExperienceStore(name, param)\n }\n private async doEval(\n eventData: ITargetingRulesEvaluationResult\n ): Promise<ITargetingRulesEvaluationResult> {\n return new Promise(async (resolve, reject) => {\n this.currentEvalReject = reject.bind(Promise)\n const tests = []\n if (this.user) {\n const userRule = await this.user\n if (userRule.hasPredicates) {\n const { isValid, user } = await userRule.getState()\n this.logDebug('visitorIs - isValid : ' + isValid.toString())\n this.currentRule.push('visitorIs')\n tests.push(isValid)\n eventData.user = user\n }\n }\n if (this.basketTotal) {\n const basketTotal = await this.basketTotal\n if (basketTotal.hasPredicates) {\n const { isValid, totals } = await basketTotal.getState()\n this.logDebug('basketTotalIs - isValid : ' + isValid.toString())\n this.currentRule.push('basketTotalIs')\n tests.push(isValid)\n eventData.totals = totals\n }\n }\n if (this.basket) {\n const basket = await this.basket\n if (basket.hasPredicates) {\n const { isValid, products } = await basket.getState()\n this.logDebug('basketContains - isValid : ' + isValid.toString())\n this.currentRule.push('basketContains')\n tests.push(isValid)\n eventData.products = products\n }\n }\n if (this.journey) {\n const journey = await this.journey\n if (journey.hasPredicates) {\n const { isValid, pages } = journey.getState()\n this.logDebug('visits/since - isValid : ' + isValid.toString())\n this.currentRule.push('visits')\n tests.push(isValid)\n eventData.pages = pages\n }\n }\n if (this.salesForceAudience) {\n const salesForceAudience = this.salesForceAudience\n if (salesForceAudience.hasPredicates) {\n const { isValid } = await salesForceAudience.getState()\n this.logDebug(\n 'salesForceAudienceIs - isValid : ' + isValid.toString()\n )\n this.currentRule.push('salesForceAudienceIs')\n tests.push(isValid)\n }\n }\n if (this.salesForceAudiencePerso) {\n const salesForceAudiencePerso = this.salesForceAudiencePerso\n if (salesForceAudiencePerso.hasPredicates) {\n const { isValid } = await salesForceAudiencePerso.getState()\n this.logDebug(\n 'salesForceAudiencePersoIs - isValid : ' + isValid.toString()\n )\n this.currentRule.push('salesForceAudiencePersoIs')\n tests.push(isValid)\n }\n }\n if (this.urlParameters) {\n const urlParameters = await this.urlParameters\n if (urlParameters.hasPredicates) {\n const { isValid, urlParams } = urlParameters.getState()\n this.logDebug('urlParameterIs - isValid : ' + isValid.toString())\n this.currentRule.push('urlParameterIs')\n tests.push(isValid)\n eventData.urlParams = urlParams\n }\n }\n if (this.dateRange) {\n const dateRange = await this.dateRange\n if (dateRange.hasPredicates) {\n const { isValid, date } = dateRange.getState()\n this.logDebug('isInDateRange - isValid : ' + isValid.toString())\n this.currentRule.push('isInDateRange')\n tests.push(isValid)\n eventData.date = date\n }\n }\n if (this.standingOrders) {\n const standingOrdersInstance = await this.standingOrders\n if (standingOrdersInstance.hasPredicates) {\n const {\n isValid,\n standingOrders,\n } = await standingOrdersInstance.getState()\n this.logDebug(\n 'standingOrdersContains - isValid : ' + isValid.toString()\n )\n this.currentRule.push('standingOrdersContains')\n tests.push(isValid)\n eventData.standingOrders = standingOrders\n }\n }\n if (this.subscriptions) {\n const subscriptionsInstance = await this.subscriptions\n if (subscriptionsInstance.hasPredicates) {\n const {\n isValid,\n subscriptions,\n } = await subscriptionsInstance.getState()\n this.logDebug(\n 'subscriptionsContains - isValid : ' + isValid.toString()\n )\n this.currentRule.push('subscriptionsContains')\n tests.push(isValid)\n eventData.subscriptions = subscriptions\n }\n }\n if (this.xpMistmatches) {\n const xpMistmatchesInstance = await this.xpMistmatches\n if (xpMistmatchesInstance.hasPredicates) {\n const { isValid, xpName } = xpMistmatchesInstance.getState()\n this.logDebug('mismtaches - isValid : ' + isValid.toString())\n this.currentRule.push('xpMistmatches')\n tests.push(isValid)\n eventData.xpName = xpName\n }\n }\n if (this.onceRule) {\n const onceRuleInstance = await this.onceRule\n const { isValid, xpName } = onceRuleInstance.getState()\n this.logDebug('once - isValid : ' + isValid.toString())\n this.currentRule.push('once')\n tests.push(isValid)\n eventData.xpName = xpName\n }\n if (tests.length) {\n eventData.allValid = tests.every((test) => test)\n }\n this.currentEvalReject = null\n resolve(eventData)\n })\n }\n private isSimpleUserExperience(): boolean {\n return (\n this.hasSimpleUserPredicate &&\n !this.basketTotal &&\n !this.basket &&\n !this.journey && // includes since\n !this.salesForceAudience &&\n !this.salesForceAudiencePerso &&\n !this.urlParameters &&\n !this.dateRange &&\n !this.standingOrders &&\n !this.xpMistmatches\n )\n }\n public async evaluate(): Promise<ITargetingRulesEvaluationResult> {\n if (this.currentEvalReject !== null) {\n this.currentEvalReject()\n }\n const eventData: ITargetingRulesEvaluationResult = {\n unsubscribe: this.unsubscribe.bind(this),\n }\n try {\n this.logDebug('evaluate()')\n const resolvedEventData = await this.doEval(eventData)\n if (resolvedEventData.allValid) {\n /*\n * https://dsu-confluence.nestle.biz/x/vhcNDw && DIGEX-10165 && DIGEX-12220\n Page builder loader has it's own event. So, with this check duplicate event is not being triggered\n * exclude object push to gtm if personalisation is triggerred from Page builder\n */\n if (!this.store?.noTracking) {\n this.trackCasper('true')\n }\n this.matchCallback(resolvedEventData)\n this.store.setTriggered()\n this.logDebug(\n 'doEval() allValid : ' + resolvedEventData.allValid.toString()\n )\n } else if (resolvedEventData.allValid !== undefined) {\n // DIGEX-12960 - don't push experience_match: false\n // if (!this.store?.noTracking) {\n // this.trackCasper('false')\n // }\n this.mismatchCallback(resolvedEventData)\n this.store.setMismatched()\n this.dispatchXpMismatch()\n this.logDebug(\n 'doEval() allValid : ' + resolvedEventData.allValid.toString()\n )\n }\n } catch {\n return eventData\n }\n\n return eventData\n }\n\n private trackCasper(match: string){\n window.gtmDataObject = window.gtmDataObject || []\n window.gtmDataObject.push({\n event: 'casper_experience',\n experience_name: this.store.name,\n experience_rule: this.currentRule.join(' | '),\n experience_match: match,\n event_raised_by: 'casper',\n })\n }\n\n private dispatchXpMismatch() {\n const casperEvent = document.createEvent('Event')\n casperEvent.initEvent(casperMismatchEvent + this.store.name, true, true)\n ;(casperEvent as XPEvent).xpName = this.store.name\n document.dispatchEvent(casperEvent)\n }\n\n public mismatches(...predicates: Conditions): this {\n this.xpMistmatches = import(\n /* webpackChunkName: \"XpMismatches\" */ './xpMismatches'\n ).then((XpMismatchesRule) => {\n const xpMistmatches = new XpMismatchesRule.default(\n (): Promise<ITargetingRulesEvaluationResult> => this.evaluate(),\n predicates\n )\n xpMistmatches.addPredicates(predicates)\n return xpMistmatches\n })\n return this\n }\n\n public standingOrdersContains(...orders: Conditions): this {\n this.standingOrders = import(\n /* webpackChunkName: \"StandingOrders\" */ './standingOrders'\n ).then((StandingOrdersRule) => {\n const standingOrders = new StandingOrdersRule.default()\n standingOrders.addPredicates(orders)\n return standingOrders\n })\n return this\n }\n\n public subscriptionsContains(...subscriptionsConditions: Conditions): this {\n this.subscriptions = import(\n /* webpackChunkName: \"Subscriptions\" */ './subscriptions'\n ).then((SubscriptionsRule) => {\n const subscriptions = new SubscriptionsRule.default()\n subscriptions.addPredicates(subscriptionsConditions)\n return subscriptions\n })\n return this\n }\n\n public isInDateRange(...dates: Conditions): this {\n this.dateRange = import(\n /* webpackChunkName: \"DateRange\" */ './dateRange'\n ).then((DateRangeRule) => {\n const dateRange = new DateRangeRule.default()\n dateRange.addPredicates(dates)\n return dateRange\n })\n return this\n }\n\n public urlParameterIs(...urlParams: Conditions): this {\n this.urlParameters = import(\n /* webpackChunkName: \"UrlParameters\" */ './urlParameters'\n ).then((UrlParametersRule) => {\n const urlParameters = new UrlParametersRule.default()\n urlParameters.addPredicates(urlParams)\n return urlParameters\n })\n return this\n }\n\n public salesForceAudienceIs(...segments: Conditions): this {\n this.salesForceAudience = new SalesForceAudience()\n this.salesForceAudience.addPredicates(segments)\n return this\n }\n\n public salesForceAudiencePersoIs(...segments: Conditions): this {\n this.salesForceAudiencePerso = new SalesForceAudiencePerso()\n this.salesForceAudiencePerso.addPredicates(segments)\n return this\n }\n \n public visitorIs(...predicates: Conditions): this {\n this.user = import(/* webpackChunkName: \"User\" */ './user').then(\n (UserRule) => {\n const user = new UserRule.default(\n (): Promise<ITargetingRulesEvaluationResult> => this.evaluate()\n )\n user.addPredicates(predicates)\n if (this.isSimpleUserPredicate(predicates)) {\n this.hasSimpleUserPredicate = true\n }\n\n return user\n }\n )\n return this\n }\n private isSimpleUserPredicate(predicates: Conditions): boolean {\n return (\n predicates.length === 1 &&\n isObject(predicates[0]) &&\n Object.keys(predicates[0]).length === 1 &&\n typeof predicates[0].status !== 'undefined'\n )\n }\n public basketTotalIs(...predicates: Conditions): this {\n this.basketTotal = import(\n /* webpackChunkName: \"BasketTotal\" */ './basketTotal'\n ).then((BasketTotalRule) => {\n const basketTotal = new BasketTotalRule.default(\n (): Promise<ITargetingRulesEvaluationResult> => this.evaluate()\n )\n basketTotal.addPredicates(predicates)\n return basketTotal\n })\n return this\n }\n public basketContains(...predicates: Conditions): this {\n this.basket = import(/* webpackChunkName: \"Basket\" */ './basket').then(\n (BasketRule) => {\n const basket = new BasketRule.default(\n (): Promise<ITargetingRulesEvaluationResult> => this.evaluate()\n )\n basket.addPredicates(predicates)\n return basket\n }\n )\n return this\n }\n public visits(...pagesUrls: string[]): this {\n const addExpectedJourney = (journey: Journey) =>\n journey.addExpectedJourney(pagesUrls)\n\n if (this.journey) {\n this.journey.then(addExpectedJourney, (e): void => {\n console.log(e)\n })\n } else {\n this.journey = importJourney().then((journey) => {\n addExpectedJourney(journey)\n return journey\n })\n }\n return this\n }\n public since(seconds: number): this {\n const addExpectedTime = (journey: Journey) =>\n journey.addExpectedTime(seconds, this.evaluate.bind(this))\n\n if (this.journey) {\n this.journey = this.journey.then((journey) => {\n addExpectedTime(journey)\n return journey\n })\n } else {\n this.journey = importJourney().then((journey) => {\n addExpectedTime(journey)\n return journey\n })\n }\n return this\n }\n public once(): this {\n this.onceRule = import(/* webpackChunkName: \"Once\" */ './once').then(\n (onceRule) => {\n const once = new onceRule.default(this.store.name)\n return once\n }\n )\n return this\n }\n public executeOnMatch(\n callback: (args: ITargetingRulesEvaluationResult) => void\n ): this {\n this.matchCallback = callback\n return this\n }\n public executeOnMismatch(\n callback: (args?: ITargetingRulesEvaluationResult) => void\n ): this {\n this.mismatchCallback = callback\n return this\n }\n public async unsubscribe(): Promise<void> {\n if (this.basketTotal) {\n ;(await this.basketTotal).off()\n delete this.basketTotal\n }\n if (this.user) {\n ;(await this.user).off()\n delete this.user\n }\n if (this.basket) {\n ;(await this.basket).off()\n delete this.basket\n }\n if (this.journey) {\n try {\n const journey: Journey = await this.journey\n journey.off()\n delete this.journey\n } catch (e) {\n throw new Error(e)\n }\n }\n if (this.xpMistmatches) {\n const xpMistmatches: XpMismatches = await this.xpMistmatches\n xpMistmatches.off()\n delete this.xpMistmatches\n }\n }\n\n private matchCallback: (args: ITargetingRulesEvaluationResult) => void = () => null\n\n private mismatchCallback: (args: ITargetingRulesEvaluationResult) => void = () => null\n\n public logDebug(message: string): void {\n debugMode &&\n console.log(\n 'Casper Debug - XP Name : ' + this.store.name + ' - ' + message\n )\n }\n}\n\nexport interface ITargetingRulesEvaluationResult {\n allValid?: boolean\n date?: Date | undefined\n unsubscribe: () => void\n user?: CustomerDetails\n totals?: IBasketTotals\n products?: IProduct[]\n pages?: IJourneyPage[]\n segments?: string[]\n persoSegments?: string[]\n urlParams?: IUnknownObject\n experiments?: ActiveExperiments\n standingOrders?: IStandingOrder[]\n subscriptions?: MergedSubscriptions[]\n xpName?: string\n}\n\nfunction importJourney() {\n return import(/* webpackChunkName: \"Journey\" */ './journey').then(\n (JourneyRule) => new JourneyRule.default()\n )\n}\n","import { initStore } from './store'\nimport SessionTime from './session-time'\n\ninitStore()\n\nSessionTime.getInstance()\n\nexport {\n allOf,\n oneOf,\n any,\n isGreaterThanOrEqual,\n isLessThanOrEqual,\n noneOf,\n olderThan,\n regex,\n} from './predicates'\n\nexport { default as Experience } from './experience'\n"],"sourceRoot":""}