diff --git a/CHANGELOG.md b/CHANGELOG.md index f6e4734..a007779 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Change Log All notable changes to this project will be documented in this file. +## [1.11.5] 30th Oct, 2024 +- Added support for personalisation in visual editor + ## [1.11.4] 24th Oct, 2024 - Fix for gender values. Have removed frontend validation diff --git a/clevertap.js b/clevertap.js index 0f21256..410ad88 100644 --- a/clevertap.js +++ b/clevertap.js @@ -4287,7 +4287,7 @@ if (formStyle.text !== undefined) { - element.innerText = formStyle.text; + element.innerText = isPreview ? formStyle.text.text : formStyle.text; } // Handle element onClick @@ -4353,7 +4353,7 @@ if (search === '?ctBuilderSDKCheck') { if (parentWindow) { - const sdkVersion = '1.11.4'; + const sdkVersion = '1.11.5'; parentWindow.postMessage({ message: 'SDKVersion', accountId, @@ -4378,7 +4378,9 @@ if (event.data.message === 'Dashboard') { var _event$data$variant, _event$data$details; - initialiseCTBuilder(event.data.url, (_event$data$variant = event.data.variant) !== null && _event$data$variant !== void 0 ? _event$data$variant : null, (_event$data$details = event.data.details) !== null && _event$data$details !== void 0 ? _event$data$details : {}); + // handle personalisation + window.evtMaster = event.data.personalisation.evtMaster; + initialiseCTBuilder(event.data.url, (_event$data$variant = event.data.variant) !== null && _event$data$variant !== void 0 ? _event$data$variant : null, (_event$data$details = event.data.details) !== null && _event$data$details !== void 0 ? _event$data$details : {}, event.data.personalisation); } else if (event.data.message === 'Overlay') { renderVisualBuilder(event.data, true); } @@ -4388,16 +4390,17 @@ * @param {string} url - The URL to initialize the builder. * @param {string} variant - The variant of the builder. * @param {Object} details - The details object. + * @param {Object} personalisation - The personalisation object */ - const initialiseCTBuilder = (url, variant, details) => { + const initialiseCTBuilder = (url, variant, details, personalisation) => { if (document.readyState === 'complete') { - onContentLoad(url, variant, details); + onContentLoad(url, variant, details, personalisation); } else { document.addEventListener('readystatechange', () => { if (document.readyState === 'complete') { - onContentLoad(url, variant, details); + onContentLoad(url, variant, details, personalisation); } }); } @@ -4410,7 +4413,7 @@ * Handles content load for Clevertap builder. */ - function onContentLoad(url, variant, details) { + function onContentLoad(url, variant, details, personalisation) { if (!contentLoaded) { if (window.Shopify) { isShopify = true; @@ -4426,7 +4429,7 @@ container.style.display = 'flex'; document.body.appendChild(container); const overlayPath = OVERLAY_PATH; - loadOverlayScript(overlayPath, url, variant, details).then(() => { + loadOverlayScript(overlayPath, url, variant, details, personalisation).then(() => { console.log('Overlay script loaded successfully.'); contentLoaded = true; }).catch(error => { @@ -4453,11 +4456,12 @@ * @param {string} url - The URL. * @param {string} variant - The variant. * @param {Object} details - The details object. + * @param {Object} personalisation * @returns {Promise} A promise. */ - function loadOverlayScript(overlayPath, url, variant, details) { + function loadOverlayScript(overlayPath, url, variant, details, personalisation) { return new Promise((resolve, reject) => { var script = document.createElement('script'); script.type = 'module'; @@ -4470,7 +4474,8 @@ url, variant, details, - isShopify + isShopify, + personalisation }); resolve(); } else { @@ -7367,7 +7372,7 @@ let proto = document.location.protocol; proto = proto.replace(':', ''); dataObject.af = { ...dataObject.af, - lib: 'web-sdk-v1.11.4', + lib: 'web-sdk-v1.11.5', protocol: proto, ...$ct.flutterVersion }; // app fields @@ -9037,7 +9042,7 @@ } getSDKVersion() { - return 'web-sdk-v1.11.4'; + return 'web-sdk-v1.11.5'; } defineVariable(name, defaultValue) { diff --git a/clevertap.js.map b/clevertap.js.map index 95efc38..fc31fe1 100644 --- a/clevertap.js.map +++ b/clevertap.js.map @@ -1 +1 @@ -{"version":3,"file":"clevertap.js","sources":["src/options.js","src/modules/account.js","src/util/constants.js","src/util/datatypes.js","src/util/datetime.js","src/util/storage.js","src/util/lruCache.js","src/modules/api.js","src/modules/device.js","src/util/messages.js","src/util/validator.js","src/modules/event.js","src/util/url.js","src/util/encoder.js","src/util/requestDispatcher.js","src/util/clevertap.js","src/modules/profile.js","src/modules/userLogin.js","src/util/web-popupImageonly/popupImageonly.js","src/modules/web-inbox/Message.js","src/modules/web-inbox/inboxStyles.js","src/modules/web-inbox/WebInbox.js","src/modules/web-inbox/helper.js","src/modules/visualBuilder/builder_constants.js","src/modules/visualBuilder/dataUpdate.js","src/modules/visualBuilder/pageBuilder.js","src/util/web-personalisation/banner.js","src/util/web-personalisation/carousel.js","src/util/campaignRender/nativeDisplay.js","src/util/campaignRender/utilities.js","src/util/campaignRender/webPopup.js","src/modules/webPushPrompt/promptStyles.js","src/modules/notification.js","src/modules/webPushPrompt/promptConstants.js","src/modules/webPushPrompt/prompt.js","src/util/tr.js","src/modules/user.js","src/modules/logger.js","src/modules/session.js","src/modules/request.js","src/modules/privacy.js","src/modules/variables/variable.js","src/modules/variables/variableStore.js","src/clevertap.js","src/main.js"],"sourcesContent":["export const TARGET_DOMAIN = 'clevertap-prod.com'\nexport const TARGET_PROTOCOL = 'https:'\nexport const DEFAULT_REGION = 'eu1'\n","import { DEFAULT_REGION, TARGET_DOMAIN, TARGET_PROTOCOL } from '../options'\n\nexport default class Account {\n #accountId\n #region = ''\n #targetDomain = TARGET_DOMAIN\n #dcSdkversion = ''\n #token = ''\n\n constructor ({ id } = {}, region = '', targetDomain = TARGET_DOMAIN, token = '') {\n this.id = id\n if (region) {\n this.region = region\n }\n if (targetDomain) {\n this.targetDomain = targetDomain\n }\n if (token) {\n this.token = token\n }\n }\n\n get id () {\n return this.#accountId\n }\n\n set id (accountId) {\n this.#accountId = accountId\n }\n\n get region () {\n return this.#region\n }\n\n set region (region) {\n this.#region = region\n }\n\n get dcSDKVersion () {\n return this.#dcSdkversion\n }\n\n set dcSDKVersion (dcSDKVersion) {\n this.#dcSdkversion = dcSDKVersion\n }\n\n get targetDomain () {\n return this.#targetDomain\n }\n\n set targetDomain (targetDomain) {\n this.#targetDomain = targetDomain\n }\n\n get token () {\n return this.#token\n }\n\n set token (token) {\n this.#token = token\n }\n\n get finalTargetDomain () {\n if (this.region) {\n return `${this.region}.${this.targetDomain}`\n } else {\n if (this.targetDomain === TARGET_DOMAIN) {\n return `${DEFAULT_REGION}.${this.targetDomain}`\n }\n return this.targetDomain\n }\n }\n\n get dataPostPEURL () {\n return `${TARGET_PROTOCOL}//${this.finalTargetDomain}/defineVars`\n }\n\n get dataPostURL () {\n return `${TARGET_PROTOCOL}//${this.finalTargetDomain}/a?t=96`\n }\n\n get recorderURL () {\n return `${TARGET_PROTOCOL}//${this.finalTargetDomain}/r?r=1`\n }\n\n get emailURL () {\n return `${TARGET_PROTOCOL}//${this.finalTargetDomain}/e?r=1`\n }\n}\n","export const unsupportedKeyCharRegex = new RegExp('^\\\\s+|\\\\\\.|\\:|\\\\\\$|\\'|\\\"|\\\\\\\\|\\\\s+$', 'g')\nexport const unsupportedValueCharRegex = new RegExp(\"^\\\\s+|\\'|\\\"|\\\\\\\\|\\\\s+$\", 'g')\nexport const doubleQuoteRegex = new RegExp('\\\"', 'g')\nexport const singleQuoteRegex = new RegExp('\\'', 'g')\nexport const CLEAR = 'clear'\nexport const CHARGED_ID = 'Charged ID'\nexport const CHARGEDID_COOKIE_NAME = 'WZRK_CHARGED_ID'\nexport const GCOOKIE_NAME = 'WZRK_G'\nexport const KCOOKIE_NAME = 'WZRK_K'\nexport const CAMP_COOKIE_NAME = 'WZRK_CAMP'\nexport const CAMP_COOKIE_G = 'WZRK_CAMP_G'// cookie for storing campaign details against guid\nexport const SCOOKIE_PREFIX = 'WZRK_S'\nexport const SCOOKIE_EXP_TIME_IN_SECS = 60 * 20 // 20 mins\nexport const EV_COOKIE = 'WZRK_EV'\nexport const META_COOKIE = 'WZRK_META'\nexport const PR_COOKIE = 'WZRK_PR'\nexport const ARP_COOKIE = 'WZRK_ARP'\nexport const LCOOKIE_NAME = 'WZRK_L'\nexport const NOTIF_COOKIE_NAME = 'WZRK_N'\nexport const GLOBAL = 'global' // used for email unsubscribe also\nexport const TOTAL_COUNT = 'tc'\nexport const DISPLAY = 'display'\nexport const UNDEFINED = 'undefined'\nexport const WEBPUSH_LS_KEY = 'WZRK_WPR'\nexport const OPTOUT_KEY = 'optOut'\nexport const CT_OPTOUT_KEY = 'ct_optout'\nexport const OPTOUT_COOKIE_ENDSWITH = ':OO'\nexport const USEIP_KEY = 'useIP'\nexport const LRU_CACHE = 'WZRK_X'\nexport const LRU_CACHE_SIZE = 100\nexport const IS_OUL = 'isOUL'\nexport const EVT_PUSH = 'push'\nexport const EVT_PING = 'ping'\nexport const COOKIE_EXPIRY = 86400 * 365 // 1 Year in seconds\nexport const MAX_TRIES = 200 // API tries\nexport const FIRST_PING_FREQ_IN_MILLIS = 2 * 60 * 1000 // 2 mins\nexport const CONTINUOUS_PING_FREQ_IN_MILLIS = 5 * 60 * 1000 // 5 mins\nexport const GROUP_SUBSCRIPTION_REQUEST_ID = '2'\nexport const categoryLongKey = 'cUsY'\nexport const WZRK_PREFIX = 'wzrk_'\nexport const WZRK_ID = 'wzrk_id'\nexport const NOTIFICATION_VIEWED = 'Notification Viewed'\nexport const NOTIFICATION_CLICKED = 'Notification Clicked'\nexport const FIRE_PUSH_UNREGISTERED = 'WZRK_FPU'\nexport const PUSH_SUBSCRIPTION_DATA = 'WZRK_PSD' // PUSH SUBSCRIPTION DATA FOR REGISTER/UNREGISTER TOKEN\nexport const COMMAND_INCREMENT = '$incr'\nexport const COMMAND_DECREMENT = '$decr'\nexport const COMMAND_SET = '$set'\nexport const COMMAND_ADD = '$add'\nexport const COMMAND_REMOVE = '$remove'\nexport const COMMAND_DELETE = '$delete'\nexport const WEBINBOX_CONFIG = 'WZRK_INBOX_CONFIG'\nexport const WEBINBOX = 'WZRK_INBOX'\nexport const MAX_INBOX_MSG = 15\nexport const VARIABLES = 'WZRK_PE'\nexport const PUSH_DELAY_MS = 1000\nexport const MAX_DELAY_FREQUENCY = 1000 * 60 * 10\nexport const WZRK_FETCH = 'wzrk_fetch'\nexport const WEBPUSH_CONFIG = 'WZRK_PUSH_CONFIG'\n\nexport const SYSTEM_EVENTS = [\n 'Stayed',\n 'UTM Visited',\n 'App Launched',\n 'Notification Sent',\n NOTIFICATION_VIEWED,\n NOTIFICATION_CLICKED\n]\n","import {\n unsupportedKeyCharRegex,\n unsupportedValueCharRegex\n} from './constants'\n\nexport const isString = (input) => {\n return (typeof input === 'string' || input instanceof String)\n}\n\nexport const isObject = (input) => {\n // TODO: refine\n return Object.prototype.toString.call(input) === '[object Object]'\n}\n\nexport const isDateObject = (input) => {\n return typeof (input) === 'object' && (input instanceof Date)\n}\n\nexport const isObjectEmpty = (obj) => {\n for (const prop in obj) {\n if (obj.hasOwnProperty(prop)) { return false }\n }\n return true\n}\n\nexport const isConvertibleToNumber = (n) => {\n return !isNaN(parseFloat(n)) && isFinite(n)\n}\n\nexport const isNumber = (n) => {\n return /^-?[\\d.]+(?:e-?\\d+)?$/.test(n) && typeof n === 'number'\n}\n\nexport const isValueValid = (value) => {\n if (value === null || value === undefined || value === 'undefined') {\n return false\n }\n return true\n}\n\nexport const arrayContains = (arr, obj) => {\n var i = arr.length\n while (i--) {\n if (arr[i] === obj) {\n return true\n }\n }\n return false\n}\n\nexport const removeUnsupportedChars = (o, logger) => {\n // keys can't be greater than 1024 chars, values can't be greater than 1024 chars\n if (typeof o === 'object') {\n for (const key in o) {\n if (o.hasOwnProperty(key)) {\n const sanitizedVal = removeUnsupportedChars(o[key], logger)\n let sanitizedKey\n sanitizedKey = sanitize(key, unsupportedKeyCharRegex)\n if (sanitizedKey.length > 1024) {\n sanitizedKey = sanitizedKey.substring(0, 1024)\n logger.reportError(520, sanitizedKey + '... length exceeded 1024 chars. Trimmed.')\n }\n delete o[key]\n o[sanitizedKey] = sanitizedVal\n }\n }\n } else {\n let val\n\n if (isString(o)) {\n val = sanitize(o, unsupportedValueCharRegex)\n if (val.length > 1024) {\n val = val.substring(0, 1024)\n logger.reportError(521, val + '... length exceeded 1024 chars. Trimmed.')\n }\n } else {\n val = o\n }\n return val\n }\n return o\n}\n\nexport const sanitize = (input, regex) => {\n return input.replace(regex, '')\n}\n","export const getToday = () => {\n const today = new Date()\n return today.getFullYear() + '' + today.getMonth() + '' + today.getDay()\n}\n\nexport const getNow = () => {\n return Math.floor((new Date()).getTime() / 1000)\n}\n\nexport const convertToWZRKDate = (dateObj) => {\n return ('$D_' + Math.round(dateObj.getTime() / 1000))\n}\n\nexport const setDate = (dt) => {\n // expecting yyyymmdd format either as a number or a string\n if (isDateValid(dt)) {\n return '$D_' + dt\n }\n}\n\nexport const isDateValid = (date) => {\n const matches = /^(\\d{4})(\\d{2})(\\d{2})$/.exec(date)\n if (matches == null) return false\n const d = matches[3]\n const m = matches[2] - 1\n const y = matches[1]\n const composedDate = new Date(y, m, d)\n // eslint-disable-next-line eqeqeq\n return composedDate.getDate() == d && composedDate.getMonth() == m && composedDate.getFullYear() == y\n}\n","import {\n GCOOKIE_NAME,\n META_COOKIE,\n KCOOKIE_NAME,\n LCOOKIE_NAME\n} from './constants'\nexport class StorageManager {\n static save (key, value) {\n if (!key || !value) {\n return false\n }\n if (this._isLocalStorageSupported()) {\n localStorage.setItem(key, typeof value === 'string' ? value : JSON.stringify(value))\n return true\n }\n }\n\n static read (key) {\n if (!key) {\n return false\n }\n let data = null\n if (this._isLocalStorageSupported()) {\n data = localStorage.getItem(key)\n }\n if (data != null) {\n try {\n data = JSON.parse(data)\n } catch (e) {}\n }\n return data\n }\n\n static remove (key) {\n if (!key) {\n return false\n }\n if (this._isLocalStorageSupported()) {\n localStorage.removeItem(key)\n return true\n }\n }\n\n static removeCookie (name, domain) {\n let cookieStr = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;'\n\n if (domain) {\n cookieStr = cookieStr + ' domain=' + domain + '; path=/'\n }\n\n document.cookie = cookieStr\n }\n\n static createCookie (name, value, seconds, domain) {\n let expires = ''\n let domainStr = ''\n if (seconds) {\n const date = new Date()\n date.setTime(date.getTime() + (seconds * 1000))\n\n expires = '; expires=' + date.toGMTString()\n }\n\n if (domain) {\n domainStr = '; domain=' + domain\n }\n\n value = encodeURIComponent(value)\n\n document.cookie = name + '=' + value + expires + domainStr + '; path=/'\n }\n\n static readCookie (name) {\n const nameEQ = name + '='\n const ca = document.cookie.split(';')\n for (let idx = 0; idx < ca.length; idx++) {\n let c = ca[idx]\n while (c.charAt(0) === ' ') {\n c = c.substring(1, c.length)\n }\n // eslint-disable-next-line eqeqeq\n if (c.indexOf(nameEQ) == 0) {\n return decodeURIComponent(c.substring(nameEQ.length, c.length))\n }\n }\n return null\n }\n\n static _isLocalStorageSupported () {\n return 'localStorage' in window && window.localStorage !== null && typeof window.localStorage.setItem === 'function'\n }\n\n static saveToLSorCookie (property, value) {\n if (value == null) {\n return\n }\n try {\n if (this._isLocalStorageSupported()) {\n this.save(property, encodeURIComponent(JSON.stringify(value)))\n } else {\n if (property === GCOOKIE_NAME) {\n this.createCookie(property, encodeURIComponent(value), 0, window.location.hostname)\n } else {\n this.createCookie(property, encodeURIComponent(JSON.stringify(value)), 0, window.location.hostname)\n }\n }\n $ct.globalCache[property] = value\n } catch (e) {}\n }\n\n static readFromLSorCookie (property) {\n let data\n if ($ct.globalCache.hasOwnProperty(property)) {\n return $ct.globalCache[property]\n }\n if (this._isLocalStorageSupported()) {\n data = this.read(property)\n } else {\n data = this.readCookie(property)\n }\n\n if (data !== null && data !== undefined && !(typeof data.trim === 'function' && data.trim() === '')) {\n let value\n try {\n value = JSON.parse(decodeURIComponent(data))\n } catch (err) {\n value = decodeURIComponent(data)\n }\n $ct.globalCache[property] = value\n return value\n }\n }\n\n static createBroadCookie (name, value, seconds, domain) {\n // sets cookie on the base domain. e.g. if domain is baz.foo.bar.com, set cookie on \".bar.com\"\n // To update an existing \"broad domain\" cookie, we need to know what domain it was actually set on.\n // since a retrieved cookie never tells which domain it was set on, we need to set another test cookie\n // to find out which \"broadest\" domain the cookie was set on. Then delete the test cookie, and use that domain\n // for updating the actual cookie.\n\n if (domain) {\n let broadDomain = $ct.broadDomain\n if (broadDomain == null) { // if we don't know the broadDomain yet, then find out\n const domainParts = domain.split('.')\n let testBroadDomain = ''\n for (let idx = domainParts.length - 1; idx >= 0; idx--) {\n if (idx === 0) {\n testBroadDomain = domainParts[idx] + testBroadDomain\n } else {\n testBroadDomain = '.' + domainParts[idx] + testBroadDomain\n }\n\n // only needed if the cookie already exists and needs to be updated. See note above.\n if (this.readCookie(name)) {\n // no guarantee that browser will delete cookie, hence create short lived cookies\n var testCookieName = 'test_' + name + idx\n this.createCookie(testCookieName, value, 10, testBroadDomain) // self-destruct after 10 seconds\n if (!this.readCookie(testCookieName)) { // if test cookie not set, then the actual cookie wouldn't have been set on this domain either.\n continue\n } else { // else if cookie set, then delete the test and the original cookie\n this.removeCookie(testCookieName, testBroadDomain)\n }\n }\n\n this.createCookie(name, value, seconds, testBroadDomain)\n const tempCookie = this.readCookie(name)\n // eslint-disable-next-line eqeqeq\n if (tempCookie == value) {\n broadDomain = testBroadDomain\n $ct.broadDomain = broadDomain\n break\n }\n }\n } else {\n this.createCookie(name, value, seconds, broadDomain)\n }\n } else {\n this.createCookie(name, value, seconds, domain)\n }\n }\n\n static getMetaProp (property) {\n const metaObj = this.readFromLSorCookie(META_COOKIE)\n if (metaObj != null) {\n return metaObj[property]\n }\n }\n\n static setMetaProp (property, value) {\n if (this._isLocalStorageSupported()) {\n let wzrkMetaObj = this.readFromLSorCookie(META_COOKIE)\n if (wzrkMetaObj == null) {\n wzrkMetaObj = {}\n }\n if (value === undefined) {\n delete wzrkMetaObj[property]\n } else {\n wzrkMetaObj[property] = value\n }\n this.saveToLSorCookie(META_COOKIE, wzrkMetaObj)\n }\n }\n\n static getAndClearMetaProp (property) {\n const value = this.getMetaProp(property)\n this.setMetaProp(property, undefined)\n return value\n }\n\n static setInstantDeleteFlagInK () {\n let k = this.readFromLSorCookie(KCOOKIE_NAME)\n if (k == null) {\n k = {}\n }\n k.flag = true\n this.saveToLSorCookie(KCOOKIE_NAME, k)\n }\n\n static backupEvent (data, reqNo, logger) {\n let backupArr = this.readFromLSorCookie(LCOOKIE_NAME)\n if (typeof backupArr === 'undefined') {\n backupArr = {}\n }\n backupArr[reqNo] = { q: data }\n this.saveToLSorCookie(LCOOKIE_NAME, backupArr)\n logger.debug(`stored in ${LCOOKIE_NAME} reqNo : ${reqNo} -> ${data}`)\n }\n\n static removeBackup (respNo, logger) {\n const backupMap = this.readFromLSorCookie(LCOOKIE_NAME)\n if (typeof backupMap !== 'undefined' && backupMap !== null && typeof backupMap[respNo] !== 'undefined') {\n logger.debug(`del event: ${respNo} data-> ${backupMap[respNo].q}`)\n delete backupMap[respNo]\n this.saveToLSorCookie(LCOOKIE_NAME, backupMap)\n }\n }\n}\n\nexport const $ct = {\n globalCache: {\n gcookie: null,\n REQ_N: 0,\n RESP_N: 0\n },\n LRU_CACHE: null,\n globalProfileMap: undefined,\n globalEventsMap: undefined,\n blockRequest: false,\n isOptInRequest: false,\n broadDomain: null,\n webPushEnabled: null,\n campaignDivMap: {},\n currentSessionId: null,\n wiz_counter: 0, // to keep track of number of times we load the body\n notifApi: {\n notifEnabledFromApi: false\n }, // helper variable to handle race condition and check when notifications were called\n unsubGroups: [],\n updatedCategoryLong: null,\n inbox: null,\n isPrivacyArrPushed: false,\n privacyArray: [],\n offline: false,\n location: null,\n dismissSpamControl: false,\n globalUnsubscribe: true,\n flutterVersion: null,\n variableStore: {},\n pushConfig: null\n // domain: window.location.hostname, url -> getHostName()\n // gcookie: -> device\n}\n","import { StorageManager } from './storage'\nimport { LRU_CACHE } from './constants'\n\nexport default class LRUCache {\n #keyOrder\n\n constructor (max) {\n this.max = max\n let lruCache = StorageManager.readFromLSorCookie(LRU_CACHE)\n if (lruCache) {\n const tempLruCache = {}\n this.#keyOrder = []\n lruCache = lruCache.cache\n for (const entry in lruCache) {\n if (lruCache.hasOwnProperty(entry)) {\n tempLruCache[lruCache[entry][0]] = lruCache[entry][1]\n this.#keyOrder.push(lruCache[entry][0])\n }\n }\n this.cache = tempLruCache\n } else {\n this.cache = {}\n this.#keyOrder = []\n }\n }\n\n get (key) {\n const item = this.cache[key]\n if (item) {\n this.cache = this.#deleteFromObject(key, this.cache)\n this.cache[key] = item\n this.#keyOrder.push(key)\n }\n this.saveCacheToLS(this.cache)\n return item\n }\n\n set (key, value) {\n const item = this.cache[key]\n const allKeys = this.#keyOrder\n if (item != null) {\n this.cache = this.#deleteFromObject(key, this.cache)\n } else if (allKeys.length === this.max) {\n this.cache = this.#deleteFromObject(allKeys[0], this.cache)\n }\n this.cache[key] = value\n if (this.#keyOrder[this.#keyOrder - 1] !== key) {\n this.#keyOrder.push(key)\n }\n this.saveCacheToLS(this.cache)\n }\n\n saveCacheToLS (cache) {\n const objToArray = []\n const allKeys = this.#keyOrder\n for (const index in allKeys) {\n if (allKeys.hasOwnProperty(index)) {\n const temp = []\n temp.push(allKeys[index])\n temp.push(cache[allKeys[index]])\n objToArray.push(temp)\n }\n }\n StorageManager.saveToLSorCookie(LRU_CACHE, { cache: objToArray })\n }\n\n getKey (value) {\n if (value === null) {\n return null\n }\n const allKeys = this.#keyOrder\n for (const index in allKeys) {\n if (allKeys.hasOwnProperty(index)) {\n if (this.cache[allKeys[index]] === value) {\n return allKeys[index]\n }\n }\n }\n return null\n }\n\n getSecondLastKey () {\n const keysArr = this.#keyOrder\n if (keysArr != null && keysArr.length > 1) {\n return keysArr[keysArr.length - 2]\n }\n return -1\n }\n\n getLastKey () {\n const keysLength = this.#keyOrder.length\n if (keysLength) {\n return this.#keyOrder[keysLength - 1]\n }\n }\n\n #deleteFromObject (key, obj) {\n const allKeys = JSON.parse(JSON.stringify(this.#keyOrder))\n const newCache = {}\n let indexToDelete\n for (const index in allKeys) {\n if (allKeys.hasOwnProperty(index)) {\n if (allKeys[index] !== key) {\n newCache[allKeys[index]] = obj[allKeys[index]]\n } else {\n indexToDelete = index\n }\n }\n }\n allKeys.splice(indexToDelete, 1)\n this.#keyOrder = JSON.parse(JSON.stringify(allKeys))\n return newCache\n }\n}\n","import { COOKIE_EXPIRY, FIRE_PUSH_UNREGISTERED, GCOOKIE_NAME, KCOOKIE_NAME, LRU_CACHE_SIZE, USEIP_KEY } from '../util/constants'\nimport { isValueValid } from '../util/datatypes'\nimport { getNow } from '../util/datetime'\nimport LRUCache from '../util/lruCache'\nimport { StorageManager, $ct } from '../util/storage'\n\nexport default class CleverTapAPI {\n #logger\n #request\n #device\n #session\n\n constructor ({ logger, request, device, session }) {\n this.#logger = logger\n this.#request = request\n this.#device = device\n this.#session = session\n }\n\n /**\n *\n * @param {string} global gcookie\n * @param {string} session\n * @param {boolean} resume sent true in case of an OUL request from client side, which is returned as it is by server\n * @param {number} respNumber the index of the request in backupmanager\n * @param {boolean} optOutResponse\n * @returns\n */\n\n s (global, session, resume, respNumber, optOutResponse) {\n let oulReq = false\n let newGuid = false\n\n // for a scenario when OUL request is true from client side\n // but resume is returned as false from server end\n // we maintan a OulReqN var in the window object\n // and compare with respNumber to determine the response of an OUL request\n if (window.isOULInProgress) {\n if (resume || (respNumber !== 'undefined' && respNumber === window.oulReqN)) {\n window.isOULInProgress = false\n oulReq = true\n }\n }\n\n // call back function used to store global and session ids for the user\n if (typeof respNumber === 'undefined') {\n respNumber = 0\n }\n\n StorageManager.removeBackup(respNumber, this.#logger)\n\n if (respNumber > $ct.globalCache.REQ_N) {\n // request for some other user so ignore\n return\n }\n\n if (!isValueValid(this.#device.gcookie)) {\n if (global) {\n newGuid = true\n }\n }\n\n if (!isValueValid(this.#device.gcookie) || resume || typeof optOutResponse === 'boolean') {\n const sessionObj = this.#session.getSessionCookieObject()\n\n /* If the received session is less than the session in the cookie,\n then don't update guid as it will be response for old request\n */\n if (window.isOULInProgress || (sessionObj.s && (session < sessionObj.s))) {\n return\n }\n this.#logger.debug(`Cookie was ${this.#device.gcookie} set to ${global}`)\n this.#device.gcookie = global\n if (!isValueValid(this.#device.gcookie)) {\n // clear useIP meta prop\n StorageManager.getAndClearMetaProp(USEIP_KEY)\n }\n if (global && StorageManager._isLocalStorageSupported()) {\n if ($ct.LRU_CACHE == null) {\n $ct.LRU_CACHE = new LRUCache(LRU_CACHE_SIZE)\n }\n\n const kIdFromLS = StorageManager.readFromLSorCookie(KCOOKIE_NAME)\n let guidFromLRUCache\n if (kIdFromLS != null && kIdFromLS.id) {\n guidFromLRUCache = $ct.LRU_CACHE.cache[kIdFromLS.id]\n if (resume) {\n if (!guidFromLRUCache) {\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, true)\n // replace login identity in OUL request\n // with the gcookie returned in exchange\n $ct.LRU_CACHE.set(kIdFromLS.id, global)\n }\n }\n }\n\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, global)\n // lastk provides the guid\n const lastK = $ct.LRU_CACHE.getSecondLastKey()\n if (StorageManager.readFromLSorCookie(FIRE_PUSH_UNREGISTERED) && lastK !== -1) {\n const lastGUID = $ct.LRU_CACHE.cache[lastK]\n // fire the request directly via fireRequest to unregister the token\n // then other requests with the updated guid should follow\n this.#request.unregisterTokenForGuid(lastGUID)\n }\n }\n StorageManager.createBroadCookie(GCOOKIE_NAME, global, COOKIE_EXPIRY, window.location.hostname)\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, global)\n }\n\n if (StorageManager._isLocalStorageSupported()) {\n this.#session.manageSession(session)\n }\n\n // session cookie\n const obj = this.#session.getSessionCookieObject()\n\n // for the race-condition where two responses come back with different session ids. don't write the older session id.\n if (typeof obj.s === 'undefined' || obj.s <= session) {\n obj.s = session\n obj.t = getNow() // time of last response from server\n this.#session.setSessionCookieObject(obj)\n }\n\n // set blockRequest to false only if the device has a valid gcookie\n if (isValueValid(this.#device.gcookie)) {\n $ct.blockRequest = false\n }\n\n // only process the backup events after an OUL request or a new guid is recieved\n if ((oulReq || newGuid) && !this.#request.processingBackup) {\n this.#request.processBackupEvents()\n }\n\n $ct.globalCache.RESP_N = respNumber\n }\n}\n","import { isValueValid } from '../util/datatypes'\nimport { StorageManager } from '../util/storage'\nimport { GCOOKIE_NAME, COOKIE_EXPIRY } from '../util/constants'\n\nexport default class DeviceManager {\n #logger\n gcookie\n\n constructor ({ logger }) {\n this.#logger = logger\n this.gcookie = this.getGuid()\n }\n\n getGuid () {\n let guid = null\n if (isValueValid(this.gcookie)) {\n return this.gcookie\n }\n if (StorageManager._isLocalStorageSupported()) {\n const value = StorageManager.read(GCOOKIE_NAME)\n if (isValueValid(value)) {\n try {\n guid = JSON.parse(decodeURIComponent(value))\n } catch (e) {\n this.#logger.debug('Cannot parse Gcookie from localstorage - must be encoded ' + value)\n // assumming guids are of size 32. supporting both formats.\n // guid can have encodedURIComponent or be without it.\n // 1.56e4078ed15749928c042479ec2b4d47 - breaks on JSON.parse(decodeURIComponent())\n // 2.%2256e4078ed15749928c042479ec2b4d47%22\n if (value.length === 32) {\n guid = value\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, value)\n } else {\n this.#logger.error('Illegal guid ' + value)\n }\n }\n\n // Persist to cookie storage if not present there.\n if (isValueValid(guid)) {\n StorageManager.createBroadCookie(GCOOKIE_NAME, guid, COOKIE_EXPIRY, window.location.hostname)\n }\n }\n }\n\n if (!isValueValid(guid)) {\n guid = StorageManager.readCookie(GCOOKIE_NAME)\n if (isValueValid(guid) && (guid.indexOf('%') === 0 || guid.indexOf('\\'') === 0 || guid.indexOf('\"') === 0)) {\n guid = null\n }\n if (isValueValid(guid)) {\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, guid)\n }\n }\n\n return guid\n }\n}\n","export const DATA_NOT_SENT_TEXT = 'This property has been ignored.'\nexport const INVALID_ACCOUNT = 'Invalid account ID'\nexport const INVALID_EVENT = 'Event structure not valid. Unable to process event'\nexport const CLEVERTAP_ERROR_PREFIX = 'CleverTap error:' // Formerly wzrk_error_txt\nexport const EMBED_ERROR = `${CLEVERTAP_ERROR_PREFIX} Incorrect embed script.`\nexport const EVENT_ERROR = `${CLEVERTAP_ERROR_PREFIX} Event structure not valid. ${DATA_NOT_SENT_TEXT}`\nexport const GENDER_ERROR = `${CLEVERTAP_ERROR_PREFIX} Gender value should one of the following: m,f,o,u,male,female,unknown,others (case insensitive). ${DATA_NOT_SENT_TEXT}`\nexport const EMPLOYED_ERROR = `${CLEVERTAP_ERROR_PREFIX} Employed value should be either Y or N. ${DATA_NOT_SENT_TEXT}`\nexport const MARRIED_ERROR = `${CLEVERTAP_ERROR_PREFIX} Married value should be either Y or N. ${DATA_NOT_SENT_TEXT}`\nexport const EDUCATION_ERROR = `${CLEVERTAP_ERROR_PREFIX} Education value should be either School, College or Graduate. ${DATA_NOT_SENT_TEXT}`\nexport const AGE_ERROR = `${CLEVERTAP_ERROR_PREFIX} Age value should be a number. ${DATA_NOT_SENT_TEXT}`\nexport const DOB_ERROR = `${CLEVERTAP_ERROR_PREFIX} DOB value should be a Date Object`\nexport const OBJECT_ARRAY_ERROR = `${CLEVERTAP_ERROR_PREFIX} Expecting Object array in profile`\nexport const DATE_FORMAT_ERROR = `${CLEVERTAP_ERROR_PREFIX} setDate(number). number should be formatted as yyyymmdd`\nexport const ENUM_FORMAT_ERROR = `${CLEVERTAP_ERROR_PREFIX} setEnum(value). value should be a string or a number`\nexport const PHONE_FORMAT_ERROR = `${CLEVERTAP_ERROR_PREFIX} Phone number should be formatted as +[country code][number]`\n","import { isObject, isDateObject, isString, isNumber } from './datatypes'\nimport { convertToWZRKDate } from './datetime'\nimport { CHARGED_ID, CHARGEDID_COOKIE_NAME } from './constants'\nimport { StorageManager } from './storage'\n\nlet _globalChargedId\n\nexport const isEventStructureFlat = (eventObj) => {\n // Events cannot have nested structure or Arrays\n if (isObject(eventObj)) {\n for (var key in eventObj) {\n if (eventObj.hasOwnProperty(key)) {\n if (isObject(eventObj[key]) || Array.isArray(eventObj[key])) {\n return false\n } else if (isDateObject(eventObj[key])) {\n eventObj[key] = convertToWZRKDate(eventObj[key])\n }\n }\n }\n return true\n }\n return false\n}\n\nexport const isChargedEventStructureValid = (chargedObj, logger) => {\n if (isObject(chargedObj)) {\n for (var key in chargedObj) {\n if (chargedObj.hasOwnProperty(key)) {\n if (key === 'Items') {\n if (!Array.isArray(chargedObj[key])) {\n return false\n }\n\n if (chargedObj[key].length > 50) {\n logger.reportError(522, 'Charged Items exceed 50 limit. Actual count: ' + chargedObj[key].length)\n }\n\n for (var itemKey in chargedObj[key]) {\n if (chargedObj[key].hasOwnProperty(itemKey)) { // since default array implementation could be overridden - e.g. Teabox site\n if (!isObject(chargedObj[key][itemKey]) || !isEventStructureFlat(chargedObj[key][itemKey])) {\n return false\n }\n }\n }\n } else {\n if (isObject(chargedObj[key]) || Array.isArray(chargedObj[key])) {\n return false\n } else if (isDateObject(chargedObj[key])) {\n chargedObj[key] = convertToWZRKDate(chargedObj[key])\n }\n }\n }\n }\n\n if (isString(chargedObj[CHARGED_ID]) || isNumber(chargedObj[CHARGED_ID])) {\n // save charged Id\n const chargedId = chargedObj[CHARGED_ID] + '' // casting chargedId to string\n\n if (typeof _globalChargedId === 'undefined') {\n _globalChargedId = StorageManager.readFromLSorCookie(CHARGEDID_COOKIE_NAME)\n }\n if (typeof _globalChargedId !== 'undefined' && _globalChargedId.trim() === chargedId.trim()) {\n // drop event- duplicate charged id\n logger.error('Duplicate charged Id - Dropped' + chargedObj)\n return false\n }\n _globalChargedId = chargedId\n StorageManager.saveToLSorCookie(CHARGEDID_COOKIE_NAME, chargedId)\n }\n return true\n } // if object (chargedObject)\n return false\n}\n","import { isString, isObject, sanitize } from '../util/datatypes'\nimport { EVENT_ERROR } from '../util/messages'\nimport { EV_COOKIE, SYSTEM_EVENTS, unsupportedKeyCharRegex } from '../util/constants'\nimport { isChargedEventStructureValid, isEventStructureFlat } from '../util/validator'\nimport { StorageManager, $ct } from '../util/storage'\n\nexport default class EventHandler extends Array {\n #logger\n #oldValues\n #request\n #isPersonalisationActive\n\n constructor ({ logger, request, isPersonalisationActive }, values) {\n super()\n this.#logger = logger\n this.#oldValues = values\n this.#request = request\n this.#isPersonalisationActive = isPersonalisationActive\n }\n\n push (...eventsArr) {\n this.#processEventArray(eventsArr)\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#processEventArray(this.#oldValues)\n }\n this.#oldValues = null\n }\n\n #processEventArray (eventsArr) {\n if (Array.isArray(eventsArr)) {\n while (eventsArr.length > 0) {\n var eventName = eventsArr.shift()\n if (!isString(eventName)) {\n this.#logger.error(EVENT_ERROR)\n continue\n }\n\n if (eventName.length > 1024) {\n eventName = eventName.substring(0, 1024)\n this.#logger.reportError(510, eventName + '... length exceeded 1024 chars. Trimmed.')\n }\n\n if (SYSTEM_EVENTS.includes(eventName)) {\n this.#logger.reportError(513, eventName + ' is a restricted system event. It cannot be used as an event name.')\n continue\n }\n\n const data = {}\n data.type = 'event'\n data.evtName = sanitize(eventName, unsupportedKeyCharRegex)\n\n if (eventsArr.length !== 0) {\n const eventObj = eventsArr.shift()\n if (!isObject(eventObj)) {\n // put it back if it is not an object\n eventsArr.unshift(eventObj)\n } else {\n // check Charged Event vs. other events.\n if (eventName === 'Charged') {\n if (!isChargedEventStructureValid(eventObj, this.#logger)) {\n this.#logger.reportError(511, 'Charged event structure invalid. Not sent.')\n continue\n }\n } else {\n if (!isEventStructureFlat(eventObj)) {\n this.#logger.reportError(512, eventName + ' event structure invalid. Not sent.')\n continue\n }\n }\n data.evtData = eventObj\n }\n }\n\n this.#request.processEvent(data)\n }\n }\n }\n\n getDetails (evtName) {\n if (!this.#isPersonalisationActive()) {\n return\n }\n if (typeof $ct.globalEventsMap === 'undefined') {\n $ct.globalEventsMap = StorageManager.readFromLSorCookie(EV_COOKIE)\n }\n if (typeof $ct.globalEventsMap === 'undefined') {\n return\n }\n const evtObj = $ct.globalEventsMap[evtName]\n const respObj = {}\n if (typeof evtObj !== 'undefined') {\n respObj.firstTime = new Date(evtObj[1] * 1000)\n respObj.lastTime = new Date(evtObj[2] * 1000)\n respObj.count = evtObj[0]\n return respObj\n }\n }\n}\n","export const getURLParams = (url) => {\n const urlParams = {}\n const idx = url.indexOf('?')\n\n if (idx > 1) {\n const uri = url.substring(idx + 1)\n let match\n const pl = /\\+/g // Regex for replacing addition symbol with a space\n const search = /([^&=]+)=?([^&]*)/g\n const decode = function (s) {\n let replacement = s.replace(pl, ' ')\n try {\n replacement = decodeURIComponent(replacement)\n } catch (e) {\n // eat\n }\n return replacement\n }\n match = search.exec(uri)\n while (match) {\n urlParams[decode(match[1])] = decode(match[2])\n match = search.exec(uri)\n }\n }\n return urlParams\n}\n\nexport const getDomain = (url) => {\n if (url === '') return ''\n var a = document.createElement('a')\n a.href = url\n return a.hostname\n}\n\nexport const addToURL = (url, k, v) => {\n return url + '&' + k + '=' + encodeURIComponent(v)\n}\n\nexport const getHostName = () => {\n return window.location.hostname\n}\n","/* eslint-disable */\nexport const urlBase64ToUint8Array = (base64String) => {\n let padding = '='.repeat((4 - base64String.length % 4) % 4)\n let base64 = (base64String + padding)\n .replace(/\\-/g, '+')\n .replace(/_/g, '/')\n\n let rawData = window.atob(base64)\n let processedData = []\n for (let i=0; i {\n logger && typeof logger.debug === 'function' && logger.debug('dobj:' + dataObject)\n return compressToBase64(dataObject)\n}\n\nexport const compress = (uncompressed) => {\n if (uncompressed == null) return ''\n let i, value,\n context_dictionary = {},\n context_dictionaryToCreate = {},\n context_c = '',\n context_wc = '',\n context_w = '',\n context_enlargeIn = 2, // Compensate for the first entry which should not count\n context_dictSize = 3,\n context_numBits = 2,\n context_data_string = '',\n context_data_val = 0,\n context_data_position = 0,\n ii,\n f = String.fromCharCode\n\n for (ii = 0; ii < uncompressed.length; ii += 1) {\n context_c = uncompressed.charAt(ii)\n if (!Object.prototype.hasOwnProperty.call(context_dictionary, context_c)) {\n context_dictionary[context_c] = context_dictSize++\n context_dictionaryToCreate[context_c] = true\n }\n\n context_wc = context_w + context_c\n if (Object.prototype.hasOwnProperty.call(context_dictionary, context_wc)) {\n context_w = context_wc\n } else {\n if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {\n if (context_w.charCodeAt(0) < 256) {\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n }\n value = context_w.charCodeAt(0)\n for (i = 0; i < 8; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n } else {\n value = 1\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1) | value\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = 0\n }\n value = context_w.charCodeAt(0)\n for (i = 0; i < 16; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n }\n context_enlargeIn--\n if (context_enlargeIn == 0) {\n context_enlargeIn = Math.pow(2, context_numBits)\n context_numBits++\n }\n delete context_dictionaryToCreate[context_w]\n } else {\n value = context_dictionary[context_w];\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0;\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n\n\n }\n context_enlargeIn--\n if (context_enlargeIn == 0) {\n context_enlargeIn = Math.pow(2, context_numBits)\n context_numBits++\n }\n // Add wc to the dictionary.\n context_dictionary[context_wc] = context_dictSize++\n context_w = String(context_c)\n }\n }\n\n // Output the code for w.\n if (context_w !== '') {\n if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {\n if (context_w.charCodeAt(0) < 256) {\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n }\n value = context_w.charCodeAt(0)\n for (i = 0; i < 8; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n } else {\n value = 1\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1) | value\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = 0\n }\n value = context_w.charCodeAt(0);\n for (i = 0; i < 16; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n }\n context_enlargeIn--\n if (context_enlargeIn == 0) {\n context_enlargeIn = Math.pow(2, context_numBits)\n context_numBits++\n }\n delete context_dictionaryToCreate[context_w]\n } else {\n value = context_dictionary[context_w]\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n\n\n }\n context_enlargeIn--\n if (context_enlargeIn == 0) {\n context_enlargeIn = Math.pow(2, context_numBits)\n context_numBits++\n }\n }\n\n // Mark the end of the stream\n value = 2\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n\n // Flush the last char\n while (true) {\n context_data_val = (context_data_val << 1)\n if (context_data_position == 15) {\n context_data_string += f(context_data_val)\n break\n } else context_data_position++\n }\n return context_data_string\n}\n\nexport const getKeyStr = () => {\n let key = ''\n let i = 0\n\n for (i = 0; i <= 25; i++) {\n key = key + String.fromCharCode(i + 65)\n }\n\n for (i = 0; i <= 25; i++) {\n key = key + String.fromCharCode(i + 97)\n }\n\n for (i = 0; i < 10; i++) {\n key = key + i\n }\n\n return key + '+/='\n}\n\nconst _keyStr = getKeyStr()\n\nexport const convertToFormattedHex = (byte_arr) => {\n let hex_str = '',\n i,\n len,\n tmp_hex\n\n if (!Array.isArray(byte_arr)) {\n return false\n }\n\n len = byte_arr.length\n\n for (i = 0; i < len; ++i) {\n if (byte_arr[i] < 0) {\n byte_arr[i] = byte_arr[i] + 256\n }\n if (byte_arr[i] === undefined) {\n byte_arr[i] = 0\n }\n tmp_hex = byte_arr[i].toString(16)\n\n if (tmp_hex.length == 1) tmp_hex = '0' + tmp_hex // Add leading zero.\n\n // beautification - needed if you're printing this in the console, else keep commented\n // if ((i + 1) % 16 === 0) {\n // tmp_hex += \"\\n\";\n // } else {\n // tmp_hex += \" \";\n // }\n\n hex_str += tmp_hex\n }\n\n return hex_str.trim()\n}\n\nexport const convertStringToHex = (s) => {\n let byte_arr = []\n for (let i = 0; i < s.length; i++) {\n let value = s.charCodeAt(i)\n byte_arr.push(value & 255)\n byte_arr.push((value >> 8) & 255)\n }\n return convertToFormattedHex(byte_arr)\n}\n\nexport const compressToBase64 = (input) => {\n if (input == null) return ''\n var output = ''\n var chr1, chr2, chr3, enc1, enc2, enc3, enc4\n var i = 0\n\n input = compress(input)\n\n while (i < input.length * 2) {\n\n if (i % 2 == 0) {\n chr1 = input.charCodeAt(i / 2) >> 8\n chr2 = input.charCodeAt(i / 2) & 255\n if (i / 2 + 1 < input.length)\n chr3 = input.charCodeAt(i / 2 + 1) >> 8\n else\n chr3 = NaN\n } else {\n chr1 = input.charCodeAt((i - 1) / 2) & 255\n if ((i + 1) / 2 < input.length) {\n chr2 = input.charCodeAt((i + 1) / 2) >> 8\n chr3 = input.charCodeAt((i + 1) / 2) & 255\n } else\n chr2 = chr3 = NaN\n }\n i += 3\n\n enc1 = chr1 >> 2;\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4)\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6)\n enc4 = chr3 & 63\n\n if (isNaN(chr2)) {\n enc3 = enc4 = 64\n } else if (isNaN(chr3)) {\n enc4 = 64\n }\n\n output = output +\n _keyStr.charAt(enc1) + _keyStr.charAt(enc2) +\n _keyStr.charAt(enc3) + _keyStr.charAt(enc4)\n\n }\n\n return output\n}\n","\nimport { ARP_COOKIE, MAX_TRIES, OPTOUT_COOKIE_ENDSWITH, USEIP_KEY, MAX_DELAY_FREQUENCY, PUSH_DELAY_MS, WZRK_FETCH } from './constants'\nimport { isString, isValueValid } from './datatypes'\nimport { compressData } from './encoder'\nimport { StorageManager, $ct } from './storage'\nimport { addToURL } from './url'\n\nexport default class RequestDispatcher {\n static logger\n static device\n static account\n networkRetryCount = 0\n minDelayFrequency = 0\n\n // ANCHOR - Requests get fired from here\n static #fireRequest (url, tries, skipARP, sendOULFlag, evtName) {\n if (this.#dropRequestDueToOptOut()) {\n this.logger.debug('req dropped due to optout cookie: ' + this.device.gcookie)\n return\n }\n\n // set a request in progress\n // so that if gcookie is not present, no other request can be made asynchronusly\n if (!isValueValid(this.device.gcookie)) {\n $ct.blockRequest = true\n }\n /**\n * if the gcookie is null\n * and the request is not the first request\n * and the tries are less than max tries\n * keep retrying\n */\n\n if (evtName && evtName === WZRK_FETCH) {\n // New retry mechanism\n if (!isValueValid(this.device.gcookie) && ($ct.globalCache.RESP_N < $ct.globalCache.REQ_N - 1)) {\n setTimeout(() => {\n this.logger.debug(`retrying fire request for url: ${url}, tries: ${this.networkRetryCount}`)\n this.#fireRequest(url, undefined, skipARP, sendOULFlag)\n }, this.getDelayFrequency())\n }\n } else {\n if (!isValueValid(this.device.gcookie) &&\n ($ct.globalCache.RESP_N < $ct.globalCache.REQ_N - 1) &&\n tries < MAX_TRIES) {\n // if ongoing First Request is in progress, initiate retry\n setTimeout(() => {\n this.logger.debug(`retrying fire request for url: ${url}, tries: ${tries}`)\n this.#fireRequest(url, tries + 1, skipARP, sendOULFlag)\n }, 50)\n return\n }\n }\n\n // set isOULInProgress to true\n // when sendOULFlag is set to true\n if (!sendOULFlag) {\n if (isValueValid(this.device.gcookie)) {\n // add gcookie to url\n url = addToURL(url, 'gc', this.device.gcookie)\n }\n url = this.#addARPToRequest(url, skipARP)\n } else {\n window.isOULInProgress = true\n }\n\n url = addToURL(url, 'tries', tries) // Add tries to URL\n\n url = this.#addUseIPToRequest(url)\n url = addToURL(url, 'r', new Date().getTime()) // add epoch to beat caching of the URL\n // TODO: Figure out a better way to handle plugin check\n if (window.clevertap?.hasOwnProperty('plugin') || window.wizrocket?.hasOwnProperty('plugin')) {\n // used to add plugin name in request parameter\n const plugin = window.clevertap.plugin || window.wizrocket.plugin\n url = addToURL(url, 'ct_pl', plugin)\n }\n if (url.indexOf('chrome-extension:') !== -1) {\n url = url.replace('chrome-extension:', 'https:')\n }\n // TODO: Try using Function constructor instead of appending script.\n var ctCbScripts = document.getElementsByClassName('ct-jp-cb')\n while (ctCbScripts[0] && ctCbScripts[0].parentNode) {\n ctCbScripts[0].parentNode.removeChild(ctCbScripts[0])\n }\n const s = document.createElement('script')\n s.setAttribute('type', 'text/javascript')\n s.setAttribute('src', url)\n s.setAttribute('class', 'ct-jp-cb')\n s.setAttribute('rel', 'nofollow')\n s.async = true\n document.getElementsByTagName('head')[0].appendChild(s)\n this.logger.debug('req snt -> url: ' + url)\n }\n\n /**\n *\n * @param {string} url\n * @param {*} skipARP\n * @param {boolean} sendOULFlag\n */\n static fireRequest (url, skipARP, sendOULFlag, evtName) {\n this.#fireRequest(url, 1, skipARP, sendOULFlag, evtName)\n }\n\n static #dropRequestDueToOptOut () {\n if ($ct.isOptInRequest || !isValueValid(this.device.gcookie) || !isString(this.device.gcookie)) {\n $ct.isOptInRequest = false\n return false\n }\n return this.device.gcookie.slice(-3) === OPTOUT_COOKIE_ENDSWITH\n }\n\n static #addUseIPToRequest (pageLoadUrl) {\n var useIP = StorageManager.getMetaProp(USEIP_KEY)\n if (typeof useIP !== 'boolean') {\n useIP = false\n }\n return addToURL(pageLoadUrl, USEIP_KEY, useIP ? 'true' : 'false')\n };\n\n static #addARPToRequest (url, skipResARP) {\n if (skipResARP === true) {\n const _arp = {}\n _arp.skipResARP = true\n return addToURL(url, 'arp', compressData(JSON.stringify(_arp), this.logger))\n }\n if (StorageManager._isLocalStorageSupported() && typeof localStorage.getItem(ARP_COOKIE) !== 'undefined' && localStorage.getItem(ARP_COOKIE) !== null) {\n return addToURL(url, 'arp', compressData(JSON.stringify(StorageManager.readFromLSorCookie(ARP_COOKIE)), this.logger))\n }\n return url\n }\n\n getDelayFrequency () {\n this.logger.debug('Network retry #' + this.networkRetryCount)\n\n // Retry with delay as 1s for first 10 retries\n if (this.networkRetryCount < 10) {\n this.logger.debug(this.account.id, 'Failure count is ' + this.networkRetryCount + '. Setting delay frequency to 1s')\n this.minDelayFrequency = PUSH_DELAY_MS // Reset minimum delay to 1s\n return this.minDelayFrequency\n }\n\n if (this.account.region == null) {\n // Retry with delay as 1s if region is null in case of eu1\n this.logger.debug(this.account.id, 'Setting delay frequency to 1s')\n return PUSH_DELAY_MS\n } else {\n // Retry with delay as minimum delay frequency and add random number of seconds to scatter traffic\n const randomDelay = (Math.floor(Math.random() * 10) + 1) * 1000\n this.minDelayFrequency += randomDelay\n if (this.minDelayFrequency < MAX_DELAY_FREQUENCY) {\n this.logger.debug(this.account.id, 'Setting delay frequency to ' + this.minDelayFrequency)\n return this.minDelayFrequency\n } else {\n this.minDelayFrequency = PUSH_DELAY_MS\n }\n this.logger.debug(this.account.id, 'Setting delay frequency to ' + this.minDelayFrequency)\n return this.minDelayFrequency\n }\n }\n}\n","// CleverTap specific utilities\n\nimport {\n StorageManager,\n $ct\n} from './storage'\nimport {\n CAMP_COOKIE_NAME,\n singleQuoteRegex,\n PR_COOKIE,\n ARP_COOKIE,\n GCOOKIE_NAME,\n IS_OUL,\n categoryLongKey,\n CAMP_COOKIE_G,\n GLOBAL\n} from './constants'\nimport {\n GENDER_ERROR,\n EMPLOYED_ERROR,\n MARRIED_ERROR,\n EDUCATION_ERROR,\n AGE_ERROR,\n DOB_ERROR,\n PHONE_FORMAT_ERROR,\n ENUM_FORMAT_ERROR\n} from './messages'\nimport {\n getToday,\n convertToWZRKDate,\n setDate,\n getNow\n} from './datetime'\nimport {\n isObject,\n isDateObject,\n isConvertibleToNumber,\n isObjectEmpty,\n isString,\n isNumber,\n isValueValid\n} from './datatypes'\n\nimport { addToURL, getURLParams } from './url'\nimport { compressData } from './encoder'\nimport RequestDispatcher from './requestDispatcher'\n\nexport const getCampaignObject = () => {\n let finalcampObj = {}\n if (StorageManager._isLocalStorageSupported()) {\n let campObj = StorageManager.read(CAMP_COOKIE_NAME)\n if (campObj != null) {\n campObj = JSON.parse(decodeURIComponent(campObj).replace(singleQuoteRegex, '\\\"'))\n if (campObj.hasOwnProperty('global')) {\n finalcampObj.wp = campObj\n } else {\n finalcampObj = campObj\n }\n } else {\n finalcampObj = {}\n }\n }\n return finalcampObj\n}\n\nexport const saveCampaignObject = (campaignObj) => {\n if (StorageManager._isLocalStorageSupported()) {\n const newObj = { ...getCampaignObject(), ...campaignObj }\n const campObj = JSON.stringify(newObj)\n StorageManager.save(CAMP_COOKIE_NAME, encodeURIComponent(campObj))\n // Update the CAMP_COOKIE_G to be in sync with CAMP_COOKIE_NAME\n setCampaignObjectForGuid()\n }\n}\n\n// set Campaign Object against the guid, with daily count and total count details\nexport const setCampaignObjectForGuid = () => {\n if (StorageManager._isLocalStorageSupported()) {\n let guid = StorageManager.read(GCOOKIE_NAME)\n if (isValueValid(guid)) {\n try {\n guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n const guidCampObj = StorageManager.read(CAMP_COOKIE_G) ? JSON.parse(decodeURIComponent(StorageManager.read(CAMP_COOKIE_G))) : {}\n if (guid && StorageManager._isLocalStorageSupported()) {\n var finalCampObj = {}\n var campObj = getCampaignObject()\n Object.keys(campObj).forEach(key => {\n const campKeyObj = (guid in guidCampObj && Object.keys(guidCampObj[guid]).length && guidCampObj[guid][key]) ? guidCampObj[guid][key] : {}\n const globalObj = campObj[key].global\n const today = getToday()\n const dailyObj = campObj[key][today]\n if (typeof globalObj !== 'undefined') {\n const campaignIdArray = Object.keys(globalObj)\n for (const index in campaignIdArray) {\n let resultObj = []\n if (campaignIdArray.hasOwnProperty(index)) {\n let dailyC = 0\n let totalC = 0\n const campaignId = campaignIdArray[index]\n if (campaignId === 'tc') {\n continue\n }\n if (typeof dailyObj !== 'undefined' && typeof dailyObj[campaignId] !== 'undefined') {\n dailyC = dailyObj[campaignId]\n }\n if (typeof globalObj !== 'undefined' && typeof globalObj[campaignId] !== 'undefined') {\n totalC = globalObj[campaignId]\n }\n resultObj = [campaignId, dailyC, totalC]\n campKeyObj[campaignId] = resultObj\n }\n }\n }\n finalCampObj = { ...finalCampObj, [key]: campKeyObj }\n })\n guidCampObj[guid] = finalCampObj\n StorageManager.save(CAMP_COOKIE_G, encodeURIComponent(JSON.stringify(guidCampObj)))\n }\n } catch (e) {\n console.error('Invalid clevertap Id ' + e)\n }\n }\n }\n}\nexport const getCampaignObjForLc = () => {\n // before preparing data to send to LC , check if the entry for the guid is already there in CAMP_COOKIE_G\n const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n\n let campObj = {}\n if (StorageManager._isLocalStorageSupported()) {\n let resultObj = {}\n campObj = getCampaignObject()\n const storageValue = StorageManager.read(CAMP_COOKIE_G)\n const decodedValue = storageValue ? decodeURIComponent(storageValue) : null\n const parsedValue = decodedValue ? JSON.parse(decodedValue) : null\n\n const resultObjWP = (!!guid &&\n storageValue !== undefined && storageValue !== null &&\n parsedValue && parsedValue[guid] && parsedValue[guid].wp)\n ? Object.values(parsedValue[guid].wp)\n : []\n\n const resultObjWI = (!!guid &&\n storageValue !== undefined && storageValue !== null &&\n parsedValue && parsedValue[guid] && parsedValue[guid].wi)\n ? Object.values(parsedValue[guid].wi)\n : []\n\n const today = getToday()\n let todayCwp = 0\n let todayCwi = 0\n if (campObj.wp && campObj.wp[today] && campObj.wp[today].tc !== 'undefined') {\n todayCwp = campObj.wp[today].tc\n }\n if (campObj.wi && campObj.wi[today] && campObj.wi[today].tc !== 'undefined') {\n todayCwi = campObj.wi[today].tc\n }\n resultObj = {\n wmp: todayCwp,\n wimp: todayCwi,\n tlc: resultObjWP,\n witlc: resultObjWI\n }\n return resultObj\n }\n}\n\nexport const isProfileValid = (profileObj, { logger }) => {\n let valid = false\n if (isObject(profileObj)) {\n for (const profileKey in profileObj) {\n if (profileObj.hasOwnProperty(profileKey)) {\n valid = true\n let profileVal = profileObj[profileKey]\n\n if (profileVal == null) {\n delete profileObj[profileKey]\n continue\n }\n if (profileKey === 'Gender' && !profileVal.match(/\\b(?:[mM](?:ale)?|[fF](?:emale)?|[oO](?:thers)?|[uU](?:nknown)?)\\b/)) {\n valid = false\n logger.error(GENDER_ERROR)\n }\n\n if (profileKey === 'Employed' && !profileVal.match(/^Y$|^N$/)) {\n valid = false\n logger.error(EMPLOYED_ERROR)\n }\n\n if (profileKey === 'Married' && !profileVal.match(/^Y$|^N$/)) {\n valid = false\n logger.error(MARRIED_ERROR)\n }\n\n if (profileKey === 'Education' && !profileVal.match(/^School$|^College$|^Graduate$/)) {\n valid = false\n logger.error(EDUCATION_ERROR)\n }\n\n if (profileKey === 'Age' && profileVal != null) {\n if (isConvertibleToNumber(profileVal)) {\n profileObj.Age = +profileVal\n } else {\n valid = false\n logger.error(AGE_ERROR)\n }\n }\n // dob will come in like this - $dt_19470815 or dateObject\n if (profileKey === 'DOB') {\n if (((!(/^\\$D_/).test(profileVal) || (profileVal + '').length !== 11)) && !isDateObject(profileVal)) {\n valid = false\n logger.error(DOB_ERROR)\n }\n\n if (isDateObject(profileVal)) {\n profileObj[profileKey] = convertToWZRKDate(profileVal)\n }\n } else if (isDateObject(profileVal)) {\n profileObj[profileKey] = convertToWZRKDate(profileVal)\n }\n\n if (profileKey === 'Phone' && !isObjectEmpty(profileVal)) {\n if (profileVal.length > 8 && (profileVal.charAt(0) === '+')) { // valid phone number\n profileVal = profileVal.substring(1, profileVal.length)\n if (isConvertibleToNumber(profileVal)) {\n profileObj.Phone = +profileVal\n } else {\n valid = false\n logger.error(PHONE_FORMAT_ERROR + '. Removed.')\n }\n } else {\n valid = false\n logger.error(PHONE_FORMAT_ERROR + '. Removed.')\n }\n }\n\n if (!valid) {\n delete profileObj[profileKey]\n }\n }\n }\n }\n return valid\n}\n\nexport const processFBUserObj = (user) => {\n const profileData = {}\n profileData.Name = user.name\n if (user.id != null) {\n profileData.FBID = user.id + ''\n }\n // Feb 2014 - FB announced over 58 gender options, hence we specifically look for male or female. Rest we don't care.\n if (user.gender === 'male') {\n profileData.Gender = 'M'\n } else if (user.gender === 'female') {\n profileData.Gender = 'F'\n } else {\n profileData.Gender = 'O'\n }\n\n const getHighestEducation = function (eduArr) {\n if (eduArr != null) {\n let college = ''\n let highschool = ''\n\n for (let i = 0; i < eduArr.length; i++) {\n const edu = eduArr[i]\n if (edu.type != null) {\n const type = edu.type\n if (type === 'Graduate School') {\n return 'Graduate'\n } else if (type === 'College') {\n college = '1'\n } else if (type === 'High School') {\n highschool = '1'\n }\n }\n }\n\n if (college === '1') {\n return 'College'\n } else if (highschool === '1') {\n return 'School'\n }\n }\n }\n\n if (user.relationship_status != null) {\n profileData.Married = 'N'\n if (user.relationship_status === 'Married') {\n profileData.Married = 'Y'\n }\n }\n\n const edu = getHighestEducation(user.education)\n if (edu != null) {\n profileData.Education = edu\n }\n\n const work = (user.work != null) ? user.work.length : 0\n if (work > 0) {\n profileData.Employed = 'Y'\n } else {\n profileData.Employed = 'N'\n }\n\n if (user.email != null) {\n profileData.Email = user.email\n }\n\n if (user.birthday != null) {\n const mmddyy = user.birthday.split('/') // comes in as \"08/15/1947\"\n profileData.DOB = setDate(mmddyy[2] + mmddyy[0] + mmddyy[1])\n }\n return profileData\n}\n\nexport const processGPlusUserObj = (user, { logger }) => {\n const profileData = {}\n if (user.displayName != null) {\n profileData.Name = user.displayName\n }\n if (user.id != null) {\n profileData.GPID = user.id + ''\n }\n\n if (user.gender != null) {\n if (user.gender === 'male') {\n profileData.Gender = 'M'\n } else if (user.gender === 'female') {\n profileData.Gender = 'F'\n } else if (user.gender === 'other') {\n profileData.Gender = 'O'\n }\n }\n\n if (user.image != null) {\n if (user.image.isDefault === false) {\n profileData.Photo = user.image.url.split('?sz')[0]\n }\n }\n\n if (user.emails != null) {\n for (let emailIdx = 0; emailIdx < user.emails.length; emailIdx++) {\n const emailObj = user.emails[emailIdx]\n if (emailObj.type === 'account') {\n profileData.Email = emailObj.value\n }\n }\n }\n\n if (user.organizations != null) {\n profileData.Employed = 'N'\n for (let i = 0; i < user.organizations.length; i++) {\n const orgObj = user.organizations[i]\n if (orgObj.type === 'work') {\n profileData.Employed = 'Y'\n }\n }\n }\n\n if (user.birthday != null) {\n const yyyymmdd = user.birthday.split('-') // comes in as \"1976-07-27\"\n profileData.DOB = setDate(yyyymmdd[0] + yyyymmdd[1] + yyyymmdd[2])\n }\n\n if (user.relationshipStatus != null) {\n profileData.Married = 'N'\n if (user.relationshipStatus === 'married') {\n profileData.Married = 'Y'\n }\n }\n logger.debug('gplus usr profile ' + JSON.stringify(profileData))\n\n return profileData\n}\n\nexport const addToLocalProfileMap = (profileObj, override) => {\n if (StorageManager._isLocalStorageSupported()) {\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE)\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = {}\n }\n }\n\n // Move props from custom bucket to outside.\n if (profileObj._custom != null) {\n const keys = profileObj._custom\n for (const key in keys) {\n if (keys.hasOwnProperty(key)) {\n profileObj[key] = keys[key]\n }\n }\n delete profileObj._custom\n }\n\n for (const prop in profileObj) {\n if (profileObj.hasOwnProperty(prop)) {\n if ($ct.globalProfileMap.hasOwnProperty(prop) && !override) {\n continue\n }\n $ct.globalProfileMap[prop] = profileObj[prop]\n }\n }\n if ($ct.globalProfileMap._custom != null) {\n delete $ct.globalProfileMap._custom\n }\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n }\n}\n\nexport const closeIframe = (campaignId, divIdIgnored, currentSessionId) => {\n if (campaignId != null && campaignId !== '-1') {\n if (StorageManager._isLocalStorageSupported()) {\n const campaignObj = getCampaignObject()\n\n let sessionCampaignObj = campaignObj.wp[currentSessionId]\n if (sessionCampaignObj == null) {\n sessionCampaignObj = {}\n campaignObj[currentSessionId] = sessionCampaignObj\n }\n sessionCampaignObj[campaignId] = 'dnd'\n saveCampaignObject(campaignObj)\n }\n }\n if ($ct.campaignDivMap != null) {\n const divId = $ct.campaignDivMap[campaignId]\n if (divId != null) {\n document.getElementById(divId).style.display = 'none'\n if (divId === 'intentPreview') {\n if (document.getElementById('intentOpacityDiv') != null) {\n document.getElementById('intentOpacityDiv').style.display = 'none'\n }\n } else if (divId === 'wizParDiv0') {\n if (document.getElementById('intentOpacityDiv0') != null) {\n document.getElementById('intentOpacityDiv0').style.display = 'none'\n }\n } else if (divId === 'wizParDiv2') {\n if (document.getElementById('intentOpacityDiv2') != null) {\n document.getElementById('intentOpacityDiv2').style.display = 'none'\n }\n }\n }\n }\n}\n\nexport const arp = (jsonMap) => {\n // For unregister calls dont set arp in LS\n if (jsonMap.skipResARP != null && jsonMap.skipResARP) {\n console.debug('Update ARP Request rejected', jsonMap)\n return null\n }\n\n const isOULARP = jsonMap[IS_OUL] === true\n\n if (StorageManager._isLocalStorageSupported()) {\n // Update arp only if it is null or an oul request\n try {\n let arpFromStorage = StorageManager.readFromLSorCookie(ARP_COOKIE)\n if (arpFromStorage == null || isOULARP) {\n arpFromStorage = {}\n for (const key in jsonMap) {\n if (jsonMap.hasOwnProperty(key)) {\n if (jsonMap[key] === -1) {\n delete arpFromStorage[key]\n } else {\n arpFromStorage[key] = jsonMap[key]\n }\n }\n }\n StorageManager.saveToLSorCookie(ARP_COOKIE, arpFromStorage)\n }\n } catch (e) {\n console.error('Unable to parse ARP JSON: ' + e)\n }\n }\n}\n\nexport const getWrappedLink = (link, targetId, type, request, account, logger) => {\n let data = {}\n data.sendTo = link\n data.targetId = targetId\n data.epoch = getNow()\n\n if (type != null) {\n data.type = type\n } else {\n data.type = 'view'\n }\n\n data = request.addSystemDataToObject(data, undefined)\n return addToURL(account.recorderURL, 'd', compressData(JSON.stringify(data), logger))\n}\n\nexport const getMessageTemplate = () => {\n return `
\n \n
\n
\n
[TITLE]
\n
\n
[TEXT]
\n
\n
\n
\n
\n
`\n}\n\nexport const getMessageHeadTemplate = () => {\n return `\n \n \n \n \n `\n}\n\nexport const setEnum = (enumVal, logger) => {\n if (isString(enumVal) || isNumber(enumVal)) {\n return '$E_' + enumVal\n }\n logger.error(ENUM_FORMAT_ERROR)\n}\nexport const handleEmailSubscription = (subscription, reEncoded, fetchGroups, account, logger) => {\n const urlParamsAsIs = getURLParams(location.href) // can't use url_params as it is in lowercase above\n const encodedEmailId = urlParamsAsIs.e\n const encodedProfileProps = urlParamsAsIs.p\n const pageType = urlParamsAsIs.page_type\n\n if (typeof encodedEmailId !== 'undefined') {\n const data = {}\n data.id = account.id // accountId\n data.unsubGroups = $ct.unsubGroups // unsubscribe groups\n\n if ($ct.updatedCategoryLong) {\n data[categoryLongKey] = $ct.updatedCategoryLong\n }\n\n let url = account.emailURL\n if (fetchGroups) {\n url = addToURL(url, 'fetchGroups', fetchGroups)\n }\n if (reEncoded) {\n url = addToURL(url, 'encoded', reEncoded)\n }\n url = addToURL(url, 'e', encodedEmailId)\n url = addToURL(url, 'd', compressData(JSON.stringify(data), logger))\n if (encodedProfileProps) {\n url = addToURL(url, 'p', encodedProfileProps)\n }\n\n if (subscription !== '-1') {\n url = addToURL(url, 'sub', subscription)\n }\n\n if (pageType) {\n $ct.globalUnsubscribe = pageType === GLOBAL\n url = addToURL(url, 'page_type', pageType)\n }\n RequestDispatcher.fireRequest(url)\n }\n}\n","import {\n isObjectEmpty\n} from '../util/datatypes'\nimport {\n isProfileValid,\n processFBUserObj,\n processGPlusUserObj,\n addToLocalProfileMap\n} from '../util/clevertap'\nimport {\n COMMAND_DELETE,\n COMMAND_INCREMENT,\n EVT_PUSH,\n PR_COOKIE\n} from '../util/constants'\nimport {\n addToURL\n} from '../util/url'\nimport {\n StorageManager,\n $ct\n} from '../util/storage'\nimport { compressData } from '../util/encoder'\nexport default class ProfileHandler extends Array {\n #logger\n #request\n #account\n #oldValues\n #isPersonalisationActive\n\n constructor ({\n logger,\n request,\n account,\n isPersonalisationActive\n }, values) {\n super()\n this.#logger = logger\n this.#request = request\n this.#account = account\n this.#oldValues = values\n this.#isPersonalisationActive = isPersonalisationActive\n }\n\n push (...profilesArr) {\n this.#processProfileArray(profilesArr)\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#processProfileArray(this.#oldValues)\n }\n this.#oldValues = null\n }\n\n getAttribute (propName) {\n if (!this.#isPersonalisationActive()) {\n return\n }\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE)\n }\n if ($ct.globalProfileMap != null) {\n return $ct.globalProfileMap[propName]\n }\n }\n\n #processProfileArray (profileArr) {\n if (Array.isArray(profileArr) && profileArr.length > 0) {\n for (const index in profileArr) {\n if (profileArr.hasOwnProperty(index)) {\n const outerObj = profileArr[index]\n let data = {}\n let profileObj\n if (outerObj.Site != null) { // organic data from the site\n profileObj = outerObj.Site\n if (isObjectEmpty(profileObj) || !isProfileValid(profileObj, {\n logger: this.#logger\n })) {\n return\n }\n } else if (outerObj.Facebook != null) { // fb connect data\n const FbProfileObj = outerObj.Facebook\n // make sure that the object contains any data at all\n\n if (!isObjectEmpty(FbProfileObj) && (!FbProfileObj.error)) {\n profileObj = processFBUserObj(FbProfileObj)\n }\n } else if (outerObj['Google Plus'] != null) {\n const GPlusProfileObj = outerObj['Google Plus']\n if (!isObjectEmpty(GPlusProfileObj) && (!GPlusProfileObj.error)) {\n profileObj = processGPlusUserObj(GPlusProfileObj, { logger: this.#logger })\n }\n }\n if (profileObj != null && (!isObjectEmpty(profileObj))) { // profile got set from above\n data.type = 'profile'\n if (profileObj.tz == null) {\n // try to auto capture user timezone if not present\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n\n data.profile = profileObj\n addToLocalProfileMap(profileObj, true)\n data = this.#request.addSystemDataToObject(data, undefined)\n\n this.#request.addFlags(data)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n }\n }\n }\n }\n\n /**\n *\n * @param {any} key\n * @param {number} value\n * @param {string} command\n * increases or decreases value of the number type properties in profile object\n */\n _handleIncrementDecrementValue (key, value, command) {\n // Check if the value is greater than 0\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE)\n }\n if ($ct.globalProfileMap == null && !$ct.globalProfileMap?.hasOwnProperty(key)) {\n // Check if the profile map already has the propery defined\n console.error('Kindly create profile with required proprty to increment/decrement.')\n } else if (!value || typeof value !== 'number' || value <= 0) {\n console.error('Value should be a number greater than 0')\n } else {\n // Update the profile property in local storage\n if (command === COMMAND_INCREMENT) {\n $ct.globalProfileMap[key] = $ct.globalProfileMap[key] + value\n } else {\n $ct.globalProfileMap[key] = $ct.globalProfileMap[key] - value\n }\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n\n // Send the updated value to LC\n let data = {}\n const profileObj = {}\n data.type = 'profile'\n profileObj[key] = { [command]: value }\n if (profileObj.tz == null) {\n // try to auto capture user timezone if not present\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n data.profile = profileObj\n data = this.#request.addSystemDataToObject(data, true)\n\n this.#request.addFlags(data)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n }\n\n /**\n *\n * @param {any} key\n * @param {array} arrayVal\n * @param {string} command\n * overwrites/sets new value(s) against a key/property in profile object\n */\n _handleMultiValueSet (key, arrayVal, command) {\n const array = []\n for (let i = 0; i < arrayVal.length; i++) {\n if (typeof arrayVal[i] === 'number' && !array.includes(arrayVal[i])) {\n array.push(arrayVal[i])\n } else if (typeof arrayVal[i] === 'string' && !array.includes(arrayVal[i].toLowerCase())) {\n array.push(arrayVal[i].toLowerCase())\n } else {\n console.error('array supports only string or number type values')\n }\n }\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE) ?? {}\n }\n $ct.globalProfileMap[key] = array\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n this.sendMultiValueData(key, arrayVal, command)\n }\n\n /**\n *\n * @param {any} propKey - the property name to be added in the profile object\n * @param {string, number, array} propVal - the property value to be added against the @propkey key\n * @param {string} command\n * Adds array or single value against a key/property in profile object\n */\n _handleMultiValueAdd (propKey, propVal, command) {\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE) || {}\n }\n\n const existingValue = $ct.globalProfileMap[propKey]\n const array = Array.isArray(existingValue) ? existingValue : (existingValue != null ? [existingValue] : [])\n\n const addValue = (value) => {\n const normalizedValue = typeof value === 'number' ? value : value.toLowerCase()\n if (!array.includes(normalizedValue)) {\n array.push(normalizedValue)\n }\n }\n\n if (Array.isArray(propVal)) {\n propVal.forEach(value => {\n if (typeof value === 'string' || typeof value === 'number') {\n addValue(value)\n } else {\n this.#logger.error('Array supports only string or number type values')\n }\n })\n } else if (typeof propVal === 'string' || typeof propVal === 'number') {\n addValue(propVal)\n } else {\n this.#logger.error('Unsupported value type')\n return\n }\n\n $ct.globalProfileMap[propKey] = array\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n this.sendMultiValueData(propKey, propVal, command)\n }\n\n /**\n *\n * @param {any} propKey\n * @param {string, number, array} propVal\n * @param {string} command\n * removes value(s) against a key/property in profile object\n */\n _handleMultiValueRemove (propKey, propVal, command) {\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE) || {}\n }\n\n if (!$ct.globalProfileMap.hasOwnProperty(propKey)) {\n this.#logger.error(`The property ${propKey} does not exist.`)\n return\n }\n\n const removeValue = (value) => {\n const index = $ct.globalProfileMap[propKey].indexOf(value)\n if (index !== -1) {\n $ct.globalProfileMap[propKey].splice(index, 1)\n }\n }\n\n if (Array.isArray(propVal)) {\n propVal.forEach(removeValue)\n } else if (typeof propVal === 'string' || typeof propVal === 'number') {\n removeValue(propVal)\n } else {\n this.#logger.error('Unsupported propVal type')\n return\n }\n\n // Remove the key if the array is empty\n if ($ct.globalProfileMap[propKey].length === 0) {\n delete $ct.globalProfileMap[propKey]\n }\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n this.sendMultiValueData(propKey, propVal, command)\n }\n\n /**\n *\n * @param {any} propKey\n * @param {string} command\n * deletes a key value pair from the profile object\n */\n _handleMultiValueDelete (propKey, command) {\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE)\n }\n if (!$ct?.globalProfileMap?.hasOwnProperty(propKey)) {\n this.#logger.error(`The property ${propKey} does not exist.`)\n } else {\n delete $ct.globalProfileMap[propKey]\n }\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n this.sendMultiValueData(propKey, null, command)\n }\n\n sendMultiValueData (propKey, propVal, command) {\n // Send the updated value to LC\n let data = {}\n const profileObj = {}\n data.type = 'profile'\n\n // this removes the property at backend\n profileObj[propKey] = { [command]: command === COMMAND_DELETE ? true : propVal }\n if (profileObj.tz == null) {\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n data.profile = profileObj\n data = this.#request.addSystemDataToObject(data, true)\n this.#request.addFlags(data)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n}\n","import {\n isObject,\n isObjectEmpty\n} from '../util/datatypes'\nimport {\n KCOOKIE_NAME,\n GCOOKIE_NAME,\n EVT_PUSH,\n LRU_CACHE_SIZE,\n IS_OUL,\n CAMP_COOKIE_NAME,\n CHARGEDID_COOKIE_NAME,\n PR_COOKIE,\n EV_COOKIE,\n ARP_COOKIE,\n CLEAR,\n META_COOKIE,\n FIRE_PUSH_UNREGISTERED\n} from '../util/constants'\nimport {\n StorageManager,\n $ct\n} from '../util/storage'\nimport LRUCache from '../util/lruCache'\nimport {\n compressData\n} from '../util/encoder'\nimport {\n addToURL,\n getHostName\n} from '../util/url'\nimport {\n isProfileValid,\n processFBUserObj,\n processGPlusUserObj,\n addToLocalProfileMap\n} from '../util/clevertap'\n\nexport default class UserLoginHandler extends Array {\n #request\n #logger\n #account\n #session\n #oldValues\n #device\n\n constructor ({\n request,\n account,\n session,\n logger,\n device\n },\n values) {\n super()\n this.#request = request\n this.#account = account\n this.#session = session\n this.#logger = logger\n this.#oldValues = values\n this.#device = device\n }\n\n // On User Login\n #processOUL (profileArr) {\n let sendOULFlag = true\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, sendOULFlag)\n const addToK = (ids) => {\n let k = StorageManager.readFromLSorCookie(KCOOKIE_NAME)\n const g = StorageManager.readFromLSorCookie(GCOOKIE_NAME)\n let kId\n if (k == null) {\n k = {}\n kId = ids\n } else {\n /* check if already exists */\n kId = k.id\n let anonymousUser = false\n let foundInCache = false\n if (kId == null) {\n kId = ids[0]\n anonymousUser = true\n }\n if ($ct.LRU_CACHE == null && StorageManager._isLocalStorageSupported()) {\n $ct.LRU_CACHE = new LRUCache(LRU_CACHE_SIZE)\n }\n\n if (anonymousUser) {\n if ((g) != null) {\n // if have gcookie\n $ct.LRU_CACHE.set(kId, g)\n $ct.blockRequest = false\n }\n } else {\n // check if the id is present in the cache\n // set foundInCache to true\n for (const idx in ids) {\n if (ids.hasOwnProperty(idx)) {\n const id = ids[idx]\n if ($ct.LRU_CACHE.cache[id]) {\n kId = id\n foundInCache = true\n break\n }\n }\n }\n }\n\n if (foundInCache) {\n if (kId !== $ct.LRU_CACHE.getLastKey()) {\n // New User found\n // remove the entire cache\n this.#handleCookieFromCache()\n } else {\n sendOULFlag = false\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, sendOULFlag)\n }\n const gFromCache = $ct.LRU_CACHE.get(kId)\n $ct.LRU_CACHE.set(kId, gFromCache)\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, gFromCache)\n this.#device.gcookie = gFromCache\n\n const lastK = $ct.LRU_CACHE.getSecondLastKey()\n if (StorageManager.readFromLSorCookie(FIRE_PUSH_UNREGISTERED) && lastK !== -1) {\n // CACHED OLD USER FOUND. TRANSFER PUSH TOKEN TO THIS USER\n const lastGUID = $ct.LRU_CACHE.cache[lastK]\n this.#request.unregisterTokenForGuid(lastGUID)\n }\n } else {\n if (!anonymousUser) {\n this.clear()\n } else {\n if ((g) != null) {\n this.#device.gcookie = g\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, g)\n sendOULFlag = false\n }\n }\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, false)\n kId = ids[0]\n }\n }\n k.id = kId\n StorageManager.saveToLSorCookie(KCOOKIE_NAME, k)\n }\n\n if (Array.isArray(profileArr) && profileArr.length > 0) {\n for (const index in profileArr) {\n if (profileArr.hasOwnProperty(index)) {\n const outerObj = profileArr[index]\n let data = {}\n let profileObj\n if (outerObj.Site != null) { // organic data from the site\n profileObj = outerObj.Site\n if (isObjectEmpty(profileObj) || !isProfileValid(profileObj, {\n logger: this.#logger\n })) {\n return\n }\n } else if (outerObj.Facebook != null) { // fb connect data\n const FbProfileObj = outerObj.Facebook\n // make sure that the object contains any data at all\n\n if (!isObjectEmpty(FbProfileObj) && (!FbProfileObj.error)) {\n profileObj = processFBUserObj(FbProfileObj)\n }\n } else if (outerObj['Google Plus'] != null) {\n const GPlusProfileObj = outerObj['Google Plus']\n if (isObjectEmpty(GPlusProfileObj) && (!GPlusProfileObj.error)) {\n profileObj = processGPlusUserObj(GPlusProfileObj, { logger: this.#logger })\n }\n }\n if (profileObj != null && (!isObjectEmpty(profileObj))) { // profile got set from above\n data.type = 'profile'\n if (profileObj.tz == null) {\n // try to auto capture user timezone if not present\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n\n data.profile = profileObj\n const ids = []\n if (StorageManager._isLocalStorageSupported()) {\n if (profileObj.Identity) {\n ids.push(profileObj.Identity)\n }\n if (profileObj.Email) {\n ids.push(profileObj.Email)\n }\n if (profileObj.GPID) {\n ids.push('GP:' + profileObj.GPID)\n }\n if (profileObj.FBID) {\n ids.push('FB:' + profileObj.FBID)\n }\n if (ids.length > 0) {\n addToK(ids)\n }\n }\n addToLocalProfileMap(profileObj, true)\n data = this.#request.addSystemDataToObject(data, undefined)\n\n this.#request.addFlags(data)\n // Adding 'isOUL' flag in true for OUL cases which.\n // This flag tells LC to create a new arp object.\n // Also we will receive the same flag in response arp which tells to delete existing arp object.\n if (sendOULFlag) {\n data[IS_OUL] = true\n }\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n // Whenever sendOULFlag is true then dont send arp and gcookie (guid in memory in the request)\n // Also when this flag is set we will get another flag from LC in arp which tells us to delete arp\n // stored in the cache and replace it with the response arp.\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest, sendOULFlag)\n }\n }\n }\n }\n }\n\n clear () {\n this.#logger.debug('clear called. Reset flag has been set.')\n this.#deleteUser()\n StorageManager.setMetaProp(CLEAR, true)\n }\n\n #handleCookieFromCache () {\n $ct.blockRequest = false\n console.debug('Block request is false')\n if (StorageManager._isLocalStorageSupported()) {\n delete localStorage[PR_COOKIE]\n delete localStorage[EV_COOKIE]\n delete localStorage[META_COOKIE]\n delete localStorage[ARP_COOKIE]\n delete localStorage[CAMP_COOKIE_NAME]\n delete localStorage[CHARGEDID_COOKIE_NAME]\n }\n StorageManager.removeCookie(CAMP_COOKIE_NAME, getHostName())\n StorageManager.removeCookie(this.#session.cookieName, $ct.broadDomain)\n StorageManager.removeCookie(ARP_COOKIE, $ct.broadDomain)\n this.#session.setSessionCookieObject('')\n }\n\n #deleteUser () {\n $ct.blockRequest = true\n this.#logger.debug('Block request is true')\n $ct.globalCache = {\n gcookie: null,\n REQ_N: 0,\n RESP_N: 0\n }\n if (StorageManager._isLocalStorageSupported()) {\n delete localStorage[GCOOKIE_NAME]\n delete localStorage[KCOOKIE_NAME]\n delete localStorage[PR_COOKIE]\n delete localStorage[EV_COOKIE]\n delete localStorage[META_COOKIE]\n delete localStorage[ARP_COOKIE]\n delete localStorage[CAMP_COOKIE_NAME]\n delete localStorage[CHARGEDID_COOKIE_NAME]\n }\n StorageManager.removeCookie(GCOOKIE_NAME, $ct.broadDomain)\n StorageManager.removeCookie(CAMP_COOKIE_NAME, getHostName())\n StorageManager.removeCookie(KCOOKIE_NAME, getHostName())\n StorageManager.removeCookie(this.#session.cookieName, $ct.broadDomain)\n StorageManager.removeCookie(ARP_COOKIE, $ct.broadDomain)\n this.#device.gcookie = null\n this.#session.setSessionCookieObject('')\n }\n\n #processLoginArray (loginArr) {\n if (Array.isArray(loginArr) && loginArr.length > 0) {\n const profileObj = loginArr.pop()\n const processProfile = profileObj != null && isObject(profileObj) &&\n ((profileObj.Site != null && Object.keys(profileObj.Site).length > 0) ||\n (profileObj.Facebook != null && Object.keys(profileObj.Facebook).length > 0) ||\n (profileObj['Google Plus'] != null && Object.keys(profileObj['Google Plus']).length > 0))\n if (processProfile) {\n StorageManager.setInstantDeleteFlagInK()\n try {\n this.#processOUL([profileObj])\n } catch (e) {\n this.#logger.debug(e)\n }\n } else {\n this.#logger.error('Profile object is in incorrect format')\n }\n }\n }\n\n push (...profilesArr) {\n this.#processLoginArray(profilesArr)\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#processLoginArray(this.#oldValues)\n }\n this.#oldValues = null\n }\n}\n","import {\n getCampaignObject,\n saveCampaignObject\n} from '../clevertap'\nimport { StorageManager } from '../storage'\n\nexport class CTWebPopupImageOnly extends HTMLElement {\n constructor () {\n super()\n this.shadow = this.attachShadow({ mode: 'open' })\n }\n\n _target = null\n _session = null\n shadow = null\n popup = null\n container = null\n resizeObserver = null\n\n get target () {\n return this._target || ''\n }\n\n set target (val) {\n if (this._target === null) {\n this._target = val\n this.renderImageOnlyPopup()\n }\n }\n\n get session () {\n return this._session || ''\n }\n\n set session (val) {\n this._session = val\n }\n\n get msgId () {\n return this.target.wzrk_id\n }\n\n get pivotId () {\n return this.target.wzrk_pivot\n }\n\n get onClickUrl () {\n return this.target.display.onClickUrl\n }\n\n renderImageOnlyPopup () {\n const campaignId = this.target.wzrk_id.split('_')[0]\n const currentSessionId = this.session.sessionId\n\n this.shadow.innerHTML = this.getImageOnlyPopupContent()\n this.popup = this.shadowRoot.getElementById('imageOnlyPopup')\n this.container = this.shadowRoot.getElementById('container')\n this.closeIcon = this.shadowRoot.getElementById('close')\n\n this.popup.addEventListener('load', this.updateImageAndContainerWidth())\n this.resizeObserver = new ResizeObserver(() => this.handleResize(this.popup, this.container))\n this.resizeObserver.observe(this.popup)\n\n this.closeIcon.addEventListener('click', () => {\n this.resizeObserver.unobserve(this.popup)\n document.getElementById('wzrkImageOnlyDiv').style.display = 'none'\n this.remove()\n if (campaignId != null && campaignId !== '-1') {\n if (StorageManager._isLocalStorageSupported()) {\n const campaignObj = getCampaignObject()\n\n let sessionCampaignObj = campaignObj.wp[currentSessionId]\n if (sessionCampaignObj == null) {\n sessionCampaignObj = {}\n campaignObj[currentSessionId] = sessionCampaignObj\n }\n sessionCampaignObj[campaignId] = 'dnd'\n saveCampaignObject(campaignObj)\n }\n }\n })\n\n window.clevertap.renderNotificationViewed({ msgId: this.msgId, pivotId: this.pivotId })\n\n if (this.onClickUrl) {\n this.popup.addEventListener('click', () => {\n this.target.display.window ? window.open(this.onClickUrl, '_blank') : window.parent.location.href = this.onClickUrl\n window.clevertap.renderNotificationClicked({ msgId: this.msgId, pivotId: this.pivotId })\n })\n }\n }\n\n handleResize (popup, container) {\n const width = this.getRenderedImageWidth(popup)\n container.style.setProperty('width', `${width}px`)\n }\n\n getImageOnlyPopupContent () {\n return `\n ${this.target.msgContent.css}\n ${this.target.msgContent.html}\n `\n }\n\n updateImageAndContainerWidth () {\n return () => {\n const width = this.getRenderedImageWidth(this.popup)\n this.popup.style.setProperty('width', `${width}px`)\n this.container.style.setProperty('width', `${width}px`)\n this.container.style.setProperty('height', 'auto')\n this.container.style.setProperty('position', 'fixed')\n this.popup.style.setProperty('visibility', 'visible')\n this.closeIcon.style.setProperty('visibility', 'visible')\n document.getElementById('wzrkImageOnlyDiv').style.visibility = 'visible'\n }\n }\n\n getRenderedImageWidth (img) {\n const ratio = img.naturalWidth / img.naturalHeight\n return img.height * ratio\n }\n}\n","import { determineTimeStampText, greenTickSvg } from './helper'\nexport class Message extends HTMLElement {\n constructor (config, message) {\n super()\n this.shadow = this.attachShadow({ mode: 'open' })\n this.config = config\n this.message = message\n this.renderMessage(message)\n }\n\n wrapper = null\n snackBar = null\n\n get pivotId () {\n return this.message.wzrk_pivot\n }\n\n get campaignId () {\n return this.message.wzrk_id\n }\n\n createEl (type, id, part) {\n const _el = document.createElement(type)\n _el.setAttribute('id', id)\n _el.setAttribute('part', part || id)\n return _el\n }\n\n renderMessage (msg) {\n this.wrapper = this.createEl('div', 'messageWrapper')\n\n switch (msg.templateType) {\n case 'text-only':\n case 'text-with-icon':\n case 'text-with-icon-and-image': {\n const message = this.prepareBasicMessage(msg.msg[0])\n this.wrapper.appendChild(message)\n }\n }\n\n const timeStamp = this.createEl('div', 'timeStamp')\n timeStamp.innerHTML = `${determineTimeStampText(msg.id.split('_')[1])}`\n if (!msg.viewed) {\n const unreadMarker = this.createEl('span', 'unreadMarker')\n timeStamp.appendChild(unreadMarker)\n }\n\n this.wrapper.appendChild(timeStamp)\n this.shadow.appendChild(this.wrapper)\n }\n\n prepareBasicMessage (msg) {\n const message = this.createEl('div', 'message')\n\n if (msg.imageUrl) {\n const imageContainer = this.addImage(msg.imageUrl, 'mainImg')\n message.appendChild(imageContainer)\n }\n const iconTitleDescWrapper = this.createEl('div', 'iconTitleDescWrapper')\n if (msg.iconUrl) {\n const iconContainer = this.addImage(msg.iconUrl, 'iconImg')\n iconTitleDescWrapper.appendChild(iconContainer)\n }\n const titleDescWrapper = this.createEl('div', 'titleDescWrapper')\n if (msg.title) {\n const title = this.createEl('div', 'title')\n title.innerText = msg.title\n titleDescWrapper.appendChild(title)\n }\n if (msg.description) {\n const description = this.createEl('div', 'description')\n description.innerText = msg.description\n titleDescWrapper.appendChild(description)\n }\n if (msg.title || msg.description) {\n iconTitleDescWrapper.appendChild(titleDescWrapper)\n }\n\n if (msg.iconUrl || msg.title || msg.description) {\n message.appendChild(iconTitleDescWrapper)\n }\n if (msg.buttons && msg.buttons.length) {\n const buttonsContainer = this.addButtons(msg.buttons)\n message.appendChild(buttonsContainer)\n }\n return message\n }\n\n addButtons (buttons = []) {\n const buttonsContainer = this.createEl('div', 'buttonsContainer')\n let hasCopyAction = false\n buttons.forEach((b, i) => {\n const button = this.createEl('button', `button-${i}`, 'button')\n button.innerText = b.text\n if (i > 0) {\n button.style.cssText += 'margin-left: 2px;'\n }\n if (b.action === 'copy') {\n hasCopyAction = true\n }\n buttonsContainer.appendChild(button)\n })\n if (hasCopyAction) {\n this.addSnackbar(buttonsContainer)\n }\n return buttonsContainer\n }\n\n addSnackbar (buttonsContainer) {\n this.snackBar = this.createEl('div', `snackbar-${this.campaignId}`, 'snackbar')\n this.snackBar.innerHTML = greenTickSvg\n const clipboardMsg = this.createEl('span', `snackbar-msg-${this.campaignId}`, 'snackbar-msg')\n clipboardMsg.innerText = 'Copied to clipboard'\n this.snackBar.appendChild(clipboardMsg)\n buttonsContainer.appendChild(this.snackBar)\n }\n\n addImage (url, type) {\n const imageContainer = this.createEl('div', `${type}Container`)\n const image = this.createEl('img', type)\n image.setAttribute('src', url)\n // images will be fetched as and when the element comes into the viewport\n image.setAttribute('loading', 'lazy')\n imageContainer.appendChild(image)\n return imageContainer\n }\n\n raiseClickedEvent (path, isPreview) {\n switch (this.message.templateType) {\n case 'text-only':\n case 'text-with-icon':\n case 'text-with-icon-and-image': {\n this.raiseClickedForBasicTemplates(path, isPreview)\n }\n }\n }\n\n raiseClickedForBasicTemplates (path, isPreview) {\n const msg = this.message.msg[0]\n const payload = { msgId: this.campaignId, pivotId: this.pivotId }\n if (path.tagName === 'BUTTON') {\n const id = path.id.split('-')[1]\n const button = msg.buttons[id]\n payload.kv = {\n wzrk_c2a: button.text\n }\n if (button.action === 'url') {\n button.openUrlInNewTab ? window.open(button.url, '_blank') : (window.location = button.url)\n } else if (button.action === 'copy') {\n window.focus()\n navigator.clipboard.writeText(button.clipboardText)\n this.snackBar.style.setProperty('display', 'flex', 'important')\n setTimeout(() => {\n this.snackBar.style.setProperty('display', 'none', 'important')\n }, 2000)\n }\n } else if (path.tagName === 'CT-INBOX-MESSAGE' && msg.onClickUrl) {\n msg.openUrlInNewTab ? window.open(msg.onClickUrl, '_blank') : (window.location = msg.onClickUrl)\n }\n if (isPreview) {\n console.log('Notifiction clicked event will be raised at run time with payload ::', payload)\n } else {\n window.clevertap.renderNotificationClicked(payload)\n }\n }\n}\n","export const messageStyles = ({ backgroundColor, borderColor, titleColor, descriptionColor, buttonColor, buttonTextColor, unreadMarkerColor }) => {\n return `\n \n `\n}\n\nexport const inboxContainerStyles = ({\n panelBackgroundColor,\n panelBorderColor,\n headerBackgroundColor,\n headerTitleColor,\n closeIconColor,\n categoriesTabColor,\n categoriesTitleColor,\n categoriesBorderColor,\n selectedCategoryTabColor,\n selectedCategoryTitleColor,\n selectedCategoryBorderColor,\n headerCategoryHeight\n}) => {\n return `\n \n `\n}\n","import { StorageManager, $ct } from '../../util/storage'\nimport { Message } from './Message'\nimport { inboxContainerStyles, messageStyles } from './inboxStyles'\nimport { getInboxPosition, determineTimeStampText, arrowSvg, getInboxMessages, saveInboxMessages } from './helper'\nimport { WEBINBOX_CONFIG, MAX_INBOX_MSG } from '../../util/constants'\n\nexport class Inbox extends HTMLElement {\n constructor (logger) {\n super()\n this.logger = logger\n this.shadow = this.attachShadow({ mode: 'open' })\n }\n\n isInboxOpen = false\n isInboxFromFlutter = false\n selectedCategory = null\n unviewedMessages = {}\n unviewedCounter = 0\n isPreview = false\n inboxConfigForPreview = {}\n\n // dom references\n inboxSelector = null\n inbox = null\n emptyInboxMsg = null\n inboxCard = null\n unviewedBadge = null\n observer = null\n selectedCategoryRef = null\n\n get incomingMessages () {\n return []\n }\n\n set incomingMessages (msgs = []) {\n if (msgs.length > 0 && this.inbox) {\n this.updateInboxMessages(msgs)\n }\n }\n\n get incomingMessagesForPreview () {\n return []\n }\n\n set incomingMessagesForPreview (msgs = []) {\n const previewMsgs = {}\n if (msgs.length > 0 && this.inbox) {\n this.isPreview = true\n this.unviewedCounter = 0\n msgs.forEach((m) => {\n const key = `${m.wzrk_id.split('_')[0]}_${Date.now()}`\n m.id = key\n previewMsgs[key] = m\n this.unviewedMessages[key] = m\n this.unviewedCounter++\n })\n this.buildUIForMessages(previewMsgs)\n this.updateUnviewedBadgeCounter()\n }\n }\n\n connectedCallback () {\n this.init()\n }\n\n init () {\n this.config = this.isPreview ? this.inboxConfigForPreview : StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}\n if (Object.keys(this.config).length === 0) {\n return\n }\n this.inboxSelector = document.getElementById(this.config.inboxSelector)\n if (this.inboxSelector === null) {\n return\n }\n\n if (this.config.styles.notificationsBadge) {\n this.addUnviewedBadge()\n } else if (this.unviewedBadge) {\n this.unviewedBadge.remove()\n }\n\n this.createinbox()\n\n /**\n * We need to remove the listener as there could be a scenario where init would be called when\n * we get updated web inbox settings from LC after the inbox has been initialised.\n * It can so happen that the inbox-selector would have changed.\n */\n document.removeEventListener('click', this.addClickListenerOnDocument)\n document.addEventListener('click', this.addClickListenerOnDocument)\n this.config.categories.length && this.updateActiveCategory(this.selectedCategoryRef.innerText)\n\n this.shadow.innerHTML = this.getInboxStyles()\n this.shadow.appendChild(this.inbox)\n }\n\n addMsgsToInboxFromLS () {\n const messages = this.deleteExpiredAndGetUnexpiredMsgs(false)\n const msgIds = messages ? Object.keys(messages) : []\n if (msgIds.length === 0) {\n return\n }\n msgIds.forEach((m) => {\n if (!messages[m].viewed) {\n this.unviewedMessages[m] = messages[m]\n this.unviewedCounter++\n }\n })\n this.buildUIForMessages(messages)\n this.updateUnviewedBadgeCounter()\n }\n\n /**\n * @param {*} deleteMsgsFromUI - If this param is true, then we'll have to check the UI and delete expired messages from the DOM\n * It'll be false when you are building the inbox layout for the very first time.\n *\n * This method reads the inbox messages from LS,\n * based on the deleteMsgsFromUI flag deletes the expired messages from UI and decrements the unviewed counter if the message was not viewed,\n * sorts the messages based on the date,\n * saves the unexpired messages to LS\n * and returns the sorted unexpired messages\n *\n * Scenarios when we encounter expired messages -\n * 1. building ui for the 1st time, no need to decrement the unviewed counter as the correct count will be set at the time of rendering\n * 2. UI is already built (deleteMsgsFromUI = true) and you open the inbox\n * a. You'll find the expired msg in inbox\n * b. You'll not find the expired msg in inbox.\n * This happens when we receive new messages from LC, increment unviewed counter, save it in LS. (We build the UI only when the user opens inbox.)\n * In both the above scenarios, we'll still have to decrement the unviewed counter if the message was not viewed.\n */\n deleteExpiredAndGetUnexpiredMsgs (deleteMsgsFromUI = true) {\n let messages = getInboxMessages()\n\n const now = Math.floor(Date.now() / 1000)\n for (const msg in messages) {\n if (messages[msg].wzrk_ttl && messages[msg].wzrk_ttl > 0 && messages[msg].wzrk_ttl < now) {\n if (deleteMsgsFromUI) {\n const el = this.shadowRoot.getElementById(messages[msg].id)\n el && el.remove()\n if (!messages[msg].viewed) {\n this.unviewedCounter--\n this.updateUnviewedBadgeCounter()\n }\n }\n delete messages[msg]\n }\n }\n if (messages && messages.length > 0) {\n messages = Object.values(messages).sort((a, b) => b.date - a.date).reduce((acc, m) => { acc[m.id] = m; return acc }, {})\n }\n saveInboxMessages(messages)\n return messages\n }\n\n updateInboxMessages (msgs = []) {\n const inboxMsgs = this.deleteExpiredAndGetUnexpiredMsgs()\n const date = Date.now()\n const incomingMsgs = {}\n msgs.forEach((m, i) => {\n const key = `${m.wzrk_id.split('_')[0]}_${Date.now()}`\n m.id = key\n // We are doing this to preserve the order of the messages\n m.date = date - i\n m.viewed = 0\n inboxMsgs[key] = m\n incomingMsgs[key] = m\n this.unviewedMessages[key] = m\n this.unviewedCounter++\n })\n saveInboxMessages(inboxMsgs)\n this.buildUIForMessages(incomingMsgs)\n this.updateUnviewedBadgeCounter()\n }\n\n createEl (type, id, part) {\n const _el = document.createElement(type)\n _el.setAttribute('id', id)\n _el.setAttribute('part', part || id)\n return _el\n }\n\n addUnviewedBadge () {\n if (!this.unviewedBadge) {\n this.unviewedBadge = this.createEl('div', 'unviewedBadge')\n // As this unviewedBadge element will be directly added to the DOM, we are defining inline styles\n this.unviewedBadge.style.cssText = `display: none; position: absolute; height: 16px; width: 26px; border-radius: 8px; background-color: ${this.config.styles.notificationsBadge.backgroundColor}; font-size: 12px; color: ${this.config.styles.notificationsBadge.textColor}; font-weight: bold; align-items: center; justify-content: center;`\n document.body.appendChild(this.unviewedBadge)\n }\n this.updateUnviewedBadgePosition()\n\n // called when user switches b/w portrait and landscape mode.\n window.addEventListener('resize', () => {\n this.updateUnviewedBadgePosition()\n })\n }\n\n updateUnviewedBadgePosition () {\n const { top, right } = this.inboxSelector.getBoundingClientRect()\n this.unviewedBadge.style.top = `${top - 8}px`\n this.unviewedBadge.style.left = `${right - 8}px`\n }\n\n createinbox () {\n this.inbox = this.createEl('div', 'inbox')\n const header = this.createEl('div', 'header')\n\n const headerTitle = this.createEl('div', 'headerTitle')\n headerTitle.innerText = this.config.title\n\n const closeIcon = this.createEl('div', 'closeInbox')\n closeIcon.innerHTML = '×'\n\n header.appendChild(headerTitle)\n header.appendChild(closeIcon)\n this.inbox.appendChild(header)\n if (this.config.categories.length) {\n const categories = this.createCategories()\n this.inbox.appendChild(categories)\n }\n this.inboxCard = this.createEl('div', 'inboxCard')\n this.inbox.appendChild(this.inboxCard)\n\n this.emptyInboxMsg = this.createEl('div', 'emptyInboxMsg')\n this.emptyInboxMsg.innerText = 'All messages will be displayed here.'\n this.inboxCard.appendChild(this.emptyInboxMsg)\n\n // Intersection observer for notification viewed\n const options = {\n root: this.inboxCard,\n rootMargin: '0px',\n threshold: 0.5\n }\n this.observer = new IntersectionObserver((entries, observer) => { this.handleMessageViewed(entries) }, options)\n\n this.addMsgsToInboxFromLS()\n }\n\n createCategories () {\n const categoriesContainer = this.createEl('div', 'categoriesContainer')\n\n const leftArrow = this.createEl('div', 'leftArrow')\n leftArrow.innerHTML = arrowSvg\n leftArrow.children[0].style = 'transform: rotate(180deg)'\n leftArrow.addEventListener('click', () => {\n this.shadowRoot.getElementById('categoriesWrapper').scrollBy(-70, 0)\n })\n categoriesContainer.appendChild(leftArrow)\n\n const categoriesWrapper = this.createEl('div', 'categoriesWrapper')\n const _categories = ['All', ...this.config.categories]\n _categories.forEach((c, i) => {\n const category = this.createEl('div', `category-${i}`, 'category')\n category.innerText = c\n if (i === 0) {\n this.selectedCategoryRef = category\n }\n categoriesWrapper.appendChild(category)\n })\n categoriesContainer.appendChild(categoriesWrapper)\n\n const rightArrow = this.createEl('div', 'rightArrow')\n rightArrow.innerHTML = arrowSvg\n rightArrow.addEventListener('click', () => {\n this.shadowRoot.getElementById('categoriesWrapper').scrollBy(70, 0)\n })\n categoriesContainer.appendChild(rightArrow)\n\n const options = { root: categoriesContainer, threshold: 0.9 }\n const firstCategory = categoriesWrapper.children[0]\n const lastCategory = categoriesWrapper.children[this.config.categories.length]\n\n const firstCategoryObserver = new IntersectionObserver((e) => {\n this.categoryObserverCb(leftArrow, e[0].intersectionRatio >= 0.9)\n }, options)\n firstCategoryObserver.observe(firstCategory)\n\n const lastCategoryObserver = new IntersectionObserver((e) => {\n this.categoryObserverCb(rightArrow, e[0].intersectionRatio >= 0.9)\n }, options)\n lastCategoryObserver.observe(lastCategory)\n\n return categoriesContainer\n }\n\n categoryObserverCb (el, hide) {\n if (!el) {\n return\n }\n el.style.display = hide ? 'none' : 'flex'\n }\n\n updateActiveCategory (activeCategory) {\n this.selectedCategory = activeCategory\n\n this.inboxCard.scrollTop = 0\n let counter = 0\n\n this.prevCategoryRef && this.prevCategoryRef.setAttribute('selected', 'false')\n this.selectedCategoryRef.setAttribute('selected', 'true')\n\n this.inboxCard.childNodes.forEach(c => {\n if (c.getAttribute('id') !== 'emptyInboxMsg') {\n c.style.display = (this.selectedCategory === 'All' || c.getAttribute('category') === this.selectedCategory) ? 'block' : 'none'\n if (c.style.display === 'block') {\n counter++\n }\n }\n })\n if (counter === 0) {\n this.emptyInboxMsg.innerText = `${activeCategory} messages will be displayed here.`\n this.emptyInboxMsg.style.display = 'block'\n } else {\n this.emptyInboxMsg.style.display = 'none'\n }\n }\n\n buildUIForMessages (messages = {}) {\n !this.isPreview && this.updateTSForRenderedMsgs()\n this.inboxCard.scrollTop = 0\n const maxMsgsInInbox = this.config.maxMsgsInInbox ?? MAX_INBOX_MSG\n const firstChild = this.inboxCard.firstChild\n\n const sortedMsgs = Object.values(messages).sort((a, b) => b.date - a.date).map((m) => m.id)\n for (const m of sortedMsgs) {\n const item = new Message(this.config, messages[m])\n item.setAttribute('id', messages[m].id)\n item.setAttribute('pivot', messages[m].wzrk_pivot)\n item.setAttribute('part', 'ct-inbox-message')\n if (this.config.categories.length > 0) {\n item.setAttribute('category', messages[m].tags[0] || '')\n item.style.display = (this.selectedCategory === 'All' || messages[m].category === this.selectedCategory) ? 'block' : 'none'\n } else {\n item.style.display = 'block'\n }\n this.inboxCard.insertBefore(item, firstChild)\n this.observer.observe(item)\n }\n\n let msgTotalCount = this.inboxCard.querySelectorAll('ct-inbox-message').length\n while (msgTotalCount > maxMsgsInInbox) {\n const ctInboxMsgs = this.inboxCard.querySelectorAll('ct-inbox-message')\n if (ctInboxMsgs.length > 0) { ctInboxMsgs[ctInboxMsgs.length - 1].remove() }\n msgTotalCount--\n }\n const hasMessages = this.inboxCard.querySelectorAll('ct-inbox-message[style*=\"display: block\"]').length\n this.emptyInboxMsg.style.display = hasMessages ? 'none' : 'block'\n }\n\n /**\n * Adds a click listener on the document. For every click we check\n * 1. if the click has happenned within the inbox\n * - on close button, we close the inbox\n * - on any of the category, we set that as the activeCategory\n * - on any of the message, we mark raise notification clicked event. To identify the clicks on a button, we have p.id.startsWith('button-')\n * 2. if the user has clicked on the inboxSelector, we toggle inbox\n * 3. if the click is anywhere else on the UI and the inbox is open, we simply close it\n */\n\n addClickListenerOnDocument = (() => {\n return (e) => {\n if (e.composedPath().includes(this.inbox)) {\n // path is not supported on FF. So we fallback to e.composedPath\n const path = e.path || (e.composedPath && e.composedPath())\n if (path.length) {\n const id = path[0].id\n if (id === 'closeInbox') {\n this.toggleInbox()\n } else if (id.startsWith('category-')) {\n this.prevCategoryRef = this.selectedCategoryRef\n this.selectedCategoryRef = path[0]\n this.updateActiveCategory(path[0].innerText)\n } else {\n const _path = path.filter((p) => p.id?.startsWith('button-') || p.tagName === 'CT-INBOX-MESSAGE')\n if (_path.length) {\n const messageEl = _path[_path.length - 1]\n messageEl.raiseClickedEvent(_path[0], this.isPreview)\n }\n }\n }\n } else if (this.inboxSelector.contains(e.target) || this.isInboxOpen) {\n if (this.isInboxFromFlutter) {\n this.isInboxFromFlutter = false\n } else {\n this.toggleInbox(e)\n }\n }\n }\n })()\n\n /**\n * This function will be called every time when a message comes into the inbox viewport and it's visibility increases to 50% or drops below 50%\n * If a msg is 50% visible in the UI, we need to mark the message as viewed in LS and raise notification viewed event\n */\n handleMessageViewed (entries) {\n const raiseViewedEvent = !this.isPreview\n if (this.isInboxOpen) {\n entries.forEach((e) => {\n if (e.isIntersecting && this.unviewedMessages.hasOwnProperty(e.target.id) && e.target.message.viewed === 0) {\n e.target.message.viewed = 1\n if (raiseViewedEvent) {\n window.clevertap.renderNotificationViewed({ msgId: e.target.campaignId, pivotId: e.target.pivotId })\n this.updateMessageInLS(e.target.id, { ...e.target.message, viewed: 1 })\n setTimeout(() => {\n e.target.shadowRoot.getElementById('unreadMarker').style.display = 'none'\n }, 1000)\n } else {\n console.log('Notifiction viewed event will be raised at run time with payload ::', { msgId: e.target.campaignId, pivotId: e.target.pivotId })\n }\n this.unviewedCounter--\n this.updateUnviewedBadgeCounter()\n delete this.unviewedMessages[e.target.id]\n }\n })\n }\n }\n\n updateMessageInLS (key, value) {\n if (!this.isPreview) {\n const messages = getInboxMessages()\n messages[key] = value\n saveInboxMessages(messages)\n }\n }\n\n // create a separte fn fro refactoring\n toggleInbox (e) {\n this.isInboxOpen = !this.isInboxOpen\n this.isInboxFromFlutter = !!e?.rect\n if (this.isInboxOpen) {\n this.inboxCard.scrollTop = 0\n !this.isPreview && this.deleteExpiredAndGetUnexpiredMsgs()\n this.inbox.style.display = 'block'\n this.inbox.style.zIndex = '2147483647' // zIndex should be max for the inbox to be rendered on top of all elements\n if (this.config.categories.length) {\n this.selectedCategoryRef.setAttribute('selected', 'false')\n this.selectedCategoryRef = this.shadowRoot.getElementById('category-0')\n this.updateActiveCategory(this.selectedCategoryRef.innerText)\n this.shadowRoot.getElementById('categoriesWrapper').scrollLeft -= this.shadowRoot.getElementById('categoriesWrapper').scrollWidth\n }\n this.setInboxPosition(e)\n } else {\n this.inbox.style.display = 'none'\n }\n }\n\n setInboxPosition (e) {\n const windowWidth = window.outerWidth\n const customInboxStyles = getComputedStyle($ct.inbox)\n const top = customInboxStyles.getPropertyValue('--inbox-top')\n const bottom = customInboxStyles.getPropertyValue('--inbox-bottom')\n const left = customInboxStyles.getPropertyValue('--inbox-left')\n const right = customInboxStyles.getPropertyValue('--inbox-right')\n const hasPositionDefined = top || bottom || left || right\n if (windowWidth > 481 && !hasPositionDefined) {\n const res = getInboxPosition(e, this.inbox.clientHeight, this.inbox.clientWidth)\n const xPos = res.xPos\n const yPos = res.yPos\n this.inbox.style.top = yPos + 'px'\n this.inbox.style.left = xPos + 'px'\n }\n }\n\n /**\n * Updates the UI with the number of unviewed messages\n * If there are more than 9 unviewed messages, we show the count as 9+\n */\n\n setBadgeStyle = (msgCount) => {\n if (this.unviewedBadge !== null) {\n this.unviewedBadge.innerText = msgCount > 9 ? '9+' : msgCount\n this.unviewedBadge.style.display = msgCount > 0 ? 'flex' : 'none'\n }\n }\n\n updateUnviewedBadgeCounter () {\n if (this.isPreview) {\n this.setBadgeStyle(this.unviewedCounter)\n return\n }\n let counter = 0\n this.inboxCard.querySelectorAll('ct-inbox-message').forEach((m) => {\n const messages = getInboxMessages()\n if (messages[m.id] && messages[m.id].viewed === 0) {\n counter++\n }\n })\n this.setBadgeStyle(counter)\n }\n\n updateTSForRenderedMsgs () {\n this.inboxCard.querySelectorAll('ct-inbox-message').forEach((m) => {\n const ts = m.id.split('_')[1]\n m.shadow.getElementById('timeStamp').firstChild.innerText = determineTimeStampText(ts)\n })\n }\n\n getInboxStyles () {\n const headerHeight = 36\n const categoriesHeight = this.config.categories.length ? 64 : 16\n\n const styles = {\n panelBackgroundColor: this.config.styles.panelBackgroundColor,\n panelBorderColor: this.config.styles.panelBorderColor,\n headerBackgroundColor: this.config.styles.header.backgroundColor,\n headerTitleColor: this.config.styles.header.titleColor,\n closeIconColor: this.config.styles.closeIconColor,\n categoriesTabColor: this.config.styles.categories.tabColor,\n categoriesTitleColor: this.config.styles.categories.titleColor,\n selectedCategoryTabColor: this.config.styles.categories.selectedTab.tabColor,\n selectedCategoryTitleColor: this.config.styles.categories.selectedTab.titleColor,\n headerCategoryHeight: headerHeight + categoriesHeight\n }\n if (this.config.styles.categories.borderColor) {\n styles.categoriesBorderColor = this.config.styles.categories.borderColor\n }\n if (this.config.styles.categories.selectedTab.borderColor) {\n styles.selectedCategoryBorderColor = this.config.styles.categories.selectedTab.borderColor\n }\n\n const inboxStyles = inboxContainerStyles(styles)\n\n const cardStyles = this.config.styles.cards\n const msgStyles = messageStyles({\n backgroundColor: cardStyles.backgroundColor,\n borderColor: cardStyles.borderColor,\n titleColor: cardStyles.titleColor,\n descriptionColor: cardStyles.descriptionColor,\n buttonColor: cardStyles.buttonColor,\n buttonTextColor: cardStyles.buttonTextColor,\n unreadMarkerColor: cardStyles.unreadMarkerColor\n })\n\n return inboxStyles + msgStyles\n }\n}\n","import { StorageManager, $ct } from '../../util/storage'\nimport { Inbox } from './WebInbox'\nimport { Message } from './Message'\nimport { WEBINBOX_CONFIG, GCOOKIE_NAME, WEBINBOX } from '../../util/constants'\nimport { isValueValid } from '../../util/datatypes'\n\nexport const processWebInboxSettings = (webInboxSetting, isPreview = false) => {\n const _settings = StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}\n if (isPreview) {\n $ct.inbox.inboxConfigForPreview = webInboxSetting\n $ct.inbox.isPreview = true\n $ct.inbox && $ct.inbox.init()\n } else if (JSON.stringify(_settings) !== JSON.stringify(webInboxSetting)) {\n StorageManager.saveToLSorCookie(WEBINBOX_CONFIG, webInboxSetting)\n $ct.inbox && $ct.inbox.init()\n }\n}\n\nexport const processInboxNotifs = (msg) => {\n if (msg.inbox_preview) {\n $ct.inbox.incomingMessagesForPreview = msg.inbox_notifs\n } else {\n $ct.inbox.incomingMessages = msg\n }\n}\n\nexport const processWebInboxResponse = (msg) => {\n if (msg.webInboxSetting) {\n processWebInboxSettings(msg.webInboxSetting, msg.inbox_preview)\n }\n if (msg.inbox_notifs != null) {\n processInboxNotifs(msg)\n }\n}\n\nexport const addWebInbox = (logger) => {\n checkAndRegisterWebInboxElements()\n $ct.inbox = new Inbox({ logger })\n document.body.appendChild($ct.inbox)\n}\n\nconst getAndMigrateInboxMessages = (guid) => {\n const messages = StorageManager.readFromLSorCookie(WEBINBOX) || {}\n // Doing this to migrate message to guid level\n if (Object.keys(messages).length > 0 && Object.keys(messages)[0].includes('_')) {\n const gudInboxObj = {}\n gudInboxObj[guid] = messages\n StorageManager.saveToLSorCookie(WEBINBOX, gudInboxObj)\n return gudInboxObj\n }\n return messages\n}\n\nexport const getInboxMessages = () => {\n const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n if (!isValueValid(guid)) { return {} }\n const messages = getAndMigrateInboxMessages(guid)\n\n return messages.hasOwnProperty(guid) ? messages[guid] : {}\n}\n\nexport const saveInboxMessages = (messages) => {\n const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n if (!isValueValid(guid)) { return }\n const storedInboxObj = getAndMigrateInboxMessages(guid)\n\n const newObj = { ...storedInboxObj, [guid]: messages }\n StorageManager.saveToLSorCookie(WEBINBOX, newObj)\n}\n\nexport const initializeWebInbox = (logger) => {\n return new Promise((resolve, reject) => {\n if (document.readyState === 'complete') {\n addWebInbox(logger)\n resolve()\n } else {\n const config = StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}\n const onLoaded = () => {\n /**\n * We need this null check here because $ct.inbox could be initialised via init method too on document load.\n * In that case we don't need to call addWebInbox method\n */\n if ($ct.inbox === null) {\n addWebInbox(logger)\n }\n resolve()\n }\n window.addEventListener('load', () => {\n /**\n * Scripts can be loaded layzily, we may not get element from dom as it may not be mounted yet\n * We will to check element for 10 seconds and give up\n */\n if (document.getElementById(config.inboxSelector)) {\n onLoaded()\n } else {\n // check for element for next 10 seconds\n let count = 0\n if (count < 20) {\n const t = setInterval(() => {\n if (document.getElementById(config.inboxSelector)) {\n onLoaded()\n clearInterval(t)\n resolve()\n } else if (count >= 20) {\n clearInterval(t)\n logger.debug('Failed to add inbox')\n }\n count++\n }, 500)\n }\n }\n })\n }\n })\n}\n\nexport const checkAndRegisterWebInboxElements = () => {\n if (customElements.get('ct-web-inbox') === undefined) {\n customElements.define('ct-web-inbox', Inbox)\n customElements.define('ct-inbox-message', Message)\n }\n}\n\nexport const getInboxPosition = (e, inboxHeight, inboxWidth) => {\n const horizontalScroll = document.scrollingElement.scrollLeft\n const verticalScroll = document.scrollingElement.scrollTop\n const windowWidth = window.innerWidth + horizontalScroll\n const windowHeight = window.innerHeight + verticalScroll\n const selectorRect = e.rect || e.target.getBoundingClientRect()\n const selectorX = selectorRect.x + horizontalScroll\n const selectorY = selectorRect.y + verticalScroll\n const selectorLeft = selectorRect.left + horizontalScroll\n const selectorRight = selectorRect.right + horizontalScroll\n const selectorTop = selectorRect.top + verticalScroll\n // const selectorBottom = selectorRect.bottom + verticalScroll\n const selectorBottom = selectorRect.bottom\n const selectorHeight = selectorRect.height\n const selectorWidth = selectorRect.width\n const selectorCenter = {\n x: selectorX + (selectorWidth / 2),\n y: selectorY + (selectorHeight / 2)\n }\n const halfOfInboxHeight = (inboxHeight / 2)\n const halfOfInboxWidth = (inboxWidth / 2)\n let inboxOnSide = false\n\n let xPos, yPos\n\n const padding = 16\n\n /**\n * y co-ordinates:\n * Try to push the card downwards\n * if that's not possible, push it upwards\n * if that too is not possible, then the card will be placed on the side. Add some padding.\n *\n * x co-ordinates:\n * If the card is on the side,\n * try to place it to the right. If it's not possible,\n * place it to the left\n * If the card is either on top/ bottom, set the x co-ordinate such that the selector center and the inbox card center become the same\n * Now,\n * if the left of the inbox card is < 0,\n * try to get the left aligned to the selectorLeft.\n * if that's not possible, simply set left to 0\n * if the right of the inbox card > windowWidth,\n * try to get the right of rhe inbox card aligned with the selectorRight\n * if that's not possible, simply set the inbox right to the window Right\n */\n if (selectorBottom + inboxHeight <= windowHeight) { // try to place the card down\n const availableHeight = windowHeight - (selectorBottom + inboxHeight)\n yPos = availableHeight >= padding ? selectorBottom + padding : selectorBottom + availableHeight\n } else if (selectorTop - inboxHeight >= verticalScroll) { // try to place the card up\n const availableHeight = selectorTop - inboxHeight\n yPos = availableHeight >= padding ? selectorTop - inboxHeight - padding : selectorTop - inboxHeight - availableHeight\n } else {\n inboxOnSide = true\n yPos = selectorCenter.y - halfOfInboxHeight // with this the y co-ordinate of the selector center and the inbox card center become the same\n if (yPos < verticalScroll) {\n yPos = verticalScroll\n } else if (yPos + inboxHeight > windowHeight) {\n yPos = windowHeight - inboxHeight\n }\n }\n\n if (inboxOnSide) {\n // See if we can place the card to the right of the selector\n const inboxRight = selectorRight + inboxWidth\n if (inboxRight <= windowWidth) {\n const availableWidth = inboxRight + padding <= windowWidth ? padding : windowWidth - inboxRight\n xPos = selectorRight + availableWidth\n } else {\n const inboxLeft = selectorLeft - inboxWidth\n const availableWidth = inboxLeft - padding >= horizontalScroll ? padding : inboxLeft - horizontalScroll\n xPos = inboxLeft - availableWidth\n }\n } else {\n xPos = selectorCenter.x - halfOfInboxWidth\n if (xPos < horizontalScroll) {\n if (selectorLeft + inboxWidth <= windowWidth) {\n xPos = selectorLeft\n } else {\n xPos = horizontalScroll\n }\n } else if (xPos + inboxWidth > windowWidth) {\n if (selectorRight - inboxWidth >= horizontalScroll) {\n xPos = selectorRight - inboxWidth\n } else {\n xPos = windowWidth - inboxWidth\n }\n }\n }\n\n return { xPos, yPos }\n}\n\nexport const determineTimeStampText = (ts) => {\n const now = Date.now()\n let diff = Math.floor((now - ts) / 60000)\n if (diff < 5) {\n return 'Just now'\n }\n if (diff < 60) {\n return `${diff} minute${diff > 1 ? 's' : ''} ago`\n }\n diff = Math.floor(diff / 60)\n if (diff < 24) {\n return `${diff} hour${diff > 1 ? 's' : ''} ago`\n }\n diff = Math.floor(diff / 24)\n return `${diff} day${diff > 1 ? 's' : ''} ago`\n}\n\nexport const hasWebInboxSettingsInLS = () => {\n return Object.keys(StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}).length > 0\n}\n\nexport const arrowSvg = `\n\n\n`\nexport const greenTickSvg = `\n\n\n`\n","export const OVERLAY_PATH = 'https://web-native-display-campaign.clevertap.com/production/lib-overlay/overlay.js'\nexport const CSS_PATH = 'https://web-native-display-campaign.clevertap.com/production/lib-overlay/style.css'\nexport const WVE_CLASS = {\n FLICKER_SHOW: 'wve-anti-flicker-show',\n FLICKER_HIDE: 'wve-anti-flicker-hide',\n FLICKER_ID: 'wve-flicker-style'\n}\n","export const updateFormData = (element, formStyle, payload, isPreview = false) => {\n // Update the element style\n if (formStyle.style !== undefined) {\n Object.keys(formStyle.style).forEach((property) => {\n element.style.setProperty(property, formStyle.style[property])\n })\n }\n\n // Update underline for element\n if (formStyle.underline !== undefined) {\n const curTextDecoration = element.style.textDecoration\n if (formStyle.underline) {\n element.style.textDecoration = `${curTextDecoration} underline`.trim()\n } else {\n element.style.textDecoration = curTextDecoration.replace('underline', '').trim()\n }\n }\n\n // Update element text\n if (formStyle.text !== undefined) {\n element.innerText = formStyle.text\n }\n\n // Handle element onClick\n if (formStyle.clickDetails !== undefined) {\n const url = formStyle.clickDetails.clickUrl\n element.onclick = formStyle.clickDetails.newTab\n ? () => {\n if (!isPreview) {\n window.clevertap.raiseNotificationClicked(payload)\n }\n window.open(url, '_blank').focus()\n }\n : () => {\n if (!isPreview) {\n window.clevertap.raiseNotificationClicked(payload)\n }\n window.location.href = url\n }\n }\n\n // Set the image source\n if (formStyle.imgURL !== undefined && element.tagName.toLowerCase() === 'img') {\n element.src = formStyle.imgURL\n }\n\n // Handle elementCss\n if (formStyle.elementCss !== undefined) {\n const style = document.createElement('style')\n style.innerHTML = formStyle.elementCss\n document.head.appendChild(style)\n }\n}\n","import { CSS_PATH, OVERLAY_PATH, WVE_CLASS } from './builder_constants'\nimport { updateFormData } from './dataUpdate'\n\nexport const checkBuilder = (logger, accountId) => {\n const search = window.location.search\n const parentWindow = window.opener\n\n if (search === '?ctBuilder') {\n // open in visual builder mode\n logger.debug('open in visual builder mode')\n window.addEventListener('message', handleMessageEvent, false)\n if (parentWindow) {\n parentWindow.postMessage({ message: 'builder', originUrl: window.location.href }, '*')\n }\n return\n }\n if (search === '?ctBuilderPreview') {\n window.addEventListener('message', handleMessageEvent, false)\n if (parentWindow) {\n parentWindow.postMessage({ message: 'preview', originUrl: window.location.href }, '*')\n }\n }\n\n if (search === '?ctBuilderSDKCheck') {\n if (parentWindow) {\n const sdkVersion = '$$PACKAGE_VERSION$$'\n parentWindow.postMessage({\n message: 'SDKVersion',\n accountId,\n originUrl: window.location.href,\n sdkVersion\n },\n '*'\n )\n }\n }\n}\n\nconst handleMessageEvent = (event) => {\n if (event.data && isValidUrl(event.data.originUrl)) {\n const msgOrigin = new URL(event.data.originUrl).origin\n if (event.origin !== msgOrigin) {\n return\n }\n } else {\n return\n }\n if (event.data.message === 'Dashboard') {\n initialiseCTBuilder(event.data.url, event.data.variant ?? null, event.data.details ?? {})\n } else if (event.data.message === 'Overlay') {\n renderVisualBuilder(event.data, true)\n }\n}\n/**\n * Initializes the Clevertap builder.\n * @param {string} url - The URL to initialize the builder.\n * @param {string} variant - The variant of the builder.\n * @param {Object} details - The details object.\n */\nconst initialiseCTBuilder = (url, variant, details) => {\n if (document.readyState === 'complete') {\n onContentLoad(url, variant, details)\n } else {\n document.addEventListener('readystatechange', () => {\n if (document.readyState === 'complete') {\n onContentLoad(url, variant, details)\n }\n })\n }\n}\n\nlet container\nlet contentLoaded = false\nlet isShopify = false\n/**\n * Handles content load for Clevertap builder.\n */\nfunction onContentLoad (url, variant, details) {\n if (!contentLoaded) {\n if (window.Shopify) {\n isShopify = true\n }\n document.body.innerHTML = ''\n document.head.innerHTML = ''\n document.documentElement.innerHTML = ''\n container = document.createElement('div')\n container.id = 'overlayDiv'\n container.style.position = 'relative' // Ensure relative positioning for absolute positioning of form\n container.style.display = 'flex'\n document.body.appendChild(container)\n const overlayPath = OVERLAY_PATH\n loadOverlayScript(overlayPath, url, variant, details)\n .then(() => {\n console.log('Overlay script loaded successfully.')\n contentLoaded = true\n })\n .catch((error) => {\n console.error('Error loading overlay script:', error)\n })\n loadCSS()\n }\n}\n\n/**\n * Loads CSS file.\n */\nfunction loadCSS () {\n var link = document.createElement('link')\n link.rel = 'stylesheet'\n link.type = 'text/css'\n link.href = CSS_PATH\n document.head.appendChild(link)\n}\n\n/**\n * Loads the overlay script.\n * @param {string} overlayPath - The path to overlay script.\n * @param {string} url - The URL.\n * @param {string} variant - The variant.\n * @param {Object} details - The details object.\n * @returns {Promise} A promise.\n */\nfunction loadOverlayScript (overlayPath, url, variant, details) {\n return new Promise((resolve, reject) => {\n var script = document.createElement('script')\n script.type = 'module'\n script.src = overlayPath\n script.onload = function () {\n if (typeof window.Overlay === 'function') {\n window.Overlay({ id: '#overlayDiv', url, variant, details, isShopify })\n resolve()\n } else {\n reject(new Error('ContentLayout not found in overlay.js'))\n }\n }\n script.onerror = function (error) {\n reject(error)\n }\n document.head.appendChild(script)\n })\n}\n\n/**\n * Renders the visual builder.\n * @param {Object} targetingMsgJson - The point and click campaign JSON object.\n * @param {boolean} isPreview - Indicates if it's a preview.\n */\nexport const renderVisualBuilder = (targetingMsgJson, isPreview) => {\n const details = isPreview ? targetingMsgJson.details : targetingMsgJson.display.details\n let notificationViewed = false\n const payload = {\n msgId: targetingMsgJson.wzrk_id,\n pivotId: targetingMsgJson.wzrk_pivot\n }\n\n const raiseViewed = () => {\n if (!isPreview && !notificationViewed) {\n notificationViewed = true\n window.clevertap.renderNotificationViewed(payload)\n }\n }\n\n const processElement = (element, selector) => {\n if (!selector.values) return\n if (selector.values.html) {\n element.outerHTML = selector.values.html\n } else if (selector.values?.json) {\n dispatchJsonData(targetingMsgJson, selector.values)\n } else {\n payload.msgCTkv = { wzrk_selector: selector.selector }\n updateFormData(element, selector.values.form, payload, isPreview)\n }\n }\n\n const tryFindingElement = (selector) => {\n let count = 0\n const intervalId = setInterval(() => {\n const retryElement = document.querySelector(selector.selector)\n if (retryElement) {\n raiseViewed()\n processElement(retryElement, selector)\n clearInterval(intervalId)\n } else if (++count >= 20) {\n console.log(`No element present on DOM with selector '${selector}'.`)\n clearInterval(intervalId)\n }\n }, 500)\n }\n\n details.forEach(d => {\n if (d.url === window.location.href.split('?')[0]) {\n d.selectorData.forEach(s => {\n const element = document.querySelector(s.selector)\n if (element) {\n raiseViewed()\n processElement(element, s)\n } else {\n tryFindingElement(s)\n }\n })\n }\n })\n}\n\n/**\n * Dispatches JSON data.\n * @param {Object} targetingMsgJson - The point and click campaign JSON object.\n * @param {Object} selector - The selector object.\n */\nfunction dispatchJsonData (targetingMsgJson, selector) {\n const inaObj = {}\n inaObj.msgId = targetingMsgJson.wzrk_id\n if (targetingMsgJson.wzrk_pivot) {\n inaObj.pivotId = targetingMsgJson.wzrk_pivot\n }\n if (selector.json != null) {\n inaObj.json = selector.json\n }\n const kvPairsEvent = new CustomEvent('CT_web_native_display_buider', { detail: inaObj })\n document.dispatchEvent(kvPairsEvent)\n}\n\nfunction isValidUrl (string) {\n try {\n const url = new URL(string)\n return Boolean(url)\n } catch (_err) {\n return false\n }\n}\n\nexport function addAntiFlicker (antiFlicker) {\n const { personalizedSelectors = [], delayTime = 2000 } = antiFlicker\n const retryElements = {} // Track selectors that need retry\n let retryCount = 0 // Counter for retries\n let retryInterval\n function isInViewport (element) {\n const rect = element.getBoundingClientRect()\n const { innerHeight: windowHeight, innerWidth: windowWidth } = window\n return (\n rect.bottom > 0 &&\n rect.right > 0 &&\n rect.top < windowHeight &&\n rect.left < windowWidth\n )\n }\n (function () {\n const styleContent = `\n .wve-anti-flicker-hide {\n opacity: 0 !important\n }\n .wve-anti-flicker-show {\n transition: opacity 0.5s, filter 0.5s !important\n }\n `\n // Create and append the style element if it doesn't exist\n const styleId = WVE_CLASS.FLICKER_ID\n if (!document.getElementById(styleId)) {\n const styleElement = document.createElement('style')\n styleElement.id = styleId\n styleElement.textContent = styleContent\n document.head.appendChild(styleElement)\n }\n })()\n function applyAntiFlicker (selectors) {\n function processSelectors (selectorElements) {\n const elements = []\n selectorElements.forEach(selector => {\n const matchedElements = document.querySelectorAll(selector)\n if (matchedElements.length) {\n matchedElements.forEach(el => {\n if (isInViewport(el)) {\n elements.push(el)\n }\n })\n delete retryElements[selector] // Successfully processed, remove from retry list\n } else {\n retryElements[selector] = false // Add to retry list if not found\n }\n })\n applyStyles(elements)\n }\n function retryProcessing () {\n processSelectors(Object.keys(retryElements))\n retryCount++\n if (Object.keys(retryElements).length === 0 || retryCount > 20) {\n retryCount = 0\n clearInterval(retryInterval)\n }\n }\n processSelectors(selectors)\n if (Object.keys(retryElements).length) {\n retryInterval = setInterval(retryProcessing, 100)\n }\n }\n function applyStyles (elements) {\n elements.forEach(el => el.classList.add(WVE_CLASS.FLICKER_HIDE))\n setTimeout(() => {\n elements.forEach(el => {\n el.classList.remove(WVE_CLASS.FLICKER_HIDE)\n el.classList.add(WVE_CLASS.FLICKER_SHOW)\n })\n }, delayTime) // Apply styles after maxRenderTime\n }\n function observeUrlChange () {\n let previousHref = document.location.href\n const observer = new MutationObserver(() => {\n if (previousHref !== document.location.href) {\n previousHref = document.location.href\n applyAntiFlicker(personalizedSelectors)\n }\n })\n observer.observe(document.body, { childList: true, subtree: true })\n }\n window.addEventListener('load', () => {\n observeUrlChange()\n applyAntiFlicker(personalizedSelectors)\n })\n}\n","export class CTWebPersonalisationBanner extends HTMLElement {\n constructor () {\n super()\n this.shadow = this.attachShadow({ mode: 'open' })\n }\n\n _details = null\n shadow = null\n\n get details () {\n return this._details || ''\n }\n\n set details (val) {\n if (this._details === null) {\n this._details = val\n this.renderBanner()\n }\n }\n\n renderBanner () {\n this.shadow.innerHTML = this.getBannerContent()\n if (this.trackClick !== false) {\n this.addEventListener('click', () => {\n const onClickUrl = this.details.onClick\n if (onClickUrl) {\n this.details.window ? window.open(onClickUrl, '_blank') : window.parent.location.href = onClickUrl\n }\n window.clevertap.renderNotificationClicked({ msgId: this.msgId, pivotId: this.pivotId })\n })\n }\n window.clevertap.renderNotificationViewed({ msgId: this.msgId, pivotId: this.pivotId })\n }\n\n getBannerContent () {\n return `\n \n
\n \n \n \n \"Please\n \n ${this.details.html ? this.details.html : ''}\n
\n `\n }\n}\n","import { CTWebPersonalisationBanner } from './banner'\nexport class CTWebPersonalisationCarousel extends HTMLElement {\n constructor () {\n super()\n this.shadow = this.attachShadow({ mode: 'open' })\n if (customElements.get('ct-web-personalisation-banner') === undefined) {\n customElements.define('ct-web-personalisation-banner', CTWebPersonalisationBanner)\n }\n }\n\n _target = null\n _carousel = null\n shadow = null\n slides = 0\n previouslySelectedItem = -1\n selectedItem = 1\n autoSlide = null\n stopAutoSlideTimeout = null\n\n get target () {\n return this._target || ''\n }\n\n set target (val) {\n if (this._target === null) {\n this._target = val\n this.renderCarousel()\n }\n }\n\n get details () {\n return this.target.display.details\n }\n\n get display () {\n return this.target.display\n }\n\n renderCarousel () {\n this.slides = this.details.length\n this.shadow.innerHTML = this.getStyles()\n const carousel = this.getCarouselContent()\n if (this.display.showNavBtns) {\n carousel.insertAdjacentHTML('beforeend', this.display.navBtnsHtml)\n }\n if (this.display.showNavArrows) {\n carousel.insertAdjacentHTML('beforeend', this.display.leftNavArrowHtml)\n carousel.insertAdjacentHTML('beforeend', this.display.rightNavArrowHtml)\n }\n this._carousel = carousel\n this.shadow.appendChild(carousel)\n this.setupClick()\n this.updateSelectedItem()\n // TODO: enable conditionally\n this.startAutoSlide()\n this.setupOnHover()\n window.clevertap.renderNotificationViewed({ msgId: this.target.wzrk_id, pivotId: this.target.wzrk_pivot })\n }\n\n setupClick () {\n this._carousel.addEventListener('click', (event) => {\n const eventID = event.target.id\n if (eventID.startsWith('carousel__button')) {\n const selected = +eventID.split('-')[1]\n if (selected !== this.selectedItem) {\n this.previouslySelectedItem = this.selectedItem\n this.selectedItem = selected\n this.updateSelectedItem()\n this.startAutoSlide()\n }\n } else if (eventID.startsWith('carousel__arrow')) {\n eventID.endsWith('right') ? this.goToNext() : this.goToPrev()\n this.startAutoSlide()\n } else if (eventID.indexOf('-') > -1) {\n const item = +eventID.split('-')[1]\n const index = item - 1\n if (window.parent.clevertap) {\n window.clevertap.renderNotificationClicked({ msgId: this.target.wzrk_id, pivotId: this.target.wzrk_pivot, wzrk_slideNo: item })\n }\n const url = this.details[index].onClick\n if (url !== '') {\n this.details[index].window ? window.open(url, '_blank') : window.location.href = url\n }\n }\n })\n }\n\n setupOnHover () {\n this._carousel.addEventListener('mouseenter', (event) => {\n this.stopAutoSlideTimeout = setTimeout(() => {\n this.autoSlide = clearInterval(this.autoSlide)\n }, 500)\n })\n\n this._carousel.addEventListener('mouseleave', (event) => {\n clearTimeout(this.stopAutoSlideTimeout)\n if (this.autoSlide === undefined) {\n this.startAutoSlide()\n }\n })\n }\n\n getCarouselContent () {\n const carousel = document.createElement('div')\n carousel.setAttribute('class', 'carousel')\n\n this.details.forEach((detail, i) => {\n const banner = document.createElement('ct-web-personalisation-banner')\n banner.classList.add('carousel__item')\n banner.trackClick = false\n banner.setAttribute('id', `carousel__item-${i + 1}`)\n banner.details = detail\n carousel.appendChild(banner)\n })\n\n return carousel\n }\n\n getStyles () {\n return `\n \n `\n }\n\n updateSelectedItem () {\n if (this.previouslySelectedItem !== -1) {\n const prevItem = this.shadow.getElementById(`carousel__item-${this.previouslySelectedItem}`)\n const prevButton = this.shadow.getElementById(`carousel__button-${this.previouslySelectedItem}`)\n prevItem.classList.remove('carousel__item--selected')\n if (prevButton) {\n prevButton.classList.remove('carousel__button--selected')\n }\n }\n const item = this.shadow.getElementById(`carousel__item-${this.selectedItem}`)\n const button = this.shadow.getElementById(`carousel__button-${this.selectedItem}`)\n item.classList.add('carousel__item--selected')\n if (button) {\n button.classList.add('carousel__button--selected')\n }\n }\n\n startAutoSlide () {\n clearInterval(this.autoSlide)\n this.autoSlide = setInterval(() => {\n this.goToNext()\n }, this.display.sliderTime ? this.display.sliderTime * 1000 : 3000)\n }\n\n goToNext () {\n this.goTo(this.selectedItem, (this.selectedItem + 1) % this.slides)\n }\n\n goToPrev () {\n this.goTo(this.selectedItem, this.selectedItem - 1)\n }\n\n goTo (prev, cur) {\n this.previouslySelectedItem = prev\n this.selectedItem = cur\n if (cur === 0) {\n this.selectedItem = this.slides\n }\n this.updateSelectedItem()\n }\n}\n","import { CTWebPersonalisationBanner } from '../web-personalisation/banner'\nimport { CTWebPersonalisationCarousel } from '../web-personalisation/carousel'\n\nexport const renderPersonalisationBanner = (targetingMsgJson) => {\n if (customElements.get('ct-web-personalisation-banner') === undefined) {\n customElements.define('ct-web-personalisation-banner', CTWebPersonalisationBanner)\n }\n const divId = targetingMsgJson.display.divId ?? targetingMsgJson.display.divSelector\n const bannerEl = document.createElement('ct-web-personalisation-banner')\n bannerEl.msgId = targetingMsgJson.wzrk_id\n bannerEl.pivotId = targetingMsgJson.wzrk_pivot\n bannerEl.divHeight = targetingMsgJson.display.divHeight\n bannerEl.details = targetingMsgJson.display.details[0]\n const containerEl = targetingMsgJson.display.divId ? document.getElementById(divId) : document.querySelector(divId)\n containerEl.innerHTML = ''\n containerEl.appendChild(bannerEl)\n}\n\nexport const renderPersonalisationCarousel = (targetingMsgJson) => {\n if (customElements.get('ct-web-personalisation-carousel') === undefined) {\n customElements.define('ct-web-personalisation-carousel', CTWebPersonalisationCarousel)\n }\n const divId = targetingMsgJson.display.divId ?? targetingMsgJson.display.divSelector\n const carousel = document.createElement('ct-web-personalisation-carousel')\n carousel.target = targetingMsgJson\n const container = targetingMsgJson.display.divId ? document.getElementById(divId) : document.querySelector(divId)\n container.innerHTML = ''\n container.appendChild(carousel)\n}\n\nexport const handleKVpairCampaign = (targetingMsgJson) => {\n const inaObj = {}\n inaObj.msgId = targetingMsgJson.wzrk_id\n if (targetingMsgJson.wzrk_pivot) {\n inaObj.pivotId = targetingMsgJson.wzrk_pivot\n }\n if (targetingMsgJson.msgContent.kv != null) {\n inaObj.kv = targetingMsgJson.msgContent.kv\n }\n const kvPairsEvent = new CustomEvent('CT_web_native_display', { detail: inaObj })\n document.dispatchEvent(kvPairsEvent)\n}\n","import { getCampaignObject, saveCampaignObject, closeIframe } from '../clevertap'\nimport { CAMP_COOKIE_G, GCOOKIE_NAME, EV_COOKIE, WZRK_ID, NOTIFICATION_VIEWED } from '../constants'\nimport { StorageManager, $ct } from '../storage'\nimport RequestDispatcher from '../requestDispatcher'\nimport { compressToBase64 } from '../encoder'\n\nexport const invokeExternalJs = (jsFunc, targetingMsgJson) => {\n const func = window.parent[jsFunc]\n if (typeof func === 'function') {\n if (targetingMsgJson.display.kv != null) {\n func(targetingMsgJson.display.kv)\n } else {\n func()\n }\n }\n}\n\nexport const appendScriptForCustomEvent = (targetingMsgJson, html) => {\n const script = `\n `\n return html.replace(/(<\\s*\\/\\s*body)/, `${script}\\n$1`)\n}\n\nexport const staleDataUpdate = (staledata, campType) => {\n const campObj = getCampaignObject()\n const globalObj = campObj[campType].global\n if (globalObj != null && campType) {\n for (const idx in staledata) {\n if (staledata.hasOwnProperty(idx)) {\n delete globalObj[staledata[idx]]\n if (StorageManager.read(CAMP_COOKIE_G)) {\n const guidCampObj = JSON.parse(decodeURIComponent(StorageManager.read(CAMP_COOKIE_G)))\n const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n if (guidCampObj[guid] && guidCampObj[guid][campType] && guidCampObj[guid][campType][staledata[idx]]) {\n delete guidCampObj[guid][campType][staledata[idx]]\n StorageManager.save(CAMP_COOKIE_G, encodeURIComponent(JSON.stringify(guidCampObj)))\n }\n }\n }\n }\n }\n saveCampaignObject(campObj)\n}\n\nexport const mergeEventMap = (newEvtMap) => {\n if ($ct.globalEventsMap == null) {\n $ct.globalEventsMap = StorageManager.readFromLSorCookie(EV_COOKIE)\n if ($ct.globalEventsMap == null) {\n $ct.globalEventsMap = newEvtMap\n return\n }\n }\n for (const key in newEvtMap) {\n if (newEvtMap.hasOwnProperty(key)) {\n const oldEvtObj = $ct.globalEventsMap[key]\n const newEvtObj = newEvtMap[key]\n if ($ct.globalEventsMap[key] != null) {\n if (newEvtObj[0] != null && newEvtObj[0] > oldEvtObj[0]) {\n $ct.globalEventsMap[key] = newEvtObj\n }\n } else {\n $ct.globalEventsMap[key] = newEvtObj\n }\n }\n }\n}\n\nexport const incrementImpression = (targetingMsgJson, _request) => {\n const data = {}\n data.type = 'event'\n data.evtName = NOTIFICATION_VIEWED\n data.evtData = { [WZRK_ID]: targetingMsgJson.wzrk_id }\n if (targetingMsgJson.wzrk_pivot) {\n data.evtData = { ...data.evtData, wzrk_pivot: targetingMsgJson.wzrk_pivot }\n }\n _request.processEvent(data)\n}\n\nexport const setupClickEvent = (onClick, targetingMsgJson, contentDiv, divId, isLegacy, _device, _session) => {\n if (onClick !== '' && onClick != null) {\n let ctaElement\n let jsCTAElements\n if (isLegacy) {\n ctaElement = contentDiv\n } else if (contentDiv !== null) {\n jsCTAElements = contentDiv.getElementsByClassName('jsCT_CTA')\n if (jsCTAElements != null && jsCTAElements.length === 1) {\n ctaElement = jsCTAElements[0]\n }\n }\n const jsFunc = targetingMsgJson.display.jsFunc\n const isPreview = targetingMsgJson.display.preview\n if (isPreview == null) {\n onClick += getCookieParams(_device, _session)\n }\n\n if (ctaElement != null) {\n ctaElement.onclick = () => {\n // invoke js function call\n if (jsFunc != null) {\n // track notification clicked event\n if (isPreview == null) {\n RequestDispatcher.fireRequest(onClick)\n }\n invokeExternalJs(jsFunc, targetingMsgJson)\n // close iframe. using -1 for no campaignId\n closeIframe('-1', divId, _session.sessionId)\n } else {\n const rValue = targetingMsgJson.display.preview ? targetingMsgJson.display.onClick : new URL(targetingMsgJson.display.onClick).searchParams.get('r')\n const campaignId = targetingMsgJson.wzrk_id.split('_')[0]\n\n if (rValue === 'pushPrompt') {\n if (!targetingMsgJson.display.preview) {\n window.parent.clevertap.renderNotificationClicked({ msgId: targetingMsgJson.wzrk_id, pivotId: targetingMsgJson.wzrk_pivot })\n }\n // Open Web Push Soft prompt\n window.clevertap.notifications.push({\n skipDialog: true\n })\n closeIframe(campaignId, divId, _session.sessionId)\n } else if (rValue === 'none') {\n // Close notification\n closeIframe(campaignId, divId, _session.sessionId)\n } else {\n // Will get the url to open\n if (targetingMsgJson.display.window === 1) {\n window.open(onClick, '_blank')\n if (targetingMsgJson.display['close-popup']) {\n closeIframe(campaignId, divId, _session.sessionId)\n }\n if (!targetingMsgJson.display.preview) {\n window.parent.clevertap.renderNotificationClicked({ msgId: targetingMsgJson.wzrk_id, pivotId: targetingMsgJson.wzrk_pivot })\n }\n } else {\n window.location = onClick\n }\n }\n }\n }\n }\n }\n}\n\nexport const getCookieParams = (_device, _session) => {\n const gcookie = _device.getGuid()\n const scookieObj = _session.getSessionCookieObject()\n return '&t=wc&d=' + encodeURIComponent(compressToBase64(gcookie + '|' + scookieObj.p + '|' + scookieObj.s))\n}\n","export const renderPopUpImageOnly = (targetingMsgJson, _session) => {\n const divId = 'wzrkImageOnlyDiv'\n const popupImageOnly = document.createElement('ct-web-popup-imageonly')\n popupImageOnly.session = _session\n popupImageOnly.target = targetingMsgJson\n const containerEl = document.getElementById(divId)\n containerEl.innerHTML = ''\n containerEl.style.visibility = 'hidden'\n containerEl.appendChild(popupImageOnly)\n}\n","export const getBoxPromptStyles = (style) => {\n const totalBorderWidth = style.card.borderEnabled ? style.card.border.borderWidth * 2 : 0\n const cardPadding = 16 * 2 // Left and right padding\n const cardContentWidth = 360 - cardPadding - totalBorderWidth\n\n return `\n #pnWrapper {\n width: 360px;\n }\n\n #pnOverlay {\n background-color: ${style.overlay.color || 'rgba(0, 0, 0, .15)'};\n position: fixed;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n z-index: 10000\n }\n\n #pnCard {\n background-color: ${style.card.color};\n border-radius: ${style.card.borderRadius}px;\n padding: 16px;\n width: ${cardContentWidth}px;\n position: fixed;\n z-index: 999999;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n ${style.card.borderEnabled ? `\n border-width: ${style.card.border.borderWidth}px;\n border-color: ${style.card.border.borderColor};\n border-style: solid;\n ` : ''}\n height: fit-content;\n }\n\n #iconTitleDescWrapper {\n display: flex;\n align-items: center;\n margin-bottom: 16px;\n gap: 12px;\n }\n\n #iconContainer {\n min-width: 64px;\n max-width: 64px;\n aspect-ratio: 1;\n object-fit: cover;\n }\n\n #titleDescWrapper {\n flex-grow: 1;\n overflow: hidden;\n overflow-wrap: break-word;\n }\n\n #title {\n font-size: 16px;\n font-weight: 700;\n color: ${style.text.titleColor};\n margin-bottom: 4px;\n line-height: 24px;\n }\n\n #description {\n font-size: 14px;\n font-weight: 500;\n color: ${style.text.descriptionColor};\n line-height: 20px;\n }\n\n #buttonsContainer {\n display: flex;\n justify-content: space-between;\n min-height: 32px;\n gap: 8px;\n align-items: center;\n }\n\n #primaryButton, #secondaryButton {\n padding: 6px 24px;\n flex: 1;\n cursor: pointer;\n font-weight: bold;\n display: flex;\n align-items: center;\n justify-content: center;\n height: max-content;\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n }\n\n #primaryButton {\n background-color: ${style.buttons.primaryButton.buttonColor};\n color: ${style.buttons.primaryButton.textColor};\n border-radius: ${style.buttons.primaryButton.borderRadius}px;\n ${style.buttons.primaryButton.borderEnabled\n ? `\n border-width: ${style.buttons.primaryButton.border.borderWidth}px;\n border-color: ${style.buttons.primaryButton.border.borderColor};\n border-style: solid;\n `\n : 'border: none;'}\n }\n\n #secondaryButton {\n background-color: ${style.buttons.secondaryButton.buttonColor};\n color: ${style.buttons.secondaryButton.textColor};\n border-radius: ${style.buttons.secondaryButton.borderRadius}px;\n ${style.buttons.secondaryButton.borderEnabled\n ? `\n border-width: ${style.buttons.secondaryButton.border.borderWidth}px;\n border-color: ${style.buttons.secondaryButton.border.borderColor};\n border-style: solid;\n `\n : 'border: none;'}\n }\n\n #primaryButton:hover, #secondaryButton:hover {\n opacity: 0.9;\n }\n `\n}\n\nexport const getBellIconStyles = (style) => {\n return `\n #bell_wrapper {\n position: fixed;\n cursor: pointer;\n background-color: ${style.card.backgroundColor};\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n width: 48px;\n height: 48px;\n border-radius: 50%;\n display: flex;\n flex-direction: column;\n gap: 8px;\n z-index: 999999;\n }\n\n #bell_icon {\n display: block;\n width: 48px;\n height: 48px;\n }\n\n #bell_wrapper:hover {\n transform: scale(1.05);\n transition: transform 0.2s ease-in-out;\n }\n\n #bell_tooltip {\n display: none;\n background-color: #2b2e3e;\n color: #fff;\n border-radius: 4px;\n padding: 4px;\n white-space: nowrap;\n pointer-events: none;\n font-size: 14px;\n line-height: 1.4;\n }\n\n #gif_modal {\n display: none;\n background-color: #ffffff;\n padding: 4px;\n width: 400px;\n height: 256px;\n border-radius: 4px;\n position: relative;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n cursor: default;\n }\n\n #gif_image {\n object-fit: contain;\n width: 100%;\n height: 100%;\n }\n\n #close_modal {\n position: absolute;\n width: 24px;\n height: 24px;\n top: 8px;\n right: 8px;\n background: rgba(238, 238, 238, 0.8);\n text-align: center;\n line-height: 20px;\n border-radius: 4px;\n color: #000000;\n font-size: 22px;\n cursor: pointer;\n }\n `\n}\n","import { StorageManager, $ct } from '../util/storage'\nimport { isObject } from '../util/datatypes'\nimport {\n PUSH_SUBSCRIPTION_DATA\n} from '../util/constants'\nimport {\n urlBase64ToUint8Array\n} from '../util/encoder'\nimport { enablePush } from './webPushPrompt/prompt'\n\nexport default class NotificationHandler extends Array {\n #oldValues\n #logger\n #request\n #account\n #wizAlertJSPath\n #fcmPublicKey\n\n constructor ({\n logger,\n session,\n request,\n account\n }, values) {\n super()\n this.#wizAlertJSPath = 'https://d2r1yp2w7bby2u.cloudfront.net/js/wzrk_dialog.min.js'\n this.#fcmPublicKey = null\n this.#oldValues = values\n this.#logger = logger\n this.#request = request\n this.#account = account\n }\n\n push (...displayArgs) {\n this.#setUpWebPush(displayArgs)\n return 0\n }\n\n enable (options = {}) {\n const { swPath } = options\n enablePush(this.#logger, this.#account, this.#request, swPath)\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#setUpWebPush(this.#oldValues)\n }\n this.#oldValues = null\n }\n\n #setUpWebPush (displayArgs) {\n if ($ct.webPushEnabled && displayArgs.length > 0) {\n this.#handleNotificationRegistration(displayArgs)\n } else if ($ct.webPushEnabled == null && displayArgs.length > 0) {\n $ct.notifApi.notifEnabledFromApi = true\n $ct.notifApi.displayArgs = displayArgs.slice()\n } else if ($ct.webPushEnabled === false && displayArgs.length > 0) {\n this.#logger.error('Make sure push notifications are fully enabled and integrated')\n }\n }\n\n setUpWebPushNotifications (subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsServiceUrl) {\n if (navigator.userAgent.indexOf('Chrome') !== -1 || navigator.userAgent.indexOf('Firefox') !== -1) {\n this.#setUpChromeFirefoxNotifications(subscriptionCallback, serviceWorkerPath)\n } else if (navigator.userAgent.indexOf('Safari') !== -1) {\n this.#setUpSafariNotifications(subscriptionCallback, apnsWebPushId, apnsServiceUrl)\n }\n }\n\n setApplicationServerKey (applicationServerKey) {\n this.#fcmPublicKey = applicationServerKey\n }\n\n #setUpSafariNotifications (subscriptionCallback, apnsWebPushId, apnsServiceUrl) {\n // ensure that proper arguments are passed\n if (typeof apnsWebPushId === 'undefined') {\n this.#logger.error('Ensure that APNS Web Push ID is supplied')\n }\n if (typeof apnsServiceUrl === 'undefined') {\n this.#logger.error('Ensure that APNS Web Push service path is supplied')\n }\n if ('safari' in window && 'pushNotification' in window.safari) {\n window.safari.pushNotification.requestPermission(\n apnsServiceUrl,\n apnsWebPushId, {}, (subscription) => {\n if (subscription.permission === 'granted') {\n const subscriptionData = JSON.parse(JSON.stringify(subscription))\n subscriptionData.endpoint = subscription.deviceToken\n subscriptionData.browser = 'Safari'\n StorageManager.saveToLSorCookie(PUSH_SUBSCRIPTION_DATA, subscriptionData)\n\n this.#request.registerToken(subscriptionData)\n this.#logger.info('Safari Web Push registered. Device Token: ' + subscription.deviceToken)\n } else if (subscription.permission === 'denied') {\n this.#logger.info('Error subscribing to Safari web push')\n }\n })\n }\n }\n\n /**\n * Sets up a service worker for WebPush(chrome/Firefox) push notifications and sends the data to LC\n */\n #setUpChromeFirefoxNotifications (subscriptionCallback, serviceWorkerPath) {\n let registrationScope = ''\n\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.register(serviceWorkerPath).then((registration) => {\n if (typeof __wzrk_account_id !== 'undefined') { // eslint-disable-line\n // shopify accounts , since the service worker is not at root, serviceWorker.ready is never resolved.\n // hence add a timeout and hope serviceWroker is ready within that time.\n return new Promise(resolve => setTimeout(() => resolve(registration), 5000))\n }\n registrationScope = registration.scope\n\n // IF SERVICE WORKER IS AT ROOT, RETURN THE READY PROMISE\n // ELSE IF CHROME RETURN PROMISE AFTER 5 SECONDS\n // OR getRegistrations PROMISE IF ITS FIREFOX\n const rootDirRegex = /^(\\.?)(\\/?)([^/]*).js$/\n const isServiceWorkerAtRoot = rootDirRegex.test(serviceWorkerPath)\n if (isServiceWorkerAtRoot) {\n return navigator.serviceWorker.ready\n } else {\n if (navigator.userAgent.indexOf('Chrome') !== -1) {\n return new Promise(resolve => setTimeout(() => resolve(registration), 5000))\n } else {\n return navigator.serviceWorker.getRegistrations()\n }\n }\n }).then((serviceWorkerRegistration) => {\n // ITS AN ARRAY IN CASE OF FIREFOX, SO USE THE REGISTRATION WITH PROPER SCOPE\n if (navigator.userAgent.indexOf('Firefox') !== -1 && Array.isArray(serviceWorkerRegistration)) {\n serviceWorkerRegistration = serviceWorkerRegistration.filter((i) => i.scope === registrationScope)[0]\n }\n const subscribeObj = { userVisibleOnly: true }\n\n if (this.#fcmPublicKey != null) {\n subscribeObj.applicationServerKey = urlBase64ToUint8Array(this.#fcmPublicKey)\n }\n\n serviceWorkerRegistration.pushManager.subscribe(subscribeObj)\n .then((subscription) => {\n this.#logger.info('Service Worker registered. Endpoint: ' + subscription.endpoint)\n\n // convert the subscription keys to strings; this sets it up nicely for pushing to LC\n const subscriptionData = JSON.parse(JSON.stringify(subscription))\n\n // remove the common chrome/firefox endpoint at the beginning of the token\n if (navigator.userAgent.indexOf('Chrome') !== -1) {\n subscriptionData.endpoint = subscriptionData.endpoint.split('/').pop()\n subscriptionData.browser = 'Chrome'\n } else if (navigator.userAgent.indexOf('Firefox') !== -1) {\n subscriptionData.endpoint = subscriptionData.endpoint.split('/').pop()\n subscriptionData.browser = 'Firefox'\n }\n StorageManager.saveToLSorCookie(PUSH_SUBSCRIPTION_DATA, subscriptionData)\n this.#request.registerToken(subscriptionData)\n\n if (typeof subscriptionCallback !== 'undefined' && typeof subscriptionCallback === 'function') {\n subscriptionCallback()\n }\n const existingBellWrapper = document.getElementById('bell_wrapper')\n if (existingBellWrapper) {\n existingBellWrapper.parentNode.removeChild(existingBellWrapper)\n }\n }).catch((error) => {\n // unsubscribe from webpush if error\n serviceWorkerRegistration.pushManager.getSubscription().then((subscription) => {\n if (subscription !== null) {\n subscription.unsubscribe().then((successful) => {\n // You've successfully unsubscribed\n this.#logger.info('Unsubscription successful')\n window.clevertap.notifications.push({\n skipDialog: true\n })\n }).catch((e) => {\n // Unsubscription failed\n this.#logger.error('Error unsubscribing: ' + e)\n })\n }\n })\n this.#logger.error('Error subscribing: ' + error)\n })\n }).catch((err) => {\n this.#logger.error('error registering service worker: ' + err)\n })\n }\n }\n\n #addWizAlertJS () {\n const scriptTag = document.createElement('script')\n scriptTag.setAttribute('type', 'text/javascript')\n scriptTag.setAttribute('id', 'wzrk-alert-js')\n scriptTag.setAttribute('src', this.#wizAlertJSPath)\n\n // add the script tag to the end of the body\n document.getElementsByTagName('body')[0].appendChild(scriptTag)\n\n return scriptTag\n }\n\n #removeWizAlertJS () {\n const scriptTag = document.getElementById('wzrk-alert-js')\n scriptTag.parentNode.removeChild(scriptTag)\n }\n\n #handleNotificationRegistration (displayArgs) {\n // make sure everything is specified\n let titleText\n let bodyText\n let okButtonText\n let rejectButtonText\n let okButtonColor\n let skipDialog\n let askAgainTimeInSeconds\n let okCallback\n let rejectCallback\n let subscriptionCallback\n let serviceWorkerPath\n let httpsPopupPath\n let httpsIframePath\n let apnsWebPushId\n let apnsWebPushServiceUrl\n\n if (displayArgs.length === 1) {\n if (isObject(displayArgs[0])) {\n const notifObj = displayArgs[0]\n titleText = notifObj.titleText\n bodyText = notifObj.bodyText\n okButtonText = notifObj.okButtonText\n rejectButtonText = notifObj.rejectButtonText\n okButtonColor = notifObj.okButtonColor\n skipDialog = notifObj.skipDialog\n askAgainTimeInSeconds = notifObj.askAgainTimeInSeconds\n okCallback = notifObj.okCallback\n rejectCallback = notifObj.rejectCallback\n subscriptionCallback = notifObj.subscriptionCallback\n serviceWorkerPath = notifObj.serviceWorkerPath\n httpsPopupPath = notifObj.httpsPopupPath\n httpsIframePath = notifObj.httpsIframePath\n apnsWebPushId = notifObj.apnsWebPushId\n apnsWebPushServiceUrl = notifObj.apnsWebPushServiceUrl\n }\n } else {\n titleText = displayArgs[0]\n bodyText = displayArgs[1]\n okButtonText = displayArgs[2]\n rejectButtonText = displayArgs[3]\n okButtonColor = displayArgs[4]\n skipDialog = displayArgs[5]\n askAgainTimeInSeconds = displayArgs[6]\n }\n\n if (skipDialog == null) {\n skipDialog = false\n }\n\n if (serviceWorkerPath == null) {\n serviceWorkerPath = '/clevertap_sw.js'\n }\n\n // ensure that the browser supports notifications\n if (typeof navigator.serviceWorker === 'undefined') {\n return\n }\n\n const isHTTP = httpsPopupPath != null && httpsIframePath != null\n\n // make sure the site is on https for chrome notifications\n if (window.location.protocol !== 'https:' && document.location.hostname !== 'localhost' && !isHTTP) {\n this.#logger.error('Make sure you are https or localhost to register for notifications')\n return\n }\n\n // right now, we only support Chrome V50 & higher & Firefox\n if (navigator.userAgent.indexOf('Chrome') !== -1) {\n const chromeAgent = navigator.userAgent.match(/Chrome\\/(\\d+)/)\n if (chromeAgent == null || parseInt(chromeAgent[1], 10) < 50) { return }\n } else if (navigator.userAgent.indexOf('Firefox') !== -1) {\n const firefoxAgent = navigator.userAgent.match(/Firefox\\/(\\d+)/)\n if (firefoxAgent == null || parseInt(firefoxAgent[1], 10) < 50) { return }\n } else if (navigator.userAgent.indexOf('Safari') !== -1) {\n const safariAgent = navigator.userAgent.match(/Safari\\/(\\d+)/)\n if (safariAgent == null || parseInt(safariAgent[1], 10) < 50) { return }\n } else {\n return\n }\n\n // we check for the cookie in setUpChromeNotifications() the tokens may have changed\n\n if (!isHTTP) {\n if (Notification == null) {\n return\n }\n // handle migrations from other services -> chrome notifications may have already been asked for before\n if (Notification.permission === 'granted') {\n // skip the dialog and register\n this.setUpWebPushNotifications(subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsWebPushServiceUrl)\n return\n } else if (Notification.permission === 'denied') {\n // we've lost this profile :'(\n return\n }\n\n if (skipDialog) {\n this.setUpWebPushNotifications(subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsWebPushServiceUrl)\n return\n }\n }\n\n // make sure the right parameters are passed\n if (!titleText || !bodyText || !okButtonText || !rejectButtonText) {\n this.#logger.error('Missing input parameters; please specify title, body, ok button and cancel button text')\n return\n }\n\n // make sure okButtonColor is formatted properly\n if (okButtonColor == null || !okButtonColor.match(/^#[a-f\\d]{6}$/i)) {\n okButtonColor = '#f28046' // default color for positive button\n }\n\n // make sure the user isn't asked for notifications more than askAgainTimeInSeconds\n const now = new Date().getTime() / 1000\n if ((StorageManager.getMetaProp('notif_last_time')) == null) {\n StorageManager.setMetaProp('notif_last_time', now)\n } else {\n if (askAgainTimeInSeconds == null) {\n // 7 days by default\n askAgainTimeInSeconds = 7 * 24 * 60 * 60\n }\n\n if (now - StorageManager.getMetaProp('notif_last_time') < askAgainTimeInSeconds) {\n return\n } else {\n // continue asking\n StorageManager.setMetaProp('notif_last_time', now)\n }\n }\n\n if (isHTTP) {\n // add the https iframe\n const httpsIframe = document.createElement('iframe')\n httpsIframe.setAttribute('style', 'display:none;')\n httpsIframe.setAttribute('src', httpsIframePath)\n document.body.appendChild(httpsIframe)\n window.addEventListener('message', (event) => {\n if (event.data != null) {\n let obj = {}\n try {\n obj = JSON.parse(event.data)\n } catch (e) {\n // not a call from our iframe\n return\n }\n if (obj.state != null) {\n if (obj.from === 'ct' && obj.state === 'not') {\n this.#addWizAlertJS().onload = () => {\n // create our wizrocket popup\n window.wzrkPermissionPopup.wizAlert({\n title: titleText,\n body: bodyText,\n confirmButtonText: okButtonText,\n confirmButtonColor: okButtonColor,\n rejectButtonText: rejectButtonText\n }, (enabled) => { // callback function\n if (enabled) {\n // the user accepted on the dialog box\n if (typeof okCallback === 'function') {\n okCallback()\n }\n // redirect to popup.html\n window.open(httpsPopupPath)\n } else {\n if (typeof rejectCallback === 'function') {\n rejectCallback()\n }\n }\n this.#removeWizAlertJS()\n })\n }\n }\n }\n }\n }, false)\n } else {\n this.#addWizAlertJS().onload = () => {\n // create our wizrocket popup\n window.wzrkPermissionPopup.wizAlert({\n title: titleText,\n body: bodyText,\n confirmButtonText: okButtonText,\n confirmButtonColor: okButtonColor,\n rejectButtonText: rejectButtonText\n }, (enabled) => { // callback function\n if (enabled) {\n // the user accepted on the dialog box\n if (typeof okCallback === 'function') {\n okCallback()\n }\n this.setUpWebPushNotifications(subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsWebPushServiceUrl)\n } else {\n if (typeof rejectCallback === 'function') {\n rejectCallback()\n }\n }\n this.#removeWizAlertJS()\n })\n }\n }\n }\n\n _enableWebPush (enabled, applicationServerKey) {\n $ct.webPushEnabled = enabled\n if (applicationServerKey != null) {\n this.setApplicationServerKey(applicationServerKey)\n }\n if ($ct.webPushEnabled && $ct.notifApi.notifEnabledFromApi) {\n this.#handleNotificationRegistration($ct.notifApi.displayArgs)\n } else if (!$ct.webPushEnabled && $ct.notifApi.notifEnabledFromApi) {\n this.#logger.error('Ensure that web push notifications are fully enabled and integrated before requesting them')\n }\n }\n}\n","export const BELL_BASE64 = 'PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0d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gMjIuMzk4NCAzOC43NiAyMi4zOTg0IDM5LjU3NDZDMjIuMzk4NCA0MC4zODkzIDIzLjA1ODkgNDEuMDQ5NyAyMy44NzM1IDQxLjA0OTdIMjkuNzgxMlY0MS43ODQyQzI5Ljc4MTIgNDMuMDA3NyAzMC43NzMxIDQzLjk5OTYgMzEuOTk2NiA0My45OTk2QzMzLjIyMDIgNDMuOTk5NiAzNC4yMTIgNDMuMDA3NyAzNC4yMTIgNDEuNzg0MlY0MS4wNDk3SDQwLjEyMzNDNDAuOTM4IDQxLjA0OTcgNDEuNTk4NCA0MC4zODkzIDQxLjU5ODQgMzkuNTc0NkM0MS41OTg0IDM4Ljc2IDQwLjkzOCAzOC4wOTk1IDQwLjEyMzMgMzguMDk5NUg0MC4xMjEyVjI5LjI1ODJDNDAuMTIxMiAyNS41OTQ2IDM3LjQ1MzMgMjIuNTU0MiAzMy45NTQzIDIxLjk3MzZMMzMuOTU0NCAyMS45NTM0QzMzLjk1NDQgMjAuODc0NiAzMy4wNzc1IDIwIDMxLjk5ODYgMjBaIiBmaWxsPSJ3aGl0ZSIvPgo8cmVjdCBvcGFjaXR5PSIwLjUiIHg9IjcuNSIgeT0iNy41IiB3aWR0aD0iNDkiIGhlaWdodD0iNDkiIHJ4PSIyNC41IiBzdHJva2U9IndoaXRlIi8+CjxyZWN0IG9wYWNpdHk9IjAuMyIgeD0iNC41IiB5PSI0LjUiIHdpZHRoPSI1NSIgaGVpZ2h0PSI1NSIgcng9IjI3LjUiIHN0cm9rZT0id2hpdGUiLz4KPHJlY3Qgb3BhY2l0eT0iMC44IiB4PSIxMC41IiB5PSIxMC41IiB3aWR0aD0iNDMiIGhlaWdodD0iNDMiIHJ4PSIyMS41IiBzdHJva2U9IndoaXRlIi8+Cjwvc3ZnPgo='\n","import { getBellIconStyles, getBoxPromptStyles } from './promptStyles.js'\nimport { WEBPUSH_CONFIG } from '../../util/constants.js'\nimport { StorageManager, $ct } from '../../util/storage.js'\nimport NotificationHandler from '../notification.js'\nimport { BELL_BASE64, PROMPT_BELL_BASE64 } from './promptConstants.js'\n\nlet appServerKey = null\nlet swPath = '/clevertap_sw.js'\nlet notificationHandler = null\n\nexport const processWebPushConfig = (webPushConfig, logger, request) => {\n const _pushConfig = StorageManager.readFromLSorCookie(WEBPUSH_CONFIG) || {}\n\n const updatePushConfig = () => {\n $ct.pushConfig = webPushConfig\n StorageManager.saveToLSorCookie(WEBPUSH_CONFIG, webPushConfig)\n }\n\n if (webPushConfig.isPreview) {\n updatePushConfig()\n enablePush(logger, null, request)\n } else if (JSON.stringify(_pushConfig) !== JSON.stringify(webPushConfig)) {\n updatePushConfig()\n }\n}\n\nexport const enablePush = (logger, account, request, customSwPath) => {\n const _pushConfig = StorageManager.readFromLSorCookie(WEBPUSH_CONFIG) || {}\n $ct.pushConfig = _pushConfig\n if (!$ct.pushConfig) {\n logger.error('Web Push config data not present')\n return\n }\n\n if (customSwPath) { swPath = customSwPath }\n\n notificationHandler = new NotificationHandler({ logger, session: {}, request, account })\n const { showBox, boxType, showBellIcon, isPreview } = $ct.pushConfig\n\n if (isPreview) {\n if ($ct.pushConfig.boxConfig) createNotificationBox($ct.pushConfig)\n if ($ct.pushConfig.bellIconConfig) createBellIcon($ct.pushConfig)\n } else {\n if (showBox && boxType === 'new') createNotificationBox($ct.pushConfig)\n if (showBellIcon) createBellIcon($ct.pushConfig)\n }\n}\n\nconst createElementWithAttributes = (tag, attributes = {}) => {\n const element = document.createElement(tag)\n Object.entries(attributes).forEach(([key, value]) => {\n element[key] = value\n })\n return element\n}\n\nexport const createNotificationBox = (configData) => {\n if (document.getElementById('pnWrapper')) return\n\n const { boxConfig: { content, style } } = configData\n\n // Create the wrapper div\n const wrapper = createElementWithAttributes('div', { id: 'pnWrapper' })\n const overlayDiv = createElementWithAttributes('div', { id: 'pnOverlay' })\n const pnCard = createElementWithAttributes('div', { id: 'pnCard' })\n\n const iconTitleDescWrapper = createElementWithAttributes('div', { id: 'iconTitleDescWrapper' })\n const iconContainer = createElementWithAttributes('img', {\n id: 'iconContainer',\n src: content.icon.type === 'default' ? `data:image/svg+xml;base64,${PROMPT_BELL_BASE64}` : content.icon.url\n })\n\n iconTitleDescWrapper.appendChild(iconContainer)\n\n const titleDescWrapper = createElementWithAttributes('div', { id: 'titleDescWrapper' })\n titleDescWrapper.appendChild(createElementWithAttributes('div', { id: 'title', textContent: content.title }))\n titleDescWrapper.appendChild(createElementWithAttributes('div', { id: 'description', textContent: content.description }))\n\n iconTitleDescWrapper.appendChild(titleDescWrapper)\n\n const buttonsContainer = createElementWithAttributes('div', { id: 'buttonsContainer' })\n\n const primaryButton = createElementWithAttributes('button', {\n id: 'primaryButton',\n textContent: content.buttons.primaryButtonText\n })\n const secondaryButton = createElementWithAttributes('button', {\n id: 'secondaryButton',\n textContent: content.buttons.secondaryButtonText\n })\n buttonsContainer.appendChild(secondaryButton)\n buttonsContainer.appendChild(primaryButton)\n\n pnCard.appendChild(iconTitleDescWrapper)\n pnCard.appendChild(buttonsContainer)\n\n // Apply styles\n const styleElement = createElementWithAttributes('style', { textContent: getBoxPromptStyles(style) })\n\n wrapper.appendChild(styleElement)\n wrapper.appendChild(pnCard)\n wrapper.appendChild(overlayDiv)\n\n setElementPosition(pnCard, style.card.position)\n\n const now = new Date().getTime() / 1000\n const lastNotifTime = StorageManager.getMetaProp('webpush_last_notif_time')\n const popupFrequency = content.popupFrequency || 7 * 24 * 60 * 60\n\n if (!lastNotifTime || now - lastNotifTime >= popupFrequency * 24 * 60 * 60) {\n document.body.appendChild(wrapper)\n if (!configData.isPreview) { addEventListeners(wrapper) }\n }\n}\n\nexport const createBellIcon = (configData) => {\n if (document.getElementById('bell_wrapper') || Notification.permission === 'granted') return\n\n const { bellIconConfig: { content, style } } = configData\n\n const bellWrapper = createElementWithAttributes('div', { id: 'bell_wrapper' })\n const bellIcon = createElementWithAttributes('img', {\n id: 'bell_icon',\n src: content.icon.type === 'default' ? `data:image/svg+xml;base64,${BELL_BASE64}` : content.icon.url\n })\n\n // For playing gif\n const gifModal = createElementWithAttributes('div', { id: 'gif_modal', style: 'display: none;' })\n const gifImage = createElementWithAttributes('img', {\n id: 'gif_image',\n src: 'https://d2r1yp2w7bby2u.cloudfront.net/js/permission_grant.gif'\n })\n const closeModal = createElementWithAttributes('div', { id: 'close_modal', innerHTML: '×' })\n\n gifModal.appendChild(gifImage)\n gifModal.appendChild(closeModal)\n\n bellWrapper.appendChild(bellIcon)\n bellWrapper.appendChild(gifModal)\n if (content.hoverText.enabled) {\n const tooltip = createElementWithAttributes('div', {\n id: 'bell_tooltip',\n textContent: content.hoverText.text\n })\n bellWrapper.appendChild(tooltip)\n }\n\n setElementPosition(bellWrapper, style.card.position)\n // Apply styles\n const styleElement = createElementWithAttributes('style', { textContent: getBellIconStyles(style) })\n\n document.head.appendChild(styleElement)\n document.body.appendChild(bellWrapper)\n\n if (!configData.isPreview) {\n addBellEventListeners(bellWrapper)\n }\n return bellWrapper\n}\n\nexport const setServerKey = (serverKey) => {\n appServerKey = serverKey\n}\n\nexport const addEventListeners = (wrapper) => {\n const primaryButton = wrapper.querySelector('#primaryButton')\n const secondaryButton = wrapper.querySelector('#secondaryButton')\n\n const removeWrapper = () => wrapper.parentNode?.removeChild(wrapper)\n\n primaryButton.addEventListener('click', () => {\n removeWrapper()\n notificationHandler.setApplicationServerKey(appServerKey)\n notificationHandler.setUpWebPushNotifications(null, swPath, null, null)\n })\n\n secondaryButton.addEventListener('click', () => {\n StorageManager.setMetaProp('webpush_last_notif_time', Date.now() / 1000)\n removeWrapper()\n })\n}\n\nexport const addBellEventListeners = (bellWrapper) => {\n const bellIcon = bellWrapper.querySelector('#bell_icon')\n bellIcon.addEventListener('click', () => {\n if (Notification.permission === 'denied') {\n toggleGifModal(bellWrapper)\n } else {\n notificationHandler.setApplicationServerKey(appServerKey)\n notificationHandler.setUpWebPushNotifications(null, swPath, null, null)\n if (Notification.permission === 'granted') {\n bellWrapper.remove()\n }\n }\n })\n bellIcon.addEventListener('mouseenter', () => displayTooltip(bellWrapper))\n bellIcon.addEventListener('mouseleave', () => clearTooltip(bellWrapper))\n bellWrapper.querySelector('#close_modal').addEventListener('click', () => toggleGifModal(bellWrapper))\n}\n\nexport const setElementPosition = (element, position) => {\n Object.assign(element.style, {\n inset: 'auto',\n transform: 'none'\n })\n\n const positions = {\n 'Top Right': { inset: '16px 16px auto auto' },\n 'Top Left': { inset: '16px auto auto 16px' },\n 'Bottom Right': { inset: 'auto 16px 16px auto' },\n 'Bottom Left': { inset: 'auto auto 16px 16px' },\n Center: { inset: '50%', transform: 'translate(-50%, -50%)' },\n Top: { inset: '16px auto auto 50%', transform: 'translateX(-50%)' },\n Bottom: { inset: 'auto auto 16px 50%', transform: 'translateX(-50%)' }\n }\n\n Object.assign(element.style, positions[position] || positions['top-right'])\n}\n\nconst displayTooltip = (bellWrapper) => {\n const gifModal = bellWrapper.querySelector('#gif_modal')\n if (gifModal.style.display === 'flex') {\n return\n }\n const tooltip = bellWrapper.querySelector('#bell_tooltip')\n if (tooltip) {\n tooltip.style.display = 'flex'\n }\n\n const bellIcon = bellWrapper.querySelector('#bell_icon')\n const bellRect = bellIcon.getBoundingClientRect()\n var midX = window.innerWidth / 2\n var midY = window.innerHeight / 2\n bellWrapper.style['flex-direction'] = bellRect.y > midY ? 'column-reverse' : 'column'\n bellWrapper.style['align-items'] = bellRect.x > midX ? 'flex-end' : 'flex-start'\n}\n\nconst clearTooltip = (bellWrapper) => {\n const tooltip = bellWrapper.querySelector('#bell_tooltip')\n if (tooltip) {\n tooltip.style.display = 'none'\n }\n}\n\nconst toggleGifModal = (bellWrapper) => {\n clearTooltip(bellWrapper)\n const gifModal = bellWrapper.querySelector('#gif_modal')\n gifModal.style.display = gifModal.style.display === 'none' ? 'flex' : 'none'\n}\n","import {\n addToLocalProfileMap,\n arp,\n getCampaignObject,\n saveCampaignObject\n} from './clevertap'\n\nimport {\n CAMP_COOKIE_NAME,\n DISPLAY,\n GLOBAL,\n EV_COOKIE,\n NOTIFICATION_CLICKED,\n WZRK_PREFIX,\n WZRK_ID\n} from './constants'\n\nimport {\n getNow,\n getToday\n} from './datetime'\n\nimport { StorageManager, $ct } from './storage'\nimport RequestDispatcher from './requestDispatcher'\nimport { CTWebPopupImageOnly } from './web-popupImageonly/popupImageonly'\nimport { checkAndRegisterWebInboxElements, initializeWebInbox, processWebInboxSettings, hasWebInboxSettingsInLS, processInboxNotifs } from '../modules/web-inbox/helper'\nimport { renderVisualBuilder } from '../modules/visualBuilder/pageBuilder'\nimport { handleKVpairCampaign, renderPersonalisationBanner, renderPersonalisationCarousel } from './campaignRender/nativeDisplay'\nimport { appendScriptForCustomEvent, getCookieParams, incrementImpression, invokeExternalJs, mergeEventMap, setupClickEvent, staleDataUpdate } from './campaignRender/utilities'\nimport { renderPopUpImageOnly } from './campaignRender/webPopup'\nimport { processWebPushConfig } from '../modules/webPushPrompt/prompt'\n\nconst _tr = (msg, {\n device,\n session,\n request,\n logger\n}) => {\n const _device = device\n const _session = session\n const _request = request\n const _logger = logger\n let _wizCounter = 0\n // Campaign House keeping\n const doCampHouseKeeping = (targetingMsgJson) => {\n const campaignId = targetingMsgJson.wzrk_id.split('_')[0]\n const today = getToday()\n\n const incrCount = (obj, campaignId, excludeFromFreqCaps) => {\n let currentCount = 0\n let totalCount = 0\n if (obj[campaignId] != null) {\n currentCount = obj[campaignId]\n }\n currentCount++\n if (obj.tc != null) {\n totalCount = obj.tc\n }\n // if exclude from caps then dont add to total counts\n if (excludeFromFreqCaps < 0) {\n totalCount++\n }\n\n obj.tc = totalCount\n obj[campaignId] = currentCount\n }\n\n if (StorageManager._isLocalStorageSupported()) {\n delete sessionStorage[CAMP_COOKIE_NAME]\n var campTypeObj = {}\n const campObj = getCampaignObject()\n if (targetingMsgJson.display.wtarget_type === 3 && campObj.hasOwnProperty('wi')) {\n campTypeObj = campObj.wi\n } else if ((targetingMsgJson.display.wtarget_type === 0 || targetingMsgJson.display.wtarget_type === 1) && campObj.hasOwnProperty('wp')) {\n campTypeObj = campObj.wp\n } else {\n campTypeObj = {}\n }\n if (campObj.hasOwnProperty('global')) {\n campTypeObj.wp = campObj\n }\n // global session limit. default is 1\n if (targetingMsgJson[DISPLAY].wmc == null) {\n targetingMsgJson[DISPLAY].wmc = 1\n }\n\n // global session limit for web inbox. default is 1\n if (targetingMsgJson[DISPLAY].wimc == null) {\n targetingMsgJson[DISPLAY].wimc = 1\n }\n\n var excludeFromFreqCaps = -1 // efc - Exclude from frequency caps\n let campaignSessionLimit = -1 // mdc - Once per session\n let campaignDailyLimit = -1 // tdc - Once per day\n let campaignTotalLimit = -1 // tlc - Once per user for the duration of campaign\n let totalDailyLimit = -1\n let totalSessionLimit = -1 // wmc - Web Popup Global Session Limit\n let totalInboxSessionLimit = -1 // wimc - Web Inbox Global Session Limit\n\n if (targetingMsgJson[DISPLAY].efc != null) { // exclude from frequency cap\n excludeFromFreqCaps = parseInt(targetingMsgJson[DISPLAY].efc, 10)\n }\n if (targetingMsgJson[DISPLAY].mdc != null) { // Campaign Session Limit\n campaignSessionLimit = parseInt(targetingMsgJson[DISPLAY].mdc, 10)\n }\n if (targetingMsgJson[DISPLAY].tdc != null) { // No of web popups in a day per campaign\n campaignDailyLimit = parseInt(targetingMsgJson[DISPLAY].tdc, 10)\n }\n if (targetingMsgJson[DISPLAY].tlc != null) { // Total lifetime count\n campaignTotalLimit = parseInt(targetingMsgJson[DISPLAY].tlc, 10)\n }\n if (targetingMsgJson[DISPLAY].wmp != null) { // No of campaigns per day\n totalDailyLimit = parseInt(targetingMsgJson[DISPLAY].wmp, 10)\n }\n if (targetingMsgJson[DISPLAY].wmc != null) { // No of campaigns per session\n totalSessionLimit = parseInt(targetingMsgJson[DISPLAY].wmc, 10)\n }\n\n if (targetingMsgJson[DISPLAY].wimc != null) { // No of inbox campaigns per session\n totalInboxSessionLimit = parseInt(targetingMsgJson[DISPLAY].wimc, 10)\n }\n // session level capping\n var sessionObj = campTypeObj[_session.sessionId]\n if (sessionObj) {\n const campaignSessionCount = sessionObj[campaignId]\n const totalSessionCount = sessionObj.tc\n // dnd\n if (campaignSessionCount === 'dnd' && !$ct.dismissSpamControl) {\n return false\n }\n\n if (targetingMsgJson[DISPLAY].wtarget_type === 3) {\n // Inbox session\n if (totalInboxSessionLimit > 0 && totalSessionCount >= totalInboxSessionLimit && excludeFromFreqCaps < 0) {\n return false\n }\n } else {\n // session\n if (totalSessionLimit > 0 && totalSessionCount >= totalSessionLimit && excludeFromFreqCaps < 0) {\n return false\n }\n }\n\n // campaign session\n if (campaignSessionLimit > 0 && campaignSessionCount >= campaignSessionLimit) {\n return false\n }\n } else {\n sessionObj = {}\n campTypeObj[_session.sessionId] = sessionObj\n }\n\n // daily level capping\n var dailyObj = campTypeObj[today]\n if (dailyObj != null) {\n const campaignDailyCount = dailyObj[campaignId]\n const totalDailyCount = dailyObj.tc\n // daily\n if (totalDailyLimit > 0 && totalDailyCount >= totalDailyLimit && excludeFromFreqCaps < 0) {\n return false\n }\n // campaign daily\n if (campaignDailyLimit > 0 && campaignDailyCount >= campaignDailyLimit) {\n return false\n }\n } else {\n dailyObj = {}\n campTypeObj[today] = dailyObj\n }\n\n var globalObj = campTypeObj[GLOBAL]\n if (globalObj != null) {\n const campaignTotalCount = globalObj[campaignId]\n // campaign total\n if (campaignTotalLimit > 0 && campaignTotalCount >= campaignTotalLimit) {\n return false\n }\n } else {\n globalObj = {}\n campTypeObj[GLOBAL] = globalObj\n }\n }\n // delay\n const displayObj = targetingMsgJson.display\n if (displayObj.delay != null && displayObj.delay > 0) {\n const delay = displayObj.delay\n displayObj.delay = 0\n setTimeout(_tr, delay * 1000, msg, {\n device: _device,\n session: _session,\n request: _request,\n logger: _logger\n })\n return false\n }\n\n incrCount(sessionObj, campaignId, excludeFromFreqCaps)\n incrCount(dailyObj, campaignId, excludeFromFreqCaps)\n incrCount(globalObj, campaignId, excludeFromFreqCaps)\n\n let campKey = 'wp'\n if (targetingMsgJson[DISPLAY].wtarget_type === 3) {\n campKey = 'wi'\n }\n // get ride of stale sessions and day entries\n const newCampObj = {}\n newCampObj[_session.sessionId] = sessionObj\n newCampObj[today] = dailyObj\n newCampObj[GLOBAL] = globalObj\n saveCampaignObject({ [campKey]: newCampObj })\n }\n\n const setupClickUrl = (onClick, targetingMsgJson, contentDiv, divId, isLegacy) => {\n incrementImpression(targetingMsgJson, _request)\n setupClickEvent(onClick, targetingMsgJson, contentDiv, divId, isLegacy, _device, _session)\n }\n\n const handleImageOnlyPopup = (targetingMsgJson) => {\n const divId = 'wzrkImageOnlyDiv'\n if (doCampHouseKeeping(targetingMsgJson) === false) {\n return\n }\n if ($ct.dismissSpamControl && document.getElementById(divId) != null) {\n const element = document.getElementById(divId)\n element.remove()\n }\n // ImageOnly campaign and Interstitial/Exit Intent shouldn't coexist\n if (document.getElementById(divId) != null || document.getElementById('intentPreview') != null) {\n return\n }\n const msgDiv = document.createElement('div')\n msgDiv.id = divId\n document.body.appendChild(msgDiv)\n if (customElements.get('ct-web-popup-imageonly') === undefined) {\n customElements.define('ct-web-popup-imageonly', CTWebPopupImageOnly)\n }\n return renderPopUpImageOnly(targetingMsgJson, _session)\n }\n\n const isExistingCampaign = (campaignId) => {\n const testIframe = document.getElementById('wiz-iframe-intent') || document.getElementById('wiz-iframe')\n if (testIframe) {\n const iframeDocument = testIframe.contentDocument || testIframe.contentWindow.document\n return iframeDocument.documentElement.innerHTML.includes(campaignId)\n }\n return false\n }\n\n const createTemplate = (targetingMsgJson, isExitIntent) => {\n const campaignId = targetingMsgJson.wzrk_id.split('_')[0]\n const displayObj = targetingMsgJson.display\n\n if (displayObj.layout === 1) { // Handling Web Exit Intent\n return showExitIntent(undefined, targetingMsgJson)\n }\n if (displayObj.layout === 3) { // Handling Web Popup Image Only\n handleImageOnlyPopup(targetingMsgJson)\n return\n }\n\n if (doCampHouseKeeping(targetingMsgJson) === false) {\n return\n }\n\n const divId = 'wizParDiv' + displayObj.layout\n const opacityDivId = 'intentOpacityDiv' + displayObj.layout\n\n if ($ct.dismissSpamControl && document.getElementById(divId) != null) {\n const element = document.getElementById(divId)\n const opacityElement = document.getElementById(opacityDivId)\n if (element) {\n element.remove()\n }\n if (opacityElement) {\n opacityElement.remove()\n }\n }\n if (isExistingCampaign(campaignId)) return\n\n if (document.getElementById(divId) != null) {\n return\n }\n\n $ct.campaignDivMap[campaignId] = divId\n const isBanner = displayObj.layout === 2\n if (isExitIntent) {\n const opacityDiv = document.createElement('div')\n opacityDiv.id = opacityDivId\n const opacity = targetingMsgJson.display.opacity || 0.7\n const rgbaColor = `rgba(0,0,0,${opacity})`\n opacityDiv.setAttribute('style', `position: fixed;top: 0;bottom: 0;left: 0;width: 100%;height: 100%;z-index: 2147483646;background: ${rgbaColor};`)\n document.body.appendChild(opacityDiv)\n }\n const msgDiv = document.createElement('div')\n msgDiv.id = divId\n const viewHeight = window.innerHeight\n const viewWidth = window.innerWidth\n let legacy = false\n\n if (!isBanner) {\n const marginBottom = viewHeight * 5 / 100\n var contentHeight = 10\n let right = viewWidth * 5 / 100\n let bottomPosition = contentHeight + marginBottom\n let width = viewWidth * 30 / 100 + 20\n let widthPerct = 'width:30%;'\n // for small devices - mobile phones\n if ((/mobile/i.test(navigator.userAgent) || (/mini/i.test(navigator.userAgent))) && /iPad/i.test(navigator.userAgent) === false) {\n width = viewWidth * 85 / 100 + 20\n right = viewWidth * 5 / 100\n bottomPosition = viewHeight * 5 / 100\n widthPerct = 'width:80%;'\n // medium devices - tablets\n } else if ('ontouchstart' in window || (/tablet/i.test(navigator.userAgent))) {\n width = viewWidth * 50 / 100 + 20\n right = viewWidth * 5 / 100\n bottomPosition = viewHeight * 5 / 100\n widthPerct = 'width:50%;'\n }\n // legacy footer notif\n if (displayObj.proto == null) {\n legacy = true\n msgDiv.setAttribute('style', 'display:block;overflow:hidden; bottom:' + bottomPosition + 'px !important;width:' + width + 'px !important;right:' + right + 'px !important;position:fixed;z-index:2147483647;')\n } else {\n msgDiv.setAttribute('style', widthPerct + displayObj.iFrameStyle)\n }\n } else {\n msgDiv.setAttribute('style', displayObj.iFrameStyle)\n }\n document.body.appendChild(msgDiv)\n const iframe = document.createElement('iframe')\n\n const borderRadius = displayObj.br === false ? '0' : '8'\n\n iframe.frameborder = '0px'\n iframe.marginheight = '0px'\n iframe.marginwidth = '0px'\n iframe.scrolling = 'no'\n iframe.id = 'wiz-iframe'\n const onClick = targetingMsgJson.display.onClick\n let pointerCss = ''\n if (onClick !== '' && onClick != null) {\n pointerCss = 'cursor:pointer;'\n }\n if (displayObj.preview && displayObj['custom-editor']) {\n iframe.sandbox = 'allow-scripts allow-popups allow-popups-to-escape-sandbox'\n }\n\n let html\n // direct html\n if (targetingMsgJson.msgContent.type === 1) {\n html = targetingMsgJson.msgContent.html\n html = html.replace(/##campaignId##/g, campaignId)\n html = html.replace(/##campaignId_batchId##/g, targetingMsgJson.wzrk_id)\n } else {\n const css = '' +\n ''\n\n let bgColor, textColor, btnBg, leftTd, btColor\n if (targetingMsgJson.display.theme === 'dark') {\n bgColor = '#2d2d2e'\n textColor = '#eaeaea'\n btnBg = '#353535'\n leftTd = '#353535'\n btColor = '#ffffff'\n } else {\n bgColor = '#ffffff'\n textColor = '#000000'\n leftTd = '#f4f4f4'\n btnBg = '#a5a6a6'\n btColor = '#ffffff'\n }\n const titleText = targetingMsgJson.msgContent.title\n const descriptionText = targetingMsgJson.msgContent.description\n let imageTd = ''\n if (targetingMsgJson.msgContent.imageUrl != null && targetingMsgJson.msgContent.imageUrl !== '') {\n imageTd = \"\"\n }\n const onClickStr = 'parent.$WZRK_WR.closeIframe(' + campaignId + \",'\" + divId + \"');\"\n const title = \"
\" +\n \"×\" +\n \"
\" +\n \"\" +\n // \"\"+\n '' + imageTd + \"
\" +\n \"
\" + titleText + '
'\n const body = \"
\" + descriptionText + '
'\n html = css + title + body\n }\n\n iframe.setAttribute('style', 'z-index: 2147483647; display:block; width: 100% !important; border:0px !important; border-color:none !important;')\n msgDiv.appendChild(iframe)\n\n // Dispatch event for popup box/banner close\n const closeCampaign = new Event('CT_campaign_rendered')\n document.dispatchEvent(closeCampaign)\n\n if (displayObj['custom-editor']) {\n html = appendScriptForCustomEvent(targetingMsgJson, html)\n }\n iframe.srcdoc = html\n\n const adjustIFrameHeight = () => {\n // adjust iframe and body height of html inside correctly\n contentHeight = document.getElementById('wiz-iframe').contentDocument.getElementById('contentDiv').scrollHeight\n if (displayObj['custom-editor'] !== true && !isBanner) {\n contentHeight += 25\n }\n document.getElementById('wiz-iframe').contentDocument.body.style.margin = '0px'\n document.getElementById('wiz-iframe').style.height = contentHeight + 'px'\n }\n\n const ua = navigator.userAgent.toLowerCase()\n if (ua.indexOf('safari') !== -1) {\n if (ua.indexOf('chrome') > -1) {\n iframe.onload = () => {\n adjustIFrameHeight()\n const contentDiv = document.getElementById('wiz-iframe').contentDocument.getElementById('contentDiv')\n setupClickUrl(onClick, targetingMsgJson, contentDiv, divId, legacy)\n }\n } else {\n let inDoc = iframe.contentDocument || iframe.contentWindow\n if (inDoc.document) inDoc = inDoc.document\n // safari iphone 7+ needs this.\n const _timer = setInterval(() => {\n if (inDoc.readyState === 'complete') {\n clearInterval(_timer)\n // adjust iframe and body height of html inside correctly\n adjustIFrameHeight()\n const contentDiv = document.getElementById('wiz-iframe').contentDocument.getElementById('contentDiv')\n setupClickUrl(onClick, targetingMsgJson, contentDiv, divId, legacy)\n }\n }, 300)\n }\n } else {\n iframe.onload = () => {\n // adjust iframe and body height of html inside correctly\n adjustIFrameHeight()\n const contentDiv = document.getElementById('wiz-iframe').contentDocument.getElementById('contentDiv')\n setupClickUrl(onClick, targetingMsgJson, contentDiv, divId, legacy)\n }\n }\n }\n const renderFooterNotification = (targetingMsgJson) => {\n createTemplate(targetingMsgJson, false)\n }\n\n let _callBackCalled = false\n\n const showFooterNotification = (targetingMsgJson) => {\n let onClick = targetingMsgJson.display.onClick\n const displayObj = targetingMsgJson.display\n\n // TODO: Needs wizrocket as a global variable\n if (window.clevertap.hasOwnProperty('notificationCallback') &&\n typeof window.clevertap.notificationCallback !== 'undefined' &&\n typeof window.clevertap.notificationCallback === 'function') {\n const notificationCallback = window.clevertap.notificationCallback\n\n if (!_callBackCalled) {\n const inaObj = {}\n inaObj.msgContent = targetingMsgJson.msgContent\n inaObj.msgId = targetingMsgJson.wzrk_id\n if (targetingMsgJson.wzrk_pivot) {\n inaObj.pivotId = targetingMsgJson.wzrk_pivot\n }\n if (targetingMsgJson.display.kv != null) {\n inaObj.kv = targetingMsgJson.display.kv\n }\n\n window.clevertap.raiseNotificationClicked = () => {\n if (onClick !== '' && onClick != null) {\n const jsFunc = targetingMsgJson.display.jsFunc\n onClick += getCookieParams(_device, _session)\n\n // invoke js function call\n if (jsFunc != null) {\n // track notification clicked event\n RequestDispatcher.fireRequest(onClick)\n invokeExternalJs(jsFunc, targetingMsgJson)\n return\n }\n // pass on the gcookie|page|scookieId for capturing the click event\n if (targetingMsgJson.display.window === 1) {\n window.open(onClick, '_blank')\n } else {\n window.location = onClick\n }\n }\n }\n window.clevertap.raiseNotificationViewed = () => {\n incrementImpression(targetingMsgJson)\n }\n notificationCallback(inaObj)\n _callBackCalled = true\n }\n } else {\n window.clevertap.popupCurrentWzrkId = targetingMsgJson.wzrk_id\n\n if (displayObj.deliveryTrigger) {\n if (displayObj.deliveryTrigger.inactive) {\n triggerByInactivity(targetingMsgJson)\n }\n if (displayObj.deliveryTrigger.scroll) {\n triggerByScroll(targetingMsgJson)\n }\n if (displayObj.deliveryTrigger.isExitIntent) {\n exitintentObj = targetingMsgJson\n window.document.body.onmouseleave = showExitIntent\n }\n // delay\n const delay = displayObj.delay || displayObj.deliveryTrigger.deliveryDelayed\n if (delay != null && delay > 0) {\n setTimeout(() => {\n renderFooterNotification(targetingMsgJson)\n }, delay * 1000)\n }\n } else {\n renderFooterNotification(targetingMsgJson)\n }\n\n if (window.clevertap.hasOwnProperty('popupCallbacks') &&\n typeof window.clevertap.popupCallbacks !== 'undefined' &&\n typeof window.clevertap.popupCallbacks[targetingMsgJson.wzrk_id] === 'function') {\n const popupCallback = window.clevertap.popupCallbacks[targetingMsgJson.wzrk_id]\n\n const inaObj = {}\n inaObj.msgContent = targetingMsgJson.msgContent\n inaObj.msgId = targetingMsgJson.wzrk_id\n\n if (targetingMsgJson.wzrk_pivot) {\n inaObj.pivotId = targetingMsgJson.wzrk_pivot\n }\n\n var msgCTkv = []\n for (var wzrkPrefixKey in targetingMsgJson) {\n // ADD WZRK PREFIX KEY VALUE PAIRS\n if (wzrkPrefixKey.startsWith(WZRK_PREFIX) && wzrkPrefixKey !== WZRK_ID) {\n const wzrkJson = { [wzrkPrefixKey]: targetingMsgJson[wzrkPrefixKey] }\n msgCTkv.push(wzrkJson)\n }\n }\n\n if (msgCTkv.length > 0) {\n inaObj.msgCTkv = msgCTkv\n }\n if (targetingMsgJson.display.kv != null) {\n inaObj.kv = targetingMsgJson.display.kv\n }\n\n // PUBLIC API TO RECORD CLICKED EVENT\n window.clevertap.raisePopupNotificationClicked = (notificationData) => {\n if (!notificationData || !notificationData.msgId) { return }\n\n const eventData = {}\n eventData.type = 'event'\n eventData.evtName = NOTIFICATION_CLICKED\n eventData.evtData = { [WZRK_ID]: notificationData.msgId }\n if (targetingMsgJson.wzrk_pivot) {\n eventData.evtData = { ...eventData.evtData, wzrk_pivot: notificationData.pivotId }\n }\n\n // WZRK PREFIX KEY VALUE PAIRS\n if (notificationData.msgCTkv) {\n for (var wzrkPrefixObj of notificationData.msgCTkv) {\n eventData.evtData = { ...eventData.evtData, ...wzrkPrefixObj }\n }\n }\n\n _request.processEvent(eventData)\n }\n popupCallback(inaObj)\n }\n }\n }\n\n const triggerByInactivity = (targetNotif) => {\n const IDLE_TIME_THRESHOLD = targetNotif.display.deliveryTrigger.inactive * 1000 // Convert to milliseconds\n let idleTimer\n const events = ['mousemove', 'keypress', 'scroll', 'mousedown', 'touchmove', 'click']\n const resetIdleTimer = () => {\n clearTimeout(idleTimer)\n idleTimer = setTimeout(() => {\n renderFooterNotification(targetNotif)\n removeEventListeners()\n }, IDLE_TIME_THRESHOLD)\n }\n const eventHandler = () => {\n resetIdleTimer()\n }\n const setupEventListeners = () => {\n events.forEach(eventType => window.addEventListener(eventType, eventHandler, { passive: true }))\n }\n const removeEventListeners = () => {\n events.forEach(eventType => window.removeEventListener(eventType, eventHandler))\n }\n setupEventListeners()\n resetIdleTimer()\n return removeEventListeners// Return a cleanup function\n }\n\n const triggerByScroll = (targetNotif) => {\n const calculateScrollPercentage = () => {\n const { scrollHeight, clientHeight, scrollTop } = document.documentElement\n return (scrollTop / (scrollHeight - clientHeight)) * 100\n }\n const scrollListener = () => {\n const scrollPercentage = calculateScrollPercentage()\n if (scrollPercentage >= targetNotif.display.deliveryTrigger.scroll) {\n renderFooterNotification(targetNotif)\n window.removeEventListener('scroll', throttledScrollListener)\n }\n }\n const throttle = (func, limit) => {\n let inThrottle = false\n return function (...args) {\n const context = this\n if (!inThrottle) {\n func.apply(context, args)\n inThrottle = true\n setTimeout(() => {\n inThrottle = false\n }, limit)\n }\n }\n }\n const throttledScrollListener = throttle(scrollListener, 200)\n window.addEventListener('scroll', throttledScrollListener, { passive: true })\n return () => window.removeEventListener('scroll', throttledScrollListener)// Return a cleanup function\n }\n\n let exitintentObj\n const showExitIntent = (event, targetObj) => {\n if (event?.clientY > 0) return\n const targetingMsgJson = targetObj || exitintentObj\n\n const campaignId = targetingMsgJson.wzrk_id.split('_')[0]\n const layout = targetingMsgJson.display.layout\n if (isExistingCampaign(campaignId)) return\n\n if (targetingMsgJson.display.wtarget_type === 0 && (layout === 0 || layout === 2 || layout === 3)) {\n createTemplate(targetingMsgJson, true)\n return\n }\n if (doCampHouseKeeping(targetingMsgJson) === false) {\n return\n }\n\n if ($ct.dismissSpamControl && targetingMsgJson.display.wtarget_type === 0) {\n const intentPreview = document.getElementById('intentPreview')\n const intentOpacityDiv = document.getElementById('intentOpacityDiv')\n if (intentPreview && intentOpacityDiv) {\n intentPreview.remove()\n intentOpacityDiv.remove()\n }\n }\n\n // ImageOnly campaign and Interstitial/Exit Intent shouldn't coexist`\n if (document.getElementById('intentPreview') != null || document.getElementById('wzrkImageOnlyDiv') != null) {\n return\n }\n // dont show exit intent on tablet/mobile - only on desktop\n if (targetingMsgJson.display.layout == null &&\n ((/mobile/i.test(navigator.userAgent)) || (/mini/i.test(navigator.userAgent)) || (/iPad/i.test(navigator.userAgent)) ||\n ('ontouchstart' in window) || (/tablet/i.test(navigator.userAgent)))) {\n return\n }\n\n $ct.campaignDivMap[campaignId] = 'intentPreview'\n let legacy = false\n const opacityDiv = document.createElement('div')\n opacityDiv.id = 'intentOpacityDiv'\n const opacity = targetingMsgJson.display.opacity || 0.7\n const rgbaColor = `rgba(0,0,0,${opacity})`\n opacityDiv.setAttribute('style', `position: fixed;top: 0;bottom: 0;left: 0;width: 100%;height: 100%;z-index: 2147483646;background: ${rgbaColor};`)\n document.body.appendChild(opacityDiv)\n\n const msgDiv = document.createElement('div')\n msgDiv.id = 'intentPreview'\n\n if (targetingMsgJson.display.proto == null) {\n legacy = true\n msgDiv.setAttribute('style', 'display:block;overflow:hidden;top:55% !important;left:50% !important;position:fixed;z-index:2147483647;width:600px !important;height:600px !important;margin:-300px 0 0 -300px !important;')\n } else {\n msgDiv.setAttribute('style', targetingMsgJson.display.iFrameStyle)\n }\n document.body.appendChild(msgDiv)\n const iframe = document.createElement('iframe')\n const borderRadius = targetingMsgJson.display.br === false ? '0' : '8'\n iframe.frameborder = '0px'\n iframe.marginheight = '0px'\n iframe.marginwidth = '0px'\n iframe.scrolling = 'no'\n iframe.id = 'wiz-iframe-intent'\n const onClick = targetingMsgJson.display.onClick\n let pointerCss = ''\n if (onClick !== '' && onClick != null) {\n pointerCss = 'cursor:pointer;'\n }\n if (targetingMsgJson.display.preview && targetingMsgJson.display['custom-editor']) {\n iframe.sandbox = 'allow-scripts allow-popups allow-popups-to-escape-sandbox'\n }\n let html\n // direct html\n if (targetingMsgJson.msgContent.type === 1) {\n html = targetingMsgJson.msgContent.html\n html = html.replace(/##campaignId##/g, campaignId)\n html = html.replace(/##campaignId_batchId##/g, targetingMsgJson.wzrk_id)\n } else {\n const css = '' +\n ''\n\n let bgColor, textColor, btnBg, btColor\n if (targetingMsgJson.display.theme === 'dark') {\n bgColor = '#2d2d2e'\n textColor = '#eaeaea'\n btnBg = '#353535'\n btColor = '#ffffff'\n } else {\n bgColor = '#ffffff'\n textColor = '#000000'\n btnBg = '#a5a6a6'\n btColor = '#ffffff'\n }\n const titleText = targetingMsgJson.msgContent.title\n const descriptionText = targetingMsgJson.msgContent.description\n let ctaText = ''\n if (targetingMsgJson.msgContent.ctaText != null && targetingMsgJson.msgContent.ctaText !== '') {\n ctaText = \"'\n }\n\n let imageTd = ''\n if (targetingMsgJson.msgContent.imageUrl != null && targetingMsgJson.msgContent.imageUrl !== '') {\n imageTd = \"
\"
'\n }\n const onClickStr = 'parent.$WZRK_WR.closeIframe(' + campaignId + \",'intentPreview');\"\n const title = \"
\" +\n \"×\" +\n \"
\" +\n \"
\" + titleText + '
'\n const body = \"
\" + descriptionText + '
' + imageTd + ctaText +\n '
'\n html = css + title + body\n }\n iframe.setAttribute('style', 'z-index: 2147483647; display:block; height: 100% !important; width: 100% !important;min-height:80px !important;border:0px !important; border-color:none !important;')\n msgDiv.appendChild(iframe)\n\n // Dispatch event for interstitial/exit intent close\n const closeCampaign = new Event('CT_campaign_rendered')\n document.dispatchEvent(closeCampaign)\n\n if (targetingMsgJson.display['custom-editor']) {\n html = appendScriptForCustomEvent(targetingMsgJson, html)\n }\n iframe.srcdoc = html\n\n iframe.onload = () => {\n const contentDiv = document.getElementById('wiz-iframe-intent').contentDocument.getElementById('contentDiv')\n setupClickUrl(onClick, targetingMsgJson, contentDiv, 'intentPreview', legacy)\n }\n }\n\n if (!document.body) {\n if (_wizCounter < 6) {\n _wizCounter++\n setTimeout(_tr, 1000, msg, {\n device: _device,\n session: _session,\n request: _request,\n logger: _logger\n })\n }\n return\n }\n const processNativeDisplayArr = (arrInAppNotifs) => {\n Object.keys(arrInAppNotifs).map(key => {\n var elementId, id\n if (arrInAppNotifs[key].display.divId) {\n elementId = arrInAppNotifs[key].display.divId\n id = document.getElementById(elementId)\n } else {\n elementId = arrInAppNotifs[key].display.divSelector\n id = document.querySelector(elementId)\n }\n if (id !== null) {\n arrInAppNotifs[key].msgContent.type === 2 ? renderPersonalisationBanner(arrInAppNotifs[key]) : renderPersonalisationCarousel(arrInAppNotifs[key])\n delete arrInAppNotifs[key]\n }\n })\n }\n\n const addLoadListener = (arrInAppNotifs) => {\n window.addEventListener('load', () => {\n let count = 0\n if (count < 20) {\n const t = setInterval(() => {\n processNativeDisplayArr(arrInAppNotifs)\n if (Object.keys(arrInAppNotifs).length === 0 || count === 20) {\n clearInterval(t)\n arrInAppNotifs = {}\n }\n count++\n }, 500)\n }\n })\n }\n\n if (msg.inapp_notifs != null) {\n const arrInAppNotifs = {}\n for (let index = 0; index < msg.inapp_notifs.length; index++) {\n const targetNotif = msg.inapp_notifs[index]\n if (targetNotif.display.wtarget_type == null || targetNotif.display.wtarget_type === 0) {\n showFooterNotification(targetNotif)\n } else if (targetNotif.display.wtarget_type === 1) { // if display['wtarget_type']==1 then exit intent\n exitintentObj = targetNotif\n window.document.body.onmouseleave = showExitIntent\n } else if (targetNotif.display.wtarget_type === 2) { // if display['wtarget_type']==2 then web native display\n if (targetNotif.msgContent.type === 1) {\n handleKVpairCampaign(targetNotif)\n } else if (targetNotif.msgContent.type === 2 || targetNotif.msgContent.type === 3) { // Check for banner and carousel\n const element = targetNotif.display.divId ? document.getElementById(targetNotif.display.divId) : document.querySelector(targetNotif.display.divSelector)\n if (element !== null) {\n targetNotif.msgContent.type === 2 ? renderPersonalisationBanner(targetNotif) : renderPersonalisationCarousel(targetNotif)\n } else {\n arrInAppNotifs[targetNotif.wzrk_id.split('_')[0]] = targetNotif // Add targetNotif to object\n }\n } else if (targetNotif.msgContent.type === 4) {\n renderVisualBuilder(targetNotif, false)\n } else {\n showFooterNotification(targetNotif)\n }\n }\n }\n // Process banner or carousel campaign array\n if (Object.keys(arrInAppNotifs).length) {\n if (document.readyState === 'complete') {\n processNativeDisplayArr(arrInAppNotifs)\n } else {\n addLoadListener(arrInAppNotifs)\n }\n }\n }\n\n const handleInboxNotifications = () => {\n if (msg.inbox_preview) {\n processInboxNotifs(msg)\n return\n }\n if (msg.inbox_notifs) {\n const msgArr = []\n for (let index = 0; index < msg.inbox_notifs.length; index++) {\n if (doCampHouseKeeping(msg.inbox_notifs[index]) !== false) {\n msgArr.push(msg.inbox_notifs[index])\n }\n }\n processInboxNotifs(msgArr)\n }\n }\n\n if (msg.webInboxSetting || msg.inbox_notifs != null) {\n /**\n * When the user visits a website for the 1st time after web inbox channel is setup,\n * we need to initialise the inbox here because the initializeWebInbox method within init will not be executed\n * as we would not have any entry related to webInboxSettings in the LS\n */\n\n if (hasWebInboxSettingsInLS()) {\n checkAndRegisterWebInboxElements()\n }\n if ($ct.inbox === null) {\n msg.webInboxSetting && processWebInboxSettings(msg.webInboxSetting)\n initializeWebInbox(_logger)\n .then(() => {\n handleInboxNotifications()\n })\n .catch(e => {})\n } else {\n handleInboxNotifications()\n }\n }\n\n if (msg.webPushConfig) {\n processWebPushConfig(msg.webPushConfig, logger, request)\n }\n\n if (msg.vars) {\n $ct.variableStore.mergeVariables(msg.vars)\n return\n }\n\n if (StorageManager._isLocalStorageSupported()) {\n try {\n if (msg.evpr != null) {\n const eventsMap = msg.evpr.events\n const profileMap = msg.evpr.profile\n const syncExpiry = msg.evpr.expires_in\n const now = getNow()\n StorageManager.setMetaProp('lsTime', now)\n StorageManager.setMetaProp('exTs', syncExpiry)\n mergeEventMap(eventsMap)\n StorageManager.saveToLSorCookie(EV_COOKIE, $ct.globalEventsMap)\n if ($ct.globalProfileMap == null) {\n addToLocalProfileMap(profileMap, true)\n } else {\n addToLocalProfileMap(profileMap, false)\n }\n }\n if (msg.arp != null) {\n arp(msg.arp)\n }\n if (msg.inapp_stale != null && msg.inapp_stale.length > 0) {\n // web popup stale\n staleDataUpdate(msg.inapp_stale, 'wp')\n }\n if (msg.inbox_stale != null && msg.inbox_stale.length > 0) {\n // web inbox stale\n staleDataUpdate(msg.inbox_stale, 'wi')\n }\n } catch (e) {\n _logger.error('Unable to persist evrp/arp: ' + e)\n }\n }\n}\n\nexport default _tr\n","import {\n StorageManager\n} from '../util/storage'\nexport default class User {\n #isPersonalisationActive\n\n constructor ({\n isPersonalisationActive\n }) {\n this.#isPersonalisationActive = isPersonalisationActive\n }\n\n getTotalVisits () {\n if (!this.#isPersonalisationActive()) {\n return\n }\n let visitCount = StorageManager.getMetaProp('sc')\n if (visitCount == null) {\n visitCount = 1\n }\n return visitCount\n }\n\n getLastVisit () {\n if (!this.#isPersonalisationActive()) {\n return\n }\n const prevSession = StorageManager.getMetaProp('ps')\n if (prevSession != null) {\n return new Date(prevSession * 1000)\n }\n }\n}\n","import {\n CLEVERTAP_ERROR_PREFIX\n} from '../util/messages'\n\nexport const logLevels = {\n DISABLE: 0,\n ERROR: 1,\n INFO: 2,\n DEBUG: 3,\n DEBUG_PE: 4\n}\n\nexport class Logger {\n #logLevel\n wzrkError = {}\n constructor (logLevel) {\n this.#logLevel = logLevel == null ? logLevel : logLevels.INFO\n this.wzrkError = {}\n }\n\n get logLevel () {\n return this.#logLevel\n }\n\n set logLevel (logLevel) {\n this.#logLevel = logLevel\n }\n\n error (message) {\n if (this.#logLevel >= logLevels.ERROR) {\n this.#log('error', message)\n }\n }\n\n info (message) {\n if (this.#logLevel >= logLevels.INFO) {\n this.#log('log', message)\n }\n }\n\n debug (message) {\n if (this.#logLevel >= logLevels.DEBUG || this.#isLegacyDebug) {\n this.#log('debug', message)\n }\n }\n\n debugPE (message) {\n if (this.#logLevel >= logLevels.DEBUG_PE) {\n this.#log('debug_pe', message)\n }\n }\n\n reportError (code, description) {\n this.wzrkError.c = code\n this.wzrkError.d = description\n this.error(`${CLEVERTAP_ERROR_PREFIX} ${code}: ${description}`)\n }\n\n #log (level, message) {\n if (window.console) {\n try {\n const ts = new Date().getTime()\n console[level](`CleverTap [${ts}]: ${message}`)\n } catch (e) {}\n }\n }\n\n get #isLegacyDebug () {\n return (typeof sessionStorage !== 'undefined' && sessionStorage.WZRK_D === '')\n }\n}\n\nexport default {\n Logger,\n logLevels\n}\n","import { singleQuoteRegex, SCOOKIE_EXP_TIME_IN_SECS } from '../util/constants'\nimport { isObject } from '../util/datatypes'\nimport { getNow } from '../util/datetime'\nimport { StorageManager } from '../util/storage'\nimport { getHostName } from '../util/url'\n\nexport default class SessionManager {\n #logger\n #sessionId\n #isPersonalisationActive\n cookieName // SCOOKIE_NAME\n scookieObj\n\n constructor ({\n logger,\n isPersonalisationActive\n }) {\n this.sessionId = StorageManager.getMetaProp('cs')\n this.#logger = logger\n this.#isPersonalisationActive = isPersonalisationActive\n }\n\n get sessionId () {\n return this.#sessionId\n }\n\n set sessionId (sessionId) {\n this.#sessionId = sessionId\n }\n\n getSessionCookieObject () {\n let scookieStr = StorageManager.readCookie(this.cookieName)\n let obj = {}\n\n if (scookieStr != null) {\n // converting back single quotes to double for JSON parsing - http://www.iandevlin.com/blog/2012/04/html5/cookies-json-localstorage-and-opera\n scookieStr = scookieStr.replace(singleQuoteRegex, '\"')\n\n obj = JSON.parse(scookieStr)\n if (!isObject(obj)) {\n obj = {}\n } else {\n if (typeof obj.t !== 'undefined') { // check time elapsed since last request\n const lastTime = obj.t\n const now = getNow()\n if ((now - lastTime) > (SCOOKIE_EXP_TIME_IN_SECS + 60)) {\n // adding 60 seconds to compensate for in-journey requests\n // ideally the cookie should've died after SCOOKIE_EXP_TIME_IN_SECS but it's still around as we can read\n // hence we shouldn't use it.\n obj = {}\n }\n }\n }\n }\n this.scookieObj = obj\n return obj\n }\n\n setSessionCookieObject (obj) {\n const objStr = JSON.stringify(obj)\n StorageManager.createBroadCookie(this.cookieName, objStr, SCOOKIE_EXP_TIME_IN_SECS, getHostName())\n }\n\n manageSession (session) {\n // first time. check if current session id in localstorage is same\n // if not same then prev = current and current = this new session\n if (typeof this.sessionId === 'undefined' || this.sessionId !== session) {\n const currentSessionInLS = StorageManager.getMetaProp('cs')\n // if sessionId in meta is undefined - set current to both\n if (typeof currentSessionInLS === 'undefined') {\n StorageManager.setMetaProp('ps', session)\n StorageManager.setMetaProp('cs', session)\n StorageManager.setMetaProp('sc', 1)\n } else if (currentSessionInLS !== session) {\n // not same as session in local storage. new session\n StorageManager.setMetaProp('ps', currentSessionInLS)\n StorageManager.setMetaProp('cs', session)\n let sessionCount = StorageManager.getMetaProp('sc')\n if (typeof sessionCount === 'undefined') {\n sessionCount = 0\n }\n StorageManager.setMetaProp('sc', sessionCount + 1)\n }\n this.sessionId = session\n }\n }\n\n getTimeElapsed () {\n if (!this.#isPersonalisationActive()) {\n return\n }\n if (this.scookieObj != null) { // TODO: check logic?\n this.scookieObj = this.getSessionCookieObject()\n }\n const sessionStart = this.scookieObj.s\n if (sessionStart != null) {\n const ts = getNow()\n return Math.floor(ts - sessionStart)\n }\n }\n\n getPageCount () {\n if (!this.#isPersonalisationActive()) {\n return\n }\n\n if (this.scookieObj != null) { // TODO: check logic\n this.scookieObj = this.getSessionCookieObject()\n }\n return this.scookieObj.p\n }\n}\n","import { CAMP_COOKIE_NAME, CLEAR, EVT_PUSH, EV_COOKIE, FIRE_PUSH_UNREGISTERED, LCOOKIE_NAME, PUSH_SUBSCRIPTION_DATA, WEBPUSH_LS_KEY } from '../util/constants'\nimport { isObjectEmpty, isValueValid, removeUnsupportedChars } from '../util/datatypes'\nimport { getNow } from '../util/datetime'\nimport { compressData } from '../util/encoder'\nimport RequestDispatcher from '../util/requestDispatcher'\nimport { StorageManager, $ct } from '../util/storage'\nimport { addToURL } from '../util/url'\nimport { getCampaignObjForLc } from '../util/clevertap'\n\nlet seqNo = 0\nlet requestTime = 0\n\nexport default class RequestManager {\n #logger\n #account\n #device\n #session\n #isPersonalisationActive\n #clearCookie = false\n processingBackup = false\n\n constructor ({ logger, account, device, session, isPersonalisationActive }) {\n this.#logger = logger\n this.#account = account\n this.#device = device\n this.#session = session\n this.#isPersonalisationActive = isPersonalisationActive\n\n RequestDispatcher.logger = logger\n RequestDispatcher.device = device\n RequestDispatcher.account = account\n }\n\n processBackupEvents () {\n const backupMap = StorageManager.readFromLSorCookie(LCOOKIE_NAME)\n if (typeof backupMap === 'undefined' || backupMap === null) {\n return\n }\n this.processingBackup = true\n for (const idx in backupMap) {\n if (backupMap.hasOwnProperty(idx)) {\n const backupEvent = backupMap[idx]\n if (typeof backupEvent.fired === 'undefined') {\n this.#logger.debug('Processing backup event : ' + backupEvent.q)\n if (typeof backupEvent.q !== 'undefined') {\n RequestDispatcher.fireRequest(backupEvent.q)\n }\n backupEvent.fired = true\n }\n }\n }\n StorageManager.saveToLSorCookie(LCOOKIE_NAME, backupMap)\n this.processingBackup = false\n }\n\n addSystemDataToObject (dataObject, ignoreTrim) {\n // ignore trim for chrome notifications; undefined everywhere else\n if (typeof ignoreTrim === 'undefined') {\n dataObject = removeUnsupportedChars(dataObject, this.#logger)\n }\n\n if (!isObjectEmpty(this.#logger.wzrkError)) {\n dataObject.wzrk_error = this.#logger.wzrkError\n this.#logger.wzrkError = {}\n }\n\n dataObject.id = this.#account.id\n\n if (isValueValid(this.#device.gcookie)) {\n dataObject.g = this.#device.gcookie\n }\n\n const obj = this.#session.getSessionCookieObject()\n dataObject.s = obj.s // session cookie\n dataObject.pg = (typeof obj.p === 'undefined') ? 1 : obj.p // Page count\n let proto = document.location.protocol\n proto = proto.replace(':', '')\n dataObject.af = { ...dataObject.af, lib: 'web-sdk-v$$PACKAGE_VERSION$$', protocol: proto, ...$ct.flutterVersion } // app fields\n if (sessionStorage.hasOwnProperty('WZRK_D')) { dataObject.debug = true }\n\n return dataObject\n }\n\n addFlags (data) {\n // check if cookie should be cleared.\n this.#clearCookie = StorageManager.getAndClearMetaProp(CLEAR)\n if (this.#clearCookie !== undefined && this.#clearCookie) {\n data.rc = true\n this.#logger.debug('reset cookie sent in request and cleared from meta for future requests.')\n }\n if (this.#isPersonalisationActive()) {\n const lastSyncTime = StorageManager.getMetaProp('lsTime')\n const expirySeconds = StorageManager.getMetaProp('exTs')\n\n // dsync not found in local storage - get data from server\n if (typeof lastSyncTime === 'undefined' || typeof expirySeconds === 'undefined') {\n data.dsync = true\n return\n }\n const now = getNow()\n // last sync time has expired - get fresh data from server\n if (lastSyncTime + expirySeconds < now) {\n data.dsync = true\n }\n }\n }\n\n // saves url to backup cache and fires the request\n /**\n *\n * @param {string} url\n * @param {boolean} override whether the request can go through or not\n * @param {Boolean} sendOULFlag - true in case of a On User Login request\n */\n saveAndFireRequest (url, override, sendOULFlag, evtName) {\n const now = getNow()\n url = addToURL(url, 'rn', ++$ct.globalCache.REQ_N)\n const data = url + '&i=' + now + '&sn=' + seqNo\n StorageManager.backupEvent(data, $ct.globalCache.REQ_N, this.#logger)\n\n // if offline is set to true, save the request in backup and return\n if ($ct.offline) return\n // if there is no override\n // and an OUL request is not in progress\n // then process the request as it is\n // else block the request\n // note - $ct.blockRequest should ideally be used for override\n if ((!override || (this.#clearCookie !== undefined && this.#clearCookie)) && !window.isOULInProgress) {\n if (now === requestTime) {\n seqNo++\n } else {\n requestTime = now\n seqNo = 0\n }\n window.oulReqN = $ct.globalCache.REQ_N\n RequestDispatcher.fireRequest(data, false, sendOULFlag, evtName)\n } else {\n this.#logger.debug(`Not fired due to override - ${$ct.blockRequest} or clearCookie - ${this.#clearCookie} or OUL request in progress - ${window.isOULInProgress}`)\n }\n }\n\n unregisterTokenForGuid (givenGUID) {\n const payload = StorageManager.readFromLSorCookie(PUSH_SUBSCRIPTION_DATA)\n // Send unregister event only when token is available\n if (payload) {\n const data = {}\n data.type = 'data'\n if (isValueValid(givenGUID)) {\n data.g = givenGUID\n }\n data.action = 'unregister'\n data.id = this.#account.id\n\n const obj = this.#session.getSessionCookieObject()\n\n data.s = obj.s // session cookie\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', 'data')\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n RequestDispatcher.fireRequest(pageLoadUrl, true)\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, false)\n }\n // REGISTER TOKEN\n this.registerToken(payload)\n }\n\n registerToken (payload) {\n if (!payload) return\n // add gcookie etc to the payload\n payload = this.addSystemDataToObject(payload, true)\n payload = JSON.stringify(payload)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', 'data')\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(payload, this.#logger))\n RequestDispatcher.fireRequest(pageLoadUrl)\n // set in localstorage\n StorageManager.save(WEBPUSH_LS_KEY, 'ok')\n }\n\n processEvent (data) {\n this.#addToLocalEventMap(data.evtName)\n data = this.addSystemDataToObject(data, undefined)\n this.addFlags(data)\n data[CAMP_COOKIE_NAME] = getCampaignObjForLc()\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.saveAndFireRequest(pageLoadUrl, $ct.blockRequest, false, data.evtName)\n }\n\n #addToLocalEventMap (evtName) {\n if (StorageManager._isLocalStorageSupported()) {\n if (typeof $ct.globalEventsMap === 'undefined') {\n $ct.globalEventsMap = StorageManager.readFromLSorCookie(EV_COOKIE)\n if (typeof $ct.globalEventsMap === 'undefined') {\n $ct.globalEventsMap = {}\n }\n }\n\n const nowTs = getNow()\n let evtDetail = $ct.globalEventsMap[evtName]\n if (typeof evtDetail !== 'undefined') {\n evtDetail[2] = nowTs\n evtDetail[0]++\n } else {\n evtDetail = []\n evtDetail.push(1)\n evtDetail.push(nowTs)\n evtDetail.push(nowTs)\n }\n $ct.globalEventsMap[evtName] = evtDetail\n StorageManager.saveToLSorCookie(EV_COOKIE, $ct.globalEventsMap)\n }\n }\n\n post (url, body) {\n return fetch(url, {\n method: 'post',\n headers: { 'Content-Type': 'application/json' },\n body: body\n })\n .then((response) => {\n if (response.ok) {\n return response.json()\n }\n throw response\n })\n .then((data) => {\n this.#logger.debug('Sync data successful', data)\n return data\n })\n .catch((e) => {\n this.#logger.debug('Error in syncing variables', e)\n throw e\n })\n }\n}\n","import {\n isObjectEmpty\n} from '../util/datatypes'\nimport {\n EVT_PUSH,\n USEIP_KEY,\n OPTOUT_KEY,\n CT_OPTOUT_KEY\n} from '../util/constants'\nimport {\n StorageManager,\n $ct\n} from '../util/storage'\nimport {\n compressData\n} from '../util/encoder'\nimport {\n addToURL\n} from '../util/url'\n\nexport default class Privacy extends Array {\n #request\n #account\n #oldValues\n #logger\n\n constructor ({\n request,\n account,\n logger\n },\n values) {\n super()\n this.#logger = logger\n this.#request = request\n this.#account = account\n this.#oldValues = values\n }\n\n push (...privacyArr) {\n if ($ct.isPrivacyArrPushed) {\n this.#processPrivacyArray($ct.privacyArray.length > 0 ? $ct.privacyArray : privacyArr)\n } else {\n $ct.privacyArray.push(...privacyArr)\n }\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#processPrivacyArray(this.#oldValues)\n }\n this.#oldValues = null\n }\n\n #processPrivacyArray (privacyArr) {\n if (Array.isArray(privacyArr) && privacyArr.length > 0) {\n const privacyObj = privacyArr.reduce((prev, curr) => ({ ...prev, ...curr }), {})\n let data = {}\n const profileObj = {}\n var optOut = false\n\n if (privacyObj.hasOwnProperty(OPTOUT_KEY)) {\n optOut = privacyObj[OPTOUT_KEY]\n if (typeof optOut === 'boolean') {\n profileObj[CT_OPTOUT_KEY] = optOut\n // should be true when user wants to opt in\n $ct.isOptInRequest = !optOut\n }\n }\n if (privacyObj.hasOwnProperty(USEIP_KEY)) {\n const useIP = privacyObj[USEIP_KEY]\n const shouldUseIP = (typeof useIP === 'boolean') ? useIP : false\n StorageManager.setMetaProp(USEIP_KEY, shouldUseIP)\n }\n if (!isObjectEmpty(profileObj)) {\n data.type = 'profile'\n data.profile = profileObj\n data = this.#request.addSystemDataToObject(data, undefined)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n pageLoadUrl = addToURL(pageLoadUrl, OPTOUT_KEY, optOut ? 'true' : 'false')\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n privacyArr.splice(0, privacyArr.length)\n }\n }\n }\n}\n","export class Variable {\n #variableStore\n\n /**\n * Creates an instance of the Variable class.\n *\n * @constructor\n * @param {VariableStore} options.variableStore - The VariableStore instance for registration.\n * @param {string|null} options.name - The name of the variable.\n * @param {*} options.defaultValue - The default value of the variable.\n * @param {*} options.value - The current value of the variable.\n * @param {string|null} options.type - The type of the variable (string, number, boolean).\n * @param {boolean} options.hadStarted - A flag indicating whether the variable has started (used internally).\n * @param {Function[]} options.valueChangedCallbacks - Array to store callbacks to be executed when the variable value changes.\n */\n constructor ({ variableStore }) {\n this.name = null\n this.defaultValue = null\n this.value = null\n this.type = null\n this.hadStarted = false\n this.valueChangedCallbacks = []\n this.#variableStore = variableStore\n }\n\n getValue () {\n return this.value\n }\n\n getdefaultValue () {\n return this.defaultValue\n }\n\n /**\n * Defines a new variable with the provided name, default value, and variable store.\n * @static\n * @param {string} name - The name of the variable.\n * @param {*} defaultValue - The default value of the variable.\n * @param {VariableStore} variableStore - The VariableStore instance for registration.\n * @returns {Variable|null} - The created Variable instance or null if invalid parameters are provided.\n */\n static define (name, defaultValue, variableStore) {\n if (!name || typeof name !== 'string') {\n console.error('Empty or invalid name parameter provided.')\n return null\n }\n if (name.startsWith('.') || name.endsWith('.')) {\n console.error('Variable name starts or ends with a `.` which is not allowed: ' + name)\n return null\n }\n\n const typeOfDefaultValue = typeof defaultValue\n if (typeOfDefaultValue !== 'string' && typeOfDefaultValue !== 'number' && typeOfDefaultValue !== 'boolean') {\n console.error('Only primitive types (string, number, boolean) are accepted as value')\n return null\n }\n\n const existing = variableStore.getVariable(name)\n if (existing) {\n return existing\n }\n\n const varInstance = new Variable({ variableStore })\n try {\n varInstance.name = name\n varInstance.defaultValue = defaultValue\n varInstance.value = defaultValue\n varInstance.type = typeOfDefaultValue\n variableStore.registerVariable(varInstance)\n varInstance.update(defaultValue)\n } catch (error) {\n console.error(error)\n }\n return varInstance\n }\n\n /**\n * Updates the variable's value, triggering callbacks if hasVarsRequestCompleted is returned true.\n * @param {*} newValue - The new value to be assigned to the variable.\n */\n update (newValue) {\n const oldValue = this.value\n this.value = newValue\n if (newValue === null && oldValue === null) {\n return\n }\n if (newValue !== null && newValue === oldValue && this.hadStarted) {\n return\n }\n if (this.#variableStore.hasVarsRequestCompleted()) {\n this.hadStarted = true\n this.triggerValueChanged()\n }\n }\n\n /**\n * Invokes all registered callbacks when the variable value changes.\n */\n triggerValueChanged () {\n this.valueChangedCallbacks.forEach((onValueChanged) => {\n onValueChanged(this)\n })\n }\n\n /**\n * Adds a callback function to the array and triggers it immediately if variable requests have completed.\n * @param {Function} onValueChanged - The callback function to be added.\n */\n addValueChangedCallback (onValueChanged) {\n if (!onValueChanged) {\n console.log('Invalid callback parameter provided.')\n return\n }\n this.valueChangedCallbacks.push(onValueChanged)\n\n if (this.#variableStore.hasVarsRequestCompleted()) {\n onValueChanged(this)\n }\n }\n\n /**\n * Removes a callback function from the array.\n * @param {Function} onValueChanged - The callback function to be removed.\n */\n removeValueChangedCallback (onValueChanged) {\n const index = this.valueChangedCallbacks.indexOf(onValueChanged)\n if (index !== -1) {\n this.valueChangedCallbacks.splice(index, 1)\n }\n }\n\n /**\n * Resets the `hadStarted` flag to false.\n */\n clearStartFlag () {\n this.hadStarted = false\n }\n}\n","import { VARIABLES, WZRK_FETCH } from '../../util/constants'\nimport { StorageManager, $ct } from '../../util/storage'\nclass VariableStore {\n #logger\n #account\n #request\n #event\n\n #variables\n #remoteVariables\n #fetchCallback\n #variablesChangedCallbacks\n #oneTimeVariablesChangedCallbacks\n #hasVarsRequestCompleted = false\n\n constructor ({ logger, request, account, event }) {\n this.#logger = logger\n this.#account = account\n this.#request = request\n this.#event = event\n\n this.#variables = {}\n this.#remoteVariables = {}\n this.#variablesChangedCallbacks = []\n this.#oneTimeVariablesChangedCallbacks = []\n\n $ct.variableStore = this\n }\n\n /**\n * Registers a variable instance in the store.\n * @param {Object} varInstance - The variable instance to be registered.\n */\n registerVariable (varInstance) {\n const { name } = varInstance\n this.#variables[name] = varInstance\n console.log('registerVariable', this.#variables)\n }\n\n /**\n * Retrieves a variable by its name.\n * @param {string} name - The name of the variable to retrieve.\n * @returns {Object} - The variable instance.\n */\n getVariable (name) {\n return this.#variables[name]\n }\n\n hasVarsRequestCompleted () {\n return this.#hasVarsRequestCompleted\n }\n\n /**\n * Synchronizes variables with the server.\n * @param {Function} onSyncSuccess - Callback function on successful synchronization.\n * @param {Function} onSyncFailure - Callback function on synchronization failure.\n * @throws Will throw an error if the account token is missing.\n * @returns {Promise} - The result of the synchronization request.\n */\n syncVariables (onSyncSuccess, onSyncFailure) {\n if (!this.#account.token) {\n const m = 'Account token is missing.'\n this.#logger.error(m)\n return Promise.reject(new Error(m))\n }\n\n const payload = {\n type: 'varsPayload',\n vars: {}\n }\n\n for (const name in this.#variables) {\n payload.vars[name] = {\n defaultValue: this.#variables[name].defaultValue,\n type: this.#variables[name].type\n }\n }\n\n // Check if payload.vars is empty\n if (Object.keys(payload.vars).length === 0) {\n const m = 'No variables are defined.'\n this.#logger.error(m)\n return Promise.reject(new Error(m))\n }\n\n let meta = {}\n meta = this.#request.addSystemDataToObject(meta, undefined)\n meta.tk = this.#account.token\n\n meta.type = 'meta'\n const body = JSON.stringify([meta, payload])\n const url = this.#account.dataPostPEURL\n\n return this.#request.post(url, body)\n .then((r) => {\n if (onSyncSuccess && typeof onSyncSuccess === 'function') {\n onSyncSuccess(r)\n }\n return r\n })\n .catch((e) => {\n if (onSyncFailure && typeof onSyncFailure === 'function') {\n onSyncFailure(e)\n }\n if (e.status === 400) {\n this.#logger.error('Invalid sync payload or clear the existing draft')\n } else if (e.status === 401) {\n this.#logger.error('This is not a test profile')\n } else {\n this.#logger.error('Sync variable failed')\n }\n throw e\n })\n }\n\n /**\n * Fetches variables from the server.\n * @param {Function} onFetchCallback - Callback function on fetch completion.\n */\n fetchVariables (onFetchCallback) {\n this.#event.push(WZRK_FETCH, { t: 4 })\n if (onFetchCallback && typeof onFetchCallback === 'function') {\n this.#fetchCallback = onFetchCallback\n }\n }\n\n mergeVariables (vars) {\n console.log('msg vars is ', vars)\n this.#hasVarsRequestCompleted = true\n\n StorageManager.saveToLSorCookie(VARIABLES, vars)\n this.#remoteVariables = vars\n\n for (const name in this.#variables) {\n if (vars.hasOwnProperty(name)) {\n this.#variables[name].update(vars[name])\n }\n }\n\n if (this.#fetchCallback) {\n this.#fetchCallback()\n }\n\n this.#runVariablesChangedCallback()\n }\n\n addVariablesChangedCallback (callback) {\n if (callback && typeof callback === 'function') {\n this.#variablesChangedCallbacks.push(callback)\n\n if (this.hasVarsRequestCompleted()) {\n callback()\n }\n } else {\n this.#logger.error('callback is not a function')\n }\n }\n\n addOneTimeVariablesChangedCallback (callback) {\n if (callback && typeof callback === 'function') {\n if (this.hasVarsRequestCompleted()) {\n callback()\n } else {\n this.#oneTimeVariablesChangedCallbacks.push(callback)\n }\n }\n }\n\n removeVariablesChangedCallback (callback) {\n const index = this.#variablesChangedCallbacks.indexOf(callback)\n if (index !== -1) {\n this.#variablesChangedCallbacks.splice(index, 1)\n }\n }\n\n removeOneTimeVariablesChangedCallback (callback) {\n const index = this.#oneTimeVariablesChangedCallbacks.indexOf(callback)\n if (index !== -1) {\n this.#oneTimeVariablesChangedCallbacks.splice(index, 1)\n }\n }\n\n #runVariablesChangedCallback () {\n for (var callback of this.#variablesChangedCallbacks) {\n callback()\n }\n for (var callBack of this.#oneTimeVariablesChangedCallbacks) {\n callBack()\n }\n this.#oneTimeVariablesChangedCallbacks.length = 0\n }\n}\n\nexport default VariableStore\n","import Account from './modules/account'\nimport CleverTapAPI from './modules/api'\nimport DeviceManager from './modules/device'\nimport EventHandler from './modules/event'\nimport ProfileHandler from './modules/profile'\nimport UserLoginHandler from './modules/userLogin'\nimport _tr from './util/tr'\nimport User from './modules/user'\nimport { Logger, logLevels } from './modules/logger'\nimport SessionManager from './modules/session'\nimport ReqestManager from './modules/request'\nimport {\n CAMP_COOKIE_NAME,\n SCOOKIE_PREFIX,\n NOTIFICATION_VIEWED,\n NOTIFICATION_CLICKED,\n EVT_PING,\n FIRST_PING_FREQ_IN_MILLIS,\n CONTINUOUS_PING_FREQ_IN_MILLIS,\n GROUP_SUBSCRIPTION_REQUEST_ID,\n WZRK_ID,\n WZRK_PREFIX,\n categoryLongKey,\n COMMAND_INCREMENT,\n COMMAND_DECREMENT,\n COMMAND_SET,\n COMMAND_ADD,\n COMMAND_REMOVE,\n COMMAND_DELETE,\n EVT_PUSH,\n WZRK_FETCH\n} from './util/constants'\nimport { EMBED_ERROR } from './util/messages'\nimport { StorageManager, $ct } from './util/storage'\nimport { addToURL, getDomain, getURLParams } from './util/url'\nimport { getCampaignObjForLc, setEnum, handleEmailSubscription, closeIframe } from './util/clevertap'\nimport { compressData } from './util/encoder'\nimport Privacy from './modules/privacy'\nimport NotificationHandler from './modules/notification'\nimport { hasWebInboxSettingsInLS, checkAndRegisterWebInboxElements, initializeWebInbox, getInboxMessages, saveInboxMessages } from './modules/web-inbox/helper'\nimport { Variable } from './modules/variables/variable'\nimport VariableStore from './modules/variables/variableStore'\nimport { checkBuilder, addAntiFlicker } from './modules/visualBuilder/pageBuilder'\nimport { setServerKey } from './modules/webPushPrompt/prompt'\n\nexport default class CleverTap {\n #logger\n #api\n #onloadcalled\n #device\n #session\n #account\n #request\n #variableStore\n #isSpa\n #previousUrl\n #boundCheckPageChanged = this.#checkPageChanged.bind(this)\n #dismissSpamControl\n enablePersonalization\n\n get spa () {\n return this.#isSpa\n }\n\n set spa (value) {\n const isSpa = value === true\n if (this.#isSpa !== isSpa && this.#onloadcalled === 1) {\n // if clevertap.spa is changed after init has been called then update the click listeners\n if (isSpa) {\n document.addEventListener('click', this.#boundCheckPageChanged)\n } else {\n document.removeEventListener('click', this.#boundCheckPageChanged)\n }\n }\n this.#isSpa = isSpa\n }\n\n get dismissSpamControl () {\n return this.#dismissSpamControl\n }\n\n set dismissSpamControl (value) {\n const dismissSpamControl = value === true\n this.#dismissSpamControl = dismissSpamControl\n $ct.dismissSpamControl = dismissSpamControl\n }\n\n constructor (clevertap = {}) {\n this.#onloadcalled = 0\n this._isPersonalisationActive = this._isPersonalisationActive.bind(this)\n this.raiseNotificationClicked = () => { }\n this.#logger = new Logger(logLevels.INFO)\n this.#account = new Account(clevertap.account?.[0], clevertap.region || clevertap.account?.[1], clevertap.targetDomain || clevertap.account?.[2], clevertap.token || clevertap.account?.[3])\n this.#device = new DeviceManager({ logger: this.#logger })\n this.#dismissSpamControl = clevertap.dismissSpamControl || false\n this.shpfyProxyPath = clevertap.shpfyProxyPath || ''\n this.#session = new SessionManager({\n logger: this.#logger,\n isPersonalisationActive: this._isPersonalisationActive\n })\n this.#request = new ReqestManager({\n logger: this.#logger,\n account: this.#account,\n device: this.#device,\n session: this.#session,\n isPersonalisationActive: this._isPersonalisationActive\n })\n this.enablePersonalization = clevertap.enablePersonalization || false\n this.event = new EventHandler({\n logger: this.#logger,\n request: this.#request,\n isPersonalisationActive: this._isPersonalisationActive\n }, clevertap.event)\n\n this.profile = new ProfileHandler({\n logger: this.#logger,\n request: this.#request,\n account: this.#account,\n isPersonalisationActive: this._isPersonalisationActive\n }, clevertap.profile)\n\n this.onUserLogin = new UserLoginHandler({\n request: this.#request,\n account: this.#account,\n session: this.#session,\n logger: this.#logger,\n device: this.#device\n }, clevertap.onUserLogin)\n\n this.privacy = new Privacy({\n request: this.#request,\n account: this.#account,\n logger: this.#logger\n }, clevertap.privacy)\n\n this.notifications = new NotificationHandler({\n logger: this.#logger,\n request: this.#request,\n account: this.#account\n }, clevertap.notifications)\n\n this.#variableStore = new VariableStore({\n logger: this.#logger,\n request: this.#request,\n account: this.#account,\n event: this.event\n })\n\n this.#api = new CleverTapAPI({\n logger: this.#logger,\n request: this.#request,\n device: this.#device,\n session: this.#session\n })\n\n this.spa = clevertap.spa\n this.dismissSpamControl = clevertap.dismissSpamControl\n\n this.user = new User({\n isPersonalisationActive: this._isPersonalisationActive\n })\n\n this.session = {\n getTimeElapsed: () => {\n return this.#session.getTimeElapsed()\n },\n getPageCount: () => {\n return this.#session.getPageCount()\n }\n }\n\n this.logout = () => {\n this.#logger.debug('logout called')\n StorageManager.setInstantDeleteFlagInK()\n }\n\n this.clear = () => {\n this.onUserLogin.clear()\n }\n\n this.getCleverTapID = () => {\n return this.#device.getGuid()\n }\n\n this.getAccountID = () => {\n return this.#account.id\n }\n\n this.getSCDomain = () => {\n return this.#account.finalTargetDomain\n }\n\n this.setLibrary = (libName, libVersion) => {\n $ct.flutterVersion = { [libName]: libVersion }\n }\n\n // Set the Signed Call sdk version and fire request\n this.setSCSDKVersion = (ver) => {\n this.#account.scSDKVersion = ver\n const data = {}\n data.af = { scv: 'sc-sdk-v' + this.#account.scSDKVersion }\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', 'page')\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(JSON.stringify(data), this.#logger))\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n\n if (hasWebInboxSettingsInLS()) {\n checkAndRegisterWebInboxElements()\n initializeWebInbox(this.#logger)\n }\n\n // Get Inbox Message Count\n this.getInboxMessageCount = () => {\n const msgCount = getInboxMessages()\n return Object.keys(msgCount).length\n }\n\n // Get Inbox Unread Message Count\n this.getInboxMessageUnreadCount = () => {\n if ($ct.inbox) {\n return $ct.inbox.unviewedCounter\n } else {\n this.#logger.debug('No unread messages')\n }\n }\n\n // Get All Inbox messages\n this.getAllInboxMessages = () => {\n return getInboxMessages()\n }\n\n // Get only Unread messages\n this.getUnreadInboxMessages = () => {\n if ($ct.inbox) {\n return $ct.inbox.unviewedMessages\n } else {\n this.#logger.debug('No unread messages')\n }\n }\n\n // Get message object belonging to the given message id only. Message id should be a String\n this.getInboxMessageForId = (messageId) => {\n const messages = getInboxMessages()\n if ((messageId !== null || messageId !== '') && messages.hasOwnProperty(messageId)) {\n return messages[messageId]\n } else {\n this.#logger.error('No message available for message Id ' + messageId)\n }\n }\n\n // Delete message from the Inbox. Message id should be a String\n // If the message to be deleted is unviewed then decrement the badge count, delete the message from unviewedMessages list\n // Then remove the message from local storage and update cookie\n this.deleteInboxMessage = (messageId) => {\n const messages = getInboxMessages()\n if ((messageId !== null || messageId !== '') && messages.hasOwnProperty(messageId)) {\n const el = document.querySelector('ct-web-inbox').shadowRoot.getElementById(messageId)\n if (messages[messageId].viewed === 0) {\n $ct.inbox.unviewedCounter--\n delete $ct.inbox.unviewedMessages[messageId]\n document.getElementById('unviewedBadge').innerText = $ct.inbox.unviewedCounter\n document.getElementById('unviewedBadge').style.display = $ct.inbox.unviewedCounter > 0 ? 'flex' : 'none'\n }\n el && el.remove()\n delete messages[messageId]\n saveInboxMessages(messages)\n } else {\n this.#logger.error('No message available for message Id ' + messageId)\n }\n }\n\n /* Mark Message as Read. Message id should be a String\n - Check if the message Id exist in the unread message list\n - Remove the unread marker, update the viewed flag, decrement the bage Count\n - renderNotificationViewed */\n this.markReadInboxMessage = (messageId) => {\n const unreadMsg = $ct.inbox.unviewedMessages\n const messages = getInboxMessages()\n if ((messageId !== null || messageId !== '') && unreadMsg.hasOwnProperty(messageId)) {\n const el = document.querySelector('ct-web-inbox').shadowRoot.getElementById(messageId)\n if (el !== null) { el.shadowRoot.getElementById('unreadMarker').style.display = 'none' }\n messages[messageId].viewed = 1\n if (document.getElementById('unviewedBadge')) {\n var counter = parseInt(document.getElementById('unviewedBadge').innerText) - 1\n document.getElementById('unviewedBadge').innerText = counter\n document.getElementById('unviewedBadge').style.display = counter > 0 ? 'flex' : 'none'\n }\n window.clevertap.renderNotificationViewed({ msgId: messages[messageId].wzrk_id, pivotId: messages[messageId].pivotId })\n $ct.inbox.unviewedCounter--\n delete $ct.inbox.unviewedMessages[messageId]\n saveInboxMessages(messages)\n } else {\n this.#logger.error('No message available for message Id ' + messageId)\n }\n }\n\n /* Mark Message as Read. messageIds should be a an array of string */\n this.markReadInboxMessagesForIds = (messageIds) => {\n if (Array.isArray(messageIds)) {\n for (var id = 0; id < messageIds.length; id++) {\n this.markReadInboxMessage(messageIds[id])\n }\n }\n }\n\n /* Mark all messages as read\n - Get the count of unread messages, update unread marker style\n - renderNotificationViewed, update the badge count and style\n */\n this.markReadAllInboxMessage = () => {\n const unreadMsg = $ct.inbox.unviewedMessages\n const messages = getInboxMessages()\n if (Object.keys(unreadMsg).length > 0) {\n const msgIds = Object.keys(unreadMsg)\n msgIds.forEach(key => {\n const el = document.querySelector('ct-web-inbox').shadowRoot.getElementById(key)\n if (el !== null) { el.shadowRoot.getElementById('unreadMarker').style.display = 'none' }\n messages[key].viewed = 1\n window.clevertap.renderNotificationViewed({ msgId: messages[key].wzrk_id, pivotId: messages[key].wzrk_pivot })\n })\n document.getElementById('unviewedBadge').innerText = 0\n document.getElementById('unviewedBadge').style.display = 'none'\n saveInboxMessages(messages)\n $ct.inbox.unviewedCounter = 0\n $ct.inbox.unviewedMessages = {}\n } else {\n this.#logger.debug('All messages are already read')\n }\n }\n\n this.toggleInbox = (e) => $ct.inbox?.toggleInbox(e)\n\n // method for notification viewed\n this.renderNotificationViewed = (detail) => {\n processNotificationEvent(NOTIFICATION_VIEWED, detail)\n }\n\n // method for notification clicked\n this.renderNotificationClicked = (detail) => {\n processNotificationEvent(NOTIFICATION_CLICKED, detail)\n }\n\n const processNotificationEvent = (eventName, eventDetail) => {\n if (!eventDetail || !eventDetail.msgId) { return }\n const data = {}\n data.type = 'event'\n data.evtName = eventName\n data.evtData = { [WZRK_ID]: eventDetail.msgId }\n\n if (eventDetail.pivotId) {\n data.evtData = { ...data.evtData, wzrk_pivot: eventDetail.pivotId }\n }\n\n if (eventDetail.wzrk_slideNo) {\n data.evtData = { ...data.evtData, wzrk_slideNo: eventDetail.wzrk_slideNo }\n }\n\n // Adding kv pair to event data\n if (eventDetail.kv && eventDetail.kv !== null && eventDetail.kv !== undefined) {\n for (const key in eventDetail.kv) {\n if (key.startsWith(WZRK_PREFIX)) {\n data.evtData = { ...data.evtData, [key]: eventDetail.kv[key] }\n }\n }\n }\n\n // Adding msgCTkv to event data\n if (eventDetail.msgCTkv && eventDetail.msgCTkv !== null && eventDetail.msgCTkv !== undefined) {\n for (const key in eventDetail.msgCTkv) {\n if (key.startsWith(WZRK_PREFIX)) {\n data.evtData = { ...data.evtData, [key]: eventDetail.msgCTkv[key] }\n }\n }\n }\n this.#request.processEvent(data)\n }\n\n this.setLogLevel = (l) => {\n this.#logger.logLevel = Number(l)\n if (l === 3) {\n sessionStorage.WZRK_D = ''\n } else {\n delete sessionStorage.WZRK_D\n }\n }\n /**\n * @param {} key\n * @param {*} value\n */\n this.handleIncrementValue = (key, value) => {\n this.profile._handleIncrementDecrementValue(key, value, COMMAND_INCREMENT)\n }\n\n this.handleDecrementValue = (key, value) => {\n this.profile._handleIncrementDecrementValue(key, value, COMMAND_DECREMENT)\n }\n\n this.setMultiValuesForKey = (key, value) => {\n if (Array.isArray(value)) {\n this.profile._handleMultiValueSet(key, value, COMMAND_SET)\n } else {\n console.error('setMultiValuesForKey should be called with a value of type array')\n }\n }\n\n this.addMultiValueForKey = (key, value) => {\n if (typeof value === 'string' || typeof value === 'number') {\n this.profile._handleMultiValueAdd(key, value, COMMAND_ADD)\n } else {\n console.error('addMultiValueForKey should be called with a value of type string or number.')\n }\n }\n\n this.addMultiValuesForKey = (key, value) => {\n if (Array.isArray(value)) {\n this.profile._handleMultiValueAdd(key, value, COMMAND_ADD)\n } else {\n console.error('addMultiValuesForKey should be called with a value of type array.')\n }\n }\n\n this.removeMultiValueForKey = (key, value) => {\n if (typeof value === 'string' || typeof value === 'number') {\n this.profile._handleMultiValueRemove(key, value, COMMAND_REMOVE)\n } else {\n console.error('removeMultiValueForKey should be called with a value of type string or number.')\n }\n }\n\n this.removeMultiValuesForKey = (key, value) => {\n if (Array.isArray(value)) {\n this.profile._handleMultiValueRemove(key, value, COMMAND_REMOVE)\n } else {\n console.error('removeMultiValuesForKey should be called with a value of type array.')\n }\n }\n\n this.removeValueForKey = (key) => {\n this.profile._handleMultiValueDelete(key, COMMAND_DELETE)\n }\n\n const _handleEmailSubscription = (subscription, reEncoded, fetchGroups) => {\n handleEmailSubscription(subscription, reEncoded, fetchGroups, this.#account, this.#logger)\n }\n\n /**\n *\n * @param {number} lat\n * @param {number} lng\n * @param {callback function} handleCoordinates\n * @returns\n */\n this.getLocation = function (lat, lng) {\n // latitude and longitude should be number type\n if ((lat && typeof lat !== 'number') || (lng && typeof lng !== 'number')) {\n console.log('Latitude and Longitude must be of number type')\n return\n }\n if (lat && lng) {\n // valid latitude ranges bw +-90\n if (lat <= -90 || lat > 90) {\n console.log('A vaid latitude must range between -90 and 90')\n return\n }\n // valid longitude ranges bw +-180\n if (lng <= -180 || lng > 180) {\n console.log('A valid longitude must range between -180 and 180')\n return\n }\n $ct.location = { Latitude: lat, Longitude: lng }\n this.#sendLocationData({ Latitude: lat, Longitude: lng })\n } else {\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(showPosition.bind(this), showError)\n } else {\n console.log('Geolocation is not supported by this browser.')\n }\n }\n }\n\n function showPosition (position) {\n var lat = position.coords.latitude\n var lng = position.coords.longitude\n $ct.location = { Latitude: lat, Longitude: lng }\n this.#sendLocationData({ Latitude: lat, Longitude: lng })\n }\n\n function showError (error) {\n switch (error.code) {\n case error.PERMISSION_DENIED:\n console.log('User denied the request for Geolocation.')\n break\n case error.POSITION_UNAVAILABLE:\n console.log('Location information is unavailable.')\n break\n case error.TIMEOUT:\n console.log('The request to get user location timed out.')\n break\n case error.UNKNOWN_ERROR:\n console.log('An unknown error occurred.')\n break\n }\n }\n\n const api = this.#api\n api.logout = this.logout\n api.clear = this.clear\n api.closeIframe = (campaignId, divIdIgnored) => {\n closeIframe(campaignId, divIdIgnored, this.#session.sessionId)\n }\n api.enableWebPush = (enabled, applicationServerKey) => {\n setServerKey(applicationServerKey)\n this.notifications._enableWebPush(enabled, applicationServerKey)\n }\n api.tr = (msg) => {\n _tr(msg, {\n device: this.#device,\n session: this.#session,\n request: this.#request,\n logger: this.#logger\n })\n }\n api.setEnum = (enumVal) => {\n setEnum(enumVal, this.#logger)\n }\n api.is_onloadcalled = () => {\n return (this.#onloadcalled === 1)\n }\n api.subEmail = (reEncoded) => {\n _handleEmailSubscription('1', reEncoded)\n }\n api.getEmail = (reEncoded, withGroups) => {\n _handleEmailSubscription('-1', reEncoded, withGroups)\n }\n api.unSubEmail = (reEncoded) => {\n _handleEmailSubscription('0', reEncoded)\n }\n api.unsubEmailGroups = (reEncoded) => {\n $ct.unsubGroups = []\n const elements = document.getElementsByClassName('ct-unsub-group-input-item')\n\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i]\n if (element.name) {\n const data = { name: element.name, isUnsubscribed: element.checked }\n $ct.unsubGroups.push(data)\n }\n }\n\n _handleEmailSubscription(GROUP_SUBSCRIPTION_REQUEST_ID, reEncoded)\n }\n api.setSubscriptionGroups = (value) => {\n $ct.unsubGroups = value\n }\n api.getSubscriptionGroups = () => {\n return $ct.unsubGroups\n }\n api.changeSubscriptionGroups = (reEncoded, updatedGroups) => {\n api.setSubscriptionGroups(updatedGroups)\n _handleEmailSubscription(GROUP_SUBSCRIPTION_REQUEST_ID, reEncoded)\n }\n api.isGlobalUnsubscribe = () => {\n return $ct.globalUnsubscribe\n }\n api.setIsGlobalUnsubscribe = (value) => {\n $ct.globalUnsubscribe = value\n }\n api.setUpdatedCategoryLong = (profile) => {\n if (profile[categoryLongKey]) {\n $ct.updatedCategoryLong = profile[categoryLongKey]\n }\n }\n window.$CLTP_WR = window.$WZRK_WR = api\n\n if (clevertap.account?.[0].id) {\n // The accountId is present so can init with empty values.\n // Needed to maintain backward compatability with legacy implementations.\n // Npm imports/require will need to call init explictly with accountId\n this.init()\n }\n }\n\n // starts here\n init (accountId, region, targetDomain, token, antiFlicker = {}) {\n if (Object.keys(antiFlicker).length > 0) {\n addAntiFlicker(antiFlicker)\n }\n if (this.#onloadcalled === 1) {\n // already initailsed\n return\n }\n\n StorageManager.removeCookie('WZRK_P', window.location.hostname)\n if (!this.#account.id) {\n if (!accountId) {\n this.#logger.error(EMBED_ERROR)\n return\n }\n this.#account.id = accountId\n }\n checkBuilder(this.#logger, this.#account.id)\n this.#session.cookieName = SCOOKIE_PREFIX + '_' + this.#account.id\n\n if (region) {\n this.#account.region = region\n }\n if (targetDomain) {\n this.#account.targetDomain = targetDomain\n }\n if (token) {\n this.#account.token = token\n }\n\n const currLocation = location.href\n const urlParams = getURLParams(currLocation.toLowerCase())\n\n // eslint-disable-next-line eqeqeq\n if (typeof urlParams.e !== 'undefined' && urlParams.wzrk_ex == '0') {\n return\n }\n\n $ct.isPrivacyArrPushed = true\n if ($ct.privacyArray.length > 0) {\n this.privacy.push($ct.privacyArray)\n }\n\n this.#processOldValues()\n this.pageChanged()\n const backupInterval = setInterval(() => {\n if (this.#device.gcookie) {\n clearInterval(backupInterval)\n this.#request.processBackupEvents()\n }\n }, 3000)\n if (this.#isSpa) {\n // listen to click on the document and check if URL has changed.\n document.addEventListener('click', this.#boundCheckPageChanged)\n } else {\n // remove existing click listeners if any\n document.removeEventListener('click', this.#boundCheckPageChanged)\n }\n this.#onloadcalled = 1\n }\n\n // process the option array provided to the clevertap object\n // after its been initialized\n #processOldValues () {\n this.onUserLogin._processOldValues()\n this.privacy._processOldValues()\n this.event._processOldValues()\n this.profile._processOldValues()\n this.notifications._processOldValues()\n }\n\n #debounce (func, delay = 300) {\n let timeout\n return function () {\n clearTimeout(timeout)\n timeout = setTimeout(func, delay)\n }\n }\n\n #checkPageChanged () {\n const debouncedPageChanged = this.#debounce(() => {\n if (this.#previousUrl !== location.href) {\n this.pageChanged()\n }\n })\n debouncedPageChanged()\n }\n\n pageChanged () {\n const currLocation = window.location.href\n const urlParams = getURLParams(currLocation.toLowerCase())\n // -- update page count\n const obj = this.#session.getSessionCookieObject()\n let pgCount = (typeof obj.p === 'undefined') ? 0 : obj.p\n obj.p = ++pgCount\n this.#session.setSessionCookieObject(obj)\n // -- update page count\n\n let data = {}\n let referrerDomain = getDomain(document.referrer)\n\n if (window.location.hostname !== referrerDomain) {\n const maxLen = 120\n if (referrerDomain !== '') {\n referrerDomain = referrerDomain.length > maxLen ? referrerDomain.substring(0, maxLen) : referrerDomain\n data.referrer = referrerDomain\n }\n\n let utmSource = urlParams.utm_source || urlParams.wzrk_source\n if (typeof utmSource !== 'undefined') {\n utmSource = utmSource.length > maxLen ? utmSource.substring(0, maxLen) : utmSource\n data.us = utmSource // utm_source\n }\n\n let utmMedium = urlParams.utm_medium || urlParams.wzrk_medium\n if (typeof utmMedium !== 'undefined') {\n utmMedium = utmMedium.length > maxLen ? utmMedium.substring(0, maxLen) : utmMedium\n data.um = utmMedium // utm_medium\n }\n\n let utmCampaign = urlParams.utm_campaign || urlParams.wzrk_campaign\n if (typeof utmCampaign !== 'undefined') {\n utmCampaign = utmCampaign.length > maxLen ? utmCampaign.substring(0, maxLen) : utmCampaign\n data.uc = utmCampaign // utm_campaign\n }\n\n // also independently send wzrk_medium to the backend\n if (typeof urlParams.wzrk_medium !== 'undefined') {\n const wm = urlParams.wzrk_medium\n if (wm.match(/^email$|^social$|^search$/)) {\n data.wm = wm // wzrk_medium\n }\n }\n }\n\n data = this.#request.addSystemDataToObject(data, undefined)\n data.cpg = currLocation\n\n data[CAMP_COOKIE_NAME] = getCampaignObjForLc()\n let pageLoadUrl = this.#account.dataPostURL\n this.#request.addFlags(data)\n // send dsync flag when page = 1\n if (parseInt(data.pg) === 1) {\n this.#overrideDSyncFlag(data)\n }\n pageLoadUrl = addToURL(pageLoadUrl, 'type', 'page')\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(JSON.stringify(data), this.#logger))\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n\n if (parseInt(data.pg) === 1) {\n this.event.push(WZRK_FETCH, { t: 4 })\n }\n\n this.#previousUrl = currLocation\n setTimeout(() => {\n if (pgCount <= 3) {\n // send ping for up to 3 pages\n this.#pingRequest()\n }\n\n if (this.#isPingContinuous()) {\n setInterval(() => {\n this.#pingRequest()\n }, CONTINUOUS_PING_FREQ_IN_MILLIS)\n }\n }, FIRST_PING_FREQ_IN_MILLIS)\n }\n\n #pingRequest () {\n let pageLoadUrl = this.#account.dataPostURL\n let data = {}\n data = this.#request.addSystemDataToObject(data, undefined)\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PING)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(JSON.stringify(data), this.#logger))\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n\n #isPingContinuous () {\n return (typeof window.wzrk_d !== 'undefined' && window.wzrk_d.ping === 'continuous')\n }\n\n _isPersonalisationActive () {\n return StorageManager._isLocalStorageSupported() && this.enablePersonalization\n }\n\n #overrideDSyncFlag (data) {\n if (this._isPersonalisationActive()) {\n data.dsync = true\n }\n }\n\n popupCallbacks = {};\n popupCurrentWzrkId = '';\n\n // eslint-disable-next-line accessor-pairs\n set popupCallback (callback) {\n this.popupCallbacks[this.popupCurrentWzrkId] = callback\n }\n\n /**\n *\n * @param {object} payload\n */\n #sendLocationData (payload) {\n // Send the updated value to LC\n let data = {}\n data.af = {}\n const profileObj = {}\n data.type = 'profile'\n if (profileObj.tz == null) {\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n data.profile = profileObj\n if (payload) {\n const keys = Object.keys(payload)\n keys.forEach(key => {\n data.af[key] = payload[key]\n })\n }\n if ($ct.location) {\n data.af = { ...data.af, ...$ct.location }\n }\n data = this.#request.addSystemDataToObject(data, true)\n this.#request.addFlags(data)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n\n // offline mode\n /**\n * events will be recorded and queued locally when passed with true\n * but will not be sent to the server until offline is disabled by passing false\n * @param {boolean} arg\n */\n\n setOffline (arg) {\n if (typeof arg !== 'boolean') {\n console.error('setOffline should be called with a value of type boolean')\n return\n }\n $ct.offline = arg\n // if offline is disabled\n // process events from cache\n if (!arg) {\n this.#request.processBackupEvents()\n }\n }\n\n getSDKVersion () {\n return 'web-sdk-v$$PACKAGE_VERSION$$'\n }\n\n defineVariable (name, defaultValue) {\n return Variable.define(name, defaultValue, this.#variableStore)\n }\n\n syncVariables (onSyncSuccess, onSyncFailure) {\n if (this.#logger.logLevel === 4) {\n return this.#variableStore.syncVariables(onSyncSuccess, onSyncFailure)\n } else {\n const m = 'App log level is not set to 4'\n this.#logger.error(m)\n return Promise.reject(new Error(m))\n }\n }\n\n fetchVariables (onFetchCallback) {\n this.#variableStore.fetchVariables(onFetchCallback)\n }\n\n addVariablesChangedCallback (callback) {\n this.#variableStore.addVariablesChangedCallback(callback)\n }\n\n addOneTimeVariablesChangedCallback (callback) {\n this.#variableStore.addOneTimeVariablesChangedCallback(callback)\n }\n}\n","import Clevertap from './clevertap'\n\nconst clevertap = new Clevertap(window.clevertap)\n\nwindow.clevertap = window.wizrocket = clevertap\n\nexport default clevertap\n"],"names":["TARGET_DOMAIN","TARGET_PROTOCOL","DEFAULT_REGION","Account","constructor","id","region","targetDomain","token","accountId","dcSDKVersion","finalTargetDomain","dataPostPEURL","dataPostURL","recorderURL","emailURL","unsupportedKeyCharRegex","RegExp","unsupportedValueCharRegex","singleQuoteRegex","CLEAR","CHARGED_ID","CHARGEDID_COOKIE_NAME","GCOOKIE_NAME","KCOOKIE_NAME","CAMP_COOKIE_NAME","CAMP_COOKIE_G","SCOOKIE_PREFIX","SCOOKIE_EXP_TIME_IN_SECS","EV_COOKIE","META_COOKIE","PR_COOKIE","ARP_COOKIE","LCOOKIE_NAME","GLOBAL","DISPLAY","WEBPUSH_LS_KEY","OPTOUT_KEY","CT_OPTOUT_KEY","OPTOUT_COOKIE_ENDSWITH","USEIP_KEY","LRU_CACHE","LRU_CACHE_SIZE","IS_OUL","EVT_PUSH","EVT_PING","COOKIE_EXPIRY","MAX_TRIES","FIRST_PING_FREQ_IN_MILLIS","CONTINUOUS_PING_FREQ_IN_MILLIS","GROUP_SUBSCRIPTION_REQUEST_ID","categoryLongKey","WZRK_PREFIX","WZRK_ID","NOTIFICATION_VIEWED","NOTIFICATION_CLICKED","FIRE_PUSH_UNREGISTERED","PUSH_SUBSCRIPTION_DATA","COMMAND_INCREMENT","COMMAND_DECREMENT","COMMAND_SET","COMMAND_ADD","COMMAND_REMOVE","COMMAND_DELETE","WEBINBOX_CONFIG","WEBINBOX","MAX_INBOX_MSG","VARIABLES","PUSH_DELAY_MS","MAX_DELAY_FREQUENCY","WZRK_FETCH","WEBPUSH_CONFIG","SYSTEM_EVENTS","isString","input","String","isObject","Object","prototype","toString","call","isDateObject","Date","isObjectEmpty","obj","prop","hasOwnProperty","isConvertibleToNumber","n","isNaN","parseFloat","isFinite","isNumber","test","isValueValid","value","undefined","removeUnsupportedChars","o","logger","key","sanitizedVal","sanitizedKey","sanitize","length","substring","reportError","val","regex","replace","getToday","today","getFullYear","getMonth","getDay","getNow","Math","floor","getTime","convertToWZRKDate","dateObj","round","setDate","dt","isDateValid","date","matches","exec","d","m","y","composedDate","getDate","StorageManager","save","_isLocalStorageSupported","localStorage","setItem","JSON","stringify","read","data","getItem","parse","e","remove","removeItem","removeCookie","name","domain","cookieStr","document","cookie","createCookie","seconds","expires","domainStr","setTime","toGMTString","encodeURIComponent","readCookie","nameEQ","ca","split","idx","c","charAt","indexOf","decodeURIComponent","window","saveToLSorCookie","property","location","hostname","$ct","globalCache","readFromLSorCookie","trim","err","createBroadCookie","broadDomain","domainParts","testBroadDomain","testCookieName","tempCookie","getMetaProp","metaObj","setMetaProp","wzrkMetaObj","getAndClearMetaProp","setInstantDeleteFlagInK","k","flag","backupEvent","reqNo","backupArr","q","debug","removeBackup","respNo","backupMap","gcookie","REQ_N","RESP_N","globalProfileMap","globalEventsMap","blockRequest","isOptInRequest","webPushEnabled","campaignDivMap","currentSessionId","wiz_counter","notifApi","notifEnabledFromApi","unsubGroups","updatedCategoryLong","inbox","isPrivacyArrPushed","privacyArray","offline","dismissSpamControl","globalUnsubscribe","flutterVersion","variableStore","pushConfig","LRUCache","max","lruCache","tempLruCache","cache","entry","push","get","item","saveCacheToLS","set","allKeys","objToArray","index","temp","getKey","getSecondLastKey","keysArr","getLastKey","keysLength","newCache","indexToDelete","splice","CleverTapAPI","request","device","session","s","global","resume","respNumber","optOutResponse","oulReq","newGuid","isOULInProgress","oulReqN","sessionObj","getSessionCookieObject","kIdFromLS","guidFromLRUCache","lastK","lastGUID","unregisterTokenForGuid","manageSession","t","setSessionCookieObject","processingBackup","processBackupEvents","DeviceManager","getGuid","guid","error","DATA_NOT_SENT_TEXT","CLEVERTAP_ERROR_PREFIX","EMBED_ERROR","EVENT_ERROR","GENDER_ERROR","EMPLOYED_ERROR","MARRIED_ERROR","EDUCATION_ERROR","AGE_ERROR","DOB_ERROR","ENUM_FORMAT_ERROR","PHONE_FORMAT_ERROR","_globalChargedId","isEventStructureFlat","eventObj","Array","isArray","isChargedEventStructureValid","chargedObj","itemKey","chargedId","EventHandler","values","isPersonalisationActive","eventsArr","_processOldValues","getDetails","evtName","evtObj","respObj","firstTime","lastTime","count","eventName","shift","includes","type","unshift","evtData","processEvent","getURLParams","url","urlParams","uri","match","pl","search","decode","replacement","getDomain","a","createElement","href","addToURL","v","getHostName","urlBase64ToUint8Array","base64String","padding","repeat","base64","rawData","atob","processedData","i","charCodeAt","Uint8Array","compressData","dataObject","compressToBase64","compress","uncompressed","context_dictionary","context_dictionaryToCreate","context_c","context_wc","context_w","context_enlargeIn","context_dictSize","context_numBits","context_data_string","context_data_val","context_data_position","ii","f","fromCharCode","pow","getKeyStr","_keyStr","output","chr1","chr2","chr3","enc1","enc2","enc3","enc4","NaN","RequestDispatcher","networkRetryCount","minDelayFrequency","fireRequest","skipARP","sendOULFlag","getDelayFrequency","account","randomDelay","random","skipResARP","_arp","pageLoadUrl","useIP","slice","tries","setTimeout","clevertap","wizrocket","plugin","ctCbScripts","getElementsByClassName","parentNode","removeChild","setAttribute","async","getElementsByTagName","appendChild","getCampaignObject","finalcampObj","campObj","wp","saveCampaignObject","campaignObj","newObj","setCampaignObjectForGuid","guidCampObj","finalCampObj","keys","forEach","campKeyObj","globalObj","dailyObj","campaignIdArray","resultObj","dailyC","totalC","campaignId","console","getCampaignObjForLc","storageValue","decodedValue","parsedValue","resultObjWP","resultObjWI","wi","todayCwp","todayCwi","tc","wmp","wimp","tlc","witlc","isProfileValid","profileObj","valid","profileKey","profileVal","Age","Phone","processFBUserObj","user","profileData","Name","FBID","gender","Gender","getHighestEducation","eduArr","college","highschool","edu","relationship_status","Married","education","Education","work","Employed","email","Email","birthday","mmddyy","DOB","processGPlusUserObj","displayName","GPID","image","isDefault","Photo","emails","emailIdx","emailObj","organizations","orgObj","yyyymmdd","relationshipStatus","addToLocalProfileMap","override","_custom","closeIframe","divIdIgnored","sessionCampaignObj","divId","getElementById","style","display","arp","jsonMap","isOULARP","arpFromStorage","setEnum","enumVal","handleEmailSubscription","subscription","reEncoded","fetchGroups","urlParamsAsIs","encodedEmailId","encodedProfileProps","p","pageType","page_type","ProfileHandler","profilesArr","getAttribute","propName","_handleIncrementDecrementValue","command","tz","profile","addSystemDataToObject","addFlags","compressedData","saveAndFireRequest","_handleMultiValueSet","arrayVal","array","toLowerCase","sendMultiValueData","_handleMultiValueAdd","propKey","propVal","existingValue","addValue","normalizedValue","_handleMultiValueRemove","removeValue","_handleMultiValueDelete","profileArr","outerObj","Site","Facebook","FbProfileObj","GPlusProfileObj","UserLoginHandler","clear","addToK","ids","g","kId","anonymousUser","foundInCache","gFromCache","Identity","cookieName","loginArr","pop","processProfile","CTWebPopupImageOnly","HTMLElement","_target","_session","shadow","popup","container","resizeObserver","attachShadow","mode","target","renderImageOnlyPopup","msgId","wzrk_id","pivotId","wzrk_pivot","onClickUrl","sessionId","innerHTML","getImageOnlyPopupContent","shadowRoot","closeIcon","addEventListener","updateImageAndContainerWidth","ResizeObserver","handleResize","observe","unobserve","renderNotificationViewed","open","parent","renderNotificationClicked","width","getRenderedImageWidth","setProperty","msgContent","css","html","visibility","img","ratio","naturalWidth","naturalHeight","height","Message","config","message","wrapper","snackBar","renderMessage","createEl","part","_el","msg","templateType","prepareBasicMessage","timeStamp","determineTimeStampText","viewed","unreadMarker","imageUrl","imageContainer","addImage","iconTitleDescWrapper","iconUrl","iconContainer","titleDescWrapper","title","innerText","description","buttons","buttonsContainer","addButtons","hasCopyAction","b","button","text","cssText","action","addSnackbar","greenTickSvg","clipboardMsg","raiseClickedEvent","path","isPreview","raiseClickedForBasicTemplates","payload","tagName","kv","wzrk_c2a","openUrlInNewTab","focus","navigator","clipboard","writeText","clipboardText","log","messageStyles","backgroundColor","borderColor","titleColor","descriptionColor","buttonColor","buttonTextColor","unreadMarkerColor","inboxContainerStyles","panelBackgroundColor","panelBorderColor","headerBackgroundColor","headerTitleColor","closeIconColor","categoriesTabColor","categoriesTitleColor","categoriesBorderColor","selectedCategoryTabColor","selectedCategoryTitleColor","selectedCategoryBorderColor","headerCategoryHeight","Inbox","isInboxOpen","isInboxFromFlutter","selectedCategory","unviewedMessages","unviewedCounter","inboxConfigForPreview","inboxSelector","emptyInboxMsg","inboxCard","unviewedBadge","observer","selectedCategoryRef","addClickListenerOnDocument","composedPath","toggleInbox","startsWith","prevCategoryRef","updateActiveCategory","_path","filter","messageEl","contains","setBadgeStyle","msgCount","incomingMessages","msgs","updateInboxMessages","incomingMessagesForPreview","previewMsgs","now","buildUIForMessages","updateUnviewedBadgeCounter","connectedCallback","init","styles","notificationsBadge","addUnviewedBadge","createinbox","removeEventListener","categories","getInboxStyles","addMsgsToInboxFromLS","messages","deleteExpiredAndGetUnexpiredMsgs","msgIds","deleteMsgsFromUI","getInboxMessages","wzrk_ttl","el","sort","reduce","acc","saveInboxMessages","inboxMsgs","incomingMsgs","textColor","body","updateUnviewedBadgePosition","top","right","getBoundingClientRect","left","header","headerTitle","createCategories","options","root","rootMargin","threshold","IntersectionObserver","entries","handleMessageViewed","categoriesContainer","leftArrow","arrowSvg","children","scrollBy","categoriesWrapper","_categories","category","rightArrow","firstCategory","lastCategory","firstCategoryObserver","categoryObserverCb","intersectionRatio","lastCategoryObserver","hide","activeCategory","scrollTop","counter","childNodes","updateTSForRenderedMsgs","maxMsgsInInbox","firstChild","sortedMsgs","map","tags","insertBefore","msgTotalCount","querySelectorAll","ctInboxMsgs","hasMessages","raiseViewedEvent","isIntersecting","updateMessageInLS","rect","zIndex","scrollLeft","scrollWidth","setInboxPosition","windowWidth","outerWidth","customInboxStyles","getComputedStyle","getPropertyValue","bottom","hasPositionDefined","res","getInboxPosition","clientHeight","clientWidth","xPos","yPos","ts","headerHeight","categoriesHeight","tabColor","selectedTab","inboxStyles","cardStyles","cards","msgStyles","processWebInboxSettings","webInboxSetting","_settings","processInboxNotifs","inbox_preview","inbox_notifs","addWebInbox","checkAndRegisterWebInboxElements","getAndMigrateInboxMessages","gudInboxObj","storedInboxObj","initializeWebInbox","Promise","resolve","reject","readyState","onLoaded","setInterval","clearInterval","customElements","define","inboxHeight","inboxWidth","horizontalScroll","scrollingElement","verticalScroll","innerWidth","windowHeight","innerHeight","selectorRect","selectorX","x","selectorY","selectorLeft","selectorRight","selectorTop","selectorBottom","selectorHeight","selectorWidth","selectorCenter","halfOfInboxHeight","halfOfInboxWidth","inboxOnSide","availableHeight","inboxRight","availableWidth","inboxLeft","diff","hasWebInboxSettingsInLS","OVERLAY_PATH","CSS_PATH","WVE_CLASS","FLICKER_SHOW","FLICKER_HIDE","FLICKER_ID","updateFormData","element","formStyle","underline","curTextDecoration","textDecoration","clickDetails","clickUrl","onclick","newTab","raiseNotificationClicked","imgURL","src","elementCss","head","checkBuilder","parentWindow","opener","handleMessageEvent","postMessage","originUrl","sdkVersion","event","isValidUrl","msgOrigin","URL","origin","initialiseCTBuilder","variant","details","renderVisualBuilder","onContentLoad","contentLoaded","isShopify","Shopify","documentElement","position","overlayPath","loadOverlayScript","then","catch","loadCSS","link","rel","script","onload","Overlay","Error","onerror","targetingMsgJson","notificationViewed","raiseViewed","processElement","selector","outerHTML","json","dispatchJsonData","msgCTkv","wzrk_selector","form","tryFindingElement","intervalId","retryElement","querySelector","selectorData","inaObj","kvPairsEvent","CustomEvent","detail","dispatchEvent","string","Boolean","_err","addAntiFlicker","antiFlicker","personalizedSelectors","delayTime","retryElements","retryCount","retryInterval","isInViewport","styleContent","styleId","styleElement","textContent","applyAntiFlicker","selectors","processSelectors","selectorElements","elements","matchedElements","applyStyles","retryProcessing","classList","add","observeUrlChange","previousHref","MutationObserver","childList","subtree","CTWebPersonalisationBanner","_details","renderBanner","getBannerContent","trackClick","onClick","divHeight","desktopImageURL","mobileImageURL","CTWebPersonalisationCarousel","_carousel","slides","previouslySelectedItem","selectedItem","autoSlide","stopAutoSlideTimeout","renderCarousel","getStyles","carousel","getCarouselContent","showNavBtns","insertAdjacentHTML","navBtnsHtml","showNavArrows","leftNavArrowHtml","rightNavArrowHtml","setupClick","updateSelectedItem","startAutoSlide","setupOnHover","eventID","selected","endsWith","goToNext","goToPrev","wzrk_slideNo","clearTimeout","banner","navBtnsCss","navArrowsCss","prevItem","prevButton","sliderTime","goTo","prev","cur","renderPersonalisationBanner","divSelector","bannerEl","containerEl","renderPersonalisationCarousel","handleKVpairCampaign","invokeExternalJs","jsFunc","func","appendScriptForCustomEvent","staleDataUpdate","staledata","campType","mergeEventMap","newEvtMap","oldEvtObj","newEvtObj","incrementImpression","_request","setupClickEvent","contentDiv","isLegacy","_device","ctaElement","jsCTAElements","preview","getCookieParams","rValue","searchParams","notifications","skipDialog","scookieObj","renderPopUpImageOnly","popupImageOnly","getBoxPromptStyles","totalBorderWidth","card","borderEnabled","border","borderWidth","cardPadding","cardContentWidth","overlay","color","borderRadius","primaryButton","secondaryButton","getBellIconStyles","NotificationHandler","displayArgs","enable","swPath","enablePush","setUpWebPushNotifications","subscriptionCallback","serviceWorkerPath","apnsWebPushId","apnsServiceUrl","userAgent","setApplicationServerKey","applicationServerKey","_enableWebPush","enabled","safari","pushNotification","requestPermission","permission","subscriptionData","endpoint","deviceToken","browser","registerToken","info","registrationScope","serviceWorker","register","registration","__wzrk_account_id","scope","rootDirRegex","isServiceWorkerAtRoot","ready","getRegistrations","serviceWorkerRegistration","subscribeObj","userVisibleOnly","pushManager","subscribe","existingBellWrapper","getSubscription","unsubscribe","successful","scriptTag","titleText","bodyText","okButtonText","rejectButtonText","okButtonColor","askAgainTimeInSeconds","okCallback","rejectCallback","httpsPopupPath","httpsIframePath","apnsWebPushServiceUrl","notifObj","isHTTP","protocol","chromeAgent","parseInt","firefoxAgent","safariAgent","Notification","httpsIframe","state","from","wzrkPermissionPopup","wizAlert","confirmButtonText","confirmButtonColor","BELL_BASE64","PROMPT_BELL_BASE64","appServerKey","notificationHandler","processWebPushConfig","webPushConfig","_pushConfig","updatePushConfig","customSwPath","showBox","boxType","showBellIcon","boxConfig","createNotificationBox","bellIconConfig","createBellIcon","createElementWithAttributes","tag","attributes","configData","content","overlayDiv","pnCard","icon","primaryButtonText","secondaryButtonText","setElementPosition","lastNotifTime","popupFrequency","addEventListeners","bellWrapper","bellIcon","gifModal","gifImage","closeModal","hoverText","tooltip","addBellEventListeners","setServerKey","serverKey","removeWrapper","toggleGifModal","displayTooltip","clearTooltip","assign","inset","transform","positions","Center","Top","Bottom","bellRect","midX","midY","_tr","_logger","_wizCounter","doCampHouseKeeping","incrCount","excludeFromFreqCaps","currentCount","totalCount","sessionStorage","campTypeObj","wtarget_type","wmc","wimc","campaignSessionLimit","campaignDailyLimit","campaignTotalLimit","totalDailyLimit","totalSessionLimit","totalInboxSessionLimit","efc","mdc","tdc","campaignSessionCount","totalSessionCount","campaignDailyCount","totalDailyCount","campaignTotalCount","displayObj","delay","campKey","newCampObj","setupClickUrl","handleImageOnlyPopup","msgDiv","isExistingCampaign","testIframe","iframeDocument","contentDocument","contentWindow","createTemplate","isExitIntent","layout","showExitIntent","opacityDivId","opacityElement","isBanner","opacityDiv","opacity","rgbaColor","viewHeight","viewWidth","legacy","marginBottom","contentHeight","bottomPosition","widthPerct","proto","iFrameStyle","iframe","br","frameborder","marginheight","marginwidth","scrolling","pointerCss","sandbox","bgColor","btnBg","leftTd","btColor","theme","descriptionText","imageTd","onClickStr","closeCampaign","Event","srcdoc","adjustIFrameHeight","scrollHeight","margin","ua","inDoc","_timer","renderFooterNotification","_callBackCalled","showFooterNotification","notificationCallback","raiseNotificationViewed","popupCurrentWzrkId","deliveryTrigger","inactive","triggerByInactivity","scroll","triggerByScroll","exitintentObj","onmouseleave","deliveryDelayed","popupCallbacks","popupCallback","wzrkPrefixKey","wzrkJson","raisePopupNotificationClicked","notificationData","eventData","wzrkPrefixObj","targetNotif","IDLE_TIME_THRESHOLD","idleTimer","events","resetIdleTimer","removeEventListeners","eventHandler","setupEventListeners","eventType","passive","calculateScrollPercentage","scrollListener","scrollPercentage","throttledScrollListener","throttle","limit","inThrottle","context","args","apply","targetObj","clientY","intentPreview","intentOpacityDiv","ctaText","processNativeDisplayArr","arrInAppNotifs","elementId","addLoadListener","inapp_notifs","handleInboxNotifications","msgArr","vars","mergeVariables","evpr","eventsMap","profileMap","syncExpiry","expires_in","inapp_stale","inbox_stale","User","getTotalVisits","visitCount","getLastVisit","prevSession","logLevels","DISABLE","ERROR","INFO","DEBUG","DEBUG_PE","Logger","logLevel","wzrkError","debugPE","code","level","WZRK_D","SessionManager","scookieStr","objStr","currentSessionInLS","sessionCount","getTimeElapsed","sessionStart","getPageCount","seqNo","requestTime","RequestManager","fired","ignoreTrim","wzrk_error","pg","af","lib","rc","lastSyncTime","expirySeconds","dsync","givenGUID","post","fetch","method","headers","response","ok","nowTs","evtDetail","Privacy","privacyArr","privacyObj","curr","optOut","shouldUseIP","Variable","defaultValue","hadStarted","valueChangedCallbacks","getValue","getdefaultValue","typeOfDefaultValue","existing","getVariable","varInstance","registerVariable","update","newValue","oldValue","hasVarsRequestCompleted","triggerValueChanged","onValueChanged","addValueChangedCallback","removeValueChangedCallback","clearStartFlag","VariableStore","syncVariables","onSyncSuccess","onSyncFailure","meta","tk","r","status","fetchVariables","onFetchCallback","addVariablesChangedCallback","callback","addOneTimeVariablesChangedCallback","removeVariablesChangedCallback","removeOneTimeVariablesChangedCallback","callBack","CleverTap","spa","isSpa","bind","enablePersonalization","_isPersonalisationActive","shpfyProxyPath","ReqestManager","onUserLogin","privacy","logout","getCleverTapID","getAccountID","getSCDomain","setLibrary","libName","libVersion","setSCSDKVersion","ver","scSDKVersion","scv","getInboxMessageCount","getInboxMessageUnreadCount","getAllInboxMessages","getUnreadInboxMessages","getInboxMessageForId","messageId","deleteInboxMessage","markReadInboxMessage","unreadMsg","markReadInboxMessagesForIds","messageIds","markReadAllInboxMessage","processNotificationEvent","eventDetail","setLogLevel","l","Number","handleIncrementValue","handleDecrementValue","setMultiValuesForKey","addMultiValueForKey","addMultiValuesForKey","removeMultiValueForKey","removeMultiValuesForKey","removeValueForKey","_handleEmailSubscription","getLocation","lat","lng","Latitude","Longitude","geolocation","getCurrentPosition","showPosition","showError","coords","latitude","longitude","PERMISSION_DENIED","POSITION_UNAVAILABLE","TIMEOUT","UNKNOWN_ERROR","api","enableWebPush","tr","is_onloadcalled","subEmail","getEmail","withGroups","unSubEmail","unsubEmailGroups","isUnsubscribed","checked","setSubscriptionGroups","getSubscriptionGroups","changeSubscriptionGroups","updatedGroups","isGlobalUnsubscribe","setIsGlobalUnsubscribe","setUpdatedCategoryLong","$CLTP_WR","$WZRK_WR","currLocation","wzrk_ex","pageChanged","backupInterval","pgCount","referrerDomain","referrer","maxLen","utmSource","utm_source","wzrk_source","us","utmMedium","utm_medium","wzrk_medium","um","utmCampaign","utm_campaign","wzrk_campaign","uc","wm","cpg","setOffline","arg","getSDKVersion","defineVariable","timeout","debouncedPageChanged","wzrk_d","ping","Clevertap"],"mappings":";;;;;;;;;;;;;;;;;;;;EAAO,MAAMA,aAAa,GAAG,oBAAtB;EACA,MAAMC,eAAe,GAAG,QAAxB;EACA,MAAMC,cAAc,GAAG,KAAvB;;;;;;;;;;;;ECAQ,MAAMC,OAAN,CAAc;EAO3BC,EAAAA,WAAW,GAAsE;EAAA,QAApE;EAAEC,MAAAA;EAAF,KAAoE,uEAA3D,EAA2D;EAAA,QAAvDC,MAAuD,uEAA9C,EAA8C;EAAA,QAA1CC,YAA0C,uEAA3BP,aAA2B;EAAA,QAAZQ,KAAY,uEAAJ,EAAI;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA,aALvE;EAKuE;EAAA;EAAA;EAAA,aAJjER;EAIiE;EAAA;EAAA;EAAA,aAHjE;EAGiE;EAAA;EAAA;EAAA,aAFxE;EAEwE;EAC/E,SAAKK,EAAL,GAAUA,EAAV;;EACA,QAAIC,MAAJ,EAAY;EACV,WAAKA,MAAL,GAAcA,MAAd;EACD;;EACD,QAAIC,YAAJ,EAAkB;EAChB,WAAKA,YAAL,GAAoBA,YAApB;EACD;;EACD,QAAIC,KAAJ,EAAW;EACT,WAAKA,KAAL,GAAaA,KAAb;EACD;EACF;;EAED,MAAIH,EAAJ,GAAU;EACR,uCAAO,IAAP;EACD;;EAED,MAAIA,EAAJ,CAAQI,SAAR,EAAmB;EACjB,gEAAkBA,SAAlB;EACD;;EAED,MAAIH,MAAJ,GAAc;EACZ,uCAAO,IAAP;EACD;;EAED,MAAIA,MAAJ,CAAYA,MAAZ,EAAoB;EAClB,0DAAeA,MAAf;EACD;;EAED,MAAII,YAAJ,GAAoB;EAClB,u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AAW,GAAGzD,QAAQ,CAACyD,WAAD,EAAc,MAAd,EAAsBvV,QAAtB,CAAtB;EACAuV,EAAAA,WAAW,GAAGzD,QAAQ,CAACyD,WAAD,EAAc,GAAd,EAAmBkI,cAAnB,CAAtB;;EAEA,4DAAcC,kBAAd,CAAiCnI,WAAjC,EAA8CrN,GAAG,CAACgC,YAAlD;EACD;;QC9yBG0L,SAAS,GAAG,IAAIgnC,SAAJ,CAAc/0C,MAAM,CAAC+N,SAArB;EAElB/N,MAAM,CAAC+N,SAAP,GAAmB/N,MAAM,CAACgO,SAAP,GAAmBD,SAAtC;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"clevertap.js","sources":["src/options.js","src/modules/account.js","src/util/constants.js","src/util/datatypes.js","src/util/datetime.js","src/util/storage.js","src/util/lruCache.js","src/modules/api.js","src/modules/device.js","src/util/messages.js","src/util/validator.js","src/modules/event.js","src/util/url.js","src/util/encoder.js","src/util/requestDispatcher.js","src/util/clevertap.js","src/modules/profile.js","src/modules/userLogin.js","src/util/web-popupImageonly/popupImageonly.js","src/modules/web-inbox/Message.js","src/modules/web-inbox/inboxStyles.js","src/modules/web-inbox/WebInbox.js","src/modules/web-inbox/helper.js","src/modules/visualBuilder/builder_constants.js","src/modules/visualBuilder/dataUpdate.js","src/modules/visualBuilder/pageBuilder.js","src/util/web-personalisation/banner.js","src/util/web-personalisation/carousel.js","src/util/campaignRender/nativeDisplay.js","src/util/campaignRender/utilities.js","src/util/campaignRender/webPopup.js","src/modules/webPushPrompt/promptStyles.js","src/modules/notification.js","src/modules/webPushPrompt/promptConstants.js","src/modules/webPushPrompt/prompt.js","src/util/tr.js","src/modules/user.js","src/modules/logger.js","src/modules/session.js","src/modules/request.js","src/modules/privacy.js","src/modules/variables/variable.js","src/modules/variables/variableStore.js","src/clevertap.js","src/main.js"],"sourcesContent":["export const TARGET_DOMAIN = 'clevertap-prod.com'\nexport const TARGET_PROTOCOL = 'https:'\nexport const DEFAULT_REGION = 'eu1'\n","import { DEFAULT_REGION, TARGET_DOMAIN, TARGET_PROTOCOL } from '../options'\n\nexport default class Account {\n #accountId\n #region = ''\n #targetDomain = TARGET_DOMAIN\n #dcSdkversion = ''\n #token = ''\n\n constructor ({ id } = {}, region = '', targetDomain = TARGET_DOMAIN, token = '') {\n this.id = id\n if (region) {\n this.region = region\n }\n if (targetDomain) {\n this.targetDomain = targetDomain\n }\n if (token) {\n this.token = token\n }\n }\n\n get id () {\n return this.#accountId\n }\n\n set id (accountId) {\n this.#accountId = accountId\n }\n\n get region () {\n return this.#region\n }\n\n set region (region) {\n this.#region = region\n }\n\n get dcSDKVersion () {\n return this.#dcSdkversion\n }\n\n set dcSDKVersion (dcSDKVersion) {\n this.#dcSdkversion = dcSDKVersion\n }\n\n get targetDomain () {\n return this.#targetDomain\n }\n\n set targetDomain (targetDomain) {\n this.#targetDomain = targetDomain\n }\n\n get token () {\n return this.#token\n }\n\n set token (token) {\n this.#token = token\n }\n\n get finalTargetDomain () {\n if (this.region) {\n return `${this.region}.${this.targetDomain}`\n } else {\n if (this.targetDomain === TARGET_DOMAIN) {\n return `${DEFAULT_REGION}.${this.targetDomain}`\n }\n return this.targetDomain\n }\n }\n\n get dataPostPEURL () {\n return `${TARGET_PROTOCOL}//${this.finalTargetDomain}/defineVars`\n }\n\n get dataPostURL () {\n return `${TARGET_PROTOCOL}//${this.finalTargetDomain}/a?t=96`\n }\n\n get recorderURL () {\n return `${TARGET_PROTOCOL}//${this.finalTargetDomain}/r?r=1`\n }\n\n get emailURL () {\n return `${TARGET_PROTOCOL}//${this.finalTargetDomain}/e?r=1`\n }\n}\n","export const unsupportedKeyCharRegex = new RegExp('^\\\\s+|\\\\\\.|\\:|\\\\\\$|\\'|\\\"|\\\\\\\\|\\\\s+$', 'g')\nexport const unsupportedValueCharRegex = new RegExp(\"^\\\\s+|\\'|\\\"|\\\\\\\\|\\\\s+$\", 'g')\nexport const doubleQuoteRegex = new RegExp('\\\"', 'g')\nexport const singleQuoteRegex = new RegExp('\\'', 'g')\nexport const CLEAR = 'clear'\nexport const CHARGED_ID = 'Charged ID'\nexport const CHARGEDID_COOKIE_NAME = 'WZRK_CHARGED_ID'\nexport const GCOOKIE_NAME = 'WZRK_G'\nexport const KCOOKIE_NAME = 'WZRK_K'\nexport const CAMP_COOKIE_NAME = 'WZRK_CAMP'\nexport const CAMP_COOKIE_G = 'WZRK_CAMP_G'// cookie for storing campaign details against guid\nexport const SCOOKIE_PREFIX = 'WZRK_S'\nexport const SCOOKIE_EXP_TIME_IN_SECS = 60 * 20 // 20 mins\nexport const EV_COOKIE = 'WZRK_EV'\nexport const META_COOKIE = 'WZRK_META'\nexport const PR_COOKIE = 'WZRK_PR'\nexport const ARP_COOKIE = 'WZRK_ARP'\nexport const LCOOKIE_NAME = 'WZRK_L'\nexport const NOTIF_COOKIE_NAME = 'WZRK_N'\nexport const GLOBAL = 'global' // used for email unsubscribe also\nexport const TOTAL_COUNT = 'tc'\nexport const DISPLAY = 'display'\nexport const UNDEFINED = 'undefined'\nexport const WEBPUSH_LS_KEY = 'WZRK_WPR'\nexport const OPTOUT_KEY = 'optOut'\nexport const CT_OPTOUT_KEY = 'ct_optout'\nexport const OPTOUT_COOKIE_ENDSWITH = ':OO'\nexport const USEIP_KEY = 'useIP'\nexport const LRU_CACHE = 'WZRK_X'\nexport const LRU_CACHE_SIZE = 100\nexport const IS_OUL = 'isOUL'\nexport const EVT_PUSH = 'push'\nexport const EVT_PING = 'ping'\nexport const COOKIE_EXPIRY = 86400 * 365 // 1 Year in seconds\nexport const MAX_TRIES = 200 // API tries\nexport const FIRST_PING_FREQ_IN_MILLIS = 2 * 60 * 1000 // 2 mins\nexport const CONTINUOUS_PING_FREQ_IN_MILLIS = 5 * 60 * 1000 // 5 mins\nexport const GROUP_SUBSCRIPTION_REQUEST_ID = '2'\nexport const categoryLongKey = 'cUsY'\nexport const WZRK_PREFIX = 'wzrk_'\nexport const WZRK_ID = 'wzrk_id'\nexport const NOTIFICATION_VIEWED = 'Notification Viewed'\nexport const NOTIFICATION_CLICKED = 'Notification Clicked'\nexport const FIRE_PUSH_UNREGISTERED = 'WZRK_FPU'\nexport const PUSH_SUBSCRIPTION_DATA = 'WZRK_PSD' // PUSH SUBSCRIPTION DATA FOR REGISTER/UNREGISTER TOKEN\nexport const COMMAND_INCREMENT = '$incr'\nexport const COMMAND_DECREMENT = '$decr'\nexport const COMMAND_SET = '$set'\nexport const COMMAND_ADD = '$add'\nexport const COMMAND_REMOVE = '$remove'\nexport const COMMAND_DELETE = '$delete'\nexport const WEBINBOX_CONFIG = 'WZRK_INBOX_CONFIG'\nexport const WEBINBOX = 'WZRK_INBOX'\nexport const MAX_INBOX_MSG = 15\nexport const VARIABLES = 'WZRK_PE'\nexport const PUSH_DELAY_MS = 1000\nexport const MAX_DELAY_FREQUENCY = 1000 * 60 * 10\nexport const WZRK_FETCH = 'wzrk_fetch'\nexport const WEBPUSH_CONFIG = 'WZRK_PUSH_CONFIG'\n\nexport const SYSTEM_EVENTS = [\n 'Stayed',\n 'UTM Visited',\n 'App Launched',\n 'Notification Sent',\n NOTIFICATION_VIEWED,\n NOTIFICATION_CLICKED\n]\n","import {\n unsupportedKeyCharRegex,\n unsupportedValueCharRegex\n} from './constants'\n\nexport const isString = (input) => {\n return (typeof input === 'string' || input instanceof String)\n}\n\nexport const isObject = (input) => {\n // TODO: refine\n return Object.prototype.toString.call(input) === '[object Object]'\n}\n\nexport const isDateObject = (input) => {\n return typeof (input) === 'object' && (input instanceof Date)\n}\n\nexport const isObjectEmpty = (obj) => {\n for (const prop in obj) {\n if (obj.hasOwnProperty(prop)) { return false }\n }\n return true\n}\n\nexport const isConvertibleToNumber = (n) => {\n return !isNaN(parseFloat(n)) && isFinite(n)\n}\n\nexport const isNumber = (n) => {\n return /^-?[\\d.]+(?:e-?\\d+)?$/.test(n) && typeof n === 'number'\n}\n\nexport const isValueValid = (value) => {\n if (value === null || value === undefined || value === 'undefined') {\n return false\n }\n return true\n}\n\nexport const arrayContains = (arr, obj) => {\n var i = arr.length\n while (i--) {\n if (arr[i] === obj) {\n return true\n }\n }\n return false\n}\n\nexport const removeUnsupportedChars = (o, logger) => {\n // keys can't be greater than 1024 chars, values can't be greater than 1024 chars\n if (typeof o === 'object') {\n for (const key in o) {\n if (o.hasOwnProperty(key)) {\n const sanitizedVal = removeUnsupportedChars(o[key], logger)\n let sanitizedKey\n sanitizedKey = sanitize(key, unsupportedKeyCharRegex)\n if (sanitizedKey.length > 1024) {\n sanitizedKey = sanitizedKey.substring(0, 1024)\n logger.reportError(520, sanitizedKey + '... length exceeded 1024 chars. Trimmed.')\n }\n delete o[key]\n o[sanitizedKey] = sanitizedVal\n }\n }\n } else {\n let val\n\n if (isString(o)) {\n val = sanitize(o, unsupportedValueCharRegex)\n if (val.length > 1024) {\n val = val.substring(0, 1024)\n logger.reportError(521, val + '... length exceeded 1024 chars. Trimmed.')\n }\n } else {\n val = o\n }\n return val\n }\n return o\n}\n\nexport const sanitize = (input, regex) => {\n return input.replace(regex, '')\n}\n","export const getToday = () => {\n const today = new Date()\n return today.getFullYear() + '' + today.getMonth() + '' + today.getDay()\n}\n\nexport const getNow = () => {\n return Math.floor((new Date()).getTime() / 1000)\n}\n\nexport const convertToWZRKDate = (dateObj) => {\n return ('$D_' + Math.round(dateObj.getTime() / 1000))\n}\n\nexport const setDate = (dt) => {\n // expecting yyyymmdd format either as a number or a string\n if (isDateValid(dt)) {\n return '$D_' + dt\n }\n}\n\nexport const isDateValid = (date) => {\n const matches = /^(\\d{4})(\\d{2})(\\d{2})$/.exec(date)\n if (matches == null) return false\n const d = matches[3]\n const m = matches[2] - 1\n const y = matches[1]\n const composedDate = new Date(y, m, d)\n // eslint-disable-next-line eqeqeq\n return composedDate.getDate() == d && composedDate.getMonth() == m && composedDate.getFullYear() == y\n}\n","import {\n GCOOKIE_NAME,\n META_COOKIE,\n KCOOKIE_NAME,\n LCOOKIE_NAME\n} from './constants'\nexport class StorageManager {\n static save (key, value) {\n if (!key || !value) {\n return false\n }\n if (this._isLocalStorageSupported()) {\n localStorage.setItem(key, typeof value === 'string' ? value : JSON.stringify(value))\n return true\n }\n }\n\n static read (key) {\n if (!key) {\n return false\n }\n let data = null\n if (this._isLocalStorageSupported()) {\n data = localStorage.getItem(key)\n }\n if (data != null) {\n try {\n data = JSON.parse(data)\n } catch (e) {}\n }\n return data\n }\n\n static remove (key) {\n if (!key) {\n return false\n }\n if (this._isLocalStorageSupported()) {\n localStorage.removeItem(key)\n return true\n }\n }\n\n static removeCookie (name, domain) {\n let cookieStr = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;'\n\n if (domain) {\n cookieStr = cookieStr + ' domain=' + domain + '; path=/'\n }\n\n document.cookie = cookieStr\n }\n\n static createCookie (name, value, seconds, domain) {\n let expires = ''\n let domainStr = ''\n if (seconds) {\n const date = new Date()\n date.setTime(date.getTime() + (seconds * 1000))\n\n expires = '; expires=' + date.toGMTString()\n }\n\n if (domain) {\n domainStr = '; domain=' + domain\n }\n\n value = encodeURIComponent(value)\n\n document.cookie = name + '=' + value + expires + domainStr + '; path=/'\n }\n\n static readCookie (name) {\n const nameEQ = name + '='\n const ca = document.cookie.split(';')\n for (let idx = 0; idx < ca.length; idx++) {\n let c = ca[idx]\n while (c.charAt(0) === ' ') {\n c = c.substring(1, c.length)\n }\n // eslint-disable-next-line eqeqeq\n if (c.indexOf(nameEQ) == 0) {\n return decodeURIComponent(c.substring(nameEQ.length, c.length))\n }\n }\n return null\n }\n\n static _isLocalStorageSupported () {\n return 'localStorage' in window && window.localStorage !== null && typeof window.localStorage.setItem === 'function'\n }\n\n static saveToLSorCookie (property, value) {\n if (value == null) {\n return\n }\n try {\n if (this._isLocalStorageSupported()) {\n this.save(property, encodeURIComponent(JSON.stringify(value)))\n } else {\n if (property === GCOOKIE_NAME) {\n this.createCookie(property, encodeURIComponent(value), 0, window.location.hostname)\n } else {\n this.createCookie(property, encodeURIComponent(JSON.stringify(value)), 0, window.location.hostname)\n }\n }\n $ct.globalCache[property] = value\n } catch (e) {}\n }\n\n static readFromLSorCookie (property) {\n let data\n if ($ct.globalCache.hasOwnProperty(property)) {\n return $ct.globalCache[property]\n }\n if (this._isLocalStorageSupported()) {\n data = this.read(property)\n } else {\n data = this.readCookie(property)\n }\n\n if (data !== null && data !== undefined && !(typeof data.trim === 'function' && data.trim() === '')) {\n let value\n try {\n value = JSON.parse(decodeURIComponent(data))\n } catch (err) {\n value = decodeURIComponent(data)\n }\n $ct.globalCache[property] = value\n return value\n }\n }\n\n static createBroadCookie (name, value, seconds, domain) {\n // sets cookie on the base domain. e.g. if domain is baz.foo.bar.com, set cookie on \".bar.com\"\n // To update an existing \"broad domain\" cookie, we need to know what domain it was actually set on.\n // since a retrieved cookie never tells which domain it was set on, we need to set another test cookie\n // to find out which \"broadest\" domain the cookie was set on. Then delete the test cookie, and use that domain\n // for updating the actual cookie.\n\n if (domain) {\n let broadDomain = $ct.broadDomain\n if (broadDomain == null) { // if we don't know the broadDomain yet, then find out\n const domainParts = domain.split('.')\n let testBroadDomain = ''\n for (let idx = domainParts.length - 1; idx >= 0; idx--) {\n if (idx === 0) {\n testBroadDomain = domainParts[idx] + testBroadDomain\n } else {\n testBroadDomain = '.' + domainParts[idx] + testBroadDomain\n }\n\n // only needed if the cookie already exists and needs to be updated. See note above.\n if (this.readCookie(name)) {\n // no guarantee that browser will delete cookie, hence create short lived cookies\n var testCookieName = 'test_' + name + idx\n this.createCookie(testCookieName, value, 10, testBroadDomain) // self-destruct after 10 seconds\n if (!this.readCookie(testCookieName)) { // if test cookie not set, then the actual cookie wouldn't have been set on this domain either.\n continue\n } else { // else if cookie set, then delete the test and the original cookie\n this.removeCookie(testCookieName, testBroadDomain)\n }\n }\n\n this.createCookie(name, value, seconds, testBroadDomain)\n const tempCookie = this.readCookie(name)\n // eslint-disable-next-line eqeqeq\n if (tempCookie == value) {\n broadDomain = testBroadDomain\n $ct.broadDomain = broadDomain\n break\n }\n }\n } else {\n this.createCookie(name, value, seconds, broadDomain)\n }\n } else {\n this.createCookie(name, value, seconds, domain)\n }\n }\n\n static getMetaProp (property) {\n const metaObj = this.readFromLSorCookie(META_COOKIE)\n if (metaObj != null) {\n return metaObj[property]\n }\n }\n\n static setMetaProp (property, value) {\n if (this._isLocalStorageSupported()) {\n let wzrkMetaObj = this.readFromLSorCookie(META_COOKIE)\n if (wzrkMetaObj == null) {\n wzrkMetaObj = {}\n }\n if (value === undefined) {\n delete wzrkMetaObj[property]\n } else {\n wzrkMetaObj[property] = value\n }\n this.saveToLSorCookie(META_COOKIE, wzrkMetaObj)\n }\n }\n\n static getAndClearMetaProp (property) {\n const value = this.getMetaProp(property)\n this.setMetaProp(property, undefined)\n return value\n }\n\n static setInstantDeleteFlagInK () {\n let k = this.readFromLSorCookie(KCOOKIE_NAME)\n if (k == null) {\n k = {}\n }\n k.flag = true\n this.saveToLSorCookie(KCOOKIE_NAME, k)\n }\n\n static backupEvent (data, reqNo, logger) {\n let backupArr = this.readFromLSorCookie(LCOOKIE_NAME)\n if (typeof backupArr === 'undefined') {\n backupArr = {}\n }\n backupArr[reqNo] = { q: data }\n this.saveToLSorCookie(LCOOKIE_NAME, backupArr)\n logger.debug(`stored in ${LCOOKIE_NAME} reqNo : ${reqNo} -> ${data}`)\n }\n\n static removeBackup (respNo, logger) {\n const backupMap = this.readFromLSorCookie(LCOOKIE_NAME)\n if (typeof backupMap !== 'undefined' && backupMap !== null && typeof backupMap[respNo] !== 'undefined') {\n logger.debug(`del event: ${respNo} data-> ${backupMap[respNo].q}`)\n delete backupMap[respNo]\n this.saveToLSorCookie(LCOOKIE_NAME, backupMap)\n }\n }\n}\n\nexport const $ct = {\n globalCache: {\n gcookie: null,\n REQ_N: 0,\n RESP_N: 0\n },\n LRU_CACHE: null,\n globalProfileMap: undefined,\n globalEventsMap: undefined,\n blockRequest: false,\n isOptInRequest: false,\n broadDomain: null,\n webPushEnabled: null,\n campaignDivMap: {},\n currentSessionId: null,\n wiz_counter: 0, // to keep track of number of times we load the body\n notifApi: {\n notifEnabledFromApi: false\n }, // helper variable to handle race condition and check when notifications were called\n unsubGroups: [],\n updatedCategoryLong: null,\n inbox: null,\n isPrivacyArrPushed: false,\n privacyArray: [],\n offline: false,\n location: null,\n dismissSpamControl: false,\n globalUnsubscribe: true,\n flutterVersion: null,\n variableStore: {},\n pushConfig: null\n // domain: window.location.hostname, url -> getHostName()\n // gcookie: -> device\n}\n","import { StorageManager } from './storage'\nimport { LRU_CACHE } from './constants'\n\nexport default class LRUCache {\n #keyOrder\n\n constructor (max) {\n this.max = max\n let lruCache = StorageManager.readFromLSorCookie(LRU_CACHE)\n if (lruCache) {\n const tempLruCache = {}\n this.#keyOrder = []\n lruCache = lruCache.cache\n for (const entry in lruCache) {\n if (lruCache.hasOwnProperty(entry)) {\n tempLruCache[lruCache[entry][0]] = lruCache[entry][1]\n this.#keyOrder.push(lruCache[entry][0])\n }\n }\n this.cache = tempLruCache\n } else {\n this.cache = {}\n this.#keyOrder = []\n }\n }\n\n get (key) {\n const item = this.cache[key]\n if (item) {\n this.cache = this.#deleteFromObject(key, this.cache)\n this.cache[key] = item\n this.#keyOrder.push(key)\n }\n this.saveCacheToLS(this.cache)\n return item\n }\n\n set (key, value) {\n const item = this.cache[key]\n const allKeys = this.#keyOrder\n if (item != null) {\n this.cache = this.#deleteFromObject(key, this.cache)\n } else if (allKeys.length === this.max) {\n this.cache = this.#deleteFromObject(allKeys[0], this.cache)\n }\n this.cache[key] = value\n if (this.#keyOrder[this.#keyOrder - 1] !== key) {\n this.#keyOrder.push(key)\n }\n this.saveCacheToLS(this.cache)\n }\n\n saveCacheToLS (cache) {\n const objToArray = []\n const allKeys = this.#keyOrder\n for (const index in allKeys) {\n if (allKeys.hasOwnProperty(index)) {\n const temp = []\n temp.push(allKeys[index])\n temp.push(cache[allKeys[index]])\n objToArray.push(temp)\n }\n }\n StorageManager.saveToLSorCookie(LRU_CACHE, { cache: objToArray })\n }\n\n getKey (value) {\n if (value === null) {\n return null\n }\n const allKeys = this.#keyOrder\n for (const index in allKeys) {\n if (allKeys.hasOwnProperty(index)) {\n if (this.cache[allKeys[index]] === value) {\n return allKeys[index]\n }\n }\n }\n return null\n }\n\n getSecondLastKey () {\n const keysArr = this.#keyOrder\n if (keysArr != null && keysArr.length > 1) {\n return keysArr[keysArr.length - 2]\n }\n return -1\n }\n\n getLastKey () {\n const keysLength = this.#keyOrder.length\n if (keysLength) {\n return this.#keyOrder[keysLength - 1]\n }\n }\n\n #deleteFromObject (key, obj) {\n const allKeys = JSON.parse(JSON.stringify(this.#keyOrder))\n const newCache = {}\n let indexToDelete\n for (const index in allKeys) {\n if (allKeys.hasOwnProperty(index)) {\n if (allKeys[index] !== key) {\n newCache[allKeys[index]] = obj[allKeys[index]]\n } else {\n indexToDelete = index\n }\n }\n }\n allKeys.splice(indexToDelete, 1)\n this.#keyOrder = JSON.parse(JSON.stringify(allKeys))\n return newCache\n }\n}\n","import { COOKIE_EXPIRY, FIRE_PUSH_UNREGISTERED, GCOOKIE_NAME, KCOOKIE_NAME, LRU_CACHE_SIZE, USEIP_KEY } from '../util/constants'\nimport { isValueValid } from '../util/datatypes'\nimport { getNow } from '../util/datetime'\nimport LRUCache from '../util/lruCache'\nimport { StorageManager, $ct } from '../util/storage'\n\nexport default class CleverTapAPI {\n #logger\n #request\n #device\n #session\n\n constructor ({ logger, request, device, session }) {\n this.#logger = logger\n this.#request = request\n this.#device = device\n this.#session = session\n }\n\n /**\n *\n * @param {string} global gcookie\n * @param {string} session\n * @param {boolean} resume sent true in case of an OUL request from client side, which is returned as it is by server\n * @param {number} respNumber the index of the request in backupmanager\n * @param {boolean} optOutResponse\n * @returns\n */\n\n s (global, session, resume, respNumber, optOutResponse) {\n let oulReq = false\n let newGuid = false\n\n // for a scenario when OUL request is true from client side\n // but resume is returned as false from server end\n // we maintan a OulReqN var in the window object\n // and compare with respNumber to determine the response of an OUL request\n if (window.isOULInProgress) {\n if (resume || (respNumber !== 'undefined' && respNumber === window.oulReqN)) {\n window.isOULInProgress = false\n oulReq = true\n }\n }\n\n // call back function used to store global and session ids for the user\n if (typeof respNumber === 'undefined') {\n respNumber = 0\n }\n\n StorageManager.removeBackup(respNumber, this.#logger)\n\n if (respNumber > $ct.globalCache.REQ_N) {\n // request for some other user so ignore\n return\n }\n\n if (!isValueValid(this.#device.gcookie)) {\n if (global) {\n newGuid = true\n }\n }\n\n if (!isValueValid(this.#device.gcookie) || resume || typeof optOutResponse === 'boolean') {\n const sessionObj = this.#session.getSessionCookieObject()\n\n /* If the received session is less than the session in the cookie,\n then don't update guid as it will be response for old request\n */\n if (window.isOULInProgress || (sessionObj.s && (session < sessionObj.s))) {\n return\n }\n this.#logger.debug(`Cookie was ${this.#device.gcookie} set to ${global}`)\n this.#device.gcookie = global\n if (!isValueValid(this.#device.gcookie)) {\n // clear useIP meta prop\n StorageManager.getAndClearMetaProp(USEIP_KEY)\n }\n if (global && StorageManager._isLocalStorageSupported()) {\n if ($ct.LRU_CACHE == null) {\n $ct.LRU_CACHE = new LRUCache(LRU_CACHE_SIZE)\n }\n\n const kIdFromLS = StorageManager.readFromLSorCookie(KCOOKIE_NAME)\n let guidFromLRUCache\n if (kIdFromLS != null && kIdFromLS.id) {\n guidFromLRUCache = $ct.LRU_CACHE.cache[kIdFromLS.id]\n if (resume) {\n if (!guidFromLRUCache) {\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, true)\n // replace login identity in OUL request\n // with the gcookie returned in exchange\n $ct.LRU_CACHE.set(kIdFromLS.id, global)\n }\n }\n }\n\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, global)\n // lastk provides the guid\n const lastK = $ct.LRU_CACHE.getSecondLastKey()\n if (StorageManager.readFromLSorCookie(FIRE_PUSH_UNREGISTERED) && lastK !== -1) {\n const lastGUID = $ct.LRU_CACHE.cache[lastK]\n // fire the request directly via fireRequest to unregister the token\n // then other requests with the updated guid should follow\n this.#request.unregisterTokenForGuid(lastGUID)\n }\n }\n StorageManager.createBroadCookie(GCOOKIE_NAME, global, COOKIE_EXPIRY, window.location.hostname)\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, global)\n }\n\n if (StorageManager._isLocalStorageSupported()) {\n this.#session.manageSession(session)\n }\n\n // session cookie\n const obj = this.#session.getSessionCookieObject()\n\n // for the race-condition where two responses come back with different session ids. don't write the older session id.\n if (typeof obj.s === 'undefined' || obj.s <= session) {\n obj.s = session\n obj.t = getNow() // time of last response from server\n this.#session.setSessionCookieObject(obj)\n }\n\n // set blockRequest to false only if the device has a valid gcookie\n if (isValueValid(this.#device.gcookie)) {\n $ct.blockRequest = false\n }\n\n // only process the backup events after an OUL request or a new guid is recieved\n if ((oulReq || newGuid) && !this.#request.processingBackup) {\n this.#request.processBackupEvents()\n }\n\n $ct.globalCache.RESP_N = respNumber\n }\n}\n","import { isValueValid } from '../util/datatypes'\nimport { StorageManager } from '../util/storage'\nimport { GCOOKIE_NAME, COOKIE_EXPIRY } from '../util/constants'\n\nexport default class DeviceManager {\n #logger\n gcookie\n\n constructor ({ logger }) {\n this.#logger = logger\n this.gcookie = this.getGuid()\n }\n\n getGuid () {\n let guid = null\n if (isValueValid(this.gcookie)) {\n return this.gcookie\n }\n if (StorageManager._isLocalStorageSupported()) {\n const value = StorageManager.read(GCOOKIE_NAME)\n if (isValueValid(value)) {\n try {\n guid = JSON.parse(decodeURIComponent(value))\n } catch (e) {\n this.#logger.debug('Cannot parse Gcookie from localstorage - must be encoded ' + value)\n // assumming guids are of size 32. supporting both formats.\n // guid can have encodedURIComponent or be without it.\n // 1.56e4078ed15749928c042479ec2b4d47 - breaks on JSON.parse(decodeURIComponent())\n // 2.%2256e4078ed15749928c042479ec2b4d47%22\n if (value.length === 32) {\n guid = value\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, value)\n } else {\n this.#logger.error('Illegal guid ' + value)\n }\n }\n\n // Persist to cookie storage if not present there.\n if (isValueValid(guid)) {\n StorageManager.createBroadCookie(GCOOKIE_NAME, guid, COOKIE_EXPIRY, window.location.hostname)\n }\n }\n }\n\n if (!isValueValid(guid)) {\n guid = StorageManager.readCookie(GCOOKIE_NAME)\n if (isValueValid(guid) && (guid.indexOf('%') === 0 || guid.indexOf('\\'') === 0 || guid.indexOf('\"') === 0)) {\n guid = null\n }\n if (isValueValid(guid)) {\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, guid)\n }\n }\n\n return guid\n }\n}\n","export const DATA_NOT_SENT_TEXT = 'This property has been ignored.'\nexport const INVALID_ACCOUNT = 'Invalid account ID'\nexport const INVALID_EVENT = 'Event structure not valid. Unable to process event'\nexport const CLEVERTAP_ERROR_PREFIX = 'CleverTap error:' // Formerly wzrk_error_txt\nexport const EMBED_ERROR = `${CLEVERTAP_ERROR_PREFIX} Incorrect embed script.`\nexport const EVENT_ERROR = `${CLEVERTAP_ERROR_PREFIX} Event structure not valid. ${DATA_NOT_SENT_TEXT}`\nexport const GENDER_ERROR = `${CLEVERTAP_ERROR_PREFIX} Gender value should one of the following: m,f,o,u,male,female,unknown,others (case insensitive). ${DATA_NOT_SENT_TEXT}`\nexport const EMPLOYED_ERROR = `${CLEVERTAP_ERROR_PREFIX} Employed value should be either Y or N. ${DATA_NOT_SENT_TEXT}`\nexport const MARRIED_ERROR = `${CLEVERTAP_ERROR_PREFIX} Married value should be either Y or N. ${DATA_NOT_SENT_TEXT}`\nexport const EDUCATION_ERROR = `${CLEVERTAP_ERROR_PREFIX} Education value should be either School, College or Graduate. ${DATA_NOT_SENT_TEXT}`\nexport const AGE_ERROR = `${CLEVERTAP_ERROR_PREFIX} Age value should be a number. ${DATA_NOT_SENT_TEXT}`\nexport const DOB_ERROR = `${CLEVERTAP_ERROR_PREFIX} DOB value should be a Date Object`\nexport const OBJECT_ARRAY_ERROR = `${CLEVERTAP_ERROR_PREFIX} Expecting Object array in profile`\nexport const DATE_FORMAT_ERROR = `${CLEVERTAP_ERROR_PREFIX} setDate(number). number should be formatted as yyyymmdd`\nexport const ENUM_FORMAT_ERROR = `${CLEVERTAP_ERROR_PREFIX} setEnum(value). value should be a string or a number`\nexport const PHONE_FORMAT_ERROR = `${CLEVERTAP_ERROR_PREFIX} Phone number should be formatted as +[country code][number]`\n","import { isObject, isDateObject, isString, isNumber } from './datatypes'\nimport { convertToWZRKDate } from './datetime'\nimport { CHARGED_ID, CHARGEDID_COOKIE_NAME } from './constants'\nimport { StorageManager } from './storage'\n\nlet _globalChargedId\n\nexport const isEventStructureFlat = (eventObj) => {\n // Events cannot have nested structure or Arrays\n if (isObject(eventObj)) {\n for (var key in eventObj) {\n if (eventObj.hasOwnProperty(key)) {\n if (isObject(eventObj[key]) || Array.isArray(eventObj[key])) {\n return false\n } else if (isDateObject(eventObj[key])) {\n eventObj[key] = convertToWZRKDate(eventObj[key])\n }\n }\n }\n return true\n }\n return false\n}\n\nexport const isChargedEventStructureValid = (chargedObj, logger) => {\n if (isObject(chargedObj)) {\n for (var key in chargedObj) {\n if (chargedObj.hasOwnProperty(key)) {\n if (key === 'Items') {\n if (!Array.isArray(chargedObj[key])) {\n return false\n }\n\n if (chargedObj[key].length > 50) {\n logger.reportError(522, 'Charged Items exceed 50 limit. Actual count: ' + chargedObj[key].length)\n }\n\n for (var itemKey in chargedObj[key]) {\n if (chargedObj[key].hasOwnProperty(itemKey)) { // since default array implementation could be overridden - e.g. Teabox site\n if (!isObject(chargedObj[key][itemKey]) || !isEventStructureFlat(chargedObj[key][itemKey])) {\n return false\n }\n }\n }\n } else {\n if (isObject(chargedObj[key]) || Array.isArray(chargedObj[key])) {\n return false\n } else if (isDateObject(chargedObj[key])) {\n chargedObj[key] = convertToWZRKDate(chargedObj[key])\n }\n }\n }\n }\n\n if (isString(chargedObj[CHARGED_ID]) || isNumber(chargedObj[CHARGED_ID])) {\n // save charged Id\n const chargedId = chargedObj[CHARGED_ID] + '' // casting chargedId to string\n\n if (typeof _globalChargedId === 'undefined') {\n _globalChargedId = StorageManager.readFromLSorCookie(CHARGEDID_COOKIE_NAME)\n }\n if (typeof _globalChargedId !== 'undefined' && _globalChargedId.trim() === chargedId.trim()) {\n // drop event- duplicate charged id\n logger.error('Duplicate charged Id - Dropped' + chargedObj)\n return false\n }\n _globalChargedId = chargedId\n StorageManager.saveToLSorCookie(CHARGEDID_COOKIE_NAME, chargedId)\n }\n return true\n } // if object (chargedObject)\n return false\n}\n","import { isString, isObject, sanitize } from '../util/datatypes'\nimport { EVENT_ERROR } from '../util/messages'\nimport { EV_COOKIE, SYSTEM_EVENTS, unsupportedKeyCharRegex } from '../util/constants'\nimport { isChargedEventStructureValid, isEventStructureFlat } from '../util/validator'\nimport { StorageManager, $ct } from '../util/storage'\n\nexport default class EventHandler extends Array {\n #logger\n #oldValues\n #request\n #isPersonalisationActive\n\n constructor ({ logger, request, isPersonalisationActive }, values) {\n super()\n this.#logger = logger\n this.#oldValues = values\n this.#request = request\n this.#isPersonalisationActive = isPersonalisationActive\n }\n\n push (...eventsArr) {\n this.#processEventArray(eventsArr)\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#processEventArray(this.#oldValues)\n }\n this.#oldValues = null\n }\n\n #processEventArray (eventsArr) {\n if (Array.isArray(eventsArr)) {\n while (eventsArr.length > 0) {\n var eventName = eventsArr.shift()\n if (!isString(eventName)) {\n this.#logger.error(EVENT_ERROR)\n continue\n }\n\n if (eventName.length > 1024) {\n eventName = eventName.substring(0, 1024)\n this.#logger.reportError(510, eventName + '... length exceeded 1024 chars. Trimmed.')\n }\n\n if (SYSTEM_EVENTS.includes(eventName)) {\n this.#logger.reportError(513, eventName + ' is a restricted system event. It cannot be used as an event name.')\n continue\n }\n\n const data = {}\n data.type = 'event'\n data.evtName = sanitize(eventName, unsupportedKeyCharRegex)\n\n if (eventsArr.length !== 0) {\n const eventObj = eventsArr.shift()\n if (!isObject(eventObj)) {\n // put it back if it is not an object\n eventsArr.unshift(eventObj)\n } else {\n // check Charged Event vs. other events.\n if (eventName === 'Charged') {\n if (!isChargedEventStructureValid(eventObj, this.#logger)) {\n this.#logger.reportError(511, 'Charged event structure invalid. Not sent.')\n continue\n }\n } else {\n if (!isEventStructureFlat(eventObj)) {\n this.#logger.reportError(512, eventName + ' event structure invalid. Not sent.')\n continue\n }\n }\n data.evtData = eventObj\n }\n }\n\n this.#request.processEvent(data)\n }\n }\n }\n\n getDetails (evtName) {\n if (!this.#isPersonalisationActive()) {\n return\n }\n if (typeof $ct.globalEventsMap === 'undefined') {\n $ct.globalEventsMap = StorageManager.readFromLSorCookie(EV_COOKIE)\n }\n if (typeof $ct.globalEventsMap === 'undefined') {\n return\n }\n const evtObj = $ct.globalEventsMap[evtName]\n const respObj = {}\n if (typeof evtObj !== 'undefined') {\n respObj.firstTime = new Date(evtObj[1] * 1000)\n respObj.lastTime = new Date(evtObj[2] * 1000)\n respObj.count = evtObj[0]\n return respObj\n }\n }\n}\n","export const getURLParams = (url) => {\n const urlParams = {}\n const idx = url.indexOf('?')\n\n if (idx > 1) {\n const uri = url.substring(idx + 1)\n let match\n const pl = /\\+/g // Regex for replacing addition symbol with a space\n const search = /([^&=]+)=?([^&]*)/g\n const decode = function (s) {\n let replacement = s.replace(pl, ' ')\n try {\n replacement = decodeURIComponent(replacement)\n } catch (e) {\n // eat\n }\n return replacement\n }\n match = search.exec(uri)\n while (match) {\n urlParams[decode(match[1])] = decode(match[2])\n match = search.exec(uri)\n }\n }\n return urlParams\n}\n\nexport const getDomain = (url) => {\n if (url === '') return ''\n var a = document.createElement('a')\n a.href = url\n return a.hostname\n}\n\nexport const addToURL = (url, k, v) => {\n return url + '&' + k + '=' + encodeURIComponent(v)\n}\n\nexport const getHostName = () => {\n return window.location.hostname\n}\n","/* eslint-disable */\nexport const urlBase64ToUint8Array = (base64String) => {\n let padding = '='.repeat((4 - base64String.length % 4) % 4)\n let base64 = (base64String + padding)\n .replace(/\\-/g, '+')\n .replace(/_/g, '/')\n\n let rawData = window.atob(base64)\n let processedData = []\n for (let i=0; i {\n logger && typeof logger.debug === 'function' && logger.debug('dobj:' + dataObject)\n return compressToBase64(dataObject)\n}\n\nexport const compress = (uncompressed) => {\n if (uncompressed == null) return ''\n let i, value,\n context_dictionary = {},\n context_dictionaryToCreate = {},\n context_c = '',\n context_wc = '',\n context_w = '',\n context_enlargeIn = 2, // Compensate for the first entry which should not count\n context_dictSize = 3,\n context_numBits = 2,\n context_data_string = '',\n context_data_val = 0,\n context_data_position = 0,\n ii,\n f = String.fromCharCode\n\n for (ii = 0; ii < uncompressed.length; ii += 1) {\n context_c = uncompressed.charAt(ii)\n if (!Object.prototype.hasOwnProperty.call(context_dictionary, context_c)) {\n context_dictionary[context_c] = context_dictSize++\n context_dictionaryToCreate[context_c] = true\n }\n\n context_wc = context_w + context_c\n if (Object.prototype.hasOwnProperty.call(context_dictionary, context_wc)) {\n context_w = context_wc\n } else {\n if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {\n if (context_w.charCodeAt(0) < 256) {\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n }\n value = context_w.charCodeAt(0)\n for (i = 0; i < 8; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n } else {\n value = 1\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1) | value\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = 0\n }\n value = context_w.charCodeAt(0)\n for (i = 0; i < 16; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n }\n context_enlargeIn--\n if (context_enlargeIn == 0) {\n context_enlargeIn = Math.pow(2, context_numBits)\n context_numBits++\n }\n delete context_dictionaryToCreate[context_w]\n } else {\n value = context_dictionary[context_w];\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0;\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n\n\n }\n context_enlargeIn--\n if (context_enlargeIn == 0) {\n context_enlargeIn = Math.pow(2, context_numBits)\n context_numBits++\n }\n // Add wc to the dictionary.\n context_dictionary[context_wc] = context_dictSize++\n context_w = String(context_c)\n }\n }\n\n // Output the code for w.\n if (context_w !== '') {\n if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {\n if (context_w.charCodeAt(0) < 256) {\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n }\n value = context_w.charCodeAt(0)\n for (i = 0; i < 8; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n } else {\n value = 1\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1) | value\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = 0\n }\n value = context_w.charCodeAt(0);\n for (i = 0; i < 16; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n }\n context_enlargeIn--\n if (context_enlargeIn == 0) {\n context_enlargeIn = Math.pow(2, context_numBits)\n context_numBits++\n }\n delete context_dictionaryToCreate[context_w]\n } else {\n value = context_dictionary[context_w]\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n\n\n }\n context_enlargeIn--\n if (context_enlargeIn == 0) {\n context_enlargeIn = Math.pow(2, context_numBits)\n context_numBits++\n }\n }\n\n // Mark the end of the stream\n value = 2\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n\n // Flush the last char\n while (true) {\n context_data_val = (context_data_val << 1)\n if (context_data_position == 15) {\n context_data_string += f(context_data_val)\n break\n } else context_data_position++\n }\n return context_data_string\n}\n\nexport const getKeyStr = () => {\n let key = ''\n let i = 0\n\n for (i = 0; i <= 25; i++) {\n key = key + String.fromCharCode(i + 65)\n }\n\n for (i = 0; i <= 25; i++) {\n key = key + String.fromCharCode(i + 97)\n }\n\n for (i = 0; i < 10; i++) {\n key = key + i\n }\n\n return key + '+/='\n}\n\nconst _keyStr = getKeyStr()\n\nexport const convertToFormattedHex = (byte_arr) => {\n let hex_str = '',\n i,\n len,\n tmp_hex\n\n if (!Array.isArray(byte_arr)) {\n return false\n }\n\n len = byte_arr.length\n\n for (i = 0; i < len; ++i) {\n if (byte_arr[i] < 0) {\n byte_arr[i] = byte_arr[i] + 256\n }\n if (byte_arr[i] === undefined) {\n byte_arr[i] = 0\n }\n tmp_hex = byte_arr[i].toString(16)\n\n if (tmp_hex.length == 1) tmp_hex = '0' + tmp_hex // Add leading zero.\n\n // beautification - needed if you're printing this in the console, else keep commented\n // if ((i + 1) % 16 === 0) {\n // tmp_hex += \"\\n\";\n // } else {\n // tmp_hex += \" \";\n // }\n\n hex_str += tmp_hex\n }\n\n return hex_str.trim()\n}\n\nexport const convertStringToHex = (s) => {\n let byte_arr = []\n for (let i = 0; i < s.length; i++) {\n let value = s.charCodeAt(i)\n byte_arr.push(value & 255)\n byte_arr.push((value >> 8) & 255)\n }\n return convertToFormattedHex(byte_arr)\n}\n\nexport const compressToBase64 = (input) => {\n if (input == null) return ''\n var output = ''\n var chr1, chr2, chr3, enc1, enc2, enc3, enc4\n var i = 0\n\n input = compress(input)\n\n while (i < input.length * 2) {\n\n if (i % 2 == 0) {\n chr1 = input.charCodeAt(i / 2) >> 8\n chr2 = input.charCodeAt(i / 2) & 255\n if (i / 2 + 1 < input.length)\n chr3 = input.charCodeAt(i / 2 + 1) >> 8\n else\n chr3 = NaN\n } else {\n chr1 = input.charCodeAt((i - 1) / 2) & 255\n if ((i + 1) / 2 < input.length) {\n chr2 = input.charCodeAt((i + 1) / 2) >> 8\n chr3 = input.charCodeAt((i + 1) / 2) & 255\n } else\n chr2 = chr3 = NaN\n }\n i += 3\n\n enc1 = chr1 >> 2;\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4)\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6)\n enc4 = chr3 & 63\n\n if (isNaN(chr2)) {\n enc3 = enc4 = 64\n } else if (isNaN(chr3)) {\n enc4 = 64\n }\n\n output = output +\n _keyStr.charAt(enc1) + _keyStr.charAt(enc2) +\n _keyStr.charAt(enc3) + _keyStr.charAt(enc4)\n\n }\n\n return output\n}\n","\nimport { ARP_COOKIE, MAX_TRIES, OPTOUT_COOKIE_ENDSWITH, USEIP_KEY, MAX_DELAY_FREQUENCY, PUSH_DELAY_MS, WZRK_FETCH } from './constants'\nimport { isString, isValueValid } from './datatypes'\nimport { compressData } from './encoder'\nimport { StorageManager, $ct } from './storage'\nimport { addToURL } from './url'\n\nexport default class RequestDispatcher {\n static logger\n static device\n static account\n networkRetryCount = 0\n minDelayFrequency = 0\n\n // ANCHOR - Requests get fired from here\n static #fireRequest (url, tries, skipARP, sendOULFlag, evtName) {\n if (this.#dropRequestDueToOptOut()) {\n this.logger.debug('req dropped due to optout cookie: ' + this.device.gcookie)\n return\n }\n\n // set a request in progress\n // so that if gcookie is not present, no other request can be made asynchronusly\n if (!isValueValid(this.device.gcookie)) {\n $ct.blockRequest = true\n }\n /**\n * if the gcookie is null\n * and the request is not the first request\n * and the tries are less than max tries\n * keep retrying\n */\n\n if (evtName && evtName === WZRK_FETCH) {\n // New retry mechanism\n if (!isValueValid(this.device.gcookie) && ($ct.globalCache.RESP_N < $ct.globalCache.REQ_N - 1)) {\n setTimeout(() => {\n this.logger.debug(`retrying fire request for url: ${url}, tries: ${this.networkRetryCount}`)\n this.#fireRequest(url, undefined, skipARP, sendOULFlag)\n }, this.getDelayFrequency())\n }\n } else {\n if (!isValueValid(this.device.gcookie) &&\n ($ct.globalCache.RESP_N < $ct.globalCache.REQ_N - 1) &&\n tries < MAX_TRIES) {\n // if ongoing First Request is in progress, initiate retry\n setTimeout(() => {\n this.logger.debug(`retrying fire request for url: ${url}, tries: ${tries}`)\n this.#fireRequest(url, tries + 1, skipARP, sendOULFlag)\n }, 50)\n return\n }\n }\n\n // set isOULInProgress to true\n // when sendOULFlag is set to true\n if (!sendOULFlag) {\n if (isValueValid(this.device.gcookie)) {\n // add gcookie to url\n url = addToURL(url, 'gc', this.device.gcookie)\n }\n url = this.#addARPToRequest(url, skipARP)\n } else {\n window.isOULInProgress = true\n }\n\n url = addToURL(url, 'tries', tries) // Add tries to URL\n\n url = this.#addUseIPToRequest(url)\n url = addToURL(url, 'r', new Date().getTime()) // add epoch to beat caching of the URL\n // TODO: Figure out a better way to handle plugin check\n if (window.clevertap?.hasOwnProperty('plugin') || window.wizrocket?.hasOwnProperty('plugin')) {\n // used to add plugin name in request parameter\n const plugin = window.clevertap.plugin || window.wizrocket.plugin\n url = addToURL(url, 'ct_pl', plugin)\n }\n if (url.indexOf('chrome-extension:') !== -1) {\n url = url.replace('chrome-extension:', 'https:')\n }\n // TODO: Try using Function constructor instead of appending script.\n var ctCbScripts = document.getElementsByClassName('ct-jp-cb')\n while (ctCbScripts[0] && ctCbScripts[0].parentNode) {\n ctCbScripts[0].parentNode.removeChild(ctCbScripts[0])\n }\n const s = document.createElement('script')\n s.setAttribute('type', 'text/javascript')\n s.setAttribute('src', url)\n s.setAttribute('class', 'ct-jp-cb')\n s.setAttribute('rel', 'nofollow')\n s.async = true\n document.getElementsByTagName('head')[0].appendChild(s)\n this.logger.debug('req snt -> url: ' + url)\n }\n\n /**\n *\n * @param {string} url\n * @param {*} skipARP\n * @param {boolean} sendOULFlag\n */\n static fireRequest (url, skipARP, sendOULFlag, evtName) {\n this.#fireRequest(url, 1, skipARP, sendOULFlag, evtName)\n }\n\n static #dropRequestDueToOptOut () {\n if ($ct.isOptInRequest || !isValueValid(this.device.gcookie) || !isString(this.device.gcookie)) {\n $ct.isOptInRequest = false\n return false\n }\n return this.device.gcookie.slice(-3) === OPTOUT_COOKIE_ENDSWITH\n }\n\n static #addUseIPToRequest (pageLoadUrl) {\n var useIP = StorageManager.getMetaProp(USEIP_KEY)\n if (typeof useIP !== 'boolean') {\n useIP = false\n }\n return addToURL(pageLoadUrl, USEIP_KEY, useIP ? 'true' : 'false')\n };\n\n static #addARPToRequest (url, skipResARP) {\n if (skipResARP === true) {\n const _arp = {}\n _arp.skipResARP = true\n return addToURL(url, 'arp', compressData(JSON.stringify(_arp), this.logger))\n }\n if (StorageManager._isLocalStorageSupported() && typeof localStorage.getItem(ARP_COOKIE) !== 'undefined' && localStorage.getItem(ARP_COOKIE) !== null) {\n return addToURL(url, 'arp', compressData(JSON.stringify(StorageManager.readFromLSorCookie(ARP_COOKIE)), this.logger))\n }\n return url\n }\n\n getDelayFrequency () {\n this.logger.debug('Network retry #' + this.networkRetryCount)\n\n // Retry with delay as 1s for first 10 retries\n if (this.networkRetryCount < 10) {\n this.logger.debug(this.account.id, 'Failure count is ' + this.networkRetryCount + '. Setting delay frequency to 1s')\n this.minDelayFrequency = PUSH_DELAY_MS // Reset minimum delay to 1s\n return this.minDelayFrequency\n }\n\n if (this.account.region == null) {\n // Retry with delay as 1s if region is null in case of eu1\n this.logger.debug(this.account.id, 'Setting delay frequency to 1s')\n return PUSH_DELAY_MS\n } else {\n // Retry with delay as minimum delay frequency and add random number of seconds to scatter traffic\n const randomDelay = (Math.floor(Math.random() * 10) + 1) * 1000\n this.minDelayFrequency += randomDelay\n if (this.minDelayFrequency < MAX_DELAY_FREQUENCY) {\n this.logger.debug(this.account.id, 'Setting delay frequency to ' + this.minDelayFrequency)\n return this.minDelayFrequency\n } else {\n this.minDelayFrequency = PUSH_DELAY_MS\n }\n this.logger.debug(this.account.id, 'Setting delay frequency to ' + this.minDelayFrequency)\n return this.minDelayFrequency\n }\n }\n}\n","// CleverTap specific utilities\n\nimport {\n StorageManager,\n $ct\n} from './storage'\nimport {\n CAMP_COOKIE_NAME,\n singleQuoteRegex,\n PR_COOKIE,\n ARP_COOKIE,\n GCOOKIE_NAME,\n IS_OUL,\n categoryLongKey,\n CAMP_COOKIE_G,\n GLOBAL\n} from './constants'\nimport {\n GENDER_ERROR,\n EMPLOYED_ERROR,\n MARRIED_ERROR,\n EDUCATION_ERROR,\n AGE_ERROR,\n DOB_ERROR,\n PHONE_FORMAT_ERROR,\n ENUM_FORMAT_ERROR\n} from './messages'\nimport {\n getToday,\n convertToWZRKDate,\n setDate,\n getNow\n} from './datetime'\nimport {\n isObject,\n isDateObject,\n isConvertibleToNumber,\n isObjectEmpty,\n isString,\n isNumber,\n isValueValid\n} from './datatypes'\n\nimport { addToURL, getURLParams } from './url'\nimport { compressData } from './encoder'\nimport RequestDispatcher from './requestDispatcher'\n\nexport const getCampaignObject = () => {\n let finalcampObj = {}\n if (StorageManager._isLocalStorageSupported()) {\n let campObj = StorageManager.read(CAMP_COOKIE_NAME)\n if (campObj != null) {\n campObj = JSON.parse(decodeURIComponent(campObj).replace(singleQuoteRegex, '\\\"'))\n if (campObj.hasOwnProperty('global')) {\n finalcampObj.wp = campObj\n } else {\n finalcampObj = campObj\n }\n } else {\n finalcampObj = {}\n }\n }\n return finalcampObj\n}\n\nexport const saveCampaignObject = (campaignObj) => {\n if (StorageManager._isLocalStorageSupported()) {\n const newObj = { ...getCampaignObject(), ...campaignObj }\n const campObj = JSON.stringify(newObj)\n StorageManager.save(CAMP_COOKIE_NAME, encodeURIComponent(campObj))\n // Update the CAMP_COOKIE_G to be in sync with CAMP_COOKIE_NAME\n setCampaignObjectForGuid()\n }\n}\n\n// set Campaign Object against the guid, with daily count and total count details\nexport const setCampaignObjectForGuid = () => {\n if (StorageManager._isLocalStorageSupported()) {\n let guid = StorageManager.read(GCOOKIE_NAME)\n if (isValueValid(guid)) {\n try {\n guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n const guidCampObj = StorageManager.read(CAMP_COOKIE_G) ? JSON.parse(decodeURIComponent(StorageManager.read(CAMP_COOKIE_G))) : {}\n if (guid && StorageManager._isLocalStorageSupported()) {\n var finalCampObj = {}\n var campObj = getCampaignObject()\n Object.keys(campObj).forEach(key => {\n const campKeyObj = (guid in guidCampObj && Object.keys(guidCampObj[guid]).length && guidCampObj[guid][key]) ? guidCampObj[guid][key] : {}\n const globalObj = campObj[key].global\n const today = getToday()\n const dailyObj = campObj[key][today]\n if (typeof globalObj !== 'undefined') {\n const campaignIdArray = Object.keys(globalObj)\n for (const index in campaignIdArray) {\n let resultObj = []\n if (campaignIdArray.hasOwnProperty(index)) {\n let dailyC = 0\n let totalC = 0\n const campaignId = campaignIdArray[index]\n if (campaignId === 'tc') {\n continue\n }\n if (typeof dailyObj !== 'undefined' && typeof dailyObj[campaignId] !== 'undefined') {\n dailyC = dailyObj[campaignId]\n }\n if (typeof globalObj !== 'undefined' && typeof globalObj[campaignId] !== 'undefined') {\n totalC = globalObj[campaignId]\n }\n resultObj = [campaignId, dailyC, totalC]\n campKeyObj[campaignId] = resultObj\n }\n }\n }\n finalCampObj = { ...finalCampObj, [key]: campKeyObj }\n })\n guidCampObj[guid] = finalCampObj\n StorageManager.save(CAMP_COOKIE_G, encodeURIComponent(JSON.stringify(guidCampObj)))\n }\n } catch (e) {\n console.error('Invalid clevertap Id ' + e)\n }\n }\n }\n}\nexport const getCampaignObjForLc = () => {\n // before preparing data to send to LC , check if the entry for the guid is already there in CAMP_COOKIE_G\n const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n\n let campObj = {}\n if (StorageManager._isLocalStorageSupported()) {\n let resultObj = {}\n campObj = getCampaignObject()\n const storageValue = StorageManager.read(CAMP_COOKIE_G)\n const decodedValue = storageValue ? decodeURIComponent(storageValue) : null\n const parsedValue = decodedValue ? JSON.parse(decodedValue) : null\n\n const resultObjWP = (!!guid &&\n storageValue !== undefined && storageValue !== null &&\n parsedValue && parsedValue[guid] && parsedValue[guid].wp)\n ? Object.values(parsedValue[guid].wp)\n : []\n\n const resultObjWI = (!!guid &&\n storageValue !== undefined && storageValue !== null &&\n parsedValue && parsedValue[guid] && parsedValue[guid].wi)\n ? Object.values(parsedValue[guid].wi)\n : []\n\n const today = getToday()\n let todayCwp = 0\n let todayCwi = 0\n if (campObj.wp && campObj.wp[today] && campObj.wp[today].tc !== 'undefined') {\n todayCwp = campObj.wp[today].tc\n }\n if (campObj.wi && campObj.wi[today] && campObj.wi[today].tc !== 'undefined') {\n todayCwi = campObj.wi[today].tc\n }\n resultObj = {\n wmp: todayCwp,\n wimp: todayCwi,\n tlc: resultObjWP,\n witlc: resultObjWI\n }\n return resultObj\n }\n}\n\nexport const isProfileValid = (profileObj, { logger }) => {\n let valid = false\n if (isObject(profileObj)) {\n for (const profileKey in profileObj) {\n if (profileObj.hasOwnProperty(profileKey)) {\n valid = true\n let profileVal = profileObj[profileKey]\n\n if (profileVal == null) {\n delete profileObj[profileKey]\n continue\n }\n if (profileKey === 'Gender' && !profileVal.match(/\\b(?:[mM](?:ale)?|[fF](?:emale)?|[oO](?:thers)?|[uU](?:nknown)?)\\b/)) {\n valid = false\n logger.error(GENDER_ERROR)\n }\n\n if (profileKey === 'Employed' && !profileVal.match(/^Y$|^N$/)) {\n valid = false\n logger.error(EMPLOYED_ERROR)\n }\n\n if (profileKey === 'Married' && !profileVal.match(/^Y$|^N$/)) {\n valid = false\n logger.error(MARRIED_ERROR)\n }\n\n if (profileKey === 'Education' && !profileVal.match(/^School$|^College$|^Graduate$/)) {\n valid = false\n logger.error(EDUCATION_ERROR)\n }\n\n if (profileKey === 'Age' && profileVal != null) {\n if (isConvertibleToNumber(profileVal)) {\n profileObj.Age = +profileVal\n } else {\n valid = false\n logger.error(AGE_ERROR)\n }\n }\n // dob will come in like this - $dt_19470815 or dateObject\n if (profileKey === 'DOB') {\n if (((!(/^\\$D_/).test(profileVal) || (profileVal + '').length !== 11)) && !isDateObject(profileVal)) {\n valid = false\n logger.error(DOB_ERROR)\n }\n\n if (isDateObject(profileVal)) {\n profileObj[profileKey] = convertToWZRKDate(profileVal)\n }\n } else if (isDateObject(profileVal)) {\n profileObj[profileKey] = convertToWZRKDate(profileVal)\n }\n\n if (profileKey === 'Phone' && !isObjectEmpty(profileVal)) {\n if (profileVal.length > 8 && (profileVal.charAt(0) === '+')) { // valid phone number\n profileVal = profileVal.substring(1, profileVal.length)\n if (isConvertibleToNumber(profileVal)) {\n profileObj.Phone = +profileVal\n } else {\n valid = false\n logger.error(PHONE_FORMAT_ERROR + '. Removed.')\n }\n } else {\n valid = false\n logger.error(PHONE_FORMAT_ERROR + '. Removed.')\n }\n }\n\n if (!valid) {\n delete profileObj[profileKey]\n }\n }\n }\n }\n return valid\n}\n\nexport const processFBUserObj = (user) => {\n const profileData = {}\n profileData.Name = user.name\n if (user.id != null) {\n profileData.FBID = user.id + ''\n }\n // Feb 2014 - FB announced over 58 gender options, hence we specifically look for male or female. Rest we don't care.\n if (user.gender === 'male') {\n profileData.Gender = 'M'\n } else if (user.gender === 'female') {\n profileData.Gender = 'F'\n } else {\n profileData.Gender = 'O'\n }\n\n const getHighestEducation = function (eduArr) {\n if (eduArr != null) {\n let college = ''\n let highschool = ''\n\n for (let i = 0; i < eduArr.length; i++) {\n const edu = eduArr[i]\n if (edu.type != null) {\n const type = edu.type\n if (type === 'Graduate School') {\n return 'Graduate'\n } else if (type === 'College') {\n college = '1'\n } else if (type === 'High School') {\n highschool = '1'\n }\n }\n }\n\n if (college === '1') {\n return 'College'\n } else if (highschool === '1') {\n return 'School'\n }\n }\n }\n\n if (user.relationship_status != null) {\n profileData.Married = 'N'\n if (user.relationship_status === 'Married') {\n profileData.Married = 'Y'\n }\n }\n\n const edu = getHighestEducation(user.education)\n if (edu != null) {\n profileData.Education = edu\n }\n\n const work = (user.work != null) ? user.work.length : 0\n if (work > 0) {\n profileData.Employed = 'Y'\n } else {\n profileData.Employed = 'N'\n }\n\n if (user.email != null) {\n profileData.Email = user.email\n }\n\n if (user.birthday != null) {\n const mmddyy = user.birthday.split('/') // comes in as \"08/15/1947\"\n profileData.DOB = setDate(mmddyy[2] + mmddyy[0] + mmddyy[1])\n }\n return profileData\n}\n\nexport const processGPlusUserObj = (user, { logger }) => {\n const profileData = {}\n if (user.displayName != null) {\n profileData.Name = user.displayName\n }\n if (user.id != null) {\n profileData.GPID = user.id + ''\n }\n\n if (user.gender != null) {\n if (user.gender === 'male') {\n profileData.Gender = 'M'\n } else if (user.gender === 'female') {\n profileData.Gender = 'F'\n } else if (user.gender === 'other') {\n profileData.Gender = 'O'\n }\n }\n\n if (user.image != null) {\n if (user.image.isDefault === false) {\n profileData.Photo = user.image.url.split('?sz')[0]\n }\n }\n\n if (user.emails != null) {\n for (let emailIdx = 0; emailIdx < user.emails.length; emailIdx++) {\n const emailObj = user.emails[emailIdx]\n if (emailObj.type === 'account') {\n profileData.Email = emailObj.value\n }\n }\n }\n\n if (user.organizations != null) {\n profileData.Employed = 'N'\n for (let i = 0; i < user.organizations.length; i++) {\n const orgObj = user.organizations[i]\n if (orgObj.type === 'work') {\n profileData.Employed = 'Y'\n }\n }\n }\n\n if (user.birthday != null) {\n const yyyymmdd = user.birthday.split('-') // comes in as \"1976-07-27\"\n profileData.DOB = setDate(yyyymmdd[0] + yyyymmdd[1] + yyyymmdd[2])\n }\n\n if (user.relationshipStatus != null) {\n profileData.Married = 'N'\n if (user.relationshipStatus === 'married') {\n profileData.Married = 'Y'\n }\n }\n logger.debug('gplus usr profile ' + JSON.stringify(profileData))\n\n return profileData\n}\n\nexport const addToLocalProfileMap = (profileObj, override) => {\n if (StorageManager._isLocalStorageSupported()) {\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE)\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = {}\n }\n }\n\n // Move props from custom bucket to outside.\n if (profileObj._custom != null) {\n const keys = profileObj._custom\n for (const key in keys) {\n if (keys.hasOwnProperty(key)) {\n profileObj[key] = keys[key]\n }\n }\n delete profileObj._custom\n }\n\n for (const prop in profileObj) {\n if (profileObj.hasOwnProperty(prop)) {\n if ($ct.globalProfileMap.hasOwnProperty(prop) && !override) {\n continue\n }\n $ct.globalProfileMap[prop] = profileObj[prop]\n }\n }\n if ($ct.globalProfileMap._custom != null) {\n delete $ct.globalProfileMap._custom\n }\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n }\n}\n\nexport const closeIframe = (campaignId, divIdIgnored, currentSessionId) => {\n if (campaignId != null && campaignId !== '-1') {\n if (StorageManager._isLocalStorageSupported()) {\n const campaignObj = getCampaignObject()\n\n let sessionCampaignObj = campaignObj.wp[currentSessionId]\n if (sessionCampaignObj == null) {\n sessionCampaignObj = {}\n campaignObj[currentSessionId] = sessionCampaignObj\n }\n sessionCampaignObj[campaignId] = 'dnd'\n saveCampaignObject(campaignObj)\n }\n }\n if ($ct.campaignDivMap != null) {\n const divId = $ct.campaignDivMap[campaignId]\n if (divId != null) {\n document.getElementById(divId).style.display = 'none'\n if (divId === 'intentPreview') {\n if (document.getElementById('intentOpacityDiv') != null) {\n document.getElementById('intentOpacityDiv').style.display = 'none'\n }\n } else if (divId === 'wizParDiv0') {\n if (document.getElementById('intentOpacityDiv0') != null) {\n document.getElementById('intentOpacityDiv0').style.display = 'none'\n }\n } else if (divId === 'wizParDiv2') {\n if (document.getElementById('intentOpacityDiv2') != null) {\n document.getElementById('intentOpacityDiv2').style.display = 'none'\n }\n }\n }\n }\n}\n\nexport const arp = (jsonMap) => {\n // For unregister calls dont set arp in LS\n if (jsonMap.skipResARP != null && jsonMap.skipResARP) {\n console.debug('Update ARP Request rejected', jsonMap)\n return null\n }\n\n const isOULARP = jsonMap[IS_OUL] === true\n\n if (StorageManager._isLocalStorageSupported()) {\n // Update arp only if it is null or an oul request\n try {\n let arpFromStorage = StorageManager.readFromLSorCookie(ARP_COOKIE)\n if (arpFromStorage == null || isOULARP) {\n arpFromStorage = {}\n for (const key in jsonMap) {\n if (jsonMap.hasOwnProperty(key)) {\n if (jsonMap[key] === -1) {\n delete arpFromStorage[key]\n } else {\n arpFromStorage[key] = jsonMap[key]\n }\n }\n }\n StorageManager.saveToLSorCookie(ARP_COOKIE, arpFromStorage)\n }\n } catch (e) {\n console.error('Unable to parse ARP JSON: ' + e)\n }\n }\n}\n\nexport const getWrappedLink = (link, targetId, type, request, account, logger) => {\n let data = {}\n data.sendTo = link\n data.targetId = targetId\n data.epoch = getNow()\n\n if (type != null) {\n data.type = type\n } else {\n data.type = 'view'\n }\n\n data = request.addSystemDataToObject(data, undefined)\n return addToURL(account.recorderURL, 'd', compressData(JSON.stringify(data), logger))\n}\n\nexport const getMessageTemplate = () => {\n return `\n
`\n}\n\nexport const getMessageHeadTemplate = () => {\n return `\n \n \n \n \n `\n}\n\nexport const setEnum = (enumVal, logger) => {\n if (isString(enumVal) || isNumber(enumVal)) {\n return '$E_' + enumVal\n }\n logger.error(ENUM_FORMAT_ERROR)\n}\nexport const handleEmailSubscription = (subscription, reEncoded, fetchGroups, account, logger) => {\n const urlParamsAsIs = getURLParams(location.href) // can't use url_params as it is in lowercase above\n const encodedEmailId = urlParamsAsIs.e\n const encodedProfileProps = urlParamsAsIs.p\n const pageType = urlParamsAsIs.page_type\n\n if (typeof encodedEmailId !== 'undefined') {\n const data = {}\n data.id = account.id // accountId\n data.unsubGroups = $ct.unsubGroups // unsubscribe groups\n\n if ($ct.updatedCategoryLong) {\n data[categoryLongKey] = $ct.updatedCategoryLong\n }\n\n let url = account.emailURL\n if (fetchGroups) {\n url = addToURL(url, 'fetchGroups', fetchGroups)\n }\n if (reEncoded) {\n url = addToURL(url, 'encoded', reEncoded)\n }\n url = addToURL(url, 'e', encodedEmailId)\n url = addToURL(url, 'd', compressData(JSON.stringify(data), logger))\n if (encodedProfileProps) {\n url = addToURL(url, 'p', encodedProfileProps)\n }\n\n if (subscription !== '-1') {\n url = addToURL(url, 'sub', subscription)\n }\n\n if (pageType) {\n $ct.globalUnsubscribe = pageType === GLOBAL\n url = addToURL(url, 'page_type', pageType)\n }\n RequestDispatcher.fireRequest(url)\n }\n}\n","import {\n isObjectEmpty\n} from '../util/datatypes'\nimport {\n isProfileValid,\n processFBUserObj,\n processGPlusUserObj,\n addToLocalProfileMap\n} from '../util/clevertap'\nimport {\n COMMAND_DELETE,\n COMMAND_INCREMENT,\n EVT_PUSH,\n PR_COOKIE\n} from '../util/constants'\nimport {\n addToURL\n} from '../util/url'\nimport {\n StorageManager,\n $ct\n} from '../util/storage'\nimport { compressData } from '../util/encoder'\nexport default class ProfileHandler extends Array {\n #logger\n #request\n #account\n #oldValues\n #isPersonalisationActive\n\n constructor ({\n logger,\n request,\n account,\n isPersonalisationActive\n }, values) {\n super()\n this.#logger = logger\n this.#request = request\n this.#account = account\n this.#oldValues = values\n this.#isPersonalisationActive = isPersonalisationActive\n }\n\n push (...profilesArr) {\n this.#processProfileArray(profilesArr)\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#processProfileArray(this.#oldValues)\n }\n this.#oldValues = null\n }\n\n getAttribute (propName) {\n if (!this.#isPersonalisationActive()) {\n return\n }\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE)\n }\n if ($ct.globalProfileMap != null) {\n return $ct.globalProfileMap[propName]\n }\n }\n\n #processProfileArray (profileArr) {\n if (Array.isArray(profileArr) && profileArr.length > 0) {\n for (const index in profileArr) {\n if (profileArr.hasOwnProperty(index)) {\n const outerObj = profileArr[index]\n let data = {}\n let profileObj\n if (outerObj.Site != null) { // organic data from the site\n profileObj = outerObj.Site\n if (isObjectEmpty(profileObj) || !isProfileValid(profileObj, {\n logger: this.#logger\n })) {\n return\n }\n } else if (outerObj.Facebook != null) { // fb connect data\n const FbProfileObj = outerObj.Facebook\n // make sure that the object contains any data at all\n\n if (!isObjectEmpty(FbProfileObj) && (!FbProfileObj.error)) {\n profileObj = processFBUserObj(FbProfileObj)\n }\n } else if (outerObj['Google Plus'] != null) {\n const GPlusProfileObj = outerObj['Google Plus']\n if (!isObjectEmpty(GPlusProfileObj) && (!GPlusProfileObj.error)) {\n profileObj = processGPlusUserObj(GPlusProfileObj, { logger: this.#logger })\n }\n }\n if (profileObj != null && (!isObjectEmpty(profileObj))) { // profile got set from above\n data.type = 'profile'\n if (profileObj.tz == null) {\n // try to auto capture user timezone if not present\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n\n data.profile = profileObj\n addToLocalProfileMap(profileObj, true)\n data = this.#request.addSystemDataToObject(data, undefined)\n\n this.#request.addFlags(data)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n }\n }\n }\n }\n\n /**\n *\n * @param {any} key\n * @param {number} value\n * @param {string} command\n * increases or decreases value of the number type properties in profile object\n */\n _handleIncrementDecrementValue (key, value, command) {\n // Check if the value is greater than 0\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE)\n }\n if ($ct.globalProfileMap == null && !$ct.globalProfileMap?.hasOwnProperty(key)) {\n // Check if the profile map already has the propery defined\n console.error('Kindly create profile with required proprty to increment/decrement.')\n } else if (!value || typeof value !== 'number' || value <= 0) {\n console.error('Value should be a number greater than 0')\n } else {\n // Update the profile property in local storage\n if (command === COMMAND_INCREMENT) {\n $ct.globalProfileMap[key] = $ct.globalProfileMap[key] + value\n } else {\n $ct.globalProfileMap[key] = $ct.globalProfileMap[key] - value\n }\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n\n // Send the updated value to LC\n let data = {}\n const profileObj = {}\n data.type = 'profile'\n profileObj[key] = { [command]: value }\n if (profileObj.tz == null) {\n // try to auto capture user timezone if not present\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n data.profile = profileObj\n data = this.#request.addSystemDataToObject(data, true)\n\n this.#request.addFlags(data)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n }\n\n /**\n *\n * @param {any} key\n * @param {array} arrayVal\n * @param {string} command\n * overwrites/sets new value(s) against a key/property in profile object\n */\n _handleMultiValueSet (key, arrayVal, command) {\n const array = []\n for (let i = 0; i < arrayVal.length; i++) {\n if (typeof arrayVal[i] === 'number' && !array.includes(arrayVal[i])) {\n array.push(arrayVal[i])\n } else if (typeof arrayVal[i] === 'string' && !array.includes(arrayVal[i].toLowerCase())) {\n array.push(arrayVal[i].toLowerCase())\n } else {\n console.error('array supports only string or number type values')\n }\n }\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE) ?? {}\n }\n $ct.globalProfileMap[key] = array\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n this.sendMultiValueData(key, arrayVal, command)\n }\n\n /**\n *\n * @param {any} propKey - the property name to be added in the profile object\n * @param {string, number, array} propVal - the property value to be added against the @propkey key\n * @param {string} command\n * Adds array or single value against a key/property in profile object\n */\n _handleMultiValueAdd (propKey, propVal, command) {\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE) || {}\n }\n\n const existingValue = $ct.globalProfileMap[propKey]\n const array = Array.isArray(existingValue) ? existingValue : (existingValue != null ? [existingValue] : [])\n\n const addValue = (value) => {\n const normalizedValue = typeof value === 'number' ? value : value.toLowerCase()\n if (!array.includes(normalizedValue)) {\n array.push(normalizedValue)\n }\n }\n\n if (Array.isArray(propVal)) {\n propVal.forEach(value => {\n if (typeof value === 'string' || typeof value === 'number') {\n addValue(value)\n } else {\n this.#logger.error('Array supports only string or number type values')\n }\n })\n } else if (typeof propVal === 'string' || typeof propVal === 'number') {\n addValue(propVal)\n } else {\n this.#logger.error('Unsupported value type')\n return\n }\n\n $ct.globalProfileMap[propKey] = array\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n this.sendMultiValueData(propKey, propVal, command)\n }\n\n /**\n *\n * @param {any} propKey\n * @param {string, number, array} propVal\n * @param {string} command\n * removes value(s) against a key/property in profile object\n */\n _handleMultiValueRemove (propKey, propVal, command) {\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE) || {}\n }\n\n if (!$ct.globalProfileMap.hasOwnProperty(propKey)) {\n this.#logger.error(`The property ${propKey} does not exist.`)\n return\n }\n\n const removeValue = (value) => {\n const index = $ct.globalProfileMap[propKey].indexOf(value)\n if (index !== -1) {\n $ct.globalProfileMap[propKey].splice(index, 1)\n }\n }\n\n if (Array.isArray(propVal)) {\n propVal.forEach(removeValue)\n } else if (typeof propVal === 'string' || typeof propVal === 'number') {\n removeValue(propVal)\n } else {\n this.#logger.error('Unsupported propVal type')\n return\n }\n\n // Remove the key if the array is empty\n if ($ct.globalProfileMap[propKey].length === 0) {\n delete $ct.globalProfileMap[propKey]\n }\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n this.sendMultiValueData(propKey, propVal, command)\n }\n\n /**\n *\n * @param {any} propKey\n * @param {string} command\n * deletes a key value pair from the profile object\n */\n _handleMultiValueDelete (propKey, command) {\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE)\n }\n if (!$ct?.globalProfileMap?.hasOwnProperty(propKey)) {\n this.#logger.error(`The property ${propKey} does not exist.`)\n } else {\n delete $ct.globalProfileMap[propKey]\n }\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n this.sendMultiValueData(propKey, null, command)\n }\n\n sendMultiValueData (propKey, propVal, command) {\n // Send the updated value to LC\n let data = {}\n const profileObj = {}\n data.type = 'profile'\n\n // this removes the property at backend\n profileObj[propKey] = { [command]: command === COMMAND_DELETE ? true : propVal }\n if (profileObj.tz == null) {\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n data.profile = profileObj\n data = this.#request.addSystemDataToObject(data, true)\n this.#request.addFlags(data)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n}\n","import {\n isObject,\n isObjectEmpty\n} from '../util/datatypes'\nimport {\n KCOOKIE_NAME,\n GCOOKIE_NAME,\n EVT_PUSH,\n LRU_CACHE_SIZE,\n IS_OUL,\n CAMP_COOKIE_NAME,\n CHARGEDID_COOKIE_NAME,\n PR_COOKIE,\n EV_COOKIE,\n ARP_COOKIE,\n CLEAR,\n META_COOKIE,\n FIRE_PUSH_UNREGISTERED\n} from '../util/constants'\nimport {\n StorageManager,\n $ct\n} from '../util/storage'\nimport LRUCache from '../util/lruCache'\nimport {\n compressData\n} from '../util/encoder'\nimport {\n addToURL,\n getHostName\n} from '../util/url'\nimport {\n isProfileValid,\n processFBUserObj,\n processGPlusUserObj,\n addToLocalProfileMap\n} from '../util/clevertap'\n\nexport default class UserLoginHandler extends Array {\n #request\n #logger\n #account\n #session\n #oldValues\n #device\n\n constructor ({\n request,\n account,\n session,\n logger,\n device\n },\n values) {\n super()\n this.#request = request\n this.#account = account\n this.#session = session\n this.#logger = logger\n this.#oldValues = values\n this.#device = device\n }\n\n // On User Login\n #processOUL (profileArr) {\n let sendOULFlag = true\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, sendOULFlag)\n const addToK = (ids) => {\n let k = StorageManager.readFromLSorCookie(KCOOKIE_NAME)\n const g = StorageManager.readFromLSorCookie(GCOOKIE_NAME)\n let kId\n if (k == null) {\n k = {}\n kId = ids\n } else {\n /* check if already exists */\n kId = k.id\n let anonymousUser = false\n let foundInCache = false\n if (kId == null) {\n kId = ids[0]\n anonymousUser = true\n }\n if ($ct.LRU_CACHE == null && StorageManager._isLocalStorageSupported()) {\n $ct.LRU_CACHE = new LRUCache(LRU_CACHE_SIZE)\n }\n\n if (anonymousUser) {\n if ((g) != null) {\n // if have gcookie\n $ct.LRU_CACHE.set(kId, g)\n $ct.blockRequest = false\n }\n } else {\n // check if the id is present in the cache\n // set foundInCache to true\n for (const idx in ids) {\n if (ids.hasOwnProperty(idx)) {\n const id = ids[idx]\n if ($ct.LRU_CACHE.cache[id]) {\n kId = id\n foundInCache = true\n break\n }\n }\n }\n }\n\n if (foundInCache) {\n if (kId !== $ct.LRU_CACHE.getLastKey()) {\n // New User found\n // remove the entire cache\n this.#handleCookieFromCache()\n } else {\n sendOULFlag = false\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, sendOULFlag)\n }\n const gFromCache = $ct.LRU_CACHE.get(kId)\n $ct.LRU_CACHE.set(kId, gFromCache)\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, gFromCache)\n this.#device.gcookie = gFromCache\n\n const lastK = $ct.LRU_CACHE.getSecondLastKey()\n if (StorageManager.readFromLSorCookie(FIRE_PUSH_UNREGISTERED) && lastK !== -1) {\n // CACHED OLD USER FOUND. TRANSFER PUSH TOKEN TO THIS USER\n const lastGUID = $ct.LRU_CACHE.cache[lastK]\n this.#request.unregisterTokenForGuid(lastGUID)\n }\n } else {\n if (!anonymousUser) {\n this.clear()\n } else {\n if ((g) != null) {\n this.#device.gcookie = g\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, g)\n sendOULFlag = false\n }\n }\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, false)\n kId = ids[0]\n }\n }\n k.id = kId\n StorageManager.saveToLSorCookie(KCOOKIE_NAME, k)\n }\n\n if (Array.isArray(profileArr) && profileArr.length > 0) {\n for (const index in profileArr) {\n if (profileArr.hasOwnProperty(index)) {\n const outerObj = profileArr[index]\n let data = {}\n let profileObj\n if (outerObj.Site != null) { // organic data from the site\n profileObj = outerObj.Site\n if (isObjectEmpty(profileObj) || !isProfileValid(profileObj, {\n logger: this.#logger\n })) {\n return\n }\n } else if (outerObj.Facebook != null) { // fb connect data\n const FbProfileObj = outerObj.Facebook\n // make sure that the object contains any data at all\n\n if (!isObjectEmpty(FbProfileObj) && (!FbProfileObj.error)) {\n profileObj = processFBUserObj(FbProfileObj)\n }\n } else if (outerObj['Google Plus'] != null) {\n const GPlusProfileObj = outerObj['Google Plus']\n if (isObjectEmpty(GPlusProfileObj) && (!GPlusProfileObj.error)) {\n profileObj = processGPlusUserObj(GPlusProfileObj, { logger: this.#logger })\n }\n }\n if (profileObj != null && (!isObjectEmpty(profileObj))) { // profile got set from above\n data.type = 'profile'\n if (profileObj.tz == null) {\n // try to auto capture user timezone if not present\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n\n data.profile = profileObj\n const ids = []\n if (StorageManager._isLocalStorageSupported()) {\n if (profileObj.Identity) {\n ids.push(profileObj.Identity)\n }\n if (profileObj.Email) {\n ids.push(profileObj.Email)\n }\n if (profileObj.GPID) {\n ids.push('GP:' + profileObj.GPID)\n }\n if (profileObj.FBID) {\n ids.push('FB:' + profileObj.FBID)\n }\n if (ids.length > 0) {\n addToK(ids)\n }\n }\n addToLocalProfileMap(profileObj, true)\n data = this.#request.addSystemDataToObject(data, undefined)\n\n this.#request.addFlags(data)\n // Adding 'isOUL' flag in true for OUL cases which.\n // This flag tells LC to create a new arp object.\n // Also we will receive the same flag in response arp which tells to delete existing arp object.\n if (sendOULFlag) {\n data[IS_OUL] = true\n }\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n // Whenever sendOULFlag is true then dont send arp and gcookie (guid in memory in the request)\n // Also when this flag is set we will get another flag from LC in arp which tells us to delete arp\n // stored in the cache and replace it with the response arp.\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest, sendOULFlag)\n }\n }\n }\n }\n }\n\n clear () {\n this.#logger.debug('clear called. Reset flag has been set.')\n this.#deleteUser()\n StorageManager.setMetaProp(CLEAR, true)\n }\n\n #handleCookieFromCache () {\n $ct.blockRequest = false\n console.debug('Block request is false')\n if (StorageManager._isLocalStorageSupported()) {\n delete localStorage[PR_COOKIE]\n delete localStorage[EV_COOKIE]\n delete localStorage[META_COOKIE]\n delete localStorage[ARP_COOKIE]\n delete localStorage[CAMP_COOKIE_NAME]\n delete localStorage[CHARGEDID_COOKIE_NAME]\n }\n StorageManager.removeCookie(CAMP_COOKIE_NAME, getHostName())\n StorageManager.removeCookie(this.#session.cookieName, $ct.broadDomain)\n StorageManager.removeCookie(ARP_COOKIE, $ct.broadDomain)\n this.#session.setSessionCookieObject('')\n }\n\n #deleteUser () {\n $ct.blockRequest = true\n this.#logger.debug('Block request is true')\n $ct.globalCache = {\n gcookie: null,\n REQ_N: 0,\n RESP_N: 0\n }\n if (StorageManager._isLocalStorageSupported()) {\n delete localStorage[GCOOKIE_NAME]\n delete localStorage[KCOOKIE_NAME]\n delete localStorage[PR_COOKIE]\n delete localStorage[EV_COOKIE]\n delete localStorage[META_COOKIE]\n delete localStorage[ARP_COOKIE]\n delete localStorage[CAMP_COOKIE_NAME]\n delete localStorage[CHARGEDID_COOKIE_NAME]\n }\n StorageManager.removeCookie(GCOOKIE_NAME, $ct.broadDomain)\n StorageManager.removeCookie(CAMP_COOKIE_NAME, getHostName())\n StorageManager.removeCookie(KCOOKIE_NAME, getHostName())\n StorageManager.removeCookie(this.#session.cookieName, $ct.broadDomain)\n StorageManager.removeCookie(ARP_COOKIE, $ct.broadDomain)\n this.#device.gcookie = null\n this.#session.setSessionCookieObject('')\n }\n\n #processLoginArray (loginArr) {\n if (Array.isArray(loginArr) && loginArr.length > 0) {\n const profileObj = loginArr.pop()\n const processProfile = profileObj != null && isObject(profileObj) &&\n ((profileObj.Site != null && Object.keys(profileObj.Site).length > 0) ||\n (profileObj.Facebook != null && Object.keys(profileObj.Facebook).length > 0) ||\n (profileObj['Google Plus'] != null && Object.keys(profileObj['Google Plus']).length > 0))\n if (processProfile) {\n StorageManager.setInstantDeleteFlagInK()\n try {\n this.#processOUL([profileObj])\n } catch (e) {\n this.#logger.debug(e)\n }\n } else {\n this.#logger.error('Profile object is in incorrect format')\n }\n }\n }\n\n push (...profilesArr) {\n this.#processLoginArray(profilesArr)\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#processLoginArray(this.#oldValues)\n }\n this.#oldValues = null\n }\n}\n","import {\n getCampaignObject,\n saveCampaignObject\n} from '../clevertap'\nimport { StorageManager } from '../storage'\n\nexport class CTWebPopupImageOnly extends HTMLElement {\n constructor () {\n super()\n this.shadow = this.attachShadow({ mode: 'open' })\n }\n\n _target = null\n _session = null\n shadow = null\n popup = null\n container = null\n resizeObserver = null\n\n get target () {\n return this._target || ''\n }\n\n set target (val) {\n if (this._target === null) {\n this._target = val\n this.renderImageOnlyPopup()\n }\n }\n\n get session () {\n return this._session || ''\n }\n\n set session (val) {\n this._session = val\n }\n\n get msgId () {\n return this.target.wzrk_id\n }\n\n get pivotId () {\n return this.target.wzrk_pivot\n }\n\n get onClickUrl () {\n return this.target.display.onClickUrl\n }\n\n renderImageOnlyPopup () {\n const campaignId = this.target.wzrk_id.split('_')[0]\n const currentSessionId = this.session.sessionId\n\n this.shadow.innerHTML = this.getImageOnlyPopupContent()\n this.popup = this.shadowRoot.getElementById('imageOnlyPopup')\n this.container = this.shadowRoot.getElementById('container')\n this.closeIcon = this.shadowRoot.getElementById('close')\n\n this.popup.addEventListener('load', this.updateImageAndContainerWidth())\n this.resizeObserver = new ResizeObserver(() => this.handleResize(this.popup, this.container))\n this.resizeObserver.observe(this.popup)\n\n this.closeIcon.addEventListener('click', () => {\n this.resizeObserver.unobserve(this.popup)\n document.getElementById('wzrkImageOnlyDiv').style.display = 'none'\n this.remove()\n if (campaignId != null && campaignId !== '-1') {\n if (StorageManager._isLocalStorageSupported()) {\n const campaignObj = getCampaignObject()\n\n let sessionCampaignObj = campaignObj.wp[currentSessionId]\n if (sessionCampaignObj == null) {\n sessionCampaignObj = {}\n campaignObj[currentSessionId] = sessionCampaignObj\n }\n sessionCampaignObj[campaignId] = 'dnd'\n saveCampaignObject(campaignObj)\n }\n }\n })\n\n window.clevertap.renderNotificationViewed({ msgId: this.msgId, pivotId: this.pivotId })\n\n if (this.onClickUrl) {\n this.popup.addEventListener('click', () => {\n this.target.display.window ? window.open(this.onClickUrl, '_blank') : window.parent.location.href = this.onClickUrl\n window.clevertap.renderNotificationClicked({ msgId: this.msgId, pivotId: this.pivotId })\n })\n }\n }\n\n handleResize (popup, container) {\n const width = this.getRenderedImageWidth(popup)\n container.style.setProperty('width', `${width}px`)\n }\n\n getImageOnlyPopupContent () {\n return `\n ${this.target.msgContent.css}\n ${this.target.msgContent.html}\n `\n }\n\n updateImageAndContainerWidth () {\n return () => {\n const width = this.getRenderedImageWidth(this.popup)\n this.popup.style.setProperty('width', `${width}px`)\n this.container.style.setProperty('width', `${width}px`)\n this.container.style.setProperty('height', 'auto')\n this.container.style.setProperty('position', 'fixed')\n this.popup.style.setProperty('visibility', 'visible')\n this.closeIcon.style.setProperty('visibility', 'visible')\n document.getElementById('wzrkImageOnlyDiv').style.visibility = 'visible'\n }\n }\n\n getRenderedImageWidth (img) {\n const ratio = img.naturalWidth / img.naturalHeight\n return img.height * ratio\n }\n}\n","import { determineTimeStampText, greenTickSvg } from './helper'\nexport class Message extends HTMLElement {\n constructor (config, message) {\n super()\n this.shadow = this.attachShadow({ mode: 'open' })\n this.config = config\n this.message = message\n this.renderMessage(message)\n }\n\n wrapper = null\n snackBar = null\n\n get pivotId () {\n return this.message.wzrk_pivot\n }\n\n get campaignId () {\n return this.message.wzrk_id\n }\n\n createEl (type, id, part) {\n const _el = document.createElement(type)\n _el.setAttribute('id', id)\n _el.setAttribute('part', part || id)\n return _el\n }\n\n renderMessage (msg) {\n this.wrapper = this.createEl('div', 'messageWrapper')\n\n switch (msg.templateType) {\n case 'text-only':\n case 'text-with-icon':\n case 'text-with-icon-and-image': {\n const message = this.prepareBasicMessage(msg.msg[0])\n this.wrapper.appendChild(message)\n }\n }\n\n const timeStamp = this.createEl('div', 'timeStamp')\n timeStamp.innerHTML = `${determineTimeStampText(msg.id.split('_')[1])}`\n if (!msg.viewed) {\n const unreadMarker = this.createEl('span', 'unreadMarker')\n timeStamp.appendChild(unreadMarker)\n }\n\n this.wrapper.appendChild(timeStamp)\n this.shadow.appendChild(this.wrapper)\n }\n\n prepareBasicMessage (msg) {\n const message = this.createEl('div', 'message')\n\n if (msg.imageUrl) {\n const imageContainer = this.addImage(msg.imageUrl, 'mainImg')\n message.appendChild(imageContainer)\n }\n const iconTitleDescWrapper = this.createEl('div', 'iconTitleDescWrapper')\n if (msg.iconUrl) {\n const iconContainer = this.addImage(msg.iconUrl, 'iconImg')\n iconTitleDescWrapper.appendChild(iconContainer)\n }\n const titleDescWrapper = this.createEl('div', 'titleDescWrapper')\n if (msg.title) {\n const title = this.createEl('div', 'title')\n title.innerText = msg.title\n titleDescWrapper.appendChild(title)\n }\n if (msg.description) {\n const description = this.createEl('div', 'description')\n description.innerText = msg.description\n titleDescWrapper.appendChild(description)\n }\n if (msg.title || msg.description) {\n iconTitleDescWrapper.appendChild(titleDescWrapper)\n }\n\n if (msg.iconUrl || msg.title || msg.description) {\n message.appendChild(iconTitleDescWrapper)\n }\n if (msg.buttons && msg.buttons.length) {\n const buttonsContainer = this.addButtons(msg.buttons)\n message.appendChild(buttonsContainer)\n }\n return message\n }\n\n addButtons (buttons = []) {\n const buttonsContainer = this.createEl('div', 'buttonsContainer')\n let hasCopyAction = false\n buttons.forEach((b, i) => {\n const button = this.createEl('button', `button-${i}`, 'button')\n button.innerText = b.text\n if (i > 0) {\n button.style.cssText += 'margin-left: 2px;'\n }\n if (b.action === 'copy') {\n hasCopyAction = true\n }\n buttonsContainer.appendChild(button)\n })\n if (hasCopyAction) {\n this.addSnackbar(buttonsContainer)\n }\n return buttonsContainer\n }\n\n addSnackbar (buttonsContainer) {\n this.snackBar = this.createEl('div', `snackbar-${this.campaignId}`, 'snackbar')\n this.snackBar.innerHTML = greenTickSvg\n const clipboardMsg = this.createEl('span', `snackbar-msg-${this.campaignId}`, 'snackbar-msg')\n clipboardMsg.innerText = 'Copied to clipboard'\n this.snackBar.appendChild(clipboardMsg)\n buttonsContainer.appendChild(this.snackBar)\n }\n\n addImage (url, type) {\n const imageContainer = this.createEl('div', `${type}Container`)\n const image = this.createEl('img', type)\n image.setAttribute('src', url)\n // images will be fetched as and when the element comes into the viewport\n image.setAttribute('loading', 'lazy')\n imageContainer.appendChild(image)\n return imageContainer\n }\n\n raiseClickedEvent (path, isPreview) {\n switch (this.message.templateType) {\n case 'text-only':\n case 'text-with-icon':\n case 'text-with-icon-and-image': {\n this.raiseClickedForBasicTemplates(path, isPreview)\n }\n }\n }\n\n raiseClickedForBasicTemplates (path, isPreview) {\n const msg = this.message.msg[0]\n const payload = { msgId: this.campaignId, pivotId: this.pivotId }\n if (path.tagName === 'BUTTON') {\n const id = path.id.split('-')[1]\n const button = msg.buttons[id]\n payload.kv = {\n wzrk_c2a: button.text\n }\n if (button.action === 'url') {\n button.openUrlInNewTab ? window.open(button.url, '_blank') : (window.location = button.url)\n } else if (button.action === 'copy') {\n window.focus()\n navigator.clipboard.writeText(button.clipboardText)\n this.snackBar.style.setProperty('display', 'flex', 'important')\n setTimeout(() => {\n this.snackBar.style.setProperty('display', 'none', 'important')\n }, 2000)\n }\n } else if (path.tagName === 'CT-INBOX-MESSAGE' && msg.onClickUrl) {\n msg.openUrlInNewTab ? window.open(msg.onClickUrl, '_blank') : (window.location = msg.onClickUrl)\n }\n if (isPreview) {\n console.log('Notifiction clicked event will be raised at run time with payload ::', payload)\n } else {\n window.clevertap.renderNotificationClicked(payload)\n }\n }\n}\n","export const messageStyles = ({ backgroundColor, borderColor, titleColor, descriptionColor, buttonColor, buttonTextColor, unreadMarkerColor }) => {\n return `\n \n `\n}\n\nexport const inboxContainerStyles = ({\n panelBackgroundColor,\n panelBorderColor,\n headerBackgroundColor,\n headerTitleColor,\n closeIconColor,\n categoriesTabColor,\n categoriesTitleColor,\n categoriesBorderColor,\n selectedCategoryTabColor,\n selectedCategoryTitleColor,\n selectedCategoryBorderColor,\n headerCategoryHeight\n}) => {\n return `\n \n `\n}\n","import { StorageManager, $ct } from '../../util/storage'\nimport { Message } from './Message'\nimport { inboxContainerStyles, messageStyles } from './inboxStyles'\nimport { getInboxPosition, determineTimeStampText, arrowSvg, getInboxMessages, saveInboxMessages } from './helper'\nimport { WEBINBOX_CONFIG, MAX_INBOX_MSG } from '../../util/constants'\n\nexport class Inbox extends HTMLElement {\n constructor (logger) {\n super()\n this.logger = logger\n this.shadow = this.attachShadow({ mode: 'open' })\n }\n\n isInboxOpen = false\n isInboxFromFlutter = false\n selectedCategory = null\n unviewedMessages = {}\n unviewedCounter = 0\n isPreview = false\n inboxConfigForPreview = {}\n\n // dom references\n inboxSelector = null\n inbox = null\n emptyInboxMsg = null\n inboxCard = null\n unviewedBadge = null\n observer = null\n selectedCategoryRef = null\n\n get incomingMessages () {\n return []\n }\n\n set incomingMessages (msgs = []) {\n if (msgs.length > 0 && this.inbox) {\n this.updateInboxMessages(msgs)\n }\n }\n\n get incomingMessagesForPreview () {\n return []\n }\n\n set incomingMessagesForPreview (msgs = []) {\n const previewMsgs = {}\n if (msgs.length > 0 && this.inbox) {\n this.isPreview = true\n this.unviewedCounter = 0\n msgs.forEach((m) => {\n const key = `${m.wzrk_id.split('_')[0]}_${Date.now()}`\n m.id = key\n previewMsgs[key] = m\n this.unviewedMessages[key] = m\n this.unviewedCounter++\n })\n this.buildUIForMessages(previewMsgs)\n this.updateUnviewedBadgeCounter()\n }\n }\n\n connectedCallback () {\n this.init()\n }\n\n init () {\n this.config = this.isPreview ? this.inboxConfigForPreview : StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}\n if (Object.keys(this.config).length === 0) {\n return\n }\n this.inboxSelector = document.getElementById(this.config.inboxSelector)\n if (this.inboxSelector === null) {\n return\n }\n\n if (this.config.styles.notificationsBadge) {\n this.addUnviewedBadge()\n } else if (this.unviewedBadge) {\n this.unviewedBadge.remove()\n }\n\n this.createinbox()\n\n /**\n * We need to remove the listener as there could be a scenario where init would be called when\n * we get updated web inbox settings from LC after the inbox has been initialised.\n * It can so happen that the inbox-selector would have changed.\n */\n document.removeEventListener('click', this.addClickListenerOnDocument)\n document.addEventListener('click', this.addClickListenerOnDocument)\n this.config.categories.length && this.updateActiveCategory(this.selectedCategoryRef.innerText)\n\n this.shadow.innerHTML = this.getInboxStyles()\n this.shadow.appendChild(this.inbox)\n }\n\n addMsgsToInboxFromLS () {\n const messages = this.deleteExpiredAndGetUnexpiredMsgs(false)\n const msgIds = messages ? Object.keys(messages) : []\n if (msgIds.length === 0) {\n return\n }\n msgIds.forEach((m) => {\n if (!messages[m].viewed) {\n this.unviewedMessages[m] = messages[m]\n this.unviewedCounter++\n }\n })\n this.buildUIForMessages(messages)\n this.updateUnviewedBadgeCounter()\n }\n\n /**\n * @param {*} deleteMsgsFromUI - If this param is true, then we'll have to check the UI and delete expired messages from the DOM\n * It'll be false when you are building the inbox layout for the very first time.\n *\n * This method reads the inbox messages from LS,\n * based on the deleteMsgsFromUI flag deletes the expired messages from UI and decrements the unviewed counter if the message was not viewed,\n * sorts the messages based on the date,\n * saves the unexpired messages to LS\n * and returns the sorted unexpired messages\n *\n * Scenarios when we encounter expired messages -\n * 1. building ui for the 1st time, no need to decrement the unviewed counter as the correct count will be set at the time of rendering\n * 2. UI is already built (deleteMsgsFromUI = true) and you open the inbox\n * a. You'll find the expired msg in inbox\n * b. You'll not find the expired msg in inbox.\n * This happens when we receive new messages from LC, increment unviewed counter, save it in LS. (We build the UI only when the user opens inbox.)\n * In both the above scenarios, we'll still have to decrement the unviewed counter if the message was not viewed.\n */\n deleteExpiredAndGetUnexpiredMsgs (deleteMsgsFromUI = true) {\n let messages = getInboxMessages()\n\n const now = Math.floor(Date.now() / 1000)\n for (const msg in messages) {\n if (messages[msg].wzrk_ttl && messages[msg].wzrk_ttl > 0 && messages[msg].wzrk_ttl < now) {\n if (deleteMsgsFromUI) {\n const el = this.shadowRoot.getElementById(messages[msg].id)\n el && el.remove()\n if (!messages[msg].viewed) {\n this.unviewedCounter--\n this.updateUnviewedBadgeCounter()\n }\n }\n delete messages[msg]\n }\n }\n if (messages && messages.length > 0) {\n messages = Object.values(messages).sort((a, b) => b.date - a.date).reduce((acc, m) => { acc[m.id] = m; return acc }, {})\n }\n saveInboxMessages(messages)\n return messages\n }\n\n updateInboxMessages (msgs = []) {\n const inboxMsgs = this.deleteExpiredAndGetUnexpiredMsgs()\n const date = Date.now()\n const incomingMsgs = {}\n msgs.forEach((m, i) => {\n const key = `${m.wzrk_id.split('_')[0]}_${Date.now()}`\n m.id = key\n // We are doing this to preserve the order of the messages\n m.date = date - i\n m.viewed = 0\n inboxMsgs[key] = m\n incomingMsgs[key] = m\n this.unviewedMessages[key] = m\n this.unviewedCounter++\n })\n saveInboxMessages(inboxMsgs)\n this.buildUIForMessages(incomingMsgs)\n this.updateUnviewedBadgeCounter()\n }\n\n createEl (type, id, part) {\n const _el = document.createElement(type)\n _el.setAttribute('id', id)\n _el.setAttribute('part', part || id)\n return _el\n }\n\n addUnviewedBadge () {\n if (!this.unviewedBadge) {\n this.unviewedBadge = this.createEl('div', 'unviewedBadge')\n // As this unviewedBadge element will be directly added to the DOM, we are defining inline styles\n this.unviewedBadge.style.cssText = `display: none; position: absolute; height: 16px; width: 26px; border-radius: 8px; background-color: ${this.config.styles.notificationsBadge.backgroundColor}; font-size: 12px; color: ${this.config.styles.notificationsBadge.textColor}; font-weight: bold; align-items: center; justify-content: center;`\n document.body.appendChild(this.unviewedBadge)\n }\n this.updateUnviewedBadgePosition()\n\n // called when user switches b/w portrait and landscape mode.\n window.addEventListener('resize', () => {\n this.updateUnviewedBadgePosition()\n })\n }\n\n updateUnviewedBadgePosition () {\n const { top, right } = this.inboxSelector.getBoundingClientRect()\n this.unviewedBadge.style.top = `${top - 8}px`\n this.unviewedBadge.style.left = `${right - 8}px`\n }\n\n createinbox () {\n this.inbox = this.createEl('div', 'inbox')\n const header = this.createEl('div', 'header')\n\n const headerTitle = this.createEl('div', 'headerTitle')\n headerTitle.innerText = this.config.title\n\n const closeIcon = this.createEl('div', 'closeInbox')\n closeIcon.innerHTML = '×'\n\n header.appendChild(headerTitle)\n header.appendChild(closeIcon)\n this.inbox.appendChild(header)\n if (this.config.categories.length) {\n const categories = this.createCategories()\n this.inbox.appendChild(categories)\n }\n this.inboxCard = this.createEl('div', 'inboxCard')\n this.inbox.appendChild(this.inboxCard)\n\n this.emptyInboxMsg = this.createEl('div', 'emptyInboxMsg')\n this.emptyInboxMsg.innerText = 'All messages will be displayed here.'\n this.inboxCard.appendChild(this.emptyInboxMsg)\n\n // Intersection observer for notification viewed\n const options = {\n root: this.inboxCard,\n rootMargin: '0px',\n threshold: 0.5\n }\n this.observer = new IntersectionObserver((entries, observer) => { this.handleMessageViewed(entries) }, options)\n\n this.addMsgsToInboxFromLS()\n }\n\n createCategories () {\n const categoriesContainer = this.createEl('div', 'categoriesContainer')\n\n const leftArrow = this.createEl('div', 'leftArrow')\n leftArrow.innerHTML = arrowSvg\n leftArrow.children[0].style = 'transform: rotate(180deg)'\n leftArrow.addEventListener('click', () => {\n this.shadowRoot.getElementById('categoriesWrapper').scrollBy(-70, 0)\n })\n categoriesContainer.appendChild(leftArrow)\n\n const categoriesWrapper = this.createEl('div', 'categoriesWrapper')\n const _categories = ['All', ...this.config.categories]\n _categories.forEach((c, i) => {\n const category = this.createEl('div', `category-${i}`, 'category')\n category.innerText = c\n if (i === 0) {\n this.selectedCategoryRef = category\n }\n categoriesWrapper.appendChild(category)\n })\n categoriesContainer.appendChild(categoriesWrapper)\n\n const rightArrow = this.createEl('div', 'rightArrow')\n rightArrow.innerHTML = arrowSvg\n rightArrow.addEventListener('click', () => {\n this.shadowRoot.getElementById('categoriesWrapper').scrollBy(70, 0)\n })\n categoriesContainer.appendChild(rightArrow)\n\n const options = { root: categoriesContainer, threshold: 0.9 }\n const firstCategory = categoriesWrapper.children[0]\n const lastCategory = categoriesWrapper.children[this.config.categories.length]\n\n const firstCategoryObserver = new IntersectionObserver((e) => {\n this.categoryObserverCb(leftArrow, e[0].intersectionRatio >= 0.9)\n }, options)\n firstCategoryObserver.observe(firstCategory)\n\n const lastCategoryObserver = new IntersectionObserver((e) => {\n this.categoryObserverCb(rightArrow, e[0].intersectionRatio >= 0.9)\n }, options)\n lastCategoryObserver.observe(lastCategory)\n\n return categoriesContainer\n }\n\n categoryObserverCb (el, hide) {\n if (!el) {\n return\n }\n el.style.display = hide ? 'none' : 'flex'\n }\n\n updateActiveCategory (activeCategory) {\n this.selectedCategory = activeCategory\n\n this.inboxCard.scrollTop = 0\n let counter = 0\n\n this.prevCategoryRef && this.prevCategoryRef.setAttribute('selected', 'false')\n this.selectedCategoryRef.setAttribute('selected', 'true')\n\n this.inboxCard.childNodes.forEach(c => {\n if (c.getAttribute('id') !== 'emptyInboxMsg') {\n c.style.display = (this.selectedCategory === 'All' || c.getAttribute('category') === this.selectedCategory) ? 'block' : 'none'\n if (c.style.display === 'block') {\n counter++\n }\n }\n })\n if (counter === 0) {\n this.emptyInboxMsg.innerText = `${activeCategory} messages will be displayed here.`\n this.emptyInboxMsg.style.display = 'block'\n } else {\n this.emptyInboxMsg.style.display = 'none'\n }\n }\n\n buildUIForMessages (messages = {}) {\n !this.isPreview && this.updateTSForRenderedMsgs()\n this.inboxCard.scrollTop = 0\n const maxMsgsInInbox = this.config.maxMsgsInInbox ?? MAX_INBOX_MSG\n const firstChild = this.inboxCard.firstChild\n\n const sortedMsgs = Object.values(messages).sort((a, b) => b.date - a.date).map((m) => m.id)\n for (const m of sortedMsgs) {\n const item = new Message(this.config, messages[m])\n item.setAttribute('id', messages[m].id)\n item.setAttribute('pivot', messages[m].wzrk_pivot)\n item.setAttribute('part', 'ct-inbox-message')\n if (this.config.categories.length > 0) {\n item.setAttribute('category', messages[m].tags[0] || '')\n item.style.display = (this.selectedCategory === 'All' || messages[m].category === this.selectedCategory) ? 'block' : 'none'\n } else {\n item.style.display = 'block'\n }\n this.inboxCard.insertBefore(item, firstChild)\n this.observer.observe(item)\n }\n\n let msgTotalCount = this.inboxCard.querySelectorAll('ct-inbox-message').length\n while (msgTotalCount > maxMsgsInInbox) {\n const ctInboxMsgs = this.inboxCard.querySelectorAll('ct-inbox-message')\n if (ctInboxMsgs.length > 0) { ctInboxMsgs[ctInboxMsgs.length - 1].remove() }\n msgTotalCount--\n }\n const hasMessages = this.inboxCard.querySelectorAll('ct-inbox-message[style*=\"display: block\"]').length\n this.emptyInboxMsg.style.display = hasMessages ? 'none' : 'block'\n }\n\n /**\n * Adds a click listener on the document. For every click we check\n * 1. if the click has happenned within the inbox\n * - on close button, we close the inbox\n * - on any of the category, we set that as the activeCategory\n * - on any of the message, we mark raise notification clicked event. To identify the clicks on a button, we have p.id.startsWith('button-')\n * 2. if the user has clicked on the inboxSelector, we toggle inbox\n * 3. if the click is anywhere else on the UI and the inbox is open, we simply close it\n */\n\n addClickListenerOnDocument = (() => {\n return (e) => {\n if (e.composedPath().includes(this.inbox)) {\n // path is not supported on FF. So we fallback to e.composedPath\n const path = e.path || (e.composedPath && e.composedPath())\n if (path.length) {\n const id = path[0].id\n if (id === 'closeInbox') {\n this.toggleInbox()\n } else if (id.startsWith('category-')) {\n this.prevCategoryRef = this.selectedCategoryRef\n this.selectedCategoryRef = path[0]\n this.updateActiveCategory(path[0].innerText)\n } else {\n const _path = path.filter((p) => p.id?.startsWith('button-') || p.tagName === 'CT-INBOX-MESSAGE')\n if (_path.length) {\n const messageEl = _path[_path.length - 1]\n messageEl.raiseClickedEvent(_path[0], this.isPreview)\n }\n }\n }\n } else if (this.inboxSelector.contains(e.target) || this.isInboxOpen) {\n if (this.isInboxFromFlutter) {\n this.isInboxFromFlutter = false\n } else {\n this.toggleInbox(e)\n }\n }\n }\n })()\n\n /**\n * This function will be called every time when a message comes into the inbox viewport and it's visibility increases to 50% or drops below 50%\n * If a msg is 50% visible in the UI, we need to mark the message as viewed in LS and raise notification viewed event\n */\n handleMessageViewed (entries) {\n const raiseViewedEvent = !this.isPreview\n if (this.isInboxOpen) {\n entries.forEach((e) => {\n if (e.isIntersecting && this.unviewedMessages.hasOwnProperty(e.target.id) && e.target.message.viewed === 0) {\n e.target.message.viewed = 1\n if (raiseViewedEvent) {\n window.clevertap.renderNotificationViewed({ msgId: e.target.campaignId, pivotId: e.target.pivotId })\n this.updateMessageInLS(e.target.id, { ...e.target.message, viewed: 1 })\n setTimeout(() => {\n e.target.shadowRoot.getElementById('unreadMarker').style.display = 'none'\n }, 1000)\n } else {\n console.log('Notifiction viewed event will be raised at run time with payload ::', { msgId: e.target.campaignId, pivotId: e.target.pivotId })\n }\n this.unviewedCounter--\n this.updateUnviewedBadgeCounter()\n delete this.unviewedMessages[e.target.id]\n }\n })\n }\n }\n\n updateMessageInLS (key, value) {\n if (!this.isPreview) {\n const messages = getInboxMessages()\n messages[key] = value\n saveInboxMessages(messages)\n }\n }\n\n // create a separte fn fro refactoring\n toggleInbox (e) {\n this.isInboxOpen = !this.isInboxOpen\n this.isInboxFromFlutter = !!e?.rect\n if (this.isInboxOpen) {\n this.inboxCard.scrollTop = 0\n !this.isPreview && this.deleteExpiredAndGetUnexpiredMsgs()\n this.inbox.style.display = 'block'\n this.inbox.style.zIndex = '2147483647' // zIndex should be max for the inbox to be rendered on top of all elements\n if (this.config.categories.length) {\n this.selectedCategoryRef.setAttribute('selected', 'false')\n this.selectedCategoryRef = this.shadowRoot.getElementById('category-0')\n this.updateActiveCategory(this.selectedCategoryRef.innerText)\n this.shadowRoot.getElementById('categoriesWrapper').scrollLeft -= this.shadowRoot.getElementById('categoriesWrapper').scrollWidth\n }\n this.setInboxPosition(e)\n } else {\n this.inbox.style.display = 'none'\n }\n }\n\n setInboxPosition (e) {\n const windowWidth = window.outerWidth\n const customInboxStyles = getComputedStyle($ct.inbox)\n const top = customInboxStyles.getPropertyValue('--inbox-top')\n const bottom = customInboxStyles.getPropertyValue('--inbox-bottom')\n const left = customInboxStyles.getPropertyValue('--inbox-left')\n const right = customInboxStyles.getPropertyValue('--inbox-right')\n const hasPositionDefined = top || bottom || left || right\n if (windowWidth > 481 && !hasPositionDefined) {\n const res = getInboxPosition(e, this.inbox.clientHeight, this.inbox.clientWidth)\n const xPos = res.xPos\n const yPos = res.yPos\n this.inbox.style.top = yPos + 'px'\n this.inbox.style.left = xPos + 'px'\n }\n }\n\n /**\n * Updates the UI with the number of unviewed messages\n * If there are more than 9 unviewed messages, we show the count as 9+\n */\n\n setBadgeStyle = (msgCount) => {\n if (this.unviewedBadge !== null) {\n this.unviewedBadge.innerText = msgCount > 9 ? '9+' : msgCount\n this.unviewedBadge.style.display = msgCount > 0 ? 'flex' : 'none'\n }\n }\n\n updateUnviewedBadgeCounter () {\n if (this.isPreview) {\n this.setBadgeStyle(this.unviewedCounter)\n return\n }\n let counter = 0\n this.inboxCard.querySelectorAll('ct-inbox-message').forEach((m) => {\n const messages = getInboxMessages()\n if (messages[m.id] && messages[m.id].viewed === 0) {\n counter++\n }\n })\n this.setBadgeStyle(counter)\n }\n\n updateTSForRenderedMsgs () {\n this.inboxCard.querySelectorAll('ct-inbox-message').forEach((m) => {\n const ts = m.id.split('_')[1]\n m.shadow.getElementById('timeStamp').firstChild.innerText = determineTimeStampText(ts)\n })\n }\n\n getInboxStyles () {\n const headerHeight = 36\n const categoriesHeight = this.config.categories.length ? 64 : 16\n\n const styles = {\n panelBackgroundColor: this.config.styles.panelBackgroundColor,\n panelBorderColor: this.config.styles.panelBorderColor,\n headerBackgroundColor: this.config.styles.header.backgroundColor,\n headerTitleColor: this.config.styles.header.titleColor,\n closeIconColor: this.config.styles.closeIconColor,\n categoriesTabColor: this.config.styles.categories.tabColor,\n categoriesTitleColor: this.config.styles.categories.titleColor,\n selectedCategoryTabColor: this.config.styles.categories.selectedTab.tabColor,\n selectedCategoryTitleColor: this.config.styles.categories.selectedTab.titleColor,\n headerCategoryHeight: headerHeight + categoriesHeight\n }\n if (this.config.styles.categories.borderColor) {\n styles.categoriesBorderColor = this.config.styles.categories.borderColor\n }\n if (this.config.styles.categories.selectedTab.borderColor) {\n styles.selectedCategoryBorderColor = this.config.styles.categories.selectedTab.borderColor\n }\n\n const inboxStyles = inboxContainerStyles(styles)\n\n const cardStyles = this.config.styles.cards\n const msgStyles = messageStyles({\n backgroundColor: cardStyles.backgroundColor,\n borderColor: cardStyles.borderColor,\n titleColor: cardStyles.titleColor,\n descriptionColor: cardStyles.descriptionColor,\n buttonColor: cardStyles.buttonColor,\n buttonTextColor: cardStyles.buttonTextColor,\n unreadMarkerColor: cardStyles.unreadMarkerColor\n })\n\n return inboxStyles + msgStyles\n }\n}\n","import { StorageManager, $ct } from '../../util/storage'\nimport { Inbox } from './WebInbox'\nimport { Message } from './Message'\nimport { WEBINBOX_CONFIG, GCOOKIE_NAME, WEBINBOX } from '../../util/constants'\nimport { isValueValid } from '../../util/datatypes'\n\nexport const processWebInboxSettings = (webInboxSetting, isPreview = false) => {\n const _settings = StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}\n if (isPreview) {\n $ct.inbox.inboxConfigForPreview = webInboxSetting\n $ct.inbox.isPreview = true\n $ct.inbox && $ct.inbox.init()\n } else if (JSON.stringify(_settings) !== JSON.stringify(webInboxSetting)) {\n StorageManager.saveToLSorCookie(WEBINBOX_CONFIG, webInboxSetting)\n $ct.inbox && $ct.inbox.init()\n }\n}\n\nexport const processInboxNotifs = (msg) => {\n if (msg.inbox_preview) {\n $ct.inbox.incomingMessagesForPreview = msg.inbox_notifs\n } else {\n $ct.inbox.incomingMessages = msg\n }\n}\n\nexport const processWebInboxResponse = (msg) => {\n if (msg.webInboxSetting) {\n processWebInboxSettings(msg.webInboxSetting, msg.inbox_preview)\n }\n if (msg.inbox_notifs != null) {\n processInboxNotifs(msg)\n }\n}\n\nexport const addWebInbox = (logger) => {\n checkAndRegisterWebInboxElements()\n $ct.inbox = new Inbox({ logger })\n document.body.appendChild($ct.inbox)\n}\n\nconst getAndMigrateInboxMessages = (guid) => {\n const messages = StorageManager.readFromLSorCookie(WEBINBOX) || {}\n // Doing this to migrate message to guid level\n if (Object.keys(messages).length > 0 && Object.keys(messages)[0].includes('_')) {\n const gudInboxObj = {}\n gudInboxObj[guid] = messages\n StorageManager.saveToLSorCookie(WEBINBOX, gudInboxObj)\n return gudInboxObj\n }\n return messages\n}\n\nexport const getInboxMessages = () => {\n const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n if (!isValueValid(guid)) { return {} }\n const messages = getAndMigrateInboxMessages(guid)\n\n return messages.hasOwnProperty(guid) ? messages[guid] : {}\n}\n\nexport const saveInboxMessages = (messages) => {\n const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n if (!isValueValid(guid)) { return }\n const storedInboxObj = getAndMigrateInboxMessages(guid)\n\n const newObj = { ...storedInboxObj, [guid]: messages }\n StorageManager.saveToLSorCookie(WEBINBOX, newObj)\n}\n\nexport const initializeWebInbox = (logger) => {\n return new Promise((resolve, reject) => {\n if (document.readyState === 'complete') {\n addWebInbox(logger)\n resolve()\n } else {\n const config = StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}\n const onLoaded = () => {\n /**\n * We need this null check here because $ct.inbox could be initialised via init method too on document load.\n * In that case we don't need to call addWebInbox method\n */\n if ($ct.inbox === null) {\n addWebInbox(logger)\n }\n resolve()\n }\n window.addEventListener('load', () => {\n /**\n * Scripts can be loaded layzily, we may not get element from dom as it may not be mounted yet\n * We will to check element for 10 seconds and give up\n */\n if (document.getElementById(config.inboxSelector)) {\n onLoaded()\n } else {\n // check for element for next 10 seconds\n let count = 0\n if (count < 20) {\n const t = setInterval(() => {\n if (document.getElementById(config.inboxSelector)) {\n onLoaded()\n clearInterval(t)\n resolve()\n } else if (count >= 20) {\n clearInterval(t)\n logger.debug('Failed to add inbox')\n }\n count++\n }, 500)\n }\n }\n })\n }\n })\n}\n\nexport const checkAndRegisterWebInboxElements = () => {\n if (customElements.get('ct-web-inbox') === undefined) {\n customElements.define('ct-web-inbox', Inbox)\n customElements.define('ct-inbox-message', Message)\n }\n}\n\nexport const getInboxPosition = (e, inboxHeight, inboxWidth) => {\n const horizontalScroll = document.scrollingElement.scrollLeft\n const verticalScroll = document.scrollingElement.scrollTop\n const windowWidth = window.innerWidth + horizontalScroll\n const windowHeight = window.innerHeight + verticalScroll\n const selectorRect = e.rect || e.target.getBoundingClientRect()\n const selectorX = selectorRect.x + horizontalScroll\n const selectorY = selectorRect.y + verticalScroll\n const selectorLeft = selectorRect.left + horizontalScroll\n const selectorRight = selectorRect.right + horizontalScroll\n const selectorTop = selectorRect.top + verticalScroll\n // const selectorBottom = selectorRect.bottom + verticalScroll\n const selectorBottom = selectorRect.bottom\n const selectorHeight = selectorRect.height\n const selectorWidth = selectorRect.width\n const selectorCenter = {\n x: selectorX + (selectorWidth / 2),\n y: selectorY + (selectorHeight / 2)\n }\n const halfOfInboxHeight = (inboxHeight / 2)\n const halfOfInboxWidth = (inboxWidth / 2)\n let inboxOnSide = false\n\n let xPos, yPos\n\n const padding = 16\n\n /**\n * y co-ordinates:\n * Try to push the card downwards\n * if that's not possible, push it upwards\n * if that too is not possible, then the card will be placed on the side. Add some padding.\n *\n * x co-ordinates:\n * If the card is on the side,\n * try to place it to the right. If it's not possible,\n * place it to the left\n * If the card is either on top/ bottom, set the x co-ordinate such that the selector center and the inbox card center become the same\n * Now,\n * if the left of the inbox card is < 0,\n * try to get the left aligned to the selectorLeft.\n * if that's not possible, simply set left to 0\n * if the right of the inbox card > windowWidth,\n * try to get the right of rhe inbox card aligned with the selectorRight\n * if that's not possible, simply set the inbox right to the window Right\n */\n if (selectorBottom + inboxHeight <= windowHeight) { // try to place the card down\n const availableHeight = windowHeight - (selectorBottom + inboxHeight)\n yPos = availableHeight >= padding ? selectorBottom + padding : selectorBottom + availableHeight\n } else if (selectorTop - inboxHeight >= verticalScroll) { // try to place the card up\n const availableHeight = selectorTop - inboxHeight\n yPos = availableHeight >= padding ? selectorTop - inboxHeight - padding : selectorTop - inboxHeight - availableHeight\n } else {\n inboxOnSide = true\n yPos = selectorCenter.y - halfOfInboxHeight // with this the y co-ordinate of the selector center and the inbox card center become the same\n if (yPos < verticalScroll) {\n yPos = verticalScroll\n } else if (yPos + inboxHeight > windowHeight) {\n yPos = windowHeight - inboxHeight\n }\n }\n\n if (inboxOnSide) {\n // See if we can place the card to the right of the selector\n const inboxRight = selectorRight + inboxWidth\n if (inboxRight <= windowWidth) {\n const availableWidth = inboxRight + padding <= windowWidth ? padding : windowWidth - inboxRight\n xPos = selectorRight + availableWidth\n } else {\n const inboxLeft = selectorLeft - inboxWidth\n const availableWidth = inboxLeft - padding >= horizontalScroll ? padding : inboxLeft - horizontalScroll\n xPos = inboxLeft - availableWidth\n }\n } else {\n xPos = selectorCenter.x - halfOfInboxWidth\n if (xPos < horizontalScroll) {\n if (selectorLeft + inboxWidth <= windowWidth) {\n xPos = selectorLeft\n } else {\n xPos = horizontalScroll\n }\n } else if (xPos + inboxWidth > windowWidth) {\n if (selectorRight - inboxWidth >= horizontalScroll) {\n xPos = selectorRight - inboxWidth\n } else {\n xPos = windowWidth - inboxWidth\n }\n }\n }\n\n return { xPos, yPos }\n}\n\nexport const determineTimeStampText = (ts) => {\n const now = Date.now()\n let diff = Math.floor((now - ts) / 60000)\n if (diff < 5) {\n return 'Just now'\n }\n if (diff < 60) {\n return `${diff} minute${diff > 1 ? 's' : ''} ago`\n }\n diff = Math.floor(diff / 60)\n if (diff < 24) {\n return `${diff} hour${diff > 1 ? 's' : ''} ago`\n }\n diff = Math.floor(diff / 24)\n return `${diff} day${diff > 1 ? 's' : ''} ago`\n}\n\nexport const hasWebInboxSettingsInLS = () => {\n return Object.keys(StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}).length > 0\n}\n\nexport const arrowSvg = `\n\n\n`\nexport const greenTickSvg = `\n\n\n`\n","export const OVERLAY_PATH = 'https://web-native-display-campaign.clevertap.com/production/lib-overlay/overlay.js'\nexport const CSS_PATH = 'https://web-native-display-campaign.clevertap.com/production/lib-overlay/style.css'\nexport const WVE_CLASS = {\n FLICKER_SHOW: 'wve-anti-flicker-show',\n FLICKER_HIDE: 'wve-anti-flicker-hide',\n FLICKER_ID: 'wve-flicker-style'\n}\n","export const updateFormData = (element, formStyle, payload, isPreview = false) => {\n // Update the element style\n if (formStyle.style !== undefined) {\n Object.keys(formStyle.style).forEach((property) => {\n element.style.setProperty(property, formStyle.style[property])\n })\n }\n\n // Update underline for element\n if (formStyle.underline !== undefined) {\n const curTextDecoration = element.style.textDecoration\n if (formStyle.underline) {\n element.style.textDecoration = `${curTextDecoration} underline`.trim()\n } else {\n element.style.textDecoration = curTextDecoration.replace('underline', '').trim()\n }\n }\n\n // Update element text\n if (formStyle.text !== undefined) {\n element.innerText = isPreview ? formStyle.text.text : formStyle.text\n }\n\n // Handle element onClick\n if (formStyle.clickDetails !== undefined) {\n const url = formStyle.clickDetails.clickUrl\n element.onclick = formStyle.clickDetails.newTab\n ? () => {\n if (!isPreview) {\n window.clevertap.raiseNotificationClicked(payload)\n }\n window.open(url, '_blank').focus()\n }\n : () => {\n if (!isPreview) {\n window.clevertap.raiseNotificationClicked(payload)\n }\n window.location.href = url\n }\n }\n\n // Set the image source\n if (formStyle.imgURL !== undefined && element.tagName.toLowerCase() === 'img') {\n element.src = formStyle.imgURL\n }\n\n // Handle elementCss\n if (formStyle.elementCss !== undefined) {\n const style = document.createElement('style')\n style.innerHTML = formStyle.elementCss\n document.head.appendChild(style)\n }\n}\n","import { CSS_PATH, OVERLAY_PATH, WVE_CLASS } from './builder_constants'\nimport { updateFormData } from './dataUpdate'\n\nexport const checkBuilder = (logger, accountId) => {\n const search = window.location.search\n const parentWindow = window.opener\n\n if (search === '?ctBuilder') {\n // open in visual builder mode\n logger.debug('open in visual builder mode')\n window.addEventListener('message', handleMessageEvent, false)\n if (parentWindow) {\n parentWindow.postMessage({ message: 'builder', originUrl: window.location.href }, '*')\n }\n return\n }\n if (search === '?ctBuilderPreview') {\n window.addEventListener('message', handleMessageEvent, false)\n if (parentWindow) {\n parentWindow.postMessage({ message: 'preview', originUrl: window.location.href }, '*')\n }\n }\n\n if (search === '?ctBuilderSDKCheck') {\n if (parentWindow) {\n const sdkVersion = '$$PACKAGE_VERSION$$'\n parentWindow.postMessage({\n message: 'SDKVersion',\n accountId,\n originUrl: window.location.href,\n sdkVersion\n },\n '*'\n )\n }\n }\n}\n\nconst handleMessageEvent = (event) => {\n if (event.data && isValidUrl(event.data.originUrl)) {\n const msgOrigin = new URL(event.data.originUrl).origin\n if (event.origin !== msgOrigin) {\n return\n }\n } else {\n return\n }\n if (event.data.message === 'Dashboard') {\n // handle personalisation\n window.evtMaster = event.data.personalisation.evtMaster\n initialiseCTBuilder(\n event.data.url,\n event.data.variant ?? null,\n event.data.details ?? {},\n event.data.personalisation\n )\n } else if (event.data.message === 'Overlay') {\n renderVisualBuilder(event.data, true)\n }\n}\n/**\n * Initializes the Clevertap builder.\n * @param {string} url - The URL to initialize the builder.\n * @param {string} variant - The variant of the builder.\n * @param {Object} details - The details object.\n * @param {Object} personalisation - The personalisation object\n */\nconst initialiseCTBuilder = (url, variant, details, personalisation) => {\n if (document.readyState === 'complete') {\n onContentLoad(url, variant, details, personalisation)\n } else {\n document.addEventListener('readystatechange', () => {\n if (document.readyState === 'complete') {\n onContentLoad(url, variant, details, personalisation)\n }\n })\n }\n}\n\nlet container\nlet contentLoaded = false\nlet isShopify = false\n/**\n * Handles content load for Clevertap builder.\n */\nfunction onContentLoad (url, variant, details, personalisation) {\n if (!contentLoaded) {\n if (window.Shopify) {\n isShopify = true\n }\n document.body.innerHTML = ''\n document.head.innerHTML = ''\n document.documentElement.innerHTML = ''\n container = document.createElement('div')\n container.id = 'overlayDiv'\n container.style.position = 'relative' // Ensure relative positioning for absolute positioning of form\n container.style.display = 'flex'\n document.body.appendChild(container)\n const overlayPath = OVERLAY_PATH\n loadOverlayScript(overlayPath, url, variant, details, personalisation)\n .then(() => {\n console.log('Overlay script loaded successfully.')\n contentLoaded = true\n })\n .catch((error) => {\n console.error('Error loading overlay script:', error)\n })\n loadCSS()\n }\n}\n\n/**\n * Loads CSS file.\n */\nfunction loadCSS () {\n var link = document.createElement('link')\n link.rel = 'stylesheet'\n link.type = 'text/css'\n link.href = CSS_PATH\n document.head.appendChild(link)\n}\n\n/**\n * Loads the overlay script.\n * @param {string} overlayPath - The path to overlay script.\n * @param {string} url - The URL.\n * @param {string} variant - The variant.\n * @param {Object} details - The details object.\n * @param {Object} personalisation\n * @returns {Promise} A promise.\n */\nfunction loadOverlayScript (overlayPath, url, variant, details, personalisation) {\n return new Promise((resolve, reject) => {\n var script = document.createElement('script')\n script.type = 'module'\n script.src = overlayPath\n script.onload = function () {\n if (typeof window.Overlay === 'function') {\n window.Overlay({ id: '#overlayDiv', url, variant, details, isShopify, personalisation })\n resolve()\n } else {\n reject(new Error('ContentLayout not found in overlay.js'))\n }\n }\n script.onerror = function (error) {\n reject(error)\n }\n document.head.appendChild(script)\n })\n}\n\n/**\n * Renders the visual builder.\n * @param {Object} targetingMsgJson - The point and click campaign JSON object.\n * @param {boolean} isPreview - Indicates if it's a preview.\n */\nexport const renderVisualBuilder = (targetingMsgJson, isPreview) => {\n const details = isPreview ? targetingMsgJson.details : targetingMsgJson.display.details\n let notificationViewed = false\n const payload = {\n msgId: targetingMsgJson.wzrk_id,\n pivotId: targetingMsgJson.wzrk_pivot\n }\n\n const raiseViewed = () => {\n if (!isPreview && !notificationViewed) {\n notificationViewed = true\n window.clevertap.renderNotificationViewed(payload)\n }\n }\n\n const processElement = (element, selector) => {\n if (!selector.values) return\n if (selector.values.html) {\n element.outerHTML = selector.values.html\n } else if (selector.values?.json) {\n dispatchJsonData(targetingMsgJson, selector.values)\n } else {\n payload.msgCTkv = { wzrk_selector: selector.selector }\n updateFormData(element, selector.values.form, payload, isPreview)\n }\n }\n\n const tryFindingElement = (selector) => {\n let count = 0\n const intervalId = setInterval(() => {\n const retryElement = document.querySelector(selector.selector)\n if (retryElement) {\n raiseViewed()\n processElement(retryElement, selector)\n clearInterval(intervalId)\n } else if (++count >= 20) {\n console.log(`No element present on DOM with selector '${selector}'.`)\n clearInterval(intervalId)\n }\n }, 500)\n }\n\n details.forEach(d => {\n if (d.url === window.location.href.split('?')[0]) {\n d.selectorData.forEach(s => {\n const element = document.querySelector(s.selector)\n if (element) {\n raiseViewed()\n processElement(element, s)\n } else {\n tryFindingElement(s)\n }\n })\n }\n })\n}\n\n/**\n * Dispatches JSON data.\n * @param {Object} targetingMsgJson - The point and click campaign JSON object.\n * @param {Object} selector - The selector object.\n */\nfunction dispatchJsonData (targetingMsgJson, selector) {\n const inaObj = {}\n inaObj.msgId = targetingMsgJson.wzrk_id\n if (targetingMsgJson.wzrk_pivot) {\n inaObj.pivotId = targetingMsgJson.wzrk_pivot\n }\n if (selector.json != null) {\n inaObj.json = selector.json\n }\n const kvPairsEvent = new CustomEvent('CT_web_native_display_buider', { detail: inaObj })\n document.dispatchEvent(kvPairsEvent)\n}\n\nfunction isValidUrl (string) {\n try {\n const url = new URL(string)\n return Boolean(url)\n } catch (_err) {\n return false\n }\n}\n\nexport function addAntiFlicker (antiFlicker) {\n const { personalizedSelectors = [], delayTime = 2000 } = antiFlicker\n const retryElements = {} // Track selectors that need retry\n let retryCount = 0 // Counter for retries\n let retryInterval\n function isInViewport (element) {\n const rect = element.getBoundingClientRect()\n const { innerHeight: windowHeight, innerWidth: windowWidth } = window\n return (\n rect.bottom > 0 &&\n rect.right > 0 &&\n rect.top < windowHeight &&\n rect.left < windowWidth\n )\n }\n (function () {\n const styleContent = `\n .wve-anti-flicker-hide {\n opacity: 0 !important\n }\n .wve-anti-flicker-show {\n transition: opacity 0.5s, filter 0.5s !important\n }\n `\n // Create and append the style element if it doesn't exist\n const styleId = WVE_CLASS.FLICKER_ID\n if (!document.getElementById(styleId)) {\n const styleElement = document.createElement('style')\n styleElement.id = styleId\n styleElement.textContent = styleContent\n document.head.appendChild(styleElement)\n }\n })()\n function applyAntiFlicker (selectors) {\n function processSelectors (selectorElements) {\n const elements = []\n selectorElements.forEach(selector => {\n const matchedElements = document.querySelectorAll(selector)\n if (matchedElements.length) {\n matchedElements.forEach(el => {\n if (isInViewport(el)) {\n elements.push(el)\n }\n })\n delete retryElements[selector] // Successfully processed, remove from retry list\n } else {\n retryElements[selector] = false // Add to retry list if not found\n }\n })\n applyStyles(elements)\n }\n function retryProcessing () {\n processSelectors(Object.keys(retryElements))\n retryCount++\n if (Object.keys(retryElements).length === 0 || retryCount > 20) {\n retryCount = 0\n clearInterval(retryInterval)\n }\n }\n processSelectors(selectors)\n if (Object.keys(retryElements).length) {\n retryInterval = setInterval(retryProcessing, 100)\n }\n }\n function applyStyles (elements) {\n elements.forEach(el => el.classList.add(WVE_CLASS.FLICKER_HIDE))\n setTimeout(() => {\n elements.forEach(el => {\n el.classList.remove(WVE_CLASS.FLICKER_HIDE)\n el.classList.add(WVE_CLASS.FLICKER_SHOW)\n })\n }, delayTime) // Apply styles after maxRenderTime\n }\n function observeUrlChange () {\n let previousHref = document.location.href\n const observer = new MutationObserver(() => {\n if (previousHref !== document.location.href) {\n previousHref = document.location.href\n applyAntiFlicker(personalizedSelectors)\n }\n })\n observer.observe(document.body, { childList: true, subtree: true })\n }\n window.addEventListener('load', () => {\n observeUrlChange()\n applyAntiFlicker(personalizedSelectors)\n })\n}\n","export class CTWebPersonalisationBanner extends HTMLElement {\n constructor () {\n super()\n this.shadow = this.attachShadow({ mode: 'open' })\n }\n\n _details = null\n shadow = null\n\n get details () {\n return this._details || ''\n }\n\n set details (val) {\n if (this._details === null) {\n this._details = val\n this.renderBanner()\n }\n }\n\n renderBanner () {\n this.shadow.innerHTML = this.getBannerContent()\n if (this.trackClick !== false) {\n this.addEventListener('click', () => {\n const onClickUrl = this.details.onClick\n if (onClickUrl) {\n this.details.window ? window.open(onClickUrl, '_blank') : window.parent.location.href = onClickUrl\n }\n window.clevertap.renderNotificationClicked({ msgId: this.msgId, pivotId: this.pivotId })\n })\n }\n window.clevertap.renderNotificationViewed({ msgId: this.msgId, pivotId: this.pivotId })\n }\n\n getBannerContent () {\n return `\n \n
\n \n \n \n \"Please\n \n ${this.details.html ? this.details.html : ''}\n
\n `\n }\n}\n","import { CTWebPersonalisationBanner } from './banner'\nexport class CTWebPersonalisationCarousel extends HTMLElement {\n constructor () {\n super()\n this.shadow = this.attachShadow({ mode: 'open' })\n if (customElements.get('ct-web-personalisation-banner') === undefined) {\n customElements.define('ct-web-personalisation-banner', CTWebPersonalisationBanner)\n }\n }\n\n _target = null\n _carousel = null\n shadow = null\n slides = 0\n previouslySelectedItem = -1\n selectedItem = 1\n autoSlide = null\n stopAutoSlideTimeout = null\n\n get target () {\n return this._target || ''\n }\n\n set target (val) {\n if (this._target === null) {\n this._target = val\n this.renderCarousel()\n }\n }\n\n get details () {\n return this.target.display.details\n }\n\n get display () {\n return this.target.display\n }\n\n renderCarousel () {\n this.slides = this.details.length\n this.shadow.innerHTML = this.getStyles()\n const carousel = this.getCarouselContent()\n if (this.display.showNavBtns) {\n carousel.insertAdjacentHTML('beforeend', this.display.navBtnsHtml)\n }\n if (this.display.showNavArrows) {\n carousel.insertAdjacentHTML('beforeend', this.display.leftNavArrowHtml)\n carousel.insertAdjacentHTML('beforeend', this.display.rightNavArrowHtml)\n }\n this._carousel = carousel\n this.shadow.appendChild(carousel)\n this.setupClick()\n this.updateSelectedItem()\n // TODO: enable conditionally\n this.startAutoSlide()\n this.setupOnHover()\n window.clevertap.renderNotificationViewed({ msgId: this.target.wzrk_id, pivotId: this.target.wzrk_pivot })\n }\n\n setupClick () {\n this._carousel.addEventListener('click', (event) => {\n const eventID = event.target.id\n if (eventID.startsWith('carousel__button')) {\n const selected = +eventID.split('-')[1]\n if (selected !== this.selectedItem) {\n this.previouslySelectedItem = this.selectedItem\n this.selectedItem = selected\n this.updateSelectedItem()\n this.startAutoSlide()\n }\n } else if (eventID.startsWith('carousel__arrow')) {\n eventID.endsWith('right') ? this.goToNext() : this.goToPrev()\n this.startAutoSlide()\n } else if (eventID.indexOf('-') > -1) {\n const item = +eventID.split('-')[1]\n const index = item - 1\n if (window.parent.clevertap) {\n window.clevertap.renderNotificationClicked({ msgId: this.target.wzrk_id, pivotId: this.target.wzrk_pivot, wzrk_slideNo: item })\n }\n const url = this.details[index].onClick\n if (url !== '') {\n this.details[index].window ? window.open(url, '_blank') : window.location.href = url\n }\n }\n })\n }\n\n setupOnHover () {\n this._carousel.addEventListener('mouseenter', (event) => {\n this.stopAutoSlideTimeout = setTimeout(() => {\n this.autoSlide = clearInterval(this.autoSlide)\n }, 500)\n })\n\n this._carousel.addEventListener('mouseleave', (event) => {\n clearTimeout(this.stopAutoSlideTimeout)\n if (this.autoSlide === undefined) {\n this.startAutoSlide()\n }\n })\n }\n\n getCarouselContent () {\n const carousel = document.createElement('div')\n carousel.setAttribute('class', 'carousel')\n\n this.details.forEach((detail, i) => {\n const banner = document.createElement('ct-web-personalisation-banner')\n banner.classList.add('carousel__item')\n banner.trackClick = false\n banner.setAttribute('id', `carousel__item-${i + 1}`)\n banner.details = detail\n carousel.appendChild(banner)\n })\n\n return carousel\n }\n\n getStyles () {\n return `\n \n `\n }\n\n updateSelectedItem () {\n if (this.previouslySelectedItem !== -1) {\n const prevItem = this.shadow.getElementById(`carousel__item-${this.previouslySelectedItem}`)\n const prevButton = this.shadow.getElementById(`carousel__button-${this.previouslySelectedItem}`)\n prevItem.classList.remove('carousel__item--selected')\n if (prevButton) {\n prevButton.classList.remove('carousel__button--selected')\n }\n }\n const item = this.shadow.getElementById(`carousel__item-${this.selectedItem}`)\n const button = this.shadow.getElementById(`carousel__button-${this.selectedItem}`)\n item.classList.add('carousel__item--selected')\n if (button) {\n button.classList.add('carousel__button--selected')\n }\n }\n\n startAutoSlide () {\n clearInterval(this.autoSlide)\n this.autoSlide = setInterval(() => {\n this.goToNext()\n }, this.display.sliderTime ? this.display.sliderTime * 1000 : 3000)\n }\n\n goToNext () {\n this.goTo(this.selectedItem, (this.selectedItem + 1) % this.slides)\n }\n\n goToPrev () {\n this.goTo(this.selectedItem, this.selectedItem - 1)\n }\n\n goTo (prev, cur) {\n this.previouslySelectedItem = prev\n this.selectedItem = cur\n if (cur === 0) {\n this.selectedItem = this.slides\n }\n this.updateSelectedItem()\n }\n}\n","import { CTWebPersonalisationBanner } from '../web-personalisation/banner'\nimport { CTWebPersonalisationCarousel } from '../web-personalisation/carousel'\n\nexport const renderPersonalisationBanner = (targetingMsgJson) => {\n if (customElements.get('ct-web-personalisation-banner') === undefined) {\n customElements.define('ct-web-personalisation-banner', CTWebPersonalisationBanner)\n }\n const divId = targetingMsgJson.display.divId ?? targetingMsgJson.display.divSelector\n const bannerEl = document.createElement('ct-web-personalisation-banner')\n bannerEl.msgId = targetingMsgJson.wzrk_id\n bannerEl.pivotId = targetingMsgJson.wzrk_pivot\n bannerEl.divHeight = targetingMsgJson.display.divHeight\n bannerEl.details = targetingMsgJson.display.details[0]\n const containerEl = targetingMsgJson.display.divId ? document.getElementById(divId) : document.querySelector(divId)\n containerEl.innerHTML = ''\n containerEl.appendChild(bannerEl)\n}\n\nexport const renderPersonalisationCarousel = (targetingMsgJson) => {\n if (customElements.get('ct-web-personalisation-carousel') === undefined) {\n customElements.define('ct-web-personalisation-carousel', CTWebPersonalisationCarousel)\n }\n const divId = targetingMsgJson.display.divId ?? targetingMsgJson.display.divSelector\n const carousel = document.createElement('ct-web-personalisation-carousel')\n carousel.target = targetingMsgJson\n const container = targetingMsgJson.display.divId ? document.getElementById(divId) : document.querySelector(divId)\n container.innerHTML = ''\n container.appendChild(carousel)\n}\n\nexport const handleKVpairCampaign = (targetingMsgJson) => {\n const inaObj = {}\n inaObj.msgId = targetingMsgJson.wzrk_id\n if (targetingMsgJson.wzrk_pivot) {\n inaObj.pivotId = targetingMsgJson.wzrk_pivot\n }\n if (targetingMsgJson.msgContent.kv != null) {\n inaObj.kv = targetingMsgJson.msgContent.kv\n }\n const kvPairsEvent = new CustomEvent('CT_web_native_display', { detail: inaObj })\n document.dispatchEvent(kvPairsEvent)\n}\n","import { getCampaignObject, saveCampaignObject, closeIframe } from '../clevertap'\nimport { CAMP_COOKIE_G, GCOOKIE_NAME, EV_COOKIE, WZRK_ID, NOTIFICATION_VIEWED } from '../constants'\nimport { StorageManager, $ct } from '../storage'\nimport RequestDispatcher from '../requestDispatcher'\nimport { compressToBase64 } from '../encoder'\n\nexport const invokeExternalJs = (jsFunc, targetingMsgJson) => {\n const func = window.parent[jsFunc]\n if (typeof func === 'function') {\n if (targetingMsgJson.display.kv != null) {\n func(targetingMsgJson.display.kv)\n } else {\n func()\n }\n }\n}\n\nexport const appendScriptForCustomEvent = (targetingMsgJson, html) => {\n const script = `\n `\n return html.replace(/(<\\s*\\/\\s*body)/, `${script}\\n$1`)\n}\n\nexport const staleDataUpdate = (staledata, campType) => {\n const campObj = getCampaignObject()\n const globalObj = campObj[campType].global\n if (globalObj != null && campType) {\n for (const idx in staledata) {\n if (staledata.hasOwnProperty(idx)) {\n delete globalObj[staledata[idx]]\n if (StorageManager.read(CAMP_COOKIE_G)) {\n const guidCampObj = JSON.parse(decodeURIComponent(StorageManager.read(CAMP_COOKIE_G)))\n const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n if (guidCampObj[guid] && guidCampObj[guid][campType] && guidCampObj[guid][campType][staledata[idx]]) {\n delete guidCampObj[guid][campType][staledata[idx]]\n StorageManager.save(CAMP_COOKIE_G, encodeURIComponent(JSON.stringify(guidCampObj)))\n }\n }\n }\n }\n }\n saveCampaignObject(campObj)\n}\n\nexport const mergeEventMap = (newEvtMap) => {\n if ($ct.globalEventsMap == null) {\n $ct.globalEventsMap = StorageManager.readFromLSorCookie(EV_COOKIE)\n if ($ct.globalEventsMap == null) {\n $ct.globalEventsMap = newEvtMap\n return\n }\n }\n for (const key in newEvtMap) {\n if (newEvtMap.hasOwnProperty(key)) {\n const oldEvtObj = $ct.globalEventsMap[key]\n const newEvtObj = newEvtMap[key]\n if ($ct.globalEventsMap[key] != null) {\n if (newEvtObj[0] != null && newEvtObj[0] > oldEvtObj[0]) {\n $ct.globalEventsMap[key] = newEvtObj\n }\n } else {\n $ct.globalEventsMap[key] = newEvtObj\n }\n }\n }\n}\n\nexport const incrementImpression = (targetingMsgJson, _request) => {\n const data = {}\n data.type = 'event'\n data.evtName = NOTIFICATION_VIEWED\n data.evtData = { [WZRK_ID]: targetingMsgJson.wzrk_id }\n if (targetingMsgJson.wzrk_pivot) {\n data.evtData = { ...data.evtData, wzrk_pivot: targetingMsgJson.wzrk_pivot }\n }\n _request.processEvent(data)\n}\n\nexport const setupClickEvent = (onClick, targetingMsgJson, contentDiv, divId, isLegacy, _device, _session) => {\n if (onClick !== '' && onClick != null) {\n let ctaElement\n let jsCTAElements\n if (isLegacy) {\n ctaElement = contentDiv\n } else if (contentDiv !== null) {\n jsCTAElements = contentDiv.getElementsByClassName('jsCT_CTA')\n if (jsCTAElements != null && jsCTAElements.length === 1) {\n ctaElement = jsCTAElements[0]\n }\n }\n const jsFunc = targetingMsgJson.display.jsFunc\n const isPreview = targetingMsgJson.display.preview\n if (isPreview == null) {\n onClick += getCookieParams(_device, _session)\n }\n\n if (ctaElement != null) {\n ctaElement.onclick = () => {\n // invoke js function call\n if (jsFunc != null) {\n // track notification clicked event\n if (isPreview == null) {\n RequestDispatcher.fireRequest(onClick)\n }\n invokeExternalJs(jsFunc, targetingMsgJson)\n // close iframe. using -1 for no campaignId\n closeIframe('-1', divId, _session.sessionId)\n } else {\n const rValue = targetingMsgJson.display.preview ? targetingMsgJson.display.onClick : new URL(targetingMsgJson.display.onClick).searchParams.get('r')\n const campaignId = targetingMsgJson.wzrk_id.split('_')[0]\n\n if (rValue === 'pushPrompt') {\n if (!targetingMsgJson.display.preview) {\n window.parent.clevertap.renderNotificationClicked({ msgId: targetingMsgJson.wzrk_id, pivotId: targetingMsgJson.wzrk_pivot })\n }\n // Open Web Push Soft prompt\n window.clevertap.notifications.push({\n skipDialog: true\n })\n closeIframe(campaignId, divId, _session.sessionId)\n } else if (rValue === 'none') {\n // Close notification\n closeIframe(campaignId, divId, _session.sessionId)\n } else {\n // Will get the url to open\n if (targetingMsgJson.display.window === 1) {\n window.open(onClick, '_blank')\n if (targetingMsgJson.display['close-popup']) {\n closeIframe(campaignId, divId, _session.sessionId)\n }\n if (!targetingMsgJson.display.preview) {\n window.parent.clevertap.renderNotificationClicked({ msgId: targetingMsgJson.wzrk_id, pivotId: targetingMsgJson.wzrk_pivot })\n }\n } else {\n window.location = onClick\n }\n }\n }\n }\n }\n }\n}\n\nexport const getCookieParams = (_device, _session) => {\n const gcookie = _device.getGuid()\n const scookieObj = _session.getSessionCookieObject()\n return '&t=wc&d=' + encodeURIComponent(compressToBase64(gcookie + '|' + scookieObj.p + '|' + scookieObj.s))\n}\n","export const renderPopUpImageOnly = (targetingMsgJson, _session) => {\n const divId = 'wzrkImageOnlyDiv'\n const popupImageOnly = document.createElement('ct-web-popup-imageonly')\n popupImageOnly.session = _session\n popupImageOnly.target = targetingMsgJson\n const containerEl = document.getElementById(divId)\n containerEl.innerHTML = ''\n containerEl.style.visibility = 'hidden'\n containerEl.appendChild(popupImageOnly)\n}\n","export const getBoxPromptStyles = (style) => {\n const totalBorderWidth = style.card.borderEnabled ? style.card.border.borderWidth * 2 : 0\n const cardPadding = 16 * 2 // Left and right padding\n const cardContentWidth = 360 - cardPadding - totalBorderWidth\n\n return `\n #pnWrapper {\n width: 360px;\n }\n\n #pnOverlay {\n background-color: ${style.overlay.color || 'rgba(0, 0, 0, .15)'};\n position: fixed;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n z-index: 10000\n }\n\n #pnCard {\n background-color: ${style.card.color};\n border-radius: ${style.card.borderRadius}px;\n padding: 16px;\n width: ${cardContentWidth}px;\n position: fixed;\n z-index: 999999;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n ${style.card.borderEnabled ? `\n border-width: ${style.card.border.borderWidth}px;\n border-color: ${style.card.border.borderColor};\n border-style: solid;\n ` : ''}\n height: fit-content;\n }\n\n #iconTitleDescWrapper {\n display: flex;\n align-items: center;\n margin-bottom: 16px;\n gap: 12px;\n }\n\n #iconContainer {\n min-width: 64px;\n max-width: 64px;\n aspect-ratio: 1;\n object-fit: cover;\n }\n\n #titleDescWrapper {\n flex-grow: 1;\n overflow: hidden;\n overflow-wrap: break-word;\n }\n\n #title {\n font-size: 16px;\n font-weight: 700;\n color: ${style.text.titleColor};\n margin-bottom: 4px;\n line-height: 24px;\n }\n\n #description {\n font-size: 14px;\n font-weight: 500;\n color: ${style.text.descriptionColor};\n line-height: 20px;\n }\n\n #buttonsContainer {\n display: flex;\n justify-content: space-between;\n min-height: 32px;\n gap: 8px;\n align-items: center;\n }\n\n #primaryButton, #secondaryButton {\n padding: 6px 24px;\n flex: 1;\n cursor: pointer;\n font-weight: bold;\n display: flex;\n align-items: center;\n justify-content: center;\n height: max-content;\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n }\n\n #primaryButton {\n background-color: ${style.buttons.primaryButton.buttonColor};\n color: ${style.buttons.primaryButton.textColor};\n border-radius: ${style.buttons.primaryButton.borderRadius}px;\n ${style.buttons.primaryButton.borderEnabled\n ? `\n border-width: ${style.buttons.primaryButton.border.borderWidth}px;\n border-color: ${style.buttons.primaryButton.border.borderColor};\n border-style: solid;\n `\n : 'border: none;'}\n }\n\n #secondaryButton {\n background-color: ${style.buttons.secondaryButton.buttonColor};\n color: ${style.buttons.secondaryButton.textColor};\n border-radius: ${style.buttons.secondaryButton.borderRadius}px;\n ${style.buttons.secondaryButton.borderEnabled\n ? `\n border-width: ${style.buttons.secondaryButton.border.borderWidth}px;\n border-color: ${style.buttons.secondaryButton.border.borderColor};\n border-style: solid;\n `\n : 'border: none;'}\n }\n\n #primaryButton:hover, #secondaryButton:hover {\n opacity: 0.9;\n }\n `\n}\n\nexport const getBellIconStyles = (style) => {\n return `\n #bell_wrapper {\n position: fixed;\n cursor: pointer;\n background-color: ${style.card.backgroundColor};\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n width: 48px;\n height: 48px;\n border-radius: 50%;\n display: flex;\n flex-direction: column;\n gap: 8px;\n z-index: 999999;\n }\n\n #bell_icon {\n display: block;\n width: 48px;\n height: 48px;\n }\n\n #bell_wrapper:hover {\n transform: scale(1.05);\n transition: transform 0.2s ease-in-out;\n }\n\n #bell_tooltip {\n display: none;\n background-color: #2b2e3e;\n color: #fff;\n border-radius: 4px;\n padding: 4px;\n white-space: nowrap;\n pointer-events: none;\n font-size: 14px;\n line-height: 1.4;\n }\n\n #gif_modal {\n display: none;\n background-color: #ffffff;\n padding: 4px;\n width: 400px;\n height: 256px;\n border-radius: 4px;\n position: relative;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n cursor: default;\n }\n\n #gif_image {\n object-fit: contain;\n width: 100%;\n height: 100%;\n }\n\n #close_modal {\n position: absolute;\n width: 24px;\n height: 24px;\n top: 8px;\n right: 8px;\n background: rgba(238, 238, 238, 0.8);\n text-align: center;\n line-height: 20px;\n border-radius: 4px;\n color: #000000;\n font-size: 22px;\n cursor: pointer;\n }\n `\n}\n","import { StorageManager, $ct } from '../util/storage'\nimport { isObject } from '../util/datatypes'\nimport {\n PUSH_SUBSCRIPTION_DATA\n} from '../util/constants'\nimport {\n urlBase64ToUint8Array\n} from '../util/encoder'\nimport { enablePush } from './webPushPrompt/prompt'\n\nexport default class NotificationHandler extends Array {\n #oldValues\n #logger\n #request\n #account\n #wizAlertJSPath\n #fcmPublicKey\n\n constructor ({\n logger,\n session,\n request,\n account\n }, values) {\n super()\n this.#wizAlertJSPath = 'https://d2r1yp2w7bby2u.cloudfront.net/js/wzrk_dialog.min.js'\n this.#fcmPublicKey = null\n this.#oldValues = values\n this.#logger = logger\n this.#request = request\n this.#account = account\n }\n\n push (...displayArgs) {\n this.#setUpWebPush(displayArgs)\n return 0\n }\n\n enable (options = {}) {\n const { swPath } = options\n enablePush(this.#logger, this.#account, this.#request, swPath)\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#setUpWebPush(this.#oldValues)\n }\n this.#oldValues = null\n }\n\n #setUpWebPush (displayArgs) {\n if ($ct.webPushEnabled && displayArgs.length > 0) {\n this.#handleNotificationRegistration(displayArgs)\n } else if ($ct.webPushEnabled == null && displayArgs.length > 0) {\n $ct.notifApi.notifEnabledFromApi = true\n $ct.notifApi.displayArgs = displayArgs.slice()\n } else if ($ct.webPushEnabled === false && displayArgs.length > 0) {\n this.#logger.error('Make sure push notifications are fully enabled and integrated')\n }\n }\n\n setUpWebPushNotifications (subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsServiceUrl) {\n if (navigator.userAgent.indexOf('Chrome') !== -1 || navigator.userAgent.indexOf('Firefox') !== -1) {\n this.#setUpChromeFirefoxNotifications(subscriptionCallback, serviceWorkerPath)\n } else if (navigator.userAgent.indexOf('Safari') !== -1) {\n this.#setUpSafariNotifications(subscriptionCallback, apnsWebPushId, apnsServiceUrl)\n }\n }\n\n setApplicationServerKey (applicationServerKey) {\n this.#fcmPublicKey = applicationServerKey\n }\n\n #setUpSafariNotifications (subscriptionCallback, apnsWebPushId, apnsServiceUrl) {\n // ensure that proper arguments are passed\n if (typeof apnsWebPushId === 'undefined') {\n this.#logger.error('Ensure that APNS Web Push ID is supplied')\n }\n if (typeof apnsServiceUrl === 'undefined') {\n this.#logger.error('Ensure that APNS Web Push service path is supplied')\n }\n if ('safari' in window && 'pushNotification' in window.safari) {\n window.safari.pushNotification.requestPermission(\n apnsServiceUrl,\n apnsWebPushId, {}, (subscription) => {\n if (subscription.permission === 'granted') {\n const subscriptionData = JSON.parse(JSON.stringify(subscription))\n subscriptionData.endpoint = subscription.deviceToken\n subscriptionData.browser = 'Safari'\n StorageManager.saveToLSorCookie(PUSH_SUBSCRIPTION_DATA, subscriptionData)\n\n this.#request.registerToken(subscriptionData)\n this.#logger.info('Safari Web Push registered. Device Token: ' + subscription.deviceToken)\n } else if (subscription.permission === 'denied') {\n this.#logger.info('Error subscribing to Safari web push')\n }\n })\n }\n }\n\n /**\n * Sets up a service worker for WebPush(chrome/Firefox) push notifications and sends the data to LC\n */\n #setUpChromeFirefoxNotifications (subscriptionCallback, serviceWorkerPath) {\n let registrationScope = ''\n\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.register(serviceWorkerPath).then((registration) => {\n if (typeof __wzrk_account_id !== 'undefined') { // eslint-disable-line\n // shopify accounts , since the service worker is not at root, serviceWorker.ready is never resolved.\n // hence add a timeout and hope serviceWroker is ready within that time.\n return new Promise(resolve => setTimeout(() => resolve(registration), 5000))\n }\n registrationScope = registration.scope\n\n // IF SERVICE WORKER IS AT ROOT, RETURN THE READY PROMISE\n // ELSE IF CHROME RETURN PROMISE AFTER 5 SECONDS\n // OR getRegistrations PROMISE IF ITS FIREFOX\n const rootDirRegex = /^(\\.?)(\\/?)([^/]*).js$/\n const isServiceWorkerAtRoot = rootDirRegex.test(serviceWorkerPath)\n if (isServiceWorkerAtRoot) {\n return navigator.serviceWorker.ready\n } else {\n if (navigator.userAgent.indexOf('Chrome') !== -1) {\n return new Promise(resolve => setTimeout(() => resolve(registration), 5000))\n } else {\n return navigator.serviceWorker.getRegistrations()\n }\n }\n }).then((serviceWorkerRegistration) => {\n // ITS AN ARRAY IN CASE OF FIREFOX, SO USE THE REGISTRATION WITH PROPER SCOPE\n if (navigator.userAgent.indexOf('Firefox') !== -1 && Array.isArray(serviceWorkerRegistration)) {\n serviceWorkerRegistration = serviceWorkerRegistration.filter((i) => i.scope === registrationScope)[0]\n }\n const subscribeObj = { userVisibleOnly: true }\n\n if (this.#fcmPublicKey != null) {\n subscribeObj.applicationServerKey = urlBase64ToUint8Array(this.#fcmPublicKey)\n }\n\n serviceWorkerRegistration.pushManager.subscribe(subscribeObj)\n .then((subscription) => {\n this.#logger.info('Service Worker registered. Endpoint: ' + subscription.endpoint)\n\n // convert the subscription keys to strings; this sets it up nicely for pushing to LC\n const subscriptionData = JSON.parse(JSON.stringify(subscription))\n\n // remove the common chrome/firefox endpoint at the beginning of the token\n if (navigator.userAgent.indexOf('Chrome') !== -1) {\n subscriptionData.endpoint = subscriptionData.endpoint.split('/').pop()\n subscriptionData.browser = 'Chrome'\n } else if (navigator.userAgent.indexOf('Firefox') !== -1) {\n subscriptionData.endpoint = subscriptionData.endpoint.split('/').pop()\n subscriptionData.browser = 'Firefox'\n }\n StorageManager.saveToLSorCookie(PUSH_SUBSCRIPTION_DATA, subscriptionData)\n this.#request.registerToken(subscriptionData)\n\n if (typeof subscriptionCallback !== 'undefined' && typeof subscriptionCallback === 'function') {\n subscriptionCallback()\n }\n const existingBellWrapper = document.getElementById('bell_wrapper')\n if (existingBellWrapper) {\n existingBellWrapper.parentNode.removeChild(existingBellWrapper)\n }\n }).catch((error) => {\n // unsubscribe from webpush if error\n serviceWorkerRegistration.pushManager.getSubscription().then((subscription) => {\n if (subscription !== null) {\n subscription.unsubscribe().then((successful) => {\n // You've successfully unsubscribed\n this.#logger.info('Unsubscription successful')\n window.clevertap.notifications.push({\n skipDialog: true\n })\n }).catch((e) => {\n // Unsubscription failed\n this.#logger.error('Error unsubscribing: ' + e)\n })\n }\n })\n this.#logger.error('Error subscribing: ' + error)\n })\n }).catch((err) => {\n this.#logger.error('error registering service worker: ' + err)\n })\n }\n }\n\n #addWizAlertJS () {\n const scriptTag = document.createElement('script')\n scriptTag.setAttribute('type', 'text/javascript')\n scriptTag.setAttribute('id', 'wzrk-alert-js')\n scriptTag.setAttribute('src', this.#wizAlertJSPath)\n\n // add the script tag to the end of the body\n document.getElementsByTagName('body')[0].appendChild(scriptTag)\n\n return scriptTag\n }\n\n #removeWizAlertJS () {\n const scriptTag = document.getElementById('wzrk-alert-js')\n scriptTag.parentNode.removeChild(scriptTag)\n }\n\n #handleNotificationRegistration (displayArgs) {\n // make sure everything is specified\n let titleText\n let bodyText\n let okButtonText\n let rejectButtonText\n let okButtonColor\n let skipDialog\n let askAgainTimeInSeconds\n let okCallback\n let rejectCallback\n let subscriptionCallback\n let serviceWorkerPath\n let httpsPopupPath\n let httpsIframePath\n let apnsWebPushId\n let apnsWebPushServiceUrl\n\n if (displayArgs.length === 1) {\n if (isObject(displayArgs[0])) {\n const notifObj = displayArgs[0]\n titleText = notifObj.titleText\n bodyText = notifObj.bodyText\n okButtonText = notifObj.okButtonText\n rejectButtonText = notifObj.rejectButtonText\n okButtonColor = notifObj.okButtonColor\n skipDialog = notifObj.skipDialog\n askAgainTimeInSeconds = notifObj.askAgainTimeInSeconds\n okCallback = notifObj.okCallback\n rejectCallback = notifObj.rejectCallback\n subscriptionCallback = notifObj.subscriptionCallback\n serviceWorkerPath = notifObj.serviceWorkerPath\n httpsPopupPath = notifObj.httpsPopupPath\n httpsIframePath = notifObj.httpsIframePath\n apnsWebPushId = notifObj.apnsWebPushId\n apnsWebPushServiceUrl = notifObj.apnsWebPushServiceUrl\n }\n } else {\n titleText = displayArgs[0]\n bodyText = displayArgs[1]\n okButtonText = displayArgs[2]\n rejectButtonText = displayArgs[3]\n okButtonColor = displayArgs[4]\n skipDialog = displayArgs[5]\n askAgainTimeInSeconds = displayArgs[6]\n }\n\n if (skipDialog == null) {\n skipDialog = false\n }\n\n if (serviceWorkerPath == null) {\n serviceWorkerPath = '/clevertap_sw.js'\n }\n\n // ensure that the browser supports notifications\n if (typeof navigator.serviceWorker === 'undefined') {\n return\n }\n\n const isHTTP = httpsPopupPath != null && httpsIframePath != null\n\n // make sure the site is on https for chrome notifications\n if (window.location.protocol !== 'https:' && document.location.hostname !== 'localhost' && !isHTTP) {\n this.#logger.error('Make sure you are https or localhost to register for notifications')\n return\n }\n\n // right now, we only support Chrome V50 & higher & Firefox\n if (navigator.userAgent.indexOf('Chrome') !== -1) {\n const chromeAgent = navigator.userAgent.match(/Chrome\\/(\\d+)/)\n if (chromeAgent == null || parseInt(chromeAgent[1], 10) < 50) { return }\n } else if (navigator.userAgent.indexOf('Firefox') !== -1) {\n const firefoxAgent = navigator.userAgent.match(/Firefox\\/(\\d+)/)\n if (firefoxAgent == null || parseInt(firefoxAgent[1], 10) < 50) { return }\n } else if (navigator.userAgent.indexOf('Safari') !== -1) {\n const safariAgent = navigator.userAgent.match(/Safari\\/(\\d+)/)\n if (safariAgent == null || parseInt(safariAgent[1], 10) < 50) { return }\n } else {\n return\n }\n\n // we check for the cookie in setUpChromeNotifications() the tokens may have changed\n\n if (!isHTTP) {\n if (Notification == null) {\n return\n }\n // handle migrations from other services -> chrome notifications may have already been asked for before\n if (Notification.permission === 'granted') {\n // skip the dialog and register\n this.setUpWebPushNotifications(subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsWebPushServiceUrl)\n return\n } else if (Notification.permission === 'denied') {\n // we've lost this profile :'(\n return\n }\n\n if (skipDialog) {\n this.setUpWebPushNotifications(subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsWebPushServiceUrl)\n return\n }\n }\n\n // make sure the right parameters are passed\n if (!titleText || !bodyText || !okButtonText || !rejectButtonText) {\n this.#logger.error('Missing input parameters; please specify title, body, ok button and cancel button text')\n return\n }\n\n // make sure okButtonColor is formatted properly\n if (okButtonColor == null || !okButtonColor.match(/^#[a-f\\d]{6}$/i)) {\n okButtonColor = '#f28046' // default color for positive button\n }\n\n // make sure the user isn't asked for notifications more than askAgainTimeInSeconds\n const now = new Date().getTime() / 1000\n if ((StorageManager.getMetaProp('notif_last_time')) == null) {\n StorageManager.setMetaProp('notif_last_time', now)\n } else {\n if (askAgainTimeInSeconds == null) {\n // 7 days by default\n askAgainTimeInSeconds = 7 * 24 * 60 * 60\n }\n\n if (now - StorageManager.getMetaProp('notif_last_time') < askAgainTimeInSeconds) {\n return\n } else {\n // continue asking\n StorageManager.setMetaProp('notif_last_time', now)\n }\n }\n\n if (isHTTP) {\n // add the https iframe\n const httpsIframe = document.createElement('iframe')\n httpsIframe.setAttribute('style', 'display:none;')\n httpsIframe.setAttribute('src', httpsIframePath)\n document.body.appendChild(httpsIframe)\n window.addEventListener('message', (event) => {\n if (event.data != null) {\n let obj = {}\n try {\n obj = JSON.parse(event.data)\n } catch (e) {\n // not a call from our iframe\n return\n }\n if (obj.state != null) {\n if (obj.from === 'ct' && obj.state === 'not') {\n this.#addWizAlertJS().onload = () => {\n // create our wizrocket popup\n window.wzrkPermissionPopup.wizAlert({\n title: titleText,\n body: bodyText,\n confirmButtonText: okButtonText,\n confirmButtonColor: okButtonColor,\n rejectButtonText: rejectButtonText\n }, (enabled) => { // callback function\n if (enabled) {\n // the user accepted on the dialog box\n if (typeof okCallback === 'function') {\n okCallback()\n }\n // redirect to popup.html\n window.open(httpsPopupPath)\n } else {\n if (typeof rejectCallback === 'function') {\n rejectCallback()\n }\n }\n this.#removeWizAlertJS()\n })\n }\n }\n }\n }\n }, false)\n } else {\n this.#addWizAlertJS().onload = () => {\n // create our wizrocket popup\n window.wzrkPermissionPopup.wizAlert({\n title: titleText,\n body: bodyText,\n confirmButtonText: okButtonText,\n confirmButtonColor: okButtonColor,\n rejectButtonText: rejectButtonText\n }, (enabled) => { // callback function\n if (enabled) {\n // the user accepted on the dialog box\n if (typeof okCallback === 'function') {\n okCallback()\n }\n this.setUpWebPushNotifications(subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsWebPushServiceUrl)\n } else {\n if (typeof rejectCallback === 'function') {\n rejectCallback()\n }\n }\n this.#removeWizAlertJS()\n })\n }\n }\n }\n\n _enableWebPush (enabled, applicationServerKey) {\n $ct.webPushEnabled = enabled\n if (applicationServerKey != null) {\n this.setApplicationServerKey(applicationServerKey)\n }\n if ($ct.webPushEnabled && $ct.notifApi.notifEnabledFromApi) {\n this.#handleNotificationRegistration($ct.notifApi.displayArgs)\n } else if (!$ct.webPushEnabled && $ct.notifApi.notifEnabledFromApi) {\n this.#logger.error('Ensure that web push notifications are fully enabled and integrated before requesting them')\n }\n }\n}\n","export const BELL_BASE64 = 'PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMi40OTYyIDUuMjQzOTVDMTIuODM5MSA1LjAzMzE3IDEzLjI4NDcgNS4xNDY4OSAxMy40OTczIDUuNDg4NjdDMTMuNzIyMyA1Ljg1MDE4IDEzLjYwMDIgNi4zMjUxOCAxMy4yMzggNi41NDkwMkM3LjM5Mzk5IDEwLjE2MDYgMy41IDE2LjYyNTcgMy41IDI0LjAwMDNDMy41IDM1LjMyMjEgMTIuNjc4MiA0NC41MDAzIDI0IDQ0LjUwM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c2IDQwLjkzOCAzOC4wOTk1IDQwLjEyMzMgMzguMDk5NUg0MC4xMjEyVjI5LjI1ODJDNDAuMTIxMiAyNS41OTQ2IDM3LjQ1MzMgMjIuNTU0MiAzMy45NTQzIDIxLjk3MzZMMzMuOTU0NCAyMS45NTM0QzMzLjk1NDQgMjAuODc0NiAzMy4wNzc1IDIwIDMxLjk5ODYgMjBaIiBmaWxsPSJ3aGl0ZSIvPgo8cmVjdCBvcGFjaXR5PSIwLjUiIHg9IjcuNSIgeT0iNy41IiB3aWR0aD0iNDkiIGhlaWdodD0iNDkiIHJ4PSIyNC41IiBzdHJva2U9IndoaXRlIi8+CjxyZWN0IG9wYWNpdHk9IjAuMyIgeD0iNC41IiB5PSI0LjUiIHdpZHRoPSI1NSIgaGVpZ2h0PSI1NSIgcng9IjI3LjUiIHN0cm9rZT0id2hpdGUiLz4KPHJlY3Qgb3BhY2l0eT0iMC44IiB4PSIxMC41IiB5PSIxMC41IiB3aWR0aD0iNDMiIGhlaWdodD0iNDMiIHJ4PSIyMS41IiBzdHJva2U9IndoaXRlIi8+Cjwvc3ZnPgo='\n","import { getBellIconStyles, getBoxPromptStyles } from './promptStyles.js'\nimport { WEBPUSH_CONFIG } from '../../util/constants.js'\nimport { StorageManager, $ct } from '../../util/storage.js'\nimport NotificationHandler from '../notification.js'\nimport { BELL_BASE64, PROMPT_BELL_BASE64 } from './promptConstants.js'\n\nlet appServerKey = null\nlet swPath = '/clevertap_sw.js'\nlet notificationHandler = null\n\nexport const processWebPushConfig = (webPushConfig, logger, request) => {\n const _pushConfig = StorageManager.readFromLSorCookie(WEBPUSH_CONFIG) || {}\n\n const updatePushConfig = () => {\n $ct.pushConfig = webPushConfig\n StorageManager.saveToLSorCookie(WEBPUSH_CONFIG, webPushConfig)\n }\n\n if (webPushConfig.isPreview) {\n updatePushConfig()\n enablePush(logger, null, request)\n } else if (JSON.stringify(_pushConfig) !== JSON.stringify(webPushConfig)) {\n updatePushConfig()\n }\n}\n\nexport const enablePush = (logger, account, request, customSwPath) => {\n const _pushConfig = StorageManager.readFromLSorCookie(WEBPUSH_CONFIG) || {}\n $ct.pushConfig = _pushConfig\n if (!$ct.pushConfig) {\n logger.error('Web Push config data not present')\n return\n }\n\n if (customSwPath) { swPath = customSwPath }\n\n notificationHandler = new NotificationHandler({ logger, session: {}, request, account })\n const { showBox, boxType, showBellIcon, isPreview } = $ct.pushConfig\n\n if (isPreview) {\n if ($ct.pushConfig.boxConfig) createNotificationBox($ct.pushConfig)\n if ($ct.pushConfig.bellIconConfig) createBellIcon($ct.pushConfig)\n } else {\n if (showBox && boxType === 'new') createNotificationBox($ct.pushConfig)\n if (showBellIcon) createBellIcon($ct.pushConfig)\n }\n}\n\nconst createElementWithAttributes = (tag, attributes = {}) => {\n const element = document.createElement(tag)\n Object.entries(attributes).forEach(([key, value]) => {\n element[key] = value\n })\n return element\n}\n\nexport const createNotificationBox = (configData) => {\n if (document.getElementById('pnWrapper')) return\n\n const { boxConfig: { content, style } } = configData\n\n // Create the wrapper div\n const wrapper = createElementWithAttributes('div', { id: 'pnWrapper' })\n const overlayDiv = createElementWithAttributes('div', { id: 'pnOverlay' })\n const pnCard = createElementWithAttributes('div', { id: 'pnCard' })\n\n const iconTitleDescWrapper = createElementWithAttributes('div', { id: 'iconTitleDescWrapper' })\n const iconContainer = createElementWithAttributes('img', {\n id: 'iconContainer',\n src: content.icon.type === 'default' ? `data:image/svg+xml;base64,${PROMPT_BELL_BASE64}` : content.icon.url\n })\n\n iconTitleDescWrapper.appendChild(iconContainer)\n\n const titleDescWrapper = createElementWithAttributes('div', { id: 'titleDescWrapper' })\n titleDescWrapper.appendChild(createElementWithAttributes('div', { id: 'title', textContent: content.title }))\n titleDescWrapper.appendChild(createElementWithAttributes('div', { id: 'description', textContent: content.description }))\n\n iconTitleDescWrapper.appendChild(titleDescWrapper)\n\n const buttonsContainer = createElementWithAttributes('div', { id: 'buttonsContainer' })\n\n const primaryButton = createElementWithAttributes('button', {\n id: 'primaryButton',\n textContent: content.buttons.primaryButtonText\n })\n const secondaryButton = createElementWithAttributes('button', {\n id: 'secondaryButton',\n textContent: content.buttons.secondaryButtonText\n })\n buttonsContainer.appendChild(secondaryButton)\n buttonsContainer.appendChild(primaryButton)\n\n pnCard.appendChild(iconTitleDescWrapper)\n pnCard.appendChild(buttonsContainer)\n\n // Apply styles\n const styleElement = createElementWithAttributes('style', { textContent: getBoxPromptStyles(style) })\n\n wrapper.appendChild(styleElement)\n wrapper.appendChild(pnCard)\n wrapper.appendChild(overlayDiv)\n\n setElementPosition(pnCard, style.card.position)\n\n const now = new Date().getTime() / 1000\n const lastNotifTime = StorageManager.getMetaProp('webpush_last_notif_time')\n const popupFrequency = content.popupFrequency || 7 * 24 * 60 * 60\n\n if (!lastNotifTime || now - lastNotifTime >= popupFrequency * 24 * 60 * 60) {\n document.body.appendChild(wrapper)\n if (!configData.isPreview) { addEventListeners(wrapper) }\n }\n}\n\nexport const createBellIcon = (configData) => {\n if (document.getElementById('bell_wrapper') || Notification.permission === 'granted') return\n\n const { bellIconConfig: { content, style } } = configData\n\n const bellWrapper = createElementWithAttributes('div', { id: 'bell_wrapper' })\n const bellIcon = createElementWithAttributes('img', {\n id: 'bell_icon',\n src: content.icon.type === 'default' ? `data:image/svg+xml;base64,${BELL_BASE64}` : content.icon.url\n })\n\n // For playing gif\n const gifModal = createElementWithAttributes('div', { id: 'gif_modal', style: 'display: none;' })\n const gifImage = createElementWithAttributes('img', {\n id: 'gif_image',\n src: 'https://d2r1yp2w7bby2u.cloudfront.net/js/permission_grant.gif'\n })\n const closeModal = createElementWithAttributes('div', { id: 'close_modal', innerHTML: '×' })\n\n gifModal.appendChild(gifImage)\n gifModal.appendChild(closeModal)\n\n bellWrapper.appendChild(bellIcon)\n bellWrapper.appendChild(gifModal)\n if (content.hoverText.enabled) {\n const tooltip = createElementWithAttributes('div', {\n id: 'bell_tooltip',\n textContent: content.hoverText.text\n })\n bellWrapper.appendChild(tooltip)\n }\n\n setElementPosition(bellWrapper, style.card.position)\n // Apply styles\n const styleElement = createElementWithAttributes('style', { textContent: getBellIconStyles(style) })\n\n document.head.appendChild(styleElement)\n document.body.appendChild(bellWrapper)\n\n if (!configData.isPreview) {\n addBellEventListeners(bellWrapper)\n }\n return bellWrapper\n}\n\nexport const setServerKey = (serverKey) => {\n appServerKey = serverKey\n}\n\nexport const addEventListeners = (wrapper) => {\n const primaryButton = wrapper.querySelector('#primaryButton')\n const secondaryButton = wrapper.querySelector('#secondaryButton')\n\n const removeWrapper = () => wrapper.parentNode?.removeChild(wrapper)\n\n primaryButton.addEventListener('click', () => {\n removeWrapper()\n notificationHandler.setApplicationServerKey(appServerKey)\n notificationHandler.setUpWebPushNotifications(null, swPath, null, null)\n })\n\n secondaryButton.addEventListener('click', () => {\n StorageManager.setMetaProp('webpush_last_notif_time', Date.now() / 1000)\n removeWrapper()\n })\n}\n\nexport const addBellEventListeners = (bellWrapper) => {\n const bellIcon = bellWrapper.querySelector('#bell_icon')\n bellIcon.addEventListener('click', () => {\n if (Notification.permission === 'denied') {\n toggleGifModal(bellWrapper)\n } else {\n notificationHandler.setApplicationServerKey(appServerKey)\n notificationHandler.setUpWebPushNotifications(null, swPath, null, null)\n if (Notification.permission === 'granted') {\n bellWrapper.remove()\n }\n }\n })\n bellIcon.addEventListener('mouseenter', () => displayTooltip(bellWrapper))\n bellIcon.addEventListener('mouseleave', () => clearTooltip(bellWrapper))\n bellWrapper.querySelector('#close_modal').addEventListener('click', () => toggleGifModal(bellWrapper))\n}\n\nexport const setElementPosition = (element, position) => {\n Object.assign(element.style, {\n inset: 'auto',\n transform: 'none'\n })\n\n const positions = {\n 'Top Right': { inset: '16px 16px auto auto' },\n 'Top Left': { inset: '16px auto auto 16px' },\n 'Bottom Right': { inset: 'auto 16px 16px auto' },\n 'Bottom Left': { inset: 'auto auto 16px 16px' },\n Center: { inset: '50%', transform: 'translate(-50%, -50%)' },\n Top: { inset: '16px auto auto 50%', transform: 'translateX(-50%)' },\n Bottom: { inset: 'auto auto 16px 50%', transform: 'translateX(-50%)' }\n }\n\n Object.assign(element.style, positions[position] || positions['top-right'])\n}\n\nconst displayTooltip = (bellWrapper) => {\n const gifModal = bellWrapper.querySelector('#gif_modal')\n if (gifModal.style.display === 'flex') {\n return\n }\n const tooltip = bellWrapper.querySelector('#bell_tooltip')\n if (tooltip) {\n tooltip.style.display = 'flex'\n }\n\n const bellIcon = bellWrapper.querySelector('#bell_icon')\n const bellRect = bellIcon.getBoundingClientRect()\n var midX = window.innerWidth / 2\n var midY = window.innerHeight / 2\n bellWrapper.style['flex-direction'] = bellRect.y > midY ? 'column-reverse' : 'column'\n bellWrapper.style['align-items'] = bellRect.x > midX ? 'flex-end' : 'flex-start'\n}\n\nconst clearTooltip = (bellWrapper) => {\n const tooltip = bellWrapper.querySelector('#bell_tooltip')\n if (tooltip) {\n tooltip.style.display = 'none'\n }\n}\n\nconst toggleGifModal = (bellWrapper) => {\n clearTooltip(bellWrapper)\n const gifModal = bellWrapper.querySelector('#gif_modal')\n gifModal.style.display = gifModal.style.display === 'none' ? 'flex' : 'none'\n}\n","import {\n addToLocalProfileMap,\n arp,\n getCampaignObject,\n saveCampaignObject\n} from './clevertap'\n\nimport {\n CAMP_COOKIE_NAME,\n DISPLAY,\n GLOBAL,\n EV_COOKIE,\n NOTIFICATION_CLICKED,\n WZRK_PREFIX,\n WZRK_ID\n} from './constants'\n\nimport {\n getNow,\n getToday\n} from './datetime'\n\nimport { StorageManager, $ct } from './storage'\nimport RequestDispatcher from './requestDispatcher'\nimport { CTWebPopupImageOnly } from './web-popupImageonly/popupImageonly'\nimport { checkAndRegisterWebInboxElements, initializeWebInbox, processWebInboxSettings, hasWebInboxSettingsInLS, processInboxNotifs } from '../modules/web-inbox/helper'\nimport { renderVisualBuilder } from '../modules/visualBuilder/pageBuilder'\nimport { handleKVpairCampaign, renderPersonalisationBanner, renderPersonalisationCarousel } from './campaignRender/nativeDisplay'\nimport { appendScriptForCustomEvent, getCookieParams, incrementImpression, invokeExternalJs, mergeEventMap, setupClickEvent, staleDataUpdate } from './campaignRender/utilities'\nimport { renderPopUpImageOnly } from './campaignRender/webPopup'\nimport { processWebPushConfig } from '../modules/webPushPrompt/prompt'\n\nconst _tr = (msg, {\n device,\n session,\n request,\n logger\n}) => {\n const _device = device\n const _session = session\n const _request = request\n const _logger = logger\n let _wizCounter = 0\n // Campaign House keeping\n const doCampHouseKeeping = (targetingMsgJson) => {\n const campaignId = targetingMsgJson.wzrk_id.split('_')[0]\n const today = getToday()\n\n const incrCount = (obj, campaignId, excludeFromFreqCaps) => {\n let currentCount = 0\n let totalCount = 0\n if (obj[campaignId] != null) {\n currentCount = obj[campaignId]\n }\n currentCount++\n if (obj.tc != null) {\n totalCount = obj.tc\n }\n // if exclude from caps then dont add to total counts\n if (excludeFromFreqCaps < 0) {\n totalCount++\n }\n\n obj.tc = totalCount\n obj[campaignId] = currentCount\n }\n\n if (StorageManager._isLocalStorageSupported()) {\n delete sessionStorage[CAMP_COOKIE_NAME]\n var campTypeObj = {}\n const campObj = getCampaignObject()\n if (targetingMsgJson.display.wtarget_type === 3 && campObj.hasOwnProperty('wi')) {\n campTypeObj = campObj.wi\n } else if ((targetingMsgJson.display.wtarget_type === 0 || targetingMsgJson.display.wtarget_type === 1) && campObj.hasOwnProperty('wp')) {\n campTypeObj = campObj.wp\n } else {\n campTypeObj = {}\n }\n if (campObj.hasOwnProperty('global')) {\n campTypeObj.wp = campObj\n }\n // global session limit. default is 1\n if (targetingMsgJson[DISPLAY].wmc == null) {\n targetingMsgJson[DISPLAY].wmc = 1\n }\n\n // global session limit for web inbox. default is 1\n if (targetingMsgJson[DISPLAY].wimc == null) {\n targetingMsgJson[DISPLAY].wimc = 1\n }\n\n var excludeFromFreqCaps = -1 // efc - Exclude from frequency caps\n let campaignSessionLimit = -1 // mdc - Once per session\n let campaignDailyLimit = -1 // tdc - Once per day\n let campaignTotalLimit = -1 // tlc - Once per user for the duration of campaign\n let totalDailyLimit = -1\n let totalSessionLimit = -1 // wmc - Web Popup Global Session Limit\n let totalInboxSessionLimit = -1 // wimc - Web Inbox Global Session Limit\n\n if (targetingMsgJson[DISPLAY].efc != null) { // exclude from frequency cap\n excludeFromFreqCaps = parseInt(targetingMsgJson[DISPLAY].efc, 10)\n }\n if (targetingMsgJson[DISPLAY].mdc != null) { // Campaign Session Limit\n campaignSessionLimit = parseInt(targetingMsgJson[DISPLAY].mdc, 10)\n }\n if (targetingMsgJson[DISPLAY].tdc != null) { // No of web popups in a day per campaign\n campaignDailyLimit = parseInt(targetingMsgJson[DISPLAY].tdc, 10)\n }\n if (targetingMsgJson[DISPLAY].tlc != null) { // Total lifetime count\n campaignTotalLimit = parseInt(targetingMsgJson[DISPLAY].tlc, 10)\n }\n if (targetingMsgJson[DISPLAY].wmp != null) { // No of campaigns per day\n totalDailyLimit = parseInt(targetingMsgJson[DISPLAY].wmp, 10)\n }\n if (targetingMsgJson[DISPLAY].wmc != null) { // No of campaigns per session\n totalSessionLimit = parseInt(targetingMsgJson[DISPLAY].wmc, 10)\n }\n\n if (targetingMsgJson[DISPLAY].wimc != null) { // No of inbox campaigns per session\n totalInboxSessionLimit = parseInt(targetingMsgJson[DISPLAY].wimc, 10)\n }\n // session level capping\n var sessionObj = campTypeObj[_session.sessionId]\n if (sessionObj) {\n const campaignSessionCount = sessionObj[campaignId]\n const totalSessionCount = sessionObj.tc\n // dnd\n if (campaignSessionCount === 'dnd' && !$ct.dismissSpamControl) {\n return false\n }\n\n if (targetingMsgJson[DISPLAY].wtarget_type === 3) {\n // Inbox session\n if (totalInboxSessionLimit > 0 && totalSessionCount >= totalInboxSessionLimit && excludeFromFreqCaps < 0) {\n return false\n }\n } else {\n // session\n if (totalSessionLimit > 0 && totalSessionCount >= totalSessionLimit && excludeFromFreqCaps < 0) {\n return false\n }\n }\n\n // campaign session\n if (campaignSessionLimit > 0 && campaignSessionCount >= campaignSessionLimit) {\n return false\n }\n } else {\n sessionObj = {}\n campTypeObj[_session.sessionId] = sessionObj\n }\n\n // daily level capping\n var dailyObj = campTypeObj[today]\n if (dailyObj != null) {\n const campaignDailyCount = dailyObj[campaignId]\n const totalDailyCount = dailyObj.tc\n // daily\n if (totalDailyLimit > 0 && totalDailyCount >= totalDailyLimit && excludeFromFreqCaps < 0) {\n return false\n }\n // campaign daily\n if (campaignDailyLimit > 0 && campaignDailyCount >= campaignDailyLimit) {\n return false\n }\n } else {\n dailyObj = {}\n campTypeObj[today] = dailyObj\n }\n\n var globalObj = campTypeObj[GLOBAL]\n if (globalObj != null) {\n const campaignTotalCount = globalObj[campaignId]\n // campaign total\n if (campaignTotalLimit > 0 && campaignTotalCount >= campaignTotalLimit) {\n return false\n }\n } else {\n globalObj = {}\n campTypeObj[GLOBAL] = globalObj\n }\n }\n // delay\n const displayObj = targetingMsgJson.display\n if (displayObj.delay != null && displayObj.delay > 0) {\n const delay = displayObj.delay\n displayObj.delay = 0\n setTimeout(_tr, delay * 1000, msg, {\n device: _device,\n session: _session,\n request: _request,\n logger: _logger\n })\n return false\n }\n\n incrCount(sessionObj, campaignId, excludeFromFreqCaps)\n incrCount(dailyObj, campaignId, excludeFromFreqCaps)\n incrCount(globalObj, campaignId, excludeFromFreqCaps)\n\n let campKey = 'wp'\n if (targetingMsgJson[DISPLAY].wtarget_type === 3) {\n campKey = 'wi'\n }\n // get ride of stale sessions and day entries\n const newCampObj = {}\n newCampObj[_session.sessionId] = sessionObj\n newCampObj[today] = dailyObj\n newCampObj[GLOBAL] = globalObj\n saveCampaignObject({ [campKey]: newCampObj })\n }\n\n const setupClickUrl = (onClick, targetingMsgJson, contentDiv, divId, isLegacy) => {\n incrementImpression(targetingMsgJson, _request)\n setupClickEvent(onClick, targetingMsgJson, contentDiv, divId, isLegacy, _device, _session)\n }\n\n const handleImageOnlyPopup = (targetingMsgJson) => {\n const divId = 'wzrkImageOnlyDiv'\n if (doCampHouseKeeping(targetingMsgJson) === false) {\n return\n }\n if ($ct.dismissSpamControl && document.getElementById(divId) != null) {\n const element = document.getElementById(divId)\n element.remove()\n }\n // ImageOnly campaign and Interstitial/Exit Intent shouldn't coexist\n if (document.getElementById(divId) != null || document.getElementById('intentPreview') != null) {\n return\n }\n const msgDiv = document.createElement('div')\n msgDiv.id = divId\n document.body.appendChild(msgDiv)\n if (customElements.get('ct-web-popup-imageonly') === undefined) {\n customElements.define('ct-web-popup-imageonly', CTWebPopupImageOnly)\n }\n return renderPopUpImageOnly(targetingMsgJson, _session)\n }\n\n const isExistingCampaign = (campaignId) => {\n const testIframe = document.getElementById('wiz-iframe-intent') || document.getElementById('wiz-iframe')\n if (testIframe) {\n const iframeDocument = testIframe.contentDocument || testIframe.contentWindow.document\n return iframeDocument.documentElement.innerHTML.includes(campaignId)\n }\n return false\n }\n\n const createTemplate = (targetingMsgJson, isExitIntent) => {\n const campaignId = targetingMsgJson.wzrk_id.split('_')[0]\n const displayObj = targetingMsgJson.display\n\n if (displayObj.layout === 1) { // Handling Web Exit Intent\n return showExitIntent(undefined, targetingMsgJson)\n }\n if (displayObj.layout === 3) { // Handling Web Popup Image Only\n handleImageOnlyPopup(targetingMsgJson)\n return\n }\n\n if (doCampHouseKeeping(targetingMsgJson) === false) {\n return\n }\n\n const divId = 'wizParDiv' + displayObj.layout\n const opacityDivId = 'intentOpacityDiv' + displayObj.layout\n\n if ($ct.dismissSpamControl && document.getElementById(divId) != null) {\n const element = document.getElementById(divId)\n const opacityElement = document.getElementById(opacityDivId)\n if (element) {\n element.remove()\n }\n if (opacityElement) {\n opacityElement.remove()\n }\n }\n if (isExistingCampaign(campaignId)) return\n\n if (document.getElementById(divId) != null) {\n return\n }\n\n $ct.campaignDivMap[campaignId] = divId\n const isBanner = displayObj.layout === 2\n if (isExitIntent) {\n const opacityDiv = document.createElement('div')\n opacityDiv.id = opacityDivId\n const opacity = targetingMsgJson.display.opacity || 0.7\n const rgbaColor = `rgba(0,0,0,${opacity})`\n opacityDiv.setAttribute('style', `position: fixed;top: 0;bottom: 0;left: 0;width: 100%;height: 100%;z-index: 2147483646;background: ${rgbaColor};`)\n document.body.appendChild(opacityDiv)\n }\n const msgDiv = document.createElement('div')\n msgDiv.id = divId\n const viewHeight = window.innerHeight\n const viewWidth = window.innerWidth\n let legacy = false\n\n if (!isBanner) {\n const marginBottom = viewHeight * 5 / 100\n var contentHeight = 10\n let right = viewWidth * 5 / 100\n let bottomPosition = contentHeight + marginBottom\n let width = viewWidth * 30 / 100 + 20\n let widthPerct = 'width:30%;'\n // for small devices - mobile phones\n if ((/mobile/i.test(navigator.userAgent) || (/mini/i.test(navigator.userAgent))) && /iPad/i.test(navigator.userAgent) === false) {\n width = viewWidth * 85 / 100 + 20\n right = viewWidth * 5 / 100\n bottomPosition = viewHeight * 5 / 100\n widthPerct = 'width:80%;'\n // medium devices - tablets\n } else if ('ontouchstart' in window || (/tablet/i.test(navigator.userAgent))) {\n width = viewWidth * 50 / 100 + 20\n right = viewWidth * 5 / 100\n bottomPosition = viewHeight * 5 / 100\n widthPerct = 'width:50%;'\n }\n // legacy footer notif\n if (displayObj.proto == null) {\n legacy = true\n msgDiv.setAttribute('style', 'display:block;overflow:hidden; bottom:' + bottomPosition + 'px !important;width:' + width + 'px !important;right:' + right + 'px !important;position:fixed;z-index:2147483647;')\n } else {\n msgDiv.setAttribute('style', widthPerct + displayObj.iFrameStyle)\n }\n } else {\n msgDiv.setAttribute('style', displayObj.iFrameStyle)\n }\n document.body.appendChild(msgDiv)\n const iframe = document.createElement('iframe')\n\n const borderRadius = displayObj.br === false ? '0' : '8'\n\n iframe.frameborder = '0px'\n iframe.marginheight = '0px'\n iframe.marginwidth = '0px'\n iframe.scrolling = 'no'\n iframe.id = 'wiz-iframe'\n const onClick = targetingMsgJson.display.onClick\n let pointerCss = ''\n if (onClick !== '' && onClick != null) {\n pointerCss = 'cursor:pointer;'\n }\n if (displayObj.preview && displayObj['custom-editor']) {\n iframe.sandbox = 'allow-scripts allow-popups allow-popups-to-escape-sandbox'\n }\n\n let html\n // direct html\n if (targetingMsgJson.msgContent.type === 1) {\n html = targetingMsgJson.msgContent.html\n html = html.replace(/##campaignId##/g, campaignId)\n html = html.replace(/##campaignId_batchId##/g, targetingMsgJson.wzrk_id)\n } else {\n const css = '' +\n ''\n\n let bgColor, textColor, btnBg, leftTd, btColor\n if (targetingMsgJson.display.theme === 'dark') {\n bgColor = '#2d2d2e'\n textColor = '#eaeaea'\n btnBg = '#353535'\n leftTd = '#353535'\n btColor = '#ffffff'\n } else {\n bgColor = '#ffffff'\n textColor = '#000000'\n leftTd = '#f4f4f4'\n btnBg = '#a5a6a6'\n btColor = '#ffffff'\n }\n const titleText = targetingMsgJson.msgContent.title\n const descriptionText = targetingMsgJson.msgContent.description\n let imageTd = ''\n if (targetingMsgJson.msgContent.imageUrl != null && targetingMsgJson.msgContent.imageUrl !== '') {\n imageTd = \"\"\n }\n const onClickStr = 'parent.$WZRK_WR.closeIframe(' + campaignId + \",'\" + divId + \"');\"\n const title = \"
\" +\n \"×\" +\n \"
\" +\n \"\" +\n // \"\"+\n '' + imageTd + \"
\" +\n \"
\" + titleText + '
'\n const body = \"
\" + descriptionText + '
'\n html = css + title + body\n }\n\n iframe.setAttribute('style', 'z-index: 2147483647; display:block; width: 100% !important; border:0px !important; border-color:none !important;')\n msgDiv.appendChild(iframe)\n\n // Dispatch event for popup box/banner close\n const closeCampaign = new Event('CT_campaign_rendered')\n document.dispatchEvent(closeCampaign)\n\n if (displayObj['custom-editor']) {\n html = appendScriptForCustomEvent(targetingMsgJson, html)\n }\n iframe.srcdoc = html\n\n const adjustIFrameHeight = () => {\n // adjust iframe and body height of html inside correctly\n contentHeight = document.getElementById('wiz-iframe').contentDocument.getElementById('contentDiv').scrollHeight\n if (displayObj['custom-editor'] !== true && !isBanner) {\n contentHeight += 25\n }\n document.getElementById('wiz-iframe').contentDocument.body.style.margin = '0px'\n document.getElementById('wiz-iframe').style.height = contentHeight + 'px'\n }\n\n const ua = navigator.userAgent.toLowerCase()\n if (ua.indexOf('safari') !== -1) {\n if (ua.indexOf('chrome') > -1) {\n iframe.onload = () => {\n adjustIFrameHeight()\n const contentDiv = document.getElementById('wiz-iframe').contentDocument.getElementById('contentDiv')\n setupClickUrl(onClick, targetingMsgJson, contentDiv, divId, legacy)\n }\n } else {\n let inDoc = iframe.contentDocument || iframe.contentWindow\n if (inDoc.document) inDoc = inDoc.document\n // safari iphone 7+ needs this.\n const _timer = setInterval(() => {\n if (inDoc.readyState === 'complete') {\n clearInterval(_timer)\n // adjust iframe and body height of html inside correctly\n adjustIFrameHeight()\n const contentDiv = document.getElementById('wiz-iframe').contentDocument.getElementById('contentDiv')\n setupClickUrl(onClick, targetingMsgJson, contentDiv, divId, legacy)\n }\n }, 300)\n }\n } else {\n iframe.onload = () => {\n // adjust iframe and body height of html inside correctly\n adjustIFrameHeight()\n const contentDiv = document.getElementById('wiz-iframe').contentDocument.getElementById('contentDiv')\n setupClickUrl(onClick, targetingMsgJson, contentDiv, divId, legacy)\n }\n }\n }\n const renderFooterNotification = (targetingMsgJson) => {\n createTemplate(targetingMsgJson, false)\n }\n\n let _callBackCalled = false\n\n const showFooterNotification = (targetingMsgJson) => {\n let onClick = targetingMsgJson.display.onClick\n const displayObj = targetingMsgJson.display\n\n // TODO: Needs wizrocket as a global variable\n if (window.clevertap.hasOwnProperty('notificationCallback') &&\n typeof window.clevertap.notificationCallback !== 'undefined' &&\n typeof window.clevertap.notificationCallback === 'function') {\n const notificationCallback = window.clevertap.notificationCallback\n\n if (!_callBackCalled) {\n const inaObj = {}\n inaObj.msgContent = targetingMsgJson.msgContent\n inaObj.msgId = targetingMsgJson.wzrk_id\n if (targetingMsgJson.wzrk_pivot) {\n inaObj.pivotId = targetingMsgJson.wzrk_pivot\n }\n if (targetingMsgJson.display.kv != null) {\n inaObj.kv = targetingMsgJson.display.kv\n }\n\n window.clevertap.raiseNotificationClicked = () => {\n if (onClick !== '' && onClick != null) {\n const jsFunc = targetingMsgJson.display.jsFunc\n onClick += getCookieParams(_device, _session)\n\n // invoke js function call\n if (jsFunc != null) {\n // track notification clicked event\n RequestDispatcher.fireRequest(onClick)\n invokeExternalJs(jsFunc, targetingMsgJson)\n return\n }\n // pass on the gcookie|page|scookieId for capturing the click event\n if (targetingMsgJson.display.window === 1) {\n window.open(onClick, '_blank')\n } else {\n window.location = onClick\n }\n }\n }\n window.clevertap.raiseNotificationViewed = () => {\n incrementImpression(targetingMsgJson)\n }\n notificationCallback(inaObj)\n _callBackCalled = true\n }\n } else {\n window.clevertap.popupCurrentWzrkId = targetingMsgJson.wzrk_id\n\n if (displayObj.deliveryTrigger) {\n if (displayObj.deliveryTrigger.inactive) {\n triggerByInactivity(targetingMsgJson)\n }\n if (displayObj.deliveryTrigger.scroll) {\n triggerByScroll(targetingMsgJson)\n }\n if (displayObj.deliveryTrigger.isExitIntent) {\n exitintentObj = targetingMsgJson\n window.document.body.onmouseleave = showExitIntent\n }\n // delay\n const delay = displayObj.delay || displayObj.deliveryTrigger.deliveryDelayed\n if (delay != null && delay > 0) {\n setTimeout(() => {\n renderFooterNotification(targetingMsgJson)\n }, delay * 1000)\n }\n } else {\n renderFooterNotification(targetingMsgJson)\n }\n\n if (window.clevertap.hasOwnProperty('popupCallbacks') &&\n typeof window.clevertap.popupCallbacks !== 'undefined' &&\n typeof window.clevertap.popupCallbacks[targetingMsgJson.wzrk_id] === 'function') {\n const popupCallback = window.clevertap.popupCallbacks[targetingMsgJson.wzrk_id]\n\n const inaObj = {}\n inaObj.msgContent = targetingMsgJson.msgContent\n inaObj.msgId = targetingMsgJson.wzrk_id\n\n if (targetingMsgJson.wzrk_pivot) {\n inaObj.pivotId = targetingMsgJson.wzrk_pivot\n }\n\n var msgCTkv = []\n for (var wzrkPrefixKey in targetingMsgJson) {\n // ADD WZRK PREFIX KEY VALUE PAIRS\n if (wzrkPrefixKey.startsWith(WZRK_PREFIX) && wzrkPrefixKey !== WZRK_ID) {\n const wzrkJson = { [wzrkPrefixKey]: targetingMsgJson[wzrkPrefixKey] }\n msgCTkv.push(wzrkJson)\n }\n }\n\n if (msgCTkv.length > 0) {\n inaObj.msgCTkv = msgCTkv\n }\n if (targetingMsgJson.display.kv != null) {\n inaObj.kv = targetingMsgJson.display.kv\n }\n\n // PUBLIC API TO RECORD CLICKED EVENT\n window.clevertap.raisePopupNotificationClicked = (notificationData) => {\n if (!notificationData || !notificationData.msgId) { return }\n\n const eventData = {}\n eventData.type = 'event'\n eventData.evtName = NOTIFICATION_CLICKED\n eventData.evtData = { [WZRK_ID]: notificationData.msgId }\n if (targetingMsgJson.wzrk_pivot) {\n eventData.evtData = { ...eventData.evtData, wzrk_pivot: notificationData.pivotId }\n }\n\n // WZRK PREFIX KEY VALUE PAIRS\n if (notificationData.msgCTkv) {\n for (var wzrkPrefixObj of notificationData.msgCTkv) {\n eventData.evtData = { ...eventData.evtData, ...wzrkPrefixObj }\n }\n }\n\n _request.processEvent(eventData)\n }\n popupCallback(inaObj)\n }\n }\n }\n\n const triggerByInactivity = (targetNotif) => {\n const IDLE_TIME_THRESHOLD = targetNotif.display.deliveryTrigger.inactive * 1000 // Convert to milliseconds\n let idleTimer\n const events = ['mousemove', 'keypress', 'scroll', 'mousedown', 'touchmove', 'click']\n const resetIdleTimer = () => {\n clearTimeout(idleTimer)\n idleTimer = setTimeout(() => {\n renderFooterNotification(targetNotif)\n removeEventListeners()\n }, IDLE_TIME_THRESHOLD)\n }\n const eventHandler = () => {\n resetIdleTimer()\n }\n const setupEventListeners = () => {\n events.forEach(eventType => window.addEventListener(eventType, eventHandler, { passive: true }))\n }\n const removeEventListeners = () => {\n events.forEach(eventType => window.removeEventListener(eventType, eventHandler))\n }\n setupEventListeners()\n resetIdleTimer()\n return removeEventListeners// Return a cleanup function\n }\n\n const triggerByScroll = (targetNotif) => {\n const calculateScrollPercentage = () => {\n const { scrollHeight, clientHeight, scrollTop } = document.documentElement\n return (scrollTop / (scrollHeight - clientHeight)) * 100\n }\n const scrollListener = () => {\n const scrollPercentage = calculateScrollPercentage()\n if (scrollPercentage >= targetNotif.display.deliveryTrigger.scroll) {\n renderFooterNotification(targetNotif)\n window.removeEventListener('scroll', throttledScrollListener)\n }\n }\n const throttle = (func, limit) => {\n let inThrottle = false\n return function (...args) {\n const context = this\n if (!inThrottle) {\n func.apply(context, args)\n inThrottle = true\n setTimeout(() => {\n inThrottle = false\n }, limit)\n }\n }\n }\n const throttledScrollListener = throttle(scrollListener, 200)\n window.addEventListener('scroll', throttledScrollListener, { passive: true })\n return () => window.removeEventListener('scroll', throttledScrollListener)// Return a cleanup function\n }\n\n let exitintentObj\n const showExitIntent = (event, targetObj) => {\n if (event?.clientY > 0) return\n const targetingMsgJson = targetObj || exitintentObj\n\n const campaignId = targetingMsgJson.wzrk_id.split('_')[0]\n const layout = targetingMsgJson.display.layout\n if (isExistingCampaign(campaignId)) return\n\n if (targetingMsgJson.display.wtarget_type === 0 && (layout === 0 || layout === 2 || layout === 3)) {\n createTemplate(targetingMsgJson, true)\n return\n }\n if (doCampHouseKeeping(targetingMsgJson) === false) {\n return\n }\n\n if ($ct.dismissSpamControl && targetingMsgJson.display.wtarget_type === 0) {\n const intentPreview = document.getElementById('intentPreview')\n const intentOpacityDiv = document.getElementById('intentOpacityDiv')\n if (intentPreview && intentOpacityDiv) {\n intentPreview.remove()\n intentOpacityDiv.remove()\n }\n }\n\n // ImageOnly campaign and Interstitial/Exit Intent shouldn't coexist`\n if (document.getElementById('intentPreview') != null || document.getElementById('wzrkImageOnlyDiv') != null) {\n return\n }\n // dont show exit intent on tablet/mobile - only on desktop\n if (targetingMsgJson.display.layout == null &&\n ((/mobile/i.test(navigator.userAgent)) || (/mini/i.test(navigator.userAgent)) || (/iPad/i.test(navigator.userAgent)) ||\n ('ontouchstart' in window) || (/tablet/i.test(navigator.userAgent)))) {\n return\n }\n\n $ct.campaignDivMap[campaignId] = 'intentPreview'\n let legacy = false\n const opacityDiv = document.createElement('div')\n opacityDiv.id = 'intentOpacityDiv'\n const opacity = targetingMsgJson.display.opacity || 0.7\n const rgbaColor = `rgba(0,0,0,${opacity})`\n opacityDiv.setAttribute('style', `position: fixed;top: 0;bottom: 0;left: 0;width: 100%;height: 100%;z-index: 2147483646;background: ${rgbaColor};`)\n document.body.appendChild(opacityDiv)\n\n const msgDiv = document.createElement('div')\n msgDiv.id = 'intentPreview'\n\n if (targetingMsgJson.display.proto == null) {\n legacy = true\n msgDiv.setAttribute('style', 'display:block;overflow:hidden;top:55% !important;left:50% !important;position:fixed;z-index:2147483647;width:600px !important;height:600px !important;margin:-300px 0 0 -300px !important;')\n } else {\n msgDiv.setAttribute('style', targetingMsgJson.display.iFrameStyle)\n }\n document.body.appendChild(msgDiv)\n const iframe = document.createElement('iframe')\n const borderRadius = targetingMsgJson.display.br === false ? '0' : '8'\n iframe.frameborder = '0px'\n iframe.marginheight = '0px'\n iframe.marginwidth = '0px'\n iframe.scrolling = 'no'\n iframe.id = 'wiz-iframe-intent'\n const onClick = targetingMsgJson.display.onClick\n let pointerCss = ''\n if (onClick !== '' && onClick != null) {\n pointerCss = 'cursor:pointer;'\n }\n if (targetingMsgJson.display.preview && targetingMsgJson.display['custom-editor']) {\n iframe.sandbox = 'allow-scripts allow-popups allow-popups-to-escape-sandbox'\n }\n let html\n // direct html\n if (targetingMsgJson.msgContent.type === 1) {\n html = targetingMsgJson.msgContent.html\n html = html.replace(/##campaignId##/g, campaignId)\n html = html.replace(/##campaignId_batchId##/g, targetingMsgJson.wzrk_id)\n } else {\n const css = '' +\n ''\n\n let bgColor, textColor, btnBg, btColor\n if (targetingMsgJson.display.theme === 'dark') {\n bgColor = '#2d2d2e'\n textColor = '#eaeaea'\n btnBg = '#353535'\n btColor = '#ffffff'\n } else {\n bgColor = '#ffffff'\n textColor = '#000000'\n btnBg = '#a5a6a6'\n btColor = '#ffffff'\n }\n const titleText = targetingMsgJson.msgContent.title\n const descriptionText = targetingMsgJson.msgContent.description\n let ctaText = ''\n if (targetingMsgJson.msgContent.ctaText != null && targetingMsgJson.msgContent.ctaText !== '') {\n ctaText = \"'\n }\n\n let imageTd = ''\n if (targetingMsgJson.msgContent.imageUrl != null && targetingMsgJson.msgContent.imageUrl !== '') {\n imageTd = \"
\"
'\n }\n const onClickStr = 'parent.$WZRK_WR.closeIframe(' + campaignId + \",'intentPreview');\"\n const title = \"
\" +\n \"×\" +\n \"
\" +\n \"
\" + titleText + '
'\n const body = \"
\" + descriptionText + '
' + imageTd + ctaText +\n '
'\n html = css + title + body\n }\n iframe.setAttribute('style', 'z-index: 2147483647; display:block; height: 100% !important; width: 100% !important;min-height:80px !important;border:0px !important; border-color:none !important;')\n msgDiv.appendChild(iframe)\n\n // Dispatch event for interstitial/exit intent close\n const closeCampaign = new Event('CT_campaign_rendered')\n document.dispatchEvent(closeCampaign)\n\n if (targetingMsgJson.display['custom-editor']) {\n html = appendScriptForCustomEvent(targetingMsgJson, html)\n }\n iframe.srcdoc = html\n\n iframe.onload = () => {\n const contentDiv = document.getElementById('wiz-iframe-intent').contentDocument.getElementById('contentDiv')\n setupClickUrl(onClick, targetingMsgJson, contentDiv, 'intentPreview', legacy)\n }\n }\n\n if (!document.body) {\n if (_wizCounter < 6) {\n _wizCounter++\n setTimeout(_tr, 1000, msg, {\n device: _device,\n session: _session,\n request: _request,\n logger: _logger\n })\n }\n return\n }\n const processNativeDisplayArr = (arrInAppNotifs) => {\n Object.keys(arrInAppNotifs).map(key => {\n var elementId, id\n if (arrInAppNotifs[key].display.divId) {\n elementId = arrInAppNotifs[key].display.divId\n id = document.getElementById(elementId)\n } else {\n elementId = arrInAppNotifs[key].display.divSelector\n id = document.querySelector(elementId)\n }\n if (id !== null) {\n arrInAppNotifs[key].msgContent.type === 2 ? renderPersonalisationBanner(arrInAppNotifs[key]) : renderPersonalisationCarousel(arrInAppNotifs[key])\n delete arrInAppNotifs[key]\n }\n })\n }\n\n const addLoadListener = (arrInAppNotifs) => {\n window.addEventListener('load', () => {\n let count = 0\n if (count < 20) {\n const t = setInterval(() => {\n processNativeDisplayArr(arrInAppNotifs)\n if (Object.keys(arrInAppNotifs).length === 0 || count === 20) {\n clearInterval(t)\n arrInAppNotifs = {}\n }\n count++\n }, 500)\n }\n })\n }\n\n if (msg.inapp_notifs != null) {\n const arrInAppNotifs = {}\n for (let index = 0; index < msg.inapp_notifs.length; index++) {\n const targetNotif = msg.inapp_notifs[index]\n if (targetNotif.display.wtarget_type == null || targetNotif.display.wtarget_type === 0) {\n showFooterNotification(targetNotif)\n } else if (targetNotif.display.wtarget_type === 1) { // if display['wtarget_type']==1 then exit intent\n exitintentObj = targetNotif\n window.document.body.onmouseleave = showExitIntent\n } else if (targetNotif.display.wtarget_type === 2) { // if display['wtarget_type']==2 then web native display\n if (targetNotif.msgContent.type === 1) {\n handleKVpairCampaign(targetNotif)\n } else if (targetNotif.msgContent.type === 2 || targetNotif.msgContent.type === 3) { // Check for banner and carousel\n const element = targetNotif.display.divId ? document.getElementById(targetNotif.display.divId) : document.querySelector(targetNotif.display.divSelector)\n if (element !== null) {\n targetNotif.msgContent.type === 2 ? renderPersonalisationBanner(targetNotif) : renderPersonalisationCarousel(targetNotif)\n } else {\n arrInAppNotifs[targetNotif.wzrk_id.split('_')[0]] = targetNotif // Add targetNotif to object\n }\n } else if (targetNotif.msgContent.type === 4) {\n renderVisualBuilder(targetNotif, false)\n } else {\n showFooterNotification(targetNotif)\n }\n }\n }\n // Process banner or carousel campaign array\n if (Object.keys(arrInAppNotifs).length) {\n if (document.readyState === 'complete') {\n processNativeDisplayArr(arrInAppNotifs)\n } else {\n addLoadListener(arrInAppNotifs)\n }\n }\n }\n\n const handleInboxNotifications = () => {\n if (msg.inbox_preview) {\n processInboxNotifs(msg)\n return\n }\n if (msg.inbox_notifs) {\n const msgArr = []\n for (let index = 0; index < msg.inbox_notifs.length; index++) {\n if (doCampHouseKeeping(msg.inbox_notifs[index]) !== false) {\n msgArr.push(msg.inbox_notifs[index])\n }\n }\n processInboxNotifs(msgArr)\n }\n }\n\n if (msg.webInboxSetting || msg.inbox_notifs != null) {\n /**\n * When the user visits a website for the 1st time after web inbox channel is setup,\n * we need to initialise the inbox here because the initializeWebInbox method within init will not be executed\n * as we would not have any entry related to webInboxSettings in the LS\n */\n\n if (hasWebInboxSettingsInLS()) {\n checkAndRegisterWebInboxElements()\n }\n if ($ct.inbox === null) {\n msg.webInboxSetting && processWebInboxSettings(msg.webInboxSetting)\n initializeWebInbox(_logger)\n .then(() => {\n handleInboxNotifications()\n })\n .catch(e => {})\n } else {\n handleInboxNotifications()\n }\n }\n\n if (msg.webPushConfig) {\n processWebPushConfig(msg.webPushConfig, logger, request)\n }\n\n if (msg.vars) {\n $ct.variableStore.mergeVariables(msg.vars)\n return\n }\n\n if (StorageManager._isLocalStorageSupported()) {\n try {\n if (msg.evpr != null) {\n const eventsMap = msg.evpr.events\n const profileMap = msg.evpr.profile\n const syncExpiry = msg.evpr.expires_in\n const now = getNow()\n StorageManager.setMetaProp('lsTime', now)\n StorageManager.setMetaProp('exTs', syncExpiry)\n mergeEventMap(eventsMap)\n StorageManager.saveToLSorCookie(EV_COOKIE, $ct.globalEventsMap)\n if ($ct.globalProfileMap == null) {\n addToLocalProfileMap(profileMap, true)\n } else {\n addToLocalProfileMap(profileMap, false)\n }\n }\n if (msg.arp != null) {\n arp(msg.arp)\n }\n if (msg.inapp_stale != null && msg.inapp_stale.length > 0) {\n // web popup stale\n staleDataUpdate(msg.inapp_stale, 'wp')\n }\n if (msg.inbox_stale != null && msg.inbox_stale.length > 0) {\n // web inbox stale\n staleDataUpdate(msg.inbox_stale, 'wi')\n }\n } catch (e) {\n _logger.error('Unable to persist evrp/arp: ' + e)\n }\n }\n}\n\nexport default _tr\n","import {\n StorageManager\n} from '../util/storage'\nexport default class User {\n #isPersonalisationActive\n\n constructor ({\n isPersonalisationActive\n }) {\n this.#isPersonalisationActive = isPersonalisationActive\n }\n\n getTotalVisits () {\n if (!this.#isPersonalisationActive()) {\n return\n }\n let visitCount = StorageManager.getMetaProp('sc')\n if (visitCount == null) {\n visitCount = 1\n }\n return visitCount\n }\n\n getLastVisit () {\n if (!this.#isPersonalisationActive()) {\n return\n }\n const prevSession = StorageManager.getMetaProp('ps')\n if (prevSession != null) {\n return new Date(prevSession * 1000)\n }\n }\n}\n","import {\n CLEVERTAP_ERROR_PREFIX\n} from '../util/messages'\n\nexport const logLevels = {\n DISABLE: 0,\n ERROR: 1,\n INFO: 2,\n DEBUG: 3,\n DEBUG_PE: 4\n}\n\nexport class Logger {\n #logLevel\n wzrkError = {}\n constructor (logLevel) {\n this.#logLevel = logLevel == null ? logLevel : logLevels.INFO\n this.wzrkError = {}\n }\n\n get logLevel () {\n return this.#logLevel\n }\n\n set logLevel (logLevel) {\n this.#logLevel = logLevel\n }\n\n error (message) {\n if (this.#logLevel >= logLevels.ERROR) {\n this.#log('error', message)\n }\n }\n\n info (message) {\n if (this.#logLevel >= logLevels.INFO) {\n this.#log('log', message)\n }\n }\n\n debug (message) {\n if (this.#logLevel >= logLevels.DEBUG || this.#isLegacyDebug) {\n this.#log('debug', message)\n }\n }\n\n debugPE (message) {\n if (this.#logLevel >= logLevels.DEBUG_PE) {\n this.#log('debug_pe', message)\n }\n }\n\n reportError (code, description) {\n this.wzrkError.c = code\n this.wzrkError.d = description\n this.error(`${CLEVERTAP_ERROR_PREFIX} ${code}: ${description}`)\n }\n\n #log (level, message) {\n if (window.console) {\n try {\n const ts = new Date().getTime()\n console[level](`CleverTap [${ts}]: ${message}`)\n } catch (e) {}\n }\n }\n\n get #isLegacyDebug () {\n return (typeof sessionStorage !== 'undefined' && sessionStorage.WZRK_D === '')\n }\n}\n\nexport default {\n Logger,\n logLevels\n}\n","import { singleQuoteRegex, SCOOKIE_EXP_TIME_IN_SECS } from '../util/constants'\nimport { isObject } from '../util/datatypes'\nimport { getNow } from '../util/datetime'\nimport { StorageManager } from '../util/storage'\nimport { getHostName } from '../util/url'\n\nexport default class SessionManager {\n #logger\n #sessionId\n #isPersonalisationActive\n cookieName // SCOOKIE_NAME\n scookieObj\n\n constructor ({\n logger,\n isPersonalisationActive\n }) {\n this.sessionId = StorageManager.getMetaProp('cs')\n this.#logger = logger\n this.#isPersonalisationActive = isPersonalisationActive\n }\n\n get sessionId () {\n return this.#sessionId\n }\n\n set sessionId (sessionId) {\n this.#sessionId = sessionId\n }\n\n getSessionCookieObject () {\n let scookieStr = StorageManager.readCookie(this.cookieName)\n let obj = {}\n\n if (scookieStr != null) {\n // converting back single quotes to double for JSON parsing - http://www.iandevlin.com/blog/2012/04/html5/cookies-json-localstorage-and-opera\n scookieStr = scookieStr.replace(singleQuoteRegex, '\"')\n\n obj = JSON.parse(scookieStr)\n if (!isObject(obj)) {\n obj = {}\n } else {\n if (typeof obj.t !== 'undefined') { // check time elapsed since last request\n const lastTime = obj.t\n const now = getNow()\n if ((now - lastTime) > (SCOOKIE_EXP_TIME_IN_SECS + 60)) {\n // adding 60 seconds to compensate for in-journey requests\n // ideally the cookie should've died after SCOOKIE_EXP_TIME_IN_SECS but it's still around as we can read\n // hence we shouldn't use it.\n obj = {}\n }\n }\n }\n }\n this.scookieObj = obj\n return obj\n }\n\n setSessionCookieObject (obj) {\n const objStr = JSON.stringify(obj)\n StorageManager.createBroadCookie(this.cookieName, objStr, SCOOKIE_EXP_TIME_IN_SECS, getHostName())\n }\n\n manageSession (session) {\n // first time. check if current session id in localstorage is same\n // if not same then prev = current and current = this new session\n if (typeof this.sessionId === 'undefined' || this.sessionId !== session) {\n const currentSessionInLS = StorageManager.getMetaProp('cs')\n // if sessionId in meta is undefined - set current to both\n if (typeof currentSessionInLS === 'undefined') {\n StorageManager.setMetaProp('ps', session)\n StorageManager.setMetaProp('cs', session)\n StorageManager.setMetaProp('sc', 1)\n } else if (currentSessionInLS !== session) {\n // not same as session in local storage. new session\n StorageManager.setMetaProp('ps', currentSessionInLS)\n StorageManager.setMetaProp('cs', session)\n let sessionCount = StorageManager.getMetaProp('sc')\n if (typeof sessionCount === 'undefined') {\n sessionCount = 0\n }\n StorageManager.setMetaProp('sc', sessionCount + 1)\n }\n this.sessionId = session\n }\n }\n\n getTimeElapsed () {\n if (!this.#isPersonalisationActive()) {\n return\n }\n if (this.scookieObj != null) { // TODO: check logic?\n this.scookieObj = this.getSessionCookieObject()\n }\n const sessionStart = this.scookieObj.s\n if (sessionStart != null) {\n const ts = getNow()\n return Math.floor(ts - sessionStart)\n }\n }\n\n getPageCount () {\n if (!this.#isPersonalisationActive()) {\n return\n }\n\n if (this.scookieObj != null) { // TODO: check logic\n this.scookieObj = this.getSessionCookieObject()\n }\n return this.scookieObj.p\n }\n}\n","import { CAMP_COOKIE_NAME, CLEAR, EVT_PUSH, EV_COOKIE, FIRE_PUSH_UNREGISTERED, LCOOKIE_NAME, PUSH_SUBSCRIPTION_DATA, WEBPUSH_LS_KEY } from '../util/constants'\nimport { isObjectEmpty, isValueValid, removeUnsupportedChars } from '../util/datatypes'\nimport { getNow } from '../util/datetime'\nimport { compressData } from '../util/encoder'\nimport RequestDispatcher from '../util/requestDispatcher'\nimport { StorageManager, $ct } from '../util/storage'\nimport { addToURL } from '../util/url'\nimport { getCampaignObjForLc } from '../util/clevertap'\n\nlet seqNo = 0\nlet requestTime = 0\n\nexport default class RequestManager {\n #logger\n #account\n #device\n #session\n #isPersonalisationActive\n #clearCookie = false\n processingBackup = false\n\n constructor ({ logger, account, device, session, isPersonalisationActive }) {\n this.#logger = logger\n this.#account = account\n this.#device = device\n this.#session = session\n this.#isPersonalisationActive = isPersonalisationActive\n\n RequestDispatcher.logger = logger\n RequestDispatcher.device = device\n RequestDispatcher.account = account\n }\n\n processBackupEvents () {\n const backupMap = StorageManager.readFromLSorCookie(LCOOKIE_NAME)\n if (typeof backupMap === 'undefined' || backupMap === null) {\n return\n }\n this.processingBackup = true\n for (const idx in backupMap) {\n if (backupMap.hasOwnProperty(idx)) {\n const backupEvent = backupMap[idx]\n if (typeof backupEvent.fired === 'undefined') {\n this.#logger.debug('Processing backup event : ' + backupEvent.q)\n if (typeof backupEvent.q !== 'undefined') {\n RequestDispatcher.fireRequest(backupEvent.q)\n }\n backupEvent.fired = true\n }\n }\n }\n StorageManager.saveToLSorCookie(LCOOKIE_NAME, backupMap)\n this.processingBackup = false\n }\n\n addSystemDataToObject (dataObject, ignoreTrim) {\n // ignore trim for chrome notifications; undefined everywhere else\n if (typeof ignoreTrim === 'undefined') {\n dataObject = removeUnsupportedChars(dataObject, this.#logger)\n }\n\n if (!isObjectEmpty(this.#logger.wzrkError)) {\n dataObject.wzrk_error = this.#logger.wzrkError\n this.#logger.wzrkError = {}\n }\n\n dataObject.id = this.#account.id\n\n if (isValueValid(this.#device.gcookie)) {\n dataObject.g = this.#device.gcookie\n }\n\n const obj = this.#session.getSessionCookieObject()\n dataObject.s = obj.s // session cookie\n dataObject.pg = (typeof obj.p === 'undefined') ? 1 : obj.p // Page count\n let proto = document.location.protocol\n proto = proto.replace(':', '')\n dataObject.af = { ...dataObject.af, lib: 'web-sdk-v$$PACKAGE_VERSION$$', protocol: proto, ...$ct.flutterVersion } // app fields\n if (sessionStorage.hasOwnProperty('WZRK_D')) { dataObject.debug = true }\n\n return dataObject\n }\n\n addFlags (data) {\n // check if cookie should be cleared.\n this.#clearCookie = StorageManager.getAndClearMetaProp(CLEAR)\n if (this.#clearCookie !== undefined && this.#clearCookie) {\n data.rc = true\n this.#logger.debug('reset cookie sent in request and cleared from meta for future requests.')\n }\n if (this.#isPersonalisationActive()) {\n const lastSyncTime = StorageManager.getMetaProp('lsTime')\n const expirySeconds = StorageManager.getMetaProp('exTs')\n\n // dsync not found in local storage - get data from server\n if (typeof lastSyncTime === 'undefined' || typeof expirySeconds === 'undefined') {\n data.dsync = true\n return\n }\n const now = getNow()\n // last sync time has expired - get fresh data from server\n if (lastSyncTime + expirySeconds < now) {\n data.dsync = true\n }\n }\n }\n\n // saves url to backup cache and fires the request\n /**\n *\n * @param {string} url\n * @param {boolean} override whether the request can go through or not\n * @param {Boolean} sendOULFlag - true in case of a On User Login request\n */\n saveAndFireRequest (url, override, sendOULFlag, evtName) {\n const now = getNow()\n url = addToURL(url, 'rn', ++$ct.globalCache.REQ_N)\n const data = url + '&i=' + now + '&sn=' + seqNo\n StorageManager.backupEvent(data, $ct.globalCache.REQ_N, this.#logger)\n\n // if offline is set to true, save the request in backup and return\n if ($ct.offline) return\n // if there is no override\n // and an OUL request is not in progress\n // then process the request as it is\n // else block the request\n // note - $ct.blockRequest should ideally be used for override\n if ((!override || (this.#clearCookie !== undefined && this.#clearCookie)) && !window.isOULInProgress) {\n if (now === requestTime) {\n seqNo++\n } else {\n requestTime = now\n seqNo = 0\n }\n window.oulReqN = $ct.globalCache.REQ_N\n RequestDispatcher.fireRequest(data, false, sendOULFlag, evtName)\n } else {\n this.#logger.debug(`Not fired due to override - ${$ct.blockRequest} or clearCookie - ${this.#clearCookie} or OUL request in progress - ${window.isOULInProgress}`)\n }\n }\n\n unregisterTokenForGuid (givenGUID) {\n const payload = StorageManager.readFromLSorCookie(PUSH_SUBSCRIPTION_DATA)\n // Send unregister event only when token is available\n if (payload) {\n const data = {}\n data.type = 'data'\n if (isValueValid(givenGUID)) {\n data.g = givenGUID\n }\n data.action = 'unregister'\n data.id = this.#account.id\n\n const obj = this.#session.getSessionCookieObject()\n\n data.s = obj.s // session cookie\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', 'data')\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n RequestDispatcher.fireRequest(pageLoadUrl, true)\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, false)\n }\n // REGISTER TOKEN\n this.registerToken(payload)\n }\n\n registerToken (payload) {\n if (!payload) return\n // add gcookie etc to the payload\n payload = this.addSystemDataToObject(payload, true)\n payload = JSON.stringify(payload)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', 'data')\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(payload, this.#logger))\n RequestDispatcher.fireRequest(pageLoadUrl)\n // set in localstorage\n StorageManager.save(WEBPUSH_LS_KEY, 'ok')\n }\n\n processEvent (data) {\n this.#addToLocalEventMap(data.evtName)\n data = this.addSystemDataToObject(data, undefined)\n this.addFlags(data)\n data[CAMP_COOKIE_NAME] = getCampaignObjForLc()\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.saveAndFireRequest(pageLoadUrl, $ct.blockRequest, false, data.evtName)\n }\n\n #addToLocalEventMap (evtName) {\n if (StorageManager._isLocalStorageSupported()) {\n if (typeof $ct.globalEventsMap === 'undefined') {\n $ct.globalEventsMap = StorageManager.readFromLSorCookie(EV_COOKIE)\n if (typeof $ct.globalEventsMap === 'undefined') {\n $ct.globalEventsMap = {}\n }\n }\n\n const nowTs = getNow()\n let evtDetail = $ct.globalEventsMap[evtName]\n if (typeof evtDetail !== 'undefined') {\n evtDetail[2] = nowTs\n evtDetail[0]++\n } else {\n evtDetail = []\n evtDetail.push(1)\n evtDetail.push(nowTs)\n evtDetail.push(nowTs)\n }\n $ct.globalEventsMap[evtName] = evtDetail\n StorageManager.saveToLSorCookie(EV_COOKIE, $ct.globalEventsMap)\n }\n }\n\n post (url, body) {\n return fetch(url, {\n method: 'post',\n headers: { 'Content-Type': 'application/json' },\n body: body\n })\n .then((response) => {\n if (response.ok) {\n return response.json()\n }\n throw response\n })\n .then((data) => {\n this.#logger.debug('Sync data successful', data)\n return data\n })\n .catch((e) => {\n this.#logger.debug('Error in syncing variables', e)\n throw e\n })\n }\n}\n","import {\n isObjectEmpty\n} from '../util/datatypes'\nimport {\n EVT_PUSH,\n USEIP_KEY,\n OPTOUT_KEY,\n CT_OPTOUT_KEY\n} from '../util/constants'\nimport {\n StorageManager,\n $ct\n} from '../util/storage'\nimport {\n compressData\n} from '../util/encoder'\nimport {\n addToURL\n} from '../util/url'\n\nexport default class Privacy extends Array {\n #request\n #account\n #oldValues\n #logger\n\n constructor ({\n request,\n account,\n logger\n },\n values) {\n super()\n this.#logger = logger\n this.#request = request\n this.#account = account\n this.#oldValues = values\n }\n\n push (...privacyArr) {\n if ($ct.isPrivacyArrPushed) {\n this.#processPrivacyArray($ct.privacyArray.length > 0 ? $ct.privacyArray : privacyArr)\n } else {\n $ct.privacyArray.push(...privacyArr)\n }\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#processPrivacyArray(this.#oldValues)\n }\n this.#oldValues = null\n }\n\n #processPrivacyArray (privacyArr) {\n if (Array.isArray(privacyArr) && privacyArr.length > 0) {\n const privacyObj = privacyArr.reduce((prev, curr) => ({ ...prev, ...curr }), {})\n let data = {}\n const profileObj = {}\n var optOut = false\n\n if (privacyObj.hasOwnProperty(OPTOUT_KEY)) {\n optOut = privacyObj[OPTOUT_KEY]\n if (typeof optOut === 'boolean') {\n profileObj[CT_OPTOUT_KEY] = optOut\n // should be true when user wants to opt in\n $ct.isOptInRequest = !optOut\n }\n }\n if (privacyObj.hasOwnProperty(USEIP_KEY)) {\n const useIP = privacyObj[USEIP_KEY]\n const shouldUseIP = (typeof useIP === 'boolean') ? useIP : false\n StorageManager.setMetaProp(USEIP_KEY, shouldUseIP)\n }\n if (!isObjectEmpty(profileObj)) {\n data.type = 'profile'\n data.profile = profileObj\n data = this.#request.addSystemDataToObject(data, undefined)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n pageLoadUrl = addToURL(pageLoadUrl, OPTOUT_KEY, optOut ? 'true' : 'false')\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n privacyArr.splice(0, privacyArr.length)\n }\n }\n }\n}\n","export class Variable {\n #variableStore\n\n /**\n * Creates an instance of the Variable class.\n *\n * @constructor\n * @param {VariableStore} options.variableStore - The VariableStore instance for registration.\n * @param {string|null} options.name - The name of the variable.\n * @param {*} options.defaultValue - The default value of the variable.\n * @param {*} options.value - The current value of the variable.\n * @param {string|null} options.type - The type of the variable (string, number, boolean).\n * @param {boolean} options.hadStarted - A flag indicating whether the variable has started (used internally).\n * @param {Function[]} options.valueChangedCallbacks - Array to store callbacks to be executed when the variable value changes.\n */\n constructor ({ variableStore }) {\n this.name = null\n this.defaultValue = null\n this.value = null\n this.type = null\n this.hadStarted = false\n this.valueChangedCallbacks = []\n this.#variableStore = variableStore\n }\n\n getValue () {\n return this.value\n }\n\n getdefaultValue () {\n return this.defaultValue\n }\n\n /**\n * Defines a new variable with the provided name, default value, and variable store.\n * @static\n * @param {string} name - The name of the variable.\n * @param {*} defaultValue - The default value of the variable.\n * @param {VariableStore} variableStore - The VariableStore instance for registration.\n * @returns {Variable|null} - The created Variable instance or null if invalid parameters are provided.\n */\n static define (name, defaultValue, variableStore) {\n if (!name || typeof name !== 'string') {\n console.error('Empty or invalid name parameter provided.')\n return null\n }\n if (name.startsWith('.') || name.endsWith('.')) {\n console.error('Variable name starts or ends with a `.` which is not allowed: ' + name)\n return null\n }\n\n const typeOfDefaultValue = typeof defaultValue\n if (typeOfDefaultValue !== 'string' && typeOfDefaultValue !== 'number' && typeOfDefaultValue !== 'boolean') {\n console.error('Only primitive types (string, number, boolean) are accepted as value')\n return null\n }\n\n const existing = variableStore.getVariable(name)\n if (existing) {\n return existing\n }\n\n const varInstance = new Variable({ variableStore })\n try {\n varInstance.name = name\n varInstance.defaultValue = defaultValue\n varInstance.value = defaultValue\n varInstance.type = typeOfDefaultValue\n variableStore.registerVariable(varInstance)\n varInstance.update(defaultValue)\n } catch (error) {\n console.error(error)\n }\n return varInstance\n }\n\n /**\n * Updates the variable's value, triggering callbacks if hasVarsRequestCompleted is returned true.\n * @param {*} newValue - The new value to be assigned to the variable.\n */\n update (newValue) {\n const oldValue = this.value\n this.value = newValue\n if (newValue === null && oldValue === null) {\n return\n }\n if (newValue !== null && newValue === oldValue && this.hadStarted) {\n return\n }\n if (this.#variableStore.hasVarsRequestCompleted()) {\n this.hadStarted = true\n this.triggerValueChanged()\n }\n }\n\n /**\n * Invokes all registered callbacks when the variable value changes.\n */\n triggerValueChanged () {\n this.valueChangedCallbacks.forEach((onValueChanged) => {\n onValueChanged(this)\n })\n }\n\n /**\n * Adds a callback function to the array and triggers it immediately if variable requests have completed.\n * @param {Function} onValueChanged - The callback function to be added.\n */\n addValueChangedCallback (onValueChanged) {\n if (!onValueChanged) {\n console.log('Invalid callback parameter provided.')\n return\n }\n this.valueChangedCallbacks.push(onValueChanged)\n\n if (this.#variableStore.hasVarsRequestCompleted()) {\n onValueChanged(this)\n }\n }\n\n /**\n * Removes a callback function from the array.\n * @param {Function} onValueChanged - The callback function to be removed.\n */\n removeValueChangedCallback (onValueChanged) {\n const index = this.valueChangedCallbacks.indexOf(onValueChanged)\n if (index !== -1) {\n this.valueChangedCallbacks.splice(index, 1)\n }\n }\n\n /**\n * Resets the `hadStarted` flag to false.\n */\n clearStartFlag () {\n this.hadStarted = false\n }\n}\n","import { VARIABLES, WZRK_FETCH } from '../../util/constants'\nimport { StorageManager, $ct } from '../../util/storage'\nclass VariableStore {\n #logger\n #account\n #request\n #event\n\n #variables\n #remoteVariables\n #fetchCallback\n #variablesChangedCallbacks\n #oneTimeVariablesChangedCallbacks\n #hasVarsRequestCompleted = false\n\n constructor ({ logger, request, account, event }) {\n this.#logger = logger\n this.#account = account\n this.#request = request\n this.#event = event\n\n this.#variables = {}\n this.#remoteVariables = {}\n this.#variablesChangedCallbacks = []\n this.#oneTimeVariablesChangedCallbacks = []\n\n $ct.variableStore = this\n }\n\n /**\n * Registers a variable instance in the store.\n * @param {Object} varInstance - The variable instance to be registered.\n */\n registerVariable (varInstance) {\n const { name } = varInstance\n this.#variables[name] = varInstance\n console.log('registerVariable', this.#variables)\n }\n\n /**\n * Retrieves a variable by its name.\n * @param {string} name - The name of the variable to retrieve.\n * @returns {Object} - The variable instance.\n */\n getVariable (name) {\n return this.#variables[name]\n }\n\n hasVarsRequestCompleted () {\n return this.#hasVarsRequestCompleted\n }\n\n /**\n * Synchronizes variables with the server.\n * @param {Function} onSyncSuccess - Callback function on successful synchronization.\n * @param {Function} onSyncFailure - Callback function on synchronization failure.\n * @throws Will throw an error if the account token is missing.\n * @returns {Promise} - The result of the synchronization request.\n */\n syncVariables (onSyncSuccess, onSyncFailure) {\n if (!this.#account.token) {\n const m = 'Account token is missing.'\n this.#logger.error(m)\n return Promise.reject(new Error(m))\n }\n\n const payload = {\n type: 'varsPayload',\n vars: {}\n }\n\n for (const name in this.#variables) {\n payload.vars[name] = {\n defaultValue: this.#variables[name].defaultValue,\n type: this.#variables[name].type\n }\n }\n\n // Check if payload.vars is empty\n if (Object.keys(payload.vars).length === 0) {\n const m = 'No variables are defined.'\n this.#logger.error(m)\n return Promise.reject(new Error(m))\n }\n\n let meta = {}\n meta = this.#request.addSystemDataToObject(meta, undefined)\n meta.tk = this.#account.token\n\n meta.type = 'meta'\n const body = JSON.stringify([meta, payload])\n const url = this.#account.dataPostPEURL\n\n return this.#request.post(url, body)\n .then((r) => {\n if (onSyncSuccess && typeof onSyncSuccess === 'function') {\n onSyncSuccess(r)\n }\n return r\n })\n .catch((e) => {\n if (onSyncFailure && typeof onSyncFailure === 'function') {\n onSyncFailure(e)\n }\n if (e.status === 400) {\n this.#logger.error('Invalid sync payload or clear the existing draft')\n } else if (e.status === 401) {\n this.#logger.error('This is not a test profile')\n } else {\n this.#logger.error('Sync variable failed')\n }\n throw e\n })\n }\n\n /**\n * Fetches variables from the server.\n * @param {Function} onFetchCallback - Callback function on fetch completion.\n */\n fetchVariables (onFetchCallback) {\n this.#event.push(WZRK_FETCH, { t: 4 })\n if (onFetchCallback && typeof onFetchCallback === 'function') {\n this.#fetchCallback = onFetchCallback\n }\n }\n\n mergeVariables (vars) {\n console.log('msg vars is ', vars)\n this.#hasVarsRequestCompleted = true\n\n StorageManager.saveToLSorCookie(VARIABLES, vars)\n this.#remoteVariables = vars\n\n for (const name in this.#variables) {\n if (vars.hasOwnProperty(name)) {\n this.#variables[name].update(vars[name])\n }\n }\n\n if (this.#fetchCallback) {\n this.#fetchCallback()\n }\n\n this.#runVariablesChangedCallback()\n }\n\n addVariablesChangedCallback (callback) {\n if (callback && typeof callback === 'function') {\n this.#variablesChangedCallbacks.push(callback)\n\n if (this.hasVarsRequestCompleted()) {\n callback()\n }\n } else {\n this.#logger.error('callback is not a function')\n }\n }\n\n addOneTimeVariablesChangedCallback (callback) {\n if (callback && typeof callback === 'function') {\n if (this.hasVarsRequestCompleted()) {\n callback()\n } else {\n this.#oneTimeVariablesChangedCallbacks.push(callback)\n }\n }\n }\n\n removeVariablesChangedCallback (callback) {\n const index = this.#variablesChangedCallbacks.indexOf(callback)\n if (index !== -1) {\n this.#variablesChangedCallbacks.splice(index, 1)\n }\n }\n\n removeOneTimeVariablesChangedCallback (callback) {\n const index = this.#oneTimeVariablesChangedCallbacks.indexOf(callback)\n if (index !== -1) {\n this.#oneTimeVariablesChangedCallbacks.splice(index, 1)\n }\n }\n\n #runVariablesChangedCallback () {\n for (var callback of this.#variablesChangedCallbacks) {\n callback()\n }\n for (var callBack of this.#oneTimeVariablesChangedCallbacks) {\n callBack()\n }\n this.#oneTimeVariablesChangedCallbacks.length = 0\n }\n}\n\nexport default VariableStore\n","import Account from './modules/account'\nimport CleverTapAPI from './modules/api'\nimport DeviceManager from './modules/device'\nimport EventHandler from './modules/event'\nimport ProfileHandler from './modules/profile'\nimport UserLoginHandler from './modules/userLogin'\nimport _tr from './util/tr'\nimport User from './modules/user'\nimport { Logger, logLevels } from './modules/logger'\nimport SessionManager from './modules/session'\nimport ReqestManager from './modules/request'\nimport {\n CAMP_COOKIE_NAME,\n SCOOKIE_PREFIX,\n NOTIFICATION_VIEWED,\n NOTIFICATION_CLICKED,\n EVT_PING,\n FIRST_PING_FREQ_IN_MILLIS,\n CONTINUOUS_PING_FREQ_IN_MILLIS,\n GROUP_SUBSCRIPTION_REQUEST_ID,\n WZRK_ID,\n WZRK_PREFIX,\n categoryLongKey,\n COMMAND_INCREMENT,\n COMMAND_DECREMENT,\n COMMAND_SET,\n COMMAND_ADD,\n COMMAND_REMOVE,\n COMMAND_DELETE,\n EVT_PUSH,\n WZRK_FETCH\n} from './util/constants'\nimport { EMBED_ERROR } from './util/messages'\nimport { StorageManager, $ct } from './util/storage'\nimport { addToURL, getDomain, getURLParams } from './util/url'\nimport { getCampaignObjForLc, setEnum, handleEmailSubscription, closeIframe } from './util/clevertap'\nimport { compressData } from './util/encoder'\nimport Privacy from './modules/privacy'\nimport NotificationHandler from './modules/notification'\nimport { hasWebInboxSettingsInLS, checkAndRegisterWebInboxElements, initializeWebInbox, getInboxMessages, saveInboxMessages } from './modules/web-inbox/helper'\nimport { Variable } from './modules/variables/variable'\nimport VariableStore from './modules/variables/variableStore'\nimport { checkBuilder, addAntiFlicker } from './modules/visualBuilder/pageBuilder'\nimport { setServerKey } from './modules/webPushPrompt/prompt'\n\nexport default class CleverTap {\n #logger\n #api\n #onloadcalled\n #device\n #session\n #account\n #request\n #variableStore\n #isSpa\n #previousUrl\n #boundCheckPageChanged = this.#checkPageChanged.bind(this)\n #dismissSpamControl\n enablePersonalization\n\n get spa () {\n return this.#isSpa\n }\n\n set spa (value) {\n const isSpa = value === true\n if (this.#isSpa !== isSpa && this.#onloadcalled === 1) {\n // if clevertap.spa is changed after init has been called then update the click listeners\n if (isSpa) {\n document.addEventListener('click', this.#boundCheckPageChanged)\n } else {\n document.removeEventListener('click', this.#boundCheckPageChanged)\n }\n }\n this.#isSpa = isSpa\n }\n\n get dismissSpamControl () {\n return this.#dismissSpamControl\n }\n\n set dismissSpamControl (value) {\n const dismissSpamControl = value === true\n this.#dismissSpamControl = dismissSpamControl\n $ct.dismissSpamControl = dismissSpamControl\n }\n\n constructor (clevertap = {}) {\n this.#onloadcalled = 0\n this._isPersonalisationActive = this._isPersonalisationActive.bind(this)\n this.raiseNotificationClicked = () => { }\n this.#logger = new Logger(logLevels.INFO)\n this.#account = new Account(clevertap.account?.[0], clevertap.region || clevertap.account?.[1], clevertap.targetDomain || clevertap.account?.[2], clevertap.token || clevertap.account?.[3])\n this.#device = new DeviceManager({ logger: this.#logger })\n this.#dismissSpamControl = clevertap.dismissSpamControl || false\n this.shpfyProxyPath = clevertap.shpfyProxyPath || ''\n this.#session = new SessionManager({\n logger: this.#logger,\n isPersonalisationActive: this._isPersonalisationActive\n })\n this.#request = new ReqestManager({\n logger: this.#logger,\n account: this.#account,\n device: this.#device,\n session: this.#session,\n isPersonalisationActive: this._isPersonalisationActive\n })\n this.enablePersonalization = clevertap.enablePersonalization || false\n this.event = new EventHandler({\n logger: this.#logger,\n request: this.#request,\n isPersonalisationActive: this._isPersonalisationActive\n }, clevertap.event)\n\n this.profile = new ProfileHandler({\n logger: this.#logger,\n request: this.#request,\n account: this.#account,\n isPersonalisationActive: this._isPersonalisationActive\n }, clevertap.profile)\n\n this.onUserLogin = new UserLoginHandler({\n request: this.#request,\n account: this.#account,\n session: this.#session,\n logger: this.#logger,\n device: this.#device\n }, clevertap.onUserLogin)\n\n this.privacy = new Privacy({\n request: this.#request,\n account: this.#account,\n logger: this.#logger\n }, clevertap.privacy)\n\n this.notifications = new NotificationHandler({\n logger: this.#logger,\n request: this.#request,\n account: this.#account\n }, clevertap.notifications)\n\n this.#variableStore = new VariableStore({\n logger: this.#logger,\n request: this.#request,\n account: this.#account,\n event: this.event\n })\n\n this.#api = new CleverTapAPI({\n logger: this.#logger,\n request: this.#request,\n device: this.#device,\n session: this.#session\n })\n\n this.spa = clevertap.spa\n this.dismissSpamControl = clevertap.dismissSpamControl\n\n this.user = new User({\n isPersonalisationActive: this._isPersonalisationActive\n })\n\n this.session = {\n getTimeElapsed: () => {\n return this.#session.getTimeElapsed()\n },\n getPageCount: () => {\n return this.#session.getPageCount()\n }\n }\n\n this.logout = () => {\n this.#logger.debug('logout called')\n StorageManager.setInstantDeleteFlagInK()\n }\n\n this.clear = () => {\n this.onUserLogin.clear()\n }\n\n this.getCleverTapID = () => {\n return this.#device.getGuid()\n }\n\n this.getAccountID = () => {\n return this.#account.id\n }\n\n this.getSCDomain = () => {\n return this.#account.finalTargetDomain\n }\n\n this.setLibrary = (libName, libVersion) => {\n $ct.flutterVersion = { [libName]: libVersion }\n }\n\n // Set the Signed Call sdk version and fire request\n this.setSCSDKVersion = (ver) => {\n this.#account.scSDKVersion = ver\n const data = {}\n data.af = { scv: 'sc-sdk-v' + this.#account.scSDKVersion }\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', 'page')\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(JSON.stringify(data), this.#logger))\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n\n if (hasWebInboxSettingsInLS()) {\n checkAndRegisterWebInboxElements()\n initializeWebInbox(this.#logger)\n }\n\n // Get Inbox Message Count\n this.getInboxMessageCount = () => {\n const msgCount = getInboxMessages()\n return Object.keys(msgCount).length\n }\n\n // Get Inbox Unread Message Count\n this.getInboxMessageUnreadCount = () => {\n if ($ct.inbox) {\n return $ct.inbox.unviewedCounter\n } else {\n this.#logger.debug('No unread messages')\n }\n }\n\n // Get All Inbox messages\n this.getAllInboxMessages = () => {\n return getInboxMessages()\n }\n\n // Get only Unread messages\n this.getUnreadInboxMessages = () => {\n if ($ct.inbox) {\n return $ct.inbox.unviewedMessages\n } else {\n this.#logger.debug('No unread messages')\n }\n }\n\n // Get message object belonging to the given message id only. Message id should be a String\n this.getInboxMessageForId = (messageId) => {\n const messages = getInboxMessages()\n if ((messageId !== null || messageId !== '') && messages.hasOwnProperty(messageId)) {\n return messages[messageId]\n } else {\n this.#logger.error('No message available for message Id ' + messageId)\n }\n }\n\n // Delete message from the Inbox. Message id should be a String\n // If the message to be deleted is unviewed then decrement the badge count, delete the message from unviewedMessages list\n // Then remove the message from local storage and update cookie\n this.deleteInboxMessage = (messageId) => {\n const messages = getInboxMessages()\n if ((messageId !== null || messageId !== '') && messages.hasOwnProperty(messageId)) {\n const el = document.querySelector('ct-web-inbox').shadowRoot.getElementById(messageId)\n if (messages[messageId].viewed === 0) {\n $ct.inbox.unviewedCounter--\n delete $ct.inbox.unviewedMessages[messageId]\n document.getElementById('unviewedBadge').innerText = $ct.inbox.unviewedCounter\n document.getElementById('unviewedBadge').style.display = $ct.inbox.unviewedCounter > 0 ? 'flex' : 'none'\n }\n el && el.remove()\n delete messages[messageId]\n saveInboxMessages(messages)\n } else {\n this.#logger.error('No message available for message Id ' + messageId)\n }\n }\n\n /* Mark Message as Read. Message id should be a String\n - Check if the message Id exist in the unread message list\n - Remove the unread marker, update the viewed flag, decrement the bage Count\n - renderNotificationViewed */\n this.markReadInboxMessage = (messageId) => {\n const unreadMsg = $ct.inbox.unviewedMessages\n const messages = getInboxMessages()\n if ((messageId !== null || messageId !== '') && unreadMsg.hasOwnProperty(messageId)) {\n const el = document.querySelector('ct-web-inbox').shadowRoot.getElementById(messageId)\n if (el !== null) { el.shadowRoot.getElementById('unreadMarker').style.display = 'none' }\n messages[messageId].viewed = 1\n if (document.getElementById('unviewedBadge')) {\n var counter = parseInt(document.getElementById('unviewedBadge').innerText) - 1\n document.getElementById('unviewedBadge').innerText = counter\n document.getElementById('unviewedBadge').style.display = counter > 0 ? 'flex' : 'none'\n }\n window.clevertap.renderNotificationViewed({ msgId: messages[messageId].wzrk_id, pivotId: messages[messageId].pivotId })\n $ct.inbox.unviewedCounter--\n delete $ct.inbox.unviewedMessages[messageId]\n saveInboxMessages(messages)\n } else {\n this.#logger.error('No message available for message Id ' + messageId)\n }\n }\n\n /* Mark Message as Read. messageIds should be a an array of string */\n this.markReadInboxMessagesForIds = (messageIds) => {\n if (Array.isArray(messageIds)) {\n for (var id = 0; id < messageIds.length; id++) {\n this.markReadInboxMessage(messageIds[id])\n }\n }\n }\n\n /* Mark all messages as read\n - Get the count of unread messages, update unread marker style\n - renderNotificationViewed, update the badge count and style\n */\n this.markReadAllInboxMessage = () => {\n const unreadMsg = $ct.inbox.unviewedMessages\n const messages = getInboxMessages()\n if (Object.keys(unreadMsg).length > 0) {\n const msgIds = Object.keys(unreadMsg)\n msgIds.forEach(key => {\n const el = document.querySelector('ct-web-inbox').shadowRoot.getElementById(key)\n if (el !== null) { el.shadowRoot.getElementById('unreadMarker').style.display = 'none' }\n messages[key].viewed = 1\n window.clevertap.renderNotificationViewed({ msgId: messages[key].wzrk_id, pivotId: messages[key].wzrk_pivot })\n })\n document.getElementById('unviewedBadge').innerText = 0\n document.getElementById('unviewedBadge').style.display = 'none'\n saveInboxMessages(messages)\n $ct.inbox.unviewedCounter = 0\n $ct.inbox.unviewedMessages = {}\n } else {\n this.#logger.debug('All messages are already read')\n }\n }\n\n this.toggleInbox = (e) => $ct.inbox?.toggleInbox(e)\n\n // method for notification viewed\n this.renderNotificationViewed = (detail) => {\n processNotificationEvent(NOTIFICATION_VIEWED, detail)\n }\n\n // method for notification clicked\n this.renderNotificationClicked = (detail) => {\n processNotificationEvent(NOTIFICATION_CLICKED, detail)\n }\n\n const processNotificationEvent = (eventName, eventDetail) => {\n if (!eventDetail || !eventDetail.msgId) { return }\n const data = {}\n data.type = 'event'\n data.evtName = eventName\n data.evtData = { [WZRK_ID]: eventDetail.msgId }\n\n if (eventDetail.pivotId) {\n data.evtData = { ...data.evtData, wzrk_pivot: eventDetail.pivotId }\n }\n\n if (eventDetail.wzrk_slideNo) {\n data.evtData = { ...data.evtData, wzrk_slideNo: eventDetail.wzrk_slideNo }\n }\n\n // Adding kv pair to event data\n if (eventDetail.kv && eventDetail.kv !== null && eventDetail.kv !== undefined) {\n for (const key in eventDetail.kv) {\n if (key.startsWith(WZRK_PREFIX)) {\n data.evtData = { ...data.evtData, [key]: eventDetail.kv[key] }\n }\n }\n }\n\n // Adding msgCTkv to event data\n if (eventDetail.msgCTkv && eventDetail.msgCTkv !== null && eventDetail.msgCTkv !== undefined) {\n for (const key in eventDetail.msgCTkv) {\n if (key.startsWith(WZRK_PREFIX)) {\n data.evtData = { ...data.evtData, [key]: eventDetail.msgCTkv[key] }\n }\n }\n }\n this.#request.processEvent(data)\n }\n\n this.setLogLevel = (l) => {\n this.#logger.logLevel = Number(l)\n if (l === 3) {\n sessionStorage.WZRK_D = ''\n } else {\n delete sessionStorage.WZRK_D\n }\n }\n /**\n * @param {} key\n * @param {*} value\n */\n this.handleIncrementValue = (key, value) => {\n this.profile._handleIncrementDecrementValue(key, value, COMMAND_INCREMENT)\n }\n\n this.handleDecrementValue = (key, value) => {\n this.profile._handleIncrementDecrementValue(key, value, COMMAND_DECREMENT)\n }\n\n this.setMultiValuesForKey = (key, value) => {\n if (Array.isArray(value)) {\n this.profile._handleMultiValueSet(key, value, COMMAND_SET)\n } else {\n console.error('setMultiValuesForKey should be called with a value of type array')\n }\n }\n\n this.addMultiValueForKey = (key, value) => {\n if (typeof value === 'string' || typeof value === 'number') {\n this.profile._handleMultiValueAdd(key, value, COMMAND_ADD)\n } else {\n console.error('addMultiValueForKey should be called with a value of type string or number.')\n }\n }\n\n this.addMultiValuesForKey = (key, value) => {\n if (Array.isArray(value)) {\n this.profile._handleMultiValueAdd(key, value, COMMAND_ADD)\n } else {\n console.error('addMultiValuesForKey should be called with a value of type array.')\n }\n }\n\n this.removeMultiValueForKey = (key, value) => {\n if (typeof value === 'string' || typeof value === 'number') {\n this.profile._handleMultiValueRemove(key, value, COMMAND_REMOVE)\n } else {\n console.error('removeMultiValueForKey should be called with a value of type string or number.')\n }\n }\n\n this.removeMultiValuesForKey = (key, value) => {\n if (Array.isArray(value)) {\n this.profile._handleMultiValueRemove(key, value, COMMAND_REMOVE)\n } else {\n console.error('removeMultiValuesForKey should be called with a value of type array.')\n }\n }\n\n this.removeValueForKey = (key) => {\n this.profile._handleMultiValueDelete(key, COMMAND_DELETE)\n }\n\n const _handleEmailSubscription = (subscription, reEncoded, fetchGroups) => {\n handleEmailSubscription(subscription, reEncoded, fetchGroups, this.#account, this.#logger)\n }\n\n /**\n *\n * @param {number} lat\n * @param {number} lng\n * @param {callback function} handleCoordinates\n * @returns\n */\n this.getLocation = function (lat, lng) {\n // latitude and longitude should be number type\n if ((lat && typeof lat !== 'number') || (lng && typeof lng !== 'number')) {\n console.log('Latitude and Longitude must be of number type')\n return\n }\n if (lat && lng) {\n // valid latitude ranges bw +-90\n if (lat <= -90 || lat > 90) {\n console.log('A vaid latitude must range between -90 and 90')\n return\n }\n // valid longitude ranges bw +-180\n if (lng <= -180 || lng > 180) {\n console.log('A valid longitude must range between -180 and 180')\n return\n }\n $ct.location = { Latitude: lat, Longitude: lng }\n this.#sendLocationData({ Latitude: lat, Longitude: lng })\n } else {\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(showPosition.bind(this), showError)\n } else {\n console.log('Geolocation is not supported by this browser.')\n }\n }\n }\n\n function showPosition (position) {\n var lat = position.coords.latitude\n var lng = position.coords.longitude\n $ct.location = { Latitude: lat, Longitude: lng }\n this.#sendLocationData({ Latitude: lat, Longitude: lng })\n }\n\n function showError (error) {\n switch (error.code) {\n case error.PERMISSION_DENIED:\n console.log('User denied the request for Geolocation.')\n break\n case error.POSITION_UNAVAILABLE:\n console.log('Location information is unavailable.')\n break\n case error.TIMEOUT:\n console.log('The request to get user location timed out.')\n break\n case error.UNKNOWN_ERROR:\n console.log('An unknown error occurred.')\n break\n }\n }\n\n const api = this.#api\n api.logout = this.logout\n api.clear = this.clear\n api.closeIframe = (campaignId, divIdIgnored) => {\n closeIframe(campaignId, divIdIgnored, this.#session.sessionId)\n }\n api.enableWebPush = (enabled, applicationServerKey) => {\n setServerKey(applicationServerKey)\n this.notifications._enableWebPush(enabled, applicationServerKey)\n }\n api.tr = (msg) => {\n _tr(msg, {\n device: this.#device,\n session: this.#session,\n request: this.#request,\n logger: this.#logger\n })\n }\n api.setEnum = (enumVal) => {\n setEnum(enumVal, this.#logger)\n }\n api.is_onloadcalled = () => {\n return (this.#onloadcalled === 1)\n }\n api.subEmail = (reEncoded) => {\n _handleEmailSubscription('1', reEncoded)\n }\n api.getEmail = (reEncoded, withGroups) => {\n _handleEmailSubscription('-1', reEncoded, withGroups)\n }\n api.unSubEmail = (reEncoded) => {\n _handleEmailSubscription('0', reEncoded)\n }\n api.unsubEmailGroups = (reEncoded) => {\n $ct.unsubGroups = []\n const elements = document.getElementsByClassName('ct-unsub-group-input-item')\n\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i]\n if (element.name) {\n const data = { name: element.name, isUnsubscribed: element.checked }\n $ct.unsubGroups.push(data)\n }\n }\n\n _handleEmailSubscription(GROUP_SUBSCRIPTION_REQUEST_ID, reEncoded)\n }\n api.setSubscriptionGroups = (value) => {\n $ct.unsubGroups = value\n }\n api.getSubscriptionGroups = () => {\n return $ct.unsubGroups\n }\n api.changeSubscriptionGroups = (reEncoded, updatedGroups) => {\n api.setSubscriptionGroups(updatedGroups)\n _handleEmailSubscription(GROUP_SUBSCRIPTION_REQUEST_ID, reEncoded)\n }\n api.isGlobalUnsubscribe = () => {\n return $ct.globalUnsubscribe\n }\n api.setIsGlobalUnsubscribe = (value) => {\n $ct.globalUnsubscribe = value\n }\n api.setUpdatedCategoryLong = (profile) => {\n if (profile[categoryLongKey]) {\n $ct.updatedCategoryLong = profile[categoryLongKey]\n }\n }\n window.$CLTP_WR = window.$WZRK_WR = api\n\n if (clevertap.account?.[0].id) {\n // The accountId is present so can init with empty values.\n // Needed to maintain backward compatability with legacy implementations.\n // Npm imports/require will need to call init explictly with accountId\n this.init()\n }\n }\n\n // starts here\n init (accountId, region, targetDomain, token, antiFlicker = {}) {\n if (Object.keys(antiFlicker).length > 0) {\n addAntiFlicker(antiFlicker)\n }\n if (this.#onloadcalled === 1) {\n // already initailsed\n return\n }\n\n StorageManager.removeCookie('WZRK_P', window.location.hostname)\n if (!this.#account.id) {\n if (!accountId) {\n this.#logger.error(EMBED_ERROR)\n return\n }\n this.#account.id = accountId\n }\n checkBuilder(this.#logger, this.#account.id)\n this.#session.cookieName = SCOOKIE_PREFIX + '_' + this.#account.id\n\n if (region) {\n this.#account.region = region\n }\n if (targetDomain) {\n this.#account.targetDomain = targetDomain\n }\n if (token) {\n this.#account.token = token\n }\n\n const currLocation = location.href\n const urlParams = getURLParams(currLocation.toLowerCase())\n\n // eslint-disable-next-line eqeqeq\n if (typeof urlParams.e !== 'undefined' && urlParams.wzrk_ex == '0') {\n return\n }\n\n $ct.isPrivacyArrPushed = true\n if ($ct.privacyArray.length > 0) {\n this.privacy.push($ct.privacyArray)\n }\n\n this.#processOldValues()\n this.pageChanged()\n const backupInterval = setInterval(() => {\n if (this.#device.gcookie) {\n clearInterval(backupInterval)\n this.#request.processBackupEvents()\n }\n }, 3000)\n if (this.#isSpa) {\n // listen to click on the document and check if URL has changed.\n document.addEventListener('click', this.#boundCheckPageChanged)\n } else {\n // remove existing click listeners if any\n document.removeEventListener('click', this.#boundCheckPageChanged)\n }\n this.#onloadcalled = 1\n }\n\n // process the option array provided to the clevertap object\n // after its been initialized\n #processOldValues () {\n this.onUserLogin._processOldValues()\n this.privacy._processOldValues()\n this.event._processOldValues()\n this.profile._processOldValues()\n this.notifications._processOldValues()\n }\n\n #debounce (func, delay = 300) {\n let timeout\n return function () {\n clearTimeout(timeout)\n timeout = setTimeout(func, delay)\n }\n }\n\n #checkPageChanged () {\n const debouncedPageChanged = this.#debounce(() => {\n if (this.#previousUrl !== location.href) {\n this.pageChanged()\n }\n })\n debouncedPageChanged()\n }\n\n pageChanged () {\n const currLocation = window.location.href\n const urlParams = getURLParams(currLocation.toLowerCase())\n // -- update page count\n const obj = this.#session.getSessionCookieObject()\n let pgCount = (typeof obj.p === 'undefined') ? 0 : obj.p\n obj.p = ++pgCount\n this.#session.setSessionCookieObject(obj)\n // -- update page count\n\n let data = {}\n let referrerDomain = getDomain(document.referrer)\n\n if (window.location.hostname !== referrerDomain) {\n const maxLen = 120\n if (referrerDomain !== '') {\n referrerDomain = referrerDomain.length > maxLen ? referrerDomain.substring(0, maxLen) : referrerDomain\n data.referrer = referrerDomain\n }\n\n let utmSource = urlParams.utm_source || urlParams.wzrk_source\n if (typeof utmSource !== 'undefined') {\n utmSource = utmSource.length > maxLen ? utmSource.substring(0, maxLen) : utmSource\n data.us = utmSource // utm_source\n }\n\n let utmMedium = urlParams.utm_medium || urlParams.wzrk_medium\n if (typeof utmMedium !== 'undefined') {\n utmMedium = utmMedium.length > maxLen ? utmMedium.substring(0, maxLen) : utmMedium\n data.um = utmMedium // utm_medium\n }\n\n let utmCampaign = urlParams.utm_campaign || urlParams.wzrk_campaign\n if (typeof utmCampaign !== 'undefined') {\n utmCampaign = utmCampaign.length > maxLen ? utmCampaign.substring(0, maxLen) : utmCampaign\n data.uc = utmCampaign // utm_campaign\n }\n\n // also independently send wzrk_medium to the backend\n if (typeof urlParams.wzrk_medium !== 'undefined') {\n const wm = urlParams.wzrk_medium\n if (wm.match(/^email$|^social$|^search$/)) {\n data.wm = wm // wzrk_medium\n }\n }\n }\n\n data = this.#request.addSystemDataToObject(data, undefined)\n data.cpg = currLocation\n\n data[CAMP_COOKIE_NAME] = getCampaignObjForLc()\n let pageLoadUrl = this.#account.dataPostURL\n this.#request.addFlags(data)\n // send dsync flag when page = 1\n if (parseInt(data.pg) === 1) {\n this.#overrideDSyncFlag(data)\n }\n pageLoadUrl = addToURL(pageLoadUrl, 'type', 'page')\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(JSON.stringify(data), this.#logger))\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n\n if (parseInt(data.pg) === 1) {\n this.event.push(WZRK_FETCH, { t: 4 })\n }\n\n this.#previousUrl = currLocation\n setTimeout(() => {\n if (pgCount <= 3) {\n // send ping for up to 3 pages\n this.#pingRequest()\n }\n\n if (this.#isPingContinuous()) {\n setInterval(() => {\n this.#pingRequest()\n }, CONTINUOUS_PING_FREQ_IN_MILLIS)\n }\n }, FIRST_PING_FREQ_IN_MILLIS)\n }\n\n #pingRequest () {\n let pageLoadUrl = this.#account.dataPostURL\n let data = {}\n data = this.#request.addSystemDataToObject(data, undefined)\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PING)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(JSON.stringify(data), this.#logger))\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n\n #isPingContinuous () {\n return (typeof window.wzrk_d !== 'undefined' && window.wzrk_d.ping === 'continuous')\n }\n\n _isPersonalisationActive () {\n return StorageManager._isLocalStorageSupported() && this.enablePersonalization\n }\n\n #overrideDSyncFlag (data) {\n if (this._isPersonalisationActive()) {\n data.dsync = true\n }\n }\n\n popupCallbacks = {};\n popupCurrentWzrkId = '';\n\n // eslint-disable-next-line accessor-pairs\n set popupCallback (callback) {\n this.popupCallbacks[this.popupCurrentWzrkId] = callback\n }\n\n /**\n *\n * @param {object} payload\n */\n #sendLocationData (payload) {\n // Send the updated value to LC\n let data = {}\n data.af = {}\n const profileObj = {}\n data.type = 'profile'\n if (profileObj.tz == null) {\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n data.profile = profileObj\n if (payload) {\n const keys = Object.keys(payload)\n keys.forEach(key => {\n data.af[key] = payload[key]\n })\n }\n if ($ct.location) {\n data.af = { ...data.af, ...$ct.location }\n }\n data = this.#request.addSystemDataToObject(data, true)\n this.#request.addFlags(data)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n\n // offline mode\n /**\n * events will be recorded and queued locally when passed with true\n * but will not be sent to the server until offline is disabled by passing false\n * @param {boolean} arg\n */\n\n setOffline (arg) {\n if (typeof arg !== 'boolean') {\n console.error('setOffline should be called with a value of type boolean')\n return\n }\n $ct.offline = arg\n // if offline is disabled\n // process events from cache\n if (!arg) {\n this.#request.processBackupEvents()\n }\n }\n\n getSDKVersion () {\n return 'web-sdk-v$$PACKAGE_VERSION$$'\n }\n\n defineVariable (name, defaultValue) {\n return Variable.define(name, defaultValue, this.#variableStore)\n }\n\n syncVariables (onSyncSuccess, onSyncFailure) {\n if (this.#logger.logLevel === 4) {\n return this.#variableStore.syncVariables(onSyncSuccess, onSyncFailure)\n } else {\n const m = 'App log level is not set to 4'\n this.#logger.error(m)\n return Promise.reject(new Error(m))\n }\n }\n\n fetchVariables (onFetchCallback) {\n this.#variableStore.fetchVariables(onFetchCallback)\n }\n\n addVariablesChangedCallback (callback) {\n this.#variableStore.addVariablesChangedCallback(callback)\n }\n\n addOneTimeVariablesChangedCallback (callback) {\n this.#variableStore.addOneTimeVariablesChangedCallback(callback)\n }\n}\n","import Clevertap from './clevertap'\n\nconst clevertap = new Clevertap(window.clevertap)\n\nwindow.clevertap = window.wizrocket = clevertap\n\nexport default clevertap\n"],"names":["TARGET_DOMAIN","TARGET_PROTOCOL","DEFAULT_REGION","Account","constructor","id","region","targetDomain","token","accountId","dcSDKVersion","finalTargetDomain","dataPostPEURL","dataPostURL","recorderURL","emailURL","unsupportedKeyCharRegex","RegExp","unsupportedValueCharRegex","singleQuoteRegex","CLEAR","CHARGED_ID","CHARGEDID_COOKIE_NAME","GCOOKIE_NAME","KCOOKIE_NAME","CAMP_COOKIE_NAME","CAMP_COOKIE_G","SCOOKIE_PREFIX","SCOOKIE_EXP_TIME_IN_SECS","EV_COOKIE","META_COOKIE","PR_COOKIE","ARP_COOKIE","LCOOKIE_NAME","GLOBAL","DISPLAY","WEBPUSH_LS_KEY","OPTOUT_KEY","CT_OPTOUT_KEY","OPTOUT_COOKIE_ENDSWITH","USEIP_KEY","LRU_CACHE","LRU_CACHE_SIZE","IS_OUL","EVT_PUSH","EVT_PING","COOKIE_EXPIRY","MAX_TRIES","FIRST_PING_FREQ_IN_MILLIS","CONTINUOUS_PING_FREQ_IN_MILLIS","GROUP_SUBSCRIPTION_REQUEST_ID","categoryLongKey","WZRK_PREFIX","WZRK_ID","NOTIFICATION_VIEWED","NOTIFICATION_CLICKED","FIRE_PUSH_UNREGISTERED","PUSH_SUBSCRIPTION_DATA","COMMAND_INCREMENT","COMMAND_DECREMENT","COMMAND_SET","COMMAND_ADD","COMMAND_REMOVE","COMMAND_DELETE","WEBINBOX_CONFIG","WEBINBOX","MAX_INBOX_MSG","VARIABLES","PUSH_DELAY_MS","MAX_DELAY_FREQUENCY","WZRK_FETCH","WEBPUSH_CONFIG","SYSTEM_EVENTS","isString","input","String","isObject","Object","prototype","toString","call","isDateObject","Date","isObjectEmpty","obj","prop","hasOwnProperty","isConvertibleToNumber","n","isNaN","parseFloat","isFinite","isNumber","test","isValueValid","value","undefined","removeUnsupportedChars","o","logger","key","sanitizedVal","sanitizedKey","sanitize","length","substring","reportError","val","regex","replace","getToday","today","getFullYear","getMonth","getDay","getNow","Math","floor","getTime","convertToWZRKDate","dateObj","round","setDate","dt","isDateValid","date","matches","exec","d","m","y","composedDate","getDate","StorageManager","save","_isLocalStorageSupported","localStorage","setItem","JSON","stringify","read","data","getItem","parse","e","remove","removeItem","removeCookie","name","domain","cookieStr","document","cookie","createCookie","seconds","expires","domainStr","setTime","toGMTString","encodeURIComponent","readCookie","nameEQ","ca","split","idx","c","charAt","indexOf","decodeURIComponent","window","saveToLSorCookie","property","location","hostname","$ct","globalCache","readFromLSorCookie","trim","err","createBroadCookie","broadDomain","domainParts","testBroadDomain","testCookieName","tempCookie","getMetaProp","metaObj","setMetaProp","wzrkMetaObj","getAndClearMetaProp","setInstantDeleteFlagInK","k","flag","backupEvent","reqNo","backupArr","q","debug","removeBackup","respNo","backupMap","gcookie","REQ_N","RESP_N","globalProfileMap","globalEventsMap","blockRequest","isOptInRequest","webPushEnabled","campaignDivMap","currentSessionId","wiz_counter","notifApi","notifEnabledFromApi","unsubGroups","updatedCategoryLong","inbox","isPrivacyArrPushed","privacyArray","offline","dismissSpamControl","globalUnsubscribe","flutterVersion","variableStore","pushConfig","LRUCache","max","lruCache","tempLruCache","cache","entry","push","get","item","saveCacheToLS","set","allKeys","objToArray","index","temp","getKey","getSecondLastKey","keysArr","getLastKey","keysLength","newCache","indexToDelete","splice","CleverTapAPI","request","device","session","s","global","resume","respNumber","optOutResponse","oulReq","newGuid","isOULInProgress","oulReqN","sessionObj","getSessionCookieObject","kIdFromLS","guidFromLRUCache","lastK","lastGUID","unregisterTokenForGuid","manageSession","t","setSessionCookieObject","processingBackup","processBackupEvents","DeviceManager","getGuid","guid","error","DATA_NOT_SENT_TEXT","CLEVERTAP_ERROR_PREFIX","EMBED_ERROR","EVENT_ERROR","GENDER_ERROR","EMPLOYED_ERROR","MARRIED_ERROR","EDUCATION_ERROR","AGE_ERROR","DOB_ERROR","ENUM_FORMAT_ERROR","PHONE_FORMAT_ERROR","_globalChargedId","isEventStructureFlat","eventObj","Array","isArray","isChargedEventStructureValid","chargedObj","itemKey","chargedId","EventHandler","values","isPersonalisationActive","eventsArr","_processOldValues","getDetails","evtName","evtObj","respObj","firstTime","lastTime","count","eventName","shift","includes","type","unshift","evtData","processEvent","getURLParams","url","urlParams","uri","match","pl","search","decode","replacement","getDomain","a","createElement","href","addToURL","v","getHostName","urlBase64ToUint8Array","base64String","padding","repeat","base64","rawData","atob","processedData","i","charCodeAt","Uint8Array","compressData","dataObject","compressToBase64","compress","uncompressed","context_dictionary","context_dictionaryToCreate","context_c","context_wc","context_w","context_enlargeIn","context_dictSize","context_numBits","context_data_string","context_data_val","context_data_position","ii","f","fromCharCode","pow","getKeyStr","_keyStr","output","chr1","chr2","chr3","enc1","enc2","enc3","enc4","NaN","RequestDispatcher","networkRetryCount","minDelayFrequency","fireRequest","skipARP","sendOULFlag","getDelayFrequency","account","randomDelay","random","skipResARP","_arp","pageLoadUrl","useIP","slice","tries","setTimeout","clevertap","wizrocket","plugin","ctCbScripts","getElementsByClassName","parentNode","removeChild","setAttribute","async","getElementsByTagName","appendChild","getCampaignObject","finalcampObj","campObj","wp","saveCampaignObject","campaignObj","newObj","setCampaignObjectForGuid","guidCampObj","finalCampObj","keys","forEach","campKeyObj","globalObj","dailyObj","campaignIdArray","resultObj","dailyC","totalC","campaignId","console","getCampaignObjForLc","storageValue","decodedValue","parsedValue","resultObjWP","resultObjWI","wi","todayCwp","todayCwi","tc","wmp","wimp","tlc","witlc","isProfileValid","profileObj","valid","profileKey","profileVal","Age","Phone","processFBUserObj","user","profileData","Name","FBID","gender","Gender","getHighestEducation","eduArr","college","highschool","edu","relationship_status","Married","education","Education","work","Employed","email","Email","birthday","mmddyy","DOB","processGPlusUserObj","displayName","GPID","image","isDefault","Photo","emails","emailIdx","emailObj","organizations","orgObj","yyyymmdd","relationshipStatus","addToLocalProfileMap","override","_custom","closeIframe","divIdIgnored","sessionCampaignObj","divId","getElementById","style","display","arp","jsonMap","isOULARP","arpFromStorage","setEnum","enumVal","handleEmailSubscription","subscription","reEncoded","fetchGroups","urlParamsAsIs","encodedEmailId","encodedProfileProps","p","pageType","page_type","ProfileHandler","profilesArr","getAttribute","propName","_handleIncrementDecrementValue","command","tz","profile","addSystemDataToObject","addFlags","compressedData","saveAndFireRequest","_handleMultiValueSet","arrayVal","array","toLowerCase","sendMultiValueData","_handleMultiValueAdd","propKey","propVal","existingValue","addValue","normalizedValue","_handleMultiValueRemove","removeValue","_handleMultiValueDelete","profileArr","outerObj","Site","Facebook","FbProfileObj","GPlusProfileObj","UserLoginHandler","clear","addToK","ids","g","kId","anonymousUser","foundInCache","gFromCache","Identity","cookieName","loginArr","pop","processProfile","CTWebPopupImageOnly","HTMLElement","_target","_session","shadow","popup","container","resizeObserver","attachShadow","mode","target","renderImageOnlyPopup","msgId","wzrk_id","pivotId","wzrk_pivot","onClickUrl","sessionId","innerHTML","getImageOnlyPopupContent","shadowRoot","closeIcon","addEventListener","updateImageAndContainerWidth","ResizeObserver","handleResize","observe","unobserve","renderNotificationViewed","open","parent","renderNotificationClicked","width","getRenderedImageWidth","setProperty","msgContent","css","html","visibility","img","ratio","naturalWidth","naturalHeight","height","Message","config","message","wrapper","snackBar","renderMessage","createEl","part","_el","msg","templateType","prepareBasicMessage","timeStamp","determineTimeStampText","viewed","unreadMarker","imageUrl","imageContainer","addImage","iconTitleDescWrapper","iconUrl","iconContainer","titleDescWrapper","title","innerText","description","buttons","buttonsContainer","addButtons","hasCopyAction","b","button","text","cssText","action","addSnackbar","greenTickSvg","clipboardMsg","raiseClickedEvent","path","isPreview","raiseClickedForBasicTemplates","payload","tagName","kv","wzrk_c2a","openUrlInNewTab","focus","navigator","clipboard","writeText","clipboardText","log","messageStyles","backgroundColor","borderColor","titleColor","descriptionColor","buttonColor","buttonTextColor","unreadMarkerColor","inboxContainerStyles","panelBackgroundColor","panelBorderColor","headerBackgroundColor","headerTitleColor","closeIconColor","categoriesTabColor","categoriesTitleColor","categoriesBorderColor","selectedCategoryTabColor","selectedCategoryTitleColor","selectedCategoryBorderColor","headerCategoryHeight","Inbox","isInboxOpen","isInboxFromFlutter","selectedCategory","unviewedMessages","unviewedCounter","inboxConfigForPreview","inboxSelector","emptyInboxMsg","inboxCard","unviewedBadge","observer","selectedCategoryRef","addClickListenerOnDocument","composedPath","toggleInbox","startsWith","prevCategoryRef","updateActiveCategory","_path","filter","messageEl","contains","setBadgeStyle","msgCount","incomingMessages","msgs","updateInboxMessages","incomingMessagesForPreview","previewMsgs","now","buildUIForMessages","updateUnviewedBadgeCounter","connectedCallback","init","styles","notificationsBadge","addUnviewedBadge","createinbox","removeEventListener","categories","getInboxStyles","addMsgsToInboxFromLS","messages","deleteExpiredAndGetUnexpiredMsgs","msgIds","deleteMsgsFromUI","getInboxMessages","wzrk_ttl","el","sort","reduce","acc","saveInboxMessages","inboxMsgs","incomingMsgs","textColor","body","updateUnviewedBadgePosition","top","right","getBoundingClientRect","left","header","headerTitle","createCategories","options","root","rootMargin","threshold","IntersectionObserver","entries","handleMessageViewed","categoriesContainer","leftArrow","arrowSvg","children","scrollBy","categoriesWrapper","_categories","category","rightArrow","firstCategory","lastCategory","firstCategoryObserver","categoryObserverCb","intersectionRatio","lastCategoryObserver","hide","activeCategory","scrollTop","counter","childNodes","updateTSForRenderedMsgs","maxMsgsInInbox","firstChild","sortedMsgs","map","tags","insertBefore","msgTotalCount","querySelectorAll","ctInboxMsgs","hasMessages","raiseViewedEvent","isIntersecting","updateMessageInLS","rect","zIndex","scrollLeft","scrollWidth","setInboxPosition","windowWidth","outerWidth","customInboxStyles","getComputedStyle","getPropertyValue","bottom","hasPositionDefined","res","getInboxPosition","clientHeight","clientWidth","xPos","yPos","ts","headerHeight","categoriesHeight","tabColor","selectedTab","inboxStyles","cardStyles","cards","msgStyles","processWebInboxSettings","webInboxSetting","_settings","processInboxNotifs","inbox_preview","inbox_notifs","addWebInbox","checkAndRegisterWebInboxElements","getAndMigrateInboxMessages","gudInboxObj","storedInboxObj","initializeWebInbox","Promise","resolve","reject","readyState","onLoaded","setInterval","clearInterval","customElements","define","inboxHeight","inboxWidth","horizontalScroll","scrollingElement","verticalScroll","innerWidth","windowHeight","innerHeight","selectorRect","selectorX","x","selectorY","selectorLeft","selectorRight","selectorTop","selectorBottom","selectorHeight","selectorWidth","selectorCenter","halfOfInboxHeight","halfOfInboxWidth","inboxOnSide","availableHeight","inboxRight","availableWidth","inboxLeft","diff","hasWebInboxSettingsInLS","OVERLAY_PATH","CSS_PATH","WVE_CLASS","FLICKER_SHOW","FLICKER_HIDE","FLICKER_ID","updateFormData","element","formStyle","underline","curTextDecoration","textDecoration","clickDetails","clickUrl","onclick","newTab","raiseNotificationClicked","imgURL","src","elementCss","head","checkBuilder","parentWindow","opener","handleMessageEvent","postMessage","originUrl","sdkVersion","event","isValidUrl","msgOrigin","URL","origin","evtMaster","personalisation","initialiseCTBuilder","variant","details","renderVisualBuilder","onContentLoad","contentLoaded","isShopify","Shopify","documentElement","position","overlayPath","loadOverlayScript","then","catch","loadCSS","link","rel","script","onload","Overlay","Error","onerror","targetingMsgJson","notificationViewed","raiseViewed","processElement","selector","outerHTML","json","dispatchJsonData","msgCTkv","wzrk_selector","form","tryFindingElement","intervalId","retryElement","querySelector","selectorData","inaObj","kvPairsEvent","CustomEvent","detail","dispatchEvent","string","Boolean","_err","addAntiFlicker","antiFlicker","personalizedSelectors","delayTime","retryElements","retryCount","retryInterval","isInViewport","styleContent","styleId","styleElement","textContent","applyAntiFlicker","selectors","processSelectors","selectorElements","elements","matchedElements","applyStyles","retryProcessing","classList","add","observeUrlChange","previousHref","MutationObserver","childList","subtree","CTWebPersonalisationBanner","_details","renderBanner","getBannerContent","trackClick","onClick","divHeight","desktopImageURL","mobileImageURL","CTWebPersonalisationCarousel","_carousel","slides","previouslySelectedItem","selectedItem","autoSlide","stopAutoSlideTimeout","renderCarousel","getStyles","carousel","getCarouselContent","showNavBtns","insertAdjacentHTML","navBtnsHtml","showNavArrows","leftNavArrowHtml","rightNavArrowHtml","setupClick","updateSelectedItem","startAutoSlide","setupOnHover","eventID","selected","endsWith","goToNext","goToPrev","wzrk_slideNo","clearTimeout","banner","navBtnsCss","navArrowsCss","prevItem","prevButton","sliderTime","goTo","prev","cur","renderPersonalisationBanner","divSelector","bannerEl","containerEl","renderPersonalisationCarousel","handleKVpairCampaign","invokeExternalJs","jsFunc","func","appendScriptForCustomEvent","staleDataUpdate","staledata","campType","mergeEventMap","newEvtMap","oldEvtObj","newEvtObj","incrementImpression","_request","setupClickEvent","contentDiv","isLegacy","_device","ctaElement","jsCTAElements","preview","getCookieParams","rValue","searchParams","notifications","skipDialog","scookieObj","renderPopUpImageOnly","popupImageOnly","getBoxPromptStyles","totalBorderWidth","card","borderEnabled","border","borderWidth","cardPadding","cardContentWidth","overlay","color","borderRadius","primaryButton","secondaryButton","getBellIconStyles","NotificationHandler","displayArgs","enable","swPath","enablePush","setUpWebPushNotifications","subscriptionCallback","serviceWorkerPath","apnsWebPushId","apnsServiceUrl","userAgent","setApplicationServerKey","applicationServerKey","_enableWebPush","enabled","safari","pushNotification","requestPermission","permission","subscriptionData","endpoint","deviceToken","browser","registerToken","info","registrationScope","serviceWorker","register","registration","__wzrk_account_id","scope","rootDirRegex","isServiceWorkerAtRoot","ready","getRegistrations","serviceWorkerRegistration","subscribeObj","userVisibleOnly","pushManager","subscribe","existingBellWrapper","getSubscription","unsubscribe","successful","scriptTag","titleText","bodyText","okButtonText","rejectButtonText","okButtonColor","askAgainTimeInSeconds","okCallback","rejectCallback","httpsPopupPath","httpsIframePath","apnsWebPushServiceUrl","notifObj","isHTTP","protocol","chromeAgent","parseInt","firefoxAgent","safariAgent","Notification","httpsIframe","state","from","wzrkPermissionPopup","wizAlert","confirmButtonText","confirmButtonColor","BELL_BASE64","PROMPT_BELL_BASE64","appServerKey","notificationHandler","processWebPushConfig","webPushConfig","_pushConfig","updatePushConfig","customSwPath","showBox","boxType","showBellIcon","boxConfig","createNotificationBox","bellIconConfig","createBellIcon","createElementWithAttributes","tag","attributes","configData","content","overlayDiv","pnCard","icon","primaryButtonText","secondaryButtonText","setElementPosition","lastNotifTime","popupFrequency","addEventListeners","bellWrapper","bellIcon","gifModal","gifImage","closeModal","hoverText","tooltip","addBellEventListeners","setServerKey","serverKey","removeWrapper","toggleGifModal","displayTooltip","clearTooltip","assign","inset","transform","positions","Center","Top","Bottom","bellRect","midX","midY","_tr","_logger","_wizCounter","doCampHouseKeeping","incrCount","excludeFromFreqCaps","currentCount","totalCount","sessionStorage","campTypeObj","wtarget_type","wmc","wimc","campaignSessionLimit","campaignDailyLimit","campaignTotalLimit","totalDailyLimit","totalSessionLimit","totalInboxSessionLimit","efc","mdc","tdc","campaignSessionCount","totalSessionCount","campaignDailyCount","totalDailyCount","campaignTotalCount","displayObj","delay","campKey","newCampObj","setupClickUrl","handleImageOnlyPopup","msgDiv","isExistingCampaign","testIframe","iframeDocument","contentDocument","contentWindow","createTemplate","isExitIntent","layout","showExitIntent","opacityDivId","opacityElement","isBanner","opacityDiv","opacity","rgbaColor","viewHeight","viewWidth","legacy","marginBottom","contentHeight","bottomPosition","widthPerct","proto","iFrameStyle","iframe","br","frameborder","marginheight","marginwidth","scrolling","pointerCss","sandbox","bgColor","btnBg","leftTd","btColor","theme","descriptionText","imageTd","onClickStr","closeCampaign","Event","srcdoc","adjustIFrameHeight","scrollHeight","margin","ua","inDoc","_timer","renderFooterNotification","_callBackCalled","showFooterNotification","notificationCallback","raiseNotificationViewed","popupCurrentWzrkId","deliveryTrigger","inactive","triggerByInactivity","scroll","triggerByScroll","exitintentObj","onmouseleave","deliveryDelayed","popupCallbacks","popupCallback","wzrkPrefixKey","wzrkJson","raisePopupNotificationClicked","notificationData","eventData","wzrkPrefixObj","targetNotif","IDLE_TIME_THRESHOLD","idleTimer","events","resetIdleTimer","removeEventListeners","eventHandler","setupEventListeners","eventType","passive","calculateScrollPercentage","scrollListener","scrollPercentage","throttledScrollListener","throttle","limit","inThrottle","context","args","apply","targetObj","clientY","intentPreview","intentOpacityDiv","ctaText","processNativeDisplayArr","arrInAppNotifs","elementId","addLoadListener","inapp_notifs","handleInboxNotifications","msgArr","vars","mergeVariables","evpr","eventsMap","profileMap","syncExpiry","expires_in","inapp_stale","inbox_stale","User","getTotalVisits","visitCount","getLastVisit","prevSession","logLevels","DISABLE","ERROR","INFO","DEBUG","DEBUG_PE","Logger","logLevel","wzrkError","debugPE","code","level","WZRK_D","SessionManager","scookieStr","objStr","currentSessionInLS","sessionCount","getTimeElapsed","sessionStart","getPageCount","seqNo","requestTime","RequestManager","fired","ignoreTrim","wzrk_error","pg","af","lib","rc","lastSyncTime","expirySeconds","dsync","givenGUID","post","fetch","method","headers","response","ok","nowTs","evtDetail","Privacy","privacyArr","privacyObj","curr","optOut","shouldUseIP","Variable","defaultValue","hadStarted","valueChangedCallbacks","getValue","getdefaultValue","typeOfDefaultValue","existing","getVariable","varInstance","registerVariable","update","newValue","oldValue","hasVarsRequestCompleted","triggerValueChanged","onValueChanged","addValueChangedCallback","removeValueChangedCallback","clearStartFlag","VariableStore","syncVariables","onSyncSuccess","onSyncFailure","meta","tk","r","status","fetchVariables","onFetchCallback","addVariablesChangedCallback","callback","addOneTimeVariablesChangedCallback","removeVariablesChangedCallback","removeOneTimeVariablesChangedCallback","callBack","CleverTap","spa","isSpa","bind","enablePersonalization","_isPersonalisationActive","shpfyProxyPath","ReqestManager","onUserLogin","privacy","logout","getCleverTapID","getAccountID","getSCDomain","setLibrary","libName","libVersion","setSCSDKVersion","ver","scSDKVersion","scv","getInboxMessageCount","getInboxMessageUnreadCount","getAllInboxMessages","getUnreadInboxMessages","getInboxMessageForId","messageId","deleteInboxMessage","markReadInboxMessage","unreadMsg","markReadInboxMessagesForIds","messageIds","markReadAllInboxMessage","processNotificationEvent","eventDetail","setLogLevel","l","Number","handleIncrementValue","handleDecrementValue","setMultiValuesForKey","addMultiValueForKey","addMultiValuesForKey","removeMultiValueForKey","removeMultiValuesForKey","removeValueForKey","_handleEmailSubscription","getLocation","lat","lng","Latitude","Longitude","geolocation","getCurrentPosition","showPosition","showError","coords","latitude","longitude","PERMISSION_DENIED","POSITION_UNAVAILABLE","TIMEOUT","UNKNOWN_ERROR","api","enableWebPush","tr","is_onloadcalled","subEmail","getEmail","withGroups","unSubEmail","unsubEmailGroups","isUnsubscribed","checked","setSubscriptionGroups","getSubscriptionGroups","changeSubscriptionGroups","updatedGroups","isGlobalUnsubscribe","setIsGlobalUnsubscribe","setUpdatedCategoryLong","$CLTP_WR","$WZRK_WR","currLocation","wzrk_ex","pageChanged","backupInterval","pgCount","referrerDomain","referrer","maxLen","utmSource","utm_source","wzrk_source","us","utmMedium","utm_medium","wzrk_medium","um","utmCampaign","utm_campaign","wzrk_campaign","uc","wm","cpg","setOffline","arg","getSDKVersion","defineVariable","timeout","debouncedPageChanged","wzrk_d","ping","Clevertap"],"mappings":";;;;;;;;;;;;;;;;;;;;EAAO,MAAMA,aAAa,GAAG,oBAAtB;EACA,MAAMC,eAAe,GAAG,QAAxB;EACA,MAAMC,cAAc,GAAG,KAAvB;;;;;;;;;;;;ECAQ,MAAMC,OAAN,CAAc;EAO3BC,EAAAA,W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,GAAGzD,QAAQ,CAACyD,WAAD,EAAc,GAAd,EAAmBkI,cAAnB,CAAtB;;EAEA,4DAAcC,kBAAd,CAAiCnI,WAAjC,EAA8CrN,GAAG,CAACgC,YAAlD;EACD;;QC9yBG0L,SAAS,GAAG,IAAIknC,SAAJ,CAAcj1C,MAAM,CAAC+N,SAArB;EAElB/N,MAAM,CAAC+N,SAAP,GAAmB/N,MAAM,CAACgO,SAAP,GAAmBD,SAAtC;;;;;;;;"} \ No newline at end of file diff --git a/clevertap.min.js b/clevertap.min.js index 161cae5..6dc7ef3 100644 --- a/clevertap.min.js +++ b/clevertap.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).clevertap=t()}(this,(function(){"use strict";var e=0;function t(t){return"__private_"+e+++"_"+t}function i(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}const o="clevertap-prod.com",n="https:";var s=t("accountId"),r=t("region"),a=t("targetDomain"),l=t("dcSdkversion"),d=t("token");class c{constructor(){let{id:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";Object.defineProperty(this,s,{writable:!0,value:void 0}),Object.defineProperty(this,r,{writable:!0,value:""}),Object.defineProperty(this,a,{writable:!0,value:o}),Object.defineProperty(this,l,{writable:!0,value:""}),Object.defineProperty(this,d,{writable:!0,value:""}),this.id=e,t&&(this.region=t),i&&(this.targetDomain=i),n&&(this.token=n)}get id(){return i(this,s)[s]}set id(e){i(this,s)[s]=e}get region(){return i(this,r)[r]}set region(e){i(this,r)[r]=e}get dcSDKVersion(){return i(this,l)[l]}set dcSDKVersion(e){i(this,l)[l]=e}get targetDomain(){return i(this,a)[a]}set targetDomain(e){i(this,a)[a]=e}get token(){return i(this,d)[d]}set token(e){i(this,d)[d]=e}get finalTargetDomain(){return this.region?"".concat(this.region,".").concat(this.targetDomain):this.targetDomain===o?"".concat("eu1",".").concat(this.targetDomain):this.targetDomain}get dataPostPEURL(){return"".concat(n,"//").concat(this.finalTargetDomain,"/defineVars")}get dataPostURL(){return"".concat(n,"//").concat(this.finalTargetDomain,"/a?t=96")}get recorderURL(){return"".concat(n,"//").concat(this.finalTargetDomain,"/r?r=1")}get emailURL(){return"".concat(n,"//").concat(this.finalTargetDomain,"/e?r=1")}}const u=new RegExp("^\\s+|\\.|:|\\$|'|\"|\\\\|\\s+$","g"),h=new RegExp("^\\s+|'|\"|\\\\|\\s+$","g"),p=new RegExp("'","g"),g="clear",f="Charged ID",b="WZRK_CHARGED_ID",v="WZRK_G",m="WZRK_K",y="WZRK_CAMP",w="WZRK_CAMP_G",C="WZRK_EV",k="WZRK_META",x="WZRK_PR",I="WZRK_ARP",M="WZRK_L",P="global",S="optOut",O="useIP",E="WZRK_X",_="push",A=31536e3,D="wzrk_",L="wzrk_id",T="Notification Viewed",z="Notification Clicked",j="WZRK_FPU",N="WZRK_PSD",R="$incr",B="$add",U="$remove",F="$delete",V="WZRK_INBOX_CONFIG",W="WZRK_INBOX",q=1e3,G="wzrk_fetch",H="WZRK_PUSH_CONFIG",K=["Stayed","UTM Visited","App Launched","Notification Sent",T,z],Z=e=>"string"==typeof e||e instanceof String,J=e=>"[object Object]"===Object.prototype.toString.call(e),Q=e=>"object"==typeof e&&e instanceof Date,Y=e=>{for(const t in e)if(e.hasOwnProperty(t))return!1;return!0},$=e=>!isNaN(parseFloat(e))&&isFinite(e),X=e=>/^-?[\d.]+(?:e-?\d+)?$/.test(e)&&"number"==typeof e,ee=e=>null!=e&&"undefined"!==e,te=(e,t)=>{if("object"!=typeof e){let i;return Z(e)?(i=ie(e,h),i.length>1024&&(i=i.substring(0,1024),t.reportError(521,i+"... length exceeded 1024 chars. Trimmed."))):i=e,i}for(const i in e)if(e.hasOwnProperty(i)){const o=te(e[i],t);let n;n=ie(i,u),n.length>1024&&(n=n.substring(0,1024),t.reportError(520,n+"... length exceeded 1024 chars. Trimmed.")),delete e[i],e[n]=o}return e},ie=(e,t)=>e.replace(t,""),oe=()=>{const e=new Date;return e.getFullYear()+""+e.getMonth()+e.getDay()},ne=()=>Math.floor((new Date).getTime()/1e3),se=e=>"$D_"+Math.round(e.getTime()/1e3),re=e=>{if(ae(e))return"$D_"+e},ae=e=>{const t=/^(\d{4})(\d{2})(\d{2})$/.exec(e);if(null==t)return!1;const i=t[3],o=t[2]-1,n=t[1],s=new Date(n,o,i);return s.getDate()==i&&s.getMonth()==o&&s.getFullYear()==n};class le{static save(e,t){return!(!e||!t)&&(this._isLocalStorageSupported()?(localStorage.setItem(e,"string"==typeof t?t:JSON.stringify(t)),!0):void 0)}static read(e){if(!e)return!1;let t=null;if(this._isLocalStorageSupported()&&(t=localStorage.getItem(e)),null!=t)try{t=JSON.parse(t)}catch(e){}return t}static remove(e){return!!e&&(this._isLocalStorageSupported()?(localStorage.removeItem(e),!0):void 0)}static removeCookie(e,t){let i=e+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT;";t&&(i=i+" domain="+t+"; path=/"),document.cookie=i}static createCookie(e,t,i,o){let n="",s="";if(i){const e=new Date;e.setTime(e.getTime()+1e3*i),n="; expires="+e.toGMTString()}o&&(s="; domain="+o),t=encodeURIComponent(t),document.cookie=e+"="+t+n+s+"; path=/"}static readCookie(e){const t=e+"=",i=document.cookie.split(";");for(let e=0;e=0;o--){if(a=0===o?r[o]+a:"."+r[o]+a,this.readCookie(e)){var n="test_"+e+o;if(this.createCookie(n,t,10,a),!this.readCookie(n))continue;this.removeCookie(n,a)}this.createCookie(e,t,i,a);if(this.readCookie(e)==t){s=a,de.broadDomain=s;break}}}else this.createCookie(e,t,i,s)}else this.createCookie(e,t,i,o)}static getMetaProp(e){const t=this.readFromLSorCookie(k);if(null!=t)return t[e]}static setMetaProp(e,t){if(this._isLocalStorageSupported()){let i=this.readFromLSorCookie(k);null==i&&(i={}),void 0===t?delete i[e]:i[e]=t,this.saveToLSorCookie(k,i)}}static getAndClearMetaProp(e){const t=this.getMetaProp(e);return this.setMetaProp(e,void 0),t}static setInstantDeleteFlagInK(){let e=this.readFromLSorCookie(m);null==e&&(e={}),e.flag=!0,this.saveToLSorCookie(m,e)}static backupEvent(e,t,i){let o=this.readFromLSorCookie(M);void 0===o&&(o={}),o[t]={q:e},this.saveToLSorCookie(M,o),i.debug("stored in ".concat(M," reqNo : ").concat(t," -> ").concat(e))}static removeBackup(e,t){const i=this.readFromLSorCookie(M);null!=i&&void 0!==i[e]&&(t.debug("del event: ".concat(e," data-> ").concat(i[e].q)),delete i[e],this.saveToLSorCookie(M,i))}}const de={globalCache:{gcookie:null,REQ_N:0,RESP_N:0},LRU_CACHE:null,globalProfileMap:void 0,globalEventsMap:void 0,blockRequest:!1,isOptInRequest:!1,broadDomain:null,webPushEnabled:null,campaignDivMap:{},currentSessionId:null,wiz_counter:0,notifApi:{notifEnabledFromApi:!1},unsubGroups:[],updatedCategoryLong:null,inbox:null,isPrivacyArrPushed:!1,privacyArray:[],offline:!1,location:null,dismissSpamControl:!1,globalUnsubscribe:!0,flutterVersion:null,variableStore:{},pushConfig:null};var ce=t("keyOrder"),ue=t("deleteFromObject");class he{constructor(e){Object.defineProperty(this,ue,{value:pe}),Object.defineProperty(this,ce,{writable:!0,value:void 0}),this.max=e;let t=le.readFromLSorCookie(E);if(t){const e={};i(this,ce)[ce]=[],t=t.cache;for(const o in t)t.hasOwnProperty(o)&&(e[t[o][0]]=t[o][1],i(this,ce)[ce].push(t[o][0]));this.cache=e}else this.cache={},i(this,ce)[ce]=[]}get(e){const t=this.cache[e];return t&&(this.cache=i(this,ue)[ue](e,this.cache),this.cache[e]=t,i(this,ce)[ce].push(e)),this.saveCacheToLS(this.cache),t}set(e,t){const o=this.cache[e],n=i(this,ce)[ce];null!=o?this.cache=i(this,ue)[ue](e,this.cache):n.length===this.max&&(this.cache=i(this,ue)[ue](n[0],this.cache)),this.cache[e]=t,i(this,ce)[ce][i(this,ce)[ce]-1]!==e&&i(this,ce)[ce].push(e),this.saveCacheToLS(this.cache)}saveCacheToLS(e){const t=[],o=i(this,ce)[ce];for(const i in o)if(o.hasOwnProperty(i)){const n=[];n.push(o[i]),n.push(e[o[i]]),t.push(n)}le.saveToLSorCookie(E,{cache:t})}getKey(e){if(null===e)return null;const t=i(this,ce)[ce];for(const i in t)if(t.hasOwnProperty(i)&&this.cache[t[i]]===e)return t[i];return null}getSecondLastKey(){const e=i(this,ce)[ce];return null!=e&&e.length>1?e[e.length-2]:-1}getLastKey(){const e=i(this,ce)[ce].length;if(e)return i(this,ce)[ce][e-1]}}var pe=function(e,t){const o=JSON.parse(JSON.stringify(i(this,ce)[ce])),n={};let s;for(const i in o)o.hasOwnProperty(i)&&(o[i]!==e?n[o[i]]=t[o[i]]:s=i);return o.splice(s,1),i(this,ce)[ce]=JSON.parse(JSON.stringify(o)),n},ge=t("logger"),fe=t("request"),be=t("device"),ve=t("session");class me{constructor(e){let{logger:t,request:o,device:n,session:s}=e;Object.defineProperty(this,ge,{writable:!0,value:void 0}),Object.defineProperty(this,fe,{writable:!0,value:void 0}),Object.defineProperty(this,be,{writable:!0,value:void 0}),Object.defineProperty(this,ve,{writable:!0,value:void 0}),i(this,ge)[ge]=t,i(this,fe)[fe]=o,i(this,be)[be]=n,i(this,ve)[ve]=s}s(e,t,o,n,s){let r=!1,a=!1;if(window.isOULInProgress&&(o||"undefined"!==n&&n===window.oulReqN)&&(window.isOULInProgress=!1,r=!0),void 0===n&&(n=0),le.removeBackup(n,i(this,ge)[ge]),n>de.globalCache.REQ_N)return;if(ee(i(this,be)[be].gcookie)||e&&(a=!0),!ee(i(this,be)[be].gcookie)||o||"boolean"==typeof s){const n=i(this,ve)[ve].getSessionCookieObject();if(window.isOULInProgress||n.s&&t{if(J(e)){for(var t in e)if(e.hasOwnProperty(t)){if(J(e[t])||Array.isArray(e[t]))return!1;Q(e[t])&&(e[t]=se(e[t]))}return!0}return!1},ze=(e,t)=>{if(J(e)){for(var i in e)if(e.hasOwnProperty(i))if("Items"===i){if(!Array.isArray(e[i]))return!1;for(var o in e[i].length>50&&t.reportError(522,"Charged Items exceed 50 limit. Actual count: "+e[i].length),e[i])if(e[i].hasOwnProperty(o)&&(!J(e[i][o])||!Te(e[i][o])))return!1}else{if(J(e[i])||Array.isArray(e[i]))return!1;Q(e[i])&&(e[i]=se(e[i]))}if(Z(e[f])||X(e[f])){const i=e[f]+"";if(void 0===Le&&(Le=le.readFromLSorCookie(b)),void 0!==Le&&Le.trim()===i.trim())return t.error("Duplicate charged Id - Dropped"+e),!1;Le=i,le.saveToLSorCookie(b,i)}return!0}return!1};var je=t("logger"),Ne=t("oldValues"),Re=t("request"),Be=t("isPersonalisationActive"),Ue=t("processEventArray");class Fe extends Array{constructor(e,t){let{logger:o,request:n,isPersonalisationActive:s}=e;super(),Object.defineProperty(this,Ue,{value:Ve}),Object.defineProperty(this,je,{writable:!0,value:void 0}),Object.defineProperty(this,Ne,{writable:!0,value:void 0}),Object.defineProperty(this,Re,{writable:!0,value:void 0}),Object.defineProperty(this,Be,{writable:!0,value:void 0}),i(this,je)[je]=o,i(this,Ne)[Ne]=t,i(this,Re)[Re]=n,i(this,Be)[Be]=s}push(){for(var e=arguments.length,t=new Array(e),o=0;o0;){var t=e.shift();if(!Z(t)){i(this,je)[je].error(Ie);continue}if(t.length>1024&&(t=t.substring(0,1024),i(this,je)[je].reportError(510,t+"... length exceeded 1024 chars. Trimmed.")),K.includes(t)){i(this,je)[je].reportError(513,t+" is a restricted system event. It cannot be used as an event name.");continue}const o={type:"event"};if(o.evtName=ie(t,u),0!==e.length){const n=e.shift();if(J(n)){if("Charged"===t){if(!ze(n,i(this,je)[je])){i(this,je)[je].reportError(511,"Charged event structure invalid. Not sent.");continue}}else if(!Te(n)){i(this,je)[je].reportError(512,t+" event structure invalid. Not sent.");continue}o.evtData=n}else e.unshift(n)}i(this,Re)[Re].processEvent(o)}};const We=e=>{const t={},i=e.indexOf("?");if(i>1){const o=e.substring(i+1);let n;const s=/\+/g,r=/([^&=]+)=?([^&]*)/g,a=function(e){let t=e.replace(s," ");try{t=decodeURIComponent(t)}catch(e){}return t};for(n=r.exec(o);n;)t[a(n[1])]=a(n[2]),n=r.exec(o)}return t},qe=(e,t,i)=>e+"&"+t+"="+encodeURIComponent(i),Ge=()=>window.location.hostname,He=(e,t)=>(t&&"function"==typeof t.debug&&t.debug("dobj:"+e),Ze(e)),Ke=(()=>{let e="",t=0;for(t=0;t<=25;t++)e+=String.fromCharCode(t+65);for(t=0;t<=25;t++)e+=String.fromCharCode(t+97);for(t=0;t<10;t++)e+=t;return e+"+/="})(),Ze=e=>{if(null==e)return"";var t,i,o,n,s,r,a,l="",d=0;for(e=(e=>{if(null==e)return"";let t,i,o,n={},s={},r="",a="",l="",d=2,c=3,u=2,h="",p=0,g=0,f=String.fromCharCode;for(o=0;o>=1}else{for(i=1,t=0;t>=1}d--,0==d&&(d=Math.pow(2,u),u++),delete s[l]}else for(i=n[l],t=0;t>=1;d--,0==d&&(d=Math.pow(2,u),u++),n[a]=c++,l=String(r)}if(""!==l){if(Object.prototype.hasOwnProperty.call(s,l)){if(l.charCodeAt(0)<256){for(t=0;t>=1}else{for(i=1,t=0;t>=1}d--,0==d&&(d=Math.pow(2,u),u++),delete s[l]}else for(i=n[l],t=0;t>=1;d--,0==d&&(d=Math.pow(2,u),u++)}for(i=2,t=0;t>=1;for(;;){if(p<<=1,15==g){h+=f(p);break}g++}return h})(e);d<2*e.length;)d%2==0?(t=e.charCodeAt(d/2)>>8,i=255&e.charCodeAt(d/2),o=d/2+1>8:NaN):(t=255&e.charCodeAt((d-1)/2),(d+1)/2>8,o=255&e.charCodeAt((d+1)/2)):i=o=NaN),d+=3,n=t>>2,s=(3&t)<<4|i>>4,r=(15&i)<<2|o>>6,a=63&o,isNaN(i)?r=a=64:isNaN(o)&&(a=64),l=l+Ke.charAt(n)+Ke.charAt(s)+Ke.charAt(r)+Ke.charAt(a);return l};var Je=t("fireRequest"),Qe=t("dropRequestDueToOptOut"),Ye=t("addUseIPToRequest"),$e=t("addARPToRequest");class Xe{constructor(){this.networkRetryCount=0,this.minDelayFrequency=0}static fireRequest(e,t,o,n){i(this,Je)[Je](e,1,t,o,n)}getDelayFrequency(){if(this.logger.debug("Network retry #"+this.networkRetryCount),this.networkRetryCount<10)return this.logger.debug(this.account.id,"Failure count is "+this.networkRetryCount+". Setting delay frequency to 1s"),this.minDelayFrequency=q,this.minDelayFrequency;if(null==this.account.region)return this.logger.debug(this.account.id,"Setting delay frequency to 1s"),q;{const e=1e3*(Math.floor(10*Math.random())+1);return this.minDelayFrequency+=e,this.minDelayFrequency<6e5?(this.logger.debug(this.account.id,"Setting delay frequency to "+this.minDelayFrequency),this.minDelayFrequency):(this.minDelayFrequency=q,this.logger.debug(this.account.id,"Setting delay frequency to "+this.minDelayFrequency),this.minDelayFrequency)}}}Xe.logger=void 0,Xe.device=void 0,Xe.account=void 0,Object.defineProperty(Xe,Je,{value:function(e,t,o,n,s){var r,a;if(i(this,Qe)[Qe]())return void this.logger.debug("req dropped due to optout cookie: "+this.device.gcookie);if(ee(this.device.gcookie)||(de.blockRequest=!0),s&&s===G)!ee(this.device.gcookie)&&de.globalCache.RESP_N{this.logger.debug("retrying fire request for url: ".concat(e,", tries: ").concat(this.networkRetryCount)),i(this,Je)[Je](e,void 0,o,n)}),this.getDelayFrequency());else if(!ee(this.device.gcookie)&&de.globalCache.RESP_N{this.logger.debug("retrying fire request for url: ".concat(e,", tries: ").concat(t)),i(this,Je)[Je](e,t+1,o,n)}),50);if(n?window.isOULInProgress=!0:(ee(this.device.gcookie)&&(e=qe(e,"gc",this.device.gcookie)),e=i(this,$e)[$e](e,o)),e=qe(e,"tries",t),e=i(this,Ye)[Ye](e),e=qe(e,"r",(new Date).getTime()),(null===(r=window.clevertap)||void 0===r?void 0:r.hasOwnProperty("plugin"))||(null===(a=window.wizrocket)||void 0===a?void 0:a.hasOwnProperty("plugin"))){const t=window.clevertap.plugin||window.wizrocket.plugin;e=qe(e,"ct_pl",t)}-1!==e.indexOf("chrome-extension:")&&(e=e.replace("chrome-extension:","https:"));for(var l=document.getElementsByClassName("ct-jp-cb");l[0]&&l[0].parentNode;)l[0].parentNode.removeChild(l[0]);const d=document.createElement("script");d.setAttribute("type","text/javascript"),d.setAttribute("src",e),d.setAttribute("class","ct-jp-cb"),d.setAttribute("rel","nofollow"),d.async=!0,document.getElementsByTagName("head")[0].appendChild(d),this.logger.debug("req snt -> url: "+e)}}),Object.defineProperty(Xe,Qe,{value:function(){return!de.isOptInRequest&&ee(this.device.gcookie)&&Z(this.device.gcookie)?":OO"===this.device.gcookie.slice(-3):(de.isOptInRequest=!1,!1)}}),Object.defineProperty(Xe,Ye,{value:function(e){var t=le.getMetaProp(O);return"boolean"!=typeof t&&(t=!1),qe(e,O,t?"true":"false")}}),Object.defineProperty(Xe,$e,{value:function(e,t){if(!0===t){const t={skipResARP:!0};return qe(e,"arp",He(JSON.stringify(t),this.logger))}return le._isLocalStorageSupported()&&void 0!==localStorage.getItem(I)&&null!==localStorage.getItem(I)?qe(e,"arp",He(JSON.stringify(le.readFromLSorCookie(I)),this.logger)):e}});const et=()=>{let e={};if(le._isLocalStorageSupported()){let t=le.read(y);null!=t?(t=JSON.parse(decodeURIComponent(t).replace(p,'"')),t.hasOwnProperty("global")?e.wp=t:e=t):e={}}return e},tt=e=>{if(le._isLocalStorageSupported()){const t={...et(),...e},i=JSON.stringify(t);le.save(y,encodeURIComponent(i)),it()}},it=()=>{if(le._isLocalStorageSupported()){let i=le.read(v);if(ee(i))try{i=JSON.parse(decodeURIComponent(le.read(v)));const o=le.read(w)?JSON.parse(decodeURIComponent(le.read(w))):{};if(i&&le._isLocalStorageSupported()){var e={},t=et();Object.keys(t).forEach((n=>{const s=i in o&&Object.keys(o[i]).length&&o[i][n]?o[i][n]:{},r=t[n].global,a=oe(),l=t[n][a];if(void 0!==r){const e=Object.keys(r);for(const t in e){let i=[];if(e.hasOwnProperty(t)){let o=0,n=0;const a=e[t];if("tc"===a)continue;void 0!==l&&void 0!==l[a]&&(o=l[a]),void 0!==r&&void 0!==r[a]&&(n=r[a]),i=[a,o,n],s[a]=i}}}e={...e,[n]:s}})),o[i]=e,le.save(w,encodeURIComponent(JSON.stringify(o)))}}catch(e){console.error("Invalid clevertap Id "+e)}}},ot=()=>{const e=JSON.parse(decodeURIComponent(le.read(v)));let t={};if(le._isLocalStorageSupported()){let i={};t=et();const o=le.read(w),n=o?decodeURIComponent(o):null,s=n?JSON.parse(n):null,r=e&&null!=o&&s&&s[e]&&s[e].wp?Object.values(s[e].wp):[],a=e&&null!=o&&s&&s[e]&&s[e].wi?Object.values(s[e].wi):[],l=oe();let d=0,c=0;return t.wp&&t.wp[l]&&"undefined"!==t.wp[l].tc&&(d=t.wp[l].tc),t.wi&&t.wi[l]&&"undefined"!==t.wi[l].tc&&(c=t.wi[l].tc),i={wmp:d,wimp:c,tlc:r,witlc:a},i}},nt=(e,t)=>{let{logger:i}=t,o=!1;if(J(e))for(const t in e)if(e.hasOwnProperty(t)){o=!0;let n=e[t];if(null==n){delete e[t];continue}"Gender"!==t||n.match(/\b(?:[mM](?:ale)?|[fF](?:emale)?|[oO](?:thers)?|[uU](?:nknown)?)\b/)||(o=!1,i.error(Me)),"Employed"!==t||n.match(/^Y$|^N$/)||(o=!1,i.error(Pe)),"Married"!==t||n.match(/^Y$|^N$/)||(o=!1,i.error(Se)),"Education"!==t||n.match(/^School$|^College$|^Graduate$/)||(o=!1,i.error(Oe)),"Age"===t&&null!=n&&($(n)?e.Age=+n:(o=!1,i.error(Ee))),"DOB"===t?(/^\$D_/.test(n)&&11===(n+"").length||Q(n)||(o=!1,i.error(_e)),Q(n)&&(e[t]=se(n))):Q(n)&&(e[t]=se(n)),"Phone"!==t||Y(n)||(n.length>8&&"+"===n.charAt(0)?(n=n.substring(1,n.length),$(n)?e.Phone=+n:(o=!1,i.error(De+". Removed."))):(o=!1,i.error(De+". Removed."))),o||delete e[t]}return o},st=e=>{const t={};t.Name=e.name,null!=e.id&&(t.FBID=e.id+""),"male"===e.gender?t.Gender="M":"female"===e.gender?t.Gender="F":t.Gender="O";null!=e.relationship_status&&(t.Married="N","Married"===e.relationship_status&&(t.Married="Y"));const i=function(e){if(null!=e){let t="",i="";for(let o=0;o0?"Y":"N",null!=e.email&&(t.Email=e.email),null!=e.birthday){const i=e.birthday.split("/");t.DOB=re(i[2]+i[0]+i[1])}return t},rt=(e,t)=>{let{logger:i}=t;const o={};if(null!=e.displayName&&(o.Name=e.displayName),null!=e.id&&(o.GPID=e.id+""),null!=e.gender&&("male"===e.gender?o.Gender="M":"female"===e.gender?o.Gender="F":"other"===e.gender&&(o.Gender="O")),null!=e.image&&!1===e.image.isDefault&&(o.Photo=e.image.url.split("?sz")[0]),null!=e.emails)for(let t=0;t{if(le._isLocalStorageSupported()){if(null==de.globalProfileMap&&(de.globalProfileMap=le.readFromLSorCookie(x),null==de.globalProfileMap&&(de.globalProfileMap={})),null!=e._custom){const t=e._custom;for(const i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);delete e._custom}for(const i in e)if(e.hasOwnProperty(i)){if(de.globalProfileMap.hasOwnProperty(i)&&!t)continue;de.globalProfileMap[i]=e[i]}null!=de.globalProfileMap._custom&&delete de.globalProfileMap._custom,le.saveToLSorCookie(x,de.globalProfileMap)}},lt=(e,t,i)=>{if(null!=e&&"-1"!==e&&le._isLocalStorageSupported()){const t=et();let o=t.wp[i];null==o&&(o={},t[i]=o),o[e]="dnd",tt(t)}if(null!=de.campaignDivMap){const t=de.campaignDivMap[e];null!=t&&(document.getElementById(t).style.display="none","intentPreview"===t?null!=document.getElementById("intentOpacityDiv")&&(document.getElementById("intentOpacityDiv").style.display="none"):"wizParDiv0"===t?null!=document.getElementById("intentOpacityDiv0")&&(document.getElementById("intentOpacityDiv0").style.display="none"):"wizParDiv2"===t&&null!=document.getElementById("intentOpacityDiv2")&&(document.getElementById("intentOpacityDiv2").style.display="none"))}};var dt=t("logger"),ct=t("request"),ut=t("account"),ht=t("oldValues"),pt=t("isPersonalisationActive"),gt=t("processProfileArray");class ft extends Array{constructor(e,t){let{logger:o,request:n,account:s,isPersonalisationActive:r}=e;super(),Object.defineProperty(this,gt,{value:bt}),Object.defineProperty(this,dt,{writable:!0,value:void 0}),Object.defineProperty(this,ct,{writable:!0,value:void 0}),Object.defineProperty(this,ut,{writable:!0,value:void 0}),Object.defineProperty(this,ht,{writable:!0,value:void 0}),Object.defineProperty(this,pt,{writable:!0,value:void 0}),i(this,dt)[dt]=o,i(this,ct)[ct]=n,i(this,ut)[ut]=s,i(this,ht)[ht]=t,i(this,pt)[pt]=r}push(){for(var e=arguments.length,t=new Array(e),o=0;o{const t="number"==typeof e?e:e.toLowerCase();s.includes(t)||s.push(t)};if(Array.isArray(t))t.forEach((e=>{"string"==typeof e||"number"==typeof e?r(e):i(this,dt)[dt].error("Array supports only string or number type values")}));else{if("string"!=typeof t&&"number"!=typeof t)return void i(this,dt)[dt].error("Unsupported value type");r(t)}de.globalProfileMap[e]=s,le.saveToLSorCookie(x,de.globalProfileMap),this.sendMultiValueData(e,t,o)}_handleMultiValueRemove(e,t,o){if(null==de.globalProfileMap&&(de.globalProfileMap=le.readFromLSorCookie(x)||{}),!de.globalProfileMap.hasOwnProperty(e))return void i(this,dt)[dt].error("The property ".concat(e," does not exist."));const n=t=>{const i=de.globalProfileMap[e].indexOf(t);-1!==i&&de.globalProfileMap[e].splice(i,1)};if(Array.isArray(t))t.forEach(n);else{if("string"!=typeof t&&"number"!=typeof t)return void i(this,dt)[dt].error("Unsupported propVal type");n(t)}0===de.globalProfileMap[e].length&&delete de.globalProfileMap[e],le.saveToLSorCookie(x,de.globalProfileMap),this.sendMultiValueData(e,t,o)}_handleMultiValueDelete(e,t){var o;null==de.globalProfileMap&&(de.globalProfileMap=le.readFromLSorCookie(x)),(null==de||null===(o=de.globalProfileMap)||void 0===o?void 0:o.hasOwnProperty(e))?delete de.globalProfileMap[e]:i(this,dt)[dt].error("The property ".concat(e," does not exist.")),le.saveToLSorCookie(x,de.globalProfileMap),this.sendMultiValueData(e,null,t)}sendMultiValueData(e,t,o){let n={};const s={};n.type="profile",s[e]={[o]:o===F||t},null==s.tz&&(s.tz=(new Date).toString().match(/([A-Z]+[\+-][0-9]+)/)[1]),n.profile=s,n=i(this,ct)[ct].addSystemDataToObject(n,!0),i(this,ct)[ct].addFlags(n);const r=He(JSON.stringify(n),i(this,dt)[dt]);let a=i(this,ut)[ut].dataPostURL;a=qe(a,"type",_),a=qe(a,"d",r),i(this,ct)[ct].saveAndFireRequest(a,de.blockRequest)}}var bt=function(e){if(Array.isArray(e)&&e.length>0)for(const t in e)if(e.hasOwnProperty(t)){const o=e[t];let n,s={};if(null!=o.Site){if(n=o.Site,Y(n)||!nt(n,{logger:i(this,dt)[dt]}))return}else if(null!=o.Facebook){const e=o.Facebook;Y(e)||e.error||(n=st(e))}else if(null!=o["Google Plus"]){const e=o["Google Plus"];Y(e)||e.error||(n=rt(e,{logger:i(this,dt)[dt]}))}if(null!=n&&!Y(n)){s.type="profile",null==n.tz&&(n.tz=(new Date).toString().match(/([A-Z]+[\+-][0-9]+)/)[1]),s.profile=n,at(n,!0),s=i(this,ct)[ct].addSystemDataToObject(s,void 0),i(this,ct)[ct].addFlags(s);const e=He(JSON.stringify(s),i(this,dt)[dt]);let t=i(this,ut)[ut].dataPostURL;t=qe(t,"type",_),t=qe(t,"d",e),i(this,ct)[ct].saveAndFireRequest(t,de.blockRequest)}}},vt=t("request"),mt=t("logger"),yt=t("account"),wt=t("session"),Ct=t("oldValues"),kt=t("device"),xt=t("processOUL"),It=t("handleCookieFromCache"),Mt=t("deleteUser"),Pt=t("processLoginArray");class St extends Array{constructor(e,t){let{request:o,account:n,session:s,logger:r,device:a}=e;super(),Object.defineProperty(this,Pt,{value:At}),Object.defineProperty(this,Mt,{value:_t}),Object.defineProperty(this,It,{value:Et}),Object.defineProperty(this,xt,{value:Ot}),Object.defineProperty(this,vt,{writable:!0,value:void 0}),Object.defineProperty(this,mt,{writable:!0,value:void 0}),Object.defineProperty(this,yt,{writable:!0,value:void 0}),Object.defineProperty(this,wt,{writable:!0,value:void 0}),Object.defineProperty(this,Ct,{writable:!0,value:void 0}),Object.defineProperty(this,kt,{writable:!0,value:void 0}),i(this,vt)[vt]=o,i(this,yt)[yt]=n,i(this,wt)[wt]=s,i(this,mt)[mt]=r,i(this,Ct)[Ct]=t,i(this,kt)[kt]=a}clear(){i(this,mt)[mt].debug("clear called. Reset flag has been set."),i(this,Mt)[Mt](),le.setMetaProp(g,!0)}push(){for(var e=arguments.length,t=new Array(e),o=0;o{let o=le.readFromLSorCookie(m);const n=le.readFromLSorCookie(v);let s;if(null==o)o={},s=e;else{s=o.id;let r=!1,a=!1;if(null==s&&(s=e[0],r=!0),null==de.LRU_CACHE&&le._isLocalStorageSupported()&&(de.LRU_CACHE=new he(100)),r)null!=n&&(de.LRU_CACHE.set(s,n),de.blockRequest=!1);else for(const t in e)if(e.hasOwnProperty(t)){const i=e[t];if(de.LRU_CACHE.cache[i]){s=i,a=!0;break}}if(a){s!==de.LRU_CACHE.getLastKey()?i(this,It)[It]():(t=!1,le.saveToLSorCookie(j,t));const e=de.LRU_CACHE.get(s);de.LRU_CACHE.set(s,e),le.saveToLSorCookie(v,e),i(this,kt)[kt].gcookie=e;const o=de.LRU_CACHE.getSecondLastKey();if(le.readFromLSorCookie(j)&&-1!==o){const e=de.LRU_CACHE.cache[o];i(this,vt)[vt].unregisterTokenForGuid(e)}}else r?null!=n&&(i(this,kt)[kt].gcookie=n,le.saveToLSorCookie(v,n),t=!1):this.clear(),le.saveToLSorCookie(j,!1),s=e[0]}o.id=s,le.saveToLSorCookie(m,o)};if(Array.isArray(e)&&e.length>0)for(const n in e)if(e.hasOwnProperty(n)){const s=e[n];let r,a={};if(null!=s.Site){if(r=s.Site,Y(r)||!nt(r,{logger:i(this,mt)[mt]}))return}else if(null!=s.Facebook){const e=s.Facebook;Y(e)||e.error||(r=st(e))}else if(null!=s["Google Plus"]){const e=s["Google Plus"];Y(e)&&!e.error&&(r=rt(e,{logger:i(this,mt)[mt]}))}if(null!=r&&!Y(r)){a.type="profile",null==r.tz&&(r.tz=(new Date).toString().match(/([A-Z]+[\+-][0-9]+)/)[1]),a.profile=r;const e=[];le._isLocalStorageSupported()&&(r.Identity&&e.push(r.Identity),r.Email&&e.push(r.Email),r.GPID&&e.push("GP:"+r.GPID),r.FBID&&e.push("FB:"+r.FBID),e.length>0&&o(e)),at(r,!0),a=i(this,vt)[vt].addSystemDataToObject(a,void 0),i(this,vt)[vt].addFlags(a),t&&(a.isOUL=!0);const n=He(JSON.stringify(a),i(this,mt)[mt]);let s=i(this,yt)[yt].dataPostURL;s=qe(s,"type",_),s=qe(s,"d",n),i(this,vt)[vt].saveAndFireRequest(s,de.blockRequest,t)}}},Et=function(){de.blockRequest=!1,console.debug("Block request is false"),le._isLocalStorageSupported()&&(delete localStorage.WZRK_PR,delete localStorage.WZRK_EV,delete localStorage.WZRK_META,delete localStorage.WZRK_ARP,delete localStorage.WZRK_CAMP,delete localStorage.WZRK_CHARGED_ID),le.removeCookie(y,Ge()),le.removeCookie(i(this,wt)[wt].cookieName,de.broadDomain),le.removeCookie(I,de.broadDomain),i(this,wt)[wt].setSessionCookieObject("")},_t=function(){de.blockRequest=!0,i(this,mt)[mt].debug("Block request is true"),de.globalCache={gcookie:null,REQ_N:0,RESP_N:0},le._isLocalStorageSupported()&&(delete localStorage.WZRK_G,delete localStorage.WZRK_K,delete localStorage.WZRK_PR,delete localStorage.WZRK_EV,delete localStorage.WZRK_META,delete localStorage.WZRK_ARP,delete localStorage.WZRK_CAMP,delete localStorage.WZRK_CHARGED_ID),le.removeCookie(v,de.broadDomain),le.removeCookie(y,Ge()),le.removeCookie(m,Ge()),le.removeCookie(i(this,wt)[wt].cookieName,de.broadDomain),le.removeCookie(I,de.broadDomain),i(this,kt)[kt].gcookie=null,i(this,wt)[wt].setSessionCookieObject("")},At=function(e){if(Array.isArray(e)&&e.length>0){const t=e.pop();if(null!=t&&J(t)&&(null!=t.Site&&Object.keys(t.Site).length>0||null!=t.Facebook&&Object.keys(t.Facebook).length>0||null!=t["Google Plus"]&&Object.keys(t["Google Plus"]).length>0)){le.setInstantDeleteFlagInK();try{i(this,xt)[xt]([t])}catch(e){i(this,mt)[mt].debug(e)}}else i(this,mt)[mt].error("Profile object is in incorrect format")}};class Dt extends HTMLElement{constructor(){super(),this._target=null,this._session=null,this.shadow=null,this.popup=null,this.container=null,this.resizeObserver=null,this.shadow=this.attachShadow({mode:"open"})}get target(){return this._target||""}set target(e){null===this._target&&(this._target=e,this.renderImageOnlyPopup())}get session(){return this._session||""}set session(e){this._session=e}get msgId(){return this.target.wzrk_id}get pivotId(){return this.target.wzrk_pivot}get onClickUrl(){return this.target.display.onClickUrl}renderImageOnlyPopup(){const e=this.target.wzrk_id.split("_")[0],t=this.session.sessionId;this.shadow.innerHTML=this.getImageOnlyPopupContent(),this.popup=this.shadowRoot.getElementById("imageOnlyPopup"),this.container=this.shadowRoot.getElementById("container"),this.closeIcon=this.shadowRoot.getElementById("close"),this.popup.addEventListener("load",this.updateImageAndContainerWidth()),this.resizeObserver=new ResizeObserver((()=>this.handleResize(this.popup,this.container))),this.resizeObserver.observe(this.popup),this.closeIcon.addEventListener("click",(()=>{if(this.resizeObserver.unobserve(this.popup),document.getElementById("wzrkImageOnlyDiv").style.display="none",this.remove(),null!=e&&"-1"!==e&&le._isLocalStorageSupported()){const i=et();let o=i.wp[t];null==o&&(o={},i[t]=o),o[e]="dnd",tt(i)}})),window.clevertap.renderNotificationViewed({msgId:this.msgId,pivotId:this.pivotId}),this.onClickUrl&&this.popup.addEventListener("click",(()=>{this.target.display.window?window.open(this.onClickUrl,"_blank"):window.parent.location.href=this.onClickUrl,window.clevertap.renderNotificationClicked({msgId:this.msgId,pivotId:this.pivotId})}))}handleResize(e,t){const i=this.getRenderedImageWidth(e);t.style.setProperty("width","".concat(i,"px"))}getImageOnlyPopupContent(){return"\n ".concat(this.target.msgContent.css,"\n ").concat(this.target.msgContent.html,"\n ")}updateImageAndContainerWidth(){return()=>{const e=this.getRenderedImageWidth(this.popup);this.popup.style.setProperty("width","".concat(e,"px")),this.container.style.setProperty("width","".concat(e,"px")),this.container.style.setProperty("height","auto"),this.container.style.setProperty("position","fixed"),this.popup.style.setProperty("visibility","visible"),this.closeIcon.style.setProperty("visibility","visible"),document.getElementById("wzrkImageOnlyDiv").style.visibility="visible"}}getRenderedImageWidth(e){const t=e.naturalWidth/e.naturalHeight;return e.height*t}}class Lt extends HTMLElement{constructor(e,t){super(),this.wrapper=null,this.snackBar=null,this.shadow=this.attachShadow({mode:"open"}),this.config=e,this.message=t,this.renderMessage(t)}get pivotId(){return this.message.wzrk_pivot}get campaignId(){return this.message.wzrk_id}createEl(e,t,i){const o=document.createElement(e);return o.setAttribute("id",t),o.setAttribute("part",i||t),o}renderMessage(e){switch(this.wrapper=this.createEl("div","messageWrapper"),e.templateType){case"text-only":case"text-with-icon":case"text-with-icon-and-image":{const t=this.prepareBasicMessage(e.msg[0]);this.wrapper.appendChild(t)}}const t=this.createEl("div","timeStamp");if(t.innerHTML="".concat(Wt(e.id.split("_")[1]),""),!e.viewed){const e=this.createEl("span","unreadMarker");t.appendChild(e)}this.wrapper.appendChild(t),this.shadow.appendChild(this.wrapper)}prepareBasicMessage(e){const t=this.createEl("div","message");if(e.imageUrl){const i=this.addImage(e.imageUrl,"mainImg");t.appendChild(i)}const i=this.createEl("div","iconTitleDescWrapper");if(e.iconUrl){const t=this.addImage(e.iconUrl,"iconImg");i.appendChild(t)}const o=this.createEl("div","titleDescWrapper");if(e.title){const t=this.createEl("div","title");t.innerText=e.title,o.appendChild(t)}if(e.description){const t=this.createEl("div","description");t.innerText=e.description,o.appendChild(t)}if((e.title||e.description)&&i.appendChild(o),(e.iconUrl||e.title||e.description)&&t.appendChild(i),e.buttons&&e.buttons.length){const i=this.addButtons(e.buttons);t.appendChild(i)}return t}addButtons(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const t=this.createEl("div","buttonsContainer");let i=!1;return e.forEach(((e,o)=>{const n=this.createEl("button","button-".concat(o),"button");n.innerText=e.text,o>0&&(n.style.cssText+="margin-left: 2px;"),"copy"===e.action&&(i=!0),t.appendChild(n)})),i&&this.addSnackbar(t),t}addSnackbar(e){this.snackBar=this.createEl("div","snackbar-".concat(this.campaignId),"snackbar"),this.snackBar.innerHTML=Ht;const t=this.createEl("span","snackbar-msg-".concat(this.campaignId),"snackbar-msg");t.innerText="Copied to clipboard",this.snackBar.appendChild(t),e.appendChild(this.snackBar)}addImage(e,t){const i=this.createEl("div","".concat(t,"Container")),o=this.createEl("img",t);return o.setAttribute("src",e),o.setAttribute("loading","lazy"),i.appendChild(o),i}raiseClickedEvent(e,t){switch(this.message.templateType){case"text-only":case"text-with-icon":case"text-with-icon-and-image":this.raiseClickedForBasicTemplates(e,t)}}raiseClickedForBasicTemplates(e,t){const i=this.message.msg[0],o={msgId:this.campaignId,pivotId:this.pivotId};if("BUTTON"===e.tagName){const t=e.id.split("-")[1],n=i.buttons[t];o.kv={wzrk_c2a:n.text},"url"===n.action?n.openUrlInNewTab?window.open(n.url,"_blank"):window.location=n.url:"copy"===n.action&&(window.focus(),navigator.clipboard.writeText(n.clipboardText),this.snackBar.style.setProperty("display","flex","important"),setTimeout((()=>{this.snackBar.style.setProperty("display","none","important")}),2e3))}else"CT-INBOX-MESSAGE"===e.tagName&&i.onClickUrl&&(i.openUrlInNewTab?window.open(i.onClickUrl,"_blank"):window.location=i.onClickUrl);t?console.log("Notifiction clicked event will be raised at run time with payload ::",o):window.clevertap.renderNotificationClicked(o)}}class Tt extends HTMLElement{constructor(e){super(),this.isInboxOpen=!1,this.isInboxFromFlutter=!1,this.selectedCategory=null,this.unviewedMessages={},this.unviewedCounter=0,this.isPreview=!1,this.inboxConfigForPreview={},this.inboxSelector=null,this.inbox=null,this.emptyInboxMsg=null,this.inboxCard=null,this.unviewedBadge=null,this.observer=null,this.selectedCategoryRef=null,this.addClickListenerOnDocument=(()=>e=>{if(e.composedPath().includes(this.inbox)){const t=e.path||e.composedPath&&e.composedPath();if(t.length){const e=t[0].id;if("closeInbox"===e)this.toggleInbox();else if(e.startsWith("category-"))this.prevCategoryRef=this.selectedCategoryRef,this.selectedCategoryRef=t[0],this.updateActiveCategory(t[0].innerText);else{const e=t.filter((e=>{var t;return(null===(t=e.id)||void 0===t?void 0:t.startsWith("button-"))||"CT-INBOX-MESSAGE"===e.tagName}));if(e.length){e[e.length-1].raiseClickedEvent(e[0],this.isPreview)}}}}else(this.inboxSelector.contains(e.target)||this.isInboxOpen)&&(this.isInboxFromFlutter?this.isInboxFromFlutter=!1:this.toggleInbox(e))})(),this.setBadgeStyle=e=>{null!==this.unviewedBadge&&(this.unviewedBadge.innerText=e>9?"9+":e,this.unviewedBadge.style.display=e>0?"flex":"none")},this.logger=e,this.shadow=this.attachShadow({mode:"open"})}get incomingMessages(){return[]}set incomingMessages(e){void 0===e&&(e=[]),e.length>0&&this.inbox&&this.updateInboxMessages(e)}get incomingMessagesForPreview(){return[]}set incomingMessagesForPreview(e){void 0===e&&(e=[]);const t={};e.length>0&&this.inbox&&(this.isPreview=!0,this.unviewedCounter=0,e.forEach((e=>{const i="".concat(e.wzrk_id.split("_")[0],"_").concat(Date.now());e.id=i,t[i]=e,this.unviewedMessages[i]=e,this.unviewedCounter++})),this.buildUIForMessages(t),this.updateUnviewedBadgeCounter())}connectedCallback(){this.init()}init(){this.config=this.isPreview?this.inboxConfigForPreview:le.readFromLSorCookie(V)||{},0!==Object.keys(this.config).length&&(this.inboxSelector=document.getElementById(this.config.inboxSelector),null!==this.inboxSelector&&(this.config.styles.notificationsBadge?this.addUnviewedBadge():this.unviewedBadge&&this.unviewedBadge.remove(),this.createinbox(),document.removeEventListener("click",this.addClickListenerOnDocument),document.addEventListener("click",this.addClickListenerOnDocument),this.config.categories.length&&this.updateActiveCategory(this.selectedCategoryRef.innerText),this.shadow.innerHTML=this.getInboxStyles(),this.shadow.appendChild(this.inbox)))}addMsgsToInboxFromLS(){const e=this.deleteExpiredAndGetUnexpiredMsgs(!1),t=e?Object.keys(e):[];0!==t.length&&(t.forEach((t=>{e[t].viewed||(this.unviewedMessages[t]=e[t],this.unviewedCounter++)})),this.buildUIForMessages(e),this.updateUnviewedBadgeCounter())}deleteExpiredAndGetUnexpiredMsgs(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=Rt();const i=Math.floor(Date.now()/1e3);for(const o in t)if(t[o].wzrk_ttl&&t[o].wzrk_ttl>0&&t[o].wzrk_ttl0&&(t=Object.values(t).sort(((e,t)=>t.date-e.date)).reduce(((e,t)=>(e[t.id]=t,e)),{})),Bt(t),t}updateInboxMessages(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const t=this.deleteExpiredAndGetUnexpiredMsgs(),i=Date.now(),o={};e.forEach(((e,n)=>{const s="".concat(e.wzrk_id.split("_")[0],"_").concat(Date.now());e.id=s,e.date=i-n,e.viewed=0,t[s]=e,o[s]=e,this.unviewedMessages[s]=e,this.unviewedCounter++})),Bt(t),this.buildUIForMessages(o),this.updateUnviewedBadgeCounter()}createEl(e,t,i){const o=document.createElement(e);return o.setAttribute("id",t),o.setAttribute("part",i||t),o}addUnviewedBadge(){this.unviewedBadge||(this.unviewedBadge=this.createEl("div","unviewedBadge"),this.unviewedBadge.style.cssText="display: none; position: absolute; height: 16px; width: 26px; border-radius: 8px; background-color: ".concat(this.config.styles.notificationsBadge.backgroundColor,"; font-size: 12px; color: ").concat(this.config.styles.notificationsBadge.textColor,"; font-weight: bold; align-items: center; justify-content: center;"),document.body.appendChild(this.unviewedBadge)),this.updateUnviewedBadgePosition(),window.addEventListener("resize",(()=>{this.updateUnviewedBadgePosition()}))}updateUnviewedBadgePosition(){const{top:e,right:t}=this.inboxSelector.getBoundingClientRect();this.unviewedBadge.style.top="".concat(e-8,"px"),this.unviewedBadge.style.left="".concat(t-8,"px")}createinbox(){this.inbox=this.createEl("div","inbox");const e=this.createEl("div","header"),t=this.createEl("div","headerTitle");t.innerText=this.config.title;const i=this.createEl("div","closeInbox");if(i.innerHTML="×",e.appendChild(t),e.appendChild(i),this.inbox.appendChild(e),this.config.categories.length){const e=this.createCategories();this.inbox.appendChild(e)}this.inboxCard=this.createEl("div","inboxCard"),this.inbox.appendChild(this.inboxCard),this.emptyInboxMsg=this.createEl("div","emptyInboxMsg"),this.emptyInboxMsg.innerText="All messages will be displayed here.",this.inboxCard.appendChild(this.emptyInboxMsg);const o={root:this.inboxCard,rootMargin:"0px",threshold:.5};this.observer=new IntersectionObserver(((e,t)=>{this.handleMessageViewed(e)}),o),this.addMsgsToInboxFromLS()}createCategories(){const e=this.createEl("div","categoriesContainer"),t=this.createEl("div","leftArrow");t.innerHTML=Gt,t.children[0].style="transform: rotate(180deg)",t.addEventListener("click",(()=>{this.shadowRoot.getElementById("categoriesWrapper").scrollBy(-70,0)})),e.appendChild(t);const i=this.createEl("div","categoriesWrapper");["All",...this.config.categories].forEach(((e,t)=>{const o=this.createEl("div","category-".concat(t),"category");o.innerText=e,0===t&&(this.selectedCategoryRef=o),i.appendChild(o)})),e.appendChild(i);const o=this.createEl("div","rightArrow");o.innerHTML=Gt,o.addEventListener("click",(()=>{this.shadowRoot.getElementById("categoriesWrapper").scrollBy(70,0)})),e.appendChild(o);const n={root:e,threshold:.9},s=i.children[0],r=i.children[this.config.categories.length];new IntersectionObserver((e=>{this.categoryObserverCb(t,e[0].intersectionRatio>=.9)}),n).observe(s);return new IntersectionObserver((e=>{this.categoryObserverCb(o,e[0].intersectionRatio>=.9)}),n).observe(r),e}categoryObserverCb(e,t){e&&(e.style.display=t?"none":"flex")}updateActiveCategory(e){this.selectedCategory=e,this.inboxCard.scrollTop=0;let t=0;this.prevCategoryRef&&this.prevCategoryRef.setAttribute("selected","false"),this.selectedCategoryRef.setAttribute("selected","true"),this.inboxCard.childNodes.forEach((e=>{"emptyInboxMsg"!==e.getAttribute("id")&&(e.style.display="All"===this.selectedCategory||e.getAttribute("category")===this.selectedCategory?"block":"none","block"===e.style.display&&t++)})),0===t?(this.emptyInboxMsg.innerText="".concat(e," messages will be displayed here."),this.emptyInboxMsg.style.display="block"):this.emptyInboxMsg.style.display="none"}buildUIForMessages(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!this.isPreview&&this.updateTSForRenderedMsgs(),this.inboxCard.scrollTop=0;const i=null!==(e=this.config.maxMsgsInInbox)&&void 0!==e?e:15,o=this.inboxCard.firstChild,n=Object.values(t).sort(((e,t)=>t.date-e.date)).map((e=>e.id));for(const e of n){const i=new Lt(this.config,t[e]);i.setAttribute("id",t[e].id),i.setAttribute("pivot",t[e].wzrk_pivot),i.setAttribute("part","ct-inbox-message"),this.config.categories.length>0?(i.setAttribute("category",t[e].tags[0]||""),i.style.display="All"===this.selectedCategory||t[e].category===this.selectedCategory?"block":"none"):i.style.display="block",this.inboxCard.insertBefore(i,o),this.observer.observe(i)}let s=this.inboxCard.querySelectorAll("ct-inbox-message").length;for(;s>i;){const e=this.inboxCard.querySelectorAll("ct-inbox-message");e.length>0&&e[e.length-1].remove(),s--}const r=this.inboxCard.querySelectorAll('ct-inbox-message[style*="display: block"]').length;this.emptyInboxMsg.style.display=r?"none":"block"}handleMessageViewed(e){const t=!this.isPreview;this.isInboxOpen&&e.forEach((e=>{e.isIntersecting&&this.unviewedMessages.hasOwnProperty(e.target.id)&&0===e.target.message.viewed&&(e.target.message.viewed=1,t?(window.clevertap.renderNotificationViewed({msgId:e.target.campaignId,pivotId:e.target.pivotId}),this.updateMessageInLS(e.target.id,{...e.target.message,viewed:1}),setTimeout((()=>{e.target.shadowRoot.getElementById("unreadMarker").style.display="none"}),1e3)):console.log("Notifiction viewed event will be raised at run time with payload ::",{msgId:e.target.campaignId,pivotId:e.target.pivotId}),this.unviewedCounter--,this.updateUnviewedBadgeCounter(),delete this.unviewedMessages[e.target.id])}))}updateMessageInLS(e,t){if(!this.isPreview){const i=Rt();i[e]=t,Bt(i)}}toggleInbox(e){this.isInboxOpen=!this.isInboxOpen,this.isInboxFromFlutter=!!(null==e?void 0:e.rect),this.isInboxOpen?(this.inboxCard.scrollTop=0,!this.isPreview&&this.deleteExpiredAndGetUnexpiredMsgs(),this.inbox.style.display="block",this.inbox.style.zIndex="2147483647",this.config.categories.length&&(this.selectedCategoryRef.setAttribute("selected","false"),this.selectedCategoryRef=this.shadowRoot.getElementById("category-0"),this.updateActiveCategory(this.selectedCategoryRef.innerText),this.shadowRoot.getElementById("categoriesWrapper").scrollLeft-=this.shadowRoot.getElementById("categoriesWrapper").scrollWidth),this.setInboxPosition(e)):this.inbox.style.display="none"}setInboxPosition(e){const t=window.outerWidth,i=getComputedStyle(de.inbox),o=i.getPropertyValue("--inbox-top"),n=i.getPropertyValue("--inbox-bottom"),s=i.getPropertyValue("--inbox-left"),r=i.getPropertyValue("--inbox-right");if(t>481&&!(o||n||s||r)){const t=Vt(e,this.inbox.clientHeight,this.inbox.clientWidth),i=t.xPos,o=t.yPos;this.inbox.style.top=o+"px",this.inbox.style.left=i+"px"}}updateUnviewedBadgeCounter(){if(this.isPreview)return void this.setBadgeStyle(this.unviewedCounter);let e=0;this.inboxCard.querySelectorAll("ct-inbox-message").forEach((t=>{const i=Rt();i[t.id]&&0===i[t.id].viewed&&e++})),this.setBadgeStyle(e)}updateTSForRenderedMsgs(){this.inboxCard.querySelectorAll("ct-inbox-message").forEach((e=>{const t=e.id.split("_")[1];e.shadow.getElementById("timeStamp").firstChild.innerText=Wt(t)}))}getInboxStyles(){const e=this.config.categories.length?64:16,t={panelBackgroundColor:this.config.styles.panelBackgroundColor,panelBorderColor:this.config.styles.panelBorderColor,headerBackgroundColor:this.config.styles.header.backgroundColor,headerTitleColor:this.config.styles.header.titleColor,closeIconColor:this.config.styles.closeIconColor,categoriesTabColor:this.config.styles.categories.tabColor,categoriesTitleColor:this.config.styles.categories.titleColor,selectedCategoryTabColor:this.config.styles.categories.selectedTab.tabColor,selectedCategoryTitleColor:this.config.styles.categories.selectedTab.titleColor,headerCategoryHeight:36+e};this.config.styles.categories.borderColor&&(t.categoriesBorderColor=this.config.styles.categories.borderColor),this.config.styles.categories.selectedTab.borderColor&&(t.selectedCategoryBorderColor=this.config.styles.categories.selectedTab.borderColor);const i=(e=>{let{panelBackgroundColor:t,panelBorderColor:i,headerBackgroundColor:o,headerTitleColor:n,closeIconColor:s,categoriesTabColor:r,categoriesTitleColor:a,categoriesBorderColor:l,selectedCategoryTabColor:d,selectedCategoryTitleColor:c,selectedCategoryBorderColor:u,headerCategoryHeight:h}=e;return'\n \n ")})(t),o=this.config.styles.cards;return i+(e=>{let{backgroundColor:t,borderColor:i,titleColor:o,descriptionColor:n,buttonColor:s,buttonTextColor:r,unreadMarkerColor:a}=e;return'\n \n ")})({backgroundColor:o.backgroundColor,borderColor:o.borderColor,titleColor:o.titleColor,descriptionColor:o.descriptionColor,buttonColor:o.buttonColor,buttonTextColor:o.buttonTextColor,unreadMarkerColor:o.unreadMarkerColor})}}const zt=e=>{e.inbox_preview?de.inbox.incomingMessagesForPreview=e.inbox_notifs:de.inbox.incomingMessages=e},jt=e=>{Ft(),de.inbox=new Tt({logger:e}),document.body.appendChild(de.inbox)},Nt=e=>{const t=le.readFromLSorCookie(W)||{};if(Object.keys(t).length>0&&Object.keys(t)[0].includes("_")){const i={};return i[e]=t,le.saveToLSorCookie(W,i),i}return t},Rt=()=>{const e=JSON.parse(decodeURIComponent(le.read(v)));if(!ee(e))return{};const t=Nt(e);return t.hasOwnProperty(e)?t[e]:{}},Bt=e=>{const t=JSON.parse(decodeURIComponent(le.read(v)));if(!ee(t))return;const i={...Nt(t),[t]:e};le.saveToLSorCookie(W,i)},Ut=e=>new Promise(((t,i)=>{if("complete"===document.readyState)jt(e),t();else{const i=le.readFromLSorCookie(V)||{},o=()=>{null===de.inbox&&jt(e),t()};window.addEventListener("load",(()=>{if(document.getElementById(i.inboxSelector))o();else{let n=0;if(n<20){const s=setInterval((()=>{document.getElementById(i.inboxSelector)?(o(),clearInterval(s),t()):n>=20&&(clearInterval(s),e.debug("Failed to add inbox")),n++}),500)}}}))}})),Ft=()=>{void 0===customElements.get("ct-web-inbox")&&(customElements.define("ct-web-inbox",Tt),customElements.define("ct-inbox-message",Lt))},Vt=(e,t,i)=>{const o=document.scrollingElement.scrollLeft,n=document.scrollingElement.scrollTop,s=window.innerWidth+o,r=window.innerHeight+n,a=e.rect||e.target.getBoundingClientRect(),l=a.x+o,d=a.y+n,c=a.left+o,u=a.right+o,h=a.top+n,p=a.bottom,g=a.height,f=a.width;let b,v,m=!1;const y=16;if(p+t<=r){const e=r-(p+t);v=e>=y?p+y:p+e}else if(h-t>=n){const e=h-t;v=e>=y?h-t-y:h-t-e}else m=!0,v=d+g/2-t/2,vr&&(v=r-t);if(m){const e=u+i;if(e<=s){b=u+(e+y<=s?y:s-e)}else{const e=c-i;b=e-(e-y>=o?y:e-o)}}else b=l+f/2-i/2,bs&&(b=u-i>=o?u-i:s-i);return{xPos:b,yPos:v}},Wt=e=>{const t=Date.now();let i=Math.floor((t-e)/6e4);return i<5?"Just now":i<60?"".concat(i," minute").concat(i>1?"s":""," ago"):(i=Math.floor(i/60),i<24?"".concat(i," hour").concat(i>1?"s":""," ago"):(i=Math.floor(i/24),"".concat(i," day").concat(i>1?"s":""," ago")))},qt=()=>Object.keys(le.readFromLSorCookie(V)||{}).length>0,Gt='\n\n\n',Ht='\n\n\n',Kt="https://web-native-display-campaign.clevertap.com/production/lib-overlay/style.css",Zt="wve-anti-flicker-show",Jt="wve-anti-flicker-hide",Qt="wve-flicker-style",Yt=e=>{if(e.data&&function(e){try{const t=new URL(e);return Boolean(t)}catch(e){return!1}}(e.data.originUrl)){{const t=new URL(e.data.originUrl).origin;if(e.origin!==t)return}var t,i;if("Dashboard"===e.data.message)$t(e.data.url,null!==(t=e.data.variant)&&void 0!==t?t:null,null!==(i=e.data.details)&&void 0!==i?i:{});else"Overlay"===e.data.message&&oi(e.data,!0)}},$t=(e,t,i)=>{"complete"===document.readyState?ii(e,t,i):document.addEventListener("readystatechange",(()=>{"complete"===document.readyState&&ii(e,t,i)}))};let Xt,ei=!1,ti=!1;function ii(e,t,i){if(!ei){window.Shopify&&(ti=!0),document.body.innerHTML="",document.head.innerHTML="",document.documentElement.innerHTML="",Xt=document.createElement("div"),Xt.id="overlayDiv",Xt.style.position="relative",Xt.style.display="flex",document.body.appendChild(Xt);(function(e,t,i,o){return new Promise(((n,s)=>{var r=document.createElement("script");r.type="module",r.src=e,r.onload=function(){"function"==typeof window.Overlay?(window.Overlay({id:"#overlayDiv",url:t,variant:i,details:o,isShopify:ti}),n()):s(new Error("ContentLayout not found in overlay.js"))},r.onerror=function(e){s(e)},document.head.appendChild(r)}))})("https://web-native-display-campaign.clevertap.com/production/lib-overlay/overlay.js",e,t,i).then((()=>{console.log("Overlay script loaded successfully."),ei=!0})).catch((e=>{console.error("Error loading overlay script:",e)})),(o=document.createElement("link")).rel="stylesheet",o.type="text/css",o.href=Kt,document.head.appendChild(o)}var o}const oi=(e,t)=>{const i=t?e.details:e.display.details;let o=!1;const n={msgId:e.wzrk_id,pivotId:e.wzrk_pivot},s=()=>{t||o||(o=!0,window.clevertap.renderNotificationViewed(n))},r=(i,o)=>{var s;o.values&&(o.values.html?i.outerHTML=o.values.html:(null===(s=o.values)||void 0===s?void 0:s.json)?function(e,t){const i={};i.msgId=e.wzrk_id,e.wzrk_pivot&&(i.pivotId=e.wzrk_pivot);null!=t.json&&(i.json=t.json);const o=new CustomEvent("CT_web_native_display_buider",{detail:i});document.dispatchEvent(o)}(e,o.values):(n.msgCTkv={wzrk_selector:o.selector},function(e,t,i){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==t.style&&Object.keys(t.style).forEach((i=>{e.style.setProperty(i,t.style[i])})),void 0!==t.underline){const i=e.style.textDecoration;t.underline?e.style.textDecoration="".concat(i," underline").trim():e.style.textDecoration=i.replace("underline","").trim()}if(void 0!==t.text&&(e.innerText=t.text),void 0!==t.clickDetails){const n=t.clickDetails.clickUrl;e.onclick=t.clickDetails.newTab?()=>{o||window.clevertap.raiseNotificationClicked(i),window.open(n,"_blank").focus()}:()=>{o||window.clevertap.raiseNotificationClicked(i),window.location.href=n}}if(void 0!==t.imgURL&&"img"===e.tagName.toLowerCase()&&(e.src=t.imgURL),void 0!==t.elementCss){const e=document.createElement("style");e.innerHTML=t.elementCss,document.head.appendChild(e)}}(i,o.values.form,n,t)))};i.forEach((e=>{e.url===window.location.href.split("?")[0]&&e.selectorData.forEach((e=>{const t=document.querySelector(e.selector);t?(s(),r(t,e)):(e=>{let t=0;const i=setInterval((()=>{const o=document.querySelector(e.selector);o?(s(),r(o,e),clearInterval(i)):++t>=20&&(console.log("No element present on DOM with selector '".concat(e,"'.")),clearInterval(i))}),500)})(e)}))}))};function ni(e){const{personalizedSelectors:t=[],delayTime:i=2e3}=e,o={};let n,s=0;function r(e){function t(e){const t=[];e.forEach((e=>{const i=document.querySelectorAll(e);i.length?(i.forEach((e=>{(function(e){const t=e.getBoundingClientRect(),{innerHeight:i,innerWidth:o}=window;return t.bottom>0&&t.right>0&&t.tope.classList.add(Jt))),setTimeout((()=>{e.forEach((e=>{e.classList.remove(Jt),e.classList.add(Zt)}))}),i)}(t)}t(e),Object.keys(o).length&&(n=setInterval((function(){t(Object.keys(o)),s++,(0===Object.keys(o).length||s>20)&&(s=0,clearInterval(n))}),100))}!function(){const e=Qt;if(!document.getElementById(e)){const t=document.createElement("style");t.id=e,t.textContent="\n .wve-anti-flicker-hide {\n opacity: 0 !important\n }\n .wve-anti-flicker-show {\n transition: opacity 0.5s, filter 0.5s !important\n }\n ",document.head.appendChild(t)}}(),window.addEventListener("load",(()=>{!function(){let e=document.location.href;new MutationObserver((()=>{e!==document.location.href&&(e=document.location.href,r(t))})).observe(document.body,{childList:!0,subtree:!0})}(),r(t)}))}class si extends HTMLElement{constructor(){super(),this._details=null,this.shadow=null,this.shadow=this.attachShadow({mode:"open"})}get details(){return this._details||""}set details(e){null===this._details&&(this._details=e,this.renderBanner())}renderBanner(){this.shadow.innerHTML=this.getBannerContent(),!1!==this.trackClick&&this.addEventListener("click",(()=>{const e=this.details.onClick;e&&(this.details.window?window.open(e,"_blank"):window.parent.location.href=e),window.clevertap.renderNotificationClicked({msgId:this.msgId,pivotId:this.pivotId})})),window.clevertap.renderNotificationViewed({msgId:this.msgId,pivotId:this.pivotId})}getBannerContent(){return'\n \n \n ")}}class ri extends HTMLElement{constructor(){super(),this._target=null,this._carousel=null,this.shadow=null,this.slides=0,this.previouslySelectedItem=-1,this.selectedItem=1,this.autoSlide=null,this.stopAutoSlideTimeout=null,this.shadow=this.attachShadow({mode:"open"}),void 0===customElements.get("ct-web-personalisation-banner")&&customElements.define("ct-web-personalisation-banner",si)}get target(){return this._target||""}set target(e){null===this._target&&(this._target=e,this.renderCarousel())}get details(){return this.target.display.details}get display(){return this.target.display}renderCarousel(){this.slides=this.details.length,this.shadow.innerHTML=this.getStyles();const e=this.getCarouselContent();this.display.showNavBtns&&e.insertAdjacentHTML("beforeend",this.display.navBtnsHtml),this.display.showNavArrows&&(e.insertAdjacentHTML("beforeend",this.display.leftNavArrowHtml),e.insertAdjacentHTML("beforeend",this.display.rightNavArrowHtml)),this._carousel=e,this.shadow.appendChild(e),this.setupClick(),this.updateSelectedItem(),this.startAutoSlide(),this.setupOnHover(),window.clevertap.renderNotificationViewed({msgId:this.target.wzrk_id,pivotId:this.target.wzrk_pivot})}setupClick(){this._carousel.addEventListener("click",(e=>{const t=e.target.id;if(t.startsWith("carousel__button")){const e=+t.split("-")[1];e!==this.selectedItem&&(this.previouslySelectedItem=this.selectedItem,this.selectedItem=e,this.updateSelectedItem(),this.startAutoSlide())}else if(t.startsWith("carousel__arrow"))t.endsWith("right")?this.goToNext():this.goToPrev(),this.startAutoSlide();else if(t.indexOf("-")>-1){const e=+t.split("-")[1],i=e-1;window.parent.clevertap&&window.clevertap.renderNotificationClicked({msgId:this.target.wzrk_id,pivotId:this.target.wzrk_pivot,wzrk_slideNo:e});const o=this.details[i].onClick;""!==o&&(this.details[i].window?window.open(o,"_blank"):window.location.href=o)}}))}setupOnHover(){this._carousel.addEventListener("mouseenter",(e=>{this.stopAutoSlideTimeout=setTimeout((()=>{this.autoSlide=clearInterval(this.autoSlide)}),500)})),this._carousel.addEventListener("mouseleave",(e=>{clearTimeout(this.stopAutoSlideTimeout),void 0===this.autoSlide&&this.startAutoSlide()}))}getCarouselContent(){const e=document.createElement("div");return e.setAttribute("class","carousel"),this.details.forEach(((t,i)=>{const o=document.createElement("ct-web-personalisation-banner");o.classList.add("carousel__item"),o.trackClick=!1,o.setAttribute("id","carousel__item-".concat(i+1)),o.details=t,e.appendChild(o)})),e}getStyles(){var e,t;return"\n \n ")}updateSelectedItem(){if(-1!==this.previouslySelectedItem){const e=this.shadow.getElementById("carousel__item-".concat(this.previouslySelectedItem)),t=this.shadow.getElementById("carousel__button-".concat(this.previouslySelectedItem));e.classList.remove("carousel__item--selected"),t&&t.classList.remove("carousel__button--selected")}const e=this.shadow.getElementById("carousel__item-".concat(this.selectedItem)),t=this.shadow.getElementById("carousel__button-".concat(this.selectedItem));e.classList.add("carousel__item--selected"),t&&t.classList.add("carousel__button--selected")}startAutoSlide(){clearInterval(this.autoSlide),this.autoSlide=setInterval((()=>{this.goToNext()}),this.display.sliderTime?1e3*this.display.sliderTime:3e3)}goToNext(){this.goTo(this.selectedItem,(this.selectedItem+1)%this.slides)}goToPrev(){this.goTo(this.selectedItem,this.selectedItem-1)}goTo(e,t){this.previouslySelectedItem=e,this.selectedItem=t,0===t&&(this.selectedItem=this.slides),this.updateSelectedItem()}}const ai=e=>{var t;void 0===customElements.get("ct-web-personalisation-banner")&&customElements.define("ct-web-personalisation-banner",si);const i=null!==(t=e.display.divId)&&void 0!==t?t:e.display.divSelector,o=document.createElement("ct-web-personalisation-banner");o.msgId=e.wzrk_id,o.pivotId=e.wzrk_pivot,o.divHeight=e.display.divHeight,o.details=e.display.details[0];const n=e.display.divId?document.getElementById(i):document.querySelector(i);n.innerHTML="",n.appendChild(o)},li=e=>{var t;void 0===customElements.get("ct-web-personalisation-carousel")&&customElements.define("ct-web-personalisation-carousel",ri);const i=null!==(t=e.display.divId)&&void 0!==t?t:e.display.divSelector,o=document.createElement("ct-web-personalisation-carousel");o.target=e;const n=e.display.divId?document.getElementById(i):document.querySelector(i);n.innerHTML="",n.appendChild(o)},di=e=>{const t={};t.msgId=e.wzrk_id,e.wzrk_pivot&&(t.pivotId=e.wzrk_pivot),null!=e.msgContent.kv&&(t.kv=e.msgContent.kv);const i=new CustomEvent("CT_web_native_display",{detail:t});document.dispatchEvent(i)},ci=(e,t)=>{const i=window.parent[e];"function"==typeof i&&(null!=t.display.kv?i(t.display.kv):i())},ui=(e,t)=>{const i="