-
Notifications
You must be signed in to change notification settings - Fork 17
/
clevertap.js.map
1 lines (1 loc) · 555 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-popupImageonly/popupImageonly.js","src/modules/web-inbox/Message.js","src/modules/web-inbox/inboxStyles.js","src/modules/web-inbox/WebInbox.js","src/modules/web-inbox/helper.js","src/modules/visualBuilder/builder_constants.js","src/modules/visualBuilder/dataUpdate.js","src/modules/visualBuilder/pageBuilder.js","src/util/web-personalisation/banner.js","src/util/web-personalisation/carousel.js","src/util/campaignRender/nativeDisplay.js","src/util/campaignRender/utilities.js","src/util/campaignRender/webPopup.js","src/modules/webPushPrompt/promptStyles.js","src/modules/notification.js","src/modules/webPushPrompt/promptConstants.js","src/modules/webPushPrompt/prompt.js","src/util/tr.js","src/modules/user.js","src/modules/logger.js","src/modules/session.js","src/modules/request.js","src/modules/privacy.js","src/modules/variables/variable.js","src/modules/variables/variableStore.js","src/clevertap.js","src/main.js"],"sourcesContent":["export const TARGET_DOMAIN = 'clevertap-prod.com'\nexport const TARGET_PROTOCOL = 'https:'\nexport const DEFAULT_REGION = 'eu1'\n","import { DEFAULT_REGION, TARGET_DOMAIN, TARGET_PROTOCOL } from '../options'\n\nexport default class Account {\n #accountId\n #region = ''\n #targetDomain = TARGET_DOMAIN\n #dcSdkversion = ''\n #token = ''\n\n constructor ({ id } = {}, region = '', targetDomain = TARGET_DOMAIN, token = '') {\n this.id = id\n if (region) {\n this.region = region\n }\n if (targetDomain) {\n this.targetDomain = targetDomain\n }\n if (token) {\n this.token = token\n }\n }\n\n get id () {\n return this.#accountId\n }\n\n set id (accountId) {\n this.#accountId = accountId\n }\n\n get region () {\n return this.#region\n }\n\n set region (region) {\n this.#region = region\n }\n\n get dcSDKVersion () {\n return this.#dcSdkversion\n }\n\n set dcSDKVersion (dcSDKVersion) {\n this.#dcSdkversion = dcSDKVersion\n }\n\n get targetDomain () {\n return this.#targetDomain\n }\n\n set targetDomain (targetDomain) {\n this.#targetDomain = targetDomain\n }\n\n get token () {\n return this.#token\n }\n\n set token (token) {\n this.#token = token\n }\n\n get finalTargetDomain () {\n if (this.region) {\n return `${this.region}.${this.targetDomain}`\n } else {\n if (this.targetDomain === TARGET_DOMAIN) {\n return `${DEFAULT_REGION}.${this.targetDomain}`\n }\n return this.targetDomain\n }\n }\n\n get dataPostPEURL () {\n return `${TARGET_PROTOCOL}//${this.finalTargetDomain}/defineVars`\n }\n\n get dataPostURL () {\n return `${TARGET_PROTOCOL}//${this.finalTargetDomain}/a?t=96`\n }\n\n get recorderURL () {\n return `${TARGET_PROTOCOL}//${this.finalTargetDomain}/r?r=1`\n }\n\n get emailURL () {\n return `${TARGET_PROTOCOL}//${this.finalTargetDomain}/e?r=1`\n }\n}\n","export const unsupportedKeyCharRegex = new RegExp('^\\\\s+|\\\\\\.|\\:|\\\\\\$|\\'|\\\"|\\\\\\\\|\\\\s+$', 'g')\nexport const unsupportedValueCharRegex = new RegExp(\"^\\\\s+|\\'|\\\"|\\\\\\\\|\\\\s+$\", 'g')\nexport const doubleQuoteRegex = new RegExp('\\\"', 'g')\nexport const singleQuoteRegex = new RegExp('\\'', 'g')\nexport const CLEAR = 'clear'\nexport const CHARGED_ID = 'Charged ID'\nexport const CHARGEDID_COOKIE_NAME = 'WZRK_CHARGED_ID'\nexport const GCOOKIE_NAME = 'WZRK_G'\nexport const KCOOKIE_NAME = 'WZRK_K'\nexport const CAMP_COOKIE_NAME = 'WZRK_CAMP'\nexport const CAMP_COOKIE_G = 'WZRK_CAMP_G'// cookie for storing campaign details against guid\nexport const SCOOKIE_PREFIX = 'WZRK_S'\nexport const SCOOKIE_EXP_TIME_IN_SECS = 60 * 20 // 20 mins\nexport const EV_COOKIE = 'WZRK_EV'\nexport const META_COOKIE = 'WZRK_META'\nexport const PR_COOKIE = 'WZRK_PR'\nexport const ARP_COOKIE = 'WZRK_ARP'\nexport const LCOOKIE_NAME = 'WZRK_L'\nexport const NOTIF_COOKIE_NAME = 'WZRK_N'\nexport const GLOBAL = 'global' // used for email unsubscribe also\nexport const TOTAL_COUNT = 'tc'\nexport const DISPLAY = 'display'\nexport const UNDEFINED = 'undefined'\nexport const WEBPUSH_LS_KEY = 'WZRK_WPR'\nexport const OPTOUT_KEY = 'optOut'\nexport const CT_OPTOUT_KEY = 'ct_optout'\nexport const OPTOUT_COOKIE_ENDSWITH = ':OO'\nexport const USEIP_KEY = 'useIP'\nexport const LRU_CACHE = 'WZRK_X'\nexport const LRU_CACHE_SIZE = 100\nexport const IS_OUL = 'isOUL'\nexport const EVT_PUSH = 'push'\nexport const EVT_PING = 'ping'\nexport const COOKIE_EXPIRY = 86400 * 365 // 1 Year in seconds\nexport const MAX_TRIES = 200 // API tries\nexport const FIRST_PING_FREQ_IN_MILLIS = 2 * 60 * 1000 // 2 mins\nexport const CONTINUOUS_PING_FREQ_IN_MILLIS = 5 * 60 * 1000 // 5 mins\nexport const GROUP_SUBSCRIPTION_REQUEST_ID = '2'\nexport const categoryLongKey = 'cUsY'\nexport const WZRK_PREFIX = 'wzrk_'\nexport const WZRK_ID = 'wzrk_id'\nexport const NOTIFICATION_VIEWED = 'Notification Viewed'\nexport const NOTIFICATION_CLICKED = 'Notification Clicked'\nexport const FIRE_PUSH_UNREGISTERED = 'WZRK_FPU'\nexport const PUSH_SUBSCRIPTION_DATA = 'WZRK_PSD' // PUSH SUBSCRIPTION DATA FOR REGISTER/UNREGISTER TOKEN\nexport const COMMAND_INCREMENT = '$incr'\nexport const COMMAND_DECREMENT = '$decr'\nexport const COMMAND_SET = '$set'\nexport const COMMAND_ADD = '$add'\nexport const COMMAND_REMOVE = '$remove'\nexport const COMMAND_DELETE = '$delete'\nexport const WEBINBOX_CONFIG = 'WZRK_INBOX_CONFIG'\nexport const WEBINBOX = 'WZRK_INBOX'\nexport const MAX_INBOX_MSG = 15\nexport const VARIABLES = 'WZRK_PE'\nexport const PUSH_DELAY_MS = 1000\nexport const MAX_DELAY_FREQUENCY = 1000 * 60 * 10\nexport const WZRK_FETCH = 'wzrk_fetch'\nexport const WEBPUSH_CONFIG = 'WZRK_PUSH_CONFIG'\n\nexport const SYSTEM_EVENTS = [\n 'Stayed',\n 'UTM Visited',\n 'App Launched',\n 'Notification Sent',\n NOTIFICATION_VIEWED,\n NOTIFICATION_CLICKED\n]\n","import {\n unsupportedKeyCharRegex,\n unsupportedValueCharRegex\n} from './constants'\n\nexport const isString = (input) => {\n return (typeof input === 'string' || input instanceof String)\n}\n\nexport const isObject = (input) => {\n // TODO: refine\n return Object.prototype.toString.call(input) === '[object Object]'\n}\n\nexport const isDateObject = (input) => {\n return typeof (input) === 'object' && (input instanceof Date)\n}\n\nexport const isObjectEmpty = (obj) => {\n for (const prop in obj) {\n if (obj.hasOwnProperty(prop)) { return false }\n }\n return true\n}\n\nexport const isConvertibleToNumber = (n) => {\n return !isNaN(parseFloat(n)) && isFinite(n)\n}\n\nexport const isNumber = (n) => {\n return /^-?[\\d.]+(?:e-?\\d+)?$/.test(n) && typeof n === 'number'\n}\n\nexport const isValueValid = (value) => {\n if (value === null || value === undefined || value === 'undefined') {\n return false\n }\n return true\n}\n\nexport const arrayContains = (arr, obj) => {\n var i = arr.length\n while (i--) {\n if (arr[i] === obj) {\n return true\n }\n }\n return false\n}\n\nexport const removeUnsupportedChars = (o, logger) => {\n // keys can't be greater than 1024 chars, values can't be greater than 1024 chars\n if (typeof o === 'object') {\n for (const key in o) {\n if (o.hasOwnProperty(key)) {\n const sanitizedVal = removeUnsupportedChars(o[key], logger)\n let sanitizedKey\n sanitizedKey = sanitize(key, unsupportedKeyCharRegex)\n if (sanitizedKey.length > 1024) {\n sanitizedKey = sanitizedKey.substring(0, 1024)\n logger.reportError(520, sanitizedKey + '... length exceeded 1024 chars. Trimmed.')\n }\n delete o[key]\n o[sanitizedKey] = sanitizedVal\n }\n }\n } else {\n let val\n\n if (isString(o)) {\n val = sanitize(o, unsupportedValueCharRegex)\n if (val.length > 1024) {\n val = val.substring(0, 1024)\n logger.reportError(521, val + '... length exceeded 1024 chars. Trimmed.')\n }\n } else {\n val = o\n }\n return val\n }\n return o\n}\n\nexport const sanitize = (input, regex) => {\n return input.replace(regex, '')\n}\n","export const getToday = () => {\n const today = new Date()\n return today.getFullYear() + '' + today.getMonth() + '' + today.getDay()\n}\n\nexport const getNow = () => {\n return Math.floor((new Date()).getTime() / 1000)\n}\n\nexport const convertToWZRKDate = (dateObj) => {\n return ('$D_' + Math.round(dateObj.getTime() / 1000))\n}\n\nexport const setDate = (dt) => {\n // expecting yyyymmdd format either as a number or a string\n if (isDateValid(dt)) {\n return '$D_' + dt\n }\n}\n\nexport const isDateValid = (date) => {\n const matches = /^(\\d{4})(\\d{2})(\\d{2})$/.exec(date)\n if (matches == null) return false\n const d = matches[3]\n const m = matches[2] - 1\n const y = matches[1]\n const composedDate = new Date(y, m, d)\n // eslint-disable-next-line eqeqeq\n return composedDate.getDate() == d && composedDate.getMonth() == m && composedDate.getFullYear() == y\n}\n","import {\n GCOOKIE_NAME,\n META_COOKIE,\n KCOOKIE_NAME,\n LCOOKIE_NAME\n} from './constants'\nexport class StorageManager {\n static save (key, value) {\n if (!key || !value) {\n return false\n }\n if (this._isLocalStorageSupported()) {\n localStorage.setItem(key, typeof value === 'string' ? value : JSON.stringify(value))\n return true\n }\n }\n\n static read (key) {\n if (!key) {\n return false\n }\n let data = null\n if (this._isLocalStorageSupported()) {\n data = localStorage.getItem(key)\n }\n if (data != null) {\n try {\n data = JSON.parse(data)\n } catch (e) {}\n }\n return data\n }\n\n static remove (key) {\n if (!key) {\n return false\n }\n if (this._isLocalStorageSupported()) {\n localStorage.removeItem(key)\n return true\n }\n }\n\n static removeCookie (name, domain) {\n let cookieStr = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;'\n\n if (domain) {\n cookieStr = cookieStr + ' domain=' + domain + '; path=/'\n }\n\n document.cookie = cookieStr\n }\n\n static createCookie (name, value, seconds, domain) {\n let expires = ''\n let domainStr = ''\n if (seconds) {\n const date = new Date()\n date.setTime(date.getTime() + (seconds * 1000))\n\n expires = '; expires=' + date.toGMTString()\n }\n\n if (domain) {\n domainStr = '; domain=' + domain\n }\n\n value = encodeURIComponent(value)\n\n document.cookie = name + '=' + value + expires + domainStr + '; path=/'\n }\n\n static readCookie (name) {\n const nameEQ = name + '='\n const ca = document.cookie.split(';')\n for (let idx = 0; idx < ca.length; idx++) {\n let c = ca[idx]\n while (c.charAt(0) === ' ') {\n c = c.substring(1, c.length)\n }\n // eslint-disable-next-line eqeqeq\n if (c.indexOf(nameEQ) == 0) {\n return decodeURIComponent(c.substring(nameEQ.length, c.length))\n }\n }\n return null\n }\n\n static _isLocalStorageSupported () {\n return 'localStorage' in window && window.localStorage !== null && typeof window.localStorage.setItem === 'function'\n }\n\n static saveToLSorCookie (property, value) {\n if (value == null) {\n return\n }\n try {\n if (this._isLocalStorageSupported()) {\n this.save(property, encodeURIComponent(JSON.stringify(value)))\n } else {\n if (property === GCOOKIE_NAME) {\n this.createCookie(property, encodeURIComponent(value), 0, window.location.hostname)\n } else {\n this.createCookie(property, encodeURIComponent(JSON.stringify(value)), 0, window.location.hostname)\n }\n }\n $ct.globalCache[property] = value\n } catch (e) {}\n }\n\n static readFromLSorCookie (property) {\n let data\n if ($ct.globalCache.hasOwnProperty(property)) {\n return $ct.globalCache[property]\n }\n if (this._isLocalStorageSupported()) {\n data = this.read(property)\n } else {\n data = this.readCookie(property)\n }\n\n if (data !== null && data !== undefined && !(typeof data.trim === 'function' && data.trim() === '')) {\n let value\n try {\n value = JSON.parse(decodeURIComponent(data))\n } catch (err) {\n value = decodeURIComponent(data)\n }\n $ct.globalCache[property] = value\n return value\n }\n }\n\n static createBroadCookie (name, value, seconds, domain) {\n // sets cookie on the base domain. e.g. if domain is baz.foo.bar.com, set cookie on \".bar.com\"\n // To update an existing \"broad domain\" cookie, we need to know what domain it was actually set on.\n // since a retrieved cookie never tells which domain it was set on, we need to set another test cookie\n // to find out which \"broadest\" domain the cookie was set on. Then delete the test cookie, and use that domain\n // for updating the actual cookie.\n\n if (domain) {\n let broadDomain = $ct.broadDomain\n if (broadDomain == null) { // if we don't know the broadDomain yet, then find out\n const domainParts = domain.split('.')\n let testBroadDomain = ''\n for (let idx = domainParts.length - 1; idx >= 0; idx--) {\n if (idx === 0) {\n testBroadDomain = domainParts[idx] + testBroadDomain\n } else {\n testBroadDomain = '.' + domainParts[idx] + testBroadDomain\n }\n\n // only needed if the cookie already exists and needs to be updated. See note above.\n if (this.readCookie(name)) {\n // no guarantee that browser will delete cookie, hence create short lived cookies\n var testCookieName = 'test_' + name + idx\n this.createCookie(testCookieName, value, 10, testBroadDomain) // self-destruct after 10 seconds\n if (!this.readCookie(testCookieName)) { // if test cookie not set, then the actual cookie wouldn't have been set on this domain either.\n continue\n } else { // else if cookie set, then delete the test and the original cookie\n this.removeCookie(testCookieName, testBroadDomain)\n }\n }\n\n this.createCookie(name, value, seconds, testBroadDomain)\n const tempCookie = this.readCookie(name)\n // eslint-disable-next-line eqeqeq\n if (tempCookie == value) {\n broadDomain = testBroadDomain\n $ct.broadDomain = broadDomain\n break\n }\n }\n } else {\n this.createCookie(name, value, seconds, broadDomain)\n }\n } else {\n this.createCookie(name, value, seconds, domain)\n }\n }\n\n static getMetaProp (property) {\n const metaObj = this.readFromLSorCookie(META_COOKIE)\n if (metaObj != null) {\n return metaObj[property]\n }\n }\n\n static setMetaProp (property, value) {\n if (this._isLocalStorageSupported()) {\n let wzrkMetaObj = this.readFromLSorCookie(META_COOKIE)\n if (wzrkMetaObj == null) {\n wzrkMetaObj = {}\n }\n if (value === undefined) {\n delete wzrkMetaObj[property]\n } else {\n wzrkMetaObj[property] = value\n }\n this.saveToLSorCookie(META_COOKIE, wzrkMetaObj)\n }\n }\n\n static getAndClearMetaProp (property) {\n const value = this.getMetaProp(property)\n this.setMetaProp(property, undefined)\n return value\n }\n\n static setInstantDeleteFlagInK () {\n let k = this.readFromLSorCookie(KCOOKIE_NAME)\n if (k == null) {\n k = {}\n }\n k.flag = true\n this.saveToLSorCookie(KCOOKIE_NAME, k)\n }\n\n static backupEvent (data, reqNo, logger) {\n let backupArr = this.readFromLSorCookie(LCOOKIE_NAME)\n if (typeof backupArr === 'undefined') {\n backupArr = {}\n }\n backupArr[reqNo] = { q: data }\n this.saveToLSorCookie(LCOOKIE_NAME, backupArr)\n logger.debug(`stored in ${LCOOKIE_NAME} reqNo : ${reqNo} -> ${data}`)\n }\n\n static removeBackup (respNo, logger) {\n const backupMap = this.readFromLSorCookie(LCOOKIE_NAME)\n if (typeof backupMap !== 'undefined' && backupMap !== null && typeof backupMap[respNo] !== 'undefined') {\n logger.debug(`del event: ${respNo} data-> ${backupMap[respNo].q}`)\n delete backupMap[respNo]\n this.saveToLSorCookie(LCOOKIE_NAME, backupMap)\n }\n }\n}\n\nexport const $ct = {\n globalCache: {\n gcookie: null,\n REQ_N: 0,\n RESP_N: 0\n },\n LRU_CACHE: null,\n globalProfileMap: undefined,\n globalEventsMap: undefined,\n blockRequest: false,\n isOptInRequest: false,\n broadDomain: null,\n webPushEnabled: null,\n campaignDivMap: {},\n currentSessionId: null,\n wiz_counter: 0, // to keep track of number of times we load the body\n notifApi: {\n notifEnabledFromApi: false\n }, // helper variable to handle race condition and check when notifications were called\n unsubGroups: [],\n updatedCategoryLong: null,\n inbox: null,\n isPrivacyArrPushed: false,\n privacyArray: [],\n offline: false,\n location: null,\n dismissSpamControl: false,\n globalUnsubscribe: true,\n flutterVersion: null,\n variableStore: {},\n pushConfig: null\n // domain: window.location.hostname, url -> getHostName()\n // gcookie: -> device\n}\n","import { StorageManager } from './storage'\nimport { LRU_CACHE } from './constants'\n\nexport default class LRUCache {\n #keyOrder\n\n constructor (max) {\n this.max = max\n let lruCache = StorageManager.readFromLSorCookie(LRU_CACHE)\n if (lruCache) {\n const tempLruCache = {}\n this.#keyOrder = []\n lruCache = lruCache.cache\n for (const entry in lruCache) {\n if (lruCache.hasOwnProperty(entry)) {\n tempLruCache[lruCache[entry][0]] = lruCache[entry][1]\n this.#keyOrder.push(lruCache[entry][0])\n }\n }\n this.cache = tempLruCache\n } else {\n this.cache = {}\n this.#keyOrder = []\n }\n }\n\n get (key) {\n const item = this.cache[key]\n if (item) {\n this.cache = this.#deleteFromObject(key, this.cache)\n this.cache[key] = item\n this.#keyOrder.push(key)\n }\n this.saveCacheToLS(this.cache)\n return item\n }\n\n set (key, value) {\n const item = this.cache[key]\n const allKeys = this.#keyOrder\n if (item != null) {\n this.cache = this.#deleteFromObject(key, this.cache)\n } else if (allKeys.length === this.max) {\n this.cache = this.#deleteFromObject(allKeys[0], this.cache)\n }\n this.cache[key] = value\n if (this.#keyOrder[this.#keyOrder - 1] !== key) {\n this.#keyOrder.push(key)\n }\n this.saveCacheToLS(this.cache)\n }\n\n saveCacheToLS (cache) {\n const objToArray = []\n const allKeys = this.#keyOrder\n for (const index in allKeys) {\n if (allKeys.hasOwnProperty(index)) {\n const temp = []\n temp.push(allKeys[index])\n temp.push(cache[allKeys[index]])\n objToArray.push(temp)\n }\n }\n StorageManager.saveToLSorCookie(LRU_CACHE, { cache: objToArray })\n }\n\n getKey (value) {\n if (value === null) {\n return null\n }\n const allKeys = this.#keyOrder\n for (const index in allKeys) {\n if (allKeys.hasOwnProperty(index)) {\n if (this.cache[allKeys[index]] === value) {\n return allKeys[index]\n }\n }\n }\n return null\n }\n\n getSecondLastKey () {\n const keysArr = this.#keyOrder\n if (keysArr != null && keysArr.length > 1) {\n return keysArr[keysArr.length - 2]\n }\n return -1\n }\n\n getLastKey () {\n const keysLength = this.#keyOrder.length\n if (keysLength) {\n return this.#keyOrder[keysLength - 1]\n }\n }\n\n #deleteFromObject (key, obj) {\n const allKeys = JSON.parse(JSON.stringify(this.#keyOrder))\n const newCache = {}\n let indexToDelete\n for (const index in allKeys) {\n if (allKeys.hasOwnProperty(index)) {\n if (allKeys[index] !== key) {\n newCache[allKeys[index]] = obj[allKeys[index]]\n } else {\n indexToDelete = index\n }\n }\n }\n allKeys.splice(indexToDelete, 1)\n this.#keyOrder = JSON.parse(JSON.stringify(allKeys))\n return newCache\n }\n}\n","import { COOKIE_EXPIRY, FIRE_PUSH_UNREGISTERED, GCOOKIE_NAME, KCOOKIE_NAME, LRU_CACHE_SIZE, USEIP_KEY } from '../util/constants'\nimport { isValueValid } from '../util/datatypes'\nimport { getNow } from '../util/datetime'\nimport LRUCache from '../util/lruCache'\nimport { StorageManager, $ct } from '../util/storage'\n\nexport default class CleverTapAPI {\n #logger\n #request\n #device\n #session\n\n constructor ({ logger, request, device, session }) {\n this.#logger = logger\n this.#request = request\n this.#device = device\n this.#session = session\n }\n\n /**\n *\n * @param {string} global gcookie\n * @param {string} session\n * @param {boolean} resume sent true in case of an OUL request from client side, which is returned as it is by server\n * @param {number} respNumber the index of the request in backupmanager\n * @param {boolean} optOutResponse\n * @returns\n */\n\n s (global, session, resume, respNumber, optOutResponse) {\n let oulReq = false\n let newGuid = false\n\n // for a scenario when OUL request is true from client side\n // but resume is returned as false from server end\n // we maintan a OulReqN var in the window object\n // and compare with respNumber to determine the response of an OUL request\n if (window.isOULInProgress) {\n if (resume || (respNumber !== 'undefined' && respNumber === window.oulReqN)) {\n window.isOULInProgress = false\n oulReq = true\n }\n }\n\n // call back function used to store global and session ids for the user\n if (typeof respNumber === 'undefined') {\n respNumber = 0\n }\n\n StorageManager.removeBackup(respNumber, this.#logger)\n\n if (respNumber > $ct.globalCache.REQ_N) {\n // request for some other user so ignore\n return\n }\n\n if (!isValueValid(this.#device.gcookie)) {\n if (global) {\n newGuid = true\n }\n }\n\n if (!isValueValid(this.#device.gcookie) || resume || typeof optOutResponse === 'boolean') {\n const sessionObj = this.#session.getSessionCookieObject()\n\n /* If the received session is less than the session in the cookie,\n then don't update guid as it will be response for old request\n */\n if (window.isOULInProgress || (sessionObj.s && (session < sessionObj.s))) {\n return\n }\n this.#logger.debug(`Cookie was ${this.#device.gcookie} set to ${global}`)\n this.#device.gcookie = global\n if (!isValueValid(this.#device.gcookie)) {\n // clear useIP meta prop\n StorageManager.getAndClearMetaProp(USEIP_KEY)\n }\n if (global && StorageManager._isLocalStorageSupported()) {\n if ($ct.LRU_CACHE == null) {\n $ct.LRU_CACHE = new LRUCache(LRU_CACHE_SIZE)\n }\n\n const kIdFromLS = StorageManager.readFromLSorCookie(KCOOKIE_NAME)\n let guidFromLRUCache\n if (kIdFromLS != null && kIdFromLS.id) {\n guidFromLRUCache = $ct.LRU_CACHE.cache[kIdFromLS.id]\n if (resume) {\n if (!guidFromLRUCache) {\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, true)\n // replace login identity in OUL request\n // with the gcookie returned in exchange\n $ct.LRU_CACHE.set(kIdFromLS.id, global)\n }\n }\n }\n\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, global)\n // lastk provides the guid\n const lastK = $ct.LRU_CACHE.getSecondLastKey()\n if (StorageManager.readFromLSorCookie(FIRE_PUSH_UNREGISTERED) && lastK !== -1) {\n const lastGUID = $ct.LRU_CACHE.cache[lastK]\n // fire the request directly via fireRequest to unregister the token\n // then other requests with the updated guid should follow\n this.#request.unregisterTokenForGuid(lastGUID)\n }\n }\n StorageManager.createBroadCookie(GCOOKIE_NAME, global, COOKIE_EXPIRY, window.location.hostname)\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, global)\n }\n\n if (StorageManager._isLocalStorageSupported()) {\n this.#session.manageSession(session)\n }\n\n // session cookie\n const obj = this.#session.getSessionCookieObject()\n\n // for the race-condition where two responses come back with different session ids. don't write the older session id.\n if (typeof obj.s === 'undefined' || obj.s <= session) {\n obj.s = session\n obj.t = getNow() // time of last response from server\n this.#session.setSessionCookieObject(obj)\n }\n\n // set blockRequest to false only if the device has a valid gcookie\n if (isValueValid(this.#device.gcookie)) {\n $ct.blockRequest = false\n }\n\n // only process the backup events after an OUL request or a new guid is recieved\n if ((oulReq || newGuid) && !this.#request.processingBackup) {\n this.#request.processBackupEvents()\n }\n\n $ct.globalCache.RESP_N = respNumber\n }\n}\n","import { isValueValid } from '../util/datatypes'\nimport { StorageManager } from '../util/storage'\nimport { GCOOKIE_NAME, COOKIE_EXPIRY } from '../util/constants'\n\nexport default class DeviceManager {\n #logger\n gcookie\n\n constructor ({ logger }) {\n this.#logger = logger\n this.gcookie = this.getGuid()\n }\n\n getGuid () {\n let guid = null\n if (isValueValid(this.gcookie)) {\n return this.gcookie\n }\n if (StorageManager._isLocalStorageSupported()) {\n const value = StorageManager.read(GCOOKIE_NAME)\n if (isValueValid(value)) {\n try {\n guid = JSON.parse(decodeURIComponent(value))\n } catch (e) {\n this.#logger.debug('Cannot parse Gcookie from localstorage - must be encoded ' + value)\n // assumming guids are of size 32. supporting both formats.\n // guid can have encodedURIComponent or be without it.\n // 1.56e4078ed15749928c042479ec2b4d47 - breaks on JSON.parse(decodeURIComponent())\n // 2.%2256e4078ed15749928c042479ec2b4d47%22\n if (value.length === 32) {\n guid = value\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, value)\n } else {\n this.#logger.error('Illegal guid ' + value)\n }\n }\n\n // Persist to cookie storage if not present there.\n if (isValueValid(guid)) {\n StorageManager.createBroadCookie(GCOOKIE_NAME, guid, COOKIE_EXPIRY, window.location.hostname)\n }\n }\n }\n\n if (!isValueValid(guid)) {\n guid = StorageManager.readCookie(GCOOKIE_NAME)\n if (isValueValid(guid) && (guid.indexOf('%') === 0 || guid.indexOf('\\'') === 0 || guid.indexOf('\"') === 0)) {\n guid = null\n }\n if (isValueValid(guid)) {\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, guid)\n }\n }\n\n return guid\n }\n}\n","export const DATA_NOT_SENT_TEXT = 'This property has been ignored.'\nexport const INVALID_ACCOUNT = 'Invalid account ID'\nexport const INVALID_EVENT = 'Event structure not valid. Unable to process event'\nexport const CLEVERTAP_ERROR_PREFIX = 'CleverTap error:' // Formerly wzrk_error_txt\nexport const EMBED_ERROR = `${CLEVERTAP_ERROR_PREFIX} Incorrect embed script.`\nexport const EVENT_ERROR = `${CLEVERTAP_ERROR_PREFIX} Event structure not valid. ${DATA_NOT_SENT_TEXT}`\nexport const GENDER_ERROR = `${CLEVERTAP_ERROR_PREFIX} Gender value should one of the following: m,f,o,u,male,female,unknown,others (case insensitive). ${DATA_NOT_SENT_TEXT}`\nexport const EMPLOYED_ERROR = `${CLEVERTAP_ERROR_PREFIX} Employed value should be either Y or N. ${DATA_NOT_SENT_TEXT}`\nexport const MARRIED_ERROR = `${CLEVERTAP_ERROR_PREFIX} Married value should be either Y or N. ${DATA_NOT_SENT_TEXT}`\nexport const EDUCATION_ERROR = `${CLEVERTAP_ERROR_PREFIX} Education value should be either School, College or Graduate. ${DATA_NOT_SENT_TEXT}`\nexport const AGE_ERROR = `${CLEVERTAP_ERROR_PREFIX} Age value should be a number. ${DATA_NOT_SENT_TEXT}`\nexport const DOB_ERROR = `${CLEVERTAP_ERROR_PREFIX} DOB value should be a Date Object`\nexport const OBJECT_ARRAY_ERROR = `${CLEVERTAP_ERROR_PREFIX} Expecting Object array in profile`\nexport const DATE_FORMAT_ERROR = `${CLEVERTAP_ERROR_PREFIX} setDate(number). number should be formatted as yyyymmdd`\nexport const ENUM_FORMAT_ERROR = `${CLEVERTAP_ERROR_PREFIX} setEnum(value). value should be a string or a number`\nexport const PHONE_FORMAT_ERROR = `${CLEVERTAP_ERROR_PREFIX} Phone number should be formatted as +[country code][number]`\n","import { isObject, isDateObject, isString, isNumber } from './datatypes'\nimport { convertToWZRKDate } from './datetime'\nimport { CHARGED_ID, CHARGEDID_COOKIE_NAME } from './constants'\nimport { StorageManager } from './storage'\n\nlet _globalChargedId\n\nexport const isEventStructureFlat = (eventObj) => {\n // Events cannot have nested structure or Arrays\n if (isObject(eventObj)) {\n for (var key in eventObj) {\n if (eventObj.hasOwnProperty(key)) {\n if (isObject(eventObj[key]) || Array.isArray(eventObj[key])) {\n return false\n } else if (isDateObject(eventObj[key])) {\n eventObj[key] = convertToWZRKDate(eventObj[key])\n }\n }\n }\n return true\n }\n return false\n}\n\nexport const isChargedEventStructureValid = (chargedObj, logger) => {\n if (isObject(chargedObj)) {\n for (var key in chargedObj) {\n if (chargedObj.hasOwnProperty(key)) {\n if (key === 'Items') {\n if (!Array.isArray(chargedObj[key])) {\n return false\n }\n\n if (chargedObj[key].length > 50) {\n logger.reportError(522, 'Charged Items exceed 50 limit. Actual count: ' + chargedObj[key].length)\n }\n\n for (var itemKey in chargedObj[key]) {\n if (chargedObj[key].hasOwnProperty(itemKey)) { // since default array implementation could be overridden - e.g. Teabox site\n if (!isObject(chargedObj[key][itemKey]) || !isEventStructureFlat(chargedObj[key][itemKey])) {\n return false\n }\n }\n }\n } else {\n if (isObject(chargedObj[key]) || Array.isArray(chargedObj[key])) {\n return false\n } else if (isDateObject(chargedObj[key])) {\n chargedObj[key] = convertToWZRKDate(chargedObj[key])\n }\n }\n }\n }\n\n if (isString(chargedObj[CHARGED_ID]) || isNumber(chargedObj[CHARGED_ID])) {\n // save charged Id\n const chargedId = chargedObj[CHARGED_ID] + '' // casting chargedId to string\n\n if (typeof _globalChargedId === 'undefined') {\n _globalChargedId = StorageManager.readFromLSorCookie(CHARGEDID_COOKIE_NAME)\n }\n if (typeof _globalChargedId !== 'undefined' && _globalChargedId.trim() === chargedId.trim()) {\n // drop event- duplicate charged id\n logger.error('Duplicate charged Id - Dropped' + chargedObj)\n return false\n }\n _globalChargedId = chargedId\n StorageManager.saveToLSorCookie(CHARGEDID_COOKIE_NAME, chargedId)\n }\n return true\n } // if object (chargedObject)\n return false\n}\n","import { isString, isObject, sanitize } from '../util/datatypes'\nimport { EVENT_ERROR } from '../util/messages'\nimport { EV_COOKIE, SYSTEM_EVENTS, unsupportedKeyCharRegex } from '../util/constants'\nimport { isChargedEventStructureValid, isEventStructureFlat } from '../util/validator'\nimport { StorageManager, $ct } from '../util/storage'\n\nexport default class EventHandler extends Array {\n #logger\n #oldValues\n #request\n #isPersonalisationActive\n\n constructor ({ logger, request, isPersonalisationActive }, values) {\n super()\n this.#logger = logger\n this.#oldValues = values\n this.#request = request\n this.#isPersonalisationActive = isPersonalisationActive\n }\n\n push (...eventsArr) {\n this.#processEventArray(eventsArr)\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#processEventArray(this.#oldValues)\n }\n this.#oldValues = null\n }\n\n #processEventArray (eventsArr) {\n if (Array.isArray(eventsArr)) {\n while (eventsArr.length > 0) {\n var eventName = eventsArr.shift()\n if (!isString(eventName)) {\n this.#logger.error(EVENT_ERROR)\n continue\n }\n\n if (eventName.length > 1024) {\n eventName = eventName.substring(0, 1024)\n this.#logger.reportError(510, eventName + '... length exceeded 1024 chars. Trimmed.')\n }\n\n if (SYSTEM_EVENTS.includes(eventName)) {\n this.#logger.reportError(513, eventName + ' is a restricted system event. It cannot be used as an event name.')\n continue\n }\n\n const data = {}\n data.type = 'event'\n data.evtName = sanitize(eventName, unsupportedKeyCharRegex)\n\n if (eventsArr.length !== 0) {\n const eventObj = eventsArr.shift()\n if (!isObject(eventObj)) {\n // put it back if it is not an object\n eventsArr.unshift(eventObj)\n } else {\n // check Charged Event vs. other events.\n if (eventName === 'Charged') {\n if (!isChargedEventStructureValid(eventObj, this.#logger)) {\n this.#logger.reportError(511, 'Charged event structure invalid. Not sent.')\n continue\n }\n } else {\n if (!isEventStructureFlat(eventObj)) {\n this.#logger.reportError(512, eventName + ' event structure invalid. Not sent.')\n continue\n }\n }\n data.evtData = eventObj\n }\n }\n\n this.#request.processEvent(data)\n }\n }\n }\n\n getDetails (evtName) {\n if (!this.#isPersonalisationActive()) {\n return\n }\n if (typeof $ct.globalEventsMap === 'undefined') {\n $ct.globalEventsMap = StorageManager.readFromLSorCookie(EV_COOKIE)\n }\n if (typeof $ct.globalEventsMap === 'undefined') {\n return\n }\n const evtObj = $ct.globalEventsMap[evtName]\n const respObj = {}\n if (typeof evtObj !== 'undefined') {\n respObj.firstTime = new Date(evtObj[1] * 1000)\n respObj.lastTime = new Date(evtObj[2] * 1000)\n respObj.count = evtObj[0]\n return respObj\n }\n }\n}\n","export const getURLParams = (url) => {\n const urlParams = {}\n const idx = url.indexOf('?')\n\n if (idx > 1) {\n const uri = url.substring(idx + 1)\n let match\n const pl = /\\+/g // Regex for replacing addition symbol with a space\n const search = /([^&=]+)=?([^&]*)/g\n const decode = function (s) {\n let replacement = s.replace(pl, ' ')\n try {\n replacement = decodeURIComponent(replacement)\n } catch (e) {\n // eat\n }\n return replacement\n }\n match = search.exec(uri)\n while (match) {\n urlParams[decode(match[1])] = decode(match[2])\n match = search.exec(uri)\n }\n }\n return urlParams\n}\n\nexport const getDomain = (url) => {\n if (url === '') return ''\n var a = document.createElement('a')\n a.href = url\n return a.hostname\n}\n\nexport const addToURL = (url, k, v) => {\n return url + '&' + k + '=' + encodeURIComponent(v)\n}\n\nexport const getHostName = () => {\n return window.location.hostname\n}\n","/* eslint-disable */\nexport const urlBase64ToUint8Array = (base64String) => {\n let padding = '='.repeat((4 - base64String.length % 4) % 4)\n let base64 = (base64String + padding)\n .replace(/\\-/g, '+')\n .replace(/_/g, '/')\n\n let rawData = window.atob(base64)\n let processedData = []\n for (let i=0; i<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(/\\b(?:[mM](?:ale)?|[fF](?:emale)?|[oO](?:thers)?|[uU](?:nknown)?)\\b/)) {\n valid = false\n logger.error(GENDER_ERROR)\n }\n\n if (profileKey === 'Employed' && !profileVal.match(/^Y$|^N$/)) {\n valid = false\n logger.error(EMPLOYED_ERROR)\n }\n\n if (profileKey === 'Married' && !profileVal.match(/^Y$|^N$/)) {\n valid = false\n logger.error(MARRIED_ERROR)\n }\n\n if (profileKey === 'Education' && !profileVal.match(/^School$|^College$|^Graduate$/)) {\n valid = false\n logger.error(EDUCATION_ERROR)\n }\n\n if (profileKey === 'Age' && profileVal != null) {\n if (isConvertibleToNumber(profileVal)) {\n profileObj.Age = +profileVal\n } else {\n valid = false\n logger.error(AGE_ERROR)\n }\n }\n // dob will come in like this - $dt_19470815 or dateObject\n if (profileKey === 'DOB') {\n if (((!(/^\\$D_/).test(profileVal) || (profileVal + '').length !== 11)) && !isDateObject(profileVal)) {\n valid = false\n logger.error(DOB_ERROR)\n }\n\n if (isDateObject(profileVal)) {\n profileObj[profileKey] = convertToWZRKDate(profileVal)\n }\n } else if (isDateObject(profileVal)) {\n profileObj[profileKey] = convertToWZRKDate(profileVal)\n }\n\n if (profileKey === 'Phone' && !isObjectEmpty(profileVal)) {\n if (profileVal.length > 8 && (profileVal.charAt(0) === '+')) { // valid phone number\n profileVal = profileVal.substring(1, profileVal.length)\n if (isConvertibleToNumber(profileVal)) {\n profileObj.Phone = +profileVal\n } else {\n valid = false\n logger.error(PHONE_FORMAT_ERROR + '. Removed.')\n }\n } else {\n valid = false\n logger.error(PHONE_FORMAT_ERROR + '. Removed.')\n }\n }\n\n if (!valid) {\n delete profileObj[profileKey]\n }\n }\n }\n }\n return valid\n}\n\nexport const processFBUserObj = (user) => {\n const profileData = {}\n profileData.Name = user.name\n if (user.id != null) {\n profileData.FBID = user.id + ''\n }\n // Feb 2014 - FB announced over 58 gender options, hence we specifically look for male or female. Rest we don't care.\n if (user.gender === 'male') {\n profileData.Gender = 'M'\n } else if (user.gender === 'female') {\n profileData.Gender = 'F'\n } else {\n profileData.Gender = 'O'\n }\n\n const getHighestEducation = function (eduArr) {\n if (eduArr != null) {\n let college = ''\n let highschool = ''\n\n for (let i = 0; i < eduArr.length; i++) {\n const edu = eduArr[i]\n if (edu.type != null) {\n const type = edu.type\n if (type === 'Graduate School') {\n return 'Graduate'\n } else if (type === 'College') {\n college = '1'\n } else if (type === 'High School') {\n highschool = '1'\n }\n }\n }\n\n if (college === '1') {\n return 'College'\n } else if (highschool === '1') {\n return 'School'\n }\n }\n }\n\n if (user.relationship_status != null) {\n profileData.Married = 'N'\n if (user.relationship_status === 'Married') {\n profileData.Married = 'Y'\n }\n }\n\n const edu = getHighestEducation(user.education)\n if (edu != null) {\n profileData.Education = edu\n }\n\n const work = (user.work != null) ? user.work.length : 0\n if (work > 0) {\n profileData.Employed = 'Y'\n } else {\n profileData.Employed = 'N'\n }\n\n if (user.email != null) {\n profileData.Email = user.email\n }\n\n if (user.birthday != null) {\n const mmddyy = user.birthday.split('/') // comes in as \"08/15/1947\"\n profileData.DOB = setDate(mmddyy[2] + mmddyy[0] + mmddyy[1])\n }\n return profileData\n}\n\nexport const processGPlusUserObj = (user, { logger }) => {\n const profileData = {}\n if (user.displayName != null) {\n profileData.Name = user.displayName\n }\n if (user.id != null) {\n profileData.GPID = user.id + ''\n }\n\n if (user.gender != null) {\n if (user.gender === 'male') {\n profileData.Gender = 'M'\n } else if (user.gender === 'female') {\n profileData.Gender = 'F'\n } else if (user.gender === 'other') {\n profileData.Gender = 'O'\n }\n }\n\n if (user.image != null) {\n if (user.image.isDefault === false) {\n profileData.Photo = user.image.url.split('?sz')[0]\n }\n }\n\n if (user.emails != null) {\n for (let emailIdx = 0; emailIdx < user.emails.length; emailIdx++) {\n const emailObj = user.emails[emailIdx]\n if (emailObj.type === 'account') {\n profileData.Email = emailObj.value\n }\n }\n }\n\n if (user.organizations != null) {\n profileData.Employed = 'N'\n for (let i = 0; i < user.organizations.length; i++) {\n const orgObj = user.organizations[i]\n if (orgObj.type === 'work') {\n profileData.Employed = 'Y'\n }\n }\n }\n\n if (user.birthday != null) {\n const yyyymmdd = user.birthday.split('-') // comes in as \"1976-07-27\"\n profileData.DOB = setDate(yyyymmdd[0] + yyyymmdd[1] + yyyymmdd[2])\n }\n\n if (user.relationshipStatus != null) {\n profileData.Married = 'N'\n if (user.relationshipStatus === 'married') {\n profileData.Married = 'Y'\n }\n }\n logger.debug('gplus usr profile ' + JSON.stringify(profileData))\n\n return profileData\n}\n\nexport const addToLocalProfileMap = (profileObj, override) => {\n if (StorageManager._isLocalStorageSupported()) {\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE)\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = {}\n }\n }\n\n // Move props from custom bucket to outside.\n if (profileObj._custom != null) {\n const keys = profileObj._custom\n for (const key in keys) {\n if (keys.hasOwnProperty(key)) {\n profileObj[key] = keys[key]\n }\n }\n delete profileObj._custom\n }\n\n for (const prop in profileObj) {\n if (profileObj.hasOwnProperty(prop)) {\n if ($ct.globalProfileMap.hasOwnProperty(prop) && !override) {\n continue\n }\n $ct.globalProfileMap[prop] = profileObj[prop]\n }\n }\n if ($ct.globalProfileMap._custom != null) {\n delete $ct.globalProfileMap._custom\n }\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n }\n}\n\nexport const closeIframe = (campaignId, divIdIgnored, currentSessionId) => {\n if (campaignId != null && campaignId !== '-1') {\n if (StorageManager._isLocalStorageSupported()) {\n const campaignObj = getCampaignObject()\n\n let sessionCampaignObj = campaignObj.wp[currentSessionId]\n if (sessionCampaignObj == null) {\n sessionCampaignObj = {}\n campaignObj[currentSessionId] = sessionCampaignObj\n }\n sessionCampaignObj[campaignId] = 'dnd'\n saveCampaignObject(campaignObj)\n }\n }\n if ($ct.campaignDivMap != null) {\n const divId = $ct.campaignDivMap[campaignId]\n if (divId != null) {\n document.getElementById(divId).remove()\n if (divId === 'intentPreview') {\n if (document.getElementById('intentOpacityDiv') != null) {\n document.getElementById('intentOpacityDiv').remove()\n }\n } else if (divId === 'wizParDiv0') {\n if (document.getElementById('intentOpacityDiv0') != null) {\n document.getElementById('intentOpacityDiv0').remove()\n }\n } else if (divId === 'wizParDiv2') {\n if (document.getElementById('intentOpacityDiv2') != null) {\n document.getElementById('intentOpacityDiv2').remove()\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 if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE) || {}\n }\n\n const existingValue = $ct.globalProfileMap[propKey]\n const array = Array.isArray(existingValue) ? existingValue : (existingValue != null ? [existingValue] : [])\n\n const addValue = (value) => {\n const normalizedValue = typeof value === 'number' ? value : value.toLowerCase()\n if (!array.includes(normalizedValue)) {\n array.push(normalizedValue)\n }\n }\n\n if (Array.isArray(propVal)) {\n propVal.forEach(value => {\n if (typeof value === 'string' || typeof value === 'number') {\n addValue(value)\n } else {\n this.#logger.error('Array supports only string or number type values')\n }\n })\n } else if (typeof propVal === 'string' || typeof propVal === 'number') {\n addValue(propVal)\n } else {\n this.#logger.error('Unsupported value type')\n return\n }\n\n $ct.globalProfileMap[propKey] = array\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n this.sendMultiValueData(propKey, propVal, command)\n }\n\n /**\n *\n * @param {any} propKey\n * @param {string, number, array} propVal\n * @param {string} command\n * removes value(s) against a key/property in profile object\n */\n _handleMultiValueRemove (propKey, propVal, command) {\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE) || {}\n }\n\n if (!$ct.globalProfileMap.hasOwnProperty(propKey)) {\n this.#logger.error(`The property ${propKey} does not exist.`)\n return\n }\n\n const removeValue = (value) => {\n const index = $ct.globalProfileMap[propKey].indexOf(value)\n if (index !== -1) {\n $ct.globalProfileMap[propKey].splice(index, 1)\n }\n }\n\n if (Array.isArray(propVal)) {\n propVal.forEach(removeValue)\n } else if (typeof propVal === 'string' || typeof propVal === 'number') {\n removeValue(propVal)\n } else {\n this.#logger.error('Unsupported propVal type')\n return\n }\n\n // Remove the key if the array is empty\n if ($ct.globalProfileMap[propKey].length === 0) {\n delete $ct.globalProfileMap[propKey]\n }\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n this.sendMultiValueData(propKey, propVal, command)\n }\n\n /**\n *\n * @param {any} propKey\n * @param {string} command\n * deletes a key value pair from the profile object\n */\n _handleMultiValueDelete (propKey, command) {\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE)\n }\n if (!$ct?.globalProfileMap?.hasOwnProperty(propKey)) {\n this.#logger.error(`The property ${propKey} does not exist.`)\n } else {\n delete $ct.globalProfileMap[propKey]\n }\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n this.sendMultiValueData(propKey, null, command)\n }\n\n sendMultiValueData (propKey, propVal, command) {\n // Send the updated value to LC\n let data = {}\n const profileObj = {}\n data.type = 'profile'\n\n // this removes the property at backend\n profileObj[propKey] = { [command]: command === COMMAND_DELETE ? true : propVal }\n if (profileObj.tz == null) {\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n data.profile = profileObj\n data = this.#request.addSystemDataToObject(data, true)\n this.#request.addFlags(data)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n}\n","import {\n isObject,\n isObjectEmpty\n} from '../util/datatypes'\nimport {\n KCOOKIE_NAME,\n GCOOKIE_NAME,\n EVT_PUSH,\n LRU_CACHE_SIZE,\n IS_OUL,\n CAMP_COOKIE_NAME,\n CHARGEDID_COOKIE_NAME,\n PR_COOKIE,\n EV_COOKIE,\n ARP_COOKIE,\n CLEAR,\n META_COOKIE,\n FIRE_PUSH_UNREGISTERED\n} from '../util/constants'\nimport {\n StorageManager,\n $ct\n} from '../util/storage'\nimport LRUCache from '../util/lruCache'\nimport {\n compressData\n} from '../util/encoder'\nimport {\n addToURL,\n getHostName\n} from '../util/url'\nimport {\n isProfileValid,\n processFBUserObj,\n processGPlusUserObj,\n addToLocalProfileMap\n} from '../util/clevertap'\n\nexport default class UserLoginHandler extends Array {\n #request\n #logger\n #account\n #session\n #oldValues\n #device\n\n constructor ({\n request,\n account,\n session,\n logger,\n device\n },\n values) {\n super()\n this.#request = request\n this.#account = account\n this.#session = session\n this.#logger = logger\n this.#oldValues = values\n this.#device = device\n }\n\n // On User Login\n #processOUL (profileArr) {\n let sendOULFlag = true\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, sendOULFlag)\n const addToK = (ids) => {\n let k = StorageManager.readFromLSorCookie(KCOOKIE_NAME)\n const g = StorageManager.readFromLSorCookie(GCOOKIE_NAME)\n let kId\n if (k == null) {\n k = {}\n kId = ids\n } else {\n /* check if already exists */\n kId = k.id\n let anonymousUser = false\n let foundInCache = false\n if (kId == null) {\n kId = ids[0]\n anonymousUser = true\n }\n if ($ct.LRU_CACHE == null && StorageManager._isLocalStorageSupported()) {\n $ct.LRU_CACHE = new LRUCache(LRU_CACHE_SIZE)\n }\n\n if (anonymousUser) {\n if ((g) != null) {\n // if have gcookie\n $ct.LRU_CACHE.set(kId, g)\n $ct.blockRequest = false\n }\n } else {\n // check if the id is present in the cache\n // set foundInCache to true\n for (const idx in ids) {\n if (ids.hasOwnProperty(idx)) {\n const id = ids[idx]\n if ($ct.LRU_CACHE.cache[id]) {\n kId = id\n foundInCache = true\n break\n }\n }\n }\n }\n\n if (foundInCache) {\n if (kId !== $ct.LRU_CACHE.getLastKey()) {\n // New User found\n // remove the entire cache\n this.#handleCookieFromCache()\n } else {\n sendOULFlag = false\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, sendOULFlag)\n }\n const gFromCache = $ct.LRU_CACHE.get(kId)\n $ct.LRU_CACHE.set(kId, gFromCache)\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, gFromCache)\n this.#device.gcookie = gFromCache\n\n const lastK = $ct.LRU_CACHE.getSecondLastKey()\n if (StorageManager.readFromLSorCookie(FIRE_PUSH_UNREGISTERED) && lastK !== -1) {\n // CACHED OLD USER FOUND. TRANSFER PUSH TOKEN TO THIS USER\n const lastGUID = $ct.LRU_CACHE.cache[lastK]\n this.#request.unregisterTokenForGuid(lastGUID)\n }\n } else {\n if (!anonymousUser) {\n this.clear()\n } else {\n if ((g) != null) {\n this.#device.gcookie = g\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, g)\n sendOULFlag = false\n }\n }\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, false)\n kId = ids[0]\n }\n }\n k.id = kId\n StorageManager.saveToLSorCookie(KCOOKIE_NAME, k)\n }\n\n if (Array.isArray(profileArr) && profileArr.length > 0) {\n for (const index in profileArr) {\n if (profileArr.hasOwnProperty(index)) {\n const outerObj = profileArr[index]\n let data = {}\n let profileObj\n if (outerObj.Site != null) { // organic data from the site\n profileObj = outerObj.Site\n if (isObjectEmpty(profileObj) || !isProfileValid(profileObj, {\n logger: this.#logger\n })) {\n return\n }\n } else if (outerObj.Facebook != null) { // fb connect data\n const FbProfileObj = outerObj.Facebook\n // make sure that the object contains any data at all\n\n if (!isObjectEmpty(FbProfileObj) && (!FbProfileObj.error)) {\n profileObj = processFBUserObj(FbProfileObj)\n }\n } else if (outerObj['Google Plus'] != null) {\n const GPlusProfileObj = outerObj['Google Plus']\n if (isObjectEmpty(GPlusProfileObj) && (!GPlusProfileObj.error)) {\n profileObj = processGPlusUserObj(GPlusProfileObj, { logger: this.#logger })\n }\n }\n if (profileObj != null && (!isObjectEmpty(profileObj))) { // profile got set from above\n data.type = 'profile'\n if (profileObj.tz == null) {\n // try to auto capture user timezone if not present\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n\n data.profile = profileObj\n const ids = []\n if (StorageManager._isLocalStorageSupported()) {\n if (profileObj.Identity) {\n ids.push(profileObj.Identity)\n }\n if (profileObj.Email) {\n ids.push(profileObj.Email)\n }\n if (profileObj.GPID) {\n ids.push('GP:' + profileObj.GPID)\n }\n if (profileObj.FBID) {\n ids.push('FB:' + profileObj.FBID)\n }\n if (ids.length > 0) {\n addToK(ids)\n }\n }\n addToLocalProfileMap(profileObj, true)\n data = this.#request.addSystemDataToObject(data, undefined)\n\n this.#request.addFlags(data)\n // Adding 'isOUL' flag in true for OUL cases which.\n // This flag tells LC to create a new arp object.\n // Also we will receive the same flag in response arp which tells to delete existing arp object.\n if (sendOULFlag) {\n data[IS_OUL] = true\n }\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n // Whenever sendOULFlag is true then dont send arp and gcookie (guid in memory in the request)\n // Also when this flag is set we will get another flag from LC in arp which tells us to delete arp\n // stored in the cache and replace it with the response arp.\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest, sendOULFlag)\n }\n }\n }\n }\n }\n\n clear () {\n this.#logger.debug('clear called. Reset flag has been set.')\n this.#deleteUser()\n StorageManager.setMetaProp(CLEAR, true)\n }\n\n #handleCookieFromCache () {\n $ct.blockRequest = false\n console.debug('Block request is false')\n if (StorageManager._isLocalStorageSupported()) {\n delete localStorage[PR_COOKIE]\n delete localStorage[EV_COOKIE]\n delete localStorage[META_COOKIE]\n delete localStorage[ARP_COOKIE]\n delete localStorage[CAMP_COOKIE_NAME]\n delete localStorage[CHARGEDID_COOKIE_NAME]\n }\n StorageManager.removeCookie(CAMP_COOKIE_NAME, getHostName())\n StorageManager.removeCookie(this.#session.cookieName, $ct.broadDomain)\n StorageManager.removeCookie(ARP_COOKIE, $ct.broadDomain)\n this.#session.setSessionCookieObject('')\n }\n\n #deleteUser () {\n $ct.blockRequest = true\n this.#logger.debug('Block request is true')\n $ct.globalCache = {\n gcookie: null,\n REQ_N: 0,\n RESP_N: 0\n }\n if (StorageManager._isLocalStorageSupported()) {\n delete localStorage[GCOOKIE_NAME]\n delete localStorage[KCOOKIE_NAME]\n delete localStorage[PR_COOKIE]\n delete localStorage[EV_COOKIE]\n delete localStorage[META_COOKIE]\n delete localStorage[ARP_COOKIE]\n delete localStorage[CAMP_COOKIE_NAME]\n delete localStorage[CHARGEDID_COOKIE_NAME]\n }\n StorageManager.removeCookie(GCOOKIE_NAME, $ct.broadDomain)\n StorageManager.removeCookie(CAMP_COOKIE_NAME, getHostName())\n StorageManager.removeCookie(KCOOKIE_NAME, getHostName())\n StorageManager.removeCookie(this.#session.cookieName, $ct.broadDomain)\n StorageManager.removeCookie(ARP_COOKIE, $ct.broadDomain)\n this.#device.gcookie = null\n this.#session.setSessionCookieObject('')\n }\n\n #processLoginArray (loginArr) {\n if (Array.isArray(loginArr) && loginArr.length > 0) {\n const profileObj = loginArr.pop()\n const processProfile = profileObj != null && isObject(profileObj) &&\n ((profileObj.Site != null && Object.keys(profileObj.Site).length > 0) ||\n (profileObj.Facebook != null && Object.keys(profileObj.Facebook).length > 0) ||\n (profileObj['Google Plus'] != null && Object.keys(profileObj['Google Plus']).length > 0))\n if (processProfile) {\n StorageManager.setInstantDeleteFlagInK()\n try {\n this.#processOUL([profileObj])\n } catch (e) {\n this.#logger.debug(e)\n }\n } else {\n this.#logger.error('Profile object is in incorrect format')\n }\n }\n }\n\n push (...profilesArr) {\n this.#processLoginArray(profilesArr)\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#processLoginArray(this.#oldValues)\n }\n this.#oldValues = null\n }\n}\n","import {\n getCampaignObject,\n saveCampaignObject\n} from '../clevertap'\nimport { StorageManager } from '../storage'\n\nexport class CTWebPopupImageOnly extends HTMLElement {\n constructor () {\n super()\n this.shadow = this.attachShadow({ mode: 'open' })\n }\n\n _target = null\n _session = null\n shadow = null\n popup = null\n container = null\n resizeObserver = null\n\n get target () {\n return this._target || ''\n }\n\n set target (val) {\n if (this._target === null) {\n this._target = val\n this.renderImageOnlyPopup()\n }\n }\n\n get session () {\n return this._session || ''\n }\n\n set session (val) {\n this._session = val\n }\n\n get msgId () {\n return this.target.wzrk_id\n }\n\n get pivotId () {\n return this.target.wzrk_pivot\n }\n\n get onClickUrl () {\n return this.target.display.onClickUrl\n }\n\n renderImageOnlyPopup () {\n const campaignId = this.target.wzrk_id.split('_')[0]\n const currentSessionId = this.session.sessionId\n\n this.shadow.innerHTML = this.getImageOnlyPopupContent()\n this.popup = this.shadowRoot.getElementById('imageOnlyPopup')\n this.container = this.shadowRoot.getElementById('container')\n this.closeIcon = this.shadowRoot.getElementById('close')\n\n this.popup.addEventListener('load', this.updateImageAndContainerWidth())\n this.resizeObserver = new ResizeObserver(() => this.handleResize(this.popup, this.container))\n this.resizeObserver.observe(this.popup)\n\n this.closeIcon.addEventListener('click', () => {\n this.resizeObserver.unobserve(this.popup)\n document.getElementById('wzrkImageOnlyDiv').style.display = 'none'\n this.remove()\n if (campaignId != null && campaignId !== '-1') {\n if (StorageManager._isLocalStorageSupported()) {\n const campaignObj = getCampaignObject()\n\n let sessionCampaignObj = campaignObj.wp[currentSessionId]\n if (sessionCampaignObj == null) {\n sessionCampaignObj = {}\n campaignObj[currentSessionId] = sessionCampaignObj\n }\n sessionCampaignObj[campaignId] = 'dnd'\n saveCampaignObject(campaignObj)\n }\n }\n })\n\n window.clevertap.renderNotificationViewed({ msgId: this.msgId, pivotId: this.pivotId })\n\n if (this.onClickUrl) {\n this.popup.addEventListener('click', () => {\n this.target.display.window ? window.open(this.onClickUrl, '_blank') : window.parent.location.href = this.onClickUrl\n window.clevertap.renderNotificationClicked({ msgId: this.msgId, pivotId: this.pivotId })\n })\n }\n }\n\n handleResize (popup, container) {\n const width = this.getRenderedImageWidth(popup)\n container.style.setProperty('width', `${width}px`)\n }\n\n getImageOnlyPopupContent () {\n return `\n ${this.target.msgContent.css}\n ${this.target.msgContent.html}\n `\n }\n\n updateImageAndContainerWidth () {\n return () => {\n const width = this.getRenderedImageWidth(this.popup)\n this.popup.style.setProperty('width', `${width}px`)\n this.container.style.setProperty('width', `${width}px`)\n this.container.style.setProperty('height', 'auto')\n this.container.style.setProperty('position', 'fixed')\n this.popup.style.setProperty('visibility', 'visible')\n this.closeIcon.style.setProperty('visibility', 'visible')\n document.getElementById('wzrkImageOnlyDiv').style.visibility = 'visible'\n }\n }\n\n getRenderedImageWidth (img) {\n const ratio = img.naturalWidth / img.naturalHeight\n return img.height * ratio\n }\n}\n","import { determineTimeStampText, greenTickSvg } from './helper'\nexport class Message extends HTMLElement {\n constructor (config, message) {\n super()\n this.shadow = this.attachShadow({ mode: 'open' })\n this.config = config\n this.message = message\n this.renderMessage(message)\n }\n\n wrapper = null\n snackBar = null\n\n get pivotId () {\n return this.message.wzrk_pivot\n }\n\n get campaignId () {\n return this.message.wzrk_id\n }\n\n createEl (type, id, part) {\n const _el = document.createElement(type)\n _el.setAttribute('id', id)\n _el.setAttribute('part', part || id)\n return _el\n }\n\n renderMessage (msg) {\n this.wrapper = this.createEl('div', 'messageWrapper')\n\n switch (msg.templateType) {\n case 'text-only':\n case 'text-with-icon':\n case 'text-with-icon-and-image': {\n const message = this.prepareBasicMessage(msg.msg[0])\n this.wrapper.appendChild(message)\n }\n }\n\n const timeStamp = this.createEl('div', 'timeStamp')\n timeStamp.innerHTML = `<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) {\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 && this.inbox) {\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 if (this.inbox) {\n this.buildUIForMessages(incomingMsgs)\n this.updateUnviewedBadgeCounter()\n }\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.checkForWebInbox(e) || 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 checks if the current Event Node is same as the already stored inboxSelector or the\n * inboxSelector present in the document\n */\n checkForWebInbox (e) {\n const config = StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}\n return this.inboxSelector.contains(e.target) ||\n document.getElementById(config.inboxSelector).contains(e.target)\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'\nexport const WVE_CLASS = {\n FLICKER_SHOW: 'wve-anti-flicker-show',\n FLICKER_HIDE: 'wve-anti-flicker-hide',\n FLICKER_ID: 'wve-flicker-style'\n}\n","export const updateFormData = (element, formStyle, payload, isPreview = false) => {\n // Update the element style\n if (formStyle.style !== undefined) {\n Object.keys(formStyle.style).forEach((property) => {\n element.style.setProperty(property, formStyle.style[property])\n })\n }\n\n // Update underline for element\n if (formStyle.underline !== undefined) {\n const curTextDecoration = element.style.textDecoration\n if (formStyle.underline) {\n element.style.textDecoration = `${curTextDecoration} underline`.trim()\n } else {\n element.style.textDecoration = curTextDecoration.replace('underline', '').trim()\n }\n }\n\n // Update element text\n if (formStyle.text !== undefined) {\n element.innerText = isPreview ? formStyle.text.text : formStyle.text\n }\n\n // Handle element onClick\n if (formStyle.clickDetails !== undefined) {\n const url = formStyle.clickDetails.clickUrl\n element.onclick = formStyle.clickDetails.newTab\n ? () => {\n if (!isPreview) {\n window.clevertap.raiseNotificationClicked(payload)\n }\n window.open(url, '_blank').focus()\n }\n : () => {\n if (!isPreview) {\n window.clevertap.raiseNotificationClicked(payload)\n }\n window.location.href = url\n }\n }\n\n // Set the image source\n if (formStyle.imgURL !== undefined && element.tagName.toLowerCase() === 'img') {\n element.src = formStyle.imgURL\n }\n\n // Handle elementCss\n if (formStyle.elementCss !== undefined) {\n const style = document.createElement('style')\n style.innerHTML = formStyle.elementCss\n document.head.appendChild(style)\n }\n}\n","import { CSS_PATH, OVERLAY_PATH, WVE_CLASS } from './builder_constants'\nimport { updateFormData } from './dataUpdate'\n\nexport const checkBuilder = (logger, accountId) => {\n const search = window.location.search\n const parentWindow = window.opener\n\n if (search === '?ctBuilder') {\n // open in visual builder mode\n logger.debug('open in visual builder mode')\n window.addEventListener('message', handleMessageEvent, false)\n if (parentWindow) {\n parentWindow.postMessage({ message: 'builder', originUrl: window.location.href }, '*')\n }\n return\n }\n if (search === '?ctBuilderPreview') {\n window.addEventListener('message', handleMessageEvent, false)\n if (parentWindow) {\n parentWindow.postMessage({ message: 'preview', originUrl: window.location.href }, '*')\n }\n }\n\n if (search === '?ctBuilderSDKCheck') {\n if (parentWindow) {\n const sdkVersion = '$$PACKAGE_VERSION$$'\n parentWindow.postMessage({\n message: 'SDKVersion',\n accountId,\n originUrl: window.location.href,\n sdkVersion\n },\n '*'\n )\n }\n }\n}\n\nconst handleMessageEvent = (event) => {\n if (event.data && isValidUrl(event.data.originUrl)) {\n const msgOrigin = new URL(event.data.originUrl).origin\n if (event.origin !== msgOrigin) {\n return\n }\n } else {\n return\n }\n if (event.data.message === 'Dashboard') {\n // handle personalisation\n window.evtMaster = event.data.personalisation.evtMaster\n initialiseCTBuilder(\n event.data.url,\n event.data.variant ?? null,\n event.data.details ?? {},\n event.data.personalisation\n )\n } else if (event.data.message === 'Overlay') {\n renderVisualBuilder(event.data, true)\n }\n}\n/**\n * Initializes the Clevertap builder.\n * @param {string} url - The URL to initialize the builder.\n * @param {string} variant - The variant of the builder.\n * @param {Object} details - The details object.\n * @param {Object} personalisation - The personalisation object\n */\nconst initialiseCTBuilder = (url, variant, details, personalisation) => {\n if (document.readyState === 'complete') {\n onContentLoad(url, variant, details, personalisation)\n } else {\n document.addEventListener('readystatechange', () => {\n if (document.readyState === 'complete') {\n onContentLoad(url, variant, details, personalisation)\n }\n })\n }\n}\n\nlet container\nlet contentLoaded = false\nlet isShopify = false\n/**\n * Handles content load for Clevertap builder.\n */\nfunction onContentLoad (url, variant, details, personalisation) {\n if (!contentLoaded) {\n if (window.Shopify) {\n isShopify = true\n }\n document.body.innerHTML = ''\n document.head.innerHTML = ''\n document.documentElement.innerHTML = ''\n container = document.createElement('div')\n container.id = 'overlayDiv'\n container.style.position = 'relative' // Ensure relative positioning for absolute positioning of form\n container.style.display = 'flex'\n document.body.appendChild(container)\n const overlayPath = OVERLAY_PATH\n loadOverlayScript(overlayPath, url, variant, details, personalisation)\n .then(() => {\n console.log('Overlay script loaded successfully.')\n contentLoaded = true\n })\n .catch((error) => {\n console.error('Error loading overlay script:', error)\n })\n loadCSS()\n }\n}\n\n/**\n * Loads CSS file.\n */\nfunction loadCSS () {\n var link = document.createElement('link')\n link.rel = 'stylesheet'\n link.type = 'text/css'\n link.href = CSS_PATH\n document.head.appendChild(link)\n}\n\n/**\n * Loads the overlay script.\n * @param {string} overlayPath - The path to overlay script.\n * @param {string} url - The URL.\n * @param {string} variant - The variant.\n * @param {Object} details - The details object.\n * @param {Object} personalisation\n * @returns {Promise} A promise.\n */\nfunction loadOverlayScript (overlayPath, url, variant, details, personalisation) {\n return new Promise((resolve, reject) => {\n var script = document.createElement('script')\n script.type = 'module'\n script.src = overlayPath\n script.onload = function () {\n if (typeof window.Overlay === 'function') {\n window.Overlay({ id: '#overlayDiv', url, variant, details, isShopify, personalisation })\n resolve()\n } else {\n reject(new Error('ContentLayout not found in overlay.js'))\n }\n }\n script.onerror = function (error) {\n reject(error)\n }\n document.head.appendChild(script)\n })\n}\n\n/**\n * Renders the visual builder.\n * @param {Object} targetingMsgJson - The point and click campaign JSON object.\n * @param {boolean} isPreview - Indicates if it's a preview.\n */\nexport const renderVisualBuilder = (targetingMsgJson, isPreview) => {\n const details = isPreview ? targetingMsgJson.details : targetingMsgJson.display.details\n let notificationViewed = false\n const payload = {\n msgId: targetingMsgJson.wzrk_id,\n pivotId: targetingMsgJson.wzrk_pivot\n }\n\n const raiseViewed = () => {\n if (!isPreview && !notificationViewed) {\n notificationViewed = true\n window.clevertap.renderNotificationViewed(payload)\n }\n }\n\n const processElement = (element, selector) => {\n if (!selector.values) return\n if (selector.values.html) {\n if (isPreview) {\n element.outerHTML = selector.values.html.text\n } else {\n element.outerHTML = selector.values.html\n }\n } else if (selector.values?.json) {\n dispatchJsonData(targetingMsgJson, selector.values, isPreview)\n } else {\n payload.msgCTkv = { wzrk_selector: selector.selector }\n updateFormData(element, selector.values.form, payload, isPreview)\n }\n }\n\n const tryFindingElement = (selector) => {\n let count = 0\n const intervalId = setInterval(() => {\n const retryElement = document.querySelector(selector.selector)\n if (retryElement) {\n raiseViewed()\n processElement(retryElement, selector)\n clearInterval(intervalId)\n } else if (++count >= 20) {\n console.log(`No element present on DOM with selector '${selector}'.`)\n clearInterval(intervalId)\n }\n }, 500)\n }\n\n details.forEach(d => {\n if (d.url === window.location.href.split('?')[0]) {\n d.selectorData.forEach(s => {\n const element = document.querySelector(s.selector)\n if (element) {\n raiseViewed()\n processElement(element, s)\n } else {\n tryFindingElement(s)\n }\n })\n }\n })\n}\n\n/**\n * Dispatches JSON data.\n * @param {Object} targetingMsgJson - The point and click campaign JSON object.\n * @param {Object} selector - The selector object.\n * @param {boolean} isPreview - If preview different handling\n */\nfunction dispatchJsonData (targetingMsgJson, selector, isPreview = false) {\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 if (isPreview) {\n inaObj.json = selector.json.text\n } else {\n inaObj.json = selector.json\n }\n }\n const kvPairsEvent = new CustomEvent('CT_web_native_display_buider', { detail: inaObj })\n document.dispatchEvent(kvPairsEvent)\n}\n\nfunction isValidUrl (string) {\n try {\n const url = new URL(string)\n return Boolean(url)\n } catch (_err) {\n return false\n }\n}\n\nexport function addAntiFlicker (antiFlicker) {\n const { personalizedSelectors = [], delayTime = 2000 } = antiFlicker\n const retryElements = {} // Track selectors that need retry\n let retryCount = 0 // Counter for retries\n let retryInterval\n function isInViewport (element) {\n const rect = element.getBoundingClientRect()\n const { innerHeight: windowHeight, innerWidth: windowWidth } = window\n return (\n rect.bottom > 0 &&\n rect.right > 0 &&\n rect.top < windowHeight &&\n rect.left < windowWidth\n )\n }\n (function () {\n const styleContent = `\n .wve-anti-flicker-hide {\n opacity: 0 !important;\n }\n .wve-anti-flicker-show {\n transition: opacity 0.5s, filter 0.5s !important;\n }\n `\n // Create and append the style element if it doesn't exist\n const styleId = WVE_CLASS.FLICKER_ID\n if (!document.getElementById(styleId)) {\n const styleElement = document.createElement('style')\n styleElement.id = styleId\n styleElement.textContent = styleContent\n document.head.appendChild(styleElement)\n }\n })()\n function applyAntiFlicker (selectors) {\n function processSelectors (selectorElements) {\n const elements = []\n selectorElements.forEach(selector => {\n const matchedElements = document.querySelectorAll(selector)\n if (matchedElements.length) {\n matchedElements.forEach(el => {\n if (isInViewport(el)) {\n elements.push(el)\n }\n })\n delete retryElements[selector] // Successfully processed, remove from retry list\n } else {\n retryElements[selector] = false // Add to retry list if not found\n }\n })\n applyStyles(elements)\n }\n function retryProcessing () {\n processSelectors(Object.keys(retryElements))\n retryCount++\n if (Object.keys(retryElements).length === 0 || retryCount > 20) {\n retryCount = 0\n clearInterval(retryInterval)\n }\n }\n processSelectors(selectors)\n if (Object.keys(retryElements).length) {\n retryInterval = setInterval(retryProcessing, 100)\n }\n }\n function applyStyles (elements) {\n elements.forEach(el => el.classList.add(WVE_CLASS.FLICKER_HIDE))\n setTimeout(() => {\n elements.forEach(el => {\n el.classList.remove(WVE_CLASS.FLICKER_HIDE)\n el.classList.add(WVE_CLASS.FLICKER_SHOW)\n })\n }, delayTime) // Apply styles after maxRenderTime\n }\n function observeUrlChange () {\n let previousHref = document.location.href\n const observer = new MutationObserver(() => {\n if (previousHref !== document.location.href) {\n previousHref = document.location.href\n applyAntiFlicker(personalizedSelectors)\n }\n })\n observer.observe(document.body, { childList: true, subtree: true })\n }\n window.addEventListener('DOMContentLoaded', () => {\n observeUrlChange()\n })\n applyAntiFlicker(personalizedSelectors)\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 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 { CTWebPersonalisationBanner } from '../web-personalisation/banner'\nimport { CTWebPersonalisationCarousel } from '../web-personalisation/carousel'\n\nexport const renderPersonalisationBanner = (targetingMsgJson) => {\n if (customElements.get('ct-web-personalisation-banner') === undefined) {\n customElements.define('ct-web-personalisation-banner', CTWebPersonalisationBanner)\n }\n const divId = targetingMsgJson.display.divId ?? targetingMsgJson.display.divSelector\n const bannerEl = document.createElement('ct-web-personalisation-banner')\n bannerEl.msgId = targetingMsgJson.wzrk_id\n bannerEl.pivotId = targetingMsgJson.wzrk_pivot\n bannerEl.divHeight = targetingMsgJson.display.divHeight\n bannerEl.details = targetingMsgJson.display.details[0]\n const containerEl = targetingMsgJson.display.divId ? document.getElementById(divId) : document.querySelector(divId)\n containerEl.innerHTML = ''\n containerEl.appendChild(bannerEl)\n}\n\nexport const renderPersonalisationCarousel = (targetingMsgJson) => {\n if (customElements.get('ct-web-personalisation-carousel') === undefined) {\n customElements.define('ct-web-personalisation-carousel', CTWebPersonalisationCarousel)\n }\n const divId = targetingMsgJson.display.divId ?? targetingMsgJson.display.divSelector\n const carousel = document.createElement('ct-web-personalisation-carousel')\n carousel.target = targetingMsgJson\n const container = targetingMsgJson.display.divId ? document.getElementById(divId) : document.querySelector(divId)\n container.innerHTML = ''\n container.appendChild(carousel)\n}\n\nexport const handleKVpairCampaign = (targetingMsgJson) => {\n const inaObj = {}\n inaObj.msgId = targetingMsgJson.wzrk_id\n if (targetingMsgJson.wzrk_pivot) {\n inaObj.pivotId = targetingMsgJson.wzrk_pivot\n }\n if (targetingMsgJson.msgContent.kv != null) {\n inaObj.kv = targetingMsgJson.msgContent.kv\n }\n const kvPairsEvent = new CustomEvent('CT_web_native_display', { detail: inaObj })\n document.dispatchEvent(kvPairsEvent)\n}\n","import { getCampaignObject, saveCampaignObject, closeIframe } from '../clevertap'\nimport { CAMP_COOKIE_G, GCOOKIE_NAME, EV_COOKIE, WZRK_ID, NOTIFICATION_VIEWED } from '../constants'\nimport { StorageManager, $ct } from '../storage'\nimport RequestDispatcher from '../requestDispatcher'\nimport { compressToBase64 } from '../encoder'\n\nexport const invokeExternalJs = (jsFunc, targetingMsgJson) => {\n const func = window.parent[jsFunc]\n if (typeof func === 'function') {\n if (targetingMsgJson.display.kv != null) {\n func(targetingMsgJson.display.kv)\n } else {\n func()\n }\n }\n}\n\nexport const appendScriptForCustomEvent = (targetingMsgJson, html) => {\n const script = `<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\nexport const staleDataUpdate = (staledata, campType) => {\n const campObj = getCampaignObject()\n const globalObj = campObj[campType].global\n if (globalObj != null && campType) {\n for (const idx in staledata) {\n if (staledata.hasOwnProperty(idx)) {\n delete globalObj[staledata[idx]]\n if (StorageManager.read(CAMP_COOKIE_G)) {\n const guidCampObj = JSON.parse(decodeURIComponent(StorageManager.read(CAMP_COOKIE_G)))\n const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n if (guidCampObj[guid] && guidCampObj[guid][campType] && guidCampObj[guid][campType][staledata[idx]]) {\n delete guidCampObj[guid][campType][staledata[idx]]\n StorageManager.save(CAMP_COOKIE_G, encodeURIComponent(JSON.stringify(guidCampObj)))\n }\n }\n }\n }\n }\n saveCampaignObject(campObj)\n}\n\nexport const mergeEventMap = (newEvtMap) => {\n if ($ct.globalEventsMap == null) {\n $ct.globalEventsMap = StorageManager.readFromLSorCookie(EV_COOKIE)\n if ($ct.globalEventsMap == null) {\n $ct.globalEventsMap = newEvtMap\n return\n }\n }\n for (const key in newEvtMap) {\n if (newEvtMap.hasOwnProperty(key)) {\n const oldEvtObj = $ct.globalEventsMap[key]\n const newEvtObj = newEvtMap[key]\n if ($ct.globalEventsMap[key] != null) {\n if (newEvtObj[0] != null && newEvtObj[0] > oldEvtObj[0]) {\n $ct.globalEventsMap[key] = newEvtObj\n }\n } else {\n $ct.globalEventsMap[key] = newEvtObj\n }\n }\n }\n}\n\nexport const incrementImpression = (targetingMsgJson, _request) => {\n const data = {}\n data.type = 'event'\n data.evtName = NOTIFICATION_VIEWED\n data.evtData = { [WZRK_ID]: targetingMsgJson.wzrk_id }\n if (targetingMsgJson.wzrk_pivot) {\n data.evtData = { ...data.evtData, wzrk_pivot: targetingMsgJson.wzrk_pivot }\n }\n _request.processEvent(data)\n}\n\nexport const setupClickEvent = (onClick, targetingMsgJson, contentDiv, divId, isLegacy, _device, _session) => {\n if (onClick !== '' && onClick != null) {\n let ctaElement\n let jsCTAElements\n if (isLegacy) {\n ctaElement = contentDiv\n } else if (contentDiv !== null) {\n jsCTAElements = contentDiv.getElementsByClassName('jsCT_CTA')\n if (jsCTAElements != null && jsCTAElements.length === 1) {\n ctaElement = jsCTAElements[0]\n }\n }\n const jsFunc = targetingMsgJson.display.jsFunc\n const isPreview = targetingMsgJson.display.preview\n if (isPreview == null) {\n onClick += getCookieParams(_device, _session)\n }\n\n if (ctaElement != null) {\n ctaElement.onclick = () => {\n // invoke js function call\n if (jsFunc != null) {\n // track notification clicked event\n if (isPreview == null) {\n RequestDispatcher.fireRequest(onClick)\n }\n invokeExternalJs(jsFunc, targetingMsgJson)\n // close iframe. using -1 for no campaignId\n closeIframe('-1', divId, _session.sessionId)\n } else {\n const rValue = targetingMsgJson.display.preview ? targetingMsgJson.display.onClick : new URL(targetingMsgJson.display.onClick).searchParams.get('r')\n const campaignId = targetingMsgJson.wzrk_id.split('_')[0]\n\n if (rValue === 'pushPrompt') {\n if (!targetingMsgJson.display.preview) {\n window.parent.clevertap.renderNotificationClicked({ msgId: targetingMsgJson.wzrk_id, pivotId: targetingMsgJson.wzrk_pivot })\n }\n // Open Web Push Soft prompt\n window.clevertap.notifications.push({\n skipDialog: true\n })\n closeIframe(campaignId, divId, _session.sessionId)\n } else if (rValue === 'none') {\n // Close notification\n closeIframe(campaignId, divId, _session.sessionId)\n } else {\n // Will get the url to open\n if (targetingMsgJson.display.window === 1) {\n window.open(onClick, '_blank')\n if (targetingMsgJson.display['close-popup']) {\n closeIframe(campaignId, divId, _session.sessionId)\n }\n if (!targetingMsgJson.display.preview) {\n window.parent.clevertap.renderNotificationClicked({ msgId: targetingMsgJson.wzrk_id, pivotId: targetingMsgJson.wzrk_pivot })\n }\n } else {\n window.location = onClick\n }\n }\n }\n }\n }\n }\n}\n\nexport const getCookieParams = (_device, _session) => {\n const gcookie = _device.getGuid()\n const scookieObj = _session.getSessionCookieObject()\n return '&t=wc&d=' + encodeURIComponent(compressToBase64(gcookie + '|' + scookieObj.p + '|' + scookieObj.s))\n}\n","export const renderPopUpImageOnly = (targetingMsgJson, _session) => {\n const divId = 'wzrkImageOnlyDiv'\n const popupImageOnly = document.createElement('ct-web-popup-imageonly')\n popupImageOnly.session = _session\n popupImageOnly.target = targetingMsgJson\n const containerEl = document.getElementById(divId)\n containerEl.innerHTML = ''\n containerEl.style.visibility = 'hidden'\n containerEl.appendChild(popupImageOnly)\n}\n","export const getBoxPromptStyles = (style) => {\n const totalBorderWidth = style.card.borderEnabled ? style.card.border.borderWidth * 2 : 0\n const cardPadding = 16 * 2 // Left and right padding\n const cardContentWidth = 360 - cardPadding - totalBorderWidth\n\n return `\n #pnWrapper {\n width: 360px;\n }\n\n #pnOverlay {\n background-color: ${style.overlay.color || 'rgba(0, 0, 0, .15)'};\n position: fixed;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n z-index: 10000\n }\n\n #pnCard {\n background-color: ${style.card.color};\n border-radius: ${style.card.borderRadius}px;\n padding: 16px;\n width: ${cardContentWidth}px;\n position: fixed;\n z-index: 999999;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n ${style.card.borderEnabled ? `\n border-width: ${style.card.border.borderWidth}px;\n border-color: ${style.card.border.borderColor};\n border-style: solid;\n ` : ''}\n height: fit-content;\n }\n\n #iconTitleDescWrapper {\n display: flex;\n align-items: center;\n margin-bottom: 16px;\n gap: 12px;\n }\n\n #iconContainer {\n min-width: 64px;\n max-width: 64px;\n aspect-ratio: 1;\n object-fit: cover;\n }\n\n #titleDescWrapper {\n flex-grow: 1;\n overflow: hidden;\n overflow-wrap: break-word;\n }\n\n #title {\n font-size: 16px;\n font-weight: 700;\n color: ${style.text.titleColor};\n margin-bottom: 4px;\n line-height: 24px;\n }\n\n #description {\n font-size: 14px;\n font-weight: 500;\n color: ${style.text.descriptionColor};\n line-height: 20px;\n }\n\n #buttonsContainer {\n display: flex;\n justify-content: space-between;\n min-height: 32px;\n gap: 8px;\n align-items: center;\n }\n\n #primaryButton, #secondaryButton {\n padding: 6px 24px;\n flex: 1;\n cursor: pointer;\n font-weight: bold;\n display: flex;\n align-items: center;\n justify-content: center;\n height: max-content;\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n }\n\n #primaryButton {\n background-color: ${style.buttons.primaryButton.buttonColor};\n color: ${style.buttons.primaryButton.textColor};\n border-radius: ${style.buttons.primaryButton.borderRadius}px;\n ${style.buttons.primaryButton.borderEnabled\n ? `\n border-width: ${style.buttons.primaryButton.border.borderWidth}px;\n border-color: ${style.buttons.primaryButton.border.borderColor};\n border-style: solid;\n `\n : 'border: none;'}\n }\n\n #secondaryButton {\n background-color: ${style.buttons.secondaryButton.buttonColor};\n color: ${style.buttons.secondaryButton.textColor};\n border-radius: ${style.buttons.secondaryButton.borderRadius}px;\n ${style.buttons.secondaryButton.borderEnabled\n ? `\n border-width: ${style.buttons.secondaryButton.border.borderWidth}px;\n border-color: ${style.buttons.secondaryButton.border.borderColor};\n border-style: solid;\n `\n : 'border: none;'}\n }\n\n #primaryButton:hover, #secondaryButton:hover {\n opacity: 0.9;\n }\n `\n}\n\nexport const getBellIconStyles = (style) => {\n return `\n #bell_wrapper {\n position: fixed;\n cursor: pointer;\n background-color: ${style.card.backgroundColor};\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n width: 48px;\n height: 48px;\n border-radius: 50%;\n display: flex;\n flex-direction: column;\n gap: 8px;\n z-index: 999999;\n }\n\n #bell_icon {\n display: block;\n width: 48px;\n height: 48px;\n }\n\n #bell_wrapper:hover {\n transform: scale(1.05);\n transition: transform 0.2s ease-in-out;\n }\n\n #bell_tooltip {\n display: none;\n background-color: #2b2e3e;\n color: #fff;\n border-radius: 4px;\n padding: 4px;\n white-space: nowrap;\n pointer-events: none;\n font-size: 14px;\n line-height: 1.4;\n }\n\n #gif_modal {\n display: none;\n background-color: #ffffff;\n padding: 4px;\n width: 400px;\n height: 256px;\n border-radius: 4px;\n position: relative;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n cursor: default;\n }\n\n #gif_image {\n object-fit: contain;\n width: 100%;\n height: 100%;\n }\n\n #close_modal {\n position: absolute;\n width: 24px;\n height: 24px;\n top: 8px;\n right: 8px;\n background: rgba(238, 238, 238, 0.8);\n text-align: center;\n line-height: 20px;\n border-radius: 4px;\n color: #000000;\n font-size: 22px;\n cursor: pointer;\n }\n `\n}\n","import { StorageManager, $ct } from '../util/storage'\nimport { isObject } from '../util/datatypes'\nimport {\n PUSH_SUBSCRIPTION_DATA\n} from '../util/constants'\nimport {\n urlBase64ToUint8Array\n} from '../util/encoder'\nimport { enablePush } from './webPushPrompt/prompt'\n\nexport default class NotificationHandler extends Array {\n #oldValues\n #logger\n #request\n #account\n #wizAlertJSPath\n #fcmPublicKey\n\n constructor ({\n logger,\n session,\n request,\n account\n }, values) {\n super()\n this.#wizAlertJSPath = 'https://d2r1yp2w7bby2u.cloudfront.net/js/wzrk_dialog.min.js'\n this.#fcmPublicKey = null\n this.#oldValues = values\n this.#logger = logger\n this.#request = request\n this.#account = account\n }\n\n push (...displayArgs) {\n this.#setUpWebPush(displayArgs)\n return 0\n }\n\n enable (options = {}) {\n const { swPath } = options\n enablePush(this.#logger, this.#account, this.#request, swPath)\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#setUpWebPush(this.#oldValues)\n }\n this.#oldValues = null\n }\n\n #setUpWebPush (displayArgs) {\n if ($ct.webPushEnabled && displayArgs.length > 0) {\n this.#handleNotificationRegistration(displayArgs)\n } else if ($ct.webPushEnabled == null && displayArgs.length > 0) {\n $ct.notifApi.notifEnabledFromApi = true\n $ct.notifApi.displayArgs = displayArgs.slice()\n } else if ($ct.webPushEnabled === false && displayArgs.length > 0) {\n this.#logger.error('Make sure push notifications are fully enabled and integrated')\n }\n }\n\n setUpWebPushNotifications (subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsServiceUrl) {\n if (navigator.userAgent.indexOf('Chrome') !== -1 || navigator.userAgent.indexOf('Firefox') !== -1) {\n this.#setUpChromeFirefoxNotifications(subscriptionCallback, serviceWorkerPath)\n } else if (navigator.userAgent.indexOf('Safari') !== -1) {\n this.#setUpSafariNotifications(subscriptionCallback, apnsWebPushId, apnsServiceUrl)\n }\n }\n\n setApplicationServerKey (applicationServerKey) {\n this.#fcmPublicKey = applicationServerKey\n }\n\n #setUpSafariNotifications (subscriptionCallback, apnsWebPushId, apnsServiceUrl) {\n // ensure that proper arguments are passed\n if (typeof apnsWebPushId === 'undefined') {\n this.#logger.error('Ensure that APNS Web Push ID is supplied')\n }\n if (typeof apnsServiceUrl === 'undefined') {\n this.#logger.error('Ensure that APNS Web Push service path is supplied')\n }\n if ('safari' in window && 'pushNotification' in window.safari) {\n window.safari.pushNotification.requestPermission(\n apnsServiceUrl,\n apnsWebPushId, {}, (subscription) => {\n if (subscription.permission === 'granted') {\n const subscriptionData = JSON.parse(JSON.stringify(subscription))\n subscriptionData.endpoint = subscription.deviceToken\n subscriptionData.browser = 'Safari'\n StorageManager.saveToLSorCookie(PUSH_SUBSCRIPTION_DATA, subscriptionData)\n\n this.#request.registerToken(subscriptionData)\n this.#logger.info('Safari Web Push registered. Device Token: ' + subscription.deviceToken)\n } else if (subscription.permission === 'denied') {\n this.#logger.info('Error subscribing to Safari web push')\n }\n })\n }\n }\n\n /**\n * Sets up a service worker for WebPush(chrome/Firefox) push notifications and sends the data to LC\n */\n #setUpChromeFirefoxNotifications (subscriptionCallback, serviceWorkerPath) {\n let registrationScope = ''\n\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.register(serviceWorkerPath).then((registration) => {\n if (typeof __wzrk_account_id !== 'undefined') { // eslint-disable-line\n // shopify accounts , since the service worker is not at root, serviceWorker.ready is never resolved.\n // hence add a timeout and hope serviceWroker is ready within that time.\n return new Promise(resolve => setTimeout(() => resolve(registration), 5000))\n }\n registrationScope = registration.scope\n\n // IF SERVICE WORKER IS AT ROOT, RETURN THE READY PROMISE\n // ELSE IF CHROME RETURN PROMISE AFTER 5 SECONDS\n // OR getRegistrations PROMISE IF ITS FIREFOX\n const rootDirRegex = /^(\\.?)(\\/?)([^/]*).js$/\n const isServiceWorkerAtRoot = rootDirRegex.test(serviceWorkerPath)\n if (isServiceWorkerAtRoot) {\n return navigator.serviceWorker.ready\n } else {\n if (navigator.userAgent.indexOf('Chrome') !== -1) {\n return new Promise(resolve => setTimeout(() => resolve(registration), 5000))\n } else {\n return navigator.serviceWorker.getRegistrations()\n }\n }\n }).then((serviceWorkerRegistration) => {\n // ITS AN ARRAY IN CASE OF FIREFOX, SO USE THE REGISTRATION WITH PROPER SCOPE\n if (navigator.userAgent.indexOf('Firefox') !== -1 && Array.isArray(serviceWorkerRegistration)) {\n serviceWorkerRegistration = serviceWorkerRegistration.filter((i) => i.scope === registrationScope)[0]\n }\n const subscribeObj = { userVisibleOnly: true }\n\n if (this.#fcmPublicKey != null) {\n subscribeObj.applicationServerKey = urlBase64ToUint8Array(this.#fcmPublicKey)\n }\n\n serviceWorkerRegistration.pushManager.subscribe(subscribeObj)\n .then((subscription) => {\n this.#logger.info('Service Worker registered. Endpoint: ' + subscription.endpoint)\n\n // convert the subscription keys to strings; this sets it up nicely for pushing to LC\n const subscriptionData = JSON.parse(JSON.stringify(subscription))\n\n // remove the common chrome/firefox endpoint at the beginning of the token\n if (navigator.userAgent.indexOf('Chrome') !== -1) {\n subscriptionData.endpoint = subscriptionData.endpoint.split('/').pop()\n subscriptionData.browser = 'Chrome'\n } else if (navigator.userAgent.indexOf('Firefox') !== -1) {\n subscriptionData.endpoint = subscriptionData.endpoint.split('/').pop()\n subscriptionData.browser = 'Firefox'\n }\n StorageManager.saveToLSorCookie(PUSH_SUBSCRIPTION_DATA, subscriptionData)\n this.#request.registerToken(subscriptionData)\n\n if (typeof subscriptionCallback !== 'undefined' && typeof subscriptionCallback === 'function') {\n subscriptionCallback()\n }\n const existingBellWrapper = document.getElementById('bell_wrapper')\n if (existingBellWrapper) {\n existingBellWrapper.parentNode.removeChild(existingBellWrapper)\n }\n }).catch((error) => {\n // unsubscribe from webpush if error\n serviceWorkerRegistration.pushManager.getSubscription().then((subscription) => {\n if (subscription !== null) {\n subscription.unsubscribe().then((successful) => {\n // You've successfully unsubscribed\n this.#logger.info('Unsubscription successful')\n window.clevertap.notifications.push({\n skipDialog: true\n })\n }).catch((e) => {\n // Unsubscription failed\n this.#logger.error('Error unsubscribing: ' + e)\n })\n }\n })\n this.#logger.error('Error subscribing: ' + error)\n })\n }).catch((err) => {\n this.#logger.error('error registering service worker: ' + err)\n })\n }\n }\n\n #addWizAlertJS () {\n const scriptTag = document.createElement('script')\n scriptTag.setAttribute('type', 'text/javascript')\n scriptTag.setAttribute('id', 'wzrk-alert-js')\n scriptTag.setAttribute('src', this.#wizAlertJSPath)\n\n // add the script tag to the end of the body\n document.getElementsByTagName('body')[0].appendChild(scriptTag)\n\n return scriptTag\n }\n\n #removeWizAlertJS () {\n const scriptTag = document.getElementById('wzrk-alert-js')\n scriptTag.parentNode.removeChild(scriptTag)\n }\n\n #handleNotificationRegistration (displayArgs) {\n // make sure everything is specified\n let titleText\n let bodyText\n let okButtonText\n let rejectButtonText\n let okButtonColor\n let skipDialog\n let askAgainTimeInSeconds\n let okCallback\n let rejectCallback\n let subscriptionCallback\n let serviceWorkerPath\n let httpsPopupPath\n let httpsIframePath\n let apnsWebPushId\n let apnsWebPushServiceUrl\n\n if (displayArgs.length === 1) {\n if (isObject(displayArgs[0])) {\n const notifObj = displayArgs[0]\n titleText = notifObj.titleText\n bodyText = notifObj.bodyText\n okButtonText = notifObj.okButtonText\n rejectButtonText = notifObj.rejectButtonText\n okButtonColor = notifObj.okButtonColor\n skipDialog = notifObj.skipDialog\n askAgainTimeInSeconds = notifObj.askAgainTimeInSeconds\n okCallback = notifObj.okCallback\n rejectCallback = notifObj.rejectCallback\n subscriptionCallback = notifObj.subscriptionCallback\n serviceWorkerPath = notifObj.serviceWorkerPath\n httpsPopupPath = notifObj.httpsPopupPath\n httpsIframePath = notifObj.httpsIframePath\n apnsWebPushId = notifObj.apnsWebPushId\n apnsWebPushServiceUrl = notifObj.apnsWebPushServiceUrl\n }\n } else {\n titleText = displayArgs[0]\n bodyText = displayArgs[1]\n okButtonText = displayArgs[2]\n rejectButtonText = displayArgs[3]\n okButtonColor = displayArgs[4]\n skipDialog = displayArgs[5]\n askAgainTimeInSeconds = displayArgs[6]\n }\n\n if (skipDialog == null) {\n skipDialog = false\n }\n\n if (serviceWorkerPath == null) {\n serviceWorkerPath = '/clevertap_sw.js'\n }\n\n // ensure that the browser supports notifications\n if (typeof navigator.serviceWorker === 'undefined') {\n return\n }\n\n const isHTTP = httpsPopupPath != null && httpsIframePath != null\n\n // make sure the site is on https for chrome notifications\n if (window.location.protocol !== 'https:' && document.location.hostname !== 'localhost' && !isHTTP) {\n this.#logger.error('Make sure you are https or localhost to register for notifications')\n return\n }\n\n // right now, we only support Chrome V50 & higher & Firefox\n if (navigator.userAgent.indexOf('Chrome') !== -1) {\n const chromeAgent = navigator.userAgent.match(/Chrome\\/(\\d+)/)\n if (chromeAgent == null || parseInt(chromeAgent[1], 10) < 50) { return }\n } else if (navigator.userAgent.indexOf('Firefox') !== -1) {\n const firefoxAgent = navigator.userAgent.match(/Firefox\\/(\\d+)/)\n if (firefoxAgent == null || parseInt(firefoxAgent[1], 10) < 50) { return }\n } else if (navigator.userAgent.indexOf('Safari') !== -1) {\n const safariAgent = navigator.userAgent.match(/Safari\\/(\\d+)/)\n if (safariAgent == null || parseInt(safariAgent[1], 10) < 50) { return }\n } else {\n return\n }\n\n // we check for the cookie in setUpChromeNotifications() the tokens may have changed\n\n if (!isHTTP) {\n const hasNotification = 'Notification' in window\n if (!hasNotification || Notification == null) {\n this.#logger.error('Notification not supported on this Device or Browser')\n return\n }\n // handle migrations from other services -> chrome notifications may have already been asked for before\n if (Notification.permission === 'granted') {\n // skip the dialog and register\n this.setUpWebPushNotifications(subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsWebPushServiceUrl)\n return\n } else if (Notification.permission === 'denied') {\n // we've lost this profile :'(\n return\n }\n\n if (skipDialog) {\n this.setUpWebPushNotifications(subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsWebPushServiceUrl)\n return\n }\n }\n\n // make sure the right parameters are passed\n if (!titleText || !bodyText || !okButtonText || !rejectButtonText) {\n this.#logger.error('Missing input parameters; please specify title, body, ok button and cancel button text')\n return\n }\n\n // make sure okButtonColor is formatted properly\n if (okButtonColor == null || !okButtonColor.match(/^#[a-f\\d]{6}$/i)) {\n okButtonColor = '#f28046' // default color for positive button\n }\n\n // make sure the user isn't asked for notifications more than askAgainTimeInSeconds\n const now = new Date().getTime() / 1000\n if ((StorageManager.getMetaProp('notif_last_time')) == null) {\n StorageManager.setMetaProp('notif_last_time', now)\n } else {\n if (askAgainTimeInSeconds == null) {\n // 7 days by default\n askAgainTimeInSeconds = 7 * 24 * 60 * 60\n }\n\n if (now - StorageManager.getMetaProp('notif_last_time') < askAgainTimeInSeconds) {\n return\n } else {\n // continue asking\n StorageManager.setMetaProp('notif_last_time', now)\n }\n }\n\n if (isHTTP) {\n // add the https iframe\n const httpsIframe = document.createElement('iframe')\n httpsIframe.setAttribute('style', 'display:none;')\n httpsIframe.setAttribute('src', httpsIframePath)\n document.body.appendChild(httpsIframe)\n window.addEventListener('message', (event) => {\n if (event.data != null) {\n let obj = {}\n try {\n obj = JSON.parse(event.data)\n } catch (e) {\n // not a call from our iframe\n return\n }\n if (obj.state != null) {\n if (obj.from === 'ct' && obj.state === 'not') {\n this.#addWizAlertJS().onload = () => {\n // create our wizrocket popup\n window.wzrkPermissionPopup.wizAlert({\n title: titleText,\n body: bodyText,\n confirmButtonText: okButtonText,\n confirmButtonColor: okButtonColor,\n rejectButtonText: rejectButtonText\n }, (enabled) => { // callback function\n if (enabled) {\n // the user accepted on the dialog box\n if (typeof okCallback === 'function') {\n okCallback()\n }\n // redirect to popup.html\n window.open(httpsPopupPath)\n } else {\n if (typeof rejectCallback === 'function') {\n rejectCallback()\n }\n }\n this.#removeWizAlertJS()\n })\n }\n }\n }\n }\n }, false)\n } else {\n this.#addWizAlertJS().onload = () => {\n // create our wizrocket popup\n window.wzrkPermissionPopup.wizAlert({\n title: titleText,\n body: bodyText,\n confirmButtonText: okButtonText,\n confirmButtonColor: okButtonColor,\n rejectButtonText: rejectButtonText\n }, (enabled) => { // callback function\n if (enabled) {\n // the user accepted on the dialog box\n if (typeof okCallback === 'function') {\n okCallback()\n }\n this.setUpWebPushNotifications(subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsWebPushServiceUrl)\n } else {\n if (typeof rejectCallback === 'function') {\n rejectCallback()\n }\n }\n this.#removeWizAlertJS()\n })\n }\n }\n }\n\n _enableWebPush (enabled, applicationServerKey) {\n $ct.webPushEnabled = enabled\n if (applicationServerKey != null) {\n this.setApplicationServerKey(applicationServerKey)\n }\n if ($ct.webPushEnabled && $ct.notifApi.notifEnabledFromApi) {\n this.#handleNotificationRegistration($ct.notifApi.displayArgs)\n } else if (!$ct.webPushEnabled && $ct.notifApi.notifEnabledFromApi) {\n this.#logger.error('Ensure that web push notifications are fully enabled and integrated before requesting them')\n }\n }\n}\n","export const BELL_BASE64 = 'PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMi40OTYyIDUuMjQzOTVDMTIuODM5MSA1LjAzMzE3IDEzLjI4NDcgNS4xNDY4OSAxMy40OTczIDUuNDg4NjdDMTMuNzIyMyA1Ljg1MDE4IDEzLjYwMDIgNi4zMjUxOCAxMy4yMzggNi41NDkwMkM3LjM5Mzk5IDEwLjE2MDYgMy41IDE2LjYyNTcgMy41IDI0LjAwMDNDMy41IDM1LjMyMjEgMTIuNj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gMzkuNTc0NkM0MS41OTg0IDM4Ljc2IDQwLjkzOCAzOC4wOTk1IDQwLjEyMzMgMzguMDk5NUg0MC4xMjEyVjI5LjI1ODJDNDAuMTIxMiAyNS41OTQ2IDM3LjQ1MzMgMjIuNTU0MiAzMy45NTQzIDIxLjk3MzZMMzMuOTU0NCAyMS45NTM0QzMzLjk1NDQgMjAuODc0NiAzMy4wNzc1IDIwIDMxLjk5ODYgMjBaIiBmaWxsPSJ3aGl0ZSIvPgo8cmVjdCBvcGFjaXR5PSIwLjUiIHg9IjcuNSIgeT0iNy41IiB3aWR0aD0iNDkiIGhlaWdodD0iNDkiIHJ4PSIyNC41IiBzdHJva2U9IndoaXRlIi8+CjxyZWN0IG9wYWNpdHk9IjAuMyIgeD0iNC41IiB5PSI0LjUiIHdpZHRoPSI1NSIgaGVpZ2h0PSI1NSIgcng9IjI3LjUiIHN0cm9rZT0id2hpdGUiLz4KPHJlY3Qgb3BhY2l0eT0iMC44IiB4PSIxMC41IiB5PSIxMC41IiB3aWR0aD0iNDMiIGhlaWdodD0iNDMiIHJ4PSIyMS41IiBzdHJva2U9IndoaXRlIi8+Cjwvc3ZnPgo='\n","import { getBellIconStyles, getBoxPromptStyles } from './promptStyles.js'\nimport { WEBPUSH_CONFIG } from '../../util/constants.js'\nimport { StorageManager, $ct } from '../../util/storage.js'\nimport NotificationHandler from '../notification.js'\nimport { BELL_BASE64, PROMPT_BELL_BASE64 } from './promptConstants.js'\n\nlet appServerKey = null\nlet swPath = '/clevertap_sw.js'\nlet notificationHandler = null\n\nexport const processWebPushConfig = (webPushConfig, logger, request) => {\n const _pushConfig = StorageManager.readFromLSorCookie(WEBPUSH_CONFIG) || {}\n\n const updatePushConfig = () => {\n $ct.pushConfig = webPushConfig\n StorageManager.saveToLSorCookie(WEBPUSH_CONFIG, webPushConfig)\n }\n\n if (webPushConfig.isPreview) {\n updatePushConfig()\n enablePush(logger, null, request)\n } else if (JSON.stringify(_pushConfig) !== JSON.stringify(webPushConfig)) {\n updatePushConfig()\n }\n}\n\nexport const enablePush = (logger, account, request, customSwPath) => {\n const _pushConfig = StorageManager.readFromLSorCookie(WEBPUSH_CONFIG) || {}\n $ct.pushConfig = _pushConfig\n if (!$ct.pushConfig) {\n logger.error('Web Push config data not present')\n return\n }\n\n if (customSwPath) { swPath = customSwPath }\n\n notificationHandler = new NotificationHandler({ logger, session: {}, request, account })\n const { showBox, boxType, showBellIcon, isPreview } = $ct.pushConfig\n\n if (isPreview) {\n if ($ct.pushConfig.boxConfig) createNotificationBox($ct.pushConfig)\n if ($ct.pushConfig.bellIconConfig) createBellIcon($ct.pushConfig)\n } else {\n if (showBox && boxType === 'new') createNotificationBox($ct.pushConfig)\n if (showBellIcon) createBellIcon($ct.pushConfig)\n }\n}\n\nconst createElementWithAttributes = (tag, attributes = {}) => {\n const element = document.createElement(tag)\n Object.entries(attributes).forEach(([key, value]) => {\n element[key] = value\n })\n return element\n}\n\nexport const createNotificationBox = (configData) => {\n if (document.getElementById('pnWrapper')) return\n\n const { boxConfig: { content, style } } = configData\n\n // Create the wrapper div\n const wrapper = createElementWithAttributes('div', { id: 'pnWrapper' })\n const overlayDiv = createElementWithAttributes('div', { id: 'pnOverlay' })\n const pnCard = createElementWithAttributes('div', { id: 'pnCard' })\n\n const iconTitleDescWrapper = createElementWithAttributes('div', { id: 'iconTitleDescWrapper' })\n const iconContainer = createElementWithAttributes('img', {\n id: 'iconContainer',\n src: content.icon.type === 'default' ? `data:image/svg+xml;base64,${PROMPT_BELL_BASE64}` : content.icon.url\n })\n\n iconTitleDescWrapper.appendChild(iconContainer)\n\n const titleDescWrapper = createElementWithAttributes('div', { id: 'titleDescWrapper' })\n titleDescWrapper.appendChild(createElementWithAttributes('div', { id: 'title', textContent: content.title }))\n titleDescWrapper.appendChild(createElementWithAttributes('div', { id: 'description', textContent: content.description }))\n\n iconTitleDescWrapper.appendChild(titleDescWrapper)\n\n const buttonsContainer = createElementWithAttributes('div', { id: 'buttonsContainer' })\n\n const primaryButton = createElementWithAttributes('button', {\n id: 'primaryButton',\n textContent: content.buttons.primaryButtonText\n })\n const secondaryButton = createElementWithAttributes('button', {\n id: 'secondaryButton',\n textContent: content.buttons.secondaryButtonText\n })\n buttonsContainer.appendChild(secondaryButton)\n buttonsContainer.appendChild(primaryButton)\n\n pnCard.appendChild(iconTitleDescWrapper)\n pnCard.appendChild(buttonsContainer)\n\n // Apply styles\n const styleElement = createElementWithAttributes('style', { textContent: getBoxPromptStyles(style) })\n\n wrapper.appendChild(styleElement)\n wrapper.appendChild(pnCard)\n wrapper.appendChild(overlayDiv)\n\n setElementPosition(pnCard, style.card.position)\n\n const now = new Date().getTime() / 1000\n const lastNotifTime = StorageManager.getMetaProp('webpush_last_notif_time')\n const popupFrequency = content.popupFrequency || 7 * 24 * 60 * 60\n\n if (!lastNotifTime || now - lastNotifTime >= popupFrequency * 24 * 60 * 60) {\n document.body.appendChild(wrapper)\n if (!configData.isPreview) { addEventListeners(wrapper) }\n }\n}\n\nexport const createBellIcon = (configData) => {\n if (document.getElementById('bell_wrapper') || Notification.permission === 'granted') return\n\n const { bellIconConfig: { content, style } } = configData\n\n const bellWrapper = createElementWithAttributes('div', { id: 'bell_wrapper' })\n const bellIcon = createElementWithAttributes('img', {\n id: 'bell_icon',\n src: content.icon.type === 'default' ? `data:image/svg+xml;base64,${BELL_BASE64}` : content.icon.url\n })\n\n // For playing gif\n const gifModal = createElementWithAttributes('div', { id: 'gif_modal', style: 'display: none;' })\n const gifImage = createElementWithAttributes('img', {\n id: 'gif_image',\n src: 'https://d2r1yp2w7bby2u.cloudfront.net/js/permission_grant.gif'\n })\n const closeModal = createElementWithAttributes('div', { id: 'close_modal', innerHTML: '×' })\n\n gifModal.appendChild(gifImage)\n gifModal.appendChild(closeModal)\n\n bellWrapper.appendChild(bellIcon)\n bellWrapper.appendChild(gifModal)\n if (content.hoverText.enabled) {\n const tooltip = createElementWithAttributes('div', {\n id: 'bell_tooltip',\n textContent: content.hoverText.text\n })\n bellWrapper.appendChild(tooltip)\n }\n\n setElementPosition(bellWrapper, style.card.position)\n // Apply styles\n const styleElement = createElementWithAttributes('style', { textContent: getBellIconStyles(style) })\n\n document.head.appendChild(styleElement)\n document.body.appendChild(bellWrapper)\n\n if (!configData.isPreview) {\n addBellEventListeners(bellWrapper)\n }\n return bellWrapper\n}\n\nexport const setServerKey = (serverKey) => {\n appServerKey = serverKey\n}\n\nexport const addEventListeners = (wrapper) => {\n const primaryButton = wrapper.querySelector('#primaryButton')\n const secondaryButton = wrapper.querySelector('#secondaryButton')\n\n const removeWrapper = () => wrapper.parentNode?.removeChild(wrapper)\n\n primaryButton.addEventListener('click', () => {\n removeWrapper()\n notificationHandler.setApplicationServerKey(appServerKey)\n notificationHandler.setUpWebPushNotifications(null, swPath, null, null)\n })\n\n secondaryButton.addEventListener('click', () => {\n StorageManager.setMetaProp('webpush_last_notif_time', Date.now() / 1000)\n removeWrapper()\n })\n}\n\nexport const addBellEventListeners = (bellWrapper) => {\n const bellIcon = bellWrapper.querySelector('#bell_icon')\n bellIcon.addEventListener('click', () => {\n if (Notification.permission === 'denied') {\n toggleGifModal(bellWrapper)\n } else {\n notificationHandler.setApplicationServerKey(appServerKey)\n notificationHandler.setUpWebPushNotifications(null, swPath, null, null)\n if (Notification.permission === 'granted') {\n bellWrapper.remove()\n }\n }\n })\n bellIcon.addEventListener('mouseenter', () => displayTooltip(bellWrapper))\n bellIcon.addEventListener('mouseleave', () => clearTooltip(bellWrapper))\n bellWrapper.querySelector('#close_modal').addEventListener('click', () => toggleGifModal(bellWrapper))\n}\n\nexport const setElementPosition = (element, position) => {\n Object.assign(element.style, {\n inset: 'auto',\n transform: 'none'\n })\n\n const positions = {\n 'Top Right': { inset: '16px 16px auto auto' },\n 'Top Left': { inset: '16px auto auto 16px' },\n 'Bottom Right': { inset: 'auto 16px 16px auto' },\n 'Bottom Left': { inset: 'auto auto 16px 16px' },\n Center: { inset: '50%', transform: 'translate(-50%, -50%)' },\n Top: { inset: '16px auto auto 50%', transform: 'translateX(-50%)' },\n Bottom: { inset: 'auto auto 16px 50%', transform: 'translateX(-50%)' }\n }\n\n Object.assign(element.style, positions[position] || positions['top-right'])\n}\n\nconst displayTooltip = (bellWrapper) => {\n const gifModal = bellWrapper.querySelector('#gif_modal')\n if (gifModal.style.display === 'flex') {\n return\n }\n const tooltip = bellWrapper.querySelector('#bell_tooltip')\n if (tooltip) {\n tooltip.style.display = 'flex'\n }\n\n const bellIcon = bellWrapper.querySelector('#bell_icon')\n const bellRect = bellIcon.getBoundingClientRect()\n var midX = window.innerWidth / 2\n var midY = window.innerHeight / 2\n bellWrapper.style['flex-direction'] = bellRect.y > midY ? 'column-reverse' : 'column'\n bellWrapper.style['align-items'] = bellRect.x > midX ? 'flex-end' : 'flex-start'\n}\n\nconst clearTooltip = (bellWrapper) => {\n const tooltip = bellWrapper.querySelector('#bell_tooltip')\n if (tooltip) {\n tooltip.style.display = 'none'\n }\n}\n\nconst toggleGifModal = (bellWrapper) => {\n clearTooltip(bellWrapper)\n const gifModal = bellWrapper.querySelector('#gif_modal')\n gifModal.style.display = gifModal.style.display === 'none' ? 'flex' : 'none'\n}\n","import {\n addToLocalProfileMap,\n arp,\n getCampaignObject,\n saveCampaignObject\n} from './clevertap'\n\nimport {\n CAMP_COOKIE_NAME,\n DISPLAY,\n GLOBAL,\n EV_COOKIE,\n NOTIFICATION_CLICKED,\n WZRK_PREFIX,\n WZRK_ID\n} from './constants'\n\nimport {\n getNow,\n getToday\n} from './datetime'\n\nimport { StorageManager, $ct } from './storage'\nimport RequestDispatcher from './requestDispatcher'\nimport { CTWebPopupImageOnly } from './web-popupImageonly/popupImageonly'\nimport { checkAndRegisterWebInboxElements, initializeWebInbox, processWebInboxSettings, hasWebInboxSettingsInLS, processInboxNotifs } from '../modules/web-inbox/helper'\nimport { renderVisualBuilder } from '../modules/visualBuilder/pageBuilder'\nimport { handleKVpairCampaign, renderPersonalisationBanner, renderPersonalisationCarousel } from './campaignRender/nativeDisplay'\nimport { appendScriptForCustomEvent, getCookieParams, incrementImpression, invokeExternalJs, mergeEventMap, setupClickEvent, staleDataUpdate } from './campaignRender/utilities'\nimport { renderPopUpImageOnly } from './campaignRender/webPopup'\nimport { processWebPushConfig } from '../modules/webPushPrompt/prompt'\n\nconst _tr = (msg, {\n device,\n session,\n request,\n logger\n}) => {\n const _device = device\n const _session = session\n const _request = request\n const _logger = logger\n let _wizCounter = 0\n // Campaign House keeping\n const doCampHouseKeeping = (targetingMsgJson) => {\n const campaignId = targetingMsgJson.wzrk_id.split('_')[0]\n const today = getToday()\n\n const incrCount = (obj, campaignId, excludeFromFreqCaps) => {\n let currentCount = 0\n let totalCount = 0\n if (obj[campaignId] != null) {\n currentCount = obj[campaignId]\n }\n currentCount++\n if (obj.tc != null) {\n totalCount = obj.tc\n }\n // if exclude from caps then dont add to total counts\n if (excludeFromFreqCaps < 0) {\n totalCount++\n }\n\n obj.tc = totalCount\n obj[campaignId] = currentCount\n }\n\n if (StorageManager._isLocalStorageSupported()) {\n delete sessionStorage[CAMP_COOKIE_NAME]\n var campTypeObj = {}\n const campObj = getCampaignObject()\n if (targetingMsgJson.display.wtarget_type === 3 && campObj.hasOwnProperty('wi')) {\n campTypeObj = campObj.wi\n } else if ((targetingMsgJson.display.wtarget_type === 0 || targetingMsgJson.display.wtarget_type === 1) && campObj.hasOwnProperty('wp')) {\n campTypeObj = campObj.wp\n } else {\n campTypeObj = {}\n }\n if (campObj.hasOwnProperty('global')) {\n campTypeObj.wp = campObj\n }\n // global session limit. default is 1\n if (targetingMsgJson[DISPLAY].wmc == null) {\n targetingMsgJson[DISPLAY].wmc = 1\n }\n\n // global session limit for web inbox. default is 1\n if (targetingMsgJson[DISPLAY].wimc == null) {\n targetingMsgJson[DISPLAY].wimc = 1\n }\n\n var excludeFromFreqCaps = -1 // efc - Exclude from frequency caps\n let campaignSessionLimit = -1 // mdc - Once per session\n let campaignDailyLimit = -1 // tdc - Once per day\n let campaignTotalLimit = -1 // tlc - Once per user for the duration of campaign\n let totalDailyLimit = -1\n let totalSessionLimit = -1 // wmc - Web Popup Global Session Limit\n let totalInboxSessionLimit = -1 // wimc - Web Inbox Global Session Limit\n\n if (targetingMsgJson[DISPLAY].efc != null) { // exclude from frequency cap\n excludeFromFreqCaps = parseInt(targetingMsgJson[DISPLAY].efc, 10)\n }\n if (targetingMsgJson[DISPLAY].mdc != null) { // Campaign Session Limit\n campaignSessionLimit = parseInt(targetingMsgJson[DISPLAY].mdc, 10)\n }\n if (targetingMsgJson[DISPLAY].tdc != null) { // No of web popups in a day per campaign\n campaignDailyLimit = parseInt(targetingMsgJson[DISPLAY].tdc, 10)\n }\n if (targetingMsgJson[DISPLAY].tlc != null) { // Total lifetime count\n campaignTotalLimit = parseInt(targetingMsgJson[DISPLAY].tlc, 10)\n }\n if (targetingMsgJson[DISPLAY].wmp != null) { // No of campaigns per day\n totalDailyLimit = parseInt(targetingMsgJson[DISPLAY].wmp, 10)\n }\n if (targetingMsgJson[DISPLAY].wmc != null) { // No of campaigns per session\n totalSessionLimit = parseInt(targetingMsgJson[DISPLAY].wmc, 10)\n }\n\n if (targetingMsgJson[DISPLAY].wimc != null) { // No of inbox campaigns per session\n totalInboxSessionLimit = parseInt(targetingMsgJson[DISPLAY].wimc, 10)\n }\n // session level capping\n var sessionObj = campTypeObj[_session.sessionId]\n if (sessionObj) {\n const campaignSessionCount = sessionObj[campaignId]\n const totalSessionCount = sessionObj.tc\n // dnd\n if (campaignSessionCount === 'dnd' && !$ct.dismissSpamControl) {\n return false\n }\n\n if (targetingMsgJson[DISPLAY].wtarget_type === 3) {\n // Inbox session\n if (totalInboxSessionLimit > 0 && totalSessionCount >= totalInboxSessionLimit && excludeFromFreqCaps < 0) {\n return false\n }\n } else {\n // session\n if (totalSessionLimit > 0 && totalSessionCount >= totalSessionLimit && excludeFromFreqCaps < 0) {\n return false\n }\n }\n\n // campaign session\n if (campaignSessionLimit > 0 && campaignSessionCount >= campaignSessionLimit) {\n return false\n }\n } else {\n sessionObj = {}\n campTypeObj[_session.sessionId] = sessionObj\n }\n\n // daily level capping\n var dailyObj = campTypeObj[today]\n if (dailyObj != null) {\n const campaignDailyCount = dailyObj[campaignId]\n const totalDailyCount = dailyObj.tc\n // daily\n if (totalDailyLimit > 0 && totalDailyCount >= totalDailyLimit && excludeFromFreqCaps < 0) {\n return false\n }\n // campaign daily\n if (campaignDailyLimit > 0 && campaignDailyCount >= campaignDailyLimit) {\n return false\n }\n } else {\n dailyObj = {}\n campTypeObj[today] = dailyObj\n }\n\n var globalObj = campTypeObj[GLOBAL]\n if (globalObj != null) {\n const campaignTotalCount = globalObj[campaignId]\n // campaign total\n if (campaignTotalLimit > 0 && campaignTotalCount >= campaignTotalLimit) {\n return false\n }\n } else {\n globalObj = {}\n campTypeObj[GLOBAL] = globalObj\n }\n }\n // delay\n const displayObj = targetingMsgJson.display\n if (displayObj.delay != null && displayObj.delay > 0) {\n const delay = displayObj.delay\n displayObj.delay = 0\n setTimeout(_tr, delay * 1000, msg, {\n device: _device,\n session: _session,\n request: _request,\n logger: _logger\n })\n return false\n }\n\n incrCount(sessionObj, campaignId, excludeFromFreqCaps)\n incrCount(dailyObj, campaignId, excludeFromFreqCaps)\n incrCount(globalObj, campaignId, excludeFromFreqCaps)\n\n let campKey = 'wp'\n if (targetingMsgJson[DISPLAY].wtarget_type === 3) {\n campKey = 'wi'\n }\n // get ride of stale sessions and day entries\n const newCampObj = {}\n newCampObj[_session.sessionId] = sessionObj\n newCampObj[today] = dailyObj\n newCampObj[GLOBAL] = globalObj\n saveCampaignObject({ [campKey]: newCampObj })\n }\n\n const setupClickUrl = (onClick, targetingMsgJson, contentDiv, divId, isLegacy) => {\n incrementImpression(targetingMsgJson, _request)\n setupClickEvent(onClick, targetingMsgJson, contentDiv, divId, isLegacy, _device, _session)\n }\n\n const handleImageOnlyPopup = (targetingMsgJson) => {\n const divId = 'wzrkImageOnlyDiv'\n if (doCampHouseKeeping(targetingMsgJson) === false) {\n return\n }\n if ($ct.dismissSpamControl && document.getElementById(divId) != null) {\n const element = document.getElementById(divId)\n element.remove()\n }\n // ImageOnly campaign and Interstitial/Exit Intent shouldn't coexist\n if (document.getElementById(divId) != null || document.getElementById('intentPreview') != null) {\n return\n }\n const msgDiv = document.createElement('div')\n msgDiv.id = divId\n document.body.appendChild(msgDiv)\n if (customElements.get('ct-web-popup-imageonly') === undefined) {\n customElements.define('ct-web-popup-imageonly', CTWebPopupImageOnly)\n }\n return renderPopUpImageOnly(targetingMsgJson, _session)\n }\n\n const isExistingCampaign = (campaignId) => {\n const testIframe = document.getElementById('wiz-iframe-intent') || document.getElementById('wiz-iframe')\n if (testIframe) {\n const iframeDocument = testIframe.contentDocument || testIframe.contentWindow.document\n return iframeDocument.documentElement.innerHTML.includes(campaignId)\n }\n return false\n }\n\n const createTemplate = (targetingMsgJson, isExitIntent) => {\n const campaignId = targetingMsgJson.wzrk_id.split('_')[0]\n const displayObj = targetingMsgJson.display\n\n if (displayObj.layout === 1) { // Handling Web Exit Intent\n return showExitIntent(undefined, targetingMsgJson)\n }\n if (displayObj.layout === 3) { // Handling Web Popup Image Only\n handleImageOnlyPopup(targetingMsgJson)\n return\n }\n\n if (doCampHouseKeeping(targetingMsgJson) === false) {\n return\n }\n\n const divId = 'wizParDiv' + displayObj.layout\n const opacityDivId = 'intentOpacityDiv' + displayObj.layout\n\n if ($ct.dismissSpamControl && document.getElementById(divId) != null) {\n const element = document.getElementById(divId)\n const opacityElement = document.getElementById(opacityDivId)\n if (element) {\n element.remove()\n }\n if (opacityElement) {\n opacityElement.remove()\n }\n }\n if (isExistingCampaign(campaignId)) return\n\n if (document.getElementById(divId) != null) {\n return\n }\n\n $ct.campaignDivMap[campaignId] = divId\n const isBanner = displayObj.layout === 2\n if (isExitIntent) {\n const opacityDiv = document.createElement('div')\n opacityDiv.id = opacityDivId\n const opacity = targetingMsgJson.display.opacity || 0.7\n const rgbaColor = `rgba(0,0,0,${opacity})`\n opacityDiv.setAttribute('style', `position: fixed;top: 0;bottom: 0;left: 0;width: 100%;height: 100%;z-index: 2147483646;background: ${rgbaColor};`)\n document.body.appendChild(opacityDiv)\n }\n const msgDiv = document.createElement('div')\n msgDiv.id = divId\n const viewHeight = window.innerHeight\n const viewWidth = window.innerWidth\n let legacy = false\n\n if (!isBanner) {\n const marginBottom = viewHeight * 5 / 100\n var contentHeight = 10\n let right = viewWidth * 5 / 100\n let bottomPosition = contentHeight + marginBottom\n let width = viewWidth * 30 / 100 + 20\n let widthPerct = 'width:30%;'\n // for small devices - mobile phones\n if ((/mobile/i.test(navigator.userAgent) || (/mini/i.test(navigator.userAgent))) && /iPad/i.test(navigator.userAgent) === false) {\n width = viewWidth * 85 / 100 + 20\n right = viewWidth * 5 / 100\n bottomPosition = viewHeight * 5 / 100\n widthPerct = 'width:80%;'\n // medium devices - tablets\n } else if ('ontouchstart' in window || (/tablet/i.test(navigator.userAgent))) {\n width = viewWidth * 50 / 100 + 20\n right = viewWidth * 5 / 100\n bottomPosition = viewHeight * 5 / 100\n widthPerct = 'width:50%;'\n }\n // legacy footer notif\n if (displayObj.proto == null) {\n legacy = true\n msgDiv.setAttribute('style', 'display:block;overflow:hidden; bottom:' + bottomPosition + 'px !important;width:' + width + 'px !important;right:' + right + 'px !important;position:fixed;z-index:2147483647;')\n } else {\n msgDiv.setAttribute('style', widthPerct + displayObj.iFrameStyle)\n }\n } else {\n msgDiv.setAttribute('style', displayObj.iFrameStyle)\n }\n document.body.appendChild(msgDiv)\n const iframe = document.createElement('iframe')\n\n const borderRadius = displayObj.br === false ? '0' : '8'\n\n iframe.frameborder = '0px'\n iframe.marginheight = '0px'\n iframe.marginwidth = '0px'\n iframe.scrolling = 'no'\n iframe.id = 'wiz-iframe'\n const onClick = targetingMsgJson.display.onClick\n let pointerCss = ''\n if (onClick !== '' && onClick != null) {\n pointerCss = 'cursor:pointer;'\n }\n if (displayObj.preview && displayObj['custom-editor']) {\n iframe.sandbox = 'allow-scripts allow-popups allow-popups-to-escape-sandbox'\n }\n\n let html\n // direct html\n if (targetingMsgJson.msgContent.type === 1) {\n html = targetingMsgJson.msgContent.html\n html = html.replace(/##campaignId##/g, campaignId)\n html = html.replace(/##campaignId_batchId##/g, targetingMsgJson.wzrk_id)\n } else {\n const css = '' +\n '<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 const renderFooterNotification = (targetingMsgJson) => {\n createTemplate(targetingMsgJson, false)\n }\n\n let _callBackCalled = false\n\n const showFooterNotification = (targetingMsgJson) => {\n let onClick = targetingMsgJson.display.onClick\n const displayObj = targetingMsgJson.display\n\n // TODO: Needs wizrocket as a global variable\n if (window.clevertap.hasOwnProperty('notificationCallback') &&\n typeof window.clevertap.notificationCallback !== 'undefined' &&\n typeof window.clevertap.notificationCallback === 'function') {\n const notificationCallback = window.clevertap.notificationCallback\n\n if (!_callBackCalled) {\n const inaObj = {}\n inaObj.msgContent = targetingMsgJson.msgContent\n inaObj.msgId = targetingMsgJson.wzrk_id\n if (targetingMsgJson.wzrk_pivot) {\n inaObj.pivotId = targetingMsgJson.wzrk_pivot\n }\n if (targetingMsgJson.display.kv != null) {\n inaObj.kv = targetingMsgJson.display.kv\n }\n\n window.clevertap.raiseNotificationClicked = () => {\n if (onClick !== '' && onClick != null) {\n const jsFunc = targetingMsgJson.display.jsFunc\n onClick += getCookieParams(_device, _session)\n\n // invoke js function call\n if (jsFunc != null) {\n // track notification clicked event\n RequestDispatcher.fireRequest(onClick)\n invokeExternalJs(jsFunc, targetingMsgJson)\n return\n }\n // pass on the gcookie|page|scookieId for capturing the click event\n if (targetingMsgJson.display.window === 1) {\n window.open(onClick, '_blank')\n } else {\n window.location = onClick\n }\n }\n }\n window.clevertap.raiseNotificationViewed = () => {\n incrementImpression(targetingMsgJson)\n }\n notificationCallback(inaObj)\n _callBackCalled = true\n }\n } else {\n window.clevertap.popupCurrentWzrkId = targetingMsgJson.wzrk_id\n\n if (displayObj.deliveryTrigger) {\n if (displayObj.deliveryTrigger.inactive) {\n triggerByInactivity(targetingMsgJson)\n }\n if (displayObj.deliveryTrigger.scroll) {\n triggerByScroll(targetingMsgJson)\n }\n if (displayObj.deliveryTrigger.isExitIntent) {\n exitintentObj = targetingMsgJson\n window.document.body.onmouseleave = showExitIntent\n }\n // delay\n const delay = displayObj.delay || displayObj.deliveryTrigger.deliveryDelayed\n if (delay != null && delay > 0) {\n setTimeout(() => {\n renderFooterNotification(targetingMsgJson)\n }, delay * 1000)\n }\n } else {\n renderFooterNotification(targetingMsgJson)\n }\n\n if (window.clevertap.hasOwnProperty('popupCallbacks') &&\n typeof window.clevertap.popupCallbacks !== 'undefined' &&\n typeof window.clevertap.popupCallbacks[targetingMsgJson.wzrk_id] === 'function') {\n const popupCallback = window.clevertap.popupCallbacks[targetingMsgJson.wzrk_id]\n\n const inaObj = {}\n inaObj.msgContent = targetingMsgJson.msgContent\n inaObj.msgId = targetingMsgJson.wzrk_id\n\n if (targetingMsgJson.wzrk_pivot) {\n inaObj.pivotId = targetingMsgJson.wzrk_pivot\n }\n\n var msgCTkv = []\n for (var wzrkPrefixKey in targetingMsgJson) {\n // ADD WZRK PREFIX KEY VALUE PAIRS\n if (wzrkPrefixKey.startsWith(WZRK_PREFIX) && wzrkPrefixKey !== WZRK_ID) {\n const wzrkJson = { [wzrkPrefixKey]: targetingMsgJson[wzrkPrefixKey] }\n msgCTkv.push(wzrkJson)\n }\n }\n\n if (msgCTkv.length > 0) {\n inaObj.msgCTkv = msgCTkv\n }\n if (targetingMsgJson.display.kv != null) {\n inaObj.kv = targetingMsgJson.display.kv\n }\n\n // PUBLIC API TO RECORD CLICKED EVENT\n window.clevertap.raisePopupNotificationClicked = (notificationData) => {\n if (!notificationData || !notificationData.msgId) { return }\n\n const eventData = {}\n eventData.type = 'event'\n eventData.evtName = NOTIFICATION_CLICKED\n eventData.evtData = { [WZRK_ID]: notificationData.msgId }\n if (targetingMsgJson.wzrk_pivot) {\n eventData.evtData = { ...eventData.evtData, wzrk_pivot: notificationData.pivotId }\n }\n\n // WZRK PREFIX KEY VALUE PAIRS\n if (notificationData.msgCTkv) {\n for (var wzrkPrefixObj of notificationData.msgCTkv) {\n eventData.evtData = { ...eventData.evtData, ...wzrkPrefixObj }\n }\n }\n\n _request.processEvent(eventData)\n }\n popupCallback(inaObj)\n }\n }\n }\n\n const triggerByInactivity = (targetNotif) => {\n const IDLE_TIME_THRESHOLD = targetNotif.display.deliveryTrigger.inactive * 1000 // Convert to milliseconds\n let idleTimer\n const events = ['mousemove', 'keypress', 'scroll', 'mousedown', 'touchmove', 'click']\n const resetIdleTimer = () => {\n clearTimeout(idleTimer)\n idleTimer = setTimeout(() => {\n renderFooterNotification(targetNotif)\n removeEventListeners()\n }, IDLE_TIME_THRESHOLD)\n }\n const eventHandler = () => {\n resetIdleTimer()\n }\n const setupEventListeners = () => {\n events.forEach(eventType => window.addEventListener(eventType, eventHandler, { passive: true }))\n }\n const removeEventListeners = () => {\n events.forEach(eventType => window.removeEventListener(eventType, eventHandler))\n }\n setupEventListeners()\n resetIdleTimer()\n return removeEventListeners// Return a cleanup function\n }\n\n const triggerByScroll = (targetNotif) => {\n const calculateScrollPercentage = () => {\n const { scrollHeight, clientHeight, scrollTop } = document.documentElement\n return (scrollTop / (scrollHeight - clientHeight)) * 100\n }\n const scrollListener = () => {\n const scrollPercentage = calculateScrollPercentage()\n if (scrollPercentage >= targetNotif.display.deliveryTrigger.scroll) {\n renderFooterNotification(targetNotif)\n window.removeEventListener('scroll', throttledScrollListener)\n }\n }\n const throttle = (func, limit) => {\n let inThrottle = false\n return function (...args) {\n const context = this\n if (!inThrottle) {\n func.apply(context, args)\n inThrottle = true\n setTimeout(() => {\n inThrottle = false\n }, limit)\n }\n }\n }\n const throttledScrollListener = throttle(scrollListener, 200)\n window.addEventListener('scroll', throttledScrollListener, { passive: true })\n return () => window.removeEventListener('scroll', throttledScrollListener)// Return a cleanup function\n }\n\n let exitintentObj\n const showExitIntent = (event, targetObj) => {\n if (event?.clientY > 0) return\n const targetingMsgJson = targetObj || exitintentObj\n\n const campaignId = targetingMsgJson.wzrk_id.split('_')[0]\n const layout = targetingMsgJson.display.layout\n if (isExistingCampaign(campaignId)) return\n\n if (targetingMsgJson.display.wtarget_type === 0 && (layout === 0 || layout === 2 || layout === 3)) {\n createTemplate(targetingMsgJson, true)\n return\n }\n if (doCampHouseKeeping(targetingMsgJson) === false) {\n return\n }\n\n if ($ct.dismissSpamControl && targetingMsgJson.display.wtarget_type === 0) {\n const intentPreview = document.getElementById('intentPreview')\n const intentOpacityDiv = document.getElementById('intentOpacityDiv')\n if (intentPreview && intentOpacityDiv) {\n intentPreview.remove()\n intentOpacityDiv.remove()\n }\n }\n\n // ImageOnly campaign and Interstitial/Exit Intent shouldn't coexist`\n if (document.getElementById('intentPreview') != null || document.getElementById('wzrkImageOnlyDiv') != null) {\n return\n }\n // dont show exit intent on tablet/mobile - only on desktop\n if (targetingMsgJson.display.layout == null &&\n ((/mobile/i.test(navigator.userAgent)) || (/mini/i.test(navigator.userAgent)) || (/iPad/i.test(navigator.userAgent)) ||\n ('ontouchstart' in window) || (/tablet/i.test(navigator.userAgent)))) {\n return\n }\n\n $ct.campaignDivMap[campaignId] = 'intentPreview'\n let legacy = false\n const opacityDiv = document.createElement('div')\n opacityDiv.id = 'intentOpacityDiv'\n const opacity = targetingMsgJson.display.opacity || 0.7\n const rgbaColor = `rgba(0,0,0,${opacity})`\n opacityDiv.setAttribute('style', `position: fixed;top: 0;bottom: 0;left: 0;width: 100%;height: 100%;z-index: 2147483646;background: ${rgbaColor};`)\n document.body.appendChild(opacityDiv)\n\n const msgDiv = document.createElement('div')\n msgDiv.id = 'intentPreview'\n\n if (targetingMsgJson.display.proto == null) {\n legacy = true\n msgDiv.setAttribute('style', 'display:block;overflow:hidden;top:55% !important;left:50% !important;position:fixed;z-index:2147483647;width:600px !important;height:600px !important;margin:-300px 0 0 -300px !important;')\n } else {\n msgDiv.setAttribute('style', targetingMsgJson.display.iFrameStyle)\n }\n document.body.appendChild(msgDiv)\n const iframe = document.createElement('iframe')\n const borderRadius = targetingMsgJson.display.br === false ? '0' : '8'\n iframe.frameborder = '0px'\n iframe.marginheight = '0px'\n iframe.marginwidth = '0px'\n iframe.scrolling = 'no'\n iframe.id = 'wiz-iframe-intent'\n const onClick = targetingMsgJson.display.onClick\n let pointerCss = ''\n if (onClick !== '' && onClick != null) {\n pointerCss = 'cursor:pointer;'\n }\n if (targetingMsgJson.display.preview && targetingMsgJson.display['custom-editor']) {\n iframe.sandbox = 'allow-scripts allow-popups allow-popups-to-escape-sandbox'\n }\n let html\n // direct html\n if (targetingMsgJson.msgContent.type === 1) {\n html = targetingMsgJson.msgContent.html\n html = html.replace(/##campaignId##/g, campaignId)\n html = html.replace(/##campaignId_batchId##/g, targetingMsgJson.wzrk_id)\n } else {\n const css = '' +\n '<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', 'color-scheme: none; z-index: 2147483647; display:block; height: 100% !important; width: 100% !important;min-height:80px !important;border:0px !important; border-color:none !important;')\n msgDiv.appendChild(iframe)\n\n // Dispatch event for interstitial/exit intent close\n const closeCampaign = new Event('CT_campaign_rendered')\n document.dispatchEvent(closeCampaign)\n\n if (targetingMsgJson.display['custom-editor']) {\n html = appendScriptForCustomEvent(targetingMsgJson, html)\n }\n iframe.srcdoc = html\n\n iframe.onload = () => {\n const contentDiv = document.getElementById('wiz-iframe-intent').contentDocument.getElementById('contentDiv')\n setupClickUrl(onClick, targetingMsgJson, contentDiv, 'intentPreview', legacy)\n }\n }\n\n if (!document.body) {\n if (_wizCounter < 6) {\n _wizCounter++\n setTimeout(_tr, 1000, msg, {\n device: _device,\n session: _session,\n request: _request,\n logger: _logger\n })\n }\n return\n }\n const processNativeDisplayArr = (arrInAppNotifs) => {\n Object.keys(arrInAppNotifs).map(key => {\n var elementId, id\n if (arrInAppNotifs[key].display.divId) {\n elementId = arrInAppNotifs[key].display.divId\n id = document.getElementById(elementId)\n } else {\n elementId = arrInAppNotifs[key].display.divSelector\n id = document.querySelector(elementId)\n }\n if (id !== null) {\n arrInAppNotifs[key].msgContent.type === 2 ? renderPersonalisationBanner(arrInAppNotifs[key]) : renderPersonalisationCarousel(arrInAppNotifs[key])\n delete arrInAppNotifs[key]\n }\n })\n }\n\n const addLoadListener = (arrInAppNotifs) => {\n window.addEventListener('load', () => {\n let count = 0\n if (count < 20) {\n const t = setInterval(() => {\n processNativeDisplayArr(arrInAppNotifs)\n if (Object.keys(arrInAppNotifs).length === 0 || count === 20) {\n clearInterval(t)\n arrInAppNotifs = {}\n }\n count++\n }, 500)\n }\n })\n }\n\n if (msg.inapp_notifs != null) {\n const arrInAppNotifs = {}\n for (let index = 0; index < msg.inapp_notifs.length; index++) {\n const targetNotif = msg.inapp_notifs[index]\n if (targetNotif.display.wtarget_type == null || targetNotif.display.wtarget_type === 0) {\n showFooterNotification(targetNotif)\n } else if (targetNotif.display.wtarget_type === 1) { // if display['wtarget_type']==1 then exit intent\n exitintentObj = targetNotif\n window.document.body.onmouseleave = showExitIntent\n } else if (targetNotif.display.wtarget_type === 2) { // if display['wtarget_type']==2 then web native display\n if (targetNotif.msgContent.type === 1) {\n handleKVpairCampaign(targetNotif)\n } else if (targetNotif.msgContent.type === 2 || targetNotif.msgContent.type === 3) { // Check for banner and carousel\n const element = targetNotif.display.divId ? document.getElementById(targetNotif.display.divId) : document.querySelector(targetNotif.display.divSelector)\n if (element !== null) {\n targetNotif.msgContent.type === 2 ? renderPersonalisationBanner(targetNotif) : renderPersonalisationCarousel(targetNotif)\n } else {\n arrInAppNotifs[targetNotif.wzrk_id.split('_')[0]] = targetNotif // Add targetNotif to object\n }\n } else if (targetNotif.msgContent.type === 4) {\n renderVisualBuilder(targetNotif, false)\n } else {\n showFooterNotification(targetNotif)\n }\n }\n }\n // Process banner or carousel campaign array\n if (Object.keys(arrInAppNotifs).length) {\n if (document.readyState === 'complete') {\n processNativeDisplayArr(arrInAppNotifs)\n } else {\n addLoadListener(arrInAppNotifs)\n }\n }\n }\n\n const handleInboxNotifications = () => {\n if (msg.inbox_preview) {\n processInboxNotifs(msg)\n return\n }\n if (msg.inbox_notifs) {\n const msgArr = []\n for (let index = 0; index < msg.inbox_notifs.length; index++) {\n if (doCampHouseKeeping(msg.inbox_notifs[index]) !== false) {\n msgArr.push(msg.inbox_notifs[index])\n }\n }\n processInboxNotifs(msgArr)\n }\n }\n\n if (msg.webInboxSetting || msg.inbox_notifs != null) {\n /**\n * When the user visits a website for the 1st time after web inbox channel is setup,\n * we need to initialise the inbox here because the initializeWebInbox method within init will not be executed\n * as we would not have any entry related to webInboxSettings in the LS\n */\n\n if (hasWebInboxSettingsInLS()) {\n checkAndRegisterWebInboxElements()\n }\n if ($ct.inbox === null) {\n msg.webInboxSetting && processWebInboxSettings(msg.webInboxSetting)\n initializeWebInbox(_logger)\n .then(() => {\n handleInboxNotifications()\n })\n .catch(e => {})\n } else {\n handleInboxNotifications()\n }\n }\n\n if (msg.webPushConfig) {\n processWebPushConfig(msg.webPushConfig, logger, request)\n }\n\n if (msg.vars) {\n $ct.variableStore.mergeVariables(msg.vars)\n return\n }\n\n if (StorageManager._isLocalStorageSupported()) {\n try {\n if (msg.evpr != null) {\n const eventsMap = msg.evpr.events\n const profileMap = msg.evpr.profile\n const syncExpiry = msg.evpr.expires_in\n const now = getNow()\n StorageManager.setMetaProp('lsTime', now)\n StorageManager.setMetaProp('exTs', syncExpiry)\n mergeEventMap(eventsMap)\n StorageManager.saveToLSorCookie(EV_COOKIE, $ct.globalEventsMap)\n if ($ct.globalProfileMap == null) {\n addToLocalProfileMap(profileMap, true)\n } else {\n addToLocalProfileMap(profileMap, false)\n }\n }\n if (msg.arp != null) {\n arp(msg.arp)\n }\n if (msg.inapp_stale != null && msg.inapp_stale.length > 0) {\n // web popup stale\n staleDataUpdate(msg.inapp_stale, 'wp')\n }\n if (msg.inbox_stale != null && msg.inbox_stale.length > 0) {\n // web inbox stale\n staleDataUpdate(msg.inbox_stale, 'wi')\n }\n } catch (e) {\n _logger.error('Unable to persist evrp/arp: ' + e)\n }\n }\n}\n\nexport default _tr\n","import {\n StorageManager\n} from '../util/storage'\nexport default class User {\n #isPersonalisationActive\n\n constructor ({\n isPersonalisationActive\n }) {\n this.#isPersonalisationActive = isPersonalisationActive\n }\n\n getTotalVisits () {\n if (!this.#isPersonalisationActive()) {\n return\n }\n let visitCount = StorageManager.getMetaProp('sc')\n if (visitCount == null) {\n visitCount = 1\n }\n return visitCount\n }\n\n getLastVisit () {\n if (!this.#isPersonalisationActive()) {\n return\n }\n const prevSession = StorageManager.getMetaProp('ps')\n if (prevSession != null) {\n return new Date(prevSession * 1000)\n }\n }\n}\n","import {\n CLEVERTAP_ERROR_PREFIX\n} from '../util/messages'\n\nexport const logLevels = {\n DISABLE: 0,\n ERROR: 1,\n INFO: 2,\n DEBUG: 3,\n DEBUG_PE: 4\n}\n\nexport class Logger {\n #logLevel\n wzrkError = {}\n constructor (logLevel) {\n this.#logLevel = logLevel == null ? logLevel : logLevels.INFO\n this.wzrkError = {}\n }\n\n get logLevel () {\n return this.#logLevel\n }\n\n set logLevel (logLevel) {\n this.#logLevel = logLevel\n }\n\n error (message) {\n if (this.#logLevel >= logLevels.ERROR) {\n this.#log('error', message)\n }\n }\n\n info (message) {\n if (this.#logLevel >= logLevels.INFO) {\n this.#log('log', message)\n }\n }\n\n debug (message) {\n if (this.#logLevel >= logLevels.DEBUG || this.#isLegacyDebug) {\n this.#log('debug', message)\n }\n }\n\n debugPE (message) {\n if (this.#logLevel >= logLevels.DEBUG_PE) {\n this.#log('debug_pe', message)\n }\n }\n\n reportError (code, description) {\n this.wzrkError.c = code\n this.wzrkError.d = description\n this.error(`${CLEVERTAP_ERROR_PREFIX} ${code}: ${description}`)\n }\n\n #log (level, message) {\n if (window.console) {\n try {\n const ts = new Date().getTime()\n console[level](`CleverTap [${ts}]: ${message}`)\n } catch (e) {}\n }\n }\n\n get #isLegacyDebug () {\n return (typeof sessionStorage !== 'undefined' && sessionStorage.WZRK_D === '')\n }\n}\n\nexport default {\n Logger,\n logLevels\n}\n","import { singleQuoteRegex, SCOOKIE_EXP_TIME_IN_SECS } from '../util/constants'\nimport { isObject } from '../util/datatypes'\nimport { getNow } from '../util/datetime'\nimport { StorageManager } from '../util/storage'\nimport { getHostName } from '../util/url'\n\nexport default class SessionManager {\n #logger\n #sessionId\n #isPersonalisationActive\n cookieName // SCOOKIE_NAME\n scookieObj\n\n constructor ({\n logger,\n isPersonalisationActive\n }) {\n this.sessionId = StorageManager.getMetaProp('cs')\n this.#logger = logger\n this.#isPersonalisationActive = isPersonalisationActive\n }\n\n get sessionId () {\n return this.#sessionId\n }\n\n set sessionId (sessionId) {\n this.#sessionId = sessionId\n }\n\n getSessionCookieObject () {\n let scookieStr = StorageManager.readCookie(this.cookieName)\n let obj = {}\n\n if (scookieStr != null) {\n // converting back single quotes to double for JSON parsing - http://www.iandevlin.com/blog/2012/04/html5/cookies-json-localstorage-and-opera\n scookieStr = scookieStr.replace(singleQuoteRegex, '\"')\n\n obj = JSON.parse(scookieStr)\n if (!isObject(obj)) {\n obj = {}\n } else {\n if (typeof obj.t !== 'undefined') { // check time elapsed since last request\n const lastTime = obj.t\n const now = getNow()\n if ((now - lastTime) > (SCOOKIE_EXP_TIME_IN_SECS + 60)) {\n // adding 60 seconds to compensate for in-journey requests\n // ideally the cookie should've died after SCOOKIE_EXP_TIME_IN_SECS but it's still around as we can read\n // hence we shouldn't use it.\n obj = {}\n }\n }\n }\n }\n this.scookieObj = obj\n return obj\n }\n\n setSessionCookieObject (obj) {\n const objStr = JSON.stringify(obj)\n StorageManager.createBroadCookie(this.cookieName, objStr, SCOOKIE_EXP_TIME_IN_SECS, getHostName())\n }\n\n manageSession (session) {\n // first time. check if current session id in localstorage is same\n // if not same then prev = current and current = this new session\n if (typeof this.sessionId === 'undefined' || this.sessionId !== session) {\n const currentSessionInLS = StorageManager.getMetaProp('cs')\n // if sessionId in meta is undefined - set current to both\n if (typeof currentSessionInLS === 'undefined') {\n StorageManager.setMetaProp('ps', session)\n StorageManager.setMetaProp('cs', session)\n StorageManager.setMetaProp('sc', 1)\n } else if (currentSessionInLS !== session) {\n // not same as session in local storage. new session\n StorageManager.setMetaProp('ps', currentSessionInLS)\n StorageManager.setMetaProp('cs', session)\n let sessionCount = StorageManager.getMetaProp('sc')\n if (typeof sessionCount === 'undefined') {\n sessionCount = 0\n }\n StorageManager.setMetaProp('sc', sessionCount + 1)\n }\n this.sessionId = session\n }\n }\n\n getTimeElapsed () {\n if (!this.#isPersonalisationActive()) {\n return\n }\n if (this.scookieObj != null) { // TODO: check logic?\n this.scookieObj = this.getSessionCookieObject()\n }\n const sessionStart = this.scookieObj.s\n if (sessionStart != null) {\n const ts = getNow()\n return Math.floor(ts - sessionStart)\n }\n }\n\n getPageCount () {\n if (!this.#isPersonalisationActive()) {\n return\n }\n\n if (this.scookieObj != null) { // TODO: check logic\n this.scookieObj = this.getSessionCookieObject()\n }\n return this.scookieObj.p\n }\n}\n","import { CAMP_COOKIE_NAME, CLEAR, EVT_PUSH, EV_COOKIE, FIRE_PUSH_UNREGISTERED, LCOOKIE_NAME, PUSH_SUBSCRIPTION_DATA, WEBPUSH_LS_KEY } from '../util/constants'\nimport { isObjectEmpty, isValueValid, removeUnsupportedChars } from '../util/datatypes'\nimport { getNow } from '../util/datetime'\nimport { compressData } from '../util/encoder'\nimport RequestDispatcher from '../util/requestDispatcher'\nimport { StorageManager, $ct } from '../util/storage'\nimport { addToURL } from '../util/url'\nimport { getCampaignObjForLc } from '../util/clevertap'\n\nlet seqNo = 0\nlet requestTime = 0\n\nexport default class RequestManager {\n #logger\n #account\n #device\n #session\n #isPersonalisationActive\n #clearCookie = false\n processingBackup = false\n\n constructor ({ logger, account, device, session, isPersonalisationActive }) {\n this.#logger = logger\n this.#account = account\n this.#device = device\n this.#session = session\n this.#isPersonalisationActive = isPersonalisationActive\n\n RequestDispatcher.logger = logger\n RequestDispatcher.device = device\n RequestDispatcher.account = account\n }\n\n processBackupEvents () {\n const backupMap = StorageManager.readFromLSorCookie(LCOOKIE_NAME)\n if (typeof backupMap === 'undefined' || backupMap === null) {\n return\n }\n this.processingBackup = true\n for (const idx in backupMap) {\n if (backupMap.hasOwnProperty(idx)) {\n const backupEvent = backupMap[idx]\n if (typeof backupEvent.fired === 'undefined') {\n this.#logger.debug('Processing backup event : ' + backupEvent.q)\n if (typeof backupEvent.q !== 'undefined') {\n RequestDispatcher.fireRequest(backupEvent.q)\n }\n backupEvent.fired = true\n }\n }\n }\n StorageManager.saveToLSorCookie(LCOOKIE_NAME, backupMap)\n this.processingBackup = false\n }\n\n addSystemDataToObject (dataObject, ignoreTrim) {\n // ignore trim for chrome notifications; undefined everywhere else\n if (typeof ignoreTrim === 'undefined') {\n dataObject = removeUnsupportedChars(dataObject, this.#logger)\n }\n\n if (!isObjectEmpty(this.#logger.wzrkError)) {\n dataObject.wzrk_error = this.#logger.wzrkError\n this.#logger.wzrkError = {}\n }\n\n dataObject.id = this.#account.id\n\n if (isValueValid(this.#device.gcookie)) {\n dataObject.g = this.#device.gcookie\n }\n\n const obj = this.#session.getSessionCookieObject()\n dataObject.s = obj.s // session cookie\n dataObject.pg = (typeof obj.p === 'undefined') ? 1 : obj.p // Page count\n let proto = document.location.protocol\n proto = proto.replace(':', '')\n dataObject.af = { ...dataObject.af, lib: 'web-sdk-v$$PACKAGE_VERSION$$', protocol: proto, ...$ct.flutterVersion } // app fields\n if (sessionStorage.hasOwnProperty('WZRK_D')) { dataObject.debug = true }\n\n return dataObject\n }\n\n addFlags (data) {\n // check if cookie should be cleared.\n this.#clearCookie = StorageManager.getAndClearMetaProp(CLEAR)\n if (this.#clearCookie !== undefined && this.#clearCookie) {\n data.rc = true\n this.#logger.debug('reset cookie sent in request and cleared from meta for future requests.')\n }\n if (this.#isPersonalisationActive()) {\n const lastSyncTime = StorageManager.getMetaProp('lsTime')\n const expirySeconds = StorageManager.getMetaProp('exTs')\n\n // dsync not found in local storage - get data from server\n if (typeof lastSyncTime === 'undefined' || typeof expirySeconds === 'undefined') {\n data.dsync = true\n return\n }\n const now = getNow()\n // last sync time has expired - get fresh data from server\n if (lastSyncTime + expirySeconds < now) {\n data.dsync = true\n }\n }\n }\n\n // saves url to backup cache and fires the request\n /**\n *\n * @param {string} url\n * @param {boolean} override whether the request can go through or not\n * @param {Boolean} sendOULFlag - true in case of a On User Login request\n */\n saveAndFireRequest (url, override, sendOULFlag, evtName) {\n const now = getNow()\n url = addToURL(url, 'rn', ++$ct.globalCache.REQ_N)\n const data = url + '&i=' + now + '&sn=' + seqNo\n StorageManager.backupEvent(data, $ct.globalCache.REQ_N, this.#logger)\n\n // if offline is set to true, save the request in backup and return\n if ($ct.offline) return\n // if there is no override\n // and an OUL request is not in progress\n // then process the request as it is\n // else block the request\n // note - $ct.blockRequest should ideally be used for override\n if ((!override || (this.#clearCookie !== undefined && this.#clearCookie)) && !window.isOULInProgress) {\n if (now === requestTime) {\n seqNo++\n } else {\n requestTime = now\n seqNo = 0\n }\n window.oulReqN = $ct.globalCache.REQ_N\n RequestDispatcher.fireRequest(data, false, sendOULFlag, evtName)\n } else {\n this.#logger.debug(`Not fired due to override - ${$ct.blockRequest} or clearCookie - ${this.#clearCookie} or OUL request in progress - ${window.isOULInProgress}`)\n }\n }\n\n unregisterTokenForGuid (givenGUID) {\n const payload = StorageManager.readFromLSorCookie(PUSH_SUBSCRIPTION_DATA)\n // Send unregister event only when token is available\n if (payload) {\n const data = {}\n data.type = 'data'\n if (isValueValid(givenGUID)) {\n data.g = givenGUID\n }\n data.action = 'unregister'\n data.id = this.#account.id\n\n const obj = this.#session.getSessionCookieObject()\n\n data.s = obj.s // session cookie\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', 'data')\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n RequestDispatcher.fireRequest(pageLoadUrl, true)\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, false)\n }\n // REGISTER TOKEN\n this.registerToken(payload)\n }\n\n registerToken (payload) {\n if (!payload) return\n // add gcookie etc to the payload\n payload = this.addSystemDataToObject(payload, true)\n payload = JSON.stringify(payload)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', 'data')\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(payload, this.#logger))\n RequestDispatcher.fireRequest(pageLoadUrl)\n // set in localstorage\n StorageManager.save(WEBPUSH_LS_KEY, 'ok')\n }\n\n processEvent (data) {\n this.#addToLocalEventMap(data.evtName)\n data = this.addSystemDataToObject(data, undefined)\n this.addFlags(data)\n data[CAMP_COOKIE_NAME] = getCampaignObjForLc()\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.saveAndFireRequest(pageLoadUrl, $ct.blockRequest, false, data.evtName)\n }\n\n #addToLocalEventMap (evtName) {\n if (StorageManager._isLocalStorageSupported()) {\n if (typeof $ct.globalEventsMap === 'undefined') {\n $ct.globalEventsMap = StorageManager.readFromLSorCookie(EV_COOKIE)\n if (typeof $ct.globalEventsMap === 'undefined') {\n $ct.globalEventsMap = {}\n }\n }\n\n const nowTs = getNow()\n let evtDetail = $ct.globalEventsMap[evtName]\n if (typeof evtDetail !== 'undefined') {\n evtDetail[2] = nowTs\n evtDetail[0]++\n } else {\n evtDetail = []\n evtDetail.push(1)\n evtDetail.push(nowTs)\n evtDetail.push(nowTs)\n }\n $ct.globalEventsMap[evtName] = evtDetail\n StorageManager.saveToLSorCookie(EV_COOKIE, $ct.globalEventsMap)\n }\n }\n\n post (url, body) {\n return fetch(url, {\n method: 'post',\n headers: { 'Content-Type': 'application/json' },\n body: body\n })\n .then((response) => {\n if (response.ok) {\n return response.json()\n }\n throw response\n })\n .then((data) => {\n this.#logger.debug('Sync data successful', data)\n return data\n })\n .catch((e) => {\n this.#logger.debug('Error in syncing variables', e)\n throw e\n })\n }\n}\n","import {\n isObjectEmpty\n} from '../util/datatypes'\nimport {\n EVT_PUSH,\n USEIP_KEY,\n OPTOUT_KEY,\n CT_OPTOUT_KEY\n} from '../util/constants'\nimport {\n StorageManager,\n $ct\n} from '../util/storage'\nimport {\n compressData\n} from '../util/encoder'\nimport {\n addToURL\n} from '../util/url'\n\nexport default class Privacy extends Array {\n #request\n #account\n #oldValues\n #logger\n\n constructor ({\n request,\n account,\n logger\n },\n values) {\n super()\n this.#logger = logger\n this.#request = request\n this.#account = account\n this.#oldValues = values\n }\n\n push (...privacyArr) {\n if ($ct.isPrivacyArrPushed) {\n this.#processPrivacyArray($ct.privacyArray.length > 0 ? $ct.privacyArray : privacyArr)\n } else {\n $ct.privacyArray.push(...privacyArr)\n }\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#processPrivacyArray(this.#oldValues)\n }\n this.#oldValues = null\n }\n\n #processPrivacyArray (privacyArr) {\n if (Array.isArray(privacyArr) && privacyArr.length > 0) {\n const privacyObj = privacyArr.reduce((prev, curr) => ({ ...prev, ...curr }), {})\n let data = {}\n const profileObj = {}\n var optOut = false\n\n if (privacyObj.hasOwnProperty(OPTOUT_KEY)) {\n optOut = privacyObj[OPTOUT_KEY]\n if (typeof optOut === 'boolean') {\n profileObj[CT_OPTOUT_KEY] = optOut\n // should be true when user wants to opt in\n $ct.isOptInRequest = !optOut\n }\n }\n if (privacyObj.hasOwnProperty(USEIP_KEY)) {\n const useIP = privacyObj[USEIP_KEY]\n const shouldUseIP = (typeof useIP === 'boolean') ? useIP : false\n StorageManager.setMetaProp(USEIP_KEY, shouldUseIP)\n }\n if (!isObjectEmpty(profileObj)) {\n data.type = 'profile'\n data.profile = profileObj\n data = this.#request.addSystemDataToObject(data, undefined)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n pageLoadUrl = addToURL(pageLoadUrl, OPTOUT_KEY, optOut ? 'true' : 'false')\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n privacyArr.splice(0, privacyArr.length)\n }\n }\n }\n}\n","export class Variable {\n #variableStore\n\n /**\n * Creates an instance of the Variable class.\n *\n * @constructor\n * @param {VariableStore} options.variableStore - The VariableStore instance for registration.\n * @param {string|null} options.name - The name of the variable.\n * @param {*} options.defaultValue - The default value of the variable.\n * @param {*} options.value - The current value of the variable.\n * @param {string|null} options.type - The type of the variable (string, number, boolean).\n * @param {boolean} options.hadStarted - A flag indicating whether the variable has started (used internally).\n * @param {Function[]} options.valueChangedCallbacks - Array to store callbacks to be executed when the variable value changes.\n */\n constructor ({ variableStore }) {\n this.name = null\n this.defaultValue = null\n this.value = null\n this.type = null\n this.hadStarted = false\n this.valueChangedCallbacks = []\n this.#variableStore = variableStore\n }\n\n getValue () {\n return this.value\n }\n\n getdefaultValue () {\n return this.defaultValue\n }\n\n /**\n * Defines a new variable with the provided name, default value, and variable store.\n * @static\n * @param {string} name - The name of the variable.\n * @param {*} defaultValue - The default value of the variable.\n * @param {VariableStore} variableStore - The VariableStore instance for registration.\n * @returns {Variable|null} - The created Variable instance or null if invalid parameters are provided.\n */\n static define (name, defaultValue, variableStore) {\n if (!name || typeof name !== 'string') {\n console.error('Empty or invalid name parameter provided.')\n return null\n }\n if (name.startsWith('.') || name.endsWith('.')) {\n console.error('Variable name starts or ends with a `.` which is not allowed: ' + name)\n return null\n }\n\n const typeOfDefaultValue = typeof defaultValue\n if (typeOfDefaultValue !== 'string' && typeOfDefaultValue !== 'number' && typeOfDefaultValue !== 'boolean') {\n console.error('Only primitive types (string, number, boolean) are accepted as value')\n return null\n }\n\n const existing = variableStore.getVariable(name)\n if (existing) {\n return existing\n }\n\n const varInstance = new Variable({ variableStore })\n try {\n varInstance.name = name\n varInstance.defaultValue = defaultValue\n varInstance.value = defaultValue\n varInstance.type = typeOfDefaultValue\n variableStore.registerVariable(varInstance)\n varInstance.update(defaultValue)\n } catch (error) {\n console.error(error)\n }\n return varInstance\n }\n\n /**\n * Updates the variable's value, triggering callbacks if hasVarsRequestCompleted is returned true.\n * @param {*} newValue - The new value to be assigned to the variable.\n */\n update (newValue) {\n const oldValue = this.value\n this.value = newValue\n if (newValue === null && oldValue === null) {\n return\n }\n if (newValue !== null && newValue === oldValue && this.hadStarted) {\n return\n }\n if (this.#variableStore.hasVarsRequestCompleted()) {\n this.hadStarted = true\n this.triggerValueChanged()\n }\n }\n\n /**\n * Invokes all registered callbacks when the variable value changes.\n */\n triggerValueChanged () {\n this.valueChangedCallbacks.forEach((onValueChanged) => {\n onValueChanged(this)\n })\n }\n\n /**\n * Adds a callback function to the array and triggers it immediately if variable requests have completed.\n * @param {Function} onValueChanged - The callback function to be added.\n */\n addValueChangedCallback (onValueChanged) {\n if (!onValueChanged) {\n console.log('Invalid callback parameter provided.')\n return\n }\n this.valueChangedCallbacks.push(onValueChanged)\n\n if (this.#variableStore.hasVarsRequestCompleted()) {\n onValueChanged(this)\n }\n }\n\n /**\n * Removes a callback function from the array.\n * @param {Function} onValueChanged - The callback function to be removed.\n */\n removeValueChangedCallback (onValueChanged) {\n const index = this.valueChangedCallbacks.indexOf(onValueChanged)\n if (index !== -1) {\n this.valueChangedCallbacks.splice(index, 1)\n }\n }\n\n /**\n * Resets the `hadStarted` flag to false.\n */\n clearStartFlag () {\n this.hadStarted = false\n }\n}\n","import { VARIABLES, WZRK_FETCH } from '../../util/constants'\nimport { StorageManager, $ct } from '../../util/storage'\nclass VariableStore {\n #logger\n #account\n #request\n #event\n\n #variables\n #remoteVariables\n #fetchCallback\n #variablesChangedCallbacks\n #oneTimeVariablesChangedCallbacks\n #hasVarsRequestCompleted = false\n\n constructor ({ logger, request, account, event }) {\n this.#logger = logger\n this.#account = account\n this.#request = request\n this.#event = event\n\n this.#variables = {}\n this.#remoteVariables = {}\n this.#variablesChangedCallbacks = []\n this.#oneTimeVariablesChangedCallbacks = []\n\n $ct.variableStore = this\n }\n\n /**\n * Registers a variable instance in the store.\n * @param {Object} varInstance - The variable instance to be registered.\n */\n registerVariable (varInstance) {\n const { name } = varInstance\n this.#variables[name] = varInstance\n console.log('registerVariable', this.#variables)\n }\n\n /**\n * Retrieves a variable by its name.\n * @param {string} name - The name of the variable to retrieve.\n * @returns {Object} - The variable instance.\n */\n getVariable (name) {\n return this.#variables[name]\n }\n\n hasVarsRequestCompleted () {\n return this.#hasVarsRequestCompleted\n }\n\n /**\n * Synchronizes variables with the server.\n * @param {Function} onSyncSuccess - Callback function on successful synchronization.\n * @param {Function} onSyncFailure - Callback function on synchronization failure.\n * @throws Will throw an error if the account token is missing.\n * @returns {Promise} - The result of the synchronization request.\n */\n syncVariables (onSyncSuccess, onSyncFailure) {\n if (!this.#account.token) {\n const m = 'Account token is missing.'\n this.#logger.error(m)\n return Promise.reject(new Error(m))\n }\n\n const payload = {\n type: 'varsPayload',\n vars: {}\n }\n\n for (const name in this.#variables) {\n payload.vars[name] = {\n defaultValue: this.#variables[name].defaultValue,\n type: this.#variables[name].type\n }\n }\n\n // Check if payload.vars is empty\n if (Object.keys(payload.vars).length === 0) {\n const m = 'No variables are defined.'\n this.#logger.error(m)\n return Promise.reject(new Error(m))\n }\n\n let meta = {}\n meta = this.#request.addSystemDataToObject(meta, undefined)\n meta.tk = this.#account.token\n\n meta.type = 'meta'\n const body = JSON.stringify([meta, payload])\n const url = this.#account.dataPostPEURL\n\n return this.#request.post(url, body)\n .then((r) => {\n if (onSyncSuccess && typeof onSyncSuccess === 'function') {\n onSyncSuccess(r)\n }\n return r\n })\n .catch((e) => {\n if (onSyncFailure && typeof onSyncFailure === 'function') {\n onSyncFailure(e)\n }\n if (e.status === 400) {\n this.#logger.error('Invalid sync payload or clear the existing draft')\n } else if (e.status === 401) {\n this.#logger.error('This is not a test profile')\n } else {\n this.#logger.error('Sync variable failed')\n }\n throw e\n })\n }\n\n /**\n * Fetches variables from the server.\n * @param {Function} onFetchCallback - Callback function on fetch completion.\n */\n fetchVariables (onFetchCallback) {\n this.#event.push(WZRK_FETCH, { t: 4 })\n if (onFetchCallback && typeof onFetchCallback === 'function') {\n this.#fetchCallback = onFetchCallback\n }\n }\n\n mergeVariables (vars) {\n console.log('msg vars is ', vars)\n this.#hasVarsRequestCompleted = true\n\n StorageManager.saveToLSorCookie(VARIABLES, vars)\n this.#remoteVariables = vars\n\n for (const name in this.#variables) {\n if (vars.hasOwnProperty(name)) {\n this.#variables[name].update(vars[name])\n }\n }\n\n if (this.#fetchCallback) {\n this.#fetchCallback()\n }\n\n this.#runVariablesChangedCallback()\n }\n\n addVariablesChangedCallback (callback) {\n if (callback && typeof callback === 'function') {\n this.#variablesChangedCallbacks.push(callback)\n\n if (this.hasVarsRequestCompleted()) {\n callback()\n }\n } else {\n this.#logger.error('callback is not a function')\n }\n }\n\n addOneTimeVariablesChangedCallback (callback) {\n if (callback && typeof callback === 'function') {\n if (this.hasVarsRequestCompleted()) {\n callback()\n } else {\n this.#oneTimeVariablesChangedCallbacks.push(callback)\n }\n }\n }\n\n removeVariablesChangedCallback (callback) {\n const index = this.#variablesChangedCallbacks.indexOf(callback)\n if (index !== -1) {\n this.#variablesChangedCallbacks.splice(index, 1)\n }\n }\n\n removeOneTimeVariablesChangedCallback (callback) {\n const index = this.#oneTimeVariablesChangedCallbacks.indexOf(callback)\n if (index !== -1) {\n this.#oneTimeVariablesChangedCallbacks.splice(index, 1)\n }\n }\n\n #runVariablesChangedCallback () {\n for (var callback of this.#variablesChangedCallbacks) {\n callback()\n }\n for (var callBack of this.#oneTimeVariablesChangedCallbacks) {\n callBack()\n }\n this.#oneTimeVariablesChangedCallbacks.length = 0\n }\n}\n\nexport default VariableStore\n","import Account from './modules/account'\nimport CleverTapAPI from './modules/api'\nimport DeviceManager from './modules/device'\nimport EventHandler from './modules/event'\nimport ProfileHandler from './modules/profile'\nimport UserLoginHandler from './modules/userLogin'\nimport _tr from './util/tr'\nimport User from './modules/user'\nimport { Logger, logLevels } from './modules/logger'\nimport SessionManager from './modules/session'\nimport ReqestManager from './modules/request'\nimport {\n CAMP_COOKIE_NAME,\n SCOOKIE_PREFIX,\n NOTIFICATION_VIEWED,\n NOTIFICATION_CLICKED,\n EVT_PING,\n FIRST_PING_FREQ_IN_MILLIS,\n CONTINUOUS_PING_FREQ_IN_MILLIS,\n GROUP_SUBSCRIPTION_REQUEST_ID,\n WZRK_ID,\n WZRK_PREFIX,\n categoryLongKey,\n COMMAND_INCREMENT,\n COMMAND_DECREMENT,\n COMMAND_SET,\n COMMAND_ADD,\n COMMAND_REMOVE,\n COMMAND_DELETE,\n EVT_PUSH,\n WZRK_FETCH\n} from './util/constants'\nimport { EMBED_ERROR } from './util/messages'\nimport { StorageManager, $ct } from './util/storage'\nimport { addToURL, getDomain, getURLParams } from './util/url'\nimport { getCampaignObjForLc, setEnum, handleEmailSubscription, closeIframe } from './util/clevertap'\nimport { compressData } from './util/encoder'\nimport Privacy from './modules/privacy'\nimport NotificationHandler from './modules/notification'\nimport { hasWebInboxSettingsInLS, checkAndRegisterWebInboxElements, initializeWebInbox, getInboxMessages, saveInboxMessages } from './modules/web-inbox/helper'\nimport { Variable } from './modules/variables/variable'\nimport VariableStore from './modules/variables/variableStore'\nimport { checkBuilder, addAntiFlicker } from './modules/visualBuilder/pageBuilder'\nimport { setServerKey } from './modules/webPushPrompt/prompt'\n\nexport default class CleverTap {\n #logger\n #api\n #onloadcalled\n #device\n #session\n #account\n #request\n #variableStore\n #isSpa\n #previousUrl\n #boundCheckPageChanged = this.#checkPageChanged.bind(this)\n #dismissSpamControl\n enablePersonalization\n\n get spa () {\n return this.#isSpa\n }\n\n set spa (value) {\n const isSpa = value === true\n if (this.#isSpa !== isSpa && this.#onloadcalled === 1) {\n // if clevertap.spa is changed after init has been called then update the click listeners\n if (isSpa) {\n document.addEventListener('click', this.#boundCheckPageChanged)\n } else {\n document.removeEventListener('click', this.#boundCheckPageChanged)\n }\n }\n this.#isSpa = isSpa\n }\n\n get dismissSpamControl () {\n return this.#dismissSpamControl\n }\n\n set dismissSpamControl (value) {\n const dismissSpamControl = value === true\n this.#dismissSpamControl = dismissSpamControl\n $ct.dismissSpamControl = dismissSpamControl\n }\n\n constructor (clevertap = {}) {\n this.#onloadcalled = 0\n this._isPersonalisationActive = this._isPersonalisationActive.bind(this)\n this.raiseNotificationClicked = () => { }\n this.#logger = new Logger(logLevels.INFO)\n this.#account = new Account(clevertap.account?.[0], clevertap.region || clevertap.account?.[1], clevertap.targetDomain || clevertap.account?.[2], clevertap.token || clevertap.account?.[3])\n this.#device = new DeviceManager({ logger: this.#logger })\n this.#dismissSpamControl = clevertap.dismissSpamControl || false\n this.shpfyProxyPath = clevertap.shpfyProxyPath || ''\n this.#session = new SessionManager({\n logger: this.#logger,\n isPersonalisationActive: this._isPersonalisationActive\n })\n this.#request = new ReqestManager({\n logger: this.#logger,\n account: this.#account,\n device: this.#device,\n session: this.#session,\n isPersonalisationActive: this._isPersonalisationActive\n })\n this.enablePersonalization = clevertap.enablePersonalization || false\n this.event = new EventHandler({\n logger: this.#logger,\n request: this.#request,\n isPersonalisationActive: this._isPersonalisationActive\n }, clevertap.event)\n\n this.profile = new ProfileHandler({\n logger: this.#logger,\n request: this.#request,\n account: this.#account,\n isPersonalisationActive: this._isPersonalisationActive\n }, clevertap.profile)\n\n this.onUserLogin = new UserLoginHandler({\n request: this.#request,\n account: this.#account,\n session: this.#session,\n logger: this.#logger,\n device: this.#device\n }, clevertap.onUserLogin)\n\n this.privacy = new Privacy({\n request: this.#request,\n account: this.#account,\n logger: this.#logger\n }, clevertap.privacy)\n\n this.notifications = new NotificationHandler({\n logger: this.#logger,\n request: this.#request,\n account: this.#account\n }, clevertap.notifications)\n\n this.#variableStore = new VariableStore({\n logger: this.#logger,\n request: this.#request,\n account: this.#account,\n event: this.event\n })\n\n this.#api = new CleverTapAPI({\n logger: this.#logger,\n request: this.#request,\n device: this.#device,\n session: this.#session\n })\n\n this.spa = clevertap.spa\n this.dismissSpamControl = clevertap.dismissSpamControl\n\n this.user = new User({\n isPersonalisationActive: this._isPersonalisationActive\n })\n\n this.session = {\n getTimeElapsed: () => {\n return this.#session.getTimeElapsed()\n },\n getPageCount: () => {\n return this.#session.getPageCount()\n }\n }\n\n this.logout = () => {\n this.#logger.debug('logout called')\n StorageManager.setInstantDeleteFlagInK()\n }\n\n this.clear = () => {\n this.onUserLogin.clear()\n }\n\n this.getCleverTapID = () => {\n return this.#device.getGuid()\n }\n\n this.getAccountID = () => {\n return this.#account.id\n }\n\n this.getSCDomain = () => {\n return this.#account.finalTargetDomain\n }\n\n this.setLibrary = (libName, libVersion) => {\n $ct.flutterVersion = { [libName]: libVersion }\n }\n\n // Set the Signed Call sdk version and fire request\n this.setSCSDKVersion = (ver) => {\n this.#account.scSDKVersion = ver\n const data = {}\n data.af = { scv: 'sc-sdk-v' + this.#account.scSDKVersion }\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', 'page')\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(JSON.stringify(data), this.#logger))\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n\n if (hasWebInboxSettingsInLS()) {\n checkAndRegisterWebInboxElements()\n initializeWebInbox(this.#logger)\n }\n\n // Get Inbox Message Count\n this.getInboxMessageCount = () => {\n const msgCount = getInboxMessages()\n return Object.keys(msgCount).length\n }\n\n // Get Inbox Unread Message Count\n this.getInboxMessageUnreadCount = () => {\n if ($ct.inbox) {\n return $ct.inbox.unviewedCounter\n } else {\n this.#logger.debug('No unread messages')\n }\n }\n\n // Get All Inbox messages\n this.getAllInboxMessages = () => {\n return getInboxMessages()\n }\n\n // Get only Unread messages\n this.getUnreadInboxMessages = () => {\n if ($ct.inbox) {\n return $ct.inbox.unviewedMessages\n } else {\n this.#logger.debug('No unread messages')\n }\n }\n\n // Get message object belonging to the given message id only. Message id should be a String\n this.getInboxMessageForId = (messageId) => {\n const messages = getInboxMessages()\n if ((messageId !== null || messageId !== '') && messages.hasOwnProperty(messageId)) {\n return messages[messageId]\n } else {\n this.#logger.error('No message available for message Id ' + messageId)\n }\n }\n\n // Delete message from the Inbox. Message id should be a String\n // If the message to be deleted is unviewed then decrement the badge count, delete the message from unviewedMessages list\n // Then remove the message from local storage and update cookie\n this.deleteInboxMessage = (messageId) => {\n const messages = getInboxMessages()\n if ((messageId !== null || messageId !== '') && messages.hasOwnProperty(messageId)) {\n if (messages[messageId].viewed === 0) {\n $ct.inbox.unviewedCounter--\n delete $ct.inbox.unviewedMessages[messageId]\n const unViewedBadge = document.getElementById('unviewedBadge')\n if (unViewedBadge) {\n unViewedBadge.innerText = $ct.inbox.unviewedCounter\n unViewedBadge.style.display = $ct.inbox.unviewedCounter > 0 ? 'flex' : 'none'\n }\n }\n const ctInbox = document.querySelector('ct-web-inbox')\n if (ctInbox) {\n const el = ctInbox.shadowRoot.getElementById(messageId)\n el && el.remove()\n }\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 ctInbox = document.querySelector('ct-web-inbox')\n if (ctInbox) {\n const el = ctInbox.shadowRoot.getElementById(messageId)\n if (el !== null) {\n el.shadowRoot.getElementById('unreadMarker').style.display = 'none'\n }\n }\n messages[messageId].viewed = 1\n const unViewedBadge = document.getElementById('unviewedBadge')\n if (unViewedBadge) {\n var counter = parseInt(unViewedBadge.innerText) - 1\n unViewedBadge.innerText = counter\n 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 ctInbox = document.querySelector('ct-web-inbox')\n if (ctInbox) {\n const el = ctInbox.shadowRoot.getElementById(key)\n if (el !== null) {\n el.shadowRoot.getElementById('unreadMarker').style.display = 'none'\n }\n }\n messages[key].viewed = 1\n window.clevertap.renderNotificationViewed({ msgId: messages[key].wzrk_id, pivotId: messages[key].wzrk_pivot })\n })\n const unViewedBadge = document.getElementById('unviewedBadge')\n if (unViewedBadge) {\n unViewedBadge.innerText = 0\n unViewedBadge.style.display = 'none'\n }\n saveInboxMessages(messages)\n $ct.inbox.unviewedCounter = 0\n $ct.inbox.unviewedMessages = {}\n } else {\n this.#logger.debug('All messages are already read')\n }\n }\n\n this.toggleInbox = (e) => $ct.inbox?.toggleInbox(e)\n\n // method for notification viewed\n this.renderNotificationViewed = (detail) => {\n processNotificationEvent(NOTIFICATION_VIEWED, detail)\n }\n\n // method for notification clicked\n this.renderNotificationClicked = (detail) => {\n processNotificationEvent(NOTIFICATION_CLICKED, detail)\n }\n\n const processNotificationEvent = (eventName, eventDetail) => {\n if (!eventDetail || !eventDetail.msgId) { return }\n const data = {}\n data.type = 'event'\n data.evtName = eventName\n data.evtData = { [WZRK_ID]: eventDetail.msgId }\n\n if (eventDetail.pivotId) {\n data.evtData = { ...data.evtData, wzrk_pivot: eventDetail.pivotId }\n }\n\n if (eventDetail.wzrk_slideNo) {\n data.evtData = { ...data.evtData, wzrk_slideNo: eventDetail.wzrk_slideNo }\n }\n\n // Adding kv pair to event data\n if (eventDetail.kv && eventDetail.kv !== null && eventDetail.kv !== undefined) {\n for (const key in eventDetail.kv) {\n if (key.startsWith(WZRK_PREFIX)) {\n data.evtData = { ...data.evtData, [key]: eventDetail.kv[key] }\n }\n }\n }\n\n // Adding msgCTkv to event data\n if (eventDetail.msgCTkv && eventDetail.msgCTkv !== null && eventDetail.msgCTkv !== undefined) {\n for (const key in eventDetail.msgCTkv) {\n if (key.startsWith(WZRK_PREFIX)) {\n data.evtData = { ...data.evtData, [key]: eventDetail.msgCTkv[key] }\n }\n }\n }\n this.#request.processEvent(data)\n }\n\n this.setLogLevel = (l) => {\n this.#logger.logLevel = Number(l)\n if (l === 3) {\n sessionStorage.WZRK_D = ''\n } else {\n delete sessionStorage.WZRK_D\n }\n }\n /**\n * @param {} key\n * @param {*} value\n */\n this.handleIncrementValue = (key, value) => {\n this.profile._handleIncrementDecrementValue(key, value, COMMAND_INCREMENT)\n }\n\n this.handleDecrementValue = (key, value) => {\n this.profile._handleIncrementDecrementValue(key, value, COMMAND_DECREMENT)\n }\n\n this.setMultiValuesForKey = (key, value) => {\n if (Array.isArray(value)) {\n this.profile._handleMultiValueSet(key, value, COMMAND_SET)\n } else {\n console.error('setMultiValuesForKey should be called with a value of type array')\n }\n }\n\n this.addMultiValueForKey = (key, value) => {\n if (typeof value === 'string' || typeof value === 'number') {\n this.profile._handleMultiValueAdd(key, value, COMMAND_ADD)\n } else {\n console.error('addMultiValueForKey should be called with a value of type string or number.')\n }\n }\n\n this.addMultiValuesForKey = (key, value) => {\n if (Array.isArray(value)) {\n this.profile._handleMultiValueAdd(key, value, COMMAND_ADD)\n } else {\n console.error('addMultiValuesForKey should be called with a value of type array.')\n }\n }\n\n this.removeMultiValueForKey = (key, value) => {\n if (typeof value === 'string' || typeof value === 'number') {\n this.profile._handleMultiValueRemove(key, value, COMMAND_REMOVE)\n } else {\n console.error('removeMultiValueForKey should be called with a value of type string or number.')\n }\n }\n\n this.removeMultiValuesForKey = (key, value) => {\n if (Array.isArray(value)) {\n this.profile._handleMultiValueRemove(key, value, COMMAND_REMOVE)\n } else {\n console.error('removeMultiValuesForKey should be called with a value of type array.')\n }\n }\n\n this.removeValueForKey = (key) => {\n this.profile._handleMultiValueDelete(key, COMMAND_DELETE)\n }\n\n const _handleEmailSubscription = (subscription, reEncoded, fetchGroups) => {\n handleEmailSubscription(subscription, reEncoded, fetchGroups, this.#account, this.#logger)\n }\n\n /**\n *\n * @param {number} lat\n * @param {number} lng\n * @param {callback function} handleCoordinates\n * @returns\n */\n this.getLocation = function (lat, lng) {\n // latitude and longitude should be number type\n if ((lat && typeof lat !== 'number') || (lng && typeof lng !== 'number')) {\n console.log('Latitude and Longitude must be of number type')\n return\n }\n if (lat && lng) {\n // valid latitude ranges bw +-90\n if (lat <= -90 || lat > 90) {\n console.log('A vaid latitude must range between -90 and 90')\n return\n }\n // valid longitude ranges bw +-180\n if (lng <= -180 || lng > 180) {\n console.log('A valid longitude must range between -180 and 180')\n return\n }\n $ct.location = { Latitude: lat, Longitude: lng }\n this.#sendLocationData({ Latitude: lat, Longitude: lng })\n } else {\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(showPosition.bind(this), showError)\n } else {\n console.log('Geolocation is not supported by this browser.')\n }\n }\n }\n\n function showPosition (position) {\n var lat = position.coords.latitude\n var lng = position.coords.longitude\n $ct.location = { Latitude: lat, Longitude: lng }\n this.#sendLocationData({ Latitude: lat, Longitude: lng })\n }\n\n function showError (error) {\n switch (error.code) {\n case error.PERMISSION_DENIED:\n console.log('User denied the request for Geolocation.')\n break\n case error.POSITION_UNAVAILABLE:\n console.log('Location information is unavailable.')\n break\n case error.TIMEOUT:\n console.log('The request to get user location timed out.')\n break\n case error.UNKNOWN_ERROR:\n console.log('An unknown error occurred.')\n break\n }\n }\n\n const api = this.#api\n api.logout = this.logout\n api.clear = this.clear\n api.closeIframe = (campaignId, divIdIgnored) => {\n closeIframe(campaignId, divIdIgnored, this.#session.sessionId)\n }\n api.enableWebPush = (enabled, applicationServerKey) => {\n setServerKey(applicationServerKey)\n this.notifications._enableWebPush(enabled, applicationServerKey)\n }\n api.tr = (msg) => {\n _tr(msg, {\n device: this.#device,\n session: this.#session,\n request: this.#request,\n logger: this.#logger\n })\n }\n api.setEnum = (enumVal) => {\n setEnum(enumVal, this.#logger)\n }\n api.is_onloadcalled = () => {\n return (this.#onloadcalled === 1)\n }\n api.subEmail = (reEncoded) => {\n _handleEmailSubscription('1', reEncoded)\n }\n api.getEmail = (reEncoded, withGroups) => {\n _handleEmailSubscription('-1', reEncoded, withGroups)\n }\n api.unSubEmail = (reEncoded) => {\n _handleEmailSubscription('0', reEncoded)\n }\n api.unsubEmailGroups = (reEncoded) => {\n $ct.unsubGroups = []\n const elements = document.getElementsByClassName('ct-unsub-group-input-item')\n\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i]\n if (element.name) {\n const data = { name: element.name, isUnsubscribed: element.checked }\n $ct.unsubGroups.push(data)\n }\n }\n\n _handleEmailSubscription(GROUP_SUBSCRIPTION_REQUEST_ID, reEncoded)\n }\n api.setSubscriptionGroups = (value) => {\n $ct.unsubGroups = value\n }\n api.getSubscriptionGroups = () => {\n return $ct.unsubGroups\n }\n api.changeSubscriptionGroups = (reEncoded, updatedGroups) => {\n api.setSubscriptionGroups(updatedGroups)\n _handleEmailSubscription(GROUP_SUBSCRIPTION_REQUEST_ID, reEncoded)\n }\n api.isGlobalUnsubscribe = () => {\n return $ct.globalUnsubscribe\n }\n api.setIsGlobalUnsubscribe = (value) => {\n $ct.globalUnsubscribe = value\n }\n api.setUpdatedCategoryLong = (profile) => {\n if (profile[categoryLongKey]) {\n $ct.updatedCategoryLong = profile[categoryLongKey]\n }\n }\n window.$CLTP_WR = window.$WZRK_WR = api\n\n if (clevertap.account?.[0].id) {\n // The accountId is present so can init with empty values.\n // Needed to maintain backward compatability with legacy implementations.\n // Npm imports/require will need to call init explictly with accountId\n this.init()\n }\n }\n\n // starts here\n init (accountId, region, targetDomain, token, antiFlicker = {}) {\n if (Object.keys(antiFlicker).length > 0) {\n addAntiFlicker(antiFlicker)\n }\n if (this.#onloadcalled === 1) {\n // already initailsed\n return\n }\n\n StorageManager.removeCookie('WZRK_P', window.location.hostname)\n if (!this.#account.id) {\n if (!accountId) {\n this.#logger.error(EMBED_ERROR)\n return\n }\n this.#account.id = accountId\n }\n checkBuilder(this.#logger, this.#account.id)\n this.#session.cookieName = SCOOKIE_PREFIX + '_' + this.#account.id\n\n if (region) {\n this.#account.region = region\n }\n if (targetDomain) {\n this.#account.targetDomain = targetDomain\n }\n if (token) {\n this.#account.token = token\n }\n\n const currLocation = location.href\n const urlParams = getURLParams(currLocation.toLowerCase())\n\n // eslint-disable-next-line eqeqeq\n if (typeof urlParams.e !== 'undefined' && urlParams.wzrk_ex == '0') {\n return\n }\n\n $ct.isPrivacyArrPushed = true\n if ($ct.privacyArray.length > 0) {\n this.privacy.push($ct.privacyArray)\n }\n\n this.#processOldValues()\n this.pageChanged()\n const backupInterval = setInterval(() => {\n if (this.#device.gcookie) {\n clearInterval(backupInterval)\n this.#request.processBackupEvents()\n }\n }, 3000)\n if (this.#isSpa) {\n // listen to click on the document and check if URL has changed.\n document.addEventListener('click', this.#boundCheckPageChanged)\n } else {\n // remove existing click listeners if any\n document.removeEventListener('click', this.#boundCheckPageChanged)\n }\n this.#onloadcalled = 1\n }\n\n // process the option array provided to the clevertap object\n // after its been initialized\n #processOldValues () {\n this.onUserLogin._processOldValues()\n this.privacy._processOldValues()\n this.event._processOldValues()\n this.profile._processOldValues()\n this.notifications._processOldValues()\n }\n\n #debounce (func, delay = 300) {\n let timeout\n return function () {\n clearTimeout(timeout)\n timeout = setTimeout(func, delay)\n }\n }\n\n #checkPageChanged () {\n const debouncedPageChanged = this.#debounce(() => {\n if (this.#previousUrl !== location.href) {\n this.pageChanged()\n }\n })\n debouncedPageChanged()\n }\n\n pageChanged () {\n const currLocation = window.location.href\n const urlParams = getURLParams(currLocation.toLowerCase())\n // -- update page count\n const obj = this.#session.getSessionCookieObject()\n let pgCount = (typeof obj.p === 'undefined') ? 0 : obj.p\n obj.p = ++pgCount\n this.#session.setSessionCookieObject(obj)\n // -- update page count\n\n let data = {}\n let referrerDomain = getDomain(document.referrer)\n\n if (window.location.hostname !== referrerDomain) {\n const maxLen = 120\n if (referrerDomain !== '') {\n referrerDomain = referrerDomain.length > maxLen ? referrerDomain.substring(0, maxLen) : referrerDomain\n data.referrer = referrerDomain\n }\n\n let utmSource = urlParams.utm_source || urlParams.wzrk_source\n if (typeof utmSource !== 'undefined') {\n utmSource = utmSource.length > maxLen ? utmSource.substring(0, maxLen) : utmSource\n data.us = utmSource // utm_source\n }\n\n let utmMedium = urlParams.utm_medium || urlParams.wzrk_medium\n if (typeof utmMedium !== 'undefined') {\n utmMedium = utmMedium.length > maxLen ? utmMedium.substring(0, maxLen) : utmMedium\n data.um = utmMedium // utm_medium\n }\n\n let utmCampaign = urlParams.utm_campaign || urlParams.wzrk_campaign\n if (typeof utmCampaign !== 'undefined') {\n utmCampaign = utmCampaign.length > maxLen ? utmCampaign.substring(0, maxLen) : utmCampaign\n data.uc = utmCampaign // utm_campaign\n }\n\n // also independently send wzrk_medium to the backend\n if (typeof urlParams.wzrk_medium !== 'undefined') {\n const wm = urlParams.wzrk_medium\n if (wm.match(/^email$|^social$|^search$/)) {\n data.wm = wm // wzrk_medium\n }\n }\n }\n\n data = this.#request.addSystemDataToObject(data, undefined)\n data.cpg = currLocation\n\n data[CAMP_COOKIE_NAME] = getCampaignObjForLc()\n let pageLoadUrl = this.#account.dataPostURL\n this.#request.addFlags(data)\n // send dsync flag when page = 1\n if (parseInt(data.pg) === 1) {\n this.#overrideDSyncFlag(data)\n }\n pageLoadUrl = addToURL(pageLoadUrl, 'type', 'page')\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(JSON.stringify(data), this.#logger))\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n\n if (parseInt(data.pg) === 1) {\n this.event.push(WZRK_FETCH, { t: 4 })\n }\n\n this.#previousUrl = currLocation\n setTimeout(() => {\n if (pgCount <= 3) {\n // send ping for up to 3 pages\n this.#pingRequest()\n }\n\n if (this.#isPingContinuous()) {\n setInterval(() => {\n this.#pingRequest()\n }, CONTINUOUS_PING_FREQ_IN_MILLIS)\n }\n }, FIRST_PING_FREQ_IN_MILLIS)\n }\n\n #pingRequest () {\n let pageLoadUrl = this.#account.dataPostURL\n let data = {}\n data = this.#request.addSystemDataToObject(data, undefined)\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PING)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(JSON.stringify(data), this.#logger))\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n\n #isPingContinuous () {\n return (typeof window.wzrk_d !== 'undefined' && window.wzrk_d.ping === 'continuous')\n }\n\n _isPersonalisationActive () {\n return StorageManager._isLocalStorageSupported() && this.enablePersonalization\n }\n\n #overrideDSyncFlag (data) {\n if (this._isPersonalisationActive()) {\n data.dsync = true\n }\n }\n\n popupCallbacks = {};\n popupCurrentWzrkId = '';\n\n // eslint-disable-next-line accessor-pairs\n set popupCallback (callback) {\n this.popupCallbacks[this.popupCurrentWzrkId] = callback\n }\n\n /**\n *\n * @param {object} payload\n */\n #sendLocationData (payload) {\n // Send the updated value to LC\n let data = {}\n data.af = {}\n const profileObj = {}\n data.type = 'profile'\n if (profileObj.tz == null) {\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n data.profile = profileObj\n if (payload) {\n const keys = Object.keys(payload)\n keys.forEach(key => {\n data.af[key] = payload[key]\n })\n }\n if ($ct.location) {\n data.af = { ...data.af, ...$ct.location }\n }\n data = this.#request.addSystemDataToObject(data, true)\n this.#request.addFlags(data)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n\n // offline mode\n /**\n * events will be recorded and queued locally when passed with true\n * but will not be sent to the server until offline is disabled by passing false\n * @param {boolean} arg\n */\n\n setOffline (arg) {\n if (typeof arg !== 'boolean') {\n console.error('setOffline should be called with a value of type boolean')\n return\n }\n $ct.offline = arg\n // if offline is disabled\n // process events from cache\n if (!arg) {\n this.#request.processBackupEvents()\n }\n }\n\n getSDKVersion () {\n return 'web-sdk-v$$PACKAGE_VERSION$$'\n }\n\n defineVariable (name, defaultValue) {\n return Variable.define(name, defaultValue, this.#variableStore)\n }\n\n syncVariables (onSyncSuccess, onSyncFailure) {\n if (this.#logger.logLevel === 4) {\n return this.#variableStore.syncVariables(onSyncSuccess, onSyncFailure)\n } else {\n const m = 'App log level is not set to 4'\n this.#logger.error(m)\n return Promise.reject(new Error(m))\n }\n }\n\n fetchVariables (onFetchCallback) {\n this.#variableStore.fetchVariables(onFetchCallback)\n }\n\n addVariablesChangedCallback (callback) {\n this.#variableStore.addVariablesChangedCallback(callback)\n }\n\n addOneTimeVariablesChangedCallback (callback) {\n this.#variableStore.addOneTimeVariablesChangedCallback(callback)\n }\n}\n","import Clevertap from './clevertap'\n\nconst clevertap = new Clevertap(window.clevertap)\n\nwindow.clevertap = window.wizrocket = clevertap\n\nexport default clevertap\n"],"names":["TARGET_DOMAIN","TARGET_PROTOCOL","DEFAULT_REGION","Account","constructor","id","region","targetDomain","token","accountId","dcSDKVersion","finalTargetDomain","dataPostPEURL","dataPostURL","recorderURL","emailURL","unsupportedKeyCharRegex","RegExp","unsupportedValueCharRegex","singleQuoteRegex","CLEAR","CHARGED_ID","CHARGEDID_COOKIE_NAME","GCOOKIE_NAME","KCOOKIE_NAME","CAMP_COOKIE_NAME","CAMP_COOKIE_G","SCOOKIE_PREFIX","SCOOKIE_EXP_TIME_IN_SECS","EV_COOKIE","META_COOKIE","PR_COOKIE","ARP_COOKIE","LCOOKIE_NAME","GLOBAL","DISPLAY","WEBPUSH_LS_KEY","OPTOUT_KEY","CT_OPTOUT_KEY","OPTOUT_COOKIE_ENDSWITH","USEIP_KEY","LRU_CACHE","LRU_CACHE_SIZE","IS_OUL","EVT_PUSH","EVT_PING","COOKIE_EXPIRY","MAX_TRIES","FIRST_PING_FREQ_IN_MILLIS","CONTINUOUS_PING_FREQ_IN_MILLIS","GROUP_SUBSCRIPTION_REQUEST_ID","categoryLongKey","WZRK_PREFIX","WZRK_ID","NOTIFICATION_VIEWED","NOTIFICATION_CLICKED","FIRE_PUSH_UNREGISTERED","PUSH_SUBSCRIPTION_DATA","COMMAND_INCREMENT","COMMAND_DECREMENT","COMMAND_SET","COMMAND_ADD","COMMAND_REMOVE","COMMAND_DELETE","WEBINBOX_CONFIG","WEBINBOX","MAX_INBOX_MSG","VARIABLES","PUSH_DELAY_MS","MAX_DELAY_FREQUENCY","WZRK_FETCH","WEBPUSH_CONFIG","SYSTEM_EVENTS","isString","input","String","isObject","Object","prototype","toString","call","isDateObject","Date","isObjectEmpty","obj","prop","hasOwnProperty","isConvertibleToNumber","n","isNaN","parseFloat","isFinite","isNumber","test","isValueValid","value","undefined","removeUnsupportedChars","o","logger","key","sanitizedVal","sanitizedKey","sanitize","length","substring","reportError","val","regex","replace","getToday","today","getFullYear","getMonth","getDay","getNow","Math","floor","getTime","convertToWZRKDate","dateObj","round","setDate","dt","isDateValid","date","matches","exec","d","m","y","composedDate","getDate","StorageManager","save","_isLocalStorageSupported","localStorage","setItem","JSON","stringify","read","data","getItem","parse","e","remove","removeItem","removeCookie","name","domain","cookieStr","document","cookie","createCookie","seconds","expires","domainStr","setTime","toGMTString","encodeURIComponent","readCookie","nameEQ","ca","split","idx","c","charAt","indexOf","decodeURIComponent","window","saveToLSorCookie","property","location","hostname","$ct","globalCache","readFromLSorCookie","trim","err","createBroadCookie","broadDomain","domainParts","testBroadDomain","testCookieName","tempCookie","getMetaProp","metaObj","setMetaProp","wzrkMetaObj","getAndClearMetaProp","setInstantDeleteFlagInK","k","flag","backupEvent","reqNo","backupArr","q","debug","removeBackup","respNo","backupMap","gcookie","REQ_N","RESP_N","globalProfileMap","globalEventsMap","blockRequest","isOptInRequest","webPushEnabled","campaignDivMap","currentSessionId","wiz_counter","notifApi","notifEnabledFromApi","unsubGroups","updatedCategoryLong","inbox","isPrivacyArrPushed","privacyArray","offline","dismissSpamControl","globalUnsubscribe","flutterVersion","variableStore","pushConfig","LRUCache","max","lruCache","tempLruCache","cache","entry","push","get","item","saveCacheToLS","set","allKeys","objToArray","index","temp","getKey","getSecondLastKey","keysArr","getLastKey","keysLength","newCache","indexToDelete","splice","CleverTapAPI","request","device","session","s","global","resume","respNumber","optOutResponse","oulReq","newGuid","isOULInProgress","oulReqN","sessionObj","getSessionCookieObject","kIdFromLS","guidFromLRUCache","lastK","lastGUID","unregisterTokenForGuid","manageSession","t","setSessionCookieObject","processingBackup","processBackupEvents","DeviceManager","getGuid","guid","error","DATA_NOT_SENT_TEXT","CLEVERTAP_ERROR_PREFIX","EMBED_ERROR","EVENT_ERROR","GENDER_ERROR","EMPLOYED_ERROR","MARRIED_ERROR","EDUCATION_ERROR","AGE_ERROR","DOB_ERROR","ENUM_FORMAT_ERROR","PHONE_FORMAT_ERROR","_globalChargedId","isEventStructureFlat","eventObj","Array","isArray","isChargedEventStructureValid","chargedObj","itemKey","chargedId","EventHandler","values","isPersonalisationActive","eventsArr","_processOldValues","getDetails","evtName","evtObj","respObj","firstTime","lastTime","count","eventName","shift","includes","type","unshift","evtData","processEvent","getURLParams","url","urlParams","uri","match","pl","search","decode","replacement","getDomain","a","createElement","href","addToURL","v","getHostName","urlBase64ToUint8Array","base64String","padding","repeat","base64","rawData","atob","processedData","i","charCodeAt","Uint8Array","compressData","dataObject","compressToBase64","compress","uncompressed","context_dictionary","context_dictionaryToCreate","context_c","context_wc","context_w","context_enlargeIn","context_dictSize","context_numBits","context_data_string","context_data_val","context_data_position","ii","f","fromCharCode","pow","getKeyStr","_keyStr","output","chr1","chr2","chr3","enc1","enc2","enc3","enc4","NaN","RequestDispatcher","networkRetryCount","minDelayFrequency","fireRequest","skipARP","sendOULFlag","getDelayFrequency","account","randomDelay","random","skipResARP","_arp","pageLoadUrl","useIP","slice","tries","setTimeout","clevertap","wizrocket","plugin","ctCbScripts","getElementsByClassName","parentNode","removeChild","setAttribute","async","getElementsByTagName","appendChild","getCampaignObject","finalcampObj","campObj","wp","saveCampaignObject","campaignObj","newObj","setCampaignObjectForGuid","guidCampObj","finalCampObj","keys","forEach","campKeyObj","globalObj","dailyObj","campaignIdArray","resultObj","dailyC","totalC","campaignId","console","getCampaignObjForLc","storageValue","decodedValue","parsedValue","resultObjWP","resultObjWI","wi","todayCwp","todayCwi","tc","wmp","wimp","tlc","witlc","isProfileValid","profileObj","valid","profileKey","profileVal","Age","Phone","processFBUserObj","user","profileData","Name","FBID","gender","Gender","getHighestEducation","eduArr","college","highschool","edu","relationship_status","Married","education","Education","work","Employed","email","Email","birthday","mmddyy","DOB","processGPlusUserObj","displayName","GPID","image","isDefault","Photo","emails","emailIdx","emailObj","organizations","orgObj","yyyymmdd","relationshipStatus","addToLocalProfileMap","override","_custom","closeIframe","divIdIgnored","sessionCampaignObj","divId","getElementById","arp","jsonMap","isOULARP","arpFromStorage","setEnum","enumVal","handleEmailSubscription","subscription","reEncoded","fetchGroups","urlParamsAsIs","encodedEmailId","encodedProfileProps","p","pageType","page_type","ProfileHandler","profilesArr","getAttribute","propName","_handleIncrementDecrementValue","command","tz","profile","addSystemDataToObject","addFlags","compressedData","saveAndFireRequest","_handleMultiValueSet","arrayVal","array","toLowerCase","sendMultiValueData","_handleMultiValueAdd","propKey","propVal","existingValue","addValue","normalizedValue","_handleMultiValueRemove","removeValue","_handleMultiValueDelete","profileArr","outerObj","Site","Facebook","FbProfileObj","GPlusProfileObj","UserLoginHandler","clear","addToK","ids","g","kId","anonymousUser","foundInCache","gFromCache","Identity","cookieName","loginArr","pop","processProfile","CTWebPopupImageOnly","HTMLElement","_target","_session","shadow","popup","container","resizeObserver","attachShadow","mode","target","renderImageOnlyPopup","msgId","wzrk_id","pivotId","wzrk_pivot","onClickUrl","display","sessionId","innerHTML","getImageOnlyPopupContent","shadowRoot","closeIcon","addEventListener","updateImageAndContainerWidth","ResizeObserver","handleResize","observe","unobserve","style","renderNotificationViewed","open","parent","renderNotificationClicked","width","getRenderedImageWidth","setProperty","msgContent","css","html","visibility","img","ratio","naturalWidth","naturalHeight","height","Message","config","message","wrapper","snackBar","renderMessage","createEl","part","_el","msg","templateType","prepareBasicMessage","timeStamp","determineTimeStampText","viewed","unreadMarker","imageUrl","imageContainer","addImage","iconTitleDescWrapper","iconUrl","iconContainer","titleDescWrapper","title","innerText","description","buttons","buttonsContainer","addButtons","hasCopyAction","b","button","text","cssText","action","addSnackbar","greenTickSvg","clipboardMsg","raiseClickedEvent","path","isPreview","raiseClickedForBasicTemplates","payload","tagName","kv","wzrk_c2a","openUrlInNewTab","focus","navigator","clipboard","writeText","clipboardText","log","messageStyles","backgroundColor","borderColor","titleColor","descriptionColor","buttonColor","buttonTextColor","unreadMarkerColor","inboxContainerStyles","panelBackgroundColor","panelBorderColor","headerBackgroundColor","headerTitleColor","closeIconColor","categoriesTabColor","categoriesTitleColor","categoriesBorderColor","selectedCategoryTabColor","selectedCategoryTitleColor","selectedCategoryBorderColor","headerCategoryHeight","Inbox","isInboxOpen","isInboxFromFlutter","selectedCategory","unviewedMessages","unviewedCounter","inboxConfigForPreview","inboxSelector","emptyInboxMsg","inboxCard","unviewedBadge","observer","selectedCategoryRef","addClickListenerOnDocument","composedPath","toggleInbox","startsWith","prevCategoryRef","updateActiveCategory","_path","filter","messageEl","checkForWebInbox","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","contains","raiseViewedEvent","isIntersecting","updateMessageInLS","rect","zIndex","scrollLeft","scrollWidth","setInboxPosition","windowWidth","outerWidth","customInboxStyles","getComputedStyle","getPropertyValue","bottom","hasPositionDefined","res","getInboxPosition","clientHeight","clientWidth","xPos","yPos","ts","headerHeight","categoriesHeight","tabColor","selectedTab","inboxStyles","cardStyles","cards","msgStyles","processWebInboxSettings","webInboxSetting","_settings","processInboxNotifs","inbox_preview","inbox_notifs","addWebInbox","checkAndRegisterWebInboxElements","getAndMigrateInboxMessages","gudInboxObj","storedInboxObj","initializeWebInbox","Promise","resolve","reject","readyState","onLoaded","setInterval","clearInterval","customElements","define","inboxHeight","inboxWidth","horizontalScroll","scrollingElement","verticalScroll","innerWidth","windowHeight","innerHeight","selectorRect","selectorX","x","selectorY","selectorLeft","selectorRight","selectorTop","selectorBottom","selectorHeight","selectorWidth","selectorCenter","halfOfInboxHeight","halfOfInboxWidth","inboxOnSide","availableHeight","inboxRight","availableWidth","inboxLeft","diff","hasWebInboxSettingsInLS","OVERLAY_PATH","CSS_PATH","WVE_CLASS","FLICKER_SHOW","FLICKER_HIDE","FLICKER_ID","updateFormData","element","formStyle","underline","curTextDecoration","textDecoration","clickDetails","clickUrl","onclick","newTab","raiseNotificationClicked","imgURL","src","elementCss","head","checkBuilder","parentWindow","opener","handleMessageEvent","postMessage","originUrl","sdkVersion","event","isValidUrl","msgOrigin","URL","origin","evtMaster","personalisation","initialiseCTBuilder","variant","details","renderVisualBuilder","onContentLoad","contentLoaded","isShopify","Shopify","documentElement","position","overlayPath","loadOverlayScript","then","catch","loadCSS","link","rel","script","onload","Overlay","Error","onerror","targetingMsgJson","notificationViewed","raiseViewed","processElement","selector","outerHTML","json","dispatchJsonData","msgCTkv","wzrk_selector","form","tryFindingElement","intervalId","retryElement","querySelector","selectorData","inaObj","kvPairsEvent","CustomEvent","detail","dispatchEvent","string","Boolean","_err","addAntiFlicker","antiFlicker","personalizedSelectors","delayTime","retryElements","retryCount","retryInterval","isInViewport","styleContent","styleId","styleElement","textContent","applyAntiFlicker","selectors","processSelectors","selectorElements","elements","matchedElements","applyStyles","retryProcessing","classList","add","observeUrlChange","previousHref","MutationObserver","childList","subtree","CTWebPersonalisationBanner","_details","renderBanner","getBannerContent","trackClick","onClick","divHeight","desktopImageURL","mobileImageURL","CTWebPersonalisationCarousel","_carousel","slides","previouslySelectedItem","selectedItem","autoSlide","stopAutoSlideTimeout","renderCarousel","getStyles","carousel","getCarouselContent","showNavBtns","insertAdjacentHTML","navBtnsHtml","showNavArrows","leftNavArrowHtml","rightNavArrowHtml","setupClick","updateSelectedItem","startAutoSlide","setupOnHover","eventID","selected","endsWith","goToNext","goToPrev","wzrk_slideNo","clearTimeout","banner","navBtnsCss","navArrowsCss","prevItem","prevButton","sliderTime","goTo","prev","cur","renderPersonalisationBanner","divSelector","bannerEl","containerEl","renderPersonalisationCarousel","handleKVpairCampaign","invokeExternalJs","jsFunc","func","appendScriptForCustomEvent","staleDataUpdate","staledata","campType","mergeEventMap","newEvtMap","oldEvtObj","newEvtObj","incrementImpression","_request","setupClickEvent","contentDiv","isLegacy","_device","ctaElement","jsCTAElements","preview","getCookieParams","rValue","searchParams","notifications","skipDialog","scookieObj","renderPopUpImageOnly","popupImageOnly","getBoxPromptStyles","totalBorderWidth","card","borderEnabled","border","borderWidth","cardPadding","cardContentWidth","overlay","color","borderRadius","primaryButton","secondaryButton","getBellIconStyles","NotificationHandler","displayArgs","enable","swPath","enablePush","setUpWebPushNotifications","subscriptionCallback","serviceWorkerPath","apnsWebPushId","apnsServiceUrl","userAgent","setApplicationServerKey","applicationServerKey","_enableWebPush","enabled","safari","pushNotification","requestPermission","permission","subscriptionData","endpoint","deviceToken","browser","registerToken","info","registrationScope","serviceWorker","register","registration","__wzrk_account_id","scope","rootDirRegex","isServiceWorkerAtRoot","ready","getRegistrations","serviceWorkerRegistration","subscribeObj","userVisibleOnly","pushManager","subscribe","existingBellWrapper","getSubscription","unsubscribe","successful","scriptTag","titleText","bodyText","okButtonText","rejectButtonText","okButtonColor","askAgainTimeInSeconds","okCallback","rejectCallback","httpsPopupPath","httpsIframePath","apnsWebPushServiceUrl","notifObj","isHTTP","protocol","chromeAgent","parseInt","firefoxAgent","safariAgent","hasNotification","Notification","httpsIframe","state","from","wzrkPermissionPopup","wizAlert","confirmButtonText","confirmButtonColor","BELL_BASE64","PROMPT_BELL_BASE64","appServerKey","notificationHandler","processWebPushConfig","webPushConfig","_pushConfig","updatePushConfig","customSwPath","showBox","boxType","showBellIcon","boxConfig","createNotificationBox","bellIconConfig","createBellIcon","createElementWithAttributes","tag","attributes","configData","content","overlayDiv","pnCard","icon","primaryButtonText","secondaryButtonText","setElementPosition","lastNotifTime","popupFrequency","addEventListeners","bellWrapper","bellIcon","gifModal","gifImage","closeModal","hoverText","tooltip","addBellEventListeners","setServerKey","serverKey","removeWrapper","toggleGifModal","displayTooltip","clearTooltip","assign","inset","transform","positions","Center","Top","Bottom","bellRect","midX","midY","_tr","_logger","_wizCounter","doCampHouseKeeping","incrCount","excludeFromFreqCaps","currentCount","totalCount","sessionStorage","campTypeObj","wtarget_type","wmc","wimc","campaignSessionLimit","campaignDailyLimit","campaignTotalLimit","totalDailyLimit","totalSessionLimit","totalInboxSessionLimit","efc","mdc","tdc","campaignSessionCount","totalSessionCount","campaignDailyCount","totalDailyCount","campaignTotalCount","displayObj","delay","campKey","newCampObj","setupClickUrl","handleImageOnlyPopup","msgDiv","isExistingCampaign","testIframe","iframeDocument","contentDocument","contentWindow","createTemplate","isExitIntent","layout","showExitIntent","opacityDivId","opacityElement","isBanner","opacityDiv","opacity","rgbaColor","viewHeight","viewWidth","legacy","marginBottom","contentHeight","bottomPosition","widthPerct","proto","iFrameStyle","iframe","br","frameborder","marginheight","marginwidth","scrolling","pointerCss","sandbox","bgColor","btnBg","leftTd","btColor","theme","descriptionText","imageTd","onClickStr","closeCampaign","Event","srcdoc","adjustIFrameHeight","scrollHeight","margin","ua","inDoc","_timer","renderFooterNotification","_callBackCalled","showFooterNotification","notificationCallback","raiseNotificationViewed","popupCurrentWzrkId","deliveryTrigger","inactive","triggerByInactivity","scroll","triggerByScroll","exitintentObj","onmouseleave","deliveryDelayed","popupCallbacks","popupCallback","wzrkPrefixKey","wzrkJson","raisePopupNotificationClicked","notificationData","eventData","wzrkPrefixObj","targetNotif","IDLE_TIME_THRESHOLD","idleTimer","events","resetIdleTimer","removeEventListeners","eventHandler","setupEventListeners","eventType","passive","calculateScrollPercentage","scrollListener","scrollPercentage","throttledScrollListener","throttle","limit","inThrottle","context","args","apply","targetObj","clientY","intentPreview","intentOpacityDiv","ctaText","processNativeDisplayArr","arrInAppNotifs","elementId","addLoadListener","inapp_notifs","handleInboxNotifications","msgArr","vars","mergeVariables","evpr","eventsMap","profileMap","syncExpiry","expires_in","inapp_stale","inbox_stale","User","getTotalVisits","visitCount","getLastVisit","prevSession","logLevels","DISABLE","ERROR","INFO","DEBUG","DEBUG_PE","Logger","logLevel","wzrkError","debugPE","code","level","WZRK_D","SessionManager","scookieStr","objStr","currentSessionInLS","sessionCount","getTimeElapsed","sessionStart","getPageCount","seqNo","requestTime","RequestManager","fired","ignoreTrim","wzrk_error","pg","af","lib","rc","lastSyncTime","expirySeconds","dsync","givenGUID","post","fetch","method","headers","response","ok","nowTs","evtDetail","Privacy","privacyArr","privacyObj","curr","optOut","shouldUseIP","Variable","defaultValue","hadStarted","valueChangedCallbacks","getValue","getdefaultValue","typeOfDefaultValue","existing","getVariable","varInstance","registerVariable","update","newValue","oldValue","hasVarsRequestCompleted","triggerValueChanged","onValueChanged","addValueChangedCallback","removeValueChangedCallback","clearStartFlag","VariableStore","syncVariables","onSyncSuccess","onSyncFailure","meta","tk","r","status","fetchVariables","onFetchCallback","addVariablesChangedCallback","callback","addOneTimeVariablesChangedCallback","removeVariablesChangedCallback","removeOneTimeVariablesChangedCallback","callBack","CleverTap","spa","isSpa","bind","enablePersonalization","_isPersonalisationActive","shpfyProxyPath","ReqestManager","onUserLogin","privacy","logout","getCleverTapID","getAccountID","getSCDomain","setLibrary","libName","libVersion","setSCSDKVersion","ver","scSDKVersion","scv","getInboxMessageCount","getInboxMessageUnreadCount","getAllInboxMessages","getUnreadInboxMessages","getInboxMessageForId","messageId","deleteInboxMessage","unViewedBadge","ctInbox","markReadInboxMessage","unreadMsg","markReadInboxMessagesForIds","messageIds","markReadAllInboxMessage","processNotificationEvent","eventDetail","setLogLevel","l","Number","handleIncrementValue","handleDecrementValue","setMultiValuesForKey","addMultiValueForKey","addMultiValuesForKey","removeMultiValueForKey","removeMultiValuesForKey","removeValueForKey","_handleEmailSubscription","getLocation","lat","lng","Latitude","Longitude","geolocation","getCurrentPosition","showPosition","showError","coords","latitude","longitude","PERMISSION_DENIED","POSITION_UNAVAILABLE","TIMEOUT","UNKNOWN_ERROR","api","enableWebPush","tr","is_onloadcalled","subEmail","getEmail","withGroups","unSubEmail","unsubEmailGroups","isUnsubscribed","checked","setSubscriptionGroups","getSubscriptionGroups","changeSubscriptionGroups","updatedGroups","isGlobalUnsubscribe","setIsGlobalUnsubscribe","setUpdatedCategoryLong","$CLTP_WR","$WZRK_WR","currLocation","wzrk_ex","pageChanged","backupInterval","pgCount","referrerDomain","referrer","maxLen","utmSource","utm_source","wzrk_source","us","utmMedium","utm_medium","wzrk_medium","um","utmCampaign","utm_campaign","wzrk_campaign","uc","wm","cpg","setOffline","arg","getSDKVersion","defineVariable","timeout","debouncedPageChanged","wzrk_d","ping","Clevertap"],"mappings":";;;;;;;;;;;;;;;;;;;;EAAO,MAAMA,aAAa,GAAG,oBAAtB;E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