forked from CleverTap/clevertap-web-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clevertap.js.map
1 lines (1 loc) · 504 KB
/
clevertap.js.map
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-personalisation/banner.js","src/util/web-personalisation/carousel.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/tr.js","src/modules/user.js","src/modules/logger.js","src/modules/session.js","src/modules/request.js","src/modules/privacy.js","src/modules/notification.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'\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 // 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 be either M or F. ${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<rawData.length; i++) {\n processedData.push(rawData.charCodeAt(i))\n }\n return new Uint8Array(processedData)\n}\n\nexport const compressData = (dataObject, logger) => {\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(/^M$|^F$/)) {\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 }\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 `<div class=\"notice-message\">\n <a href=\"[RECORDER_HREF]\" class=\"box\">\n <div class=\"avatar\"><span class=\"fa [ICON] fa-4x fa-fw\"></span></div>\n <div class=\"info\">\n <div class=\"title\">[TITLE]</div>\n <div class=\"clearfix\"></div>\n <div class=\"text\">[TEXT]</div>\n </div>\n <div class=\"clearfix\"></div>\n </a>\n </div>\n <div class=\"clearfix\"></div>`\n}\n\nexport const getMessageHeadTemplate = () => {\n return `<head>\n <base target=\"_parent\" />\n <link rel=\"stylesheet\" href=\"http://static.clevertap.com/fa/font-awesome.css\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <style>\n [STYLE]\n </style>\n </head>`\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 // Initialize array\n var array = []\n\n // Check if globalProfileMap is null, initialize if needed\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE) || {}\n }\n\n // Check if the value to be set is either string or number\n if (typeof propVal === 'string' || typeof propVal === 'number') {\n if ($ct.globalProfileMap.hasOwnProperty(propKey)) {\n array = $ct.globalProfileMap[propKey]\n array.push(typeof propVal === 'number' ? propVal : propVal.toLowerCase())\n } else {\n $ct.globalProfileMap[propKey] = propVal\n }\n } else {\n // Check if propVal is an array\n if ($ct.globalProfileMap.hasOwnProperty(propKey)) {\n array = Array.isArray($ct.globalProfileMap[propKey]) ? $ct.globalProfileMap[propKey] : [$ct.globalProfileMap[propKey]]\n }\n\n // Check for case-sensitive inputs and filter the same ones\n for (var i = 0; i < propVal.length; i++) {\n if (typeof propVal[i] === 'number' && !array.includes(propVal[i])) {\n array.push(propVal[i])\n } else if (typeof propVal[i] === 'string' && !array.includes(propVal[i].toLowerCase())) {\n array.push(propVal[i].toLowerCase())\n } else if ((typeof propVal[i] === 'number' && array.includes(propVal[i])) || (typeof propVal[i] === 'string' && array.includes(propVal[i].toLowerCase()))) {\n console.error('Values already included')\n } else {\n console.error('Array supports only string or number type values')\n }\n }\n\n // Update globalProfileMap with the array\n $ct.globalProfileMap[propKey] = array\n }\n\n // Save to local storage or cookie\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n\n // Call the sendMultiValueData function\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 if (!$ct?.globalProfileMap?.hasOwnProperty(propKey)) {\n console.error(`The property ${propKey} does not exist.`)\n } else {\n if (typeof propVal === 'string' || typeof propVal === 'number') {\n var index = $ct.globalProfileMap[propKey].indexOf(propVal)\n if (index !== -1) {\n $ct.globalProfileMap[propKey].splice(index, 1)\n }\n } else {\n for (var k = 0; k < propVal.length; k++) {\n var idx = $ct.globalProfileMap[propKey].indexOf(propVal[k])\n if (idx !== -1) {\n $ct.globalProfileMap[propKey].splice(idx, 1)\n }\n }\n }\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 console.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","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 <style type=\"text/css\">\n .banner {\n position: relative;\n cursor: ${this.details.onClick ? 'pointer' : ''}\n }\n img {\n height: ${this.divHeight ? this.divHeight : 'auto'};\n width: 100%;\n }\n .wrapper:is(.left, .right, .center) {\n display: flex;\n justify-content: center;\n flex-direction: column;\n align-items: center;\n position: absolute;\n width: 100%;\n height: 100%;\n overflow: auto;\n top: 0;\n }\n ${this.details.css ? this.details.css : ''}\n </style>\n <div class=\"banner\">\n <picture>\n <source media=\"(min-width:480px)\" srcset=\"${this.details.desktopImageURL}\">\n <source srcset=\"${this.details.mobileImageURL}\">\n <img src=\"${this.details.desktopImageURL}\" alt=\"Please upload a picture\" style=\"width:100%;\" part=\"banner__img\">\n </picture>\n ${this.details.html ? this.details.html : ''}\n </div>\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 // console.log('Raise notification clicked event for ', item)\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 <style>\n .carousel {\n position: relative;\n }\n\n .carousel__item {\n display: none;\n background-repeat: no-repeat;\n background-size: cover;\n }\n\n ct-web-personalisation-banner::part(banner__img) {\n height: ${this?.target?.display?.divHeight ? this.target.display.divHeight : 'auto'};\n width: 100%;\n transition: 2s;\n }\n\n .carousel__item--selected {\n display: block;\n }\n ${this.display.navBtnsCss}\n ${this.display.navArrowsCss}\n </style>\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 {\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 = `<span>${determineTimeStampText(msg.id.split('_')[1])}<span>`\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 <style id=\"messageStyles\">\n ct-inbox-message::part(messageWrapper) {\n margin-bottom: 16px; \n }\n ct-inbox-message::part(message) {\n background-color: ${backgroundColor}; \n border: 1px solid ${borderColor};\n border-radius: 4px; \n overflow: hidden;\n min-height: 40px;\n }\n ct-inbox-message::part(message):hover {\n box-shadow: 0px 4px 8px rgb(0 0 0 / 10%);\n cursor: pointer;\n }\n ct-inbox-message::part(iconTitleDescWrapper) {\n display: flex; \n padding: 16px;\n }\n ct-inbox-message::part(titleDescWrapper) {\n display: flex; \n flex-direction: column;\n }\n ct-inbox-message::part(iconImgContainer) {\n display: flex; \n margin-right: 16px;\n }\n ct-inbox-message::part(mainImgContainer) {\n line-height: 0;\n }\n ct-inbox-message::part(mainImg) {\n width: 100%; \n background: #b2b1ae;\n }\n ct-inbox-message::part(iconImg) {\n height: 40px; \n width: 40px;\n }\n ct-inbox-message::part(title) {\n font-size: 14px !important; \n line-height: 20px; \n font-weight: 600; \n color: ${titleColor}\n }\n ct-inbox-message::part(description) {\n font-size: 14px !important; \n line-height: 20px; \n font-weight: 400; \n color: ${descriptionColor}\n }\n ct-inbox-message::part(button) {\n background-color: ${buttonColor}; \n color: ${buttonTextColor}; \n padding: 8px 16px; \n font-size: 12px; \n line-height: 16px; \n font-weight: 600; \n flex: 1; \n border-radius: 0px; \n text-transform: capitalize; \n cursor: pointer; \n border: none;\n }\n ct-inbox-message::part(buttonsContainer) {\n display: flex;\n position: relative;\n }\n ct-inbox-message::part(snackbar) {\n position: absolute;\n top: calc(-100% - 12px);\n left: 50%;\n transform: translate(-50%, 0px);\n font-size: 14px;\n font-weight: 400;\n background: #FFFFFF;\n border: 1px solid #ECEDF2;\n box-shadow: 0px 4px 8px rgb(0 0 0 / 6%), 0px 0px 2px rgb(0 0 0 / 4%);\n border-radius: 4px;\n z-index: 2;\n display: none;\n width: max-content;\n align-items: center;\n padding: 8px 16px;\n justify-content: center;\n }\n\n ct-inbox-message::part(snackbar-msg) {\n color: black;\n margin-left: 8px;\n }\n\n ct-inbox-message::part(timeStamp) {\n display: flex; \n justify-content: end; \n align-items: center; \n margin-top: 4px; \n font-size: 12px !important; \n line-height: 16px; \n color: black;\n }\n ct-inbox-message::part(unreadMarker) {\n height: 8px; \n width: 8px; \n border-radius: 50%; \n background-color: ${unreadMarkerColor}; \n margin-left: 8px;\n }\n @media only screen and (min-width: 420px) {\n ct-inbox-message::part(mainImg) {\n height: 180px;\n }\n }\n </style>\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 <style id=\"webInboxStyles\">\n #inbox {\n width: 100%;\n position: fixed;\n background-color: #fff; \n display: none; \n box-shadow: 0px 2px 10px 0px #d7d7d791;\n background-color: ${panelBackgroundColor}; \n border: 1px solid ${panelBorderColor};\n top: 0;\n left: 0;\n height: 100%;\n overflow: auto;\n z-index: 1;\n box-sizing: content-box;\n border-radius: 4px;\n }\n \n #emptyInboxMsg {\n display: block;\n padding: 10px;\n text-align: center;\n color: black;\n }\n \n #header {\n height: 36px; \n width: 100%; \n display: flex; \n justify-content: center; \n align-items: center; \n background-color: ${headerBackgroundColor}; \n background-color: var(--card-bg, ${headerBackgroundColor});\n color: ${headerTitleColor}\n }\n \n #closeInbox {\n font-size: 20px; \n margin-right: 12px; \n color: ${closeIconColor}; \n cursor: pointer;\n }\n \n #headerTitle {\n font-size: 14px; \n line-height: 20px; \n flex-grow: 1; \n font-weight: 700; \n text-align: center;\n flex-grow: 1;\n text-align: center;\n }\n \n #categoriesContainer {\n padding: 16px 16px 0 16px; \n height: 32px; \n display: flex;\n scroll-behavior: smooth;\n position: relative;\n }\n\n #categoriesWrapper {\n height: 32px; \n overflow-x: scroll;\n display: flex;\n white-space: nowrap;\n scrollbar-width: none;\n }\n\n #categoriesWrapper::-webkit-scrollbar {\n display: none;\n }\n \n #leftArrow, #rightArrow {\n height: 32px;\n align-items: center;\n font-weight: 700;\n position: absolute;\n z-index: 2;\n pointer-events: auto;\n cursor: pointer;\n display: none;\n }\n\n #leftArrow {\n left: 0;\n padding-left: 4px;\n padding-right: 16px;\n background: linear-gradient(90deg, ${panelBackgroundColor} 0%, ${panelBackgroundColor}99 80%, ${panelBackgroundColor}0d 100%);\n }\n\n #rightArrow {\n right: 0;\n padding-right: 4px;\n padding-left: 16px;\n background: linear-gradient(-90deg, ${panelBackgroundColor} 0%, ${panelBackgroundColor}99 80%, ${panelBackgroundColor}0d 100%);\n }\n\n [id^=\"category-\"] {\n display: flex; \n flex: 1 1 0; \n justify-content: center; \n align-items: center; \n font-size: 14px; \n line-height: 20px; \n background-color: ${categoriesTabColor}; \n color: ${categoriesTitleColor}; \n cursor: pointer;\n padding: 6px 24px;\n margin: 0 3px;\n border-radius: 16px;\n border: ${categoriesBorderColor ? '1px solid ' + categoriesBorderColor : 'none'};\n }\n\n [id^=\"category-\"][selected=\"true\"] {\n background-color: ${selectedCategoryTabColor}; \n color: ${selectedCategoryTitleColor}; \n border: ${selectedCategoryBorderColor ? '1px solid ' + selectedCategoryBorderColor : 'none'}\n }\n \n #inboxCard {\n padding: 0 16px 0 16px;\n overflow-y: auto;\n box-sizing: border-box;\n margin-top: 16px;\n }\n\n @media only screen and (min-width: 480px) {\n #inbox {\n width: var(--inbox-width, 392px);\n height: var(--inbox-height, 546px);\n position: var(--inbox-position, fixed);\n right: var(--inbox-right, unset);\n bottom: var(--inbox-bottom, unset);\n top: var(--inbox-top, unset);\n left: var(--inbox-left, unset);\n }\n \n #inboxCard {\n height: calc(var(--inbox-height, 546px) - ${headerCategoryHeight}px); \n }\n \n }\n </style>\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 = `<svg width=\"6\" height=\"10\" viewBox=\"0 0 6 10\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M0.258435 9.74751C-0.0478584 9.44825 -0.081891 8.98373 0.156337 8.64775L0.258435 8.52836L3.87106 5L0.258435 1.47164C-0.0478588 1.17239 -0.0818914 0.707867 0.156337 0.371887L0.258435 0.252494C0.564728 -0.0467585 1.04018 -0.0800085 1.38407 0.152743L1.50627 0.252494L5.74156 4.39042C6.04786 4.68968 6.08189 5.1542 5.84366 5.49018L5.74156 5.60957L1.50627 9.74751C1.16169 10.0842 0.603015 10.0842 0.258435 9.74751Z\" fill=\"#63698F\"/>\n</svg>\n`\nexport const greenTickSvg = `<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M16 8C16 3.58172 12.4183 0 8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16C12.4183 16 16 12.4183 16 8ZM9.6839 5.93602C9.97083 5.55698 10.503 5.48833 10.8725 5.78269C11.2135 6.0544 11.2968 6.54044 11.0819 6.91173L11.0219 7.00198L8.09831 10.864C7.80581 11.2504 7.26654 11.3086 6.90323 11.0122L6.82822 10.9433L5.04597 9.10191C4.71635 8.76136 4.71826 8.21117 5.05023 7.87303C5.35666 7.5609 5.83722 7.53855 6.16859 7.80482L6.24814 7.87739L7.35133 9.01717L9.6839 5.93602Z\" fill=\"#03A387\"/>\n</svg>\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'\n","export const updateFormData = (element, formStyle) => {\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 ? () => window.open(url, '_blank').focus()\n : () => { window.location.href = url }\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 } from './builder_constants'\nimport { updateFormData } from './dataUpdate'\n\nexport const checkBuilder = (logger) => {\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\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 === 'loading') {\n document.addEventListener('DOMContentLoaded', () => onContentLoad(url, variant, details))\n } else {\n onContentLoad(url, variant, details)\n }\n}\n\nlet container\nlet contentLoaded = false\n/**\n * Handles content load for Clevertap builder.\n */\nfunction onContentLoad (url, variant, details) {\n if (!contentLoaded) {\n document.body.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 loadTypeKit()\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 })\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 * Loads TypeKit script.\n */\nfunction loadTypeKit () {\n const config = {\n kitId: 'eqj6nom',\n scriptTimeout: 3000,\n async: true\n }\n\n const docElement = document.documentElement\n const timeoutId = setTimeout(function () {\n docElement.className = docElement.className.replace(/\\bwf-loading\\b/g, '') + ' wf-inactive'\n }, config.scriptTimeout)\n const typeKitScript = document.createElement('script')\n let scriptLoaded = false\n const firstScript = document.getElementsByTagName('script')[0]\n let scriptReadyState\n\n docElement.className += ' wf-loading'\n typeKitScript.src = 'https://use.typekit.net/' + config.kitId + '.js'\n typeKitScript.async = true\n typeKitScript.onload = typeKitScript.onreadystatechange = function () {\n scriptReadyState = this.readyState\n if (scriptLoaded || (scriptReadyState && scriptReadyState !== 'complete' && scriptReadyState !== 'loaded')) return\n scriptLoaded = true\n clearTimeout(timeoutId)\n try {\n // eslint-disable-next-line no-undef\n Typekit.load(config)\n } catch (e) {}\n }\n\n firstScript.parentNode.insertBefore(typeKitScript, firstScript)\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[0] : targetingMsgJson.display.details[0]\n const siteUrl = Object.keys(details)[0]\n const selectors = details[siteUrl]\n let elementDisplayed = false\n\n if (siteUrl !== window.location.href.split('?')[0]) return\n\n const processElement = (element, selector) => {\n if (selectors[selector].html) {\n element.outerHTML = selectors[selector].html\n } else if (selectors[selector].json) {\n dispatchJsonData(targetingMsgJson, selectors[selector])\n } else {\n updateFormData(element, selectors[selector].form)\n }\n }\n\n const tryFindingElement = (selector) => {\n let count = 0\n const intervalId = setInterval(() => {\n const retryElement = document.querySelector(selector)\n if (retryElement) {\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 Object.keys(selectors).forEach(selector => {\n const element = document.querySelector(selector)\n if (element) {\n processElement(element, selector)\n elementDisplayed = true\n } else {\n tryFindingElement(selector)\n }\n })\n\n if (elementDisplayed && !isPreview) {\n window.clevertap.renderNotificationViewed({\n msgId: targetingMsgJson.wzrk_id,\n pivotId: targetingMsgJson.wzrk_pivot\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","import {\n addToLocalProfileMap,\n arp,\n getCampaignObject,\n saveCampaignObject,\n closeIframe\n} from './clevertap'\n\nimport {\n CAMP_COOKIE_NAME,\n DISPLAY,\n GLOBAL,\n EV_COOKIE,\n NOTIFICATION_VIEWED,\n NOTIFICATION_CLICKED,\n WZRK_PREFIX,\n WZRK_ID,\n CAMP_COOKIE_G,\n GCOOKIE_NAME\n} from './constants'\n\nimport {\n getNow,\n getToday\n} from './datetime'\n\nimport {\n compressToBase64\n} from './encoder'\n\nimport { StorageManager, $ct } from './storage'\nimport RequestDispatcher from './requestDispatcher'\nimport { CTWebPersonalisationBanner } from './web-personalisation/banner'\nimport { CTWebPersonalisationCarousel } from './web-personalisation/carousel'\nimport { CTWebPopupImageOnly } from './web-popupImageonly/popupImageonly'\nimport { checkAndRegisterWebInboxElements, initializeWebInbox, processWebInboxSettings, hasWebInboxSettingsInLS, processInboxNotifs } from '../modules/web-inbox/helper'\nimport { renderVisualBuilder } from '../modules/visualBuilder/pageBuilder'\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 if (targetingMsgJson[DISPLAY].delay != null && targetingMsgJson[DISPLAY].delay > 0) {\n const delay = targetingMsgJson[DISPLAY].delay\n targetingMsgJson[DISPLAY].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 getCookieParams = () => {\n const gcookie = _device.getGuid()\n const scookieObj = _session.getSessionCookieObject()\n return '&t=wc&d=' + encodeURIComponent(compressToBase64(gcookie + '|' + scookieObj.p + '|' + scookieObj.s))\n }\n\n const setupClickEvent = (onClick, targetingMsgJson, contentDiv, divId, isLegacy) => {\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()\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 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 }\n }\n\n 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\n const setupClickUrl = (onClick, targetingMsgJson, contentDiv, divId, isLegacy) => {\n incrementImpression(targetingMsgJson)\n setupClickEvent(onClick, targetingMsgJson, contentDiv, divId, isLegacy)\n }\n\n const incrementImpression = (targetingMsgJson) => {\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\n 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\n 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\n const renderPopUpImageOnly = (targetingMsgJson) => {\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\n const renderFooterNotification = (targetingMsgJson) => {\n const campaignId = targetingMsgJson.wzrk_id.split('_')[0]\n const displayObj = targetingMsgJson.display\n\n if (displayObj.wtarget_type === 2) { // Handling Web Native display\n // Logic for kv pair data\n if (targetingMsgJson.msgContent.type === 1) {\n const inaObj = {}\n\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 return\n }\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 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)\n }\n\n if (doCampHouseKeeping(targetingMsgJson) === false) {\n return\n }\n\n const divId = 'wizParDiv' + displayObj.layout\n\n if ($ct.dismissSpamControl && document.getElementById(divId) != null) {\n const element = document.getElementById(divId)\n element.remove()\n }\n if (document.getElementById(divId) != null) {\n return\n }\n\n $ct.campaignDivMap[campaignId] = divId\n const isBanner = displayObj.layout === 2\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 '<style type=\"text/css\">' +\n 'body{margin:0;padding:0;}' +\n '#contentDiv.wzrk{overflow:hidden;padding:0;text-align:center;' + pointerCss + '}' +\n '#contentDiv.wzrk td{padding:15px 10px;}' +\n '.wzrkPPtitle{font-weight: bold;font-size: 16px;font-family:arial;padding-bottom:10px;word-break: break-word;}' +\n '.wzrkPPdscr{font-size: 14px;font-family:arial;line-height:16px;word-break: break-word;display:inline-block;}' +\n '.PL15{padding-left:15px;}' +\n '.wzrkPPwarp{margin:20px 20px 0 5px;padding:0px;border-radius: ' + borderRadius + 'px;box-shadow: 1px 1px 5px #888888;}' +\n 'a.wzrkClose{cursor:pointer;position: absolute;top: 11px;right: 11px;z-index: 2147483647;font-size:19px;font-family:arial;font-weight:bold;text-decoration: none;width: 25px;/*height: 25px;*/text-align: center; -webkit-appearance: none; line-height: 25px;' +\n 'background: #353535;border: #fff 2px solid;border-radius: 100%;box-shadow: #777 2px 2px 2px;color:#fff;}' +\n 'a:hover.wzrkClose{background-color:#d1914a !important;color:#fff !important; -webkit-appearance: none;}' +\n 'td{vertical-align:top;}' +\n 'td.imgTd{border-top-left-radius:8px;border-bottom-left-radius:8px;}' +\n '</style>'\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 = \"<td class='imgTd' style='background-color:\" + leftTd + \"'><img src='\" + targetingMsgJson.msgContent.imageUrl + \"' height='60' width='60'></td>\"\n }\n const onClickStr = 'parent.$WZRK_WR.closeIframe(' + campaignId + \",'\" + divId + \"');\"\n const title = \"<div class='wzrkPPwarp' style='color:\" + textColor + ';background-color:' + bgColor + \";'>\" +\n \"<a href='javascript:void(0);' onclick=\" + onClickStr + \" class='wzrkClose' style='background-color:\" + btnBg + ';color:' + btColor + \"'>×</a>\" +\n \"<div id='contentDiv' class='wzrk'>\" +\n \"<table cellpadding='0' cellspacing='0' border='0'>\" +\n // \"<tr><td colspan='2'></td></tr>\"+\n '<tr>' + imageTd + \"<td style='vertical-align:top;'>\" +\n \"<div class='wzrkPPtitle' style='color:\" + textColor + \"'>\" + titleText + '</div>'\n const body = \"<div class='wzrkPPdscr' style='color:\" + textColor + \"'>\" + descriptionText + '<div></td></tr></table></div>'\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\n const appendScriptForCustomEvent = (targetingMsgJson, html) => {\n const script = `<script>\n const ct__camapignId = '${targetingMsgJson.wzrk_id}';\n const ct__formatVal = (v) => {\n return v && v.trim().substring(0, 20);\n }\n const ct__parentOrigin = window.parent.origin;\n document.body.addEventListener('click', (event) => {\n const elem = event.target.closest?.('a[wzrk_c2a], button[wzrk_c2a]');\n if (elem) {\n const {innerText, id, name, value, href} = elem;\n const clickAttr = elem.getAttribute('onclick') || elem.getAttribute('click');\n const onclickURL = clickAttr?.match(/(window.open)[(\\](\\\"|')(.*)(\\\"|',)/)?.[3] || clickAttr?.match(/(location.href *= *)(\\\"|')(.*)(\\\"|')/)?.[3];\n const props = {innerText, id, name, value};\n let msgCTkv = Object.keys(props).reduce((acc, c) => {\n const formattedVal = ct__formatVal(props[c]);\n formattedVal && (acc['wzrk_click_' + c] = formattedVal);\n return acc;\n }, {});\n if(onclickURL) { msgCTkv['wzrk_click_' + 'url'] = onclickURL; }\n if(href) { msgCTkv['wzrk_click_' + 'c2a'] = href; }\n const notifData = { msgId: ct__camapignId, msgCTkv, pivotId: '${targetingMsgJson.wzrk_pivot}' };\n window.parent.clevertap.renderNotificationClicked(notifData);\n }\n });\n </script>\n `\n return html.replace(/(<\\s*\\/\\s*body)/, `${script}\\n$1`)\n }\n\n let _callBackCalled = false\n\n const showFooterNotification = (targetingMsgJson) => {\n let onClick = targetingMsgJson.display.onClick\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()\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 renderFooterNotification(targetingMsgJson)\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 let exitintentObj\n const showExitIntent = (event, targetObj) => {\n let targetingMsgJson\n if (event != null && event.clientY > 0) {\n return\n }\n if (targetObj == null) {\n targetingMsgJson = exitintentObj\n } else {\n targetingMsgJson = targetObj\n }\n\n if ($ct.dismissSpamControl && targetingMsgJson.display.wtarget_type === 0 && document.getElementById('intentPreview') != null && document.getElementById('intentOpacityDiv') != null) {\n const element = document.getElementById('intentPreview')\n element.remove()\n document.getElementById('intentOpacityDiv').remove()\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 if (doCampHouseKeeping(targetingMsgJson) === false) {\n return\n }\n\n const campaignId = targetingMsgJson.wzrk_id.split('_')[0]\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 '<style type=\"text/css\">' +\n 'body{margin:0;padding:0;}' +\n '#contentDiv.wzrk{overflow:hidden;padding:0 0 20px 0;text-align:center;' + pointerCss + '}' +\n '#contentDiv.wzrk td{padding:15px 10px;}' +\n '.wzrkPPtitle{font-weight: bold;font-size: 24px;font-family:arial;word-break: break-word;padding-top:20px;}' +\n '.wzrkPPdscr{font-size: 14px;font-family:arial;line-height:16px;word-break: break-word;display:inline-block;padding:20px 20px 0 20px;line-height:20px;}' +\n '.PL15{padding-left:15px;}' +\n '.wzrkPPwarp{margin:20px 20px 0 5px;padding:0px;border-radius: ' + borderRadius + 'px;box-shadow: 1px 1px 5px #888888;}' +\n 'a.wzrkClose{cursor:pointer;position: absolute;top: 11px;right: 11px;z-index: 2147483647;font-size:19px;font-family:arial;font-weight:bold;text-decoration: none;width: 25px;/*height: 25px;*/text-align: center; -webkit-appearance: none; line-height: 25px;' +\n 'background: #353535;border: #fff 2px solid;border-radius: 100%;box-shadow: #777 2px 2px 2px;color:#fff;}' +\n 'a:hover.wzrkClose{background-color:#d1914a !important;color:#fff !important; -webkit-appearance: none;}' +\n '#contentDiv .button{padding-top:20px;}' +\n '#contentDiv .button a{font-size: 14px;font-weight:bold;font-family:arial;text-align:center;display:inline-block;text-decoration:none;padding:0 30px;height:40px;line-height:40px;background:#ea693b;color:#fff;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px;}' +\n '</style>'\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 = \"<div class='button'><a href='#'>\" + targetingMsgJson.msgContent.ctaText + '</a></div>'\n }\n\n let imageTd = ''\n if (targetingMsgJson.msgContent.imageUrl != null && targetingMsgJson.msgContent.imageUrl !== '') {\n imageTd = \"<div style='padding-top:20px;'><img src='\" + targetingMsgJson.msgContent.imageUrl + \"' width='500' alt=\" + titleText + ' /></div>'\n }\n const onClickStr = 'parent.$WZRK_WR.closeIframe(' + campaignId + \",'intentPreview');\"\n const title = \"<div class='wzrkPPwarp' style='color:\" + textColor + ';background-color:' + bgColor + \";'>\" +\n \"<a href='javascript:void(0);' onclick=\" + onClickStr + \" class='wzrkClose' style='background-color:\" + btnBg + ';color:' + btColor + \"'>×</a>\" +\n \"<div id='contentDiv' class='wzrk'>\" +\n \"<div class='wzrkPPtitle' style='color:\" + textColor + \"'>\" + titleText + '</div>'\n const body = \"<div class='wzrkPPdscr' style='color:\" + textColor + \"'>\" + descriptionText + '</div>' + imageTd + ctaText +\n '</div></div>'\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 === 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 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\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.vars) {\n $ct.variableStore.mergeVariables(msg.vars)\n return\n }\n\n 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\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","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'\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 _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 }).catch((error) => {\n this.#logger.error('Error subscribing: ' + 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 }).catch((e) => {\n // Unsubscription failed\n this.#logger.error('Error unsubscribing: ' + e)\n })\n }\n })\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 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 } from './modules/visualBuilder/pageBuilder'\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 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) {\n if (this.#onloadcalled === 1) {\n // already initailsed\n return\n }\n checkBuilder(this.#logger)\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 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","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","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","_handleMultiValueRemove","_handleMultiValueDelete","profileArr","outerObj","Site","Facebook","FbProfileObj","GPlusProfileObj","UserLoginHandler","clear","addToK","ids","g","kId","anonymousUser","foundInCache","gFromCache","Identity","cookieName","loginArr","pop","processProfile","CTWebPersonalisationBanner","HTMLElement","_details","shadow","attachShadow","mode","details","renderBanner","innerHTML","getBannerContent","trackClick","addEventListener","onClickUrl","onClick","open","parent","renderNotificationClicked","msgId","pivotId","renderNotificationViewed","divHeight","css","desktopImageURL","mobileImageURL","html","CTWebPersonalisationCarousel","_target","_carousel","slides","previouslySelectedItem","selectedItem","autoSlide","stopAutoSlideTimeout","customElements","define","target","renderCarousel","getStyles","carousel","getCarouselContent","showNavBtns","insertAdjacentHTML","navBtnsHtml","showNavArrows","leftNavArrowHtml","rightNavArrowHtml","setupClick","updateSelectedItem","startAutoSlide","setupOnHover","wzrk_id","wzrk_pivot","event","eventID","startsWith","selected","endsWith","goToNext","goToPrev","wzrk_slideNo","clearInterval","clearTimeout","detail","banner","classList","add","navBtnsCss","navArrowsCss","prevItem","prevButton","button","setInterval","sliderTime","goTo","prev","cur","CTWebPopupImageOnly","_session","popup","container","resizeObserver","renderImageOnlyPopup","sessionId","getImageOnlyPopupContent","shadowRoot","closeIcon","updateImageAndContainerWidth","ResizeObserver","handleResize","observe","unobserve","width","getRenderedImageWidth","setProperty","msgContent","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","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","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","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","updateFormData","element","formStyle","underline","curTextDecoration","textDecoration","clickDetails","clickUrl","onclick","newTab","imgURL","src","elementCss","head","checkBuilder","parentWindow","opener","handleMessageEvent","postMessage","originUrl","isValidUrl","msgOrigin","URL","origin","initialiseCTBuilder","variant","renderVisualBuilder","onContentLoad","contentLoaded","position","overlayPath","loadOverlayScript","then","catch","loadCSS","loadTypeKit","link","rel","script","onload","Overlay","Error","onerror","kitId","scriptTimeout","docElement","documentElement","timeoutId","className","typeKitScript","scriptLoaded","firstScript","scriptReadyState","onreadystatechange","Typekit","load","targetingMsgJson","siteUrl","selectors","elementDisplayed","processElement","selector","outerHTML","json","dispatchJsonData","form","tryFindingElement","intervalId","retryElement","querySelector","inaObj","kvPairsEvent","CustomEvent","dispatchEvent","string","Boolean","_err","_tr","_device","_request","_logger","_wizCounter","doCampHouseKeeping","incrCount","excludeFromFreqCaps","currentCount","totalCount","sessionStorage","campTypeObj","wtarget_type","wmc","wimc","campaignSessionLimit","campaignDailyLimit","campaignTotalLimit","totalDailyLimit","totalSessionLimit","totalInboxSessionLimit","efc","parseInt","mdc","tdc","campaignSessionCount","totalSessionCount","campaignDailyCount","totalDailyCount","campaignTotalCount","delay","campKey","newCampObj","getCookieParams","scookieObj","setupClickEvent","contentDiv","isLegacy","ctaElement","jsCTAElements","jsFunc","preview","invokeExternalJs","func","setupClickUrl","incrementImpression","renderPersonalisationBanner","divSelector","bannerEl","containerEl","renderPersonalisationCarousel","renderPopUpImageOnly","popupImageOnly","renderFooterNotification","displayObj","layout","showExitIntent","msgDiv","isBanner","viewHeight","viewWidth","legacy","marginBottom","contentHeight","bottomPosition","widthPerct","userAgent","proto","iFrameStyle","iframe","borderRadius","br","frameborder","marginheight","marginwidth","scrolling","pointerCss","sandbox","bgColor","btnBg","leftTd","btColor","theme","titleText","descriptionText","imageTd","onClickStr","closeCampaign","Event","appendScriptForCustomEvent","srcdoc","adjustIFrameHeight","contentDocument","scrollHeight","margin","ua","inDoc","contentWindow","_timer","_callBackCalled","showFooterNotification","notificationCallback","raiseNotificationClicked","raiseNotificationViewed","popupCurrentWzrkId","popupCallbacks","popupCallback","msgCTkv","wzrkPrefixKey","wzrkJson","raisePopupNotificationClicked","notificationData","eventData","wzrkPrefixObj","exitintentObj","targetObj","clientY","opacityDiv","opacity","rgbaColor","ctaText","processNativeDisplayArr","arrInAppNotifs","elementId","addLoadListener","inapp_notifs","targetNotif","onmouseleave","mergeEventMap","newEvtMap","oldEvtObj","newEvtObj","handleInboxNotifications","msgArr","vars","mergeVariables","staleDataUpdate","staledata","campType","evpr","eventsMap","events","profileMap","syncExpiry","expires_in","inapp_stale","inbox_stale","User","getTotalVisits","visitCount","getLastVisit","prevSession","logLevels","DISABLE","ERROR","INFO","DEBUG","DEBUG_PE","Logger","logLevel","wzrkError","info","debugPE","code","level","WZRK_D","SessionManager","scookieStr","objStr","currentSessionInLS","sessionCount","getTimeElapsed","sessionStart","getPageCount","seqNo","requestTime","RequestManager","fired","ignoreTrim","wzrk_error","pg","protocol","af","lib","rc","lastSyncTime","expirySeconds","dsync","givenGUID","registerToken","post","fetch","method","headers","response","ok","nowTs","evtDetail","Privacy","privacyArr","privacyObj","curr","optOut","shouldUseIP","NotificationHandler","displayArgs","_enableWebPush","enabled","applicationServerKey","subscriptionCallback","serviceWorkerPath","apnsWebPushId","apnsServiceUrl","safari","pushNotification","requestPermission","permission","subscriptionData","endpoint","deviceToken","browser","registrationScope","serviceWorker","register","registration","__wzrk_account_id","scope","rootDirRegex","isServiceWorkerAtRoot","ready","getRegistrations","serviceWorkerRegistration","subscribeObj","userVisibleOnly","pushManager","subscribe","getSubscription","unsubscribe","successful","scriptTag","bodyText","okButtonText","rejectButtonText","okButtonColor","skipDialog","askAgainTimeInSeconds","okCallback","rejectCallback","httpsPopupPath","httpsIframePath","apnsWebPushServiceUrl","notifObj","isHTTP","chromeAgent","firefoxAgent","safariAgent","Notification","httpsIframe","state","from","wzrkPermissionPopup","wizAlert","confirmButtonText","confirmButtonColor","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","notifications","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","elements","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,W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