diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c178c48..667c49cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ # Change Log All notable changes to this project will be documented in this file. -## [1.7.4] - 3 May, 2024 -- Cross-site scripting (XSS) bugfix. +## [1.7.4] - 17 May, 2024 +- Fixes a issue in path for installation of Service worker for shopify. ## [1.7.3] - 3 Apr, 2024 - Fixes a issue in release pipeline of Service worker. diff --git a/clevertap.js b/clevertap.js index 55e7efad..9ea36e7a 100644 --- a/clevertap.js +++ b/clevertap.js @@ -4,317 +4,6 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.clevertap = factory()); }(this, (function () { 'use strict'; - function _typeof(obj) { - "@babel/helpers - typeof"; - - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function (obj) { - return typeof obj; - }; - } else { - _typeof = function (obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; - } - - return _typeof(obj); - } - - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; - } - - function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - - return obj; - } - - function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - if (enumerableOnly) symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - }); - keys.push.apply(keys, symbols); - } - - return keys; - } - - function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - - if (i % 2) { - ownKeys(Object(source), true).forEach(function (key) { - _defineProperty(target, key, source[key]); - }); - } else if (Object.getOwnPropertyDescriptors) { - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - } else { - ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } - } - - return target; - } - - function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - if (superClass) _setPrototypeOf(subClass, superClass); - } - - function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); - } - - function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - return _setPrototypeOf(o, p); - } - - function _isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) return false; - if (Reflect.construct.sham) return false; - if (typeof Proxy === "function") return true; - - try { - Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); - return true; - } catch (e) { - return false; - } - } - - function _construct(Parent, args, Class) { - if (_isNativeReflectConstruct()) { - _construct = Reflect.construct; - } else { - _construct = function _construct(Parent, args, Class) { - var a = [null]; - a.push.apply(a, args); - var Constructor = Function.bind.apply(Parent, a); - var instance = new Constructor(); - if (Class) _setPrototypeOf(instance, Class.prototype); - return instance; - }; - } - - return _construct.apply(null, arguments); - } - - function _isNativeFunction(fn) { - return Function.toString.call(fn).indexOf("[native code]") !== -1; - } - - function _wrapNativeSuper(Class) { - var _cache = typeof Map === "function" ? new Map() : undefined; - - _wrapNativeSuper = function _wrapNativeSuper(Class) { - if (Class === null || !_isNativeFunction(Class)) return Class; - - if (typeof Class !== "function") { - throw new TypeError("Super expression must either be null or a function"); - } - - if (typeof _cache !== "undefined") { - if (_cache.has(Class)) return _cache.get(Class); - - _cache.set(Class, Wrapper); - } - - function Wrapper() { - return _construct(Class, arguments, _getPrototypeOf(this).constructor); - } - - Wrapper.prototype = Object.create(Class.prototype, { - constructor: { - value: Wrapper, - enumerable: false, - writable: true, - configurable: true - } - }); - return _setPrototypeOf(Wrapper, Class); - }; - - return _wrapNativeSuper(Class); - } - - function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - - return self; - } - - function _possibleConstructorReturn(self, call) { - if (call && (typeof call === "object" || typeof call === "function")) { - return call; - } - - return _assertThisInitialized(self); - } - - function _createSuper(Derived) { - var hasNativeReflectConstruct = _isNativeReflectConstruct(); - - return function _createSuperInternal() { - var Super = _getPrototypeOf(Derived), - result; - - if (hasNativeReflectConstruct) { - var NewTarget = _getPrototypeOf(this).constructor; - - result = Reflect.construct(Super, arguments, NewTarget); - } else { - result = Super.apply(this, arguments); - } - - return _possibleConstructorReturn(this, result); - }; - } - - function _toConsumableArray(arr) { - return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); - } - - function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) return _arrayLikeToArray(arr); - } - - function _iterableToArray(iter) { - if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); - } - - function _unsupportedIterableToArray(o, minLen) { - if (!o) return; - if (typeof o === "string") return _arrayLikeToArray(o, minLen); - var n = Object.prototype.toString.call(o).slice(8, -1); - if (n === "Object" && o.constructor) n = o.constructor.name; - if (n === "Map" || n === "Set") return Array.from(o); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); - } - - function _arrayLikeToArray(arr, len) { - if (len == null || len > arr.length) len = arr.length; - - for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; - - return arr2; - } - - function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - } - - function _createForOfIteratorHelper(o, allowArrayLike) { - var it; - - if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { - if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { - if (it) o = it; - var i = 0; - - var F = function () {}; - - return { - s: F, - n: function () { - if (i >= o.length) return { - done: true - }; - return { - done: false, - value: o[i++] - }; - }, - e: function (e) { - throw e; - }, - f: F - }; - } - - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - } - - var normalCompletion = true, - didErr = false, - err; - return { - s: function () { - it = o[Symbol.iterator](); - }, - n: function () { - var step = it.next(); - normalCompletion = step.done; - return step; - }, - e: function (e) { - didErr = true; - err = e; - }, - f: function () { - try { - if (!normalCompletion && it.return != null) it.return(); - } finally { - if (didErr) throw err; - } - } - }; - } - var id = 0; function _classPrivateFieldLooseKey(name) { @@ -329,9 +18,9 @@ return receiver; } - var TARGET_DOMAIN = 'clevertap-prod.com'; - var TARGET_PROTOCOL = 'https:'; - var DEFAULT_REGION = 'eu1'; + const TARGET_DOMAIN = 'clevertap-prod.com'; + const TARGET_PROTOCOL = 'https:'; + const DEFAULT_REGION = 'eu1'; var _accountId = _classPrivateFieldLooseKey("accountId"); @@ -343,17 +32,14 @@ var _token = _classPrivateFieldLooseKey("token"); - var Account = /*#__PURE__*/function () { - function Account() { - var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - id = _ref.id; - - var region = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; - var targetDomain = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : TARGET_DOMAIN; - var token = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ''; - - _classCallCheck(this, Account); - + class Account { + constructor() { + let { + id + } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let region = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + let targetDomain = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : TARGET_DOMAIN; + let token = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ''; Object.defineProperty(this, _accountId, { writable: true, value: void 0 @@ -389,171 +75,151 @@ } } - _createClass(Account, [{ - key: "id", - get: function get() { - return _classPrivateFieldLooseBase(this, _accountId)[_accountId]; - }, - set: function set(accountId) { - _classPrivateFieldLooseBase(this, _accountId)[_accountId] = accountId; - } - }, { - key: "region", - get: function get() { - return _classPrivateFieldLooseBase(this, _region)[_region]; - }, - set: function set(region) { - _classPrivateFieldLooseBase(this, _region)[_region] = region; - } - }, { - key: "dcSDKVersion", - get: function get() { - return _classPrivateFieldLooseBase(this, _dcSdkversion)[_dcSdkversion]; - }, - set: function set(dcSDKVersion) { - _classPrivateFieldLooseBase(this, _dcSdkversion)[_dcSdkversion] = dcSDKVersion; - } - }, { - key: "targetDomain", - get: function get() { - return _classPrivateFieldLooseBase(this, _targetDomain)[_targetDomain]; - }, - set: function set(targetDomain) { - _classPrivateFieldLooseBase(this, _targetDomain)[_targetDomain] = targetDomain; - } - }, { - key: "token", - get: function get() { - return _classPrivateFieldLooseBase(this, _token)[_token]; - }, - set: function set(token) { - _classPrivateFieldLooseBase(this, _token)[_token] = token; - } - }, { - key: "finalTargetDomain", - get: function get() { - if (this.region) { - return "".concat(this.region, ".").concat(this.targetDomain); - } else { - if (this.targetDomain === TARGET_DOMAIN) { - return "".concat(DEFAULT_REGION, ".").concat(this.targetDomain); - } + get id() { + return _classPrivateFieldLooseBase(this, _accountId)[_accountId]; + } + + set id(accountId) { + _classPrivateFieldLooseBase(this, _accountId)[_accountId] = accountId; + } + + get region() { + return _classPrivateFieldLooseBase(this, _region)[_region]; + } + + set region(region) { + _classPrivateFieldLooseBase(this, _region)[_region] = region; + } + + get dcSDKVersion() { + return _classPrivateFieldLooseBase(this, _dcSdkversion)[_dcSdkversion]; + } + + set dcSDKVersion(dcSDKVersion) { + _classPrivateFieldLooseBase(this, _dcSdkversion)[_dcSdkversion] = dcSDKVersion; + } + + get targetDomain() { + return _classPrivateFieldLooseBase(this, _targetDomain)[_targetDomain]; + } + + set targetDomain(targetDomain) { + _classPrivateFieldLooseBase(this, _targetDomain)[_targetDomain] = targetDomain; + } + + get token() { + return _classPrivateFieldLooseBase(this, _token)[_token]; + } + + set token(token) { + _classPrivateFieldLooseBase(this, _token)[_token] = token; + } + + get finalTargetDomain() { + if (this.region) { + return "".concat(this.region, ".").concat(this.targetDomain); + } else { + if (this.targetDomain === TARGET_DOMAIN) { + return "".concat(DEFAULT_REGION, ".").concat(this.targetDomain); + } + + return this.targetDomain; + } + } + + get dataPostPEURL() { + return "".concat(TARGET_PROTOCOL, "//").concat(this.finalTargetDomain, "/defineVars"); + } - return this.targetDomain; - } - } - }, { - key: "dataPostPEURL", - get: function get() { - return "".concat(TARGET_PROTOCOL, "//").concat(this.finalTargetDomain, "/defineVars"); - } - }, { - key: "dataPostURL", - get: function get() { - return "".concat(TARGET_PROTOCOL, "//").concat(this.finalTargetDomain, "/a?t=96"); - } - }, { - key: "recorderURL", - get: function get() { - return "".concat(TARGET_PROTOCOL, "//").concat(this.finalTargetDomain, "/r?r=1"); - } - }, { - key: "emailURL", - get: function get() { - return "".concat(TARGET_PROTOCOL, "//").concat(this.finalTargetDomain, "/e?r=1"); - } - }]); - - return Account; - }(); - - var unsupportedKeyCharRegex = new RegExp('^\\s+|\\\.|\:|\\\$|\'|\"|\\\\|\\s+$', 'g'); - var unsupportedValueCharRegex = new RegExp("^\\s+|\'|\"|\\\\|\\s+$", 'g'); - var singleQuoteRegex = new RegExp('\'', 'g'); - var CLEAR = 'clear'; - var CHARGED_ID = 'Charged ID'; - var CHARGEDID_COOKIE_NAME = 'WZRK_CHARGED_ID'; - var GCOOKIE_NAME = 'WZRK_G'; - var KCOOKIE_NAME = 'WZRK_K'; - var CAMP_COOKIE_NAME = 'WZRK_CAMP'; - var CAMP_COOKIE_G = 'WZRK_CAMP_G'; // cookie for storing campaign details against guid - - var SCOOKIE_PREFIX = 'WZRK_S'; - var SCOOKIE_EXP_TIME_IN_SECS = 60 * 20; // 20 mins - - var EV_COOKIE = 'WZRK_EV'; - var META_COOKIE = 'WZRK_META'; - var PR_COOKIE = 'WZRK_PR'; - var ARP_COOKIE = 'WZRK_ARP'; - var LCOOKIE_NAME = 'WZRK_L'; - var GLOBAL = 'global'; // used for email unsubscribe also - var DISPLAY = 'display'; - var WEBPUSH_LS_KEY = 'WZRK_WPR'; - var OPTOUT_KEY = 'optOut'; - var CT_OPTOUT_KEY = 'ct_optout'; - var OPTOUT_COOKIE_ENDSWITH = ':OO'; - var USEIP_KEY = 'useIP'; - var LRU_CACHE = 'WZRK_X'; - var LRU_CACHE_SIZE = 100; - var IS_OUL = 'isOUL'; - var EVT_PUSH = 'push'; - var EVT_PING = 'ping'; - var COOKIE_EXPIRY = 86400 * 365; // 1 Year in seconds - - var MAX_TRIES = 200; // API tries - - var FIRST_PING_FREQ_IN_MILLIS = 2 * 60 * 1000; // 2 mins - - var CONTINUOUS_PING_FREQ_IN_MILLIS = 5 * 60 * 1000; // 5 mins - - var GROUP_SUBSCRIPTION_REQUEST_ID = '2'; - var categoryLongKey = 'cUsY'; - var WZRK_PREFIX = 'wzrk_'; - var WZRK_ID = 'wzrk_id'; - var NOTIFICATION_VIEWED = 'Notification Viewed'; - var NOTIFICATION_CLICKED = 'Notification Clicked'; - var FIRE_PUSH_UNREGISTERED = 'WZRK_FPU'; - var PUSH_SUBSCRIPTION_DATA = 'WZRK_PSD'; // PUSH SUBSCRIPTION DATA FOR REGISTER/UNREGISTER TOKEN - - var COMMAND_INCREMENT = '$incr'; - var COMMAND_DECREMENT = '$decr'; - var COMMAND_SET = '$set'; - var COMMAND_ADD = '$add'; - var COMMAND_REMOVE = '$remove'; - var COMMAND_DELETE = '$delete'; - var WEBINBOX_CONFIG = 'WZRK_INBOX_CONFIG'; - var WEBINBOX = 'WZRK_INBOX'; - var MAX_INBOX_MSG = 15; - var VARIABLES = 'WZRK_PE'; - var PUSH_DELAY_MS = 1000; - var MAX_DELAY_FREQUENCY = 1000 * 60 * 10; - var WZRK_FETCH = 'wzrk_fetch'; - var WIZ_IFRAME = 'wiz-iframe'; - var WIZ_IFRAME_INTENT = 'wiz-iframe-intent'; - var ADJUST_IFRAME_HEIGHT = 'adjustIFrameHeight'; - var UPDATE_HEIGHT = 'update height'; - var GET_NOTIFICATION = 'getnotif'; - var EVENT = 'Event'; - var PROFILE = 'Profile'; - var OUL = 'OUL'; - var CLOSE_BOX_POPUP = 'closeBoxPopUp'; - var CLOSE_BANNER_POPUP = 'closeBannerPopUp'; - var GET_NOTIFICATION_DATA = 'getnotifData'; - var CLOSE_INTERSTITIAL_POPUP = 'closeInterstitialPopUp'; - var SYSTEM_EVENTS = ['Stayed', 'UTM Visited', 'App Launched', 'Notification Sent', NOTIFICATION_VIEWED, NOTIFICATION_CLICKED]; - - var isString = function isString(input) { + get dataPostURL() { + return "".concat(TARGET_PROTOCOL, "//").concat(this.finalTargetDomain, "/a?t=96"); + } + + get recorderURL() { + return "".concat(TARGET_PROTOCOL, "//").concat(this.finalTargetDomain, "/r?r=1"); + } + + get emailURL() { + return "".concat(TARGET_PROTOCOL, "//").concat(this.finalTargetDomain, "/e?r=1"); + } + + } + + const unsupportedKeyCharRegex = new RegExp('^\\s+|\\\.|\:|\\\$|\'|\"|\\\\|\\s+$', 'g'); + const unsupportedValueCharRegex = new RegExp("^\\s+|\'|\"|\\\\|\\s+$", 'g'); + const singleQuoteRegex = new RegExp('\'', 'g'); + const CLEAR = 'clear'; + const CHARGED_ID = 'Charged ID'; + const CHARGEDID_COOKIE_NAME = 'WZRK_CHARGED_ID'; + const GCOOKIE_NAME = 'WZRK_G'; + const KCOOKIE_NAME = 'WZRK_K'; + const CAMP_COOKIE_NAME = 'WZRK_CAMP'; + const CAMP_COOKIE_G = 'WZRK_CAMP_G'; // cookie for storing campaign details against guid + + const SCOOKIE_PREFIX = 'WZRK_S'; + const SCOOKIE_EXP_TIME_IN_SECS = 60 * 20; // 20 mins + + const EV_COOKIE = 'WZRK_EV'; + const META_COOKIE = 'WZRK_META'; + const PR_COOKIE = 'WZRK_PR'; + const ARP_COOKIE = 'WZRK_ARP'; + const LCOOKIE_NAME = 'WZRK_L'; + const GLOBAL = 'global'; // used for email unsubscribe also + const DISPLAY = 'display'; + const WEBPUSH_LS_KEY = 'WZRK_WPR'; + const OPTOUT_KEY = 'optOut'; + const CT_OPTOUT_KEY = 'ct_optout'; + const OPTOUT_COOKIE_ENDSWITH = ':OO'; + const USEIP_KEY = 'useIP'; + const LRU_CACHE = 'WZRK_X'; + const LRU_CACHE_SIZE = 100; + const IS_OUL = 'isOUL'; + const EVT_PUSH = 'push'; + const EVT_PING = 'ping'; + const COOKIE_EXPIRY = 86400 * 365; // 1 Year in seconds + + const MAX_TRIES = 200; // API tries + + const FIRST_PING_FREQ_IN_MILLIS = 2 * 60 * 1000; // 2 mins + + const CONTINUOUS_PING_FREQ_IN_MILLIS = 5 * 60 * 1000; // 5 mins + + const GROUP_SUBSCRIPTION_REQUEST_ID = '2'; + const categoryLongKey = 'cUsY'; + const WZRK_PREFIX = 'wzrk_'; + const WZRK_ID = 'wzrk_id'; + const NOTIFICATION_VIEWED = 'Notification Viewed'; + const NOTIFICATION_CLICKED = 'Notification Clicked'; + const FIRE_PUSH_UNREGISTERED = 'WZRK_FPU'; + const PUSH_SUBSCRIPTION_DATA = 'WZRK_PSD'; // PUSH SUBSCRIPTION DATA FOR REGISTER/UNREGISTER TOKEN + + const COMMAND_INCREMENT = '$incr'; + const COMMAND_DECREMENT = '$decr'; + const COMMAND_SET = '$set'; + const COMMAND_ADD = '$add'; + const COMMAND_REMOVE = '$remove'; + const COMMAND_DELETE = '$delete'; + const WEBINBOX_CONFIG = 'WZRK_INBOX_CONFIG'; + const WEBINBOX = 'WZRK_INBOX'; + const MAX_INBOX_MSG = 15; + const VARIABLES = 'WZRK_PE'; + const PUSH_DELAY_MS = 1000; + const MAX_DELAY_FREQUENCY = 1000 * 60 * 10; + const WZRK_FETCH = 'wzrk_fetch'; + const SYSTEM_EVENTS = ['Stayed', 'UTM Visited', 'App Launched', 'Notification Sent', NOTIFICATION_VIEWED, NOTIFICATION_CLICKED]; + + const isString = input => { return typeof input === 'string' || input instanceof String; }; - var isObject = function isObject(input) { + const isObject = input => { // TODO: refine return Object.prototype.toString.call(input) === '[object Object]'; }; - var isDateObject = function isDateObject(input) { - return _typeof(input) === 'object' && input instanceof Date; + const isDateObject = input => { + return typeof input === 'object' && input instanceof Date; }; - var isObjectEmpty = function isObjectEmpty(obj) { - for (var prop in obj) { + const isObjectEmpty = obj => { + for (const prop in obj) { if (obj.hasOwnProperty(prop)) { return false; } @@ -561,26 +227,26 @@ return true; }; - var isConvertibleToNumber = function isConvertibleToNumber(n) { + const isConvertibleToNumber = n => { return !isNaN(parseFloat(n)) && isFinite(n); }; - var isNumber = function isNumber(n) { + const isNumber = n => { return /^-?[\d.]+(?:e-?\d+)?$/.test(n) && typeof n === 'number'; }; - var isValueValid = function isValueValid(value) { + const isValueValid = value => { if (value === null || value === undefined || value === 'undefined') { return false; } return true; }; - var removeUnsupportedChars = function removeUnsupportedChars(o, logger) { + const removeUnsupportedChars = (o, logger) => { // keys can't be greater than 1024 chars, values can't be greater than 1024 chars - if (_typeof(o) === 'object') { - for (var key in o) { + if (typeof o === 'object') { + for (const key in o) { if (o.hasOwnProperty(key)) { - var sanitizedVal = removeUnsupportedChars(o[key], logger); - var sanitizedKey = void 0; + const sanitizedVal = removeUnsupportedChars(o[key], logger); + let sanitizedKey; sanitizedKey = sanitize(key, unsupportedKeyCharRegex); if (sanitizedKey.length > 1024) { @@ -593,7 +259,7 @@ } } } else { - var val; + let val; if (isString(o)) { val = sanitize(o, unsupportedValueCharRegex); @@ -611,324 +277,301 @@ return o; }; - var sanitize = function sanitize(input, regex) { + const sanitize = (input, regex) => { return input.replace(regex, ''); }; - var getToday = function getToday() { - var today = new Date(); + const getToday = () => { + const today = new Date(); return today.getFullYear() + '' + today.getMonth() + '' + today.getDay(); }; - var getNow = function getNow() { + const getNow = () => { return Math.floor(new Date().getTime() / 1000); }; - var convertToWZRKDate = function convertToWZRKDate(dateObj) { + const convertToWZRKDate = dateObj => { return '$D_' + Math.round(dateObj.getTime() / 1000); }; - var setDate = function setDate(dt) { + const setDate = dt => { // expecting yyyymmdd format either as a number or a string if (isDateValid(dt)) { return '$D_' + dt; } }; - var isDateValid = function isDateValid(date) { - var matches = /^(\d{4})(\d{2})(\d{2})$/.exec(date); + const isDateValid = date => { + const matches = /^(\d{4})(\d{2})(\d{2})$/.exec(date); if (matches == null) return false; - var d = matches[3]; - var m = matches[2] - 1; - var y = matches[1]; - var composedDate = new Date(y, m, d); // eslint-disable-next-line eqeqeq + const d = matches[3]; + const m = matches[2] - 1; + const y = matches[1]; + const composedDate = new Date(y, m, d); // eslint-disable-next-line eqeqeq return composedDate.getDate() == d && composedDate.getMonth() == m && composedDate.getFullYear() == y; }; - var StorageManager = /*#__PURE__*/function () { - function StorageManager() { - _classCallCheck(this, StorageManager); - } + class StorageManager { + static save(key, value) { + if (!key || !value) { + return false; + } - _createClass(StorageManager, null, [{ - key: "save", - value: function save(key, value) { - if (!key || !value) { - return false; - } + if (this._isLocalStorageSupported()) { + localStorage.setItem(key, typeof value === 'string' ? value : JSON.stringify(value)); + return true; + } + } - if (this._isLocalStorageSupported()) { - localStorage.setItem(key, typeof value === 'string' ? value : JSON.stringify(value)); - return true; - } + static read(key) { + if (!key) { + return false; } - }, { - key: "read", - value: function read(key) { - if (!key) { - return false; - } - var data = null; + let data = null; - if (this._isLocalStorageSupported()) { - data = localStorage.getItem(key); - } + if (this._isLocalStorageSupported()) { + data = localStorage.getItem(key); + } - if (data != null) { - try { - data = JSON.parse(data); - } catch (e) {} - } + if (data != null) { + try { + data = JSON.parse(data); + } catch (e) {} + } - return data; + return data; + } + + static remove(key) { + if (!key) { + return false; } - }, { - key: "remove", - value: function remove(key) { - if (!key) { - return false; - } - if (this._isLocalStorageSupported()) { - localStorage.removeItem(key); - return true; - } + if (this._isLocalStorageSupported()) { + localStorage.removeItem(key); + return true; } - }, { - key: "removeCookie", - value: function removeCookie(name, domain) { - var cookieStr = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;'; + } - if (domain) { - cookieStr = cookieStr + ' domain=' + domain + '; path=/'; - } + static removeCookie(name, domain) { + let cookieStr = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;'; - document.cookie = cookieStr; + if (domain) { + cookieStr = cookieStr + ' domain=' + domain + '; path=/'; } - }, { - key: "createCookie", - value: function createCookie(name, value, seconds, domain) { - var expires = ''; - var domainStr = ''; - if (seconds) { - var date = new Date(); - date.setTime(date.getTime() + seconds * 1000); - expires = '; expires=' + date.toGMTString(); - } + document.cookie = cookieStr; + } - if (domain) { - domainStr = '; domain=' + domain; - } + static createCookie(name, value, seconds, domain) { + let expires = ''; + let domainStr = ''; + + if (seconds) { + const date = new Date(); + date.setTime(date.getTime() + seconds * 1000); + expires = '; expires=' + date.toGMTString(); + } - value = encodeURIComponent(value); - document.cookie = name + '=' + value + expires + domainStr + '; path=/'; + if (domain) { + domainStr = '; domain=' + domain; } - }, { - key: "readCookie", - value: function readCookie(name) { - var nameEQ = name + '='; - var ca = document.cookie.split(';'); - for (var idx = 0; idx < ca.length; idx++) { - var c = ca[idx]; + value = encodeURIComponent(value); + document.cookie = name + '=' + value + expires + domainStr + '; path=/'; + } - while (c.charAt(0) === ' ') { - c = c.substring(1, c.length); - } // eslint-disable-next-line eqeqeq + static readCookie(name) { + const nameEQ = name + '='; + const ca = document.cookie.split(';'); + for (let idx = 0; idx < ca.length; idx++) { + let c = ca[idx]; - if (c.indexOf(nameEQ) == 0) { - return decodeURIComponent(c.substring(nameEQ.length, c.length)); - } - } + while (c.charAt(0) === ' ') { + c = c.substring(1, c.length); + } // eslint-disable-next-line eqeqeq - return null; + + if (c.indexOf(nameEQ) == 0) { + return decodeURIComponent(c.substring(nameEQ.length, c.length)); + } } - }, { - key: "_isLocalStorageSupported", - value: function _isLocalStorageSupported() { - return 'localStorage' in window && window.localStorage !== null && typeof window.localStorage.setItem === 'function'; + + return null; + } + + static _isLocalStorageSupported() { + return 'localStorage' in window && window.localStorage !== null && typeof window.localStorage.setItem === 'function'; + } + + static saveToLSorCookie(property, value) { + if (value == null) { + return; } - }, { - key: "saveToLSorCookie", - value: function saveToLSorCookie(property, value) { - if (value == null) { - return; - } - try { - if (this._isLocalStorageSupported()) { - this.save(property, encodeURIComponent(JSON.stringify(value))); + try { + if (this._isLocalStorageSupported()) { + this.save(property, encodeURIComponent(JSON.stringify(value))); + } else { + if (property === GCOOKIE_NAME) { + this.createCookie(property, encodeURIComponent(value), 0, window.location.hostname); } else { - if (property === GCOOKIE_NAME) { - this.createCookie(property, encodeURIComponent(value), 0, window.location.hostname); - } else { - this.createCookie(property, encodeURIComponent(JSON.stringify(value)), 0, window.location.hostname); - } + this.createCookie(property, encodeURIComponent(JSON.stringify(value)), 0, window.location.hostname); } + } - $ct.globalCache[property] = value; - } catch (e) {} + $ct.globalCache[property] = value; + } catch (e) {} + } + + static readFromLSorCookie(property) { + let data; + + if ($ct.globalCache.hasOwnProperty(property)) { + return $ct.globalCache[property]; } - }, { - key: "readFromLSorCookie", - value: function readFromLSorCookie(property) { - var data; - if ($ct.globalCache.hasOwnProperty(property)) { - return $ct.globalCache[property]; - } + if (this._isLocalStorageSupported()) { + data = this.read(property); + } else { + data = this.readCookie(property); + } - if (this._isLocalStorageSupported()) { - data = this.read(property); - } else { - data = this.readCookie(property); - } + if (data !== null && data !== undefined && !(typeof data.trim === 'function' && data.trim() === '')) { + let value; - if (data !== null && data !== undefined && !(typeof data.trim === 'function' && data.trim() === '')) { - var value; + try { + value = JSON.parse(decodeURIComponent(data)); + } catch (err) { + value = decodeURIComponent(data); + } - try { - value = JSON.parse(decodeURIComponent(data)); - } catch (err) { - value = decodeURIComponent(data); - } + $ct.globalCache[property] = value; + return value; + } + } - $ct.globalCache[property] = value; - return value; - } - } - }, { - key: "createBroadCookie", - value: function createBroadCookie(name, value, seconds, domain) { - // sets cookie on the base domain. e.g. if domain is baz.foo.bar.com, set cookie on ".bar.com" - // To update an existing "broad domain" cookie, we need to know what domain it was actually set on. - // since a retrieved cookie never tells which domain it was set on, we need to set another test cookie - // to find out which "broadest" domain the cookie was set on. Then delete the test cookie, and use that domain - // for updating the actual cookie. - if (domain) { - var broadDomain = $ct.broadDomain; - - if (broadDomain == null) { - // if we don't know the broadDomain yet, then find out - var domainParts = domain.split('.'); - var testBroadDomain = ''; - - for (var idx = domainParts.length - 1; idx >= 0; idx--) { - if (idx === 0) { - testBroadDomain = domainParts[idx] + testBroadDomain; - } else { - testBroadDomain = '.' + domainParts[idx] + testBroadDomain; - } // only needed if the cookie already exists and needs to be updated. See note above. + static createBroadCookie(name, value, seconds, domain) { + // sets cookie on the base domain. e.g. if domain is baz.foo.bar.com, set cookie on ".bar.com" + // To update an existing "broad domain" cookie, we need to know what domain it was actually set on. + // since a retrieved cookie never tells which domain it was set on, we need to set another test cookie + // to find out which "broadest" domain the cookie was set on. Then delete the test cookie, and use that domain + // for updating the actual cookie. + if (domain) { + let broadDomain = $ct.broadDomain; + + if (broadDomain == null) { + // if we don't know the broadDomain yet, then find out + const domainParts = domain.split('.'); + let testBroadDomain = ''; + + for (let idx = domainParts.length - 1; idx >= 0; idx--) { + if (idx === 0) { + testBroadDomain = domainParts[idx] + testBroadDomain; + } else { + testBroadDomain = '.' + domainParts[idx] + testBroadDomain; + } // only needed if the cookie already exists and needs to be updated. See note above. - if (this.readCookie(name)) { - // no guarantee that browser will delete cookie, hence create short lived cookies - var testCookieName = 'test_' + name + idx; - this.createCookie(testCookieName, value, 10, testBroadDomain); // self-destruct after 10 seconds + if (this.readCookie(name)) { + // no guarantee that browser will delete cookie, hence create short lived cookies + var testCookieName = 'test_' + name + idx; + this.createCookie(testCookieName, value, 10, testBroadDomain); // self-destruct after 10 seconds - if (!this.readCookie(testCookieName)) { - // if test cookie not set, then the actual cookie wouldn't have been set on this domain either. - continue; - } else { - // else if cookie set, then delete the test and the original cookie - this.removeCookie(testCookieName, testBroadDomain); - } + if (!this.readCookie(testCookieName)) { + // if test cookie not set, then the actual cookie wouldn't have been set on this domain either. + continue; + } else { + // else if cookie set, then delete the test and the original cookie + this.removeCookie(testCookieName, testBroadDomain); } + } - this.createCookie(name, value, seconds, testBroadDomain); - var tempCookie = this.readCookie(name); // eslint-disable-next-line eqeqeq + this.createCookie(name, value, seconds, testBroadDomain); + const tempCookie = this.readCookie(name); // eslint-disable-next-line eqeqeq - if (tempCookie == value) { - broadDomain = testBroadDomain; - $ct.broadDomain = broadDomain; - break; - } + if (tempCookie == value) { + broadDomain = testBroadDomain; + $ct.broadDomain = broadDomain; + break; } - } else { - this.createCookie(name, value, seconds, broadDomain); } } else { - this.createCookie(name, value, seconds, domain); + this.createCookie(name, value, seconds, broadDomain); } + } else { + this.createCookie(name, value, seconds, domain); } - }, { - key: "getMetaProp", - value: function getMetaProp(property) { - var metaObj = this.readFromLSorCookie(META_COOKIE); + } - if (metaObj != null) { - return metaObj[property]; - } + static getMetaProp(property) { + const metaObj = this.readFromLSorCookie(META_COOKIE); + + if (metaObj != null) { + return metaObj[property]; } - }, { - key: "setMetaProp", - value: function setMetaProp(property, value) { - if (this._isLocalStorageSupported()) { - var wzrkMetaObj = this.readFromLSorCookie(META_COOKIE); + } - if (wzrkMetaObj == null) { - wzrkMetaObj = {}; - } + static setMetaProp(property, value) { + if (this._isLocalStorageSupported()) { + let wzrkMetaObj = this.readFromLSorCookie(META_COOKIE); - if (value === undefined) { - delete wzrkMetaObj[property]; - } else { - wzrkMetaObj[property] = value; - } + if (wzrkMetaObj == null) { + wzrkMetaObj = {}; + } - this.saveToLSorCookie(META_COOKIE, wzrkMetaObj); + if (value === undefined) { + delete wzrkMetaObj[property]; + } else { + wzrkMetaObj[property] = value; } + + this.saveToLSorCookie(META_COOKIE, wzrkMetaObj); } - }, { - key: "getAndClearMetaProp", - value: function getAndClearMetaProp(property) { - var value = this.getMetaProp(property); - this.setMetaProp(property, undefined); - return value; - } - }, { - key: "setInstantDeleteFlagInK", - value: function setInstantDeleteFlagInK() { - var k = this.readFromLSorCookie(KCOOKIE_NAME); + } - if (k == null) { - k = {}; - } + static getAndClearMetaProp(property) { + const value = this.getMetaProp(property); + this.setMetaProp(property, undefined); + return value; + } + + static setInstantDeleteFlagInK() { + let k = this.readFromLSorCookie(KCOOKIE_NAME); - k.flag = true; - this.saveToLSorCookie(KCOOKIE_NAME, k); + if (k == null) { + k = {}; } - }, { - key: "backupEvent", - value: function backupEvent(data, reqNo, logger) { - var backupArr = this.readFromLSorCookie(LCOOKIE_NAME); - if (typeof backupArr === 'undefined') { - backupArr = {}; - } + k.flag = true; + this.saveToLSorCookie(KCOOKIE_NAME, k); + } - backupArr[reqNo] = { - q: data - }; - this.saveToLSorCookie(LCOOKIE_NAME, backupArr); - logger.debug("stored in ".concat(LCOOKIE_NAME, " reqNo : ").concat(reqNo, " -> ").concat(data)); + static backupEvent(data, reqNo, logger) { + let backupArr = this.readFromLSorCookie(LCOOKIE_NAME); + + if (typeof backupArr === 'undefined') { + backupArr = {}; } - }, { - key: "removeBackup", - value: function removeBackup(respNo, logger) { - var backupMap = this.readFromLSorCookie(LCOOKIE_NAME); - if (typeof backupMap !== 'undefined' && backupMap !== null && typeof backupMap[respNo] !== 'undefined') { - logger.debug("del event: ".concat(respNo, " data-> ").concat(backupMap[respNo].q)); - delete backupMap[respNo]; - this.saveToLSorCookie(LCOOKIE_NAME, backupMap); - } + backupArr[reqNo] = { + q: data + }; + this.saveToLSorCookie(LCOOKIE_NAME, backupArr); + logger.debug("stored in ".concat(LCOOKIE_NAME, " reqNo : ").concat(reqNo, " -> ").concat(data)); + } + + static removeBackup(respNo, logger) { + const backupMap = this.readFromLSorCookie(LCOOKIE_NAME); + + if (typeof backupMap !== 'undefined' && backupMap !== null && typeof backupMap[respNo] !== 'undefined') { + logger.debug("del event: ".concat(respNo, " data-> ").concat(backupMap[respNo].q)); + delete backupMap[respNo]; + this.saveToLSorCookie(LCOOKIE_NAME, backupMap); } - }]); + } - return StorageManager; - }(); - var $ct = { + } + const $ct = { globalCache: { gcookie: null, REQ_N: 0, @@ -968,10 +611,8 @@ var _deleteFromObject = _classPrivateFieldLooseKey("deleteFromObject"); - var LRUCache = /*#__PURE__*/function () { - function LRUCache(max) { - _classCallCheck(this, LRUCache); - + class LRUCache { + constructor(max) { Object.defineProperty(this, _deleteFromObject, { value: _deleteFromObject2 }); @@ -980,14 +621,14 @@ value: void 0 }); this.max = max; - var lruCache = StorageManager.readFromLSorCookie(LRU_CACHE); + let lruCache = StorageManager.readFromLSorCookie(LRU_CACHE); if (lruCache) { - var tempLruCache = {}; + const tempLruCache = {}; _classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder] = []; lruCache = lruCache.cache; - for (var entry in lruCache) { + for (const entry in lruCache) { if (lruCache.hasOwnProperty(entry)) { tempLruCache[lruCache[entry][0]] = lruCache[entry][1]; @@ -1002,112 +643,103 @@ } } - _createClass(LRUCache, [{ - key: "get", - value: function get(key) { - var item = this.cache[key]; + get(key) { + const item = this.cache[key]; - if (item) { - this.cache = _classPrivateFieldLooseBase(this, _deleteFromObject)[_deleteFromObject](key, this.cache); - this.cache[key] = item; - - _classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder].push(key); - } + if (item) { + this.cache = _classPrivateFieldLooseBase(this, _deleteFromObject)[_deleteFromObject](key, this.cache); + this.cache[key] = item; - this.saveCacheToLS(this.cache); - return item; + _classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder].push(key); } - }, { - key: "set", - value: function set(key, value) { - var item = this.cache[key]; - var allKeys = _classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder]; + this.saveCacheToLS(this.cache); + return item; + } - if (item != null) { - this.cache = _classPrivateFieldLooseBase(this, _deleteFromObject)[_deleteFromObject](key, this.cache); - } else if (allKeys.length === this.max) { - this.cache = _classPrivateFieldLooseBase(this, _deleteFromObject)[_deleteFromObject](allKeys[0], this.cache); - } + set(key, value) { + const item = this.cache[key]; - this.cache[key] = value; + const allKeys = _classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder]; - if (_classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder][_classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder] - 1] !== key) { - _classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder].push(key); - } + if (item != null) { + this.cache = _classPrivateFieldLooseBase(this, _deleteFromObject)[_deleteFromObject](key, this.cache); + } else if (allKeys.length === this.max) { + this.cache = _classPrivateFieldLooseBase(this, _deleteFromObject)[_deleteFromObject](allKeys[0], this.cache); + } + + this.cache[key] = value; - this.saveCacheToLS(this.cache); + if (_classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder][_classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder] - 1] !== key) { + _classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder].push(key); } - }, { - key: "saveCacheToLS", - value: function saveCacheToLS(cache) { - var objToArray = []; - var allKeys = _classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder]; + this.saveCacheToLS(this.cache); + } - for (var index in allKeys) { - if (allKeys.hasOwnProperty(index)) { - var temp = []; - temp.push(allKeys[index]); - temp.push(cache[allKeys[index]]); - objToArray.push(temp); - } + saveCacheToLS(cache) { + const objToArray = []; + + const allKeys = _classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder]; + + for (const index in allKeys) { + if (allKeys.hasOwnProperty(index)) { + const temp = []; + temp.push(allKeys[index]); + temp.push(cache[allKeys[index]]); + objToArray.push(temp); } + } - StorageManager.saveToLSorCookie(LRU_CACHE, { - cache: objToArray - }); + StorageManager.saveToLSorCookie(LRU_CACHE, { + cache: objToArray + }); + } + + getKey(value) { + if (value === null) { + return null; } - }, { - key: "getKey", - value: function getKey(value) { - if (value === null) { - return null; - } - var allKeys = _classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder]; + const allKeys = _classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder]; - for (var index in allKeys) { - if (allKeys.hasOwnProperty(index)) { - if (this.cache[allKeys[index]] === value) { - return allKeys[index]; - } + for (const index in allKeys) { + if (allKeys.hasOwnProperty(index)) { + if (this.cache[allKeys[index]] === value) { + return allKeys[index]; } } - - return null; } - }, { - key: "getSecondLastKey", - value: function getSecondLastKey() { - var keysArr = _classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder]; - if (keysArr != null && keysArr.length > 1) { - return keysArr[keysArr.length - 2]; - } + return null; + } - return -1; + getSecondLastKey() { + const keysArr = _classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder]; + + if (keysArr != null && keysArr.length > 1) { + return keysArr[keysArr.length - 2]; } - }, { - key: "getLastKey", - value: function getLastKey() { - var keysLength = _classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder].length; - if (keysLength) { - return _classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder][keysLength - 1]; - } + return -1; + } + + getLastKey() { + const keysLength = _classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder].length; + + if (keysLength) { + return _classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder][keysLength - 1]; } - }]); + } - return LRUCache; - }(); + } var _deleteFromObject2 = function _deleteFromObject2(key, obj) { - var allKeys = JSON.parse(JSON.stringify(_classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder])); - var newCache = {}; - var indexToDelete; + const allKeys = JSON.parse(JSON.stringify(_classPrivateFieldLooseBase(this, _keyOrder)[_keyOrder])); + const newCache = {}; + let indexToDelete; - for (var index in allKeys) { + for (const index in allKeys) { if (allKeys.hasOwnProperty(index)) { if (allKeys[index] !== key) { newCache[allKeys[index]] = obj[allKeys[index]]; @@ -1130,15 +762,14 @@ var _session = _classPrivateFieldLooseKey("session"); - var CleverTapAPI = /*#__PURE__*/function () { - function CleverTapAPI(_ref) { - var logger = _ref.logger, - request = _ref.request, - device = _ref.device, - session = _ref.session; - - _classCallCheck(this, CleverTapAPI); - + class CleverTapAPI { + constructor(_ref) { + let { + logger, + request, + device, + session + } = _ref; Object.defineProperty(this, _logger, { writable: true, value: void 0 @@ -1171,137 +802,132 @@ */ - _createClass(CleverTapAPI, [{ - key: "s", - value: function s(global, session, resume, respNumber, optOutResponse) { - var oulReq = false; - var newGuid = false; // for a scenario when OUL request is true from client side - // but resume is returned as false from server end - // we maintan a OulReqN var in the window object - // and compare with respNumber to determine the response of an OUL request + s(global, session, resume, respNumber, optOutResponse) { + let oulReq = false; + let newGuid = false; // for a scenario when OUL request is true from client side + // but resume is returned as false from server end + // we maintan a OulReqN var in the window object + // and compare with respNumber to determine the response of an OUL request - if (window.isOULInProgress) { - if (resume || respNumber !== 'undefined' && respNumber === window.oulReqN) { - window.isOULInProgress = false; - oulReq = true; - } - } // call back function used to store global and session ids for the user + if (window.isOULInProgress) { + if (resume || respNumber !== 'undefined' && respNumber === window.oulReqN) { + window.isOULInProgress = false; + oulReq = true; + } + } // call back function used to store global and session ids for the user - if (typeof respNumber === 'undefined') { - respNumber = 0; - } + if (typeof respNumber === 'undefined') { + respNumber = 0; + } - StorageManager.removeBackup(respNumber, _classPrivateFieldLooseBase(this, _logger)[_logger]); + StorageManager.removeBackup(respNumber, _classPrivateFieldLooseBase(this, _logger)[_logger]); - if (respNumber > $ct.globalCache.REQ_N) { - // request for some other user so ignore - return; - } + if (respNumber > $ct.globalCache.REQ_N) { + // request for some other user so ignore + return; + } - if (!isValueValid(_classPrivateFieldLooseBase(this, _device)[_device].gcookie)) { - if (global) { - newGuid = true; - } + if (!isValueValid(_classPrivateFieldLooseBase(this, _device)[_device].gcookie)) { + if (global) { + newGuid = true; } + } - if (!isValueValid(_classPrivateFieldLooseBase(this, _device)[_device].gcookie) || resume || typeof optOutResponse === 'boolean') { - var sessionObj = _classPrivateFieldLooseBase(this, _session)[_session].getSessionCookieObject(); - /* If the received session is less than the session in the cookie, - then don't update guid as it will be response for old request - */ + if (!isValueValid(_classPrivateFieldLooseBase(this, _device)[_device].gcookie) || resume || typeof optOutResponse === 'boolean') { + const sessionObj = _classPrivateFieldLooseBase(this, _session)[_session].getSessionCookieObject(); + /* If the received session is less than the session in the cookie, + then don't update guid as it will be response for old request + */ - if (window.isOULInProgress || sessionObj.s && session < sessionObj.s) { - return; - } + if (window.isOULInProgress || sessionObj.s && session < sessionObj.s) { + return; + } - _classPrivateFieldLooseBase(this, _logger)[_logger].debug("Cookie was ".concat(_classPrivateFieldLooseBase(this, _device)[_device].gcookie, " set to ").concat(global)); + _classPrivateFieldLooseBase(this, _logger)[_logger].debug("Cookie was ".concat(_classPrivateFieldLooseBase(this, _device)[_device].gcookie, " set to ").concat(global)); - _classPrivateFieldLooseBase(this, _device)[_device].gcookie = global; + _classPrivateFieldLooseBase(this, _device)[_device].gcookie = global; - if (!isValueValid(_classPrivateFieldLooseBase(this, _device)[_device].gcookie)) { - // clear useIP meta prop - StorageManager.getAndClearMetaProp(USEIP_KEY); - } + if (!isValueValid(_classPrivateFieldLooseBase(this, _device)[_device].gcookie)) { + // clear useIP meta prop + StorageManager.getAndClearMetaProp(USEIP_KEY); + } - if (global && StorageManager._isLocalStorageSupported()) { - if ($ct.LRU_CACHE == null) { - $ct.LRU_CACHE = new LRUCache(LRU_CACHE_SIZE); - } + if (global && StorageManager._isLocalStorageSupported()) { + if ($ct.LRU_CACHE == null) { + $ct.LRU_CACHE = new LRUCache(LRU_CACHE_SIZE); + } - var kIdFromLS = StorageManager.readFromLSorCookie(KCOOKIE_NAME); - var guidFromLRUCache; + const kIdFromLS = StorageManager.readFromLSorCookie(KCOOKIE_NAME); + let guidFromLRUCache; - if (kIdFromLS != null && kIdFromLS.id) { - guidFromLRUCache = $ct.LRU_CACHE.cache[kIdFromLS.id]; + if (kIdFromLS != null && kIdFromLS.id) { + guidFromLRUCache = $ct.LRU_CACHE.cache[kIdFromLS.id]; - if (resume) { - if (!guidFromLRUCache) { - StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, true); // replace login identity in OUL request - // with the gcookie returned in exchange + if (resume) { + if (!guidFromLRUCache) { + StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, true); // replace login identity in OUL request + // with the gcookie returned in exchange - $ct.LRU_CACHE.set(kIdFromLS.id, global); - } + $ct.LRU_CACHE.set(kIdFromLS.id, global); } } + } - StorageManager.saveToLSorCookie(GCOOKIE_NAME, global); // lastk provides the guid + StorageManager.saveToLSorCookie(GCOOKIE_NAME, global); // lastk provides the guid - var lastK = $ct.LRU_CACHE.getSecondLastKey(); + const lastK = $ct.LRU_CACHE.getSecondLastKey(); - if (StorageManager.readFromLSorCookie(FIRE_PUSH_UNREGISTERED) && lastK !== -1) { - var lastGUID = $ct.LRU_CACHE.cache[lastK]; // fire the request directly via fireRequest to unregister the token - // then other requests with the updated guid should follow + if (StorageManager.readFromLSorCookie(FIRE_PUSH_UNREGISTERED) && lastK !== -1) { + const lastGUID = $ct.LRU_CACHE.cache[lastK]; // fire the request directly via fireRequest to unregister the token + // then other requests with the updated guid should follow - _classPrivateFieldLooseBase(this, _request)[_request].unregisterTokenForGuid(lastGUID); - } + _classPrivateFieldLooseBase(this, _request)[_request].unregisterTokenForGuid(lastGUID); } - - StorageManager.createBroadCookie(GCOOKIE_NAME, global, COOKIE_EXPIRY, window.location.hostname); - StorageManager.saveToLSorCookie(GCOOKIE_NAME, global); } - if (StorageManager._isLocalStorageSupported()) { - _classPrivateFieldLooseBase(this, _session)[_session].manageSession(session); - } // session cookie + StorageManager.createBroadCookie(GCOOKIE_NAME, global, COOKIE_EXPIRY, window.location.hostname); + StorageManager.saveToLSorCookie(GCOOKIE_NAME, global); + } + if (StorageManager._isLocalStorageSupported()) { + _classPrivateFieldLooseBase(this, _session)[_session].manageSession(session); + } // session cookie - var obj = _classPrivateFieldLooseBase(this, _session)[_session].getSessionCookieObject(); // for the race-condition where two responses come back with different session ids. don't write the older session id. + const obj = _classPrivateFieldLooseBase(this, _session)[_session].getSessionCookieObject(); // for the race-condition where two responses come back with different session ids. don't write the older session id. - if (typeof obj.s === 'undefined' || obj.s <= session) { - obj.s = session; - obj.t = getNow(); // time of last response from server - _classPrivateFieldLooseBase(this, _session)[_session].setSessionCookieObject(obj); - } // set blockRequest to false only if the device has a valid gcookie + if (typeof obj.s === 'undefined' || obj.s <= session) { + obj.s = session; + obj.t = getNow(); // time of last response from server + _classPrivateFieldLooseBase(this, _session)[_session].setSessionCookieObject(obj); + } // set blockRequest to false only if the device has a valid gcookie - if (isValueValid(_classPrivateFieldLooseBase(this, _device)[_device].gcookie)) { - $ct.blockRequest = false; - } // only process the backup events after an OUL request or a new guid is recieved + if (isValueValid(_classPrivateFieldLooseBase(this, _device)[_device].gcookie)) { + $ct.blockRequest = false; + } // only process the backup events after an OUL request or a new guid is recieved - if ((oulReq || newGuid) && !_classPrivateFieldLooseBase(this, _request)[_request].processingBackup) { - _classPrivateFieldLooseBase(this, _request)[_request].processBackupEvents(); - } - $ct.globalCache.RESP_N = respNumber; + if ((oulReq || newGuid) && !_classPrivateFieldLooseBase(this, _request)[_request].processingBackup) { + _classPrivateFieldLooseBase(this, _request)[_request].processBackupEvents(); } - }]); - - return CleverTapAPI; - }(); - var _logger$1 = _classPrivateFieldLooseKey("logger"); + $ct.globalCache.RESP_N = respNumber; + } - var DeviceManager = /*#__PURE__*/function () { - function DeviceManager(_ref) { - var logger = _ref.logger; + } - _classCallCheck(this, DeviceManager); + var _logger$1 = _classPrivateFieldLooseKey("logger"); + class DeviceManager { + constructor(_ref) { + let { + logger + } = _ref; Object.defineProperty(this, _logger$1, { writable: true, value: void 0 @@ -1311,79 +937,75 @@ this.gcookie = this.getGuid(); } - _createClass(DeviceManager, [{ - key: "getGuid", - value: function getGuid() { - var guid = null; + getGuid() { + let guid = null; - if (isValueValid(this.gcookie)) { - return this.gcookie; - } + if (isValueValid(this.gcookie)) { + return this.gcookie; + } - if (StorageManager._isLocalStorageSupported()) { - var value = StorageManager.read(GCOOKIE_NAME); + if (StorageManager._isLocalStorageSupported()) { + const value = StorageManager.read(GCOOKIE_NAME); - if (isValueValid(value)) { - try { - guid = JSON.parse(decodeURIComponent(value)); - } catch (e) { - _classPrivateFieldLooseBase(this, _logger$1)[_logger$1].debug('Cannot parse Gcookie from localstorage - must be encoded ' + value); // assumming guids are of size 32. supporting both formats. - // guid can have encodedURIComponent or be without it. - // 1.56e4078ed15749928c042479ec2b4d47 - breaks on JSON.parse(decodeURIComponent()) - // 2.%2256e4078ed15749928c042479ec2b4d47%22 + if (isValueValid(value)) { + try { + guid = JSON.parse(decodeURIComponent(value)); + } catch (e) { + _classPrivateFieldLooseBase(this, _logger$1)[_logger$1].debug('Cannot parse Gcookie from localstorage - must be encoded ' + value); // assumming guids are of size 32. supporting both formats. + // guid can have encodedURIComponent or be without it. + // 1.56e4078ed15749928c042479ec2b4d47 - breaks on JSON.parse(decodeURIComponent()) + // 2.%2256e4078ed15749928c042479ec2b4d47%22 - if (value.length === 32) { - guid = value; - StorageManager.saveToLSorCookie(GCOOKIE_NAME, value); - } else { - _classPrivateFieldLooseBase(this, _logger$1)[_logger$1].error('Illegal guid ' + value); - } - } // Persist to cookie storage if not present there. + if (value.length === 32) { + guid = value; + StorageManager.saveToLSorCookie(GCOOKIE_NAME, value); + } else { + _classPrivateFieldLooseBase(this, _logger$1)[_logger$1].error('Illegal guid ' + value); + } + } // Persist to cookie storage if not present there. - if (isValueValid(guid)) { - StorageManager.createBroadCookie(GCOOKIE_NAME, guid, COOKIE_EXPIRY, window.location.hostname); - } + if (isValueValid(guid)) { + StorageManager.createBroadCookie(GCOOKIE_NAME, guid, COOKIE_EXPIRY, window.location.hostname); } } + } - if (!isValueValid(guid)) { - guid = StorageManager.readCookie(GCOOKIE_NAME); - - if (isValueValid(guid) && (guid.indexOf('%') === 0 || guid.indexOf('\'') === 0 || guid.indexOf('"') === 0)) { - guid = null; - } + if (!isValueValid(guid)) { + guid = StorageManager.readCookie(GCOOKIE_NAME); - if (isValueValid(guid)) { - StorageManager.saveToLSorCookie(GCOOKIE_NAME, guid); - } + if (isValueValid(guid) && (guid.indexOf('%') === 0 || guid.indexOf('\'') === 0 || guid.indexOf('"') === 0)) { + guid = null; } - return guid; + if (isValueValid(guid)) { + StorageManager.saveToLSorCookie(GCOOKIE_NAME, guid); + } } - }]); - return DeviceManager; - }(); + return guid; + } + + } - var DATA_NOT_SENT_TEXT = 'This property has been ignored.'; - var CLEVERTAP_ERROR_PREFIX = 'CleverTap error:'; // Formerly wzrk_error_txt + const DATA_NOT_SENT_TEXT = 'This property has been ignored.'; + const CLEVERTAP_ERROR_PREFIX = 'CleverTap error:'; // Formerly wzrk_error_txt - var EMBED_ERROR = "".concat(CLEVERTAP_ERROR_PREFIX, " Incorrect embed script."); - var EVENT_ERROR = "".concat(CLEVERTAP_ERROR_PREFIX, " Event structure not valid. ").concat(DATA_NOT_SENT_TEXT); - var GENDER_ERROR = "".concat(CLEVERTAP_ERROR_PREFIX, " Gender value should be either M or F. ").concat(DATA_NOT_SENT_TEXT); - var EMPLOYED_ERROR = "".concat(CLEVERTAP_ERROR_PREFIX, " Employed value should be either Y or N. ").concat(DATA_NOT_SENT_TEXT); - var MARRIED_ERROR = "".concat(CLEVERTAP_ERROR_PREFIX, " Married value should be either Y or N. ").concat(DATA_NOT_SENT_TEXT); - var EDUCATION_ERROR = "".concat(CLEVERTAP_ERROR_PREFIX, " Education value should be either School, College or Graduate. ").concat(DATA_NOT_SENT_TEXT); - var AGE_ERROR = "".concat(CLEVERTAP_ERROR_PREFIX, " Age value should be a number. ").concat(DATA_NOT_SENT_TEXT); - var DOB_ERROR = "".concat(CLEVERTAP_ERROR_PREFIX, " DOB value should be a Date Object"); - var ENUM_FORMAT_ERROR = "".concat(CLEVERTAP_ERROR_PREFIX, " setEnum(value). value should be a string or a number"); - var PHONE_FORMAT_ERROR = "".concat(CLEVERTAP_ERROR_PREFIX, " Phone number should be formatted as +[country code][number]"); + const EMBED_ERROR = "".concat(CLEVERTAP_ERROR_PREFIX, " Incorrect embed script."); + const EVENT_ERROR = "".concat(CLEVERTAP_ERROR_PREFIX, " Event structure not valid. ").concat(DATA_NOT_SENT_TEXT); + const GENDER_ERROR = "".concat(CLEVERTAP_ERROR_PREFIX, " Gender value should be either M or F. ").concat(DATA_NOT_SENT_TEXT); + const EMPLOYED_ERROR = "".concat(CLEVERTAP_ERROR_PREFIX, " Employed value should be either Y or N. ").concat(DATA_NOT_SENT_TEXT); + const MARRIED_ERROR = "".concat(CLEVERTAP_ERROR_PREFIX, " Married value should be either Y or N. ").concat(DATA_NOT_SENT_TEXT); + const EDUCATION_ERROR = "".concat(CLEVERTAP_ERROR_PREFIX, " Education value should be either School, College or Graduate. ").concat(DATA_NOT_SENT_TEXT); + const AGE_ERROR = "".concat(CLEVERTAP_ERROR_PREFIX, " Age value should be a number. ").concat(DATA_NOT_SENT_TEXT); + const DOB_ERROR = "".concat(CLEVERTAP_ERROR_PREFIX, " DOB value should be a Date Object"); + const ENUM_FORMAT_ERROR = "".concat(CLEVERTAP_ERROR_PREFIX, " setEnum(value). value should be a string or a number"); + const PHONE_FORMAT_ERROR = "".concat(CLEVERTAP_ERROR_PREFIX, " Phone number should be formatted as +[country code][number]"); - var _globalChargedId; + let _globalChargedId; - var isEventStructureFlat = function isEventStructureFlat(eventObj) { + const isEventStructureFlat = eventObj => { // Events cannot have nested structure or Arrays if (isObject(eventObj)) { for (var key in eventObj) { @@ -1401,7 +1023,7 @@ return false; }; - var isChargedEventStructureValid = function isChargedEventStructureValid(chargedObj, logger) { + const isChargedEventStructureValid = (chargedObj, logger) => { if (isObject(chargedObj)) { for (var key in chargedObj) { if (chargedObj.hasOwnProperty(key)) { @@ -1434,7 +1056,7 @@ if (isString(chargedObj[CHARGED_ID]) || isNumber(chargedObj[CHARGED_ID])) { // save charged Id - var chargedId = chargedObj[CHARGED_ID] + ''; // casting chargedId to string + const chargedId = chargedObj[CHARGED_ID] + ''; // casting chargedId to string if (typeof _globalChargedId === 'undefined') { _globalChargedId = StorageManager.readFromLSorCookie(CHARGEDID_COOKIE_NAME); @@ -1467,96 +1089,82 @@ var _processEventArray = _classPrivateFieldLooseKey("processEventArray"); - var EventHandler = /*#__PURE__*/function (_Array) { - _inherits(EventHandler, _Array); - - var _super = _createSuper(EventHandler); - - function EventHandler(_ref, values) { - var _this; - - var logger = _ref.logger, - request = _ref.request, - isPersonalisationActive = _ref.isPersonalisationActive; - - _classCallCheck(this, EventHandler); - - _this = _super.call(this); - Object.defineProperty(_assertThisInitialized(_this), _processEventArray, { + class EventHandler extends Array { + constructor(_ref, values) { + let { + logger, + request, + isPersonalisationActive + } = _ref; + super(); + Object.defineProperty(this, _processEventArray, { value: _processEventArray2 }); - Object.defineProperty(_assertThisInitialized(_this), _logger$2, { + Object.defineProperty(this, _logger$2, { writable: true, value: void 0 }); - Object.defineProperty(_assertThisInitialized(_this), _oldValues, { + Object.defineProperty(this, _oldValues, { writable: true, value: void 0 }); - Object.defineProperty(_assertThisInitialized(_this), _request$1, { + Object.defineProperty(this, _request$1, { writable: true, value: void 0 }); - Object.defineProperty(_assertThisInitialized(_this), _isPersonalisationActive, { + Object.defineProperty(this, _isPersonalisationActive, { writable: true, value: void 0 }); - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _logger$2)[_logger$2] = logger; - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _oldValues)[_oldValues] = values; - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _request$1)[_request$1] = request; - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _isPersonalisationActive)[_isPersonalisationActive] = isPersonalisationActive; - return _this; + _classPrivateFieldLooseBase(this, _logger$2)[_logger$2] = logger; + _classPrivateFieldLooseBase(this, _oldValues)[_oldValues] = values; + _classPrivateFieldLooseBase(this, _request$1)[_request$1] = request; + _classPrivateFieldLooseBase(this, _isPersonalisationActive)[_isPersonalisationActive] = isPersonalisationActive; } - _createClass(EventHandler, [{ - key: "push", - value: function push() { - for (var _len = arguments.length, eventsArr = new Array(_len), _key = 0; _key < _len; _key++) { - eventsArr[_key] = arguments[_key]; - } + push() { + for (var _len = arguments.length, eventsArr = new Array(_len), _key = 0; _key < _len; _key++) { + eventsArr[_key] = arguments[_key]; + } + + _classPrivateFieldLooseBase(this, _processEventArray)[_processEventArray](eventsArr); - _classPrivateFieldLooseBase(this, _processEventArray)[_processEventArray](eventsArr); + return 0; + } - return 0; + _processOldValues() { + if (_classPrivateFieldLooseBase(this, _oldValues)[_oldValues]) { + _classPrivateFieldLooseBase(this, _processEventArray)[_processEventArray](_classPrivateFieldLooseBase(this, _oldValues)[_oldValues]); } - }, { - key: "_processOldValues", - value: function _processOldValues() { - if (_classPrivateFieldLooseBase(this, _oldValues)[_oldValues]) { - _classPrivateFieldLooseBase(this, _processEventArray)[_processEventArray](_classPrivateFieldLooseBase(this, _oldValues)[_oldValues]); - } - _classPrivateFieldLooseBase(this, _oldValues)[_oldValues] = null; + _classPrivateFieldLooseBase(this, _oldValues)[_oldValues] = null; + } + + getDetails(evtName) { + if (!_classPrivateFieldLooseBase(this, _isPersonalisationActive)[_isPersonalisationActive]()) { + return; } - }, { - key: "getDetails", - value: function getDetails(evtName) { - if (!_classPrivateFieldLooseBase(this, _isPersonalisationActive)[_isPersonalisationActive]()) { - return; - } - if (typeof $ct.globalEventsMap === 'undefined') { - $ct.globalEventsMap = StorageManager.readFromLSorCookie(EV_COOKIE); - } + if (typeof $ct.globalEventsMap === 'undefined') { + $ct.globalEventsMap = StorageManager.readFromLSorCookie(EV_COOKIE); + } - if (typeof $ct.globalEventsMap === 'undefined') { - return; - } + if (typeof $ct.globalEventsMap === 'undefined') { + return; + } - var evtObj = $ct.globalEventsMap[evtName]; - var respObj = {}; + const evtObj = $ct.globalEventsMap[evtName]; + const respObj = {}; - if (typeof evtObj !== 'undefined') { - respObj.firstTime = new Date(evtObj[1] * 1000); - respObj.lastTime = new Date(evtObj[2] * 1000); - respObj.count = evtObj[0]; - return respObj; - } + if (typeof evtObj !== 'undefined') { + respObj.firstTime = new Date(evtObj[1] * 1000); + respObj.lastTime = new Date(evtObj[2] * 1000); + respObj.count = evtObj[0]; + return respObj; } - }]); + } - return EventHandler; - }( /*#__PURE__*/_wrapNativeSuper(Array)); + } var _processEventArray2 = function _processEventArray2(eventsArr) { if (Array.isArray(eventsArr)) { @@ -1581,12 +1189,12 @@ continue; } - var data = {}; + const data = {}; data.type = 'event'; data.evtName = sanitize(eventName, unsupportedKeyCharRegex); if (eventsArr.length !== 0) { - var eventObj = eventsArr.shift(); + const eventObj = eventsArr.shift(); if (!isObject(eventObj)) { // put it back if it is not an object @@ -1616,19 +1224,19 @@ } }; - var getURLParams = function getURLParams(url) { - var urlParams = {}; - var idx = url.indexOf('?'); + const getURLParams = url => { + const urlParams = {}; + const idx = url.indexOf('?'); if (idx > 1) { - var uri = url.substring(idx + 1); - var match; - var pl = /\+/g; // Regex for replacing addition symbol with a space + const uri = url.substring(idx + 1); + let match; + const pl = /\+/g; // Regex for replacing addition symbol with a space - var search = /([^&=]+)=?([^&]*)/g; + const search = /([^&=]+)=?([^&]*)/g; - var decode = function decode(s) { - var replacement = s.replace(pl, ' '); + const decode = function (s) { + let replacement = s.replace(pl, ' '); try { replacement = decodeURIComponent(replacement); @@ -1648,39 +1256,39 @@ return urlParams; }; - var getDomain = function getDomain(url) { + const getDomain = url => { if (url === '') return ''; var a = document.createElement('a'); a.href = url; return a.hostname; }; - var addToURL = function addToURL(url, k, v) { + const addToURL = (url, k, v) => { return url + '&' + k + '=' + encodeURIComponent(v); }; - var getHostName = function getHostName() { + const getHostName = () => { return window.location.hostname; }; /* eslint-disable */ - var urlBase64ToUint8Array = function urlBase64ToUint8Array(base64String) { - var padding = '='.repeat((4 - base64String.length % 4) % 4); - var base64 = (base64String + padding).replace(/\-/g, '+').replace(/_/g, '/'); - var rawData = window.atob(base64); - var processedData = []; + const urlBase64ToUint8Array = base64String => { + let padding = '='.repeat((4 - base64String.length % 4) % 4); + let base64 = (base64String + padding).replace(/\-/g, '+').replace(/_/g, '/'); + let rawData = window.atob(base64); + let processedData = []; - for (var i = 0; i < rawData.length; i++) { + for (let i = 0; i < rawData.length; i++) { processedData.push(rawData.charCodeAt(i)); } return new Uint8Array(processedData); }; - var compressData = function compressData(dataObject, logger) { + const compressData = (dataObject, logger) => { logger && typeof logger.debug === 'function' && logger.debug('dobj:' + dataObject); return compressToBase64(dataObject); }; - var compress = function compress(uncompressed) { + const compress = uncompressed => { if (uncompressed == null) return ''; - var i, + let i, value, context_dictionary = {}, context_dictionaryToCreate = {}, @@ -1940,9 +1548,9 @@ return context_data_string; }; - var getKeyStr = function getKeyStr() { - var key = ''; - var i = 0; + const getKeyStr = () => { + let key = ''; + let i = 0; for (i = 0; i <= 25; i++) { key = key + String.fromCharCode(i + 65); @@ -1959,8 +1567,8 @@ return key + '+/='; }; - var _keyStr = getKeyStr(); - var compressToBase64 = function compressToBase64(input) { + const _keyStr = getKeyStr(); + const compressToBase64 = input => { if (input == null) return ''; var output = ''; var chr1, chr2, chr3, enc1, enc2, enc3, enc4; @@ -2007,66 +1615,58 @@ var _addARPToRequest = _classPrivateFieldLooseKey("addARPToRequest"); - var RequestDispatcher = /*#__PURE__*/function () { - function RequestDispatcher() { - _classCallCheck(this, RequestDispatcher); - + class RequestDispatcher { + constructor() { this.networkRetryCount = 0; this.minDelayFrequency = 0; } - _createClass(RequestDispatcher, [{ - key: "getDelayFrequency", - value: function getDelayFrequency() { - this.logger.debug('Network retry #' + this.networkRetryCount); // Retry with delay as 1s for first 10 retries + /** + * + * @param {string} url + * @param {*} skipARP + * @param {boolean} sendOULFlag + */ + static fireRequest(url, skipARP, sendOULFlag, evtName) { + _classPrivateFieldLooseBase(this, _fireRequest)[_fireRequest](url, 1, skipARP, sendOULFlag, evtName); + } - if (this.networkRetryCount < 10) { - this.logger.debug(this.account.id, 'Failure count is ' + this.networkRetryCount + '. Setting delay frequency to 1s'); - this.minDelayFrequency = PUSH_DELAY_MS; // Reset minimum delay to 1s + getDelayFrequency() { + this.logger.debug('Network retry #' + this.networkRetryCount); // Retry with delay as 1s for first 10 retries - return this.minDelayFrequency; - } + if (this.networkRetryCount < 10) { + this.logger.debug(this.account.id, 'Failure count is ' + this.networkRetryCount + '. Setting delay frequency to 1s'); + this.minDelayFrequency = PUSH_DELAY_MS; // Reset minimum delay to 1s - if (this.account.region == null) { - // Retry with delay as 1s if region is null in case of eu1 - this.logger.debug(this.account.id, 'Setting delay frequency to 1s'); - return PUSH_DELAY_MS; - } else { - // Retry with delay as minimum delay frequency and add random number of seconds to scatter traffic - var randomDelay = (Math.floor(Math.random() * 10) + 1) * 1000; - this.minDelayFrequency += randomDelay; + return this.minDelayFrequency; + } - if (this.minDelayFrequency < MAX_DELAY_FREQUENCY) { - this.logger.debug(this.account.id, 'Setting delay frequency to ' + this.minDelayFrequency); - return this.minDelayFrequency; - } else { - this.minDelayFrequency = PUSH_DELAY_MS; - } + if (this.account.region == null) { + // Retry with delay as 1s if region is null in case of eu1 + this.logger.debug(this.account.id, 'Setting delay frequency to 1s'); + return PUSH_DELAY_MS; + } else { + // Retry with delay as minimum delay frequency and add random number of seconds to scatter traffic + const randomDelay = (Math.floor(Math.random() * 10) + 1) * 1000; + this.minDelayFrequency += randomDelay; + if (this.minDelayFrequency < MAX_DELAY_FREQUENCY) { this.logger.debug(this.account.id, 'Setting delay frequency to ' + this.minDelayFrequency); return this.minDelayFrequency; + } else { + this.minDelayFrequency = PUSH_DELAY_MS; } - } - }], [{ - key: "fireRequest", - /** - * - * @param {string} url - * @param {*} skipARP - * @param {boolean} sendOULFlag - */ - value: function fireRequest(url, skipARP, sendOULFlag, evtName) { - _classPrivateFieldLooseBase(this, _fireRequest)[_fireRequest](url, 1, skipARP, sendOULFlag, evtName); + this.logger.debug(this.account.id, 'Setting delay frequency to ' + this.minDelayFrequency); + return this.minDelayFrequency; } - }]); + } - return RequestDispatcher; - }(); + } var _addARPToRequest2 = function _addARPToRequest2(url, skipResARP) { if (skipResARP === true) { - var _arp = {}; + const _arp = {}; _arp.skipResARP = true; return addToURL(url, 'arp', compressData(JSON.stringify(_arp), this.logger)); } @@ -2098,9 +1698,7 @@ }; var _fireRequest2 = function _fireRequest2(url, tries, skipARP, sendOULFlag, evtName) { - var _this = this, - _window$clevertap, - _window$wizrocket; + var _window$clevertap, _window$wizrocket; if (_classPrivateFieldLooseBase(this, _dropRequestDueToOptOut)[_dropRequestDueToOptOut]()) { this.logger.debug('req dropped due to optout cookie: ' + this.device.gcookie); @@ -2123,19 +1721,19 @@ if (evtName && evtName === WZRK_FETCH) { // New retry mechanism if (!isValueValid(this.device.gcookie) && $ct.globalCache.RESP_N < $ct.globalCache.REQ_N - 1) { - setTimeout(function () { - _this.logger.debug("retrying fire request for url: ".concat(url, ", tries: ").concat(_this.networkRetryCount)); + setTimeout(() => { + this.logger.debug("retrying fire request for url: ".concat(url, ", tries: ").concat(this.networkRetryCount)); - _classPrivateFieldLooseBase(_this, _fireRequest)[_fireRequest](url, undefined, skipARP, sendOULFlag); + _classPrivateFieldLooseBase(this, _fireRequest)[_fireRequest](url, undefined, skipARP, sendOULFlag); }, this.getDelayFrequency()); } } else { if (!isValueValid(this.device.gcookie) && $ct.globalCache.RESP_N < $ct.globalCache.REQ_N - 1 && tries < MAX_TRIES) { // if ongoing First Request is in progress, initiate retry - setTimeout(function () { - _this.logger.debug("retrying fire request for url: ".concat(url, ", tries: ").concat(tries)); + setTimeout(() => { + this.logger.debug("retrying fire request for url: ".concat(url, ", tries: ").concat(tries)); - _classPrivateFieldLooseBase(_this, _fireRequest)[_fireRequest](url, tries + 1, skipARP, sendOULFlag); + _classPrivateFieldLooseBase(this, _fireRequest)[_fireRequest](url, tries + 1, skipARP, sendOULFlag); }, 50); return; } @@ -2162,7 +1760,7 @@ if (((_window$clevertap = window.clevertap) === null || _window$clevertap === void 0 ? void 0 : _window$clevertap.hasOwnProperty('plugin')) || ((_window$wizrocket = window.wizrocket) === null || _window$wizrocket === void 0 ? void 0 : _window$wizrocket.hasOwnProperty('plugin'))) { // used to add plugin name in request parameter - var plugin = window.clevertap.plugin || window.wizrocket.plugin; + const plugin = window.clevertap.plugin || window.wizrocket.plugin; url = addToURL(url, 'ct_pl', plugin); } @@ -2177,7 +1775,7 @@ ctCbScripts[0].parentNode.removeChild(ctCbScripts[0]); } - var s = document.createElement('script'); + const s = document.createElement('script'); s.setAttribute('type', 'text/javascript'); s.setAttribute('src', url); s.setAttribute('class', 'ct-jp-cb'); @@ -2203,11 +1801,12 @@ value: _addARPToRequest2 }); - var getCampaignObject = function getCampaignObject() { - var finalcampObj = {}; + // CleverTap specific utilities + const getCampaignObject = () => { + let finalcampObj = {}; if (StorageManager._isLocalStorageSupported()) { - var campObj = StorageManager.read(CAMP_COOKIE_NAME); + let campObj = StorageManager.read(CAMP_COOKIE_NAME); if (campObj != null) { campObj = JSON.parse(decodeURIComponent(campObj).replace(singleQuoteRegex, '\"')); @@ -2224,45 +1823,46 @@ return finalcampObj; }; - var saveCampaignObject = function saveCampaignObject(campaignObj) { + const saveCampaignObject = campaignObj => { if (StorageManager._isLocalStorageSupported()) { - var newObj = _objectSpread2(_objectSpread2({}, getCampaignObject()), campaignObj); - - var campObj = JSON.stringify(newObj); + const newObj = { ...getCampaignObject(), + ...campaignObj + }; + const campObj = JSON.stringify(newObj); StorageManager.save(CAMP_COOKIE_NAME, encodeURIComponent(campObj)); // Update the CAMP_COOKIE_G to be in sync with CAMP_COOKIE_NAME setCampaignObjectForGuid(); } }; // set Campaign Object against the guid, with daily count and total count details - var setCampaignObjectForGuid = function setCampaignObjectForGuid() { + const setCampaignObjectForGuid = () => { if (StorageManager._isLocalStorageSupported()) { - var guid = StorageManager.read(GCOOKIE_NAME); + let guid = StorageManager.read(GCOOKIE_NAME); if (isValueValid(guid)) { try { guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME))); - var guidCampObj = StorageManager.read(CAMP_COOKIE_G) ? JSON.parse(decodeURIComponent(StorageManager.read(CAMP_COOKIE_G))) : {}; + const guidCampObj = StorageManager.read(CAMP_COOKIE_G) ? JSON.parse(decodeURIComponent(StorageManager.read(CAMP_COOKIE_G))) : {}; if (guid && StorageManager._isLocalStorageSupported()) { var finalCampObj = {}; var campObj = getCampaignObject(); - Object.keys(campObj).forEach(function (key) { - var campKeyObj = guid in guidCampObj && Object.keys(guidCampObj[guid]).length && guidCampObj[guid][key] ? guidCampObj[guid][key] : {}; - var globalObj = campObj[key].global; - var today = getToday(); - var dailyObj = campObj[key][today]; + Object.keys(campObj).forEach(key => { + const campKeyObj = guid in guidCampObj && Object.keys(guidCampObj[guid]).length && guidCampObj[guid][key] ? guidCampObj[guid][key] : {}; + const globalObj = campObj[key].global; + const today = getToday(); + const dailyObj = campObj[key][today]; if (typeof globalObj !== 'undefined') { - var campaignIdArray = Object.keys(globalObj); + const campaignIdArray = Object.keys(globalObj); - for (var index in campaignIdArray) { - var resultObj = []; + for (const index in campaignIdArray) { + let resultObj = []; if (campaignIdArray.hasOwnProperty(index)) { - var dailyC = 0; - var totalC = 0; - var campaignId = campaignIdArray[index]; + let dailyC = 0; + let totalC = 0; + const campaignId = campaignIdArray[index]; if (campaignId === 'tc') { continue; @@ -2282,7 +1882,9 @@ } } - finalCampObj = _objectSpread2(_objectSpread2({}, finalCampObj), {}, _defineProperty({}, key, campKeyObj)); + finalCampObj = { ...finalCampObj, + [key]: campKeyObj + }; }); guidCampObj[guid] = finalCampObj; StorageManager.save(CAMP_COOKIE_G, encodeURIComponent(JSON.stringify(guidCampObj))); @@ -2293,22 +1895,22 @@ } } }; - var getCampaignObjForLc = function getCampaignObjForLc() { + const getCampaignObjForLc = () => { // before preparing data to send to LC , check if the entry for the guid is already there in CAMP_COOKIE_G - var guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME))); - var campObj = {}; + const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME))); + let campObj = {}; if (StorageManager._isLocalStorageSupported()) { - var resultObj = {}; + let resultObj = {}; campObj = getCampaignObject(); - var storageValue = StorageManager.read(CAMP_COOKIE_G); - var decodedValue = storageValue ? decodeURIComponent(storageValue) : null; - var parsedValue = decodedValue ? JSON.parse(decodedValue) : null; - var resultObjWP = !!guid && storageValue !== undefined && storageValue !== null && parsedValue && parsedValue[guid] && parsedValue[guid].wp ? Object.values(parsedValue[guid].wp) : []; - var resultObjWI = !!guid && storageValue !== undefined && storageValue !== null && parsedValue && parsedValue[guid] && parsedValue[guid].wi ? Object.values(parsedValue[guid].wi) : []; - var today = getToday(); - var todayCwp = 0; - var todayCwi = 0; + const storageValue = StorageManager.read(CAMP_COOKIE_G); + const decodedValue = storageValue ? decodeURIComponent(storageValue) : null; + const parsedValue = decodedValue ? JSON.parse(decodedValue) : null; + const resultObjWP = !!guid && storageValue !== undefined && storageValue !== null && parsedValue && parsedValue[guid] && parsedValue[guid].wp ? Object.values(parsedValue[guid].wp) : []; + const resultObjWI = !!guid && storageValue !== undefined && storageValue !== null && parsedValue && parsedValue[guid] && parsedValue[guid].wi ? Object.values(parsedValue[guid].wi) : []; + const today = getToday(); + let todayCwp = 0; + let todayCwi = 0; if (campObj.wp && campObj.wp[today] && campObj.wp[today].tc !== 'undefined') { todayCwp = campObj.wp[today].tc; @@ -2327,15 +1929,17 @@ return resultObj; } }; - var isProfileValid = function isProfileValid(profileObj, _ref) { - var logger = _ref.logger; - var valid = false; + const isProfileValid = (profileObj, _ref) => { + let { + logger + } = _ref; + let valid = false; if (isObject(profileObj)) { - for (var profileKey in profileObj) { + for (const profileKey in profileObj) { if (profileObj.hasOwnProperty(profileKey)) { valid = true; - var profileVal = profileObj[profileKey]; + let profileVal = profileObj[profileKey]; if (profileVal == null) { delete profileObj[profileKey]; @@ -2411,8 +2015,8 @@ return valid; }; - var processFBUserObj = function processFBUserObj(user) { - var profileData = {}; + const processFBUserObj = user => { + const profileData = {}; profileData.Name = user.name; if (user.id != null) { @@ -2428,16 +2032,16 @@ profileData.Gender = 'O'; } - var getHighestEducation = function getHighestEducation(eduArr) { + const getHighestEducation = function (eduArr) { if (eduArr != null) { - var college = ''; - var highschool = ''; + let college = ''; + let highschool = ''; - for (var i = 0; i < eduArr.length; i++) { - var _edu = eduArr[i]; + for (let i = 0; i < eduArr.length; i++) { + const edu = eduArr[i]; - if (_edu.type != null) { - var type = _edu.type; + if (edu.type != null) { + const type = edu.type; if (type === 'Graduate School') { return 'Graduate'; @@ -2465,13 +2069,13 @@ } } - var edu = getHighestEducation(user.education); + const edu = getHighestEducation(user.education); if (edu != null) { profileData.Education = edu; } - var work = user.work != null ? user.work.length : 0; + const work = user.work != null ? user.work.length : 0; if (work > 0) { profileData.Employed = 'Y'; @@ -2484,16 +2088,18 @@ } if (user.birthday != null) { - var mmddyy = user.birthday.split('/'); // comes in as "08/15/1947" + const mmddyy = user.birthday.split('/'); // comes in as "08/15/1947" profileData.DOB = setDate(mmddyy[2] + mmddyy[0] + mmddyy[1]); } return profileData; }; - var processGPlusUserObj = function processGPlusUserObj(user, _ref2) { - var logger = _ref2.logger; - var profileData = {}; + const processGPlusUserObj = (user, _ref2) => { + let { + logger + } = _ref2; + const profileData = {}; if (user.displayName != null) { profileData.Name = user.displayName; @@ -2520,8 +2126,8 @@ } if (user.emails != null) { - for (var emailIdx = 0; emailIdx < user.emails.length; emailIdx++) { - var emailObj = user.emails[emailIdx]; + for (let emailIdx = 0; emailIdx < user.emails.length; emailIdx++) { + const emailObj = user.emails[emailIdx]; if (emailObj.type === 'account') { profileData.Email = emailObj.value; @@ -2532,8 +2138,8 @@ if (user.organizations != null) { profileData.Employed = 'N'; - for (var i = 0; i < user.organizations.length; i++) { - var orgObj = user.organizations[i]; + for (let i = 0; i < user.organizations.length; i++) { + const orgObj = user.organizations[i]; if (orgObj.type === 'work') { profileData.Employed = 'Y'; @@ -2542,7 +2148,7 @@ } if (user.birthday != null) { - var yyyymmdd = user.birthday.split('-'); // comes in as "1976-07-27" + const yyyymmdd = user.birthday.split('-'); // comes in as "1976-07-27" profileData.DOB = setDate(yyyymmdd[0] + yyyymmdd[1] + yyyymmdd[2]); } @@ -2558,7 +2164,7 @@ logger.debug('gplus usr profile ' + JSON.stringify(profileData)); return profileData; }; - var addToLocalProfileMap = function addToLocalProfileMap(profileObj, override) { + const addToLocalProfileMap = (profileObj, override) => { if (StorageManager._isLocalStorageSupported()) { if ($ct.globalProfileMap == null) { $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE); @@ -2570,9 +2176,9 @@ if (profileObj._custom != null) { - var keys = profileObj._custom; + const keys = profileObj._custom; - for (var key in keys) { + for (const key in keys) { if (keys.hasOwnProperty(key)) { profileObj[key] = keys[key]; } @@ -2581,7 +2187,7 @@ delete profileObj._custom; } - for (var prop in profileObj) { + for (const prop in profileObj) { if (profileObj.hasOwnProperty(prop)) { if ($ct.globalProfileMap.hasOwnProperty(prop) && !override) { continue; @@ -2598,11 +2204,11 @@ StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap); } }; - var closeIframe = function closeIframe(campaignId, divIdIgnored, currentSessionId) { + const closeIframe = (campaignId, divIdIgnored, currentSessionId) => { if (campaignId != null && campaignId !== '-1') { if (StorageManager._isLocalStorageSupported()) { - var campaignObj = getCampaignObject(); - var sessionCampaignObj = campaignObj.wp[currentSessionId]; + const campaignObj = getCampaignObject(); + let sessionCampaignObj = campaignObj.wp[currentSessionId]; if (sessionCampaignObj == null) { sessionCampaignObj = {}; @@ -2615,7 +2221,7 @@ } if ($ct.campaignDivMap != null) { - var divId = $ct.campaignDivMap[campaignId]; + const divId = $ct.campaignDivMap[campaignId]; if (divId != null) { document.getElementById(divId).style.display = 'none'; @@ -2628,24 +2234,24 @@ } } }; - var arp = function arp(jsonMap) { + const arp = jsonMap => { // For unregister calls dont set arp in LS if (jsonMap.skipResARP != null && jsonMap.skipResARP) { console.debug('Update ARP Request rejected', jsonMap); return null; } - var isOULARP = jsonMap[IS_OUL] === true; + const isOULARP = jsonMap[IS_OUL] === true; if (StorageManager._isLocalStorageSupported()) { // Update arp only if it is null or an oul request try { - var arpFromStorage = StorageManager.readFromLSorCookie(ARP_COOKIE); + let arpFromStorage = StorageManager.readFromLSorCookie(ARP_COOKIE); if (arpFromStorage == null || isOULARP) { arpFromStorage = {}; - for (var key in jsonMap) { + for (const key in jsonMap) { if (jsonMap.hasOwnProperty(key)) { if (jsonMap[key] === -1) { delete arpFromStorage[key]; @@ -2662,22 +2268,22 @@ } } }; - var setEnum = function setEnum(enumVal, logger) { + const setEnum = (enumVal, logger) => { if (isString(enumVal) || isNumber(enumVal)) { return '$E_' + enumVal; } logger.error(ENUM_FORMAT_ERROR); }; - var handleEmailSubscription = function handleEmailSubscription(subscription, reEncoded, fetchGroups, account, logger) { - var urlParamsAsIs = getURLParams(location.href); // can't use url_params as it is in lowercase above + const handleEmailSubscription = (subscription, reEncoded, fetchGroups, account, logger) => { + const urlParamsAsIs = getURLParams(location.href); // can't use url_params as it is in lowercase above - var encodedEmailId = urlParamsAsIs.e; - var encodedProfileProps = urlParamsAsIs.p; - var pageType = urlParamsAsIs.page_type; + const encodedEmailId = urlParamsAsIs.e; + const encodedProfileProps = urlParamsAsIs.p; + const pageType = urlParamsAsIs.page_type; if (typeof encodedEmailId !== 'undefined') { - var data = {}; + const data = {}; data.id = account.id; // accountId data.unsubGroups = $ct.unsubGroups; // unsubscribe groups @@ -2686,7 +2292,7 @@ data[categoryLongKey] = $ct.updatedCategoryLong; } - var url = account.emailURL; + let url = account.emailURL; if (fetchGroups) { url = addToURL(url, 'fetchGroups', fetchGroups); @@ -2728,338 +2334,321 @@ var _processProfileArray = _classPrivateFieldLooseKey("processProfileArray"); - var ProfileHandler = /*#__PURE__*/function (_Array) { - _inherits(ProfileHandler, _Array); - - var _super = _createSuper(ProfileHandler); - - function ProfileHandler(_ref, values) { - var _this; - - var logger = _ref.logger, - request = _ref.request, - account = _ref.account, - isPersonalisationActive = _ref.isPersonalisationActive; - - _classCallCheck(this, ProfileHandler); - - _this = _super.call(this); - Object.defineProperty(_assertThisInitialized(_this), _processProfileArray, { + class ProfileHandler extends Array { + constructor(_ref, values) { + let { + logger, + request, + account, + isPersonalisationActive + } = _ref; + super(); + Object.defineProperty(this, _processProfileArray, { value: _processProfileArray2 }); - Object.defineProperty(_assertThisInitialized(_this), _logger$3, { + Object.defineProperty(this, _logger$3, { writable: true, value: void 0 }); - Object.defineProperty(_assertThisInitialized(_this), _request$2, { + Object.defineProperty(this, _request$2, { writable: true, value: void 0 }); - Object.defineProperty(_assertThisInitialized(_this), _account, { + Object.defineProperty(this, _account, { writable: true, value: void 0 }); - Object.defineProperty(_assertThisInitialized(_this), _oldValues$1, { + Object.defineProperty(this, _oldValues$1, { writable: true, value: void 0 }); - Object.defineProperty(_assertThisInitialized(_this), _isPersonalisationActive$1, { + Object.defineProperty(this, _isPersonalisationActive$1, { writable: true, value: void 0 }); - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _logger$3)[_logger$3] = logger; - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _request$2)[_request$2] = request; - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _account)[_account] = account; - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _oldValues$1)[_oldValues$1] = values; - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _isPersonalisationActive$1)[_isPersonalisationActive$1] = isPersonalisationActive; - return _this; + _classPrivateFieldLooseBase(this, _logger$3)[_logger$3] = logger; + _classPrivateFieldLooseBase(this, _request$2)[_request$2] = request; + _classPrivateFieldLooseBase(this, _account)[_account] = account; + _classPrivateFieldLooseBase(this, _oldValues$1)[_oldValues$1] = values; + _classPrivateFieldLooseBase(this, _isPersonalisationActive$1)[_isPersonalisationActive$1] = isPersonalisationActive; } - _createClass(ProfileHandler, [{ - key: "push", - value: function push() { - for (var _len = arguments.length, profilesArr = new Array(_len), _key = 0; _key < _len; _key++) { - profilesArr[_key] = arguments[_key]; - } + push() { + for (var _len = arguments.length, profilesArr = new Array(_len), _key = 0; _key < _len; _key++) { + profilesArr[_key] = arguments[_key]; + } - _classPrivateFieldLooseBase(this, _processProfileArray)[_processProfileArray](profilesArr); + _classPrivateFieldLooseBase(this, _processProfileArray)[_processProfileArray](profilesArr); + + return 0; + } - return 0; + _processOldValues() { + if (_classPrivateFieldLooseBase(this, _oldValues$1)[_oldValues$1]) { + _classPrivateFieldLooseBase(this, _processProfileArray)[_processProfileArray](_classPrivateFieldLooseBase(this, _oldValues$1)[_oldValues$1]); } - }, { - key: "_processOldValues", - value: function _processOldValues() { - if (_classPrivateFieldLooseBase(this, _oldValues$1)[_oldValues$1]) { - _classPrivateFieldLooseBase(this, _processProfileArray)[_processProfileArray](_classPrivateFieldLooseBase(this, _oldValues$1)[_oldValues$1]); - } - _classPrivateFieldLooseBase(this, _oldValues$1)[_oldValues$1] = null; + _classPrivateFieldLooseBase(this, _oldValues$1)[_oldValues$1] = null; + } + + getAttribute(propName) { + if (!_classPrivateFieldLooseBase(this, _isPersonalisationActive$1)[_isPersonalisationActive$1]()) { + return; } - }, { - key: "getAttribute", - value: function getAttribute(propName) { - if (!_classPrivateFieldLooseBase(this, _isPersonalisationActive$1)[_isPersonalisationActive$1]()) { - return; - } - if ($ct.globalProfileMap == null) { - $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE); - } + if ($ct.globalProfileMap == null) { + $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE); + } - if ($ct.globalProfileMap != null) { - return $ct.globalProfileMap[propName]; - } + if ($ct.globalProfileMap != null) { + return $ct.globalProfileMap[propName]; } - }, { - key: "_handleIncrementDecrementValue", + } - /** - * - * @param {any} key - * @param {number} value - * @param {string} command - * increases or decreases value of the number type properties in profile object - */ - value: function _handleIncrementDecrementValue(key, value, command) { - var _$ct$globalProfileMap; + /** + * + * @param {any} key + * @param {number} value + * @param {string} command + * increases or decreases value of the number type properties in profile object + */ + _handleIncrementDecrementValue(key, value, command) { + var _$ct$globalProfileMap; + + // Check if the value is greater than 0 + if ($ct.globalProfileMap == null) { + $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE); + } + + if ($ct.globalProfileMap == null && !((_$ct$globalProfileMap = $ct.globalProfileMap) === null || _$ct$globalProfileMap === void 0 ? void 0 : _$ct$globalProfileMap.hasOwnProperty(key))) { + // Check if the profile map already has the propery defined + console.error('Kindly create profile with required proprty to increment/decrement.'); + } else if (!value || typeof value !== 'number' || value <= 0) { + console.error('Value should be a number greater than 0'); + } else { + // Update the profile property in local storage + if (command === COMMAND_INCREMENT) { + $ct.globalProfileMap[key] = $ct.globalProfileMap[key] + value; + } else { + $ct.globalProfileMap[key] = $ct.globalProfileMap[key] - value; + } + + StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap); // Send the updated value to LC + + let data = {}; + const profileObj = {}; + data.type = 'profile'; + profileObj[key] = { + [command]: value + }; - // Check if the value is greater than 0 - if ($ct.globalProfileMap == null) { - $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE); + if (profileObj.tz == null) { + // try to auto capture user timezone if not present + profileObj.tz = new Date().toString().match(/([A-Z]+[\+-][0-9]+)/)[1]; } - if ($ct.globalProfileMap == null && !((_$ct$globalProfileMap = $ct.globalProfileMap) === null || _$ct$globalProfileMap === void 0 ? void 0 : _$ct$globalProfileMap.hasOwnProperty(key))) { - // Check if the profile map already has the propery defined - console.error('Kindly create profile with required proprty to increment/decrement.'); - } else if (!value || typeof value !== 'number' || value <= 0) { - console.error('Value should be a number greater than 0'); - } else { - // Update the profile property in local storage - if (command === COMMAND_INCREMENT) { - $ct.globalProfileMap[key] = $ct.globalProfileMap[key] + value; - } else { - $ct.globalProfileMap[key] = $ct.globalProfileMap[key] - value; - } - - StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap); // Send the updated value to LC + data.profile = profileObj; + data = _classPrivateFieldLooseBase(this, _request$2)[_request$2].addSystemDataToObject(data, true); - var data = {}; - var profileObj = {}; - data.type = 'profile'; - profileObj[key] = _defineProperty({}, command, value); + _classPrivateFieldLooseBase(this, _request$2)[_request$2].addFlags(data); - if (profileObj.tz == null) { - // try to auto capture user timezone if not present - profileObj.tz = new Date().toString().match(/([A-Z]+[\+-][0-9]+)/)[1]; - } + const compressedData = compressData(JSON.stringify(data), _classPrivateFieldLooseBase(this, _logger$3)[_logger$3]); - data.profile = profileObj; - data = _classPrivateFieldLooseBase(this, _request$2)[_request$2].addSystemDataToObject(data, true); + let pageLoadUrl = _classPrivateFieldLooseBase(this, _account)[_account].dataPostURL; - _classPrivateFieldLooseBase(this, _request$2)[_request$2].addFlags(data); + pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH); + pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData); - var compressedData = compressData(JSON.stringify(data), _classPrivateFieldLooseBase(this, _logger$3)[_logger$3]); + _classPrivateFieldLooseBase(this, _request$2)[_request$2].saveAndFireRequest(pageLoadUrl, $ct.blockRequest); + } + } + /** + * + * @param {any} key + * @param {array} arrayVal + * @param {string} command + * overwrites/sets new value(s) against a key/property in profile object + */ - var pageLoadUrl = _classPrivateFieldLooseBase(this, _account)[_account].dataPostURL; - pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH); - pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData); + _handleMultiValueSet(key, arrayVal, command) { + const array = []; - _classPrivateFieldLooseBase(this, _request$2)[_request$2].saveAndFireRequest(pageLoadUrl, $ct.blockRequest); + for (let i = 0; i < arrayVal.length; i++) { + if (typeof arrayVal[i] === 'number' && !array.includes(arrayVal[i])) { + array.push(arrayVal[i]); + } else if (typeof arrayVal[i] === 'string' && !array.includes(arrayVal[i].toLowerCase())) { + array.push(arrayVal[i].toLowerCase()); + } else { + console.error('array supports only string or number type values'); } } - /** - * - * @param {any} key - * @param {array} arrayVal - * @param {string} command - * overwrites/sets new value(s) against a key/property in profile object - */ - - }, { - key: "_handleMultiValueSet", - value: function _handleMultiValueSet(key, arrayVal, command) { - var array = []; - for (var i = 0; i < arrayVal.length; i++) { - if (typeof arrayVal[i] === 'number' && !array.includes(arrayVal[i])) { - array.push(arrayVal[i]); - } else if (typeof arrayVal[i] === 'string' && !array.includes(arrayVal[i].toLowerCase())) { - array.push(arrayVal[i].toLowerCase()); - } else { - console.error('array supports only string or number type values'); - } - } + if ($ct.globalProfileMap == null) { + var _StorageManager$readF; - if ($ct.globalProfileMap == null) { - var _StorageManager$readF; + $ct.globalProfileMap = (_StorageManager$readF = StorageManager.readFromLSorCookie(PR_COOKIE)) !== null && _StorageManager$readF !== void 0 ? _StorageManager$readF : {}; + } - $ct.globalProfileMap = (_StorageManager$readF = StorageManager.readFromLSorCookie(PR_COOKIE)) !== null && _StorageManager$readF !== void 0 ? _StorageManager$readF : {}; - } + $ct.globalProfileMap[key] = array; + StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap); + this.sendMultiValueData(key, arrayVal, command); + } + /** + * + * @param {any} propKey - the property name to be added in the profile object + * @param {string, number, array} propVal - the property value to be added against the @propkey key + * @param {string} command + * Adds array or single value against a key/property in profile object + */ - $ct.globalProfileMap[key] = array; - StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap); - this.sendMultiValueData(key, arrayVal, command); - } - /** - * - * @param {any} propKey - the property name to be added in the profile object - * @param {string, number, array} propVal - the property value to be added against the @propkey key - * @param {string} command - * Adds array or single value against a key/property in profile object - */ - }, { - key: "_handleMultiValueAdd", - value: function _handleMultiValueAdd(propKey, propVal, command) { - // Initialize array - var array = []; // Check if globalProfileMap is null, initialize if needed + _handleMultiValueAdd(propKey, propVal, command) { + // Initialize array + var array = []; // Check if globalProfileMap is null, initialize if needed - if ($ct.globalProfileMap == null) { - $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE) || {}; - } // Check if the value to be set is either string or number + if ($ct.globalProfileMap == null) { + $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE) || {}; + } // Check if the value to be set is either string or number - if (typeof propVal === 'string' || typeof propVal === 'number') { - if ($ct.globalProfileMap.hasOwnProperty(propKey)) { - array = $ct.globalProfileMap[propKey]; - array.push(typeof propVal === 'number' ? propVal : propVal.toLowerCase()); + if (typeof propVal === 'string' || typeof propVal === 'number') { + if ($ct.globalProfileMap.hasOwnProperty(propKey)) { + array = $ct.globalProfileMap[propKey]; + array.push(typeof propVal === 'number' ? propVal : propVal.toLowerCase()); + } else { + $ct.globalProfileMap[propKey] = propVal; + } + } else { + // Check if propVal is an array + if ($ct.globalProfileMap.hasOwnProperty(propKey)) { + array = Array.isArray($ct.globalProfileMap[propKey]) ? $ct.globalProfileMap[propKey] : [$ct.globalProfileMap[propKey]]; + } // Check for case-sensitive inputs and filter the same ones + + + for (var i = 0; i < propVal.length; i++) { + if (typeof propVal[i] === 'number' && !array.includes(propVal[i])) { + array.push(propVal[i]); + } else if (typeof propVal[i] === 'string' && !array.includes(propVal[i].toLowerCase())) { + array.push(propVal[i].toLowerCase()); + } else if (typeof propVal[i] === 'number' && array.includes(propVal[i]) || typeof propVal[i] === 'string' && array.includes(propVal[i].toLowerCase())) { + console.error('Values already included'); } else { - $ct.globalProfileMap[propKey] = propVal; + console.error('Array supports only string or number type values'); } - } else { - // Check if propVal is an array - if ($ct.globalProfileMap.hasOwnProperty(propKey)) { - array = Array.isArray($ct.globalProfileMap[propKey]) ? $ct.globalProfileMap[propKey] : [$ct.globalProfileMap[propKey]]; - } // Check for case-sensitive inputs and filter the same ones - - - for (var i = 0; i < propVal.length; i++) { - if (typeof propVal[i] === 'number' && !array.includes(propVal[i])) { - array.push(propVal[i]); - } else if (typeof propVal[i] === 'string' && !array.includes(propVal[i].toLowerCase())) { - array.push(propVal[i].toLowerCase()); - } else if (typeof propVal[i] === 'number' && array.includes(propVal[i]) || typeof propVal[i] === 'string' && array.includes(propVal[i].toLowerCase())) { - console.error('Values already included'); - } else { - console.error('Array supports only string or number type values'); - } - } // Update globalProfileMap with the array + } // Update globalProfileMap with the array - $ct.globalProfileMap[propKey] = array; - } // Save to local storage or cookie + $ct.globalProfileMap[propKey] = array; + } // Save to local storage or cookie - StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap); // Call the sendMultiValueData function + StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap); // Call the sendMultiValueData function - this.sendMultiValueData(propKey, propVal, command); - } - /** - * - * @param {any} propKey - * @param {string, number, array} propVal - * @param {string} command - * removes value(s) against a key/property in profile object - */ + this.sendMultiValueData(propKey, propVal, command); + } + /** + * + * @param {any} propKey + * @param {string, number, array} propVal + * @param {string} command + * removes value(s) against a key/property in profile object + */ - }, { - key: "_handleMultiValueRemove", - value: function _handleMultiValueRemove(propKey, propVal, command) { - var _$ct$globalProfileMap2; - if ($ct.globalProfileMap == null) { - $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE); - } + _handleMultiValueRemove(propKey, propVal, command) { + var _$ct$globalProfileMap2; - if (!($ct === null || $ct === void 0 ? void 0 : (_$ct$globalProfileMap2 = $ct.globalProfileMap) === null || _$ct$globalProfileMap2 === void 0 ? void 0 : _$ct$globalProfileMap2.hasOwnProperty(propKey))) { - console.error("The property ".concat(propKey, " does not exist.")); - } else { - if (typeof propVal === 'string' || typeof propVal === 'number') { - var index = $ct.globalProfileMap[propKey].indexOf(propVal); + if ($ct.globalProfileMap == null) { + $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE); + } - if (index !== -1) { - $ct.globalProfileMap[propKey].splice(index, 1); - } - } else { - for (var k = 0; k < propVal.length; k++) { - var idx = $ct.globalProfileMap[propKey].indexOf(propVal[k]); + if (!($ct === null || $ct === void 0 ? void 0 : (_$ct$globalProfileMap2 = $ct.globalProfileMap) === null || _$ct$globalProfileMap2 === void 0 ? void 0 : _$ct$globalProfileMap2.hasOwnProperty(propKey))) { + console.error("The property ".concat(propKey, " does not exist.")); + } else { + if (typeof propVal === 'string' || typeof propVal === 'number') { + var index = $ct.globalProfileMap[propKey].indexOf(propVal); - if (idx !== -1) { - $ct.globalProfileMap[propKey].splice(idx, 1); - } + if (index !== -1) { + $ct.globalProfileMap[propKey].splice(index, 1); + } + } else { + for (var k = 0; k < propVal.length; k++) { + var idx = $ct.globalProfileMap[propKey].indexOf(propVal[k]); + + if (idx !== -1) { + $ct.globalProfileMap[propKey].splice(idx, 1); } } } - - StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap); - this.sendMultiValueData(propKey, propVal, command); } - /** - * - * @param {any} propKey - * @param {string} command - * deletes a key value pair from the profile object - */ - }, { - key: "_handleMultiValueDelete", - value: function _handleMultiValueDelete(propKey, command) { - var _$ct$globalProfileMap3; + StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap); + this.sendMultiValueData(propKey, propVal, command); + } + /** + * + * @param {any} propKey + * @param {string} command + * deletes a key value pair from the profile object + */ - if ($ct.globalProfileMap == null) { - $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE); - } - if (!($ct === null || $ct === void 0 ? void 0 : (_$ct$globalProfileMap3 = $ct.globalProfileMap) === null || _$ct$globalProfileMap3 === void 0 ? void 0 : _$ct$globalProfileMap3.hasOwnProperty(propKey))) { - console.error("The property ".concat(propKey, " does not exist.")); - } else { - delete $ct.globalProfileMap[propKey]; - } + _handleMultiValueDelete(propKey, command) { + var _$ct$globalProfileMap3; - StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap); - this.sendMultiValueData(propKey, null, command); + if ($ct.globalProfileMap == null) { + $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE); } - }, { - key: "sendMultiValueData", - value: function sendMultiValueData(propKey, propVal, command) { - // Send the updated value to LC - var data = {}; - var profileObj = {}; - data.type = 'profile'; // this removes the property at backend - profileObj[propKey] = _defineProperty({}, command, command === COMMAND_DELETE ? true : propVal); + if (!($ct === null || $ct === void 0 ? void 0 : (_$ct$globalProfileMap3 = $ct.globalProfileMap) === null || _$ct$globalProfileMap3 === void 0 ? void 0 : _$ct$globalProfileMap3.hasOwnProperty(propKey))) { + console.error("The property ".concat(propKey, " does not exist.")); + } else { + delete $ct.globalProfileMap[propKey]; + } - if (profileObj.tz == null) { - profileObj.tz = new Date().toString().match(/([A-Z]+[\+-][0-9]+)/)[1]; - } + StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap); + this.sendMultiValueData(propKey, null, command); + } - data.profile = profileObj; - data = _classPrivateFieldLooseBase(this, _request$2)[_request$2].addSystemDataToObject(data, true); + sendMultiValueData(propKey, propVal, command) { + // Send the updated value to LC + let data = {}; + const profileObj = {}; + data.type = 'profile'; // this removes the property at backend - _classPrivateFieldLooseBase(this, _request$2)[_request$2].addFlags(data); + profileObj[propKey] = { + [command]: command === COMMAND_DELETE ? true : propVal + }; - var compressedData = compressData(JSON.stringify(data), _classPrivateFieldLooseBase(this, _logger$3)[_logger$3]); + if (profileObj.tz == null) { + profileObj.tz = new Date().toString().match(/([A-Z]+[\+-][0-9]+)/)[1]; + } - var pageLoadUrl = _classPrivateFieldLooseBase(this, _account)[_account].dataPostURL; + data.profile = profileObj; + data = _classPrivateFieldLooseBase(this, _request$2)[_request$2].addSystemDataToObject(data, true); - pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH); - pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData); + _classPrivateFieldLooseBase(this, _request$2)[_request$2].addFlags(data); - _classPrivateFieldLooseBase(this, _request$2)[_request$2].saveAndFireRequest(pageLoadUrl, $ct.blockRequest); - } - }]); + const compressedData = compressData(JSON.stringify(data), _classPrivateFieldLooseBase(this, _logger$3)[_logger$3]); + + let pageLoadUrl = _classPrivateFieldLooseBase(this, _account)[_account].dataPostURL; + + pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH); + pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData); - return ProfileHandler; - }( /*#__PURE__*/_wrapNativeSuper(Array)); + _classPrivateFieldLooseBase(this, _request$2)[_request$2].saveAndFireRequest(pageLoadUrl, $ct.blockRequest); + } + + } var _processProfileArray2 = function _processProfileArray2(profileArr) { if (Array.isArray(profileArr) && profileArr.length > 0) { - for (var index in profileArr) { + for (const index in profileArr) { if (profileArr.hasOwnProperty(index)) { - var outerObj = profileArr[index]; - var data = {}; - var profileObj = void 0; + const outerObj = profileArr[index]; + let data = {}; + let profileObj; if (outerObj.Site != null) { // organic data from the site @@ -3072,13 +2661,13 @@ } } else if (outerObj.Facebook != null) { // fb connect data - var FbProfileObj = outerObj.Facebook; // make sure that the object contains any data at all + const FbProfileObj = outerObj.Facebook; // make sure that the object contains any data at all if (!isObjectEmpty(FbProfileObj) && !FbProfileObj.error) { profileObj = processFBUserObj(FbProfileObj); } } else if (outerObj['Google Plus'] != null) { - var GPlusProfileObj = outerObj['Google Plus']; + const GPlusProfileObj = outerObj['Google Plus']; if (!isObjectEmpty(GPlusProfileObj) && !GPlusProfileObj.error) { profileObj = processGPlusUserObj(GPlusProfileObj, { @@ -3102,9 +2691,9 @@ _classPrivateFieldLooseBase(this, _request$2)[_request$2].addFlags(data); - var compressedData = compressData(JSON.stringify(data), _classPrivateFieldLooseBase(this, _logger$3)[_logger$3]); + const compressedData = compressData(JSON.stringify(data), _classPrivateFieldLooseBase(this, _logger$3)[_logger$3]); - var pageLoadUrl = _classPrivateFieldLooseBase(this, _account)[_account].dataPostURL; + let pageLoadUrl = _classPrivateFieldLooseBase(this, _account)[_account].dataPostURL; pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH); pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData); @@ -3136,113 +2725,97 @@ var _processLoginArray = _classPrivateFieldLooseKey("processLoginArray"); - var UserLoginHandler = /*#__PURE__*/function (_Array) { - _inherits(UserLoginHandler, _Array); - - var _super = _createSuper(UserLoginHandler); - - function UserLoginHandler(_ref, values) { - var _this; - - var request = _ref.request, - account = _ref.account, - session = _ref.session, - logger = _ref.logger, - device = _ref.device; - - _classCallCheck(this, UserLoginHandler); - - _this = _super.call(this); - Object.defineProperty(_assertThisInitialized(_this), _processLoginArray, { + class UserLoginHandler extends Array { + constructor(_ref, values) { + let { + request, + account, + session, + logger, + device + } = _ref; + super(); + Object.defineProperty(this, _processLoginArray, { value: _processLoginArray2 }); - Object.defineProperty(_assertThisInitialized(_this), _deleteUser, { + Object.defineProperty(this, _deleteUser, { value: _deleteUser2 }); - Object.defineProperty(_assertThisInitialized(_this), _handleCookieFromCache, { + Object.defineProperty(this, _handleCookieFromCache, { value: _handleCookieFromCache2 }); - Object.defineProperty(_assertThisInitialized(_this), _processOUL, { + Object.defineProperty(this, _processOUL, { value: _processOUL2 }); - Object.defineProperty(_assertThisInitialized(_this), _request$3, { + Object.defineProperty(this, _request$3, { writable: true, value: void 0 }); - Object.defineProperty(_assertThisInitialized(_this), _logger$4, { + Object.defineProperty(this, _logger$4, { writable: true, value: void 0 }); - Object.defineProperty(_assertThisInitialized(_this), _account$1, { + Object.defineProperty(this, _account$1, { writable: true, value: void 0 }); - Object.defineProperty(_assertThisInitialized(_this), _session$1, { + Object.defineProperty(this, _session$1, { writable: true, value: void 0 }); - Object.defineProperty(_assertThisInitialized(_this), _oldValues$2, { + Object.defineProperty(this, _oldValues$2, { writable: true, value: void 0 }); - Object.defineProperty(_assertThisInitialized(_this), _device$1, { + Object.defineProperty(this, _device$1, { writable: true, value: void 0 }); - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _request$3)[_request$3] = request; - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _account$1)[_account$1] = account; - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _session$1)[_session$1] = session; - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _logger$4)[_logger$4] = logger; - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _oldValues$2)[_oldValues$2] = values; - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _device$1)[_device$1] = device; - return _this; + _classPrivateFieldLooseBase(this, _request$3)[_request$3] = request; + _classPrivateFieldLooseBase(this, _account$1)[_account$1] = account; + _classPrivateFieldLooseBase(this, _session$1)[_session$1] = session; + _classPrivateFieldLooseBase(this, _logger$4)[_logger$4] = logger; + _classPrivateFieldLooseBase(this, _oldValues$2)[_oldValues$2] = values; + _classPrivateFieldLooseBase(this, _device$1)[_device$1] = device; } // On User Login - _createClass(UserLoginHandler, [{ - key: "clear", - value: function clear() { - _classPrivateFieldLooseBase(this, _logger$4)[_logger$4].debug('clear called. Reset flag has been set.'); + clear() { + _classPrivateFieldLooseBase(this, _logger$4)[_logger$4].debug('clear called. Reset flag has been set.'); - _classPrivateFieldLooseBase(this, _deleteUser)[_deleteUser](); + _classPrivateFieldLooseBase(this, _deleteUser)[_deleteUser](); - StorageManager.setMetaProp(CLEAR, true); + StorageManager.setMetaProp(CLEAR, true); + } + + push() { + for (var _len = arguments.length, profilesArr = new Array(_len), _key = 0; _key < _len; _key++) { + profilesArr[_key] = arguments[_key]; } - }, { - key: "push", - value: function push() { - for (var _len = arguments.length, profilesArr = new Array(_len), _key = 0; _key < _len; _key++) { - profilesArr[_key] = arguments[_key]; - } - _classPrivateFieldLooseBase(this, _processLoginArray)[_processLoginArray](profilesArr); + _classPrivateFieldLooseBase(this, _processLoginArray)[_processLoginArray](profilesArr); - return 0; - } - }, { - key: "_processOldValues", - value: function _processOldValues() { - if (_classPrivateFieldLooseBase(this, _oldValues$2)[_oldValues$2]) { - _classPrivateFieldLooseBase(this, _processLoginArray)[_processLoginArray](_classPrivateFieldLooseBase(this, _oldValues$2)[_oldValues$2]); - } + return 0; + } - _classPrivateFieldLooseBase(this, _oldValues$2)[_oldValues$2] = null; + _processOldValues() { + if (_classPrivateFieldLooseBase(this, _oldValues$2)[_oldValues$2]) { + _classPrivateFieldLooseBase(this, _processLoginArray)[_processLoginArray](_classPrivateFieldLooseBase(this, _oldValues$2)[_oldValues$2]); } - }]); - return UserLoginHandler; - }( /*#__PURE__*/_wrapNativeSuper(Array)); + _classPrivateFieldLooseBase(this, _oldValues$2)[_oldValues$2] = null; + } - var _processOUL2 = function _processOUL2(profileArr) { - var _this2 = this; + } - var sendOULFlag = true; + var _processOUL2 = function _processOUL2(profileArr) { + let sendOULFlag = true; StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, sendOULFlag); - var addToK = function addToK(ids) { - var k = StorageManager.readFromLSorCookie(KCOOKIE_NAME); - var g = StorageManager.readFromLSorCookie(GCOOKIE_NAME); - var kId; + const addToK = ids => { + let k = StorageManager.readFromLSorCookie(KCOOKIE_NAME); + const g = StorageManager.readFromLSorCookie(GCOOKIE_NAME); + let kId; if (k == null) { k = {}; @@ -3250,8 +2823,8 @@ } else { /* check if already exists */ kId = k.id; - var anonymousUser = false; - var foundInCache = false; + let anonymousUser = false; + let foundInCache = false; if (kId == null) { kId = ids[0]; @@ -3271,9 +2844,9 @@ } else { // check if the id is present in the cache // set foundInCache to true - for (var idx in ids) { + for (const idx in ids) { if (ids.hasOwnProperty(idx)) { - var id = ids[idx]; + const id = ids[idx]; if ($ct.LRU_CACHE.cache[id]) { kId = id; @@ -3288,30 +2861,30 @@ if (kId !== $ct.LRU_CACHE.getLastKey()) { // New User found // remove the entire cache - _classPrivateFieldLooseBase(_this2, _handleCookieFromCache)[_handleCookieFromCache](); + _classPrivateFieldLooseBase(this, _handleCookieFromCache)[_handleCookieFromCache](); } else { sendOULFlag = false; StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, sendOULFlag); } - var gFromCache = $ct.LRU_CACHE.get(kId); + const gFromCache = $ct.LRU_CACHE.get(kId); $ct.LRU_CACHE.set(kId, gFromCache); StorageManager.saveToLSorCookie(GCOOKIE_NAME, gFromCache); - _classPrivateFieldLooseBase(_this2, _device$1)[_device$1].gcookie = gFromCache; - var lastK = $ct.LRU_CACHE.getSecondLastKey(); + _classPrivateFieldLooseBase(this, _device$1)[_device$1].gcookie = gFromCache; + const lastK = $ct.LRU_CACHE.getSecondLastKey(); if (StorageManager.readFromLSorCookie(FIRE_PUSH_UNREGISTERED) && lastK !== -1) { // CACHED OLD USER FOUND. TRANSFER PUSH TOKEN TO THIS USER - var lastGUID = $ct.LRU_CACHE.cache[lastK]; + const lastGUID = $ct.LRU_CACHE.cache[lastK]; - _classPrivateFieldLooseBase(_this2, _request$3)[_request$3].unregisterTokenForGuid(lastGUID); + _classPrivateFieldLooseBase(this, _request$3)[_request$3].unregisterTokenForGuid(lastGUID); } } else { if (!anonymousUser) { - _this2.clear(); + this.clear(); } else { if (g != null) { - _classPrivateFieldLooseBase(_this2, _device$1)[_device$1].gcookie = g; + _classPrivateFieldLooseBase(this, _device$1)[_device$1].gcookie = g; StorageManager.saveToLSorCookie(GCOOKIE_NAME, g); sendOULFlag = false; } @@ -3327,11 +2900,11 @@ }; if (Array.isArray(profileArr) && profileArr.length > 0) { - for (var index in profileArr) { + for (const index in profileArr) { if (profileArr.hasOwnProperty(index)) { - var outerObj = profileArr[index]; - var data = {}; - var profileObj = void 0; + const outerObj = profileArr[index]; + let data = {}; + let profileObj; if (outerObj.Site != null) { // organic data from the site @@ -3344,13 +2917,13 @@ } } else if (outerObj.Facebook != null) { // fb connect data - var FbProfileObj = outerObj.Facebook; // make sure that the object contains any data at all + const FbProfileObj = outerObj.Facebook; // make sure that the object contains any data at all if (!isObjectEmpty(FbProfileObj) && !FbProfileObj.error) { profileObj = processFBUserObj(FbProfileObj); } } else if (outerObj['Google Plus'] != null) { - var GPlusProfileObj = outerObj['Google Plus']; + const GPlusProfileObj = outerObj['Google Plus']; if (isObjectEmpty(GPlusProfileObj) && !GPlusProfileObj.error) { profileObj = processGPlusUserObj(GPlusProfileObj, { @@ -3369,7 +2942,7 @@ } data.profile = profileObj; - var ids = []; + const ids = []; if (StorageManager._isLocalStorageSupported()) { if (profileObj.Identity) { @@ -3405,9 +2978,9 @@ data[IS_OUL] = true; } - var compressedData = compressData(JSON.stringify(data), _classPrivateFieldLooseBase(this, _logger$4)[_logger$4]); + const compressedData = compressData(JSON.stringify(data), _classPrivateFieldLooseBase(this, _logger$4)[_logger$4]); - var pageLoadUrl = _classPrivateFieldLooseBase(this, _account$1)[_account$1].dataPostURL; + let pageLoadUrl = _classPrivateFieldLooseBase(this, _account$1)[_account$1].dataPostURL; pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH); pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData); // Whenever sendOULFlag is true then dont send arp and gcookie (guid in memory in the request) @@ -3475,8 +3048,8 @@ var _processLoginArray2 = function _processLoginArray2(loginArr) { if (Array.isArray(loginArr) && loginArr.length > 0) { - var profileObj = loginArr.pop(); - var processProfile = profileObj != null && isObject(profileObj) && (profileObj.Site != null && Object.keys(profileObj.Site).length > 0 || profileObj.Facebook != null && Object.keys(profileObj.Facebook).length > 0 || profileObj['Google Plus'] != null && Object.keys(profileObj['Google Plus']).length > 0); + const profileObj = loginArr.pop(); + const processProfile = profileObj != null && isObject(profileObj) && (profileObj.Site != null && Object.keys(profileObj.Site).length > 0 || profileObj.Facebook != null && Object.keys(profileObj.Facebook).length > 0 || profileObj['Google Plus'] != null && Object.keys(profileObj['Google Plus']).length > 0); if (processProfile) { StorageManager.setInstantDeleteFlagInK(); @@ -3492,1362 +3065,1185 @@ } }; - var CTWebPersonalisationBanner = /*#__PURE__*/function (_HTMLElement) { - _inherits(CTWebPersonalisationBanner, _HTMLElement); - - var _super = _createSuper(CTWebPersonalisationBanner); - - function CTWebPersonalisationBanner() { - var _this; - - _classCallCheck(this, CTWebPersonalisationBanner); - - _this = _super.call(this); - _this._details = null; - _this.shadow = null; - _this.shadow = _this.attachShadow({ + class CTWebPersonalisationBanner extends HTMLElement { + constructor() { + super(); + this._details = null; + this.shadow = null; + this.shadow = this.attachShadow({ mode: 'open' }); - return _this; } - _createClass(CTWebPersonalisationBanner, [{ - key: "renderBanner", - value: function renderBanner() { - var _this2 = this; + get details() { + return this._details || ''; + } + + set details(val) { + if (this._details === null) { + this._details = val; + this.renderBanner(); + } + } - this.shadow.innerHTML = this.getBannerContent(); + renderBanner() { + this.shadow.innerHTML = this.getBannerContent(); - if (this.trackClick !== false) { - this.addEventListener('click', function () { - var onClickUrl = _this2.details.onClick; + if (this.trackClick !== false) { + this.addEventListener('click', () => { + const onClickUrl = this.details.onClick; - if (onClickUrl) { - _this2.details.window ? window.open(onClickUrl, '_blank') : window.parent.location.href = onClickUrl; - } + if (onClickUrl) { + this.details.window ? window.open(onClickUrl, '_blank') : window.parent.location.href = onClickUrl; + } - window.clevertap.renderNotificationClicked({ - msgId: _this2.msgId, - pivotId: _this2.pivotId - }); + window.clevertap.renderNotificationClicked({ + msgId: this.msgId, + pivotId: this.pivotId }); - } - - window.clevertap.renderNotificationViewed({ - msgId: this.msgId, - pivotId: this.pivotId }); } - }, { - key: "getBannerContent", - value: function getBannerContent() { - return "\n \n
\n \n \n \n \"Please\n \n ").concat(this.details.html ? this.details.html : '', "\n
\n "); - } - }, { - key: "details", - get: function get() { - return this._details || ''; - }, - set: function set(val) { - if (this._details === null) { - this._details = val; - this.renderBanner(); - } - } - }]); - - return CTWebPersonalisationBanner; - }( /*#__PURE__*/_wrapNativeSuper(HTMLElement)); - var CTWebPersonalisationCarousel = /*#__PURE__*/function (_HTMLElement) { - _inherits(CTWebPersonalisationCarousel, _HTMLElement); - - var _super = _createSuper(CTWebPersonalisationCarousel); + window.clevertap.renderNotificationViewed({ + msgId: this.msgId, + pivotId: this.pivotId + }); + } - function CTWebPersonalisationCarousel() { - var _this; + getBannerContent() { + return "\n \n
\n \n \n \n \"Please\n \n ").concat(this.details.html ? this.details.html : '', "\n
\n "); + } - _classCallCheck(this, CTWebPersonalisationCarousel); + } - _this = _super.call(this); - _this._target = null; - _this._carousel = null; - _this.shadow = null; - _this.slides = 0; - _this.previouslySelectedItem = -1; - _this.selectedItem = 1; - _this.autoSlide = null; - _this.stopAutoSlideTimeout = null; - _this.shadow = _this.attachShadow({ + class CTWebPersonalisationCarousel extends HTMLElement { + constructor() { + super(); + this._target = null; + this._carousel = null; + this.shadow = null; + this.slides = 0; + this.previouslySelectedItem = -1; + this.selectedItem = 1; + this.autoSlide = null; + this.stopAutoSlideTimeout = null; + this.shadow = this.attachShadow({ mode: 'open' }); if (customElements.get('ct-web-personalisation-banner') === undefined) { customElements.define('ct-web-personalisation-banner', CTWebPersonalisationBanner); } + } - return _this; + get target() { + return this._target || ''; } - _createClass(CTWebPersonalisationCarousel, [{ - key: "renderCarousel", - value: function renderCarousel() { - this.slides = this.details.length; - this.shadow.innerHTML = this.getStyles(); - var carousel = this.getCarouselContent(); + set target(val) { + if (this._target === null) { + this._target = val; + this.renderCarousel(); + } + } - if (this.display.showNavBtns) { - carousel.insertAdjacentHTML('beforeend', this.display.navBtnsHtml); - } + get details() { + return this.target.display.details; + } - if (this.display.showNavArrows) { - carousel.insertAdjacentHTML('beforeend', this.display.leftNavArrowHtml); - carousel.insertAdjacentHTML('beforeend', this.display.rightNavArrowHtml); - } + get display() { + return this.target.display; + } - this._carousel = carousel; - this.shadow.appendChild(carousel); - this.setupClick(); - this.updateSelectedItem(); // TODO: enable conditionally + renderCarousel() { + this.slides = this.details.length; + this.shadow.innerHTML = this.getStyles(); + const carousel = this.getCarouselContent(); - this.startAutoSlide(); - this.setupOnHover(); - window.clevertap.renderNotificationViewed({ - msgId: this.target.wzrk_id, - pivotId: this.target.wzrk_pivot - }); + if (this.display.showNavBtns) { + carousel.insertAdjacentHTML('beforeend', this.display.navBtnsHtml); } - }, { - key: "setupClick", - value: function setupClick() { - var _this2 = this; - - this._carousel.addEventListener('click', function (event) { - var eventID = event.target.id; - if (eventID.startsWith('carousel__button')) { - var selected = +eventID.split('-')[1]; + if (this.display.showNavArrows) { + carousel.insertAdjacentHTML('beforeend', this.display.leftNavArrowHtml); + carousel.insertAdjacentHTML('beforeend', this.display.rightNavArrowHtml); + } - if (selected !== _this2.selectedItem) { - _this2.previouslySelectedItem = _this2.selectedItem; - _this2.selectedItem = selected; + this._carousel = carousel; + this.shadow.appendChild(carousel); + this.setupClick(); + this.updateSelectedItem(); // TODO: enable conditionally - _this2.updateSelectedItem(); + this.startAutoSlide(); + this.setupOnHover(); + window.clevertap.renderNotificationViewed({ + msgId: this.target.wzrk_id, + pivotId: this.target.wzrk_pivot + }); + } - _this2.startAutoSlide(); - } - } else if (eventID.startsWith('carousel__arrow')) { - eventID.endsWith('right') ? _this2.goToNext() : _this2.goToPrev(); - - _this2.startAutoSlide(); - } else if (eventID.indexOf('-') > -1) { - var item = +eventID.split('-')[1]; - var index = item - 1; - - if (window.parent.clevertap) { - // console.log('Raise notification clicked event for ', item) - window.clevertap.renderNotificationClicked({ - msgId: _this2.target.wzrk_id, - pivotId: _this2.target.wzrk_pivot, - wzrk_slideNo: item - }); - } + setupClick() { + this._carousel.addEventListener('click', event => { + const eventID = event.target.id; - var url = _this2.details[index].onClick; + if (eventID.startsWith('carousel__button')) { + const selected = +eventID.split('-')[1]; - if (url !== '') { - _this2.details[index].window ? window.open(url, '_blank') : window.location.href = url; - } + if (selected !== this.selectedItem) { + this.previouslySelectedItem = this.selectedItem; + this.selectedItem = selected; + this.updateSelectedItem(); + this.startAutoSlide(); } - }); - } - }, { - key: "setupOnHover", - value: function setupOnHover() { - var _this3 = this; - - this._carousel.addEventListener('mouseenter', function (event) { - _this3.stopAutoSlideTimeout = setTimeout(function () { - _this3.autoSlide = clearInterval(_this3.autoSlide); - }, 500); - }); + } else if (eventID.startsWith('carousel__arrow')) { + eventID.endsWith('right') ? this.goToNext() : this.goToPrev(); + this.startAutoSlide(); + } else if (eventID.indexOf('-') > -1) { + const item = +eventID.split('-')[1]; + const index = item - 1; - this._carousel.addEventListener('mouseleave', function (event) { - clearTimeout(_this3.stopAutoSlideTimeout); - - if (_this3.autoSlide === undefined) { - _this3.startAutoSlide(); + if (window.parent.clevertap) { + // console.log('Raise notification clicked event for ', item) + window.clevertap.renderNotificationClicked({ + msgId: this.target.wzrk_id, + pivotId: this.target.wzrk_pivot, + wzrk_slideNo: item + }); } - }); - } - }, { - key: "getCarouselContent", - value: function getCarouselContent() { - var carousel = document.createElement('div'); - carousel.setAttribute('class', 'carousel'); - this.details.forEach(function (detail, i) { - var banner = document.createElement('ct-web-personalisation-banner'); - banner.classList.add('carousel__item'); - banner.trackClick = false; - banner.setAttribute('id', "carousel__item-".concat(i + 1)); - banner.details = detail; - carousel.appendChild(banner); - }); - return carousel; - } - }, { - key: "getStyles", - value: function getStyles() { - var _this$target, _this$target$display; - return "\n \n "); - } - }, { - key: "updateSelectedItem", - value: function updateSelectedItem() { - if (this.previouslySelectedItem !== -1) { - var prevItem = this.shadow.getElementById("carousel__item-".concat(this.previouslySelectedItem)); - var prevButton = this.shadow.getElementById("carousel__button-".concat(this.previouslySelectedItem)); - prevItem.classList.remove('carousel__item--selected'); + const url = this.details[index].onClick; - if (prevButton) { - prevButton.classList.remove('carousel__button--selected'); + if (url !== '') { + this.details[index].window ? window.open(url, '_blank') : window.location.href = url; } } + }); + } - var item = this.shadow.getElementById("carousel__item-".concat(this.selectedItem)); - var button = this.shadow.getElementById("carousel__button-".concat(this.selectedItem)); - item.classList.add('carousel__item--selected'); + setupOnHover() { + this._carousel.addEventListener('mouseenter', event => { + this.stopAutoSlideTimeout = setTimeout(() => { + this.autoSlide = clearInterval(this.autoSlide); + }, 500); + }); + + this._carousel.addEventListener('mouseleave', event => { + clearTimeout(this.stopAutoSlideTimeout); - if (button) { - button.classList.add('carousel__button--selected'); + if (this.autoSlide === undefined) { + this.startAutoSlide(); } - } - }, { - key: "startAutoSlide", - value: function startAutoSlide() { - var _this4 = this; + }); + } - clearInterval(this.autoSlide); - this.autoSlide = setInterval(function () { - _this4.goToNext(); - }, this.display.sliderTime ? this.display.sliderTime * 1000 : 3000); - } - }, { - key: "goToNext", - value: function goToNext() { - this.goTo(this.selectedItem, (this.selectedItem + 1) % this.slides); - } - }, { - key: "goToPrev", - value: function goToPrev() { - this.goTo(this.selectedItem, this.selectedItem - 1); - } - }, { - key: "goTo", - value: function goTo(prev, cur) { - this.previouslySelectedItem = prev; - this.selectedItem = cur; + getCarouselContent() { + const carousel = document.createElement('div'); + carousel.setAttribute('class', 'carousel'); + this.details.forEach((detail, i) => { + const banner = document.createElement('ct-web-personalisation-banner'); + banner.classList.add('carousel__item'); + banner.trackClick = false; + banner.setAttribute('id', "carousel__item-".concat(i + 1)); + banner.details = detail; + carousel.appendChild(banner); + }); + return carousel; + } - if (cur === 0) { - this.selectedItem = this.slides; - } + getStyles() { + var _this$target, _this$target$display; - this.updateSelectedItem(); - } - }, { - key: "target", - get: function get() { - return this._target || ''; - }, - set: function set(val) { - if (this._target === null) { - this._target = val; - this.renderCarousel(); + return "\n \n "); + } + + updateSelectedItem() { + if (this.previouslySelectedItem !== -1) { + const prevItem = this.shadow.getElementById("carousel__item-".concat(this.previouslySelectedItem)); + const prevButton = this.shadow.getElementById("carousel__button-".concat(this.previouslySelectedItem)); + prevItem.classList.remove('carousel__item--selected'); + + if (prevButton) { + prevButton.classList.remove('carousel__button--selected'); } } - }, { - key: "details", - get: function get() { - return this.target.display.details; - } - }, { - key: "display", - get: function get() { - return this.target.display; + + const item = this.shadow.getElementById("carousel__item-".concat(this.selectedItem)); + const button = this.shadow.getElementById("carousel__button-".concat(this.selectedItem)); + item.classList.add('carousel__item--selected'); + + if (button) { + button.classList.add('carousel__button--selected'); } - }]); + } + + startAutoSlide() { + clearInterval(this.autoSlide); + this.autoSlide = setInterval(() => { + this.goToNext(); + }, this.display.sliderTime ? this.display.sliderTime * 1000 : 3000); + } + + goToNext() { + this.goTo(this.selectedItem, (this.selectedItem + 1) % this.slides); + } - return CTWebPersonalisationCarousel; - }( /*#__PURE__*/_wrapNativeSuper(HTMLElement)); + goToPrev() { + this.goTo(this.selectedItem, this.selectedItem - 1); + } - var CTWebPopupImageOnly = /*#__PURE__*/function (_HTMLElement) { - _inherits(CTWebPopupImageOnly, _HTMLElement); + goTo(prev, cur) { + this.previouslySelectedItem = prev; + this.selectedItem = cur; - var _super = _createSuper(CTWebPopupImageOnly); + if (cur === 0) { + this.selectedItem = this.slides; + } - function CTWebPopupImageOnly() { - var _this; + this.updateSelectedItem(); + } - _classCallCheck(this, CTWebPopupImageOnly); + } - _this = _super.call(this); - _this._target = null; - _this._session = null; - _this.shadow = null; - _this.popup = null; - _this.container = null; - _this.resizeObserver = null; - _this.shadow = _this.attachShadow({ + class CTWebPopupImageOnly extends HTMLElement { + constructor() { + super(); + this._target = null; + this._session = null; + this.shadow = null; + this.popup = null; + this.container = null; + this.resizeObserver = null; + this.shadow = this.attachShadow({ mode: 'open' }); - return _this; } - _createClass(CTWebPopupImageOnly, [{ - key: "renderImageOnlyPopup", - value: function renderImageOnlyPopup() { - var _this2 = this; + get target() { + return this._target || ''; + } + + set target(val) { + if (this._target === null) { + this._target = val; + this.renderImageOnlyPopup(); + } + } - var campaignId = this.target.wzrk_id.split('_')[0]; - var currentSessionId = this.session.sessionId; - this.shadow.innerHTML = this.getImageOnlyPopupContent(); - this.popup = this.shadowRoot.getElementById('imageOnlyPopup'); - this.container = this.shadowRoot.getElementById('container'); - this.closeIcon = this.shadowRoot.getElementById('close'); - this.popup.addEventListener('load', this.updateImageAndContainerWidth()); - this.resizeObserver = new ResizeObserver(function () { - return _this2.handleResize(_this2.popup, _this2.container); - }); - this.resizeObserver.observe(this.popup); - this.closeIcon.addEventListener('click', function () { - _this2.resizeObserver.unobserve(_this2.popup); + get session() { + return this._session || ''; + } - document.getElementById('wzrkImageOnlyDiv').style.display = 'none'; + set session(val) { + this._session = val; + } - _this2.remove(); + get msgId() { + return this.target.wzrk_id; + } - if (campaignId != null && campaignId !== '-1') { - if (StorageManager._isLocalStorageSupported()) { - var campaignObj = getCampaignObject(); - var sessionCampaignObj = campaignObj.wp[currentSessionId]; + get pivotId() { + return this.target.wzrk_pivot; + } - if (sessionCampaignObj == null) { - sessionCampaignObj = {}; - campaignObj[currentSessionId] = sessionCampaignObj; - } + get onClickUrl() { + return this.target.display.onClickUrl; + } - sessionCampaignObj[campaignId] = 'dnd'; - saveCampaignObject(campaignObj); + renderImageOnlyPopup() { + const campaignId = this.target.wzrk_id.split('_')[0]; + const currentSessionId = this.session.sessionId; + this.shadow.innerHTML = this.getImageOnlyPopupContent(); + this.popup = this.shadowRoot.getElementById('imageOnlyPopup'); + this.container = this.shadowRoot.getElementById('container'); + this.closeIcon = this.shadowRoot.getElementById('close'); + this.popup.addEventListener('load', this.updateImageAndContainerWidth()); + this.resizeObserver = new ResizeObserver(() => this.handleResize(this.popup, this.container)); + this.resizeObserver.observe(this.popup); + this.closeIcon.addEventListener('click', () => { + this.resizeObserver.unobserve(this.popup); + document.getElementById('wzrkImageOnlyDiv').style.display = 'none'; + this.remove(); + + if (campaignId != null && campaignId !== '-1') { + if (StorageManager._isLocalStorageSupported()) { + const campaignObj = getCampaignObject(); + let sessionCampaignObj = campaignObj.wp[currentSessionId]; + + if (sessionCampaignObj == null) { + sessionCampaignObj = {}; + campaignObj[currentSessionId] = sessionCampaignObj; } + + sessionCampaignObj[campaignId] = 'dnd'; + saveCampaignObject(campaignObj); } - }); - window.clevertap.renderNotificationViewed({ - msgId: this.msgId, - pivotId: this.pivotId - }); + } + }); + window.clevertap.renderNotificationViewed({ + msgId: this.msgId, + pivotId: this.pivotId + }); - if (this.onClickUrl) { - this.popup.addEventListener('click', function () { - _this2.target.display.window ? window.open(_this2.onClickUrl, '_blank') : window.parent.location.href = _this2.onClickUrl; - window.clevertap.renderNotificationClicked({ - msgId: _this2.msgId, - pivotId: _this2.pivotId - }); + if (this.onClickUrl) { + this.popup.addEventListener('click', () => { + this.target.display.window ? window.open(this.onClickUrl, '_blank') : window.parent.location.href = this.onClickUrl; + window.clevertap.renderNotificationClicked({ + msgId: this.msgId, + pivotId: this.pivotId }); - } - } - }, { - key: "handleResize", - value: function handleResize(popup, container) { - var width = this.getRenderedImageWidth(popup); - container.style.setProperty('width', "".concat(width, "px")); - } - }, { - key: "getImageOnlyPopupContent", - value: function getImageOnlyPopupContent() { - return "\n ".concat(this.target.msgContent.css, "\n ").concat(this.target.msgContent.html, "\n "); + }); } - }, { - key: "updateImageAndContainerWidth", - value: function updateImageAndContainerWidth() { - var _this3 = this; - - return function () { - var width = _this3.getRenderedImageWidth(_this3.popup); - - _this3.popup.style.setProperty('width', "".concat(width, "px")); + } - _this3.container.style.setProperty('width', "".concat(width, "px")); + handleResize(popup, container) { + const width = this.getRenderedImageWidth(popup); + container.style.setProperty('width', "".concat(width, "px")); + } - _this3.container.style.setProperty('height', 'auto'); + getImageOnlyPopupContent() { + return "\n ".concat(this.target.msgContent.css, "\n ").concat(this.target.msgContent.html, "\n "); + } - _this3.container.style.setProperty('position', 'fixed'); + updateImageAndContainerWidth() { + return () => { + const width = this.getRenderedImageWidth(this.popup); + this.popup.style.setProperty('width', "".concat(width, "px")); + this.container.style.setProperty('width', "".concat(width, "px")); + this.container.style.setProperty('height', 'auto'); + this.container.style.setProperty('position', 'fixed'); + this.popup.style.setProperty('visibility', 'visible'); + this.closeIcon.style.setProperty('visibility', 'visible'); + document.getElementById('wzrkImageOnlyDiv').style.visibility = 'visible'; + }; + } - _this3.popup.style.setProperty('visibility', 'visible'); + getRenderedImageWidth(img) { + const ratio = img.naturalWidth / img.naturalHeight; + return img.height * ratio; + } - _this3.closeIcon.style.setProperty('visibility', 'visible'); + } - document.getElementById('wzrkImageOnlyDiv').style.visibility = 'visible'; - }; - } - }, { - key: "getRenderedImageWidth", - value: function getRenderedImageWidth(img) { - var ratio = img.naturalWidth / img.naturalHeight; - return img.height * ratio; - } - }, { - key: "target", - get: function get() { - return this._target || ''; - }, - set: function set(val) { - if (this._target === null) { - this._target = val; - this.renderImageOnlyPopup(); - } - } - }, { - key: "session", - get: function get() { - return this._session || ''; - }, - set: function set(val) { - this._session = val; - } - }, { - key: "msgId", - get: function get() { - return this.target.wzrk_id; - } - }, { - key: "pivotId", - get: function get() { - return this.target.wzrk_pivot; - } - }, { - key: "onClickUrl", - get: function get() { - return this.target.display.onClickUrl; - } - }]); - - return CTWebPopupImageOnly; - }( /*#__PURE__*/_wrapNativeSuper(HTMLElement)); - - var Message = /*#__PURE__*/function (_HTMLElement) { - _inherits(Message, _HTMLElement); - - var _super = _createSuper(Message); - - function Message(config, message) { - var _this; - - _classCallCheck(this, Message); - - _this = _super.call(this); - _this.wrapper = null; - _this.snackBar = null; - _this.shadow = _this.attachShadow({ + class Message extends HTMLElement { + constructor(config, message) { + super(); + this.wrapper = null; + this.snackBar = null; + this.shadow = this.attachShadow({ mode: 'open' }); - _this.config = config; - _this.message = message; + this.config = config; + this.message = message; + this.renderMessage(message); + } + + get pivotId() { + return this.message.wzrk_pivot; + } + + get campaignId() { + return this.message.wzrk_id; + } + + createEl(type, id, part) { + const _el = document.createElement(type); - _this.renderMessage(message); + _el.setAttribute('id', id); - return _this; + _el.setAttribute('part', part || id); + + return _el; } - _createClass(Message, [{ - key: "createEl", - value: function createEl(type, id, part) { - var _el = document.createElement(type); + renderMessage(msg) { + this.wrapper = this.createEl('div', 'messageWrapper'); - _el.setAttribute('id', id); + switch (msg.templateType) { + case 'text-only': + case 'text-with-icon': + case 'text-with-icon-and-image': + { + const message = this.prepareBasicMessage(msg.msg[0]); + this.wrapper.appendChild(message); + } + } - _el.setAttribute('part', part || id); + const timeStamp = this.createEl('div', 'timeStamp'); + timeStamp.innerHTML = "".concat(determineTimeStampText(msg.id.split('_')[1]), ""); - return _el; + if (!msg.viewed) { + const unreadMarker = this.createEl('span', 'unreadMarker'); + timeStamp.appendChild(unreadMarker); } - }, { - key: "renderMessage", - value: function renderMessage(msg) { - this.wrapper = this.createEl('div', 'messageWrapper'); - switch (msg.templateType) { - case 'text-only': - case 'text-with-icon': - case 'text-with-icon-and-image': - { - var message = this.prepareBasicMessage(msg.msg[0]); - this.wrapper.appendChild(message); - } - } + this.wrapper.appendChild(timeStamp); + this.shadow.appendChild(this.wrapper); + } - var timeStamp = this.createEl('div', 'timeStamp'); - timeStamp.innerHTML = "".concat(determineTimeStampText(msg.id.split('_')[1]), ""); + prepareBasicMessage(msg) { + const message = this.createEl('div', 'message'); - if (!msg.viewed) { - var unreadMarker = this.createEl('span', 'unreadMarker'); - timeStamp.appendChild(unreadMarker); - } + if (msg.imageUrl) { + const imageContainer = this.addImage(msg.imageUrl, 'mainImg'); + message.appendChild(imageContainer); + } + + const iconTitleDescWrapper = this.createEl('div', 'iconTitleDescWrapper'); + + if (msg.iconUrl) { + const iconContainer = this.addImage(msg.iconUrl, 'iconImg'); + iconTitleDescWrapper.appendChild(iconContainer); + } + + const titleDescWrapper = this.createEl('div', 'titleDescWrapper'); - this.wrapper.appendChild(timeStamp); - this.shadow.appendChild(this.wrapper); + if (msg.title) { + const title = this.createEl('div', 'title'); + title.innerText = msg.title; + titleDescWrapper.appendChild(title); } - }, { - key: "prepareBasicMessage", - value: function prepareBasicMessage(msg) { - var message = this.createEl('div', 'message'); - if (msg.imageUrl) { - var imageContainer = this.addImage(msg.imageUrl, 'mainImg'); - message.appendChild(imageContainer); - } + if (msg.description) { + const description = this.createEl('div', 'description'); + description.innerText = msg.description; + titleDescWrapper.appendChild(description); + } - var iconTitleDescWrapper = this.createEl('div', 'iconTitleDescWrapper'); + if (msg.title || msg.description) { + iconTitleDescWrapper.appendChild(titleDescWrapper); + } - if (msg.iconUrl) { - var iconContainer = this.addImage(msg.iconUrl, 'iconImg'); - iconTitleDescWrapper.appendChild(iconContainer); - } + if (msg.iconUrl || msg.title || msg.description) { + message.appendChild(iconTitleDescWrapper); + } - var titleDescWrapper = this.createEl('div', 'titleDescWrapper'); + if (msg.buttons && msg.buttons.length) { + const buttonsContainer = this.addButtons(msg.buttons); + message.appendChild(buttonsContainer); + } - if (msg.title) { - var title = this.createEl('div', 'title'); - title.innerText = msg.title; - titleDescWrapper.appendChild(title); - } + return message; + } - if (msg.description) { - var description = this.createEl('div', 'description'); - description.innerText = msg.description; - titleDescWrapper.appendChild(description); - } + addButtons() { + let buttons = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + const buttonsContainer = this.createEl('div', 'buttonsContainer'); + let hasCopyAction = false; + buttons.forEach((b, i) => { + const button = this.createEl('button', "button-".concat(i), 'button'); + button.innerText = b.text; - if (msg.title || msg.description) { - iconTitleDescWrapper.appendChild(titleDescWrapper); + if (i > 0) { + button.style.cssText += 'margin-left: 2px;'; } - if (msg.iconUrl || msg.title || msg.description) { - message.appendChild(iconTitleDescWrapper); + if (b.action === 'copy') { + hasCopyAction = true; } - if (msg.buttons && msg.buttons.length) { - var buttonsContainer = this.addButtons(msg.buttons); - message.appendChild(buttonsContainer); - } + buttonsContainer.appendChild(button); + }); - return message; + if (hasCopyAction) { + this.addSnackbar(buttonsContainer); } - }, { - key: "addButtons", - value: function addButtons() { - var _this2 = this; - - var buttons = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - var buttonsContainer = this.createEl('div', 'buttonsContainer'); - var hasCopyAction = false; - buttons.forEach(function (b, i) { - var button = _this2.createEl('button', "button-".concat(i), 'button'); - button.innerText = b.text; + return buttonsContainer; + } - if (i > 0) { - button.style.cssText += 'margin-left: 2px;'; - } + addSnackbar(buttonsContainer) { + this.snackBar = this.createEl('div', "snackbar-".concat(this.campaignId), 'snackbar'); + this.snackBar.innerHTML = greenTickSvg; + const clipboardMsg = this.createEl('span', "snackbar-msg-".concat(this.campaignId), 'snackbar-msg'); + clipboardMsg.innerText = 'Copied to clipboard'; + this.snackBar.appendChild(clipboardMsg); + buttonsContainer.appendChild(this.snackBar); + } - if (b.action === 'copy') { - hasCopyAction = true; - } + addImage(url, type) { + const imageContainer = this.createEl('div', "".concat(type, "Container")); + const image = this.createEl('img', type); + image.setAttribute('src', url); // images will be fetched as and when the element comes into the viewport - buttonsContainer.appendChild(button); - }); + image.setAttribute('loading', 'lazy'); + imageContainer.appendChild(image); + return imageContainer; + } - if (hasCopyAction) { - this.addSnackbar(buttonsContainer); - } - - return buttonsContainer; - } - }, { - key: "addSnackbar", - value: function addSnackbar(buttonsContainer) { - this.snackBar = this.createEl('div', "snackbar-".concat(this.campaignId), 'snackbar'); - this.snackBar.innerHTML = greenTickSvg; - var clipboardMsg = this.createEl('span', "snackbar-msg-".concat(this.campaignId), 'snackbar-msg'); - clipboardMsg.innerText = 'Copied to clipboard'; - this.snackBar.appendChild(clipboardMsg); - buttonsContainer.appendChild(this.snackBar); - } - }, { - key: "addImage", - value: function addImage(url, type) { - var imageContainer = this.createEl('div', "".concat(type, "Container")); - var image = this.createEl('img', type); - image.setAttribute('src', url); // images will be fetched as and when the element comes into the viewport - - image.setAttribute('loading', 'lazy'); - imageContainer.appendChild(image); - return imageContainer; - } - }, { - key: "raiseClickedEvent", - value: function raiseClickedEvent(path, isPreview) { - switch (this.message.templateType) { - case 'text-only': - case 'text-with-icon': - case 'text-with-icon-and-image': - { - this.raiseClickedForBasicTemplates(path, isPreview); - } - } + raiseClickedEvent(path, isPreview) { + switch (this.message.templateType) { + case 'text-only': + case 'text-with-icon': + case 'text-with-icon-and-image': + { + this.raiseClickedForBasicTemplates(path, isPreview); + } } - }, { - key: "raiseClickedForBasicTemplates", - value: function raiseClickedForBasicTemplates(path, isPreview) { - var _this3 = this; - - var msg = this.message.msg[0]; - var payload = { - msgId: this.campaignId, - pivotId: this.pivotId - }; + } - if (path.tagName === 'BUTTON') { - var id = path.id.split('-')[1]; - var button = msg.buttons[id]; - payload.kv = { - wzrk_c2a: button.text - }; + raiseClickedForBasicTemplates(path, isPreview) { + const msg = this.message.msg[0]; + const payload = { + msgId: this.campaignId, + pivotId: this.pivotId + }; - if (button.action === 'url') { - button.openUrlInNewTab ? window.open(button.url, '_blank') : window.location = button.url; - } else if (button.action === 'copy') { - window.focus(); - navigator.clipboard.writeText(button.clipboardText); - this.snackBar.style.setProperty('display', 'flex', 'important'); - setTimeout(function () { - _this3.snackBar.style.setProperty('display', 'none', 'important'); - }, 2000); - } - } else if (path.tagName === 'CT-INBOX-MESSAGE' && msg.onClickUrl) { - msg.openUrlInNewTab ? window.open(msg.onClickUrl, '_blank') : window.location = msg.onClickUrl; - } + if (path.tagName === 'BUTTON') { + const id = path.id.split('-')[1]; + const button = msg.buttons[id]; + payload.kv = { + wzrk_c2a: button.text + }; - if (isPreview) { - console.log('Notifiction clicked event will be raised at run time with payload ::', payload); - } else { - window.clevertap.renderNotificationClicked(payload); + if (button.action === 'url') { + button.openUrlInNewTab ? window.open(button.url, '_blank') : window.location = button.url; + } else if (button.action === 'copy') { + window.focus(); + navigator.clipboard.writeText(button.clipboardText); + this.snackBar.style.setProperty('display', 'flex', 'important'); + setTimeout(() => { + this.snackBar.style.setProperty('display', 'none', 'important'); + }, 2000); } + } else if (path.tagName === 'CT-INBOX-MESSAGE' && msg.onClickUrl) { + msg.openUrlInNewTab ? window.open(msg.onClickUrl, '_blank') : window.location = msg.onClickUrl; } - }, { - key: "pivotId", - get: function get() { - return this.message.wzrk_pivot; - } - }, { - key: "campaignId", - get: function get() { - return this.message.wzrk_id; + + if (isPreview) { + console.log('Notifiction clicked event will be raised at run time with payload ::', payload); + } else { + window.clevertap.renderNotificationClicked(payload); } - }]); + } - return Message; - }( /*#__PURE__*/_wrapNativeSuper(HTMLElement)); + } - var messageStyles = function messageStyles(_ref) { - var backgroundColor = _ref.backgroundColor, - borderColor = _ref.borderColor, - titleColor = _ref.titleColor, - descriptionColor = _ref.descriptionColor, - buttonColor = _ref.buttonColor, - buttonTextColor = _ref.buttonTextColor, - unreadMarkerColor = _ref.unreadMarkerColor; + const messageStyles = (_ref) => { + let { + backgroundColor, + borderColor, + titleColor, + descriptionColor, + buttonColor, + buttonTextColor, + unreadMarkerColor + } = _ref; return "\n \n "); }; - var inboxContainerStyles = function inboxContainerStyles(_ref2) { - var panelBackgroundColor = _ref2.panelBackgroundColor, - panelBorderColor = _ref2.panelBorderColor, - headerBackgroundColor = _ref2.headerBackgroundColor, - headerTitleColor = _ref2.headerTitleColor, - closeIconColor = _ref2.closeIconColor, - categoriesTabColor = _ref2.categoriesTabColor, - categoriesTitleColor = _ref2.categoriesTitleColor, - categoriesBorderColor = _ref2.categoriesBorderColor, - selectedCategoryTabColor = _ref2.selectedCategoryTabColor, - selectedCategoryTitleColor = _ref2.selectedCategoryTitleColor, - selectedCategoryBorderColor = _ref2.selectedCategoryBorderColor, - headerCategoryHeight = _ref2.headerCategoryHeight; + const inboxContainerStyles = (_ref2) => { + let { + panelBackgroundColor, + panelBorderColor, + headerBackgroundColor, + headerTitleColor, + closeIconColor, + categoriesTabColor, + categoriesTitleColor, + categoriesBorderColor, + selectedCategoryTabColor, + selectedCategoryTitleColor, + selectedCategoryBorderColor, + headerCategoryHeight + } = _ref2; return "\n \n "); }; - var Inbox = /*#__PURE__*/function (_HTMLElement) { - _inherits(Inbox, _HTMLElement); - - var _super = _createSuper(Inbox); - - function Inbox(logger) { - var _this; - - _classCallCheck(this, Inbox); - - _this = _super.call(this); - _this.isInboxOpen = false; - _this.isInboxFromFlutter = false; - _this.selectedCategory = null; - _this.unviewedMessages = {}; - _this.unviewedCounter = 0; - _this.isPreview = false; - _this.inboxConfigForPreview = {}; - _this.inboxSelector = null; - _this.inbox = null; - _this.emptyInboxMsg = null; - _this.inboxCard = null; - _this.unviewedBadge = null; - _this.observer = null; - _this.selectedCategoryRef = null; - - _this.addClickListenerOnDocument = function () { - return function (e) { - if (e.composedPath().includes(_this.inbox)) { + class Inbox extends HTMLElement { + constructor(logger) { + super(); + this.isInboxOpen = false; + this.isInboxFromFlutter = false; + this.selectedCategory = null; + this.unviewedMessages = {}; + this.unviewedCounter = 0; + this.isPreview = false; + this.inboxConfigForPreview = {}; + this.inboxSelector = null; + this.inbox = null; + this.emptyInboxMsg = null; + this.inboxCard = null; + this.unviewedBadge = null; + this.observer = null; + this.selectedCategoryRef = null; + + this.addClickListenerOnDocument = (() => { + return e => { + if (e.composedPath().includes(this.inbox)) { // path is not supported on FF. So we fallback to e.composedPath - var path = e.path || e.composedPath && e.composedPath(); + const path = e.path || e.composedPath && e.composedPath(); if (path.length) { - var id = path[0].id; + const id = path[0].id; if (id === 'closeInbox') { - _this.toggleInbox(); + this.toggleInbox(); } else if (id.startsWith('category-')) { - _this.prevCategoryRef = _this.selectedCategoryRef; - _this.selectedCategoryRef = path[0]; - - _this.updateActiveCategory(path[0].innerText); + this.prevCategoryRef = this.selectedCategoryRef; + this.selectedCategoryRef = path[0]; + this.updateActiveCategory(path[0].innerText); } else { - var _path = path.filter(function (p) { + const _path = path.filter(p => { var _p$id; return ((_p$id = p.id) === null || _p$id === void 0 ? void 0 : _p$id.startsWith('button-')) || p.tagName === 'CT-INBOX-MESSAGE'; }); if (_path.length) { - var messageEl = _path[_path.length - 1]; - messageEl.raiseClickedEvent(_path[0], _this.isPreview); + const messageEl = _path[_path.length - 1]; + messageEl.raiseClickedEvent(_path[0], this.isPreview); } } } - } else if (_this.inboxSelector.contains(e.target) || _this.isInboxOpen) { - if (_this.isInboxFromFlutter) { - _this.isInboxFromFlutter = false; + } else if (this.inboxSelector.contains(e.target) || this.isInboxOpen) { + if (this.isInboxFromFlutter) { + this.isInboxFromFlutter = false; } else { - _this.toggleInbox(e); + this.toggleInbox(e); } } }; - }(); + })(); - _this.setBadgeStyle = function (msgCount) { - if (_this.unviewedBadge !== null) { - _this.unviewedBadge.innerText = msgCount > 9 ? '9+' : msgCount; - _this.unviewedBadge.style.display = msgCount > 0 ? 'flex' : 'none'; + this.setBadgeStyle = msgCount => { + if (this.unviewedBadge !== null) { + this.unviewedBadge.innerText = msgCount > 9 ? '9+' : msgCount; + this.unviewedBadge.style.display = msgCount > 0 ? 'flex' : 'none'; } }; - _this.logger = logger; - _this.shadow = _this.attachShadow({ + this.logger = logger; + this.shadow = this.attachShadow({ mode: 'open' }); - return _this; } - _createClass(Inbox, [{ - key: "connectedCallback", - value: function connectedCallback() { - this.init(); - } - }, { - key: "init", - value: function init() { - this.config = this.isPreview ? this.inboxConfigForPreview : StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}; - - if (Object.keys(this.config).length === 0) { - return; - } - - this.inboxSelector = document.getElementById(this.config.inboxSelector); + get incomingMessages() { + return []; + } - if (this.inboxSelector === null) { - return; - } + set incomingMessages(msgs) { + if (msgs === void 0) { + msgs = []; + } - if (this.config.styles.notificationsBadge) { - this.addUnviewedBadge(); - } else if (this.unviewedBadge) { - this.unviewedBadge.remove(); - } + if (msgs.length > 0 && this.inbox) { + this.updateInboxMessages(msgs); + } + } - this.createinbox(); - /** - * We need to remove the listener as there could be a scenario where init would be called when - * we get updated web inbox settings from LC after the inbox has been initialised. - * It can so happen that the inbox-selector would have changed. - */ + get incomingMessagesForPreview() { + return []; + } - document.removeEventListener('click', this.addClickListenerOnDocument); - document.addEventListener('click', this.addClickListenerOnDocument); - this.config.categories.length && this.updateActiveCategory(this.selectedCategoryRef.innerText); - this.shadow.innerHTML = this.getInboxStyles(); - this.shadow.appendChild(this.inbox); + set incomingMessagesForPreview(msgs) { + if (msgs === void 0) { + msgs = []; } - }, { - key: "addMsgsToInboxFromLS", - value: function addMsgsToInboxFromLS() { - var _this2 = this; - var messages = this.deleteExpiredAndGetUnexpiredMsgs(false); - var msgIds = messages ? Object.keys(messages) : []; - - if (msgIds.length === 0) { - return; - } + const previewMsgs = {}; - msgIds.forEach(function (m) { - if (!messages[m].viewed) { - _this2.unviewedMessages[m] = messages[m]; - _this2.unviewedCounter++; - } + if (msgs.length > 0 && this.inbox) { + this.isPreview = true; + this.unviewedCounter = 0; + msgs.forEach(m => { + const key = "".concat(m.wzrk_id.split('_')[0], "_").concat(Date.now()); + m.id = key; + previewMsgs[key] = m; + this.unviewedMessages[key] = m; + this.unviewedCounter++; }); - this.buildUIForMessages(messages); + this.buildUIForMessages(previewMsgs); this.updateUnviewedBadgeCounter(); } - /** - * @param {*} deleteMsgsFromUI - If this param is true, then we'll have to check the UI and delete expired messages from the DOM - * It'll be false when you are building the inbox layout for the very first time. - * - * This method reads the inbox messages from LS, - * based on the deleteMsgsFromUI flag deletes the expired messages from UI and decrements the unviewed counter if the message was not viewed, - * sorts the messages based on the date, - * saves the unexpired messages to LS - * and returns the sorted unexpired messages - * - * Scenarios when we encounter expired messages - - * 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 - * 2. UI is already built (deleteMsgsFromUI = true) and you open the inbox - * a. You'll find the expired msg in inbox - * b. You'll not find the expired msg in inbox. - * 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.) - * In both the above scenarios, we'll still have to decrement the unviewed counter if the message was not viewed. - */ - - }, { - key: "deleteExpiredAndGetUnexpiredMsgs", - value: function deleteExpiredAndGetUnexpiredMsgs() { - var deleteMsgsFromUI = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; - var messages = getInboxMessages(); - var now = Math.floor(Date.now() / 1000); - - for (var msg in messages) { - if (messages[msg].wzrk_ttl && messages[msg].wzrk_ttl > 0 && messages[msg].wzrk_ttl < now) { - if (deleteMsgsFromUI) { - var el = this.shadowRoot.getElementById(messages[msg].id); - el && el.remove(); - - if (!messages[msg].viewed) { - this.unviewedCounter--; - this.updateUnviewedBadgeCounter(); - } - } + } - delete messages[msg]; - } - } + connectedCallback() { + this.init(); + } - if (messages && messages.length > 0) { - messages = Object.values(messages).sort(function (a, b) { - return b.date - a.date; - }).reduce(function (acc, m) { - acc[m.id] = m; - return acc; - }, {}); - } + init() { + this.config = this.isPreview ? this.inboxConfigForPreview : StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}; - saveInboxMessages(messages); - return messages; - } - }, { - key: "updateInboxMessages", - value: function updateInboxMessages() { - var _this3 = this; - - var msgs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - var inboxMsgs = this.deleteExpiredAndGetUnexpiredMsgs(); - var date = Date.now(); - var incomingMsgs = {}; - msgs.forEach(function (m, i) { - var key = "".concat(m.wzrk_id.split('_')[0], "_").concat(Date.now()); - m.id = key; // We are doing this to preserve the order of the messages - - m.date = date - i; - m.viewed = 0; - inboxMsgs[key] = m; - incomingMsgs[key] = m; - _this3.unviewedMessages[key] = m; - _this3.unviewedCounter++; - }); - saveInboxMessages(inboxMsgs); - this.buildUIForMessages(incomingMsgs); - this.updateUnviewedBadgeCounter(); + if (Object.keys(this.config).length === 0) { + return; } - }, { - key: "createEl", - value: function createEl(type, id, part) { - var _el = document.createElement(type); - _el.setAttribute('id', id); + this.inboxSelector = document.getElementById(this.config.inboxSelector); - _el.setAttribute('part', part || id); + if (this.inboxSelector === null) { + return; + } - return _el; + if (this.config.styles.notificationsBadge) { + this.addUnviewedBadge(); + } else if (this.unviewedBadge) { + this.unviewedBadge.remove(); } - }, { - key: "addUnviewedBadge", - value: function addUnviewedBadge() { - var _this4 = this; - if (!this.unviewedBadge) { - this.unviewedBadge = this.createEl('div', 'unviewedBadge'); // As this unviewedBadge element will be directly added to the DOM, we are defining inline styles + this.createinbox(); + /** + * We need to remove the listener as there could be a scenario where init would be called when + * we get updated web inbox settings from LC after the inbox has been initialised. + * It can so happen that the inbox-selector would have changed. + */ - this.unviewedBadge.style.cssText = "display: none; position: absolute; height: 16px; width: 26px; border-radius: 8px; background-color: ".concat(this.config.styles.notificationsBadge.backgroundColor, "; font-size: 12px; color: ").concat(this.config.styles.notificationsBadge.textColor, "; font-weight: bold; align-items: center; justify-content: center;"); - document.body.appendChild(this.unviewedBadge); - } + document.removeEventListener('click', this.addClickListenerOnDocument); + document.addEventListener('click', this.addClickListenerOnDocument); + this.config.categories.length && this.updateActiveCategory(this.selectedCategoryRef.innerText); + this.shadow.innerHTML = this.getInboxStyles(); + this.shadow.appendChild(this.inbox); + } - this.updateUnviewedBadgePosition(); // called when user switches b/w portrait and landscape mode. + addMsgsToInboxFromLS() { + const messages = this.deleteExpiredAndGetUnexpiredMsgs(false); + const msgIds = messages ? Object.keys(messages) : []; - window.addEventListener('resize', function () { - _this4.updateUnviewedBadgePosition(); - }); + if (msgIds.length === 0) { + return; } - }, { - key: "updateUnviewedBadgePosition", - value: function updateUnviewedBadgePosition() { - var _this$inboxSelector$g = this.inboxSelector.getBoundingClientRect(), - top = _this$inboxSelector$g.top, - right = _this$inboxSelector$g.right; - - this.unviewedBadge.style.top = "".concat(top - 8, "px"); - this.unviewedBadge.style.left = "".concat(right - 8, "px"); - } - }, { - key: "createinbox", - value: function createinbox() { - var _this5 = this; - - this.inbox = this.createEl('div', 'inbox'); - var header = this.createEl('div', 'header'); - var headerTitle = this.createEl('div', 'headerTitle'); - headerTitle.innerText = this.config.title; - var closeIcon = this.createEl('div', 'closeInbox'); - closeIcon.innerHTML = '×'; - header.appendChild(headerTitle); - header.appendChild(closeIcon); - this.inbox.appendChild(header); - if (this.config.categories.length) { - var categories = this.createCategories(); - this.inbox.appendChild(categories); + msgIds.forEach(m => { + if (!messages[m].viewed) { + this.unviewedMessages[m] = messages[m]; + this.unviewedCounter++; } + }); + this.buildUIForMessages(messages); + this.updateUnviewedBadgeCounter(); + } + /** + * @param {*} deleteMsgsFromUI - If this param is true, then we'll have to check the UI and delete expired messages from the DOM + * It'll be false when you are building the inbox layout for the very first time. + * + * This method reads the inbox messages from LS, + * based on the deleteMsgsFromUI flag deletes the expired messages from UI and decrements the unviewed counter if the message was not viewed, + * sorts the messages based on the date, + * saves the unexpired messages to LS + * and returns the sorted unexpired messages + * + * Scenarios when we encounter expired messages - + * 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 + * 2. UI is already built (deleteMsgsFromUI = true) and you open the inbox + * a. You'll find the expired msg in inbox + * b. You'll not find the expired msg in inbox. + * 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.) + * In both the above scenarios, we'll still have to decrement the unviewed counter if the message was not viewed. + */ - this.inboxCard = this.createEl('div', 'inboxCard'); - this.inbox.appendChild(this.inboxCard); - this.emptyInboxMsg = this.createEl('div', 'emptyInboxMsg'); - this.emptyInboxMsg.innerText = 'All messages will be displayed here.'; - this.inboxCard.appendChild(this.emptyInboxMsg); // Intersection observer for notification viewed - - var options = { - root: this.inboxCard, - rootMargin: '0px', - threshold: 0.5 - }; - this.observer = new IntersectionObserver(function (entries, observer) { - _this5.handleMessageViewed(entries); - }, options); - this.addMsgsToInboxFromLS(); - } - }, { - key: "createCategories", - value: function createCategories() { - var _this6 = this; - - var categoriesContainer = this.createEl('div', 'categoriesContainer'); - var leftArrow = this.createEl('div', 'leftArrow'); - leftArrow.innerHTML = arrowSvg; - leftArrow.children[0].style = 'transform: rotate(180deg)'; - leftArrow.addEventListener('click', function () { - _this6.shadowRoot.getElementById('categoriesWrapper').scrollBy(-70, 0); - }); - categoriesContainer.appendChild(leftArrow); - var categoriesWrapper = this.createEl('div', 'categoriesWrapper'); - - var _categories = ['All'].concat(_toConsumableArray(this.config.categories)); - - _categories.forEach(function (c, i) { - var category = _this6.createEl('div', "category-".concat(i), 'category'); - - category.innerText = c; - - if (i === 0) { - _this6.selectedCategoryRef = category; - } - - categoriesWrapper.appendChild(category); - }); - categoriesContainer.appendChild(categoriesWrapper); - var rightArrow = this.createEl('div', 'rightArrow'); - rightArrow.innerHTML = arrowSvg; - rightArrow.addEventListener('click', function () { - _this6.shadowRoot.getElementById('categoriesWrapper').scrollBy(70, 0); - }); - categoriesContainer.appendChild(rightArrow); - var options = { - root: categoriesContainer, - threshold: 0.9 - }; - var firstCategory = categoriesWrapper.children[0]; - var lastCategory = categoriesWrapper.children[this.config.categories.length]; - var firstCategoryObserver = new IntersectionObserver(function (e) { - _this6.categoryObserverCb(leftArrow, e[0].intersectionRatio >= 0.9); - }, options); - firstCategoryObserver.observe(firstCategory); - var lastCategoryObserver = new IntersectionObserver(function (e) { - _this6.categoryObserverCb(rightArrow, e[0].intersectionRatio >= 0.9); - }, options); - lastCategoryObserver.observe(lastCategory); - return categoriesContainer; - } - }, { - key: "categoryObserverCb", - value: function categoryObserverCb(el, hide) { - if (!el) { - return; - } + deleteExpiredAndGetUnexpiredMsgs() { + let deleteMsgsFromUI = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + let messages = getInboxMessages(); + const now = Math.floor(Date.now() / 1000); - el.style.display = hide ? 'none' : 'flex'; - } - }, { - key: "updateActiveCategory", - value: function updateActiveCategory(activeCategory) { - var _this7 = this; + for (const msg in messages) { + if (messages[msg].wzrk_ttl && messages[msg].wzrk_ttl > 0 && messages[msg].wzrk_ttl < now) { + if (deleteMsgsFromUI) { + const el = this.shadowRoot.getElementById(messages[msg].id); + el && el.remove(); - this.selectedCategory = activeCategory; - this.inboxCard.scrollTop = 0; - var counter = 0; - this.prevCategoryRef && this.prevCategoryRef.setAttribute('selected', 'false'); - this.selectedCategoryRef.setAttribute('selected', 'true'); - this.inboxCard.childNodes.forEach(function (c) { - if (c.getAttribute('id') !== 'emptyInboxMsg') { - c.style.display = _this7.selectedCategory === 'All' || c.getAttribute('category') === _this7.selectedCategory ? 'block' : 'none'; - - if (c.style.display === 'block') { - counter++; + if (!messages[msg].viewed) { + this.unviewedCounter--; + this.updateUnviewedBadgeCounter(); } } - }); - if (counter === 0) { - this.emptyInboxMsg.innerText = "".concat(activeCategory, " messages will be displayed here."); - this.emptyInboxMsg.style.display = 'block'; - } else { - this.emptyInboxMsg.style.display = 'none'; + delete messages[msg]; } } - }, { - key: "buildUIForMessages", - value: function buildUIForMessages() { - var _this$config$maxMsgsI; - var messages = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - !this.isPreview && this.updateTSForRenderedMsgs(); - this.inboxCard.scrollTop = 0; - var maxMsgsInInbox = (_this$config$maxMsgsI = this.config.maxMsgsInInbox) !== null && _this$config$maxMsgsI !== void 0 ? _this$config$maxMsgsI : MAX_INBOX_MSG; - var firstChild = this.inboxCard.firstChild; - var sortedMsgs = Object.values(messages).sort(function (a, b) { - return b.date - a.date; - }).map(function (m) { - return m.id; - }); + if (messages && messages.length > 0) { + messages = Object.values(messages).sort((a, b) => b.date - a.date).reduce((acc, m) => { + acc[m.id] = m; + return acc; + }, {}); + } - var _iterator = _createForOfIteratorHelper(sortedMsgs), - _step; + saveInboxMessages(messages); + return messages; + } - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var m = _step.value; - var item = new Message(this.config, messages[m]); - item.setAttribute('id', messages[m].id); - item.setAttribute('pivot', messages[m].wzrk_pivot); - item.setAttribute('part', 'ct-inbox-message'); - - if (this.config.categories.length > 0) { - item.setAttribute('category', messages[m].tags[0] || ''); - item.style.display = this.selectedCategory === 'All' || messages[m].category === this.selectedCategory ? 'block' : 'none'; - } else { - item.style.display = 'block'; - } + updateInboxMessages() { + let msgs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + const inboxMsgs = this.deleteExpiredAndGetUnexpiredMsgs(); + const date = Date.now(); + const incomingMsgs = {}; + msgs.forEach((m, i) => { + const key = "".concat(m.wzrk_id.split('_')[0], "_").concat(Date.now()); + m.id = key; // We are doing this to preserve the order of the messages + + m.date = date - i; + m.viewed = 0; + inboxMsgs[key] = m; + incomingMsgs[key] = m; + this.unviewedMessages[key] = m; + this.unviewedCounter++; + }); + saveInboxMessages(inboxMsgs); + this.buildUIForMessages(incomingMsgs); + this.updateUnviewedBadgeCounter(); + } - this.inboxCard.insertBefore(item, firstChild); - this.observer.observe(item); - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } + createEl(type, id, part) { + const _el = document.createElement(type); - var msgTotalCount = this.inboxCard.querySelectorAll('ct-inbox-message').length; + _el.setAttribute('id', id); - while (msgTotalCount > maxMsgsInInbox) { - var ctInboxMsgs = this.inboxCard.querySelectorAll('ct-inbox-message'); + _el.setAttribute('part', part || id); - if (ctInboxMsgs.length > 0) { - ctInboxMsgs[ctInboxMsgs.length - 1].remove(); - } + return _el; + } - msgTotalCount--; - } + addUnviewedBadge() { + if (!this.unviewedBadge) { + this.unviewedBadge = this.createEl('div', 'unviewedBadge'); // As this unviewedBadge element will be directly added to the DOM, we are defining inline styles - var hasMessages = this.inboxCard.querySelectorAll('ct-inbox-message[style*="display: block"]').length; - this.emptyInboxMsg.style.display = hasMessages ? 'none' : 'block'; + this.unviewedBadge.style.cssText = "display: none; position: absolute; height: 16px; width: 26px; border-radius: 8px; background-color: ".concat(this.config.styles.notificationsBadge.backgroundColor, "; font-size: 12px; color: ").concat(this.config.styles.notificationsBadge.textColor, "; font-weight: bold; align-items: center; justify-content: center;"); + document.body.appendChild(this.unviewedBadge); } - /** - * Adds a click listener on the document. For every click we check - * 1. if the click has happenned within the inbox - * - on close button, we close the inbox - * - on any of the category, we set that as the activeCategory - * - on any of the message, we mark raise notification clicked event. To identify the clicks on a button, we have p.id.startsWith('button-') - * 2. if the user has clicked on the inboxSelector, we toggle inbox - * 3. if the click is anywhere else on the UI and the inbox is open, we simply close it - */ - }, { - key: "handleMessageViewed", + this.updateUnviewedBadgePosition(); // called when user switches b/w portrait and landscape mode. - /** - * 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% - * If a msg is 50% visible in the UI, we need to mark the message as viewed in LS and raise notification viewed event - */ - value: function handleMessageViewed(entries) { - var _this8 = this; + window.addEventListener('resize', () => { + this.updateUnviewedBadgePosition(); + }); + } - var raiseViewedEvent = !this.isPreview; + updateUnviewedBadgePosition() { + const { + top, + right + } = this.inboxSelector.getBoundingClientRect(); + this.unviewedBadge.style.top = "".concat(top - 8, "px"); + this.unviewedBadge.style.left = "".concat(right - 8, "px"); + } - if (this.isInboxOpen) { - entries.forEach(function (e) { - if (e.isIntersecting && _this8.unviewedMessages.hasOwnProperty(e.target.id) && e.target.message.viewed === 0) { - e.target.message.viewed = 1; + createinbox() { + this.inbox = this.createEl('div', 'inbox'); + const header = this.createEl('div', 'header'); + const headerTitle = this.createEl('div', 'headerTitle'); + headerTitle.innerText = this.config.title; + const closeIcon = this.createEl('div', 'closeInbox'); + closeIcon.innerHTML = '×'; + header.appendChild(headerTitle); + header.appendChild(closeIcon); + this.inbox.appendChild(header); + + if (this.config.categories.length) { + const categories = this.createCategories(); + this.inbox.appendChild(categories); + } + + this.inboxCard = this.createEl('div', 'inboxCard'); + this.inbox.appendChild(this.inboxCard); + this.emptyInboxMsg = this.createEl('div', 'emptyInboxMsg'); + this.emptyInboxMsg.innerText = 'All messages will be displayed here.'; + this.inboxCard.appendChild(this.emptyInboxMsg); // Intersection observer for notification viewed + + const options = { + root: this.inboxCard, + rootMargin: '0px', + threshold: 0.5 + }; + this.observer = new IntersectionObserver((entries, observer) => { + this.handleMessageViewed(entries); + }, options); + this.addMsgsToInboxFromLS(); + } - if (raiseViewedEvent) { - window.clevertap.renderNotificationViewed({ - msgId: e.target.campaignId, - pivotId: e.target.pivotId - }); + createCategories() { + const categoriesContainer = this.createEl('div', 'categoriesContainer'); + const leftArrow = this.createEl('div', 'leftArrow'); + leftArrow.innerHTML = arrowSvg; + leftArrow.children[0].style = 'transform: rotate(180deg)'; + leftArrow.addEventListener('click', () => { + this.shadowRoot.getElementById('categoriesWrapper').scrollBy(-70, 0); + }); + categoriesContainer.appendChild(leftArrow); + const categoriesWrapper = this.createEl('div', 'categoriesWrapper'); + const _categories = ['All', ...this.config.categories]; - _this8.updateMessageInLS(e.target.id, _objectSpread2(_objectSpread2({}, e.target.message), {}, { - viewed: 1 - })); + _categories.forEach((c, i) => { + const category = this.createEl('div', "category-".concat(i), 'category'); + category.innerText = c; - setTimeout(function () { - e.target.shadowRoot.getElementById('unreadMarker').style.display = 'none'; - }, 1000); - } else { - console.log('Notifiction viewed event will be raised at run time with payload ::', { - msgId: e.target.campaignId, - pivotId: e.target.pivotId - }); - } + if (i === 0) { + this.selectedCategoryRef = category; + } - _this8.unviewedCounter--; + categoriesWrapper.appendChild(category); + }); - _this8.updateUnviewedBadgeCounter(); + categoriesContainer.appendChild(categoriesWrapper); + const rightArrow = this.createEl('div', 'rightArrow'); + rightArrow.innerHTML = arrowSvg; + rightArrow.addEventListener('click', () => { + this.shadowRoot.getElementById('categoriesWrapper').scrollBy(70, 0); + }); + categoriesContainer.appendChild(rightArrow); + const options = { + root: categoriesContainer, + threshold: 0.9 + }; + const firstCategory = categoriesWrapper.children[0]; + const lastCategory = categoriesWrapper.children[this.config.categories.length]; + const firstCategoryObserver = new IntersectionObserver(e => { + this.categoryObserverCb(leftArrow, e[0].intersectionRatio >= 0.9); + }, options); + firstCategoryObserver.observe(firstCategory); + const lastCategoryObserver = new IntersectionObserver(e => { + this.categoryObserverCb(rightArrow, e[0].intersectionRatio >= 0.9); + }, options); + lastCategoryObserver.observe(lastCategory); + return categoriesContainer; + } - delete _this8.unviewedMessages[e.target.id]; - } - }); - } + categoryObserverCb(el, hide) { + if (!el) { + return; } - }, { - key: "updateMessageInLS", - value: function updateMessageInLS(key, value) { - if (!this.isPreview) { - var messages = getInboxMessages(); - messages[key] = value; - saveInboxMessages(messages); - } - } // create a separte fn fro refactoring - - }, { - key: "toggleInbox", - value: function toggleInbox(e) { - this.isInboxOpen = !this.isInboxOpen; - this.isInboxFromFlutter = !!(e === null || e === void 0 ? void 0 : e.rect); - - if (this.isInboxOpen) { - this.inboxCard.scrollTop = 0; - !this.isPreview && this.deleteExpiredAndGetUnexpiredMsgs(); - this.inbox.style.display = 'block'; - this.inbox.style.zIndex = '2147483647'; // zIndex should be max for the inbox to be rendered on top of all elements - - if (this.config.categories.length) { - this.selectedCategoryRef.setAttribute('selected', 'false'); - this.selectedCategoryRef = this.shadowRoot.getElementById('category-0'); - this.updateActiveCategory(this.selectedCategoryRef.innerText); - this.shadowRoot.getElementById('categoriesWrapper').scrollLeft -= this.shadowRoot.getElementById('categoriesWrapper').scrollWidth; + + el.style.display = hide ? 'none' : 'flex'; + } + + updateActiveCategory(activeCategory) { + this.selectedCategory = activeCategory; + this.inboxCard.scrollTop = 0; + let counter = 0; + this.prevCategoryRef && this.prevCategoryRef.setAttribute('selected', 'false'); + this.selectedCategoryRef.setAttribute('selected', 'true'); + this.inboxCard.childNodes.forEach(c => { + if (c.getAttribute('id') !== 'emptyInboxMsg') { + c.style.display = this.selectedCategory === 'All' || c.getAttribute('category') === this.selectedCategory ? 'block' : 'none'; + + if (c.style.display === 'block') { + counter++; } + } + }); + + if (counter === 0) { + this.emptyInboxMsg.innerText = "".concat(activeCategory, " messages will be displayed here."); + this.emptyInboxMsg.style.display = 'block'; + } else { + this.emptyInboxMsg.style.display = 'none'; + } + } - this.setInboxPosition(e); + buildUIForMessages() { + var _this$config$maxMsgsI; + + let messages = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + !this.isPreview && this.updateTSForRenderedMsgs(); + this.inboxCard.scrollTop = 0; + const maxMsgsInInbox = (_this$config$maxMsgsI = this.config.maxMsgsInInbox) !== null && _this$config$maxMsgsI !== void 0 ? _this$config$maxMsgsI : MAX_INBOX_MSG; + const firstChild = this.inboxCard.firstChild; + const sortedMsgs = Object.values(messages).sort((a, b) => b.date - a.date).map(m => m.id); + + for (const m of sortedMsgs) { + const item = new Message(this.config, messages[m]); + item.setAttribute('id', messages[m].id); + item.setAttribute('pivot', messages[m].wzrk_pivot); + item.setAttribute('part', 'ct-inbox-message'); + + if (this.config.categories.length > 0) { + item.setAttribute('category', messages[m].tags[0] || ''); + item.style.display = this.selectedCategory === 'All' || messages[m].category === this.selectedCategory ? 'block' : 'none'; } else { - this.inbox.style.display = 'none'; + item.style.display = 'block'; } + + this.inboxCard.insertBefore(item, firstChild); + this.observer.observe(item); } - }, { - key: "setInboxPosition", - value: function setInboxPosition(e) { - var windowWidth = window.outerWidth; - var customInboxStyles = getComputedStyle($ct.inbox); - var top = customInboxStyles.getPropertyValue('--inbox-top'); - var bottom = customInboxStyles.getPropertyValue('--inbox-bottom'); - var left = customInboxStyles.getPropertyValue('--inbox-left'); - var right = customInboxStyles.getPropertyValue('--inbox-right'); - var hasPositionDefined = top || bottom || left || right; - if (windowWidth > 481 && !hasPositionDefined) { - var res = getInboxPosition(e, this.inbox.clientHeight, this.inbox.clientWidth); - var xPos = res.xPos; - var yPos = res.yPos; - this.inbox.style.top = yPos + 'px'; - this.inbox.style.left = xPos + 'px'; + let msgTotalCount = this.inboxCard.querySelectorAll('ct-inbox-message').length; + + while (msgTotalCount > maxMsgsInInbox) { + const ctInboxMsgs = this.inboxCard.querySelectorAll('ct-inbox-message'); + + if (ctInboxMsgs.length > 0) { + ctInboxMsgs[ctInboxMsgs.length - 1].remove(); } + + msgTotalCount--; } - /** - * Updates the UI with the number of unviewed messages - * If there are more than 9 unviewed messages, we show the count as 9+ - */ - }, { - key: "updateUnviewedBadgeCounter", - value: function updateUnviewedBadgeCounter() { - if (this.isPreview) { - this.setBadgeStyle(this.unviewedCounter); - return; - } + const hasMessages = this.inboxCard.querySelectorAll('ct-inbox-message[style*="display: block"]').length; + this.emptyInboxMsg.style.display = hasMessages ? 'none' : 'block'; + } + /** + * Adds a click listener on the document. For every click we check + * 1. if the click has happenned within the inbox + * - on close button, we close the inbox + * - on any of the category, we set that as the activeCategory + * - on any of the message, we mark raise notification clicked event. To identify the clicks on a button, we have p.id.startsWith('button-') + * 2. if the user has clicked on the inboxSelector, we toggle inbox + * 3. if the click is anywhere else on the UI and the inbox is open, we simply close it + */ - var counter = 0; - this.inboxCard.querySelectorAll('ct-inbox-message').forEach(function (m) { - var messages = getInboxMessages(); - if (messages[m.id] && messages[m.id].viewed === 0) { - counter++; + /** + * 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% + * If a msg is 50% visible in the UI, we need to mark the message as viewed in LS and raise notification viewed event + */ + handleMessageViewed(entries) { + const raiseViewedEvent = !this.isPreview; + + if (this.isInboxOpen) { + entries.forEach(e => { + if (e.isIntersecting && this.unviewedMessages.hasOwnProperty(e.target.id) && e.target.message.viewed === 0) { + e.target.message.viewed = 1; + + if (raiseViewedEvent) { + window.clevertap.renderNotificationViewed({ + msgId: e.target.campaignId, + pivotId: e.target.pivotId + }); + this.updateMessageInLS(e.target.id, { ...e.target.message, + viewed: 1 + }); + setTimeout(() => { + e.target.shadowRoot.getElementById('unreadMarker').style.display = 'none'; + }, 1000); + } else { + console.log('Notifiction viewed event will be raised at run time with payload ::', { + msgId: e.target.campaignId, + pivotId: e.target.pivotId + }); + } + + this.unviewedCounter--; + this.updateUnviewedBadgeCounter(); + delete this.unviewedMessages[e.target.id]; } }); - this.setBadgeStyle(counter); - } - }, { - key: "updateTSForRenderedMsgs", - value: function updateTSForRenderedMsgs() { - this.inboxCard.querySelectorAll('ct-inbox-message').forEach(function (m) { - var ts = m.id.split('_')[1]; - m.shadow.getElementById('timeStamp').firstChild.innerText = determineTimeStampText(ts); - }); } - }, { - key: "getInboxStyles", - value: function getInboxStyles() { - var headerHeight = 36; - var categoriesHeight = this.config.categories.length ? 64 : 16; - var styles = { - panelBackgroundColor: this.config.styles.panelBackgroundColor, - panelBorderColor: this.config.styles.panelBorderColor, - headerBackgroundColor: this.config.styles.header.backgroundColor, - headerTitleColor: this.config.styles.header.titleColor, - closeIconColor: this.config.styles.closeIconColor, - categoriesTabColor: this.config.styles.categories.tabColor, - categoriesTitleColor: this.config.styles.categories.titleColor, - selectedCategoryTabColor: this.config.styles.categories.selectedTab.tabColor, - selectedCategoryTitleColor: this.config.styles.categories.selectedTab.titleColor, - headerCategoryHeight: headerHeight + categoriesHeight - }; + } + + updateMessageInLS(key, value) { + if (!this.isPreview) { + const messages = getInboxMessages(); + messages[key] = value; + saveInboxMessages(messages); + } + } // create a separte fn fro refactoring - if (this.config.styles.categories.borderColor) { - styles.categoriesBorderColor = this.config.styles.categories.borderColor; - } - if (this.config.styles.categories.selectedTab.borderColor) { - styles.selectedCategoryBorderColor = this.config.styles.categories.selectedTab.borderColor; + toggleInbox(e) { + this.isInboxOpen = !this.isInboxOpen; + this.isInboxFromFlutter = !!(e === null || e === void 0 ? void 0 : e.rect); + + if (this.isInboxOpen) { + this.inboxCard.scrollTop = 0; + !this.isPreview && this.deleteExpiredAndGetUnexpiredMsgs(); + this.inbox.style.display = 'block'; + this.inbox.style.zIndex = '2147483647'; // zIndex should be max for the inbox to be rendered on top of all elements + + if (this.config.categories.length) { + this.selectedCategoryRef.setAttribute('selected', 'false'); + this.selectedCategoryRef = this.shadowRoot.getElementById('category-0'); + this.updateActiveCategory(this.selectedCategoryRef.innerText); + this.shadowRoot.getElementById('categoriesWrapper').scrollLeft -= this.shadowRoot.getElementById('categoriesWrapper').scrollWidth; } - var inboxStyles = inboxContainerStyles(styles); - var cardStyles = this.config.styles.cards; - var msgStyles = messageStyles({ - backgroundColor: cardStyles.backgroundColor, - borderColor: cardStyles.borderColor, - titleColor: cardStyles.titleColor, - descriptionColor: cardStyles.descriptionColor, - buttonColor: cardStyles.buttonColor, - buttonTextColor: cardStyles.buttonTextColor, - unreadMarkerColor: cardStyles.unreadMarkerColor - }); - return inboxStyles + msgStyles; - } - }, { - key: "incomingMessages", - get: function get() { - return []; - }, - set: function set() { - var msgs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - - if (msgs.length > 0 && this.inbox) { - this.updateInboxMessages(msgs); - } - } - }, { - key: "incomingMessagesForPreview", - get: function get() { - return []; - }, - set: function set() { - var _this9 = this; - - var msgs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - var previewMsgs = {}; - - if (msgs.length > 0 && this.inbox) { - this.isPreview = true; - this.unviewedCounter = 0; - msgs.forEach(function (m) { - var key = "".concat(m.wzrk_id.split('_')[0], "_").concat(Date.now()); - m.id = key; - previewMsgs[key] = m; - _this9.unviewedMessages[key] = m; - _this9.unviewedCounter++; - }); - this.buildUIForMessages(previewMsgs); - this.updateUnviewedBadgeCounter(); + this.setInboxPosition(e); + } else { + this.inbox.style.display = 'none'; + } + } + + setInboxPosition(e) { + const windowWidth = window.outerWidth; + const customInboxStyles = getComputedStyle($ct.inbox); + const top = customInboxStyles.getPropertyValue('--inbox-top'); + const bottom = customInboxStyles.getPropertyValue('--inbox-bottom'); + const left = customInboxStyles.getPropertyValue('--inbox-left'); + const right = customInboxStyles.getPropertyValue('--inbox-right'); + const hasPositionDefined = top || bottom || left || right; + + if (windowWidth > 481 && !hasPositionDefined) { + const res = getInboxPosition(e, this.inbox.clientHeight, this.inbox.clientWidth); + const xPos = res.xPos; + const yPos = res.yPos; + this.inbox.style.top = yPos + 'px'; + this.inbox.style.left = xPos + 'px'; + } + } + /** + * Updates the UI with the number of unviewed messages + * If there are more than 9 unviewed messages, we show the count as 9+ + */ + + + updateUnviewedBadgeCounter() { + if (this.isPreview) { + this.setBadgeStyle(this.unviewedCounter); + return; + } + + let counter = 0; + this.inboxCard.querySelectorAll('ct-inbox-message').forEach(m => { + const messages = getInboxMessages(); + + if (messages[m.id] && messages[m.id].viewed === 0) { + counter++; } + }); + this.setBadgeStyle(counter); + } + + updateTSForRenderedMsgs() { + this.inboxCard.querySelectorAll('ct-inbox-message').forEach(m => { + const ts = m.id.split('_')[1]; + m.shadow.getElementById('timeStamp').firstChild.innerText = determineTimeStampText(ts); + }); + } + + getInboxStyles() { + const headerHeight = 36; + const categoriesHeight = this.config.categories.length ? 64 : 16; + const styles = { + panelBackgroundColor: this.config.styles.panelBackgroundColor, + panelBorderColor: this.config.styles.panelBorderColor, + headerBackgroundColor: this.config.styles.header.backgroundColor, + headerTitleColor: this.config.styles.header.titleColor, + closeIconColor: this.config.styles.closeIconColor, + categoriesTabColor: this.config.styles.categories.tabColor, + categoriesTitleColor: this.config.styles.categories.titleColor, + selectedCategoryTabColor: this.config.styles.categories.selectedTab.tabColor, + selectedCategoryTitleColor: this.config.styles.categories.selectedTab.titleColor, + headerCategoryHeight: headerHeight + categoriesHeight + }; + + if (this.config.styles.categories.borderColor) { + styles.categoriesBorderColor = this.config.styles.categories.borderColor; } - }]); - return Inbox; - }( /*#__PURE__*/_wrapNativeSuper(HTMLElement)); + if (this.config.styles.categories.selectedTab.borderColor) { + styles.selectedCategoryBorderColor = this.config.styles.categories.selectedTab.borderColor; + } + + const inboxStyles = inboxContainerStyles(styles); + const cardStyles = this.config.styles.cards; + const msgStyles = messageStyles({ + backgroundColor: cardStyles.backgroundColor, + borderColor: cardStyles.borderColor, + titleColor: cardStyles.titleColor, + descriptionColor: cardStyles.descriptionColor, + buttonColor: cardStyles.buttonColor, + buttonTextColor: cardStyles.buttonTextColor, + unreadMarkerColor: cardStyles.unreadMarkerColor + }); + return inboxStyles + msgStyles; + } - var processWebInboxSettings = function processWebInboxSettings(webInboxSetting) { - var isPreview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + } + + const processWebInboxSettings = function (webInboxSetting) { + let isPreview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var _settings = StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}; + const _settings = StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}; if (isPreview) { $ct.inbox.inboxConfigForPreview = webInboxSetting; @@ -4858,26 +4254,26 @@ $ct.inbox && $ct.inbox.init(); } }; - var processInboxNotifs = function processInboxNotifs(msg) { + const processInboxNotifs = msg => { if (msg.inbox_preview) { $ct.inbox.incomingMessagesForPreview = msg.inbox_notifs; } else { $ct.inbox.incomingMessages = msg; } }; - var addWebInbox = function addWebInbox(logger) { + const addWebInbox = logger => { checkAndRegisterWebInboxElements(); $ct.inbox = new Inbox({ - logger: logger + logger }); document.body.appendChild($ct.inbox); }; - var getAndMigrateInboxMessages = function getAndMigrateInboxMessages(guid) { - var messages = StorageManager.readFromLSorCookie(WEBINBOX) || {}; // Doing this to migrate message to guid level + const getAndMigrateInboxMessages = guid => { + const messages = StorageManager.readFromLSorCookie(WEBINBOX) || {}; // Doing this to migrate message to guid level if (Object.keys(messages).length > 0 && Object.keys(messages)[0].includes('_')) { - var gudInboxObj = {}; + const gudInboxObj = {}; gudInboxObj[guid] = messages; StorageManager.saveToLSorCookie(WEBINBOX, gudInboxObj); return gudInboxObj; @@ -4886,38 +4282,38 @@ return messages; }; - var getInboxMessages = function getInboxMessages() { - var guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME))); + const getInboxMessages = () => { + const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME))); if (!isValueValid(guid)) { return {}; } - var messages = getAndMigrateInboxMessages(guid); + const messages = getAndMigrateInboxMessages(guid); return messages.hasOwnProperty(guid) ? messages[guid] : {}; }; - var saveInboxMessages = function saveInboxMessages(messages) { - var guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME))); + const saveInboxMessages = messages => { + const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME))); if (!isValueValid(guid)) { return; } - var storedInboxObj = getAndMigrateInboxMessages(guid); - - var newObj = _objectSpread2(_objectSpread2({}, storedInboxObj), {}, _defineProperty({}, guid, messages)); - + const storedInboxObj = getAndMigrateInboxMessages(guid); + const newObj = { ...storedInboxObj, + [guid]: messages + }; StorageManager.saveToLSorCookie(WEBINBOX, newObj); }; - var initializeWebInbox = function initializeWebInbox(logger) { - return new Promise(function (resolve, reject) { + const initializeWebInbox = logger => { + return new Promise((resolve, reject) => { if (document.readyState === 'complete') { addWebInbox(logger); resolve(); } else { - var config = StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}; + const config = StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}; - var onLoaded = function onLoaded() { + const onLoaded = () => { /** * We need this null check here because $ct.inbox could be initialised via init method too on document load. * In that case we don't need to call addWebInbox method @@ -4929,7 +4325,7 @@ resolve(); }; - window.addEventListener('load', function () { + window.addEventListener('load', () => { /** * Scripts can be loaded layzily, we may not get element from dom as it may not be mounted yet * We will to check element for 10 seconds and give up @@ -4938,10 +4334,10 @@ onLoaded(); } else { // check for element for next 10 seconds - var count = 0; + let count = 0; if (count < 20) { - var t = setInterval(function () { + const t = setInterval(() => { if (document.getElementById(config.inboxSelector)) { onLoaded(); clearInterval(t); @@ -4959,36 +4355,36 @@ } }); }; - var checkAndRegisterWebInboxElements = function checkAndRegisterWebInboxElements() { + const checkAndRegisterWebInboxElements = () => { if (customElements.get('ct-web-inbox') === undefined) { customElements.define('ct-web-inbox', Inbox); customElements.define('ct-inbox-message', Message); } }; - var getInboxPosition = function getInboxPosition(e, inboxHeight, inboxWidth) { - var horizontalScroll = document.scrollingElement.scrollLeft; - var verticalScroll = document.scrollingElement.scrollTop; - var windowWidth = window.innerWidth + horizontalScroll; - var windowHeight = window.innerHeight + verticalScroll; - var selectorRect = e.rect || e.target.getBoundingClientRect(); - var selectorX = selectorRect.x + horizontalScroll; - var selectorY = selectorRect.y + verticalScroll; - var selectorLeft = selectorRect.left + horizontalScroll; - var selectorRight = selectorRect.right + horizontalScroll; - var selectorTop = selectorRect.top + verticalScroll; // const selectorBottom = selectorRect.bottom + verticalScroll - - var selectorBottom = selectorRect.bottom; - var selectorHeight = selectorRect.height; - var selectorWidth = selectorRect.width; - var selectorCenter = { + const getInboxPosition = (e, inboxHeight, inboxWidth) => { + const horizontalScroll = document.scrollingElement.scrollLeft; + const verticalScroll = document.scrollingElement.scrollTop; + const windowWidth = window.innerWidth + horizontalScroll; + const windowHeight = window.innerHeight + verticalScroll; + const selectorRect = e.rect || e.target.getBoundingClientRect(); + const selectorX = selectorRect.x + horizontalScroll; + const selectorY = selectorRect.y + verticalScroll; + const selectorLeft = selectorRect.left + horizontalScroll; + const selectorRight = selectorRect.right + horizontalScroll; + const selectorTop = selectorRect.top + verticalScroll; // const selectorBottom = selectorRect.bottom + verticalScroll + + const selectorBottom = selectorRect.bottom; + const selectorHeight = selectorRect.height; + const selectorWidth = selectorRect.width; + const selectorCenter = { x: selectorX + selectorWidth / 2, y: selectorY + selectorHeight / 2 }; - var halfOfInboxHeight = inboxHeight / 2; - var halfOfInboxWidth = inboxWidth / 2; - var inboxOnSide = false; - var xPos, yPos; - var padding = 16; + const halfOfInboxHeight = inboxHeight / 2; + const halfOfInboxWidth = inboxWidth / 2; + let inboxOnSide = false; + let xPos, yPos; + const padding = 16; /** * y co-ordinates: * Try to push the card downwards @@ -5011,13 +4407,12 @@ if (selectorBottom + inboxHeight <= windowHeight) { // try to place the card down - var availableHeight = windowHeight - (selectorBottom + inboxHeight); + const availableHeight = windowHeight - (selectorBottom + inboxHeight); yPos = availableHeight >= padding ? selectorBottom + padding : selectorBottom + availableHeight; } else if (selectorTop - inboxHeight >= verticalScroll) { // try to place the card up - var _availableHeight = selectorTop - inboxHeight; - - yPos = _availableHeight >= padding ? selectorTop - inboxHeight - padding : selectorTop - inboxHeight - _availableHeight; + const availableHeight = selectorTop - inboxHeight; + yPos = availableHeight >= padding ? selectorTop - inboxHeight - padding : selectorTop - inboxHeight - availableHeight; } else { inboxOnSide = true; yPos = selectorCenter.y - halfOfInboxHeight; // with this the y co-ordinate of the selector center and the inbox card center become the same @@ -5031,17 +4426,15 @@ if (inboxOnSide) { // See if we can place the card to the right of the selector - var inboxRight = selectorRight + inboxWidth; + const inboxRight = selectorRight + inboxWidth; if (inboxRight <= windowWidth) { - var availableWidth = inboxRight + padding <= windowWidth ? padding : windowWidth - inboxRight; + const availableWidth = inboxRight + padding <= windowWidth ? padding : windowWidth - inboxRight; xPos = selectorRight + availableWidth; } else { - var inboxLeft = selectorLeft - inboxWidth; - - var _availableWidth = inboxLeft - padding >= horizontalScroll ? padding : inboxLeft - horizontalScroll; - - xPos = inboxLeft - _availableWidth; + const inboxLeft = selectorLeft - inboxWidth; + const availableWidth = inboxLeft - padding >= horizontalScroll ? padding : inboxLeft - horizontalScroll; + xPos = inboxLeft - availableWidth; } } else { xPos = selectorCenter.x - halfOfInboxWidth; @@ -5062,13 +4455,13 @@ } return { - xPos: xPos, - yPos: yPos + xPos, + yPos }; }; - var determineTimeStampText = function determineTimeStampText(ts) { - var now = Date.now(); - var diff = Math.floor((now - ts) / 60000); + const determineTimeStampText = ts => { + const now = Date.now(); + let diff = Math.floor((now - ts) / 60000); if (diff < 5) { return 'Just now'; @@ -5087,38 +4480,32 @@ diff = Math.floor(diff / 24); return "".concat(diff, " day").concat(diff > 1 ? 's' : '', " ago"); }; - var hasWebInboxSettingsInLS = function hasWebInboxSettingsInLS() { + const hasWebInboxSettingsInLS = () => { return Object.keys(StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}).length > 0; }; - var arrowSvg = "\n\n\n"; - var greenTickSvg = "\n\n\n"; - - // clevertap-handler.js - var ctEventhandler = function ctEventhandler(html) { - var ctScript = "\n var clevertap = {\n event: {\n push: (eventName) => {\n window.parent.postMessage({\n action: 'Event',\n value: eventName\n },'*');\n }\n },\n profile: {\n push: (eventName) => {\n window.parent.postMessage({\n action: 'Profile',\n value: eventName\n },'*');\n }\n },\n onUserLogin: {\n push: (eventName) => {\n window.parent.postMessage({\n action: 'OUL',\n value: eventName\n },'*');\n }\n },\n closeBoxPopUp: () => {\n window.parent.postMessage({\n action: 'closeBoxPopUp',\n value: 'closeBoxPopUp'\n },'*');\n },\n closeBannerPopUp: () => {\n window.parent.postMessage({\n action: 'closeBannerPopUp',\n value: 'closeBannerPopUp'\n },'*');\n },\n closeInterstitialPopUp: () => {\n window.parent.postMessage({\n action: 'closeInterstitialPopUp',\n value: 'closeInterstitialPopUp'\n },'*');\n }\n }\n "; - var insertPosition = html.indexOf('\n "); - return html.replace(/(<\s*\/\s*body)/, "".concat(script, "\n$1")); + const appendScriptForCustomEvent = (targetingMsgJson, doc) => { + const script = doc.createElement('script'); + script.innerHTML = "\n const ct__camapignId = '".concat(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: '").concat(targetingMsgJson.wzrk_pivot, "' };\n window.parent.clevertap.renderNotificationClicked(notifData);\n }\n });\n "); + doc.body.appendChild(script); }; - var _callBackCalled = false; + let _callBackCalled = false; - var showFooterNotification = function showFooterNotification(targetingMsgJson) { - var onClick = targetingMsgJson.display.onClick; // TODO: Needs wizrocket as a global variable + const showFooterNotification = targetingMsgJson => { + let onClick = targetingMsgJson.display.onClick; // TODO: Needs wizrocket as a global variable if (window.clevertap.hasOwnProperty('notificationCallback') && typeof window.clevertap.notificationCallback !== 'undefined' && typeof window.clevertap.notificationCallback === 'function') { - var notificationCallback = window.clevertap.notificationCallback; + const notificationCallback = window.clevertap.notificationCallback; if (!_callBackCalled) { - var inaObj = {}; + const inaObj = {}; inaObj.msgContent = targetingMsgJson.msgContent; inaObj.msgId = targetingMsgJson.wzrk_id; @@ -5747,9 +5092,9 @@ inaObj.kv = targetingMsgJson.display.kv; } - window.clevertap.raiseNotificationClicked = function () { + window.clevertap.raiseNotificationClicked = () => { if (onClick !== '' && onClick != null) { - var jsFunc = targetingMsgJson.display.jsFunc; + const jsFunc = targetingMsgJson.display.jsFunc; onClick += getCookieParams(); // invoke js function call if (jsFunc != null) { @@ -5768,7 +5113,7 @@ } }; - window.clevertap.raiseNotificationViewed = function () { + window.clevertap.raiseNotificationViewed = () => { incrementImpression(targetingMsgJson); }; @@ -5780,13 +5125,13 @@ renderFooterNotification(targetingMsgJson); if (window.clevertap.hasOwnProperty('popupCallbacks') && typeof window.clevertap.popupCallbacks !== 'undefined' && typeof window.clevertap.popupCallbacks[targetingMsgJson.wzrk_id] === 'function') { - var popupCallback = window.clevertap.popupCallbacks[targetingMsgJson.wzrk_id]; - var _inaObj = {}; - _inaObj.msgContent = targetingMsgJson.msgContent; - _inaObj.msgId = targetingMsgJson.wzrk_id; + const popupCallback = window.clevertap.popupCallbacks[targetingMsgJson.wzrk_id]; + const inaObj = {}; + inaObj.msgContent = targetingMsgJson.msgContent; + inaObj.msgId = targetingMsgJson.wzrk_id; if (targetingMsgJson.wzrk_pivot) { - _inaObj.pivotId = targetingMsgJson.wzrk_pivot; + inaObj.pivotId = targetingMsgJson.wzrk_pivot; } var msgCTkv = []; @@ -5794,66 +5139,61 @@ for (var wzrkPrefixKey in targetingMsgJson) { // ADD WZRK PREFIX KEY VALUE PAIRS if (wzrkPrefixKey.startsWith(WZRK_PREFIX) && wzrkPrefixKey !== WZRK_ID) { - var wzrkJson = _defineProperty({}, wzrkPrefixKey, targetingMsgJson[wzrkPrefixKey]); - + const wzrkJson = { + [wzrkPrefixKey]: targetingMsgJson[wzrkPrefixKey] + }; msgCTkv.push(wzrkJson); } } if (msgCTkv.length > 0) { - _inaObj.msgCTkv = msgCTkv; + inaObj.msgCTkv = msgCTkv; } if (targetingMsgJson.display.kv != null) { - _inaObj.kv = targetingMsgJson.display.kv; + inaObj.kv = targetingMsgJson.display.kv; } // PUBLIC API TO RECORD CLICKED EVENT - window.clevertap.raisePopupNotificationClicked = function (notificationData) { + window.clevertap.raisePopupNotificationClicked = notificationData => { if (!notificationData || !notificationData.msgId) { return; } - var eventData = {}; + const eventData = {}; eventData.type = 'event'; eventData.evtName = NOTIFICATION_CLICKED; - eventData.evtData = _defineProperty({}, WZRK_ID, notificationData.msgId); + eventData.evtData = { + [WZRK_ID]: notificationData.msgId + }; if (targetingMsgJson.wzrk_pivot) { - eventData.evtData = _objectSpread2(_objectSpread2({}, eventData.evtData), {}, { + eventData.evtData = { ...eventData.evtData, wzrk_pivot: notificationData.pivotId - }); + }; } // WZRK PREFIX KEY VALUE PAIRS if (notificationData.msgCTkv) { - var _iterator = _createForOfIteratorHelper(notificationData.msgCTkv), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var wzrkPrefixObj = _step.value; - eventData.evtData = _objectSpread2(_objectSpread2({}, eventData.evtData), wzrkPrefixObj); - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); + for (var wzrkPrefixObj of notificationData.msgCTkv) { + eventData.evtData = { ...eventData.evtData, + ...wzrkPrefixObj + }; } } _request.processEvent(eventData); }; - popupCallback(_inaObj); + popupCallback(inaObj); } } }; - var exitintentObj; + let exitintentObj; - var showExitIntent = function showExitIntent(event, targetObj) { - var targetingMsgJson; + const showExitIntent = (event, targetObj) => { + let targetingMsgJson; if (event != null && event.clientY > 0) { return; @@ -5866,7 +5206,7 @@ } if ($ct.dismissSpamControl && targetingMsgJson.display.wtarget_type === 0 && document.getElementById('intentPreview') != null && document.getElementById('intentOpacityDiv') != null) { - var element = document.getElementById('intentPreview'); + const element = document.getElementById('intentPreview'); element.remove(); document.getElementById('intentOpacityDiv').remove(); } // ImageOnly campaign and Interstitial/Exit Intent shouldn't coexist @@ -5885,16 +5225,16 @@ return; } - var campaignId = targetingMsgJson.wzrk_id.split('_')[0]; + const campaignId = targetingMsgJson.wzrk_id.split('_')[0]; $ct.campaignDivMap[campaignId] = 'intentPreview'; - var legacy = false; - var opacityDiv = document.createElement('div'); + let legacy = false; + const opacityDiv = document.createElement('div'); opacityDiv.id = 'intentOpacityDiv'; - var opacity = targetingMsgJson.display.opacity || 0.7; - var rgbaColor = "rgba(0,0,0,".concat(opacity, ")"); + const opacity = targetingMsgJson.display.opacity || 0.7; + const rgbaColor = "rgba(0,0,0,".concat(opacity, ")"); opacityDiv.setAttribute('style', "position: fixed;top: 0;bottom: 0;left: 0;width: 100%;height: 100%;z-index: 2147483646;background: ".concat(rgbaColor, ";")); document.body.appendChild(opacityDiv); - var msgDiv = document.createElement('div'); + const msgDiv = document.createElement('div'); msgDiv.id = 'intentPreview'; if (targetingMsgJson.display.proto == null) { @@ -5905,37 +5245,29 @@ } document.body.appendChild(msgDiv); - var iframe = document.createElement('iframe'); - var borderRadius = targetingMsgJson.display.br === false ? '0' : '8'; - var displayObj = targetingMsgJson.display; + const iframe = document.createElement('iframe'); + const borderRadius = targetingMsgJson.display.br === false ? '0' : '8'; iframe.frameborder = '0px'; iframe.marginheight = '0px'; iframe.marginwidth = '0px'; iframe.scrolling = 'no'; - iframe.id = WIZ_IFRAME_INTENT; - var html = targetingMsgJson.msgContent.html; - - if (displayObj['custom-editor'] && !displayObj['bee-editor'] && displayObj['custom-html-sandbox']) { - // sandbox the iframe only for custom html - iframe.sandbox = 'allow-scripts allow-popups allow-popups-to-escape-sandbox allow-forms'; // allow popup to open url in new page - - html = ctEventhandler(html); - } - - var onClick = targetingMsgJson.display.onClick; - var pointerCss = ''; + iframe.id = 'wiz-iframe-intent'; + const onClick = targetingMsgJson.display.onClick; + let pointerCss = ''; if (onClick !== '' && onClick != null) { pointerCss = 'cursor:pointer;'; - } // direct html + } + let html; // direct html if (targetingMsgJson.msgContent.type === 1) { + html = targetingMsgJson.msgContent.html; html = html.replace(/##campaignId##/g, campaignId); html = html.replace(/##campaignId_batchId##/g, targetingMsgJson.wzrk_id); } else { - var css = '' + ''; - var bgColor, textColor, btnBg, btColor; + const css = '' + ''; + let bgColor, textColor, btnBg, btColor; if (targetingMsgJson.display.theme === 'dark') { bgColor = '#2d2d2e'; @@ -5949,78 +5281,43 @@ btColor = '#ffffff'; } - var titleText = targetingMsgJson.msgContent.title; - var descriptionText = targetingMsgJson.msgContent.description; - var ctaText = ''; + const titleText = targetingMsgJson.msgContent.title; + const descriptionText = targetingMsgJson.msgContent.description; + let ctaText = ''; if (targetingMsgJson.msgContent.ctaText != null && targetingMsgJson.msgContent.ctaText !== '') { ctaText = "'; } - var imageTd = ''; + let imageTd = ''; if (targetingMsgJson.msgContent.imageUrl != null && targetingMsgJson.msgContent.imageUrl !== '') { imageTd = "
 + titleText + ' /></div>';
         }
 
-        var onClickStr = 'parent.$WZRK_WR.closeIframe(' + campaignId + " + "×" + "
" + "
" + titleText + '
'; - var body = "
" + descriptionText + '
' + imageTd + ctaText + '
'; + const onClickStr = 'parent.$WZRK_WR.closeIframe(' + campaignId + ",'intentPreview');"; + const title = "
" + "×" + "
" + "
" + titleText + '
'; + const body = "
" + descriptionText + '
' + imageTd + ctaText + '
'; html = css + title + body; } iframe.setAttribute('style', 'z-index: 2147483647; display:block; height: 100% !important; width: 100% !important;min-height:80px !important;border:0px !important; border-color:none !important;'); - msgDiv.appendChild(iframe); // Dispatch event for interstitial/exit intent close + msgDiv.appendChild(iframe); + const ifrm = iframe.contentWindow ? iframe.contentWindow : iframe.contentDocument.document ? iframe.contentDocument.document : iframe.contentDocument; + const doc = ifrm.document; // Dispatch event for interstitial/exit intent close - var closeCampaign = new Event('CT_campaign_rendered'); + const closeCampaign = new Event('CT_campaign_rendered'); document.dispatchEvent(closeCampaign); + doc.open(); + doc.write(html); - if (targetingMsgJson.display['custom-editor'] && !targetingMsgJson.display['bee-editor'] && targetingMsgJson.display['custom-html-sandbox']) { - html = appendScriptForCustomEvent(targetingMsgJson, html); + if (targetingMsgJson.display['custom-editor']) { + appendScriptForCustomEvent(targetingMsgJson, doc); } - iframe.srcdoc = html; - var contentDiv; - - iframe.onload = function () { - if (targetingMsgJson.display['custom-editor'] && !targetingMsgJson.display['bee-editor'] && targetingMsgJson.display['custom-html-sandbox']) { - window.addEventListener('message', function (event) { - var _event$data3; - - switch (event === null || event === void 0 ? void 0 : (_event$data3 = event.data) === null || _event$data3 === void 0 ? void 0 : _event$data3.action) { - case GET_NOTIFICATION_DATA: - window.clevertap.renderNotificationClicked(event.data.value); - break; - - case EVENT: - window.clevertap.event.push(event.data.value); - break; - - case PROFILE: - window.clevertap.profile.push(event.data.value); - break; - - case OUL: - window.clevertap.onUserLogin.push(event.data.value); - break; - - case CLOSE_INTERSTITIAL_POPUP: - setTimeout(function () { - var interstitialWrapper = window.document.getElementById('intentPreview'); - var interstitialOverlay = window.document.getElementById('intentOpacityDiv'); - interstitialOverlay && interstitialOverlay.remove(); - interstitialWrapper && interstitialWrapper.remove(); - }, 0); - break; - } - }); - contentDiv = ''; - } else { - contentDiv = document.getElementById(WIZ_IFRAME_INTENT).contentDocument.getElementById('contentDiv'); - } - - setupClickUrl(onClick, targetingMsgJson, contentDiv, 'intentPreview', legacy); - }; + doc.close(); + const contentDiv = document.getElementById('wiz-iframe-intent').contentDocument.getElementById('contentDiv'); + setupClickUrl(onClick, targetingMsgJson, contentDiv, 'intentPreview', legacy); }; if (!document.body) { @@ -6037,8 +5334,8 @@ return; } - var processNativeDisplayArr = function processNativeDisplayArr(arrInAppNotifs) { - Object.keys(arrInAppNotifs).map(function (key) { + const processNativeDisplayArr = arrInAppNotifs => { + Object.keys(arrInAppNotifs).map(key => { var elementId, id; if (arrInAppNotifs[key].display.divId) { @@ -6056,12 +5353,12 @@ }); }; - var addLoadListener = function addLoadListener(arrInAppNotifs) { - window.addEventListener('load', function () { - var count = 0; + const addLoadListener = arrInAppNotifs => { + window.addEventListener('load', () => { + let count = 0; if (count < 20) { - var t = setInterval(function () { + const t = setInterval(() => { processNativeDisplayArr(arrInAppNotifs); if (Object.keys(arrInAppNotifs).length === 0 || count === 20) { @@ -6076,10 +5373,10 @@ }; if (msg.inapp_notifs != null) { - var arrInAppNotifs = {}; + const arrInAppNotifs = {}; - for (var index = 0; index < msg.inapp_notifs.length; index++) { - var targetNotif = msg.inapp_notifs[index]; + for (let index = 0; index < msg.inapp_notifs.length; index++) { + const targetNotif = msg.inapp_notifs[index]; if (targetNotif.display.wtarget_type == null || targetNotif.display.wtarget_type === 0) { showFooterNotification(targetNotif); @@ -6091,7 +5388,7 @@ // if display['wtarget_type']==2 then web native display if (targetNotif.msgContent.type === 2 || targetNotif.msgContent.type === 3) { // Check for banner and carousel - var element = targetNotif.display.divId ? document.getElementById(targetNotif.display.divId) : document.querySelector(targetNotif.display.divSelector); + const element = targetNotif.display.divId ? document.getElementById(targetNotif.display.divId) : document.querySelector(targetNotif.display.divSelector); if (element !== null) { targetNotif.msgContent.type === 2 ? renderPersonalisationBanner(targetNotif) : renderPersonalisationCarousel(targetNotif); @@ -6114,7 +5411,7 @@ } } - var mergeEventMap = function mergeEventMap(newEvtMap) { + const mergeEventMap = newEvtMap => { if ($ct.globalEventsMap == null) { $ct.globalEventsMap = StorageManager.readFromLSorCookie(EV_COOKIE); @@ -6124,10 +5421,10 @@ } } - for (var key in newEvtMap) { + for (const key in newEvtMap) { if (newEvtMap.hasOwnProperty(key)) { - var oldEvtObj = $ct.globalEventsMap[key]; - var newEvtObj = newEvtMap[key]; + const oldEvtObj = $ct.globalEventsMap[key]; + const newEvtObj = newEvtMap[key]; if ($ct.globalEventsMap[key] != null) { if (newEvtObj[0] != null && newEvtObj[0] > oldEvtObj[0]) { @@ -6140,18 +5437,18 @@ } }; - var handleInboxNotifications = function handleInboxNotifications() { + const handleInboxNotifications = () => { if (msg.inbox_preview) { processInboxNotifs(msg); return; } if (msg.inbox_notifs) { - var msgArr = []; + const msgArr = []; - for (var _index = 0; _index < msg.inbox_notifs.length; _index++) { - if (doCampHouseKeeping(msg.inbox_notifs[_index]) !== false) { - msgArr.push(msg.inbox_notifs[_index]); + for (let index = 0; index < msg.inbox_notifs.length; index++) { + if (doCampHouseKeeping(msg.inbox_notifs[index]) !== false) { + msgArr.push(msg.inbox_notifs[index]); } } @@ -6171,9 +5468,9 @@ if ($ct.inbox === null) { msg.webInboxSetting && processWebInboxSettings(msg.webInboxSetting); - initializeWebInbox(_logger).then(function () { + initializeWebInbox(_logger).then(() => { handleInboxNotifications(); - }).catch(function (e) {}); + }).catch(e => {}); } else { handleInboxNotifications(); } @@ -6184,18 +5481,18 @@ return; } - var staleDataUpdate = function staleDataUpdate(staledata, campType) { - var campObj = getCampaignObject(); - var globalObj = campObj[campType].global; + const staleDataUpdate = (staledata, campType) => { + const campObj = getCampaignObject(); + const globalObj = campObj[campType].global; if (globalObj != null && campType) { - for (var idx in staledata) { + for (const idx in staledata) { if (staledata.hasOwnProperty(idx)) { delete globalObj[staledata[idx]]; if (StorageManager.read(CAMP_COOKIE_G)) { - var guidCampObj = JSON.parse(decodeURIComponent(StorageManager.read(CAMP_COOKIE_G))); - var guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME))); + const guidCampObj = JSON.parse(decodeURIComponent(StorageManager.read(CAMP_COOKIE_G))); + const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME))); if (guidCampObj[guid] && guidCampObj[guid][campType] && guidCampObj[guid][campType][staledata[idx]]) { delete guidCampObj[guid][campType][staledata[idx]]; @@ -6212,10 +5509,10 @@ if (StorageManager._isLocalStorageSupported()) { try { if (msg.evpr != null) { - var eventsMap = msg.evpr.events; - var profileMap = msg.evpr.profile; - var syncExpiry = msg.evpr.expires_in; - var now = getNow(); + const eventsMap = msg.evpr.events; + const profileMap = msg.evpr.profile; + const syncExpiry = msg.evpr.expires_in; + const now = getNow(); StorageManager.setMetaProp('lsTime', now); StorageManager.setMetaProp('exTs', syncExpiry); mergeEventMap(eventsMap); @@ -6249,12 +5546,11 @@ var _isPersonalisationActive$2 = _classPrivateFieldLooseKey("isPersonalisationActive"); - var User = /*#__PURE__*/function () { - function User(_ref) { - var isPersonalisationActive = _ref.isPersonalisationActive; - - _classCallCheck(this, User); - + class User { + constructor(_ref) { + let { + isPersonalisationActive + } = _ref; Object.defineProperty(this, _isPersonalisationActive$2, { writable: true, value: void 0 @@ -6262,40 +5558,35 @@ _classPrivateFieldLooseBase(this, _isPersonalisationActive$2)[_isPersonalisationActive$2] = isPersonalisationActive; } - _createClass(User, [{ - key: "getTotalVisits", - value: function getTotalVisits() { - if (!_classPrivateFieldLooseBase(this, _isPersonalisationActive$2)[_isPersonalisationActive$2]()) { - return; - } + getTotalVisits() { + if (!_classPrivateFieldLooseBase(this, _isPersonalisationActive$2)[_isPersonalisationActive$2]()) { + return; + } - var visitCount = StorageManager.getMetaProp('sc'); + let visitCount = StorageManager.getMetaProp('sc'); - if (visitCount == null) { - visitCount = 1; - } + if (visitCount == null) { + visitCount = 1; + } + + return visitCount; + } - return visitCount; + getLastVisit() { + if (!_classPrivateFieldLooseBase(this, _isPersonalisationActive$2)[_isPersonalisationActive$2]()) { + return; } - }, { - key: "getLastVisit", - value: function getLastVisit() { - if (!_classPrivateFieldLooseBase(this, _isPersonalisationActive$2)[_isPersonalisationActive$2]()) { - return; - } - var prevSession = StorageManager.getMetaProp('ps'); + const prevSession = StorageManager.getMetaProp('ps'); - if (prevSession != null) { - return new Date(prevSession * 1000); - } + if (prevSession != null) { + return new Date(prevSession * 1000); } - }]); + } - return User; - }(); + } - var logLevels = { + const logLevels = { DISABLE: 0, ERROR: 1, INFO: 2, @@ -6309,10 +5600,8 @@ var _isLegacyDebug = _classPrivateFieldLooseKey("isLegacyDebug"); - var Logger = /*#__PURE__*/function () { - function Logger(logLevel) { - _classCallCheck(this, Logger); - + class Logger { + constructor(logLevel) { Object.defineProperty(this, _isLegacyDebug, { get: _get_isLegacyDebug, set: void 0 @@ -6329,64 +5618,56 @@ this.wzrkError = {}; } - _createClass(Logger, [{ - key: "error", - value: function error(message) { - if (_classPrivateFieldLooseBase(this, _logLevel)[_logLevel] >= logLevels.ERROR) { - _classPrivateFieldLooseBase(this, _log)[_log]('error', message); - } - } - }, { - key: "info", - value: function info(message) { - if (_classPrivateFieldLooseBase(this, _logLevel)[_logLevel] >= logLevels.INFO) { - _classPrivateFieldLooseBase(this, _log)[_log]('log', message); - } - } - }, { - key: "debug", - value: function debug(message) { - if (_classPrivateFieldLooseBase(this, _logLevel)[_logLevel] >= logLevels.DEBUG || _classPrivateFieldLooseBase(this, _isLegacyDebug)[_isLegacyDebug]) { - _classPrivateFieldLooseBase(this, _log)[_log]('debug', message); - } + get logLevel() { + return _classPrivateFieldLooseBase(this, _logLevel)[_logLevel]; + } + + set logLevel(logLevel) { + _classPrivateFieldLooseBase(this, _logLevel)[_logLevel] = logLevel; + } + + error(message) { + if (_classPrivateFieldLooseBase(this, _logLevel)[_logLevel] >= logLevels.ERROR) { + _classPrivateFieldLooseBase(this, _log)[_log]('error', message); } - }, { - key: "debugPE", - value: function debugPE(message) { - if (_classPrivateFieldLooseBase(this, _logLevel)[_logLevel] >= logLevels.DEBUG_PE) { - _classPrivateFieldLooseBase(this, _log)[_log]('debug_pe', message); - } + } + + info(message) { + if (_classPrivateFieldLooseBase(this, _logLevel)[_logLevel] >= logLevels.INFO) { + _classPrivateFieldLooseBase(this, _log)[_log]('log', message); } - }, { - key: "reportError", - value: function reportError(code, description) { - this.wzrkError.c = code; - this.wzrkError.d = description; - this.error("".concat(CLEVERTAP_ERROR_PREFIX, " ").concat(code, ": ").concat(description)); + } + + debug(message) { + if (_classPrivateFieldLooseBase(this, _logLevel)[_logLevel] >= logLevels.DEBUG || _classPrivateFieldLooseBase(this, _isLegacyDebug)[_isLegacyDebug]) { + _classPrivateFieldLooseBase(this, _log)[_log]('debug', message); } - }, { - key: "logLevel", - get: function get() { - return _classPrivateFieldLooseBase(this, _logLevel)[_logLevel]; - }, - set: function set(logLevel) { - _classPrivateFieldLooseBase(this, _logLevel)[_logLevel] = logLevel; + } + + debugPE(message) { + if (_classPrivateFieldLooseBase(this, _logLevel)[_logLevel] >= logLevels.DEBUG_PE) { + _classPrivateFieldLooseBase(this, _log)[_log]('debug_pe', message); } - }]); + } + + reportError(code, description) { + this.wzrkError.c = code; + this.wzrkError.d = description; + this.error("".concat(CLEVERTAP_ERROR_PREFIX, " ").concat(code, ": ").concat(description)); + } - return Logger; - }(); + } var _log2 = function _log2(level, message) { if (window.console) { try { - var ts = new Date().getTime(); + const ts = new Date().getTime(); console[level]("CleverTap [".concat(ts, "]: ").concat(message)); } catch (e) {} } }; - var _get_isLegacyDebug = function _get_isLegacyDebug() { + var _get_isLegacyDebug = function () { return typeof sessionStorage !== 'undefined' && sessionStorage.WZRK_D === ''; }; @@ -6396,14 +5677,13 @@ var _isPersonalisationActive$3 = _classPrivateFieldLooseKey("isPersonalisationActive"); - var SessionManager = /*#__PURE__*/function () { + class SessionManager { // SCOOKIE_NAME - function SessionManager(_ref) { - var logger = _ref.logger, - isPersonalisationActive = _ref.isPersonalisationActive; - - _classCallCheck(this, SessionManager); - + constructor(_ref) { + let { + logger, + isPersonalisationActive + } = _ref; Object.defineProperty(this, _logger$5, { writable: true, value: void 0 @@ -6423,120 +5703,112 @@ _classPrivateFieldLooseBase(this, _isPersonalisationActive$3)[_isPersonalisationActive$3] = isPersonalisationActive; } - _createClass(SessionManager, [{ - key: "getSessionCookieObject", - value: function getSessionCookieObject() { - var scookieStr = StorageManager.readCookie(this.cookieName); - var obj = {}; + get sessionId() { + return _classPrivateFieldLooseBase(this, _sessionId)[_sessionId]; + } - if (scookieStr != null) { - // converting back single quotes to double for JSON parsing - http://www.iandevlin.com/blog/2012/04/html5/cookies-json-localstorage-and-opera - scookieStr = scookieStr.replace(singleQuoteRegex, '"'); - obj = JSON.parse(scookieStr); + set sessionId(sessionId) { + _classPrivateFieldLooseBase(this, _sessionId)[_sessionId] = sessionId; + } - if (!isObject(obj)) { - obj = {}; - } else { - if (typeof obj.t !== 'undefined') { - // check time elapsed since last request - var lastTime = obj.t; - var now = getNow(); - - if (now - lastTime > SCOOKIE_EXP_TIME_IN_SECS + 60) { - // adding 60 seconds to compensate for in-journey requests - // ideally the cookie should've died after SCOOKIE_EXP_TIME_IN_SECS but it's still around as we can read - // hence we shouldn't use it. - obj = {}; - } + getSessionCookieObject() { + let scookieStr = StorageManager.readCookie(this.cookieName); + let obj = {}; + + if (scookieStr != null) { + // converting back single quotes to double for JSON parsing - http://www.iandevlin.com/blog/2012/04/html5/cookies-json-localstorage-and-opera + scookieStr = scookieStr.replace(singleQuoteRegex, '"'); + obj = JSON.parse(scookieStr); + + if (!isObject(obj)) { + obj = {}; + } else { + if (typeof obj.t !== 'undefined') { + // check time elapsed since last request + const lastTime = obj.t; + const now = getNow(); + + if (now - lastTime > SCOOKIE_EXP_TIME_IN_SECS + 60) { + // adding 60 seconds to compensate for in-journey requests + // ideally the cookie should've died after SCOOKIE_EXP_TIME_IN_SECS but it's still around as we can read + // hence we shouldn't use it. + obj = {}; } } } + } - this.scookieObj = obj; - return obj; - } - }, { - key: "setSessionCookieObject", - value: function setSessionCookieObject(obj) { - var objStr = JSON.stringify(obj); - StorageManager.createBroadCookie(this.cookieName, objStr, SCOOKIE_EXP_TIME_IN_SECS, getHostName()); - } - }, { - key: "manageSession", - value: function manageSession(session) { - // first time. check if current session id in localstorage is same - // if not same then prev = current and current = this new session - if (typeof this.sessionId === 'undefined' || this.sessionId !== session) { - var currentSessionInLS = StorageManager.getMetaProp('cs'); // if sessionId in meta is undefined - set current to both - - if (typeof currentSessionInLS === 'undefined') { - StorageManager.setMetaProp('ps', session); - StorageManager.setMetaProp('cs', session); - StorageManager.setMetaProp('sc', 1); - } else if (currentSessionInLS !== session) { - // not same as session in local storage. new session - StorageManager.setMetaProp('ps', currentSessionInLS); - StorageManager.setMetaProp('cs', session); - var sessionCount = StorageManager.getMetaProp('sc'); - - if (typeof sessionCount === 'undefined') { - sessionCount = 0; - } + this.scookieObj = obj; + return obj; + } + + setSessionCookieObject(obj) { + const objStr = JSON.stringify(obj); + StorageManager.createBroadCookie(this.cookieName, objStr, SCOOKIE_EXP_TIME_IN_SECS, getHostName()); + } - StorageManager.setMetaProp('sc', sessionCount + 1); + manageSession(session) { + // first time. check if current session id in localstorage is same + // if not same then prev = current and current = this new session + if (typeof this.sessionId === 'undefined' || this.sessionId !== session) { + const currentSessionInLS = StorageManager.getMetaProp('cs'); // if sessionId in meta is undefined - set current to both + + if (typeof currentSessionInLS === 'undefined') { + StorageManager.setMetaProp('ps', session); + StorageManager.setMetaProp('cs', session); + StorageManager.setMetaProp('sc', 1); + } else if (currentSessionInLS !== session) { + // not same as session in local storage. new session + StorageManager.setMetaProp('ps', currentSessionInLS); + StorageManager.setMetaProp('cs', session); + let sessionCount = StorageManager.getMetaProp('sc'); + + if (typeof sessionCount === 'undefined') { + sessionCount = 0; } - this.sessionId = session; - } - } - }, { - key: "getTimeElapsed", - value: function getTimeElapsed() { - if (!_classPrivateFieldLooseBase(this, _isPersonalisationActive$3)[_isPersonalisationActive$3]()) { - return; + StorageManager.setMetaProp('sc', sessionCount + 1); } - if (this.scookieObj != null) { - // TODO: check logic? - this.scookieObj = this.getSessionCookieObject(); - } + this.sessionId = session; + } + } - var sessionStart = this.scookieObj.s; + getTimeElapsed() { + if (!_classPrivateFieldLooseBase(this, _isPersonalisationActive$3)[_isPersonalisationActive$3]()) { + return; + } - if (sessionStart != null) { - var ts = getNow(); - return Math.floor(ts - sessionStart); - } + if (this.scookieObj != null) { + // TODO: check logic? + this.scookieObj = this.getSessionCookieObject(); } - }, { - key: "getPageCount", - value: function getPageCount() { - if (!_classPrivateFieldLooseBase(this, _isPersonalisationActive$3)[_isPersonalisationActive$3]()) { - return; - } - if (this.scookieObj != null) { - // TODO: check logic - this.scookieObj = this.getSessionCookieObject(); - } + const sessionStart = this.scookieObj.s; + + if (sessionStart != null) { + const ts = getNow(); + return Math.floor(ts - sessionStart); + } + } - return this.scookieObj.p; + getPageCount() { + if (!_classPrivateFieldLooseBase(this, _isPersonalisationActive$3)[_isPersonalisationActive$3]()) { + return; } - }, { - key: "sessionId", - get: function get() { - return _classPrivateFieldLooseBase(this, _sessionId)[_sessionId]; - }, - set: function set(sessionId) { - _classPrivateFieldLooseBase(this, _sessionId)[_sessionId] = sessionId; + + if (this.scookieObj != null) { + // TODO: check logic + this.scookieObj = this.getSessionCookieObject(); } - }]); - return SessionManager; - }(); + return this.scookieObj.p; + } + + } - var seqNo = 0; - var requestTime = 0; + let seqNo = 0; + let requestTime = 0; var _logger$6 = _classPrivateFieldLooseKey("logger"); @@ -6552,16 +5824,15 @@ var _addToLocalEventMap = _classPrivateFieldLooseKey("addToLocalEventMap"); - var RequestManager = /*#__PURE__*/function () { - function RequestManager(_ref) { - var logger = _ref.logger, - account = _ref.account, - device = _ref.device, - session = _ref.session, - isPersonalisationActive = _ref.isPersonalisationActive; - - _classCallCheck(this, RequestManager); - + class RequestManager { + constructor(_ref) { + let { + logger, + account, + device, + session, + isPersonalisationActive + } = _ref; Object.defineProperty(this, _addToLocalEventMap, { value: _addToLocalEventMap2 }); @@ -6600,234 +5871,222 @@ RequestDispatcher.account = account; } - _createClass(RequestManager, [{ - key: "processBackupEvents", - value: function processBackupEvents() { - var backupMap = StorageManager.readFromLSorCookie(LCOOKIE_NAME); + processBackupEvents() { + const backupMap = StorageManager.readFromLSorCookie(LCOOKIE_NAME); - if (typeof backupMap === 'undefined' || backupMap === null) { - return; - } - - this.processingBackup = true; + if (typeof backupMap === 'undefined' || backupMap === null) { + return; + } - for (var idx in backupMap) { - if (backupMap.hasOwnProperty(idx)) { - var backupEvent = backupMap[idx]; + this.processingBackup = true; - if (typeof backupEvent.fired === 'undefined') { - _classPrivateFieldLooseBase(this, _logger$6)[_logger$6].debug('Processing backup event : ' + backupEvent.q); + for (const idx in backupMap) { + if (backupMap.hasOwnProperty(idx)) { + const backupEvent = backupMap[idx]; - if (typeof backupEvent.q !== 'undefined') { - RequestDispatcher.fireRequest(backupEvent.q); - } + if (typeof backupEvent.fired === 'undefined') { + _classPrivateFieldLooseBase(this, _logger$6)[_logger$6].debug('Processing backup event : ' + backupEvent.q); - backupEvent.fired = true; + if (typeof backupEvent.q !== 'undefined') { + RequestDispatcher.fireRequest(backupEvent.q); } + + backupEvent.fired = true; } } + } - StorageManager.saveToLSorCookie(LCOOKIE_NAME, backupMap); - this.processingBackup = false; + StorageManager.saveToLSorCookie(LCOOKIE_NAME, backupMap); + this.processingBackup = false; + } + + addSystemDataToObject(dataObject, ignoreTrim) { + // ignore trim for chrome notifications; undefined everywhere else + if (typeof ignoreTrim === 'undefined') { + dataObject = removeUnsupportedChars(dataObject, _classPrivateFieldLooseBase(this, _logger$6)[_logger$6]); } - }, { - key: "addSystemDataToObject", - value: function addSystemDataToObject(dataObject, ignoreTrim) { - // ignore trim for chrome notifications; undefined everywhere else - if (typeof ignoreTrim === 'undefined') { - dataObject = removeUnsupportedChars(dataObject, _classPrivateFieldLooseBase(this, _logger$6)[_logger$6]); - } - if (!isObjectEmpty(_classPrivateFieldLooseBase(this, _logger$6)[_logger$6].wzrkError)) { - dataObject.wzrk_error = _classPrivateFieldLooseBase(this, _logger$6)[_logger$6].wzrkError; - _classPrivateFieldLooseBase(this, _logger$6)[_logger$6].wzrkError = {}; - } + if (!isObjectEmpty(_classPrivateFieldLooseBase(this, _logger$6)[_logger$6].wzrkError)) { + dataObject.wzrk_error = _classPrivateFieldLooseBase(this, _logger$6)[_logger$6].wzrkError; + _classPrivateFieldLooseBase(this, _logger$6)[_logger$6].wzrkError = {}; + } - dataObject.id = _classPrivateFieldLooseBase(this, _account$2)[_account$2].id; + dataObject.id = _classPrivateFieldLooseBase(this, _account$2)[_account$2].id; - if (isValueValid(_classPrivateFieldLooseBase(this, _device$2)[_device$2].gcookie)) { - dataObject.g = _classPrivateFieldLooseBase(this, _device$2)[_device$2].gcookie; - } + if (isValueValid(_classPrivateFieldLooseBase(this, _device$2)[_device$2].gcookie)) { + dataObject.g = _classPrivateFieldLooseBase(this, _device$2)[_device$2].gcookie; + } - var obj = _classPrivateFieldLooseBase(this, _session$2)[_session$2].getSessionCookieObject(); + const obj = _classPrivateFieldLooseBase(this, _session$2)[_session$2].getSessionCookieObject(); - dataObject.s = obj.s; // session cookie + dataObject.s = obj.s; // session cookie - dataObject.pg = typeof obj.p === 'undefined' ? 1 : obj.p; // Page count + dataObject.pg = typeof obj.p === 'undefined' ? 1 : obj.p; // Page count - var proto = document.location.protocol; - proto = proto.replace(':', ''); - dataObject.af = _objectSpread2({ - lib: 'web-sdk-v1.7.4', - protocol: proto - }, $ct.flutterVersion); // app fields + let proto = document.location.protocol; + proto = proto.replace(':', ''); + dataObject.af = { + lib: 'web-sdk-v1.7.4', + protocol: proto, + ...$ct.flutterVersion + }; // app fields - if (sessionStorage.hasOwnProperty('WZRK_D')) { - dataObject.debug = true; - } + if (sessionStorage.hasOwnProperty('WZRK_D')) { + dataObject.debug = true; + } + + return dataObject; + } - return dataObject; + addFlags(data) { + // check if cookie should be cleared. + _classPrivateFieldLooseBase(this, _clearCookie)[_clearCookie] = StorageManager.getAndClearMetaProp(CLEAR); + + if (_classPrivateFieldLooseBase(this, _clearCookie)[_clearCookie] !== undefined && _classPrivateFieldLooseBase(this, _clearCookie)[_clearCookie]) { + data.rc = true; + + _classPrivateFieldLooseBase(this, _logger$6)[_logger$6].debug('reset cookie sent in request and cleared from meta for future requests.'); } - }, { - key: "addFlags", - value: function addFlags(data) { - // check if cookie should be cleared. - _classPrivateFieldLooseBase(this, _clearCookie)[_clearCookie] = StorageManager.getAndClearMetaProp(CLEAR); - if (_classPrivateFieldLooseBase(this, _clearCookie)[_clearCookie] !== undefined && _classPrivateFieldLooseBase(this, _clearCookie)[_clearCookie]) { - data.rc = true; + if (_classPrivateFieldLooseBase(this, _isPersonalisationActive$4)[_isPersonalisationActive$4]()) { + const lastSyncTime = StorageManager.getMetaProp('lsTime'); + const expirySeconds = StorageManager.getMetaProp('exTs'); // dsync not found in local storage - get data from server - _classPrivateFieldLooseBase(this, _logger$6)[_logger$6].debug('reset cookie sent in request and cleared from meta for future requests.'); + if (typeof lastSyncTime === 'undefined' || typeof expirySeconds === 'undefined') { + data.dsync = true; + return; } - if (_classPrivateFieldLooseBase(this, _isPersonalisationActive$4)[_isPersonalisationActive$4]()) { - var lastSyncTime = StorageManager.getMetaProp('lsTime'); - var expirySeconds = StorageManager.getMetaProp('exTs'); // dsync not found in local storage - get data from server + const now = getNow(); // last sync time has expired - get fresh data from server - if (typeof lastSyncTime === 'undefined' || typeof expirySeconds === 'undefined') { - data.dsync = true; - return; - } + if (lastSyncTime + expirySeconds < now) { + data.dsync = true; + } + } + } // saves url to backup cache and fires the request - var now = getNow(); // last sync time has expired - get fresh data from server + /** + * + * @param {string} url + * @param {boolean} override whether the request can go through or not + * @param {Boolean} sendOULFlag - true in case of a On User Login request + */ - if (lastSyncTime + expirySeconds < now) { - data.dsync = true; - } - } - } // saves url to backup cache and fires the request - /** - * - * @param {string} url - * @param {boolean} override whether the request can go through or not - * @param {Boolean} sendOULFlag - true in case of a On User Login request - */ + saveAndFireRequest(url, override, sendOULFlag, evtName) { + const now = getNow(); + url = addToURL(url, 'rn', ++$ct.globalCache.REQ_N); + const data = url + '&i=' + now + '&sn=' + seqNo; + StorageManager.backupEvent(data, $ct.globalCache.REQ_N, _classPrivateFieldLooseBase(this, _logger$6)[_logger$6]); // if offline is set to true, save the request in backup and return - }, { - key: "saveAndFireRequest", - value: function saveAndFireRequest(url, override, sendOULFlag, evtName) { - var now = getNow(); - url = addToURL(url, 'rn', ++$ct.globalCache.REQ_N); - var data = url + '&i=' + now + '&sn=' + seqNo; - StorageManager.backupEvent(data, $ct.globalCache.REQ_N, _classPrivateFieldLooseBase(this, _logger$6)[_logger$6]); // if offline is set to true, save the request in backup and return - - if ($ct.offline) return; // if there is no override - // and an OUL request is not in progress - // then process the request as it is - // else block the request - // note - $ct.blockRequest should ideally be used for override - - if ((!override || _classPrivateFieldLooseBase(this, _clearCookie)[_clearCookie] !== undefined && _classPrivateFieldLooseBase(this, _clearCookie)[_clearCookie]) && !window.isOULInProgress) { - if (now === requestTime) { - seqNo++; - } else { - requestTime = now; - seqNo = 0; - } + if ($ct.offline) return; // if there is no override + // and an OUL request is not in progress + // then process the request as it is + // else block the request + // note - $ct.blockRequest should ideally be used for override - window.oulReqN = $ct.globalCache.REQ_N; - RequestDispatcher.fireRequest(data, false, sendOULFlag, evtName); + if ((!override || _classPrivateFieldLooseBase(this, _clearCookie)[_clearCookie] !== undefined && _classPrivateFieldLooseBase(this, _clearCookie)[_clearCookie]) && !window.isOULInProgress) { + if (now === requestTime) { + seqNo++; } else { - _classPrivateFieldLooseBase(this, _logger$6)[_logger$6].debug("Not fired due to override - ".concat($ct.blockRequest, " or clearCookie - ").concat(_classPrivateFieldLooseBase(this, _clearCookie)[_clearCookie], " or OUL request in progress - ").concat(window.isOULInProgress)); + requestTime = now; + seqNo = 0; } + + window.oulReqN = $ct.globalCache.REQ_N; + RequestDispatcher.fireRequest(data, false, sendOULFlag, evtName); + } else { + _classPrivateFieldLooseBase(this, _logger$6)[_logger$6].debug("Not fired due to override - ".concat($ct.blockRequest, " or clearCookie - ").concat(_classPrivateFieldLooseBase(this, _clearCookie)[_clearCookie], " or OUL request in progress - ").concat(window.isOULInProgress)); } - }, { - key: "unregisterTokenForGuid", - value: function unregisterTokenForGuid(givenGUID) { - var payload = StorageManager.readFromLSorCookie(PUSH_SUBSCRIPTION_DATA); // Send unregister event only when token is available + } - if (payload) { - var data = {}; - data.type = 'data'; + unregisterTokenForGuid(givenGUID) { + const payload = StorageManager.readFromLSorCookie(PUSH_SUBSCRIPTION_DATA); // Send unregister event only when token is available - if (isValueValid(givenGUID)) { - data.g = givenGUID; - } + if (payload) { + const data = {}; + data.type = 'data'; - data.action = 'unregister'; - data.id = _classPrivateFieldLooseBase(this, _account$2)[_account$2].id; + if (isValueValid(givenGUID)) { + data.g = givenGUID; + } - var obj = _classPrivateFieldLooseBase(this, _session$2)[_session$2].getSessionCookieObject(); + data.action = 'unregister'; + data.id = _classPrivateFieldLooseBase(this, _account$2)[_account$2].id; - data.s = obj.s; // session cookie + const obj = _classPrivateFieldLooseBase(this, _session$2)[_session$2].getSessionCookieObject(); - var compressedData = compressData(JSON.stringify(data), _classPrivateFieldLooseBase(this, _logger$6)[_logger$6]); + data.s = obj.s; // session cookie - var pageLoadUrl = _classPrivateFieldLooseBase(this, _account$2)[_account$2].dataPostURL; + const compressedData = compressData(JSON.stringify(data), _classPrivateFieldLooseBase(this, _logger$6)[_logger$6]); - pageLoadUrl = addToURL(pageLoadUrl, 'type', 'data'); - pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData); - RequestDispatcher.fireRequest(pageLoadUrl, true); - StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, false); - } // REGISTER TOKEN + let pageLoadUrl = _classPrivateFieldLooseBase(this, _account$2)[_account$2].dataPostURL; + pageLoadUrl = addToURL(pageLoadUrl, 'type', 'data'); + pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData); + RequestDispatcher.fireRequest(pageLoadUrl, true); + StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, false); + } // REGISTER TOKEN - this.registerToken(payload); - } - }, { - key: "registerToken", - value: function registerToken(payload) { - if (!payload) return; // add gcookie etc to the payload - payload = this.addSystemDataToObject(payload, true); - payload = JSON.stringify(payload); + this.registerToken(payload); + } - var pageLoadUrl = _classPrivateFieldLooseBase(this, _account$2)[_account$2].dataPostURL; + registerToken(payload) { + if (!payload) return; // add gcookie etc to the payload - pageLoadUrl = addToURL(pageLoadUrl, 'type', 'data'); - pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(payload, _classPrivateFieldLooseBase(this, _logger$6)[_logger$6])); - RequestDispatcher.fireRequest(pageLoadUrl); // set in localstorage + payload = this.addSystemDataToObject(payload, true); + payload = JSON.stringify(payload); - StorageManager.save(WEBPUSH_LS_KEY, 'ok'); - } - }, { - key: "processEvent", - value: function processEvent(data) { - _classPrivateFieldLooseBase(this, _addToLocalEventMap)[_addToLocalEventMap](data.evtName); + let pageLoadUrl = _classPrivateFieldLooseBase(this, _account$2)[_account$2].dataPostURL; - data = this.addSystemDataToObject(data, undefined); - this.addFlags(data); - data[CAMP_COOKIE_NAME] = getCampaignObjForLc(); - var compressedData = compressData(JSON.stringify(data), _classPrivateFieldLooseBase(this, _logger$6)[_logger$6]); + pageLoadUrl = addToURL(pageLoadUrl, 'type', 'data'); + pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(payload, _classPrivateFieldLooseBase(this, _logger$6)[_logger$6])); + RequestDispatcher.fireRequest(pageLoadUrl); // set in localstorage - var pageLoadUrl = _classPrivateFieldLooseBase(this, _account$2)[_account$2].dataPostURL; + StorageManager.save(WEBPUSH_LS_KEY, 'ok'); + } - pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH); - pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData); - this.saveAndFireRequest(pageLoadUrl, $ct.blockRequest, false, data.evtName); - } - }, { - key: "post", - value: function post(url, body) { - var _this = this; - - return fetch(url, { - method: 'post', - headers: { - 'Content-Type': 'application/json' - }, - body: body - }).then(function (response) { - if (response.ok) { - return response.json(); - } + processEvent(data) { + _classPrivateFieldLooseBase(this, _addToLocalEventMap)[_addToLocalEventMap](data.evtName); - throw response; - }).then(function (data) { - _classPrivateFieldLooseBase(_this, _logger$6)[_logger$6].debug('Sync data successful', data); + data = this.addSystemDataToObject(data, undefined); + this.addFlags(data); + data[CAMP_COOKIE_NAME] = getCampaignObjForLc(); + const compressedData = compressData(JSON.stringify(data), _classPrivateFieldLooseBase(this, _logger$6)[_logger$6]); - return data; - }).catch(function (e) { - _classPrivateFieldLooseBase(_this, _logger$6)[_logger$6].debug('Error in syncing variables', e); + let pageLoadUrl = _classPrivateFieldLooseBase(this, _account$2)[_account$2].dataPostURL; - throw e; - }); - } - }]); + pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH); + pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData); + this.saveAndFireRequest(pageLoadUrl, $ct.blockRequest, false, data.evtName); + } + + post(url, body) { + return fetch(url, { + method: 'post', + headers: { + 'Content-Type': 'application/json' + }, + body: body + }).then(response => { + if (response.ok) { + return response.json(); + } + + throw response; + }).then(data => { + _classPrivateFieldLooseBase(this, _logger$6)[_logger$6].debug('Sync data successful', data); - return RequestManager; - }(); + return data; + }).catch(e => { + _classPrivateFieldLooseBase(this, _logger$6)[_logger$6].debug('Error in syncing variables', e); + + throw e; + }); + } + + } var _addToLocalEventMap2 = function _addToLocalEventMap2(evtName) { if (StorageManager._isLocalStorageSupported()) { @@ -6839,8 +6098,8 @@ } } - var nowTs = getNow(); - var evtDetail = $ct.globalEventsMap[evtName]; + const nowTs = getNow(); + let evtDetail = $ct.globalEventsMap[evtName]; if (typeof evtDetail !== 'undefined') { evtDetail[2] = nowTs; @@ -6867,85 +6126,70 @@ var _processPrivacyArray = _classPrivateFieldLooseKey("processPrivacyArray"); - var Privacy = /*#__PURE__*/function (_Array) { - _inherits(Privacy, _Array); - - var _super = _createSuper(Privacy); - - function Privacy(_ref, values) { - var _this; - - var request = _ref.request, - account = _ref.account, - logger = _ref.logger; - - _classCallCheck(this, Privacy); - - _this = _super.call(this); - Object.defineProperty(_assertThisInitialized(_this), _processPrivacyArray, { + class Privacy extends Array { + constructor(_ref, values) { + let { + request, + account, + logger + } = _ref; + super(); + Object.defineProperty(this, _processPrivacyArray, { value: _processPrivacyArray2 }); - Object.defineProperty(_assertThisInitialized(_this), _request$4, { + Object.defineProperty(this, _request$4, { writable: true, value: void 0 }); - Object.defineProperty(_assertThisInitialized(_this), _account$3, { + Object.defineProperty(this, _account$3, { writable: true, value: void 0 }); - Object.defineProperty(_assertThisInitialized(_this), _oldValues$3, { + Object.defineProperty(this, _oldValues$3, { writable: true, value: void 0 }); - Object.defineProperty(_assertThisInitialized(_this), _logger$7, { + Object.defineProperty(this, _logger$7, { writable: true, value: void 0 }); - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _logger$7)[_logger$7] = logger; - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _request$4)[_request$4] = request; - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _account$3)[_account$3] = account; - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _oldValues$3)[_oldValues$3] = values; - return _this; + _classPrivateFieldLooseBase(this, _logger$7)[_logger$7] = logger; + _classPrivateFieldLooseBase(this, _request$4)[_request$4] = request; + _classPrivateFieldLooseBase(this, _account$3)[_account$3] = account; + _classPrivateFieldLooseBase(this, _oldValues$3)[_oldValues$3] = values; } - _createClass(Privacy, [{ - key: "push", - value: function push() { - for (var _len = arguments.length, privacyArr = new Array(_len), _key = 0; _key < _len; _key++) { - privacyArr[_key] = arguments[_key]; - } + push() { + for (var _len = arguments.length, privacyArr = new Array(_len), _key = 0; _key < _len; _key++) { + privacyArr[_key] = arguments[_key]; + } - if ($ct.isPrivacyArrPushed) { - _classPrivateFieldLooseBase(this, _processPrivacyArray)[_processPrivacyArray]($ct.privacyArray.length > 0 ? $ct.privacyArray : privacyArr); - } else { - var _$ct$privacyArray; + if ($ct.isPrivacyArrPushed) { + _classPrivateFieldLooseBase(this, _processPrivacyArray)[_processPrivacyArray]($ct.privacyArray.length > 0 ? $ct.privacyArray : privacyArr); + } else { + $ct.privacyArray.push(...privacyArr); + } - (_$ct$privacyArray = $ct.privacyArray).push.apply(_$ct$privacyArray, privacyArr); - } + return 0; + } - return 0; + _processOldValues() { + if (_classPrivateFieldLooseBase(this, _oldValues$3)[_oldValues$3]) { + _classPrivateFieldLooseBase(this, _processPrivacyArray)[_processPrivacyArray](_classPrivateFieldLooseBase(this, _oldValues$3)[_oldValues$3]); } - }, { - key: "_processOldValues", - value: function _processOldValues() { - if (_classPrivateFieldLooseBase(this, _oldValues$3)[_oldValues$3]) { - _classPrivateFieldLooseBase(this, _processPrivacyArray)[_processPrivacyArray](_classPrivateFieldLooseBase(this, _oldValues$3)[_oldValues$3]); - } - _classPrivateFieldLooseBase(this, _oldValues$3)[_oldValues$3] = null; - } - }]); + _classPrivateFieldLooseBase(this, _oldValues$3)[_oldValues$3] = null; + } - return Privacy; - }( /*#__PURE__*/_wrapNativeSuper(Array)); + } var _processPrivacyArray2 = function _processPrivacyArray2(privacyArr) { if (Array.isArray(privacyArr) && privacyArr.length > 0) { - var privacyObj = privacyArr.reduce(function (prev, curr) { - return _objectSpread2(_objectSpread2({}, prev), curr); - }, {}); - var data = {}; - var profileObj = {}; + const privacyObj = privacyArr.reduce((prev, curr) => ({ ...prev, + ...curr + }), {}); + let data = {}; + const profileObj = {}; var optOut = false; if (privacyObj.hasOwnProperty(OPTOUT_KEY)) { @@ -6959,8 +6203,8 @@ } if (privacyObj.hasOwnProperty(USEIP_KEY)) { - var useIP = privacyObj[USEIP_KEY]; - var shouldUseIP = typeof useIP === 'boolean' ? useIP : false; + const useIP = privacyObj[USEIP_KEY]; + const shouldUseIP = typeof useIP === 'boolean' ? useIP : false; StorageManager.setMetaProp(USEIP_KEY, shouldUseIP); } @@ -6968,9 +6212,9 @@ data.type = 'profile'; data.profile = profileObj; data = _classPrivateFieldLooseBase(this, _request$4)[_request$4].addSystemDataToObject(data, undefined); - var compressedData = compressData(JSON.stringify(data), _classPrivateFieldLooseBase(this, _logger$7)[_logger$7]); + const compressedData = compressData(JSON.stringify(data), _classPrivateFieldLooseBase(this, _logger$7)[_logger$7]); - var pageLoadUrl = _classPrivateFieldLooseBase(this, _account$3)[_account$3].dataPostURL; + let pageLoadUrl = _classPrivateFieldLooseBase(this, _account$3)[_account$3].dataPostURL; pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH); pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData); @@ -7011,118 +6255,104 @@ var _handleNotificationRegistration = _classPrivateFieldLooseKey("handleNotificationRegistration"); - var NotificationHandler = /*#__PURE__*/function (_Array) { - _inherits(NotificationHandler, _Array); - - var _super = _createSuper(NotificationHandler); - - function NotificationHandler(_ref, values) { - var _this; - - var logger = _ref.logger, - session = _ref.session, - request = _ref.request, - account = _ref.account; - - _classCallCheck(this, NotificationHandler); - - _this = _super.call(this); - Object.defineProperty(_assertThisInitialized(_this), _handleNotificationRegistration, { + class NotificationHandler extends Array { + constructor(_ref, values) { + let { + logger, + session, + request, + account + } = _ref; + super(); + Object.defineProperty(this, _handleNotificationRegistration, { value: _handleNotificationRegistration2 }); - Object.defineProperty(_assertThisInitialized(_this), _removeWizAlertJS, { + Object.defineProperty(this, _removeWizAlertJS, { value: _removeWizAlertJS2 }); - Object.defineProperty(_assertThisInitialized(_this), _addWizAlertJS, { + Object.defineProperty(this, _addWizAlertJS, { value: _addWizAlertJS2 }); - Object.defineProperty(_assertThisInitialized(_this), _setUpChromeFirefoxNotifications, { + Object.defineProperty(this, _setUpChromeFirefoxNotifications, { value: _setUpChromeFirefoxNotifications2 }); - Object.defineProperty(_assertThisInitialized(_this), _setUpSafariNotifications, { + Object.defineProperty(this, _setUpSafariNotifications, { value: _setUpSafariNotifications2 }); - Object.defineProperty(_assertThisInitialized(_this), _setApplicationServerKey, { + Object.defineProperty(this, _setApplicationServerKey, { value: _setApplicationServerKey2 }); - Object.defineProperty(_assertThisInitialized(_this), _setUpWebPushNotifications, { + Object.defineProperty(this, _setUpWebPushNotifications, { value: _setUpWebPushNotifications2 }); - Object.defineProperty(_assertThisInitialized(_this), _setUpWebPush, { + Object.defineProperty(this, _setUpWebPush, { value: _setUpWebPush2 }); - Object.defineProperty(_assertThisInitialized(_this), _oldValues$4, { + Object.defineProperty(this, _oldValues$4, { writable: true, value: void 0 }); - Object.defineProperty(_assertThisInitialized(_this), _logger$8, { + Object.defineProperty(this, _logger$8, { writable: true, value: void 0 }); - Object.defineProperty(_assertThisInitialized(_this), _request$5, { + Object.defineProperty(this, _request$5, { writable: true, value: void 0 }); - Object.defineProperty(_assertThisInitialized(_this), _account$4, { + Object.defineProperty(this, _account$4, { writable: true, value: void 0 }); - Object.defineProperty(_assertThisInitialized(_this), _wizAlertJSPath, { + Object.defineProperty(this, _wizAlertJSPath, { writable: true, value: void 0 }); - Object.defineProperty(_assertThisInitialized(_this), _fcmPublicKey, { + Object.defineProperty(this, _fcmPublicKey, { writable: true, value: void 0 }); - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _wizAlertJSPath)[_wizAlertJSPath] = 'https://d2r1yp2w7bby2u.cloudfront.net/js/wzrk_dialog.min.js'; - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _fcmPublicKey)[_fcmPublicKey] = null; - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _oldValues$4)[_oldValues$4] = values; - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _logger$8)[_logger$8] = logger; - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _request$5)[_request$5] = request; - _classPrivateFieldLooseBase(_assertThisInitialized(_this), _account$4)[_account$4] = account; - return _this; + _classPrivateFieldLooseBase(this, _wizAlertJSPath)[_wizAlertJSPath] = 'https://d2r1yp2w7bby2u.cloudfront.net/js/wzrk_dialog.min.js'; + _classPrivateFieldLooseBase(this, _fcmPublicKey)[_fcmPublicKey] = null; + _classPrivateFieldLooseBase(this, _oldValues$4)[_oldValues$4] = values; + _classPrivateFieldLooseBase(this, _logger$8)[_logger$8] = logger; + _classPrivateFieldLooseBase(this, _request$5)[_request$5] = request; + _classPrivateFieldLooseBase(this, _account$4)[_account$4] = account; } - _createClass(NotificationHandler, [{ - key: "push", - value: function push() { - for (var _len = arguments.length, displayArgs = new Array(_len), _key = 0; _key < _len; _key++) { - displayArgs[_key] = arguments[_key]; - } + push() { + for (var _len = arguments.length, displayArgs = new Array(_len), _key = 0; _key < _len; _key++) { + displayArgs[_key] = arguments[_key]; + } - _classPrivateFieldLooseBase(this, _setUpWebPush)[_setUpWebPush](displayArgs); + _classPrivateFieldLooseBase(this, _setUpWebPush)[_setUpWebPush](displayArgs); - return 0; - } - }, { - key: "_processOldValues", - value: function _processOldValues() { - if (_classPrivateFieldLooseBase(this, _oldValues$4)[_oldValues$4]) { - _classPrivateFieldLooseBase(this, _setUpWebPush)[_setUpWebPush](_classPrivateFieldLooseBase(this, _oldValues$4)[_oldValues$4]); - } + return 0; + } - _classPrivateFieldLooseBase(this, _oldValues$4)[_oldValues$4] = null; + _processOldValues() { + if (_classPrivateFieldLooseBase(this, _oldValues$4)[_oldValues$4]) { + _classPrivateFieldLooseBase(this, _setUpWebPush)[_setUpWebPush](_classPrivateFieldLooseBase(this, _oldValues$4)[_oldValues$4]); } - }, { - key: "_enableWebPush", - value: function _enableWebPush(enabled, applicationServerKey) { - $ct.webPushEnabled = enabled; - if (applicationServerKey != null) { - _classPrivateFieldLooseBase(this, _setApplicationServerKey)[_setApplicationServerKey](applicationServerKey); - } + _classPrivateFieldLooseBase(this, _oldValues$4)[_oldValues$4] = null; + } - if ($ct.webPushEnabled && $ct.notifApi.notifEnabledFromApi) { - _classPrivateFieldLooseBase(this, _handleNotificationRegistration)[_handleNotificationRegistration]($ct.notifApi.displayArgs); - } else if (!$ct.webPushEnabled && $ct.notifApi.notifEnabledFromApi) { - _classPrivateFieldLooseBase(this, _logger$8)[_logger$8].error('Ensure that web push notifications are fully enabled and integrated before requesting them'); - } + _enableWebPush(enabled, applicationServerKey) { + $ct.webPushEnabled = enabled; + + if (applicationServerKey != null) { + _classPrivateFieldLooseBase(this, _setApplicationServerKey)[_setApplicationServerKey](applicationServerKey); } - }]); - return NotificationHandler; - }( /*#__PURE__*/_wrapNativeSuper(Array)); + if ($ct.webPushEnabled && $ct.notifApi.notifEnabledFromApi) { + _classPrivateFieldLooseBase(this, _handleNotificationRegistration)[_handleNotificationRegistration]($ct.notifApi.displayArgs); + } else if (!$ct.webPushEnabled && $ct.notifApi.notifEnabledFromApi) { + _classPrivateFieldLooseBase(this, _logger$8)[_logger$8].error('Ensure that web push notifications are fully enabled and integrated before requesting them'); + } + } + + } var _setUpWebPush2 = function _setUpWebPush2(displayArgs) { if ($ct.webPushEnabled && displayArgs.length > 0) { @@ -7148,8 +6378,6 @@ }; var _setUpSafariNotifications2 = function _setUpSafariNotifications2(subscriptionCallback, apnsWebPushId, apnsServiceUrl) { - var _this2 = this; - // ensure that proper arguments are passed if (typeof apnsWebPushId === 'undefined') { _classPrivateFieldLooseBase(this, _logger$8)[_logger$8].error('Ensure that APNS Web Push ID is supplied'); @@ -7160,82 +6388,70 @@ } if ('safari' in window && 'pushNotification' in window.safari) { - window.safari.pushNotification.requestPermission(apnsServiceUrl, apnsWebPushId, {}, function (subscription) { + window.safari.pushNotification.requestPermission(apnsServiceUrl, apnsWebPushId, {}, subscription => { if (subscription.permission === 'granted') { - var subscriptionData = JSON.parse(JSON.stringify(subscription)); + const subscriptionData = JSON.parse(JSON.stringify(subscription)); subscriptionData.endpoint = subscription.deviceToken; subscriptionData.browser = 'Safari'; StorageManager.saveToLSorCookie(PUSH_SUBSCRIPTION_DATA, subscriptionData); - _classPrivateFieldLooseBase(_this2, _request$5)[_request$5].registerToken(subscriptionData); + _classPrivateFieldLooseBase(this, _request$5)[_request$5].registerToken(subscriptionData); - _classPrivateFieldLooseBase(_this2, _logger$8)[_logger$8].info('Safari Web Push registered. Device Token: ' + subscription.deviceToken); + _classPrivateFieldLooseBase(this, _logger$8)[_logger$8].info('Safari Web Push registered. Device Token: ' + subscription.deviceToken); } else if (subscription.permission === 'denied') { - _classPrivateFieldLooseBase(_this2, _logger$8)[_logger$8].info('Error subscribing to Safari web push'); + _classPrivateFieldLooseBase(this, _logger$8)[_logger$8].info('Error subscribing to Safari web push'); } }); } }; var _setUpChromeFirefoxNotifications2 = function _setUpChromeFirefoxNotifications2(subscriptionCallback, serviceWorkerPath) { - var _this3 = this; - - var registrationScope = ''; + let registrationScope = ''; if ('serviceWorker' in navigator) { - navigator.serviceWorker.register(serviceWorkerPath).then(function (registration) { + navigator.serviceWorker.register(serviceWorkerPath).then(registration => { if (typeof __wzrk_account_id !== 'undefined') { // eslint-disable-line // shopify accounts , since the service worker is not at root, serviceWorker.ready is never resolved. // hence add a timeout and hope serviceWroker is ready within that time. - return new Promise(function (resolve) { - return setTimeout(function () { - return resolve(registration); - }, 5000); - }); + return new Promise(resolve => setTimeout(() => resolve(registration), 5000)); } registrationScope = registration.scope; // IF SERVICE WORKER IS AT ROOT, RETURN THE READY PROMISE // ELSE IF CHROME RETURN PROMISE AFTER 5 SECONDS // OR getRegistrations PROMISE IF ITS FIREFOX - var rootDirRegex = /^(\.?)(\/?)([^/]*).js$/; - var isServiceWorkerAtRoot = rootDirRegex.test(serviceWorkerPath); + const rootDirRegex = /^(\.?)(\/?)([^/]*).js$/; + const isServiceWorkerAtRoot = rootDirRegex.test(serviceWorkerPath); if (isServiceWorkerAtRoot) { return navigator.serviceWorker.ready; } else { if (navigator.userAgent.indexOf('Chrome') !== -1) { - return new Promise(function (resolve) { - return setTimeout(function () { - return resolve(registration); - }, 5000); - }); + return new Promise(resolve => setTimeout(() => resolve(registration), 5000)); } else { return navigator.serviceWorker.getRegistrations(); } } - }).then(function (serviceWorkerRegistration) { + }).then(serviceWorkerRegistration => { // ITS AN ARRAY IN CASE OF FIREFOX, SO USE THE REGISTRATION WITH PROPER SCOPE if (navigator.userAgent.indexOf('Firefox') !== -1 && Array.isArray(serviceWorkerRegistration)) { - serviceWorkerRegistration = serviceWorkerRegistration.filter(function (i) { - return i.scope === registrationScope; - })[0]; + serviceWorkerRegistration = serviceWorkerRegistration.filter(i => i.scope === registrationScope)[0]; } - var subscribeObj = { + const subscribeObj = { userVisibleOnly: true }; - if (_classPrivateFieldLooseBase(_this3, _fcmPublicKey)[_fcmPublicKey] != null) { - subscribeObj.applicationServerKey = urlBase64ToUint8Array(_classPrivateFieldLooseBase(_this3, _fcmPublicKey)[_fcmPublicKey]); + if (_classPrivateFieldLooseBase(this, _fcmPublicKey)[_fcmPublicKey] != null) { + subscribeObj.applicationServerKey = urlBase64ToUint8Array(_classPrivateFieldLooseBase(this, _fcmPublicKey)[_fcmPublicKey]); } - serviceWorkerRegistration.pushManager.subscribe(subscribeObj).then(function (subscription) { - _classPrivateFieldLooseBase(_this3, _logger$8)[_logger$8].info('Service Worker registered. Endpoint: ' + subscription.endpoint); // convert the subscription keys to strings; this sets it up nicely for pushing to LC + serviceWorkerRegistration.pushManager.subscribe(subscribeObj).then(subscription => { + _classPrivateFieldLooseBase(this, _logger$8)[_logger$8].info('Service Worker registered. Endpoint: ' + subscription.endpoint); // convert the subscription keys to strings; this sets it up nicely for pushing to LC - var subscriptionData = JSON.parse(JSON.stringify(subscription)); // remove the common chrome/firefox endpoint at the beginning of the token + const subscriptionData = JSON.parse(JSON.stringify(subscription)); // remove the common chrome/firefox endpoint at the beginning of the token if (navigator.userAgent.indexOf('Chrome') !== -1) { subscriptionData.endpoint = subscriptionData.endpoint.split('/').pop(); @@ -7247,35 +6463,35 @@ StorageManager.saveToLSorCookie(PUSH_SUBSCRIPTION_DATA, subscriptionData); - _classPrivateFieldLooseBase(_this3, _request$5)[_request$5].registerToken(subscriptionData); + _classPrivateFieldLooseBase(this, _request$5)[_request$5].registerToken(subscriptionData); if (typeof subscriptionCallback !== 'undefined' && typeof subscriptionCallback === 'function') { subscriptionCallback(); } - }).catch(function (error) { - _classPrivateFieldLooseBase(_this3, _logger$8)[_logger$8].error('Error subscribing: ' + error); // unsubscribe from webpush if error + }).catch(error => { + _classPrivateFieldLooseBase(this, _logger$8)[_logger$8].error('Error subscribing: ' + error); // unsubscribe from webpush if error - serviceWorkerRegistration.pushManager.getSubscription().then(function (subscription) { + serviceWorkerRegistration.pushManager.getSubscription().then(subscription => { if (subscription !== null) { - subscription.unsubscribe().then(function (successful) { + subscription.unsubscribe().then(successful => { // You've successfully unsubscribed - _classPrivateFieldLooseBase(_this3, _logger$8)[_logger$8].info('Unsubscription successful'); - }).catch(function (e) { + _classPrivateFieldLooseBase(this, _logger$8)[_logger$8].info('Unsubscription successful'); + }).catch(e => { // Unsubscription failed - _classPrivateFieldLooseBase(_this3, _logger$8)[_logger$8].error('Error unsubscribing: ' + e); + _classPrivateFieldLooseBase(this, _logger$8)[_logger$8].error('Error unsubscribing: ' + e); }); } }); }); - }).catch(function (err) { - _classPrivateFieldLooseBase(_this3, _logger$8)[_logger$8].error('error registering service worker: ' + err); + }).catch(err => { + _classPrivateFieldLooseBase(this, _logger$8)[_logger$8].error('error registering service worker: ' + err); }); } }; var _addWizAlertJS2 = function _addWizAlertJS2() { - var scriptTag = document.createElement('script'); + const scriptTag = document.createElement('script'); scriptTag.setAttribute('type', 'text/javascript'); scriptTag.setAttribute('id', 'wzrk-alert-js'); scriptTag.setAttribute('src', _classPrivateFieldLooseBase(this, _wizAlertJSPath)[_wizAlertJSPath]); // add the script tag to the end of the body @@ -7285,33 +6501,31 @@ }; var _removeWizAlertJS2 = function _removeWizAlertJS2() { - var scriptTag = document.getElementById('wzrk-alert-js'); + const scriptTag = document.getElementById('wzrk-alert-js'); scriptTag.parentNode.removeChild(scriptTag); }; var _handleNotificationRegistration2 = function _handleNotificationRegistration2(displayArgs) { - var _this4 = this; - // make sure everything is specified - var titleText; - var bodyText; - var okButtonText; - var rejectButtonText; - var okButtonColor; - var skipDialog; - var askAgainTimeInSeconds; - var okCallback; - var rejectCallback; - var subscriptionCallback; - var serviceWorkerPath; - var httpsPopupPath; - var httpsIframePath; - var apnsWebPushId; - var apnsWebPushServiceUrl; + let titleText; + let bodyText; + let okButtonText; + let rejectButtonText; + let okButtonColor; + let skipDialog; + let askAgainTimeInSeconds; + let okCallback; + let rejectCallback; + let subscriptionCallback; + let serviceWorkerPath; + let httpsPopupPath; + let httpsIframePath; + let apnsWebPushId; + let apnsWebPushServiceUrl; if (displayArgs.length === 1) { if (isObject(displayArgs[0])) { - var notifObj = displayArgs[0]; + const notifObj = displayArgs[0]; titleText = notifObj.titleText; bodyText = notifObj.bodyText; okButtonText = notifObj.okButtonText; @@ -7351,7 +6565,7 @@ return; } - var isHTTP = httpsPopupPath != null && httpsIframePath != null; // make sure the site is on https for chrome notifications + const isHTTP = httpsPopupPath != null && httpsIframePath != null; // make sure the site is on https for chrome notifications if (window.location.protocol !== 'https:' && document.location.hostname !== 'localhost' && !isHTTP) { _classPrivateFieldLooseBase(this, _logger$8)[_logger$8].error('Make sure you are https or localhost to register for notifications'); @@ -7361,19 +6575,19 @@ if (navigator.userAgent.indexOf('Chrome') !== -1) { - var chromeAgent = navigator.userAgent.match(/Chrome\/(\d+)/); + const chromeAgent = navigator.userAgent.match(/Chrome\/(\d+)/); if (chromeAgent == null || parseInt(chromeAgent[1], 10) < 50) { return; } } else if (navigator.userAgent.indexOf('Firefox') !== -1) { - var firefoxAgent = navigator.userAgent.match(/Firefox\/(\d+)/); + const firefoxAgent = navigator.userAgent.match(/Firefox\/(\d+)/); if (firefoxAgent == null || parseInt(firefoxAgent[1], 10) < 50) { return; } } else if (navigator.userAgent.indexOf('Safari') !== -1) { - var safariAgent = navigator.userAgent.match(/Safari\/(\d+)/); + const safariAgent = navigator.userAgent.match(/Safari\/(\d+)/); if (safariAgent == null || parseInt(safariAgent[1], 10) < 50) { return; @@ -7419,7 +6633,7 @@ } // make sure the user isn't asked for notifications more than askAgainTimeInSeconds - var now = new Date().getTime() / 1000; + const now = new Date().getTime() / 1000; if (StorageManager.getMetaProp('notif_last_time') == null) { StorageManager.setMetaProp('notif_last_time', now); @@ -7439,13 +6653,13 @@ if (isHTTP) { // add the https iframe - var httpsIframe = document.createElement('iframe'); + const httpsIframe = document.createElement('iframe'); httpsIframe.setAttribute('style', 'display:none;'); httpsIframe.setAttribute('src', httpsIframePath); document.body.appendChild(httpsIframe); - window.addEventListener('message', function (event) { + window.addEventListener('message', event => { if (event.data != null) { - var obj = {}; + let obj = {}; try { obj = JSON.parse(event.data); @@ -7456,7 +6670,7 @@ if (obj.state != null) { if (obj.from === 'ct' && obj.state === 'not') { - _classPrivateFieldLooseBase(_this4, _addWizAlertJS)[_addWizAlertJS]().onload = function () { + _classPrivateFieldLooseBase(this, _addWizAlertJS)[_addWizAlertJS]().onload = () => { // create our wizrocket popup window.wzrkPermissionPopup.wizAlert({ title: titleText, @@ -7464,7 +6678,7 @@ confirmButtonText: okButtonText, confirmButtonColor: okButtonColor, rejectButtonText: rejectButtonText - }, function (enabled) { + }, enabled => { // callback function if (enabled) { // the user accepted on the dialog box @@ -7480,7 +6694,7 @@ } } - _classPrivateFieldLooseBase(_this4, _removeWizAlertJS)[_removeWizAlertJS](); + _classPrivateFieldLooseBase(this, _removeWizAlertJS)[_removeWizAlertJS](); }); }; } @@ -7488,7 +6702,7 @@ } }, false); } else { - _classPrivateFieldLooseBase(this, _addWizAlertJS)[_addWizAlertJS]().onload = function () { + _classPrivateFieldLooseBase(this, _addWizAlertJS)[_addWizAlertJS]().onload = () => { // create our wizrocket popup window.wzrkPermissionPopup.wizAlert({ title: titleText, @@ -7496,7 +6710,7 @@ confirmButtonText: okButtonText, confirmButtonColor: okButtonColor, rejectButtonText: rejectButtonText - }, function (enabled) { + }, enabled => { // callback function if (enabled) { // the user accepted on the dialog box @@ -7504,14 +6718,14 @@ okCallback(); } - _classPrivateFieldLooseBase(_this4, _setUpWebPushNotifications)[_setUpWebPushNotifications](subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsWebPushServiceUrl); + _classPrivateFieldLooseBase(this, _setUpWebPushNotifications)[_setUpWebPushNotifications](subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsWebPushServiceUrl); } else { if (typeof rejectCallback === 'function') { rejectCallback(); } } - _classPrivateFieldLooseBase(_this4, _removeWizAlertJS)[_removeWizAlertJS](); + _classPrivateFieldLooseBase(this, _removeWizAlertJS)[_removeWizAlertJS](); }); }; } @@ -7519,7 +6733,7 @@ var _variableStore = _classPrivateFieldLooseKey("variableStore"); - var Variable = /*#__PURE__*/function () { + class Variable { /** * Creates an instance of the Variable class. * @@ -7532,11 +6746,10 @@ * @param {boolean} options.hadStarted - A flag indicating whether the variable has started (used internally). * @param {Function[]} options.valueChangedCallbacks - Array to store callbacks to be executed when the variable value changes. */ - function Variable(_ref) { - var variableStore = _ref.variableStore; - - _classCallCheck(this, Variable); - + constructor(_ref) { + let { + variableStore + } = _ref; Object.defineProperty(this, _variableStore, { writable: true, value: void 0 @@ -7550,151 +6763,138 @@ _classPrivateFieldLooseBase(this, _variableStore)[_variableStore] = variableStore; } - _createClass(Variable, [{ - key: "getValue", - value: function getValue() { - return this.value; - } - }, { - key: "getdefaultValue", - value: function getdefaultValue() { - return this.defaultValue; - } - /** - * Defines a new variable with the provided name, default value, and variable store. - * @static - * @param {string} name - The name of the variable. - * @param {*} defaultValue - The default value of the variable. - * @param {VariableStore} variableStore - The VariableStore instance for registration. - * @returns {Variable|null} - The created Variable instance or null if invalid parameters are provided. - */ + getValue() { + return this.value; + } - }, { - key: "update", + getdefaultValue() { + return this.defaultValue; + } + /** + * Defines a new variable with the provided name, default value, and variable store. + * @static + * @param {string} name - The name of the variable. + * @param {*} defaultValue - The default value of the variable. + * @param {VariableStore} variableStore - The VariableStore instance for registration. + * @returns {Variable|null} - The created Variable instance or null if invalid parameters are provided. + */ - /** - * Updates the variable's value, triggering callbacks if hasVarsRequestCompleted is returned true. - * @param {*} newValue - The new value to be assigned to the variable. - */ - value: function update(newValue) { - var oldValue = this.value; - this.value = newValue; - if (newValue === null && oldValue === null) { - return; - } + static define(name, defaultValue, variableStore) { + if (!name || typeof name !== 'string') { + console.error('Empty or invalid name parameter provided.'); + return null; + } - if (newValue !== null && newValue === oldValue && this.hadStarted) { - return; - } + if (name.startsWith('.') || name.endsWith('.')) { + console.error('Variable name starts or ends with a `.` which is not allowed: ' + name); + return null; + } - if (_classPrivateFieldLooseBase(this, _variableStore)[_variableStore].hasVarsRequestCompleted()) { - this.hadStarted = true; - this.triggerValueChanged(); - } + const typeOfDefaultValue = typeof defaultValue; + + if (typeOfDefaultValue !== 'string' && typeOfDefaultValue !== 'number' && typeOfDefaultValue !== 'boolean') { + console.error('Only primitive types (string, number, boolean) are accepted as value'); + return null; + } + + const existing = variableStore.getVariable(name); + + if (existing) { + return existing; } - /** - * Invokes all registered callbacks when the variable value changes. - */ - }, { - key: "triggerValueChanged", - value: function triggerValueChanged() { - var _this = this; + const varInstance = new Variable({ + variableStore + }); - this.valueChangedCallbacks.forEach(function (onValueChanged) { - onValueChanged(_this); - }); + try { + varInstance.name = name; + varInstance.defaultValue = defaultValue; + varInstance.value = defaultValue; + varInstance.type = typeOfDefaultValue; + variableStore.registerVariable(varInstance); + varInstance.update(defaultValue); + } catch (error) { + console.error(error); } - /** - * Adds a callback function to the array and triggers it immediately if variable requests have completed. - * @param {Function} onValueChanged - The callback function to be added. - */ - }, { - key: "addValueChangedCallback", - value: function addValueChangedCallback(onValueChanged) { - if (!onValueChanged) { - console.log('Invalid callback parameter provided.'); - return; - } + return varInstance; + } + /** + * Updates the variable's value, triggering callbacks if hasVarsRequestCompleted is returned true. + * @param {*} newValue - The new value to be assigned to the variable. + */ - this.valueChangedCallbacks.push(onValueChanged); - if (_classPrivateFieldLooseBase(this, _variableStore)[_variableStore].hasVarsRequestCompleted()) { - onValueChanged(this); - } - } - /** - * Removes a callback function from the array. - * @param {Function} onValueChanged - The callback function to be removed. - */ + update(newValue) { + const oldValue = this.value; + this.value = newValue; - }, { - key: "removeValueChangedCallback", - value: function removeValueChangedCallback(onValueChanged) { - var index = this.valueChangedCallbacks.indexOf(onValueChanged); + if (newValue === null && oldValue === null) { + return; + } - if (index !== -1) { - this.valueChangedCallbacks.splice(index, 1); - } + if (newValue !== null && newValue === oldValue && this.hadStarted) { + return; } - /** - * Resets the `hadStarted` flag to false. - */ - }, { - key: "clearStartFlag", - value: function clearStartFlag() { - this.hadStarted = false; + if (_classPrivateFieldLooseBase(this, _variableStore)[_variableStore].hasVarsRequestCompleted()) { + this.hadStarted = true; + this.triggerValueChanged(); } - }], [{ - key: "define", - value: function define(name, defaultValue, variableStore) { - if (!name || typeof name !== 'string') { - console.error('Empty or invalid name parameter provided.'); - return null; - } + } + /** + * Invokes all registered callbacks when the variable value changes. + */ - if (name.startsWith('.') || name.endsWith('.')) { - console.error('Variable name starts or ends with a `.` which is not allowed: ' + name); - return null; - } - var typeOfDefaultValue = _typeof(defaultValue); + triggerValueChanged() { + this.valueChangedCallbacks.forEach(onValueChanged => { + onValueChanged(this); + }); + } + /** + * Adds a callback function to the array and triggers it immediately if variable requests have completed. + * @param {Function} onValueChanged - The callback function to be added. + */ + - if (typeOfDefaultValue !== 'string' && typeOfDefaultValue !== 'number' && typeOfDefaultValue !== 'boolean') { - console.error('Only primitive types (string, number, boolean) are accepted as value'); - return null; - } + addValueChangedCallback(onValueChanged) { + if (!onValueChanged) { + console.log('Invalid callback parameter provided.'); + return; + } - var existing = variableStore.getVariable(name); + this.valueChangedCallbacks.push(onValueChanged); - if (existing) { - return existing; - } + if (_classPrivateFieldLooseBase(this, _variableStore)[_variableStore].hasVarsRequestCompleted()) { + onValueChanged(this); + } + } + /** + * Removes a callback function from the array. + * @param {Function} onValueChanged - The callback function to be removed. + */ - var varInstance = new Variable({ - variableStore: variableStore - }); - try { - varInstance.name = name; - varInstance.defaultValue = defaultValue; - varInstance.value = defaultValue; - varInstance.type = typeOfDefaultValue; - variableStore.registerVariable(varInstance); - varInstance.update(defaultValue); - } catch (error) { - console.error(error); - } + removeValueChangedCallback(onValueChanged) { + const index = this.valueChangedCallbacks.indexOf(onValueChanged); - return varInstance; + if (index !== -1) { + this.valueChangedCallbacks.splice(index, 1); } - }]); + } + /** + * Resets the `hadStarted` flag to false. + */ + + + clearStartFlag() { + this.hadStarted = false; + } - return Variable; - }(); + } var _logger$9 = _classPrivateFieldLooseKey("logger"); @@ -7718,15 +6918,14 @@ var _runVariablesChangedCallback = _classPrivateFieldLooseKey("runVariablesChangedCallback"); - var VariableStore = /*#__PURE__*/function () { - function VariableStore(_ref) { - var logger = _ref.logger, - request = _ref.request, - account = _ref.account, - event = _ref.event; - - _classCallCheck(this, VariableStore); - + class VariableStore { + constructor(_ref) { + let { + logger, + request, + account, + event + } = _ref; Object.defineProperty(this, _runVariablesChangedCallback, { value: _runVariablesChangedCallback2 }); @@ -7786,211 +6985,178 @@ */ - _createClass(VariableStore, [{ - key: "registerVariable", - value: function registerVariable(varInstance) { - var name = varInstance.name; - _classPrivateFieldLooseBase(this, _variables)[_variables][name] = varInstance; - console.log('registerVariable', _classPrivateFieldLooseBase(this, _variables)[_variables]); - } - /** - * Retrieves a variable by its name. - * @param {string} name - The name of the variable to retrieve. - * @returns {Object} - The variable instance. - */ + registerVariable(varInstance) { + const { + name + } = varInstance; + _classPrivateFieldLooseBase(this, _variables)[_variables][name] = varInstance; + console.log('registerVariable', _classPrivateFieldLooseBase(this, _variables)[_variables]); + } + /** + * Retrieves a variable by its name. + * @param {string} name - The name of the variable to retrieve. + * @returns {Object} - The variable instance. + */ - }, { - key: "getVariable", - value: function getVariable(name) { - return _classPrivateFieldLooseBase(this, _variables)[_variables][name]; - } - }, { - key: "hasVarsRequestCompleted", - value: function hasVarsRequestCompleted() { - return _classPrivateFieldLooseBase(this, _hasVarsRequestCompleted)[_hasVarsRequestCompleted]; - } - /** - * Synchronizes variables with the server. - * @param {Function} onSyncSuccess - Callback function on successful synchronization. - * @param {Function} onSyncFailure - Callback function on synchronization failure. - * @throws Will throw an error if the account token is missing. - * @returns {Promise} - The result of the synchronization request. - */ - }, { - key: "syncVariables", - value: function syncVariables(onSyncSuccess, onSyncFailure) { - var _this = this; + getVariable(name) { + return _classPrivateFieldLooseBase(this, _variables)[_variables][name]; + } + + hasVarsRequestCompleted() { + return _classPrivateFieldLooseBase(this, _hasVarsRequestCompleted)[_hasVarsRequestCompleted]; + } + /** + * Synchronizes variables with the server. + * @param {Function} onSyncSuccess - Callback function on successful synchronization. + * @param {Function} onSyncFailure - Callback function on synchronization failure. + * @throws Will throw an error if the account token is missing. + * @returns {Promise} - The result of the synchronization request. + */ - if (!_classPrivateFieldLooseBase(this, _account$5)[_account$5].token) { - var m = 'Account token is missing.'; - _classPrivateFieldLooseBase(this, _logger$9)[_logger$9].error(m); + syncVariables(onSyncSuccess, onSyncFailure) { + if (!_classPrivateFieldLooseBase(this, _account$5)[_account$5].token) { + const m = 'Account token is missing.'; - return Promise.reject(new Error(m)); - } + _classPrivateFieldLooseBase(this, _logger$9)[_logger$9].error(m); + + return Promise.reject(new Error(m)); + } + + const payload = { + type: 'varsPayload', + vars: {} + }; - var payload = { - type: 'varsPayload', - vars: {} + for (const name in _classPrivateFieldLooseBase(this, _variables)[_variables]) { + payload.vars[name] = { + defaultValue: _classPrivateFieldLooseBase(this, _variables)[_variables][name].defaultValue, + type: _classPrivateFieldLooseBase(this, _variables)[_variables][name].type }; + } // Check if payload.vars is empty - for (var name in _classPrivateFieldLooseBase(this, _variables)[_variables]) { - payload.vars[name] = { - defaultValue: _classPrivateFieldLooseBase(this, _variables)[_variables][name].defaultValue, - type: _classPrivateFieldLooseBase(this, _variables)[_variables][name].type - }; - } // Check if payload.vars is empty + if (Object.keys(payload.vars).length === 0) { + const m = 'No variables are defined.'; + + _classPrivateFieldLooseBase(this, _logger$9)[_logger$9].error(m); + + return Promise.reject(new Error(m)); + } - if (Object.keys(payload.vars).length === 0) { - var _m = 'No variables are defined.'; + let meta = {}; + meta = _classPrivateFieldLooseBase(this, _request$6)[_request$6].addSystemDataToObject(meta, undefined); + meta.tk = _classPrivateFieldLooseBase(this, _account$5)[_account$5].token; + meta.type = 'meta'; + const body = JSON.stringify([meta, payload]); - _classPrivateFieldLooseBase(this, _logger$9)[_logger$9].error(_m); + const url = _classPrivateFieldLooseBase(this, _account$5)[_account$5].dataPostPEURL; - return Promise.reject(new Error(_m)); + return _classPrivateFieldLooseBase(this, _request$6)[_request$6].post(url, body).then(r => { + if (onSyncSuccess && typeof onSyncSuccess === 'function') { + onSyncSuccess(r); } - var meta = {}; - meta = _classPrivateFieldLooseBase(this, _request$6)[_request$6].addSystemDataToObject(meta, undefined); - meta.tk = _classPrivateFieldLooseBase(this, _account$5)[_account$5].token; - meta.type = 'meta'; - var body = JSON.stringify([meta, payload]); + return r; + }).catch(e => { + if (onSyncFailure && typeof onSyncFailure === 'function') { + onSyncFailure(e); + } - var url = _classPrivateFieldLooseBase(this, _account$5)[_account$5].dataPostPEURL; + if (e.status === 400) { + _classPrivateFieldLooseBase(this, _logger$9)[_logger$9].error('Invalid sync payload or clear the existing draft'); + } else if (e.status === 401) { + _classPrivateFieldLooseBase(this, _logger$9)[_logger$9].error('This is not a test profile'); + } else { + _classPrivateFieldLooseBase(this, _logger$9)[_logger$9].error('Sync variable failed'); + } - return _classPrivateFieldLooseBase(this, _request$6)[_request$6].post(url, body).then(function (r) { - if (onSyncSuccess && typeof onSyncSuccess === 'function') { - onSyncSuccess(r); - } + throw e; + }); + } + /** + * Fetches variables from the server. + * @param {Function} onFetchCallback - Callback function on fetch completion. + */ - return r; - }).catch(function (e) { - if (onSyncFailure && typeof onSyncFailure === 'function') { - onSyncFailure(e); - } - if (e.status === 400) { - _classPrivateFieldLooseBase(_this, _logger$9)[_logger$9].error('Invalid sync payload or clear the existing draft'); - } else if (e.status === 401) { - _classPrivateFieldLooseBase(_this, _logger$9)[_logger$9].error('This is not a test profile'); - } else { - _classPrivateFieldLooseBase(_this, _logger$9)[_logger$9].error('Sync variable failed'); - } + fetchVariables(onFetchCallback) { + _classPrivateFieldLooseBase(this, _event)[_event].push(WZRK_FETCH, { + t: 4 + }); - throw e; - }); + if (onFetchCallback && typeof onFetchCallback === 'function') { + _classPrivateFieldLooseBase(this, _fetchCallback)[_fetchCallback] = onFetchCallback; } - /** - * Fetches variables from the server. - * @param {Function} onFetchCallback - Callback function on fetch completion. - */ + } - }, { - key: "fetchVariables", - value: function fetchVariables(onFetchCallback) { - _classPrivateFieldLooseBase(this, _event)[_event].push(WZRK_FETCH, { - t: 4 - }); + mergeVariables(vars) { + console.log('msg vars is ', vars); + _classPrivateFieldLooseBase(this, _hasVarsRequestCompleted)[_hasVarsRequestCompleted] = true; + StorageManager.saveToLSorCookie(VARIABLES, vars); + _classPrivateFieldLooseBase(this, _remoteVariables)[_remoteVariables] = vars; - if (onFetchCallback && typeof onFetchCallback === 'function') { - _classPrivateFieldLooseBase(this, _fetchCallback)[_fetchCallback] = onFetchCallback; + for (const name in _classPrivateFieldLooseBase(this, _variables)[_variables]) { + if (vars.hasOwnProperty(name)) { + _classPrivateFieldLooseBase(this, _variables)[_variables][name].update(vars[name]); } } - }, { - key: "mergeVariables", - value: function mergeVariables(vars) { - console.log('msg vars is ', vars); - _classPrivateFieldLooseBase(this, _hasVarsRequestCompleted)[_hasVarsRequestCompleted] = true; - StorageManager.saveToLSorCookie(VARIABLES, vars); - _classPrivateFieldLooseBase(this, _remoteVariables)[_remoteVariables] = vars; - for (var name in _classPrivateFieldLooseBase(this, _variables)[_variables]) { - if (vars.hasOwnProperty(name)) { - _classPrivateFieldLooseBase(this, _variables)[_variables][name].update(vars[name]); - } - } + if (_classPrivateFieldLooseBase(this, _fetchCallback)[_fetchCallback]) { + _classPrivateFieldLooseBase(this, _fetchCallback)[_fetchCallback](); + } - if (_classPrivateFieldLooseBase(this, _fetchCallback)[_fetchCallback]) { - _classPrivateFieldLooseBase(this, _fetchCallback)[_fetchCallback](); - } + _classPrivateFieldLooseBase(this, _runVariablesChangedCallback)[_runVariablesChangedCallback](); + } - _classPrivateFieldLooseBase(this, _runVariablesChangedCallback)[_runVariablesChangedCallback](); - } - }, { - key: "addVariablesChangedCallback", - value: function addVariablesChangedCallback(callback) { - if (callback && typeof callback === 'function') { - _classPrivateFieldLooseBase(this, _variablesChangedCallbacks)[_variablesChangedCallbacks].push(callback); + addVariablesChangedCallback(callback) { + if (callback && typeof callback === 'function') { + _classPrivateFieldLooseBase(this, _variablesChangedCallbacks)[_variablesChangedCallbacks].push(callback); - if (this.hasVarsRequestCompleted()) { - callback(); - } - } else { - _classPrivateFieldLooseBase(this, _logger$9)[_logger$9].error('callback is not a function'); - } - } - }, { - key: "addOneTimeVariablesChangedCallback", - value: function addOneTimeVariablesChangedCallback(callback) { - if (callback && typeof callback === 'function') { - if (this.hasVarsRequestCompleted()) { - callback(); - } else { - _classPrivateFieldLooseBase(this, _oneTimeVariablesChangedCallbacks)[_oneTimeVariablesChangedCallbacks].push(callback); - } + if (this.hasVarsRequestCompleted()) { + callback(); } + } else { + _classPrivateFieldLooseBase(this, _logger$9)[_logger$9].error('callback is not a function'); } - }, { - key: "removeVariablesChangedCallback", - value: function removeVariablesChangedCallback(callback) { - var index = _classPrivateFieldLooseBase(this, _variablesChangedCallbacks)[_variablesChangedCallbacks].indexOf(callback); + } - if (index !== -1) { - _classPrivateFieldLooseBase(this, _variablesChangedCallbacks)[_variablesChangedCallbacks].splice(index, 1); + addOneTimeVariablesChangedCallback(callback) { + if (callback && typeof callback === 'function') { + if (this.hasVarsRequestCompleted()) { + callback(); + } else { + _classPrivateFieldLooseBase(this, _oneTimeVariablesChangedCallbacks)[_oneTimeVariablesChangedCallbacks].push(callback); } } - }, { - key: "removeOneTimeVariablesChangedCallback", - value: function removeOneTimeVariablesChangedCallback(callback) { - var index = _classPrivateFieldLooseBase(this, _oneTimeVariablesChangedCallbacks)[_oneTimeVariablesChangedCallbacks].indexOf(callback); + } - if (index !== -1) { - _classPrivateFieldLooseBase(this, _oneTimeVariablesChangedCallbacks)[_oneTimeVariablesChangedCallbacks].splice(index, 1); - } - } - }]); + removeVariablesChangedCallback(callback) { + const index = _classPrivateFieldLooseBase(this, _variablesChangedCallbacks)[_variablesChangedCallbacks].indexOf(callback); - return VariableStore; - }(); + if (index !== -1) { + _classPrivateFieldLooseBase(this, _variablesChangedCallbacks)[_variablesChangedCallbacks].splice(index, 1); + } + } - var _runVariablesChangedCallback2 = function _runVariablesChangedCallback2() { - var _iterator = _createForOfIteratorHelper(_classPrivateFieldLooseBase(this, _variablesChangedCallbacks)[_variablesChangedCallbacks]), - _step; + removeOneTimeVariablesChangedCallback(callback) { + const index = _classPrivateFieldLooseBase(this, _oneTimeVariablesChangedCallbacks)[_oneTimeVariablesChangedCallbacks].indexOf(callback); - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var callback = _step.value; - callback(); + if (index !== -1) { + _classPrivateFieldLooseBase(this, _oneTimeVariablesChangedCallbacks)[_oneTimeVariablesChangedCallbacks].splice(index, 1); } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); } - var _iterator2 = _createForOfIteratorHelper(_classPrivateFieldLooseBase(this, _oneTimeVariablesChangedCallbacks)[_oneTimeVariablesChangedCallbacks]), - _step2; + } + + var _runVariablesChangedCallback2 = function _runVariablesChangedCallback2() { + for (var callback of _classPrivateFieldLooseBase(this, _variablesChangedCallbacks)[_variablesChangedCallbacks]) { + callback(); + } - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var callBack = _step2.value; - callBack(); - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); + for (var callBack of _classPrivateFieldLooseBase(this, _oneTimeVariablesChangedCallbacks)[_oneTimeVariablesChangedCallbacks]) { + callBack(); } _classPrivateFieldLooseBase(this, _oneTimeVariablesChangedCallbacks)[_oneTimeVariablesChangedCallbacks].length = 0; @@ -8032,50 +7198,40 @@ var _overrideDSyncFlag = _classPrivateFieldLooseKey("overrideDSyncFlag"); - var CleverTap = /*#__PURE__*/function () { - _createClass(CleverTap, [{ - key: "spa", - get: function get() { - return _classPrivateFieldLooseBase(this, _isSpa)[_isSpa]; - }, - set: function set(value) { - var isSpa = value === true; - - if (_classPrivateFieldLooseBase(this, _isSpa)[_isSpa] !== isSpa && _classPrivateFieldLooseBase(this, _onloadcalled)[_onloadcalled] === 1) { - // if clevertap.spa is changed after init has been called then update the click listeners - if (isSpa) { - document.addEventListener('click', _classPrivateFieldLooseBase(this, _boundCheckPageChanged)[_boundCheckPageChanged]); - } else { - document.removeEventListener('click', _classPrivateFieldLooseBase(this, _boundCheckPageChanged)[_boundCheckPageChanged]); - } - } + class CleverTap { + get spa() { + return _classPrivateFieldLooseBase(this, _isSpa)[_isSpa]; + } - _classPrivateFieldLooseBase(this, _isSpa)[_isSpa] = isSpa; - } - }, { - key: "dismissSpamControl", - get: function get() { - return _classPrivateFieldLooseBase(this, _dismissSpamControl)[_dismissSpamControl]; - }, - set: function set(value) { - var dismissSpamControl = value === true; - _classPrivateFieldLooseBase(this, _dismissSpamControl)[_dismissSpamControl] = dismissSpamControl; - $ct.dismissSpamControl = dismissSpamControl; + set spa(value) { + const isSpa = value === true; + + if (_classPrivateFieldLooseBase(this, _isSpa)[_isSpa] !== isSpa && _classPrivateFieldLooseBase(this, _onloadcalled)[_onloadcalled] === 1) { + // if clevertap.spa is changed after init has been called then update the click listeners + if (isSpa) { + document.addEventListener('click', _classPrivateFieldLooseBase(this, _boundCheckPageChanged)[_boundCheckPageChanged]); + } else { + document.removeEventListener('click', _classPrivateFieldLooseBase(this, _boundCheckPageChanged)[_boundCheckPageChanged]); + } } - }]); - function CleverTap() { - var _clevertap$account, - _clevertap$account2, - _clevertap$account3, - _clevertap$account4, - _this = this, - _clevertap$account5; + _classPrivateFieldLooseBase(this, _isSpa)[_isSpa] = isSpa; + } + + get dismissSpamControl() { + return _classPrivateFieldLooseBase(this, _dismissSpamControl)[_dismissSpamControl]; + } - var clevertap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + set dismissSpamControl(value) { + const dismissSpamControl = value === true; + _classPrivateFieldLooseBase(this, _dismissSpamControl)[_dismissSpamControl] = dismissSpamControl; + $ct.dismissSpamControl = dismissSpamControl; + } - _classCallCheck(this, CleverTap); + constructor() { + var _clevertap$account, _clevertap$account2, _clevertap$account3, _clevertap$account4, _clevertap$account5; + let clevertap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; Object.defineProperty(this, _overrideDSyncFlag, { value: _overrideDSyncFlag2 }); @@ -8148,7 +7304,7 @@ _classPrivateFieldLooseBase(this, _onloadcalled)[_onloadcalled] = 0; this._isPersonalisationActive = this._isPersonalisationActive.bind(this); - this.raiseNotificationClicked = function () {}; + this.raiseNotificationClicked = () => {}; _classPrivateFieldLooseBase(this, _logger$a)[_logger$a] = new Logger(logLevels.INFO); _classPrivateFieldLooseBase(this, _account$6)[_account$6] = new Account((_clevertap$account = clevertap.account) === null || _clevertap$account === void 0 ? void 0 : _clevertap$account[0], clevertap.region || ((_clevertap$account2 = clevertap.account) === null || _clevertap$account2 === void 0 ? void 0 : _clevertap$account2[1]), clevertap.targetDomain || ((_clevertap$account3 = clevertap.account) === null || _clevertap$account3 === void 0 ? void 0 : _clevertap$account3[2]), clevertap.token || ((_clevertap$account4 = clevertap.account) === null || _clevertap$account4 === void 0 ? void 0 : _clevertap$account4[3])); @@ -8156,6 +7312,7 @@ logger: _classPrivateFieldLooseBase(this, _logger$a)[_logger$a] }); _classPrivateFieldLooseBase(this, _dismissSpamControl)[_dismissSpamControl] = clevertap.dismissSpamControl || false; + this.shpfyProxyPath = clevertap.shpfyProxyPath || ''; _classPrivateFieldLooseBase(this, _session$3)[_session$3] = new SessionManager({ logger: _classPrivateFieldLooseBase(this, _logger$a)[_logger$a], isPersonalisationActive: this._isPersonalisationActive @@ -8214,54 +7371,56 @@ isPersonalisationActive: this._isPersonalisationActive }); this.session = { - getTimeElapsed: function getTimeElapsed() { - return _classPrivateFieldLooseBase(_this, _session$3)[_session$3].getTimeElapsed(); + getTimeElapsed: () => { + return _classPrivateFieldLooseBase(this, _session$3)[_session$3].getTimeElapsed(); }, - getPageCount: function getPageCount() { - return _classPrivateFieldLooseBase(_this, _session$3)[_session$3].getPageCount(); + getPageCount: () => { + return _classPrivateFieldLooseBase(this, _session$3)[_session$3].getPageCount(); } }; - this.logout = function () { - _classPrivateFieldLooseBase(_this, _logger$a)[_logger$a].debug('logout called'); + this.logout = () => { + _classPrivateFieldLooseBase(this, _logger$a)[_logger$a].debug('logout called'); StorageManager.setInstantDeleteFlagInK(); }; - this.clear = function () { - _this.onUserLogin.clear(); + this.clear = () => { + this.onUserLogin.clear(); }; - this.getCleverTapID = function () { - return _classPrivateFieldLooseBase(_this, _device$3)[_device$3].getGuid(); + this.getCleverTapID = () => { + return _classPrivateFieldLooseBase(this, _device$3)[_device$3].getGuid(); }; - this.getAccountID = function () { - return _classPrivateFieldLooseBase(_this, _account$6)[_account$6].id; + this.getAccountID = () => { + return _classPrivateFieldLooseBase(this, _account$6)[_account$6].id; }; - this.getSCDomain = function () { - return _classPrivateFieldLooseBase(_this, _account$6)[_account$6].finalTargetDomain; + this.getSCDomain = () => { + return _classPrivateFieldLooseBase(this, _account$6)[_account$6].finalTargetDomain; }; - this.setLibrary = function (libName, libVersion) { - $ct.flutterVersion = _defineProperty({}, libName, libVersion); + this.setLibrary = (libName, libVersion) => { + $ct.flutterVersion = { + [libName]: libVersion + }; }; // Set the Signed Call sdk version and fire request - this.setSCSDKVersion = function (ver) { - _classPrivateFieldLooseBase(_this, _account$6)[_account$6].scSDKVersion = ver; - var data = {}; + this.setSCSDKVersion = ver => { + _classPrivateFieldLooseBase(this, _account$6)[_account$6].scSDKVersion = ver; + const data = {}; data.af = { - scv: 'sc-sdk-v' + _classPrivateFieldLooseBase(_this, _account$6)[_account$6].scSDKVersion + scv: 'sc-sdk-v' + _classPrivateFieldLooseBase(this, _account$6)[_account$6].scSDKVersion }; - var pageLoadUrl = _classPrivateFieldLooseBase(_this, _account$6)[_account$6].dataPostURL; + let pageLoadUrl = _classPrivateFieldLooseBase(this, _account$6)[_account$6].dataPostURL; pageLoadUrl = addToURL(pageLoadUrl, 'type', 'page'); - pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(JSON.stringify(data), _classPrivateFieldLooseBase(_this, _logger$a)[_logger$a])); + pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(JSON.stringify(data), _classPrivateFieldLooseBase(this, _logger$a)[_logger$a])); - _classPrivateFieldLooseBase(_this, _request$7)[_request$7].saveAndFireRequest(pageLoadUrl, $ct.blockRequest); + _classPrivateFieldLooseBase(this, _request$7)[_request$7].saveAndFireRequest(pageLoadUrl, $ct.blockRequest); }; if (hasWebInboxSettingsInLS()) { @@ -8270,53 +7429,53 @@ } // Get Inbox Message Count - this.getInboxMessageCount = function () { - var msgCount = getInboxMessages(); + this.getInboxMessageCount = () => { + const msgCount = getInboxMessages(); return Object.keys(msgCount).length; }; // Get Inbox Unread Message Count - this.getInboxMessageUnreadCount = function () { + this.getInboxMessageUnreadCount = () => { if ($ct.inbox) { return $ct.inbox.unviewedCounter; } else { - _classPrivateFieldLooseBase(_this, _logger$a)[_logger$a].debug('No unread messages'); + _classPrivateFieldLooseBase(this, _logger$a)[_logger$a].debug('No unread messages'); } }; // Get All Inbox messages - this.getAllInboxMessages = function () { + this.getAllInboxMessages = () => { return getInboxMessages(); }; // Get only Unread messages - this.getUnreadInboxMessages = function () { + this.getUnreadInboxMessages = () => { if ($ct.inbox) { return $ct.inbox.unviewedMessages; } else { - _classPrivateFieldLooseBase(_this, _logger$a)[_logger$a].debug('No unread messages'); + _classPrivateFieldLooseBase(this, _logger$a)[_logger$a].debug('No unread messages'); } }; // Get message object belonging to the given message id only. Message id should be a String - this.getInboxMessageForId = function (messageId) { - var messages = getInboxMessages(); + this.getInboxMessageForId = messageId => { + const messages = getInboxMessages(); if ((messageId !== null || messageId !== '') && messages.hasOwnProperty(messageId)) { return messages[messageId]; } else { - _classPrivateFieldLooseBase(_this, _logger$a)[_logger$a].error('No message available for message Id ' + messageId); + _classPrivateFieldLooseBase(this, _logger$a)[_logger$a].error('No message available for message Id ' + messageId); } }; // Delete message from the Inbox. Message id should be a String // If the message to be deleted is unviewed then decrement the badge count, delete the message from unviewedMessages list // Then remove the message from local storage and update cookie - this.deleteInboxMessage = function (messageId) { - var messages = getInboxMessages(); + this.deleteInboxMessage = messageId => { + const messages = getInboxMessages(); if ((messageId !== null || messageId !== '') && messages.hasOwnProperty(messageId)) { - var el = document.querySelector('ct-web-inbox').shadowRoot.getElementById(messageId); + const el = document.querySelector('ct-web-inbox').shadowRoot.getElementById(messageId); if (messages[messageId].viewed === 0) { $ct.inbox.unviewedCounter--; @@ -8329,7 +7488,7 @@ delete messages[messageId]; saveInboxMessages(messages); } else { - _classPrivateFieldLooseBase(_this, _logger$a)[_logger$a].error('No message available for message Id ' + messageId); + _classPrivateFieldLooseBase(this, _logger$a)[_logger$a].error('No message available for message Id ' + messageId); } }; /* Mark Message as Read. Message id should be a String @@ -8338,12 +7497,12 @@ - renderNotificationViewed */ - this.markReadInboxMessage = function (messageId) { - var unreadMsg = $ct.inbox.unviewedMessages; - var messages = getInboxMessages(); + this.markReadInboxMessage = messageId => { + const unreadMsg = $ct.inbox.unviewedMessages; + const messages = getInboxMessages(); if ((messageId !== null || messageId !== '') && unreadMsg.hasOwnProperty(messageId)) { - var el = document.querySelector('ct-web-inbox').shadowRoot.getElementById(messageId); + const el = document.querySelector('ct-web-inbox').shadowRoot.getElementById(messageId); if (el !== null) { el.shadowRoot.getElementById('unreadMarker').style.display = 'none'; @@ -8365,16 +7524,16 @@ delete $ct.inbox.unviewedMessages[messageId]; saveInboxMessages(messages); } else { - _classPrivateFieldLooseBase(_this, _logger$a)[_logger$a].error('No message available for message Id ' + messageId); + _classPrivateFieldLooseBase(this, _logger$a)[_logger$a].error('No message available for message Id ' + messageId); } }; /* Mark Message as Read. messageIds should be a an array of string */ - this.markReadInboxMessagesForIds = function (messageIds) { + this.markReadInboxMessagesForIds = messageIds => { if (Array.isArray(messageIds)) { for (var id = 0; id < messageIds.length; id++) { - _this.markReadInboxMessage(messageIds[id]); + this.markReadInboxMessage(messageIds[id]); } } }; @@ -8384,14 +7543,14 @@ */ - this.markReadAllInboxMessage = function () { - var unreadMsg = $ct.inbox.unviewedMessages; - var messages = getInboxMessages(); + this.markReadAllInboxMessage = () => { + const unreadMsg = $ct.inbox.unviewedMessages; + const messages = getInboxMessages(); if (Object.keys(unreadMsg).length > 0) { - var msgIds = Object.keys(unreadMsg); - msgIds.forEach(function (key) { - var el = document.querySelector('ct-web-inbox').shadowRoot.getElementById(key); + const msgIds = Object.keys(unreadMsg); + msgIds.forEach(key => { + const el = document.querySelector('ct-web-inbox').shadowRoot.getElementById(key); if (el !== null) { el.shadowRoot.getElementById('unreadMarker').style.display = 'none'; @@ -8409,71 +7568,77 @@ $ct.inbox.unviewedCounter = 0; $ct.inbox.unviewedMessages = {}; } else { - _classPrivateFieldLooseBase(_this, _logger$a)[_logger$a].debug('All messages are already read'); + _classPrivateFieldLooseBase(this, _logger$a)[_logger$a].debug('All messages are already read'); } }; - this.toggleInbox = function (e) { + this.toggleInbox = e => { var _$ct$inbox; return (_$ct$inbox = $ct.inbox) === null || _$ct$inbox === void 0 ? void 0 : _$ct$inbox.toggleInbox(e); }; // method for notification viewed - this.renderNotificationViewed = function (detail) { + this.renderNotificationViewed = detail => { processNotificationEvent(NOTIFICATION_VIEWED, detail); }; // method for notification clicked - this.renderNotificationClicked = function (detail) { + this.renderNotificationClicked = detail => { processNotificationEvent(NOTIFICATION_CLICKED, detail); }; - var processNotificationEvent = function processNotificationEvent(eventName, eventDetail) { + const processNotificationEvent = (eventName, eventDetail) => { if (!eventDetail || !eventDetail.msgId) { return; } - var data = {}; + const data = {}; data.type = 'event'; data.evtName = eventName; - data.evtData = _defineProperty({}, WZRK_ID, eventDetail.msgId); + data.evtData = { + [WZRK_ID]: eventDetail.msgId + }; if (eventDetail.pivotId) { - data.evtData = _objectSpread2(_objectSpread2({}, data.evtData), {}, { + data.evtData = { ...data.evtData, wzrk_pivot: eventDetail.pivotId - }); + }; } if (eventDetail.wzrk_slideNo) { - data.evtData = _objectSpread2(_objectSpread2({}, data.evtData), {}, { + data.evtData = { ...data.evtData, wzrk_slideNo: eventDetail.wzrk_slideNo - }); + }; } // Adding kv pair to event data if (eventDetail.kv && eventDetail.kv !== null && eventDetail.kv !== undefined) { - for (var key in eventDetail.kv) { + for (const key in eventDetail.kv) { if (key.startsWith(WZRK_PREFIX)) { - data.evtData = _objectSpread2(_objectSpread2({}, data.evtData), {}, _defineProperty({}, key, eventDetail.kv[key])); + data.evtData = { ...data.evtData, + [key]: eventDetail.kv[key] + }; } } } // Adding msgCTkv to event data if (eventDetail.msgCTkv && eventDetail.msgCTkv !== null && eventDetail.msgCTkv !== undefined) { - for (var _key in eventDetail.msgCTkv) { - if (_key.startsWith(WZRK_PREFIX)) { - data.evtData = _objectSpread2(_objectSpread2({}, data.evtData), {}, _defineProperty({}, _key, eventDetail.msgCTkv[_key])); + for (const key in eventDetail.msgCTkv) { + if (key.startsWith(WZRK_PREFIX)) { + data.evtData = { ...data.evtData, + [key]: eventDetail.msgCTkv[key] + }; } } } - _classPrivateFieldLooseBase(_this, _request$7)[_request$7].processEvent(data); + _classPrivateFieldLooseBase(this, _request$7)[_request$7].processEvent(data); }; - this.setLogLevel = function (l) { - _classPrivateFieldLooseBase(_this, _logger$a)[_logger$a].logLevel = Number(l); + this.setLogLevel = l => { + _classPrivateFieldLooseBase(this, _logger$a)[_logger$a].logLevel = Number(l); if (l === 3) { sessionStorage.WZRK_D = ''; @@ -8487,60 +7652,60 @@ */ - this.handleIncrementValue = function (key, value) { - _this.profile._handleIncrementDecrementValue(key, value, COMMAND_INCREMENT); + this.handleIncrementValue = (key, value) => { + this.profile._handleIncrementDecrementValue(key, value, COMMAND_INCREMENT); }; - this.handleDecrementValue = function (key, value) { - _this.profile._handleIncrementDecrementValue(key, value, COMMAND_DECREMENT); + this.handleDecrementValue = (key, value) => { + this.profile._handleIncrementDecrementValue(key, value, COMMAND_DECREMENT); }; - this.setMultiValuesForKey = function (key, value) { + this.setMultiValuesForKey = (key, value) => { if (Array.isArray(value)) { - _this.profile._handleMultiValueSet(key, value, COMMAND_SET); + this.profile._handleMultiValueSet(key, value, COMMAND_SET); } else { console.error('setMultiValuesForKey should be called with a value of type array'); } }; - this.addMultiValueForKey = function (key, value) { + this.addMultiValueForKey = (key, value) => { if (typeof value === 'string' || typeof value === 'number') { - _this.profile._handleMultiValueAdd(key, value, COMMAND_ADD); + this.profile._handleMultiValueAdd(key, value, COMMAND_ADD); } else { console.error('addMultiValueForKey should be called with a value of type string or number.'); } }; - this.addMultiValuesForKey = function (key, value) { + this.addMultiValuesForKey = (key, value) => { if (Array.isArray(value)) { - _this.profile._handleMultiValueAdd(key, value, COMMAND_ADD); + this.profile._handleMultiValueAdd(key, value, COMMAND_ADD); } else { console.error('addMultiValuesForKey should be called with a value of type array.'); } }; - this.removeMultiValueForKey = function (key, value) { + this.removeMultiValueForKey = (key, value) => { if (typeof value === 'string' || typeof value === 'number') { - _this.profile._handleMultiValueRemove(key, value, COMMAND_REMOVE); + this.profile._handleMultiValueRemove(key, value, COMMAND_REMOVE); } else { console.error('removeMultiValueForKey should be called with a value of type string or number.'); } }; - this.removeMultiValuesForKey = function (key, value) { + this.removeMultiValuesForKey = (key, value) => { if (Array.isArray(value)) { - _this.profile._handleMultiValueRemove(key, value, COMMAND_REMOVE); + this.profile._handleMultiValueRemove(key, value, COMMAND_REMOVE); } else { console.error('removeMultiValuesForKey should be called with a value of type array.'); } }; - this.removeValueForKey = function (key) { - _this.profile._handleMultiValueDelete(key, COMMAND_DELETE); + this.removeValueForKey = key => { + this.profile._handleMultiValueDelete(key, COMMAND_DELETE); }; - var _handleEmailSubscription = function _handleEmailSubscription(subscription, reEncoded, fetchGroups) { - handleEmailSubscription(subscription, reEncoded, fetchGroups, _classPrivateFieldLooseBase(_this, _account$6)[_account$6], _classPrivateFieldLooseBase(_this, _logger$a)[_logger$a]); + const _handleEmailSubscription = (subscription, reEncoded, fetchGroups) => { + handleEmailSubscription(subscription, reEncoded, fetchGroups, _classPrivateFieldLooseBase(this, _account$6)[_account$6], _classPrivateFieldLooseBase(this, _logger$a)[_logger$a]); }; /** * @@ -8621,57 +7786,57 @@ } } - var api = _classPrivateFieldLooseBase(this, _api)[_api]; + const api = _classPrivateFieldLooseBase(this, _api)[_api]; api.logout = this.logout; api.clear = this.clear; - api.closeIframe = function (campaignId, divIdIgnored) { - closeIframe(campaignId, divIdIgnored, _classPrivateFieldLooseBase(_this, _session$3)[_session$3].sessionId); + api.closeIframe = (campaignId, divIdIgnored) => { + closeIframe(campaignId, divIdIgnored, _classPrivateFieldLooseBase(this, _session$3)[_session$3].sessionId); }; - api.enableWebPush = function (enabled, applicationServerKey) { - _this.notifications._enableWebPush(enabled, applicationServerKey); + api.enableWebPush = (enabled, applicationServerKey) => { + this.notifications._enableWebPush(enabled, applicationServerKey); }; - api.tr = function (msg) { + api.tr = msg => { _tr(msg, { - device: _classPrivateFieldLooseBase(_this, _device$3)[_device$3], - session: _classPrivateFieldLooseBase(_this, _session$3)[_session$3], - request: _classPrivateFieldLooseBase(_this, _request$7)[_request$7], - logger: _classPrivateFieldLooseBase(_this, _logger$a)[_logger$a] + device: _classPrivateFieldLooseBase(this, _device$3)[_device$3], + session: _classPrivateFieldLooseBase(this, _session$3)[_session$3], + request: _classPrivateFieldLooseBase(this, _request$7)[_request$7], + logger: _classPrivateFieldLooseBase(this, _logger$a)[_logger$a] }); }; - api.setEnum = function (enumVal) { - setEnum(enumVal, _classPrivateFieldLooseBase(_this, _logger$a)[_logger$a]); + api.setEnum = enumVal => { + setEnum(enumVal, _classPrivateFieldLooseBase(this, _logger$a)[_logger$a]); }; - api.is_onloadcalled = function () { - return _classPrivateFieldLooseBase(_this, _onloadcalled)[_onloadcalled] === 1; + api.is_onloadcalled = () => { + return _classPrivateFieldLooseBase(this, _onloadcalled)[_onloadcalled] === 1; }; - api.subEmail = function (reEncoded) { + api.subEmail = reEncoded => { _handleEmailSubscription('1', reEncoded); }; - api.getEmail = function (reEncoded, withGroups) { + api.getEmail = (reEncoded, withGroups) => { _handleEmailSubscription('-1', reEncoded, withGroups); }; - api.unSubEmail = function (reEncoded) { + api.unSubEmail = reEncoded => { _handleEmailSubscription('0', reEncoded); }; - api.unsubEmailGroups = function (reEncoded) { + api.unsubEmailGroups = reEncoded => { $ct.unsubGroups = []; - var elements = document.getElementsByClassName('ct-unsub-group-input-item'); + const elements = document.getElementsByClassName('ct-unsub-group-input-item'); - for (var i = 0; i < elements.length; i++) { - var element = elements[i]; + for (let i = 0; i < elements.length; i++) { + const element = elements[i]; if (element.name) { - var data = { + const data = { name: element.name, isUnsubscribed: element.checked }; @@ -8682,29 +7847,29 @@ _handleEmailSubscription(GROUP_SUBSCRIPTION_REQUEST_ID, reEncoded); }; - api.setSubscriptionGroups = function (value) { + api.setSubscriptionGroups = value => { $ct.unsubGroups = value; }; - api.getSubscriptionGroups = function () { + api.getSubscriptionGroups = () => { return $ct.unsubGroups; }; - api.changeSubscriptionGroups = function (reEncoded, updatedGroups) { + api.changeSubscriptionGroups = (reEncoded, updatedGroups) => { api.setSubscriptionGroups(updatedGroups); _handleEmailSubscription(GROUP_SUBSCRIPTION_REQUEST_ID, reEncoded); }; - api.isGlobalUnsubscribe = function () { + api.isGlobalUnsubscribe = () => { return $ct.globalUnsubscribe; }; - api.setIsGlobalUnsubscribe = function (value) { + api.setIsGlobalUnsubscribe = value => { $ct.globalUnsubscribe = value; }; - api.setUpdatedCategoryLong = function (profile) { + api.setUpdatedCategoryLong = profile => { if (profile[categoryLongKey]) { $ct.updatedCategoryLong = profile[categoryLongKey]; } @@ -8721,288 +7886,272 @@ } // starts here - _createClass(CleverTap, [{ - key: "init", - value: function init(accountId, region, targetDomain, token) { - var _this2 = this; + init(accountId, region, targetDomain, token) { + if (_classPrivateFieldLooseBase(this, _onloadcalled)[_onloadcalled] === 1) { + // already initailsed + return; + } + + StorageManager.removeCookie('WZRK_P', window.location.hostname); + + if (!_classPrivateFieldLooseBase(this, _account$6)[_account$6].id) { + if (!accountId) { + _classPrivateFieldLooseBase(this, _logger$a)[_logger$a].error(EMBED_ERROR); - if (_classPrivateFieldLooseBase(this, _onloadcalled)[_onloadcalled] === 1) { - // already initailsed return; } - StorageManager.removeCookie('WZRK_P', window.location.hostname); + _classPrivateFieldLooseBase(this, _account$6)[_account$6].id = accountId; + } - if (!_classPrivateFieldLooseBase(this, _account$6)[_account$6].id) { - if (!accountId) { - _classPrivateFieldLooseBase(this, _logger$a)[_logger$a].error(EMBED_ERROR); + _classPrivateFieldLooseBase(this, _session$3)[_session$3].cookieName = SCOOKIE_PREFIX + '_' + _classPrivateFieldLooseBase(this, _account$6)[_account$6].id; - return; - } + if (region) { + _classPrivateFieldLooseBase(this, _account$6)[_account$6].region = region; + } - _classPrivateFieldLooseBase(this, _account$6)[_account$6].id = accountId; - } + if (targetDomain) { + _classPrivateFieldLooseBase(this, _account$6)[_account$6].targetDomain = targetDomain; + } - _classPrivateFieldLooseBase(this, _session$3)[_session$3].cookieName = SCOOKIE_PREFIX + '_' + _classPrivateFieldLooseBase(this, _account$6)[_account$6].id; + if (token) { + _classPrivateFieldLooseBase(this, _account$6)[_account$6].token = token; + } - if (region) { - _classPrivateFieldLooseBase(this, _account$6)[_account$6].region = region; - } + const currLocation = location.href; + const urlParams = getURLParams(currLocation.toLowerCase()); // eslint-disable-next-line eqeqeq - if (targetDomain) { - _classPrivateFieldLooseBase(this, _account$6)[_account$6].targetDomain = targetDomain; - } + if (typeof urlParams.e !== 'undefined' && urlParams.wzrk_ex == '0') { + return; + } - if (token) { - _classPrivateFieldLooseBase(this, _account$6)[_account$6].token = token; - } + $ct.isPrivacyArrPushed = true; - var currLocation = location.href; - var urlParams = getURLParams(currLocation.toLowerCase()); // eslint-disable-next-line eqeqeq + if ($ct.privacyArray.length > 0) { + this.privacy.push($ct.privacyArray); + } - if (typeof urlParams.e !== 'undefined' && urlParams.wzrk_ex == '0') { - return; - } + _classPrivateFieldLooseBase(this, _processOldValues)[_processOldValues](); - $ct.isPrivacyArrPushed = true; + this.pageChanged(); + const backupInterval = setInterval(() => { + if (_classPrivateFieldLooseBase(this, _device$3)[_device$3].gcookie) { + clearInterval(backupInterval); - if ($ct.privacyArray.length > 0) { - this.privacy.push($ct.privacyArray); + _classPrivateFieldLooseBase(this, _request$7)[_request$7].processBackupEvents(); } + }, 3000); - _classPrivateFieldLooseBase(this, _processOldValues)[_processOldValues](); + if (_classPrivateFieldLooseBase(this, _isSpa)[_isSpa]) { + // listen to click on the document and check if URL has changed. + document.addEventListener('click', _classPrivateFieldLooseBase(this, _boundCheckPageChanged)[_boundCheckPageChanged]); + } else { + // remove existing click listeners if any + document.removeEventListener('click', _classPrivateFieldLooseBase(this, _boundCheckPageChanged)[_boundCheckPageChanged]); + } - this.pageChanged(); - var backupInterval = setInterval(function () { - if (_classPrivateFieldLooseBase(_this2, _device$3)[_device$3].gcookie) { - clearInterval(backupInterval); + _classPrivateFieldLooseBase(this, _onloadcalled)[_onloadcalled] = 1; + } // process the option array provided to the clevertap object + // after its been initialized - _classPrivateFieldLooseBase(_this2, _request$7)[_request$7].processBackupEvents(); - } - }, 3000); - if (_classPrivateFieldLooseBase(this, _isSpa)[_isSpa]) { - // listen to click on the document and check if URL has changed. - document.addEventListener('click', _classPrivateFieldLooseBase(this, _boundCheckPageChanged)[_boundCheckPageChanged]); - } else { - // remove existing click listeners if any - document.removeEventListener('click', _classPrivateFieldLooseBase(this, _boundCheckPageChanged)[_boundCheckPageChanged]); - } + pageChanged() { + const currLocation = window.location.href; + const urlParams = getURLParams(currLocation.toLowerCase()); // -- update page count - _classPrivateFieldLooseBase(this, _onloadcalled)[_onloadcalled] = 1; - } // process the option array provided to the clevertap object - // after its been initialized + const obj = _classPrivateFieldLooseBase(this, _session$3)[_session$3].getSessionCookieObject(); - }, { - key: "pageChanged", - value: function pageChanged() { - var _this3 = this; + let pgCount = typeof obj.p === 'undefined' ? 0 : obj.p; + obj.p = ++pgCount; - var currLocation = window.location.href; - var urlParams = getURLParams(currLocation.toLowerCase()); // -- update page count + _classPrivateFieldLooseBase(this, _session$3)[_session$3].setSessionCookieObject(obj); // -- update page count - var obj = _classPrivateFieldLooseBase(this, _session$3)[_session$3].getSessionCookieObject(); - var pgCount = typeof obj.p === 'undefined' ? 0 : obj.p; - obj.p = ++pgCount; + let data = {}; + let referrerDomain = getDomain(document.referrer); - _classPrivateFieldLooseBase(this, _session$3)[_session$3].setSessionCookieObject(obj); // -- update page count + if (window.location.hostname !== referrerDomain) { + const maxLen = 120; + if (referrerDomain !== '') { + referrerDomain = referrerDomain.length > maxLen ? referrerDomain.substring(0, maxLen) : referrerDomain; + data.referrer = referrerDomain; + } + + let utmSource = urlParams.utm_source || urlParams.wzrk_source; - var data = {}; - var referrerDomain = getDomain(document.referrer); + if (typeof utmSource !== 'undefined') { + utmSource = utmSource.length > maxLen ? utmSource.substring(0, maxLen) : utmSource; + data.us = utmSource; // utm_source + } - if (window.location.hostname !== referrerDomain) { - var maxLen = 120; + let utmMedium = urlParams.utm_medium || urlParams.wzrk_medium; - if (referrerDomain !== '') { - referrerDomain = referrerDomain.length > maxLen ? referrerDomain.substring(0, maxLen) : referrerDomain; - data.referrer = referrerDomain; - } + if (typeof utmMedium !== 'undefined') { + utmMedium = utmMedium.length > maxLen ? utmMedium.substring(0, maxLen) : utmMedium; + data.um = utmMedium; // utm_medium + } - var utmSource = urlParams.utm_source || urlParams.wzrk_source; + let utmCampaign = urlParams.utm_campaign || urlParams.wzrk_campaign; - if (typeof utmSource !== 'undefined') { - utmSource = utmSource.length > maxLen ? utmSource.substring(0, maxLen) : utmSource; - data.us = utmSource; // utm_source - } + if (typeof utmCampaign !== 'undefined') { + utmCampaign = utmCampaign.length > maxLen ? utmCampaign.substring(0, maxLen) : utmCampaign; + data.uc = utmCampaign; // utm_campaign + } // also independently send wzrk_medium to the backend - var utmMedium = urlParams.utm_medium || urlParams.wzrk_medium; - if (typeof utmMedium !== 'undefined') { - utmMedium = utmMedium.length > maxLen ? utmMedium.substring(0, maxLen) : utmMedium; - data.um = utmMedium; // utm_medium + if (typeof urlParams.wzrk_medium !== 'undefined') { + const wm = urlParams.wzrk_medium; + + if (wm.match(/^email$|^social$|^search$/)) { + data.wm = wm; // wzrk_medium } + } + } - var utmCampaign = urlParams.utm_campaign || urlParams.wzrk_campaign; + data = _classPrivateFieldLooseBase(this, _request$7)[_request$7].addSystemDataToObject(data, undefined); + data.cpg = currLocation; + data[CAMP_COOKIE_NAME] = getCampaignObjForLc(); - if (typeof utmCampaign !== 'undefined') { - utmCampaign = utmCampaign.length > maxLen ? utmCampaign.substring(0, maxLen) : utmCampaign; - data.uc = utmCampaign; // utm_campaign - } // also independently send wzrk_medium to the backend + let pageLoadUrl = _classPrivateFieldLooseBase(this, _account$6)[_account$6].dataPostURL; + _classPrivateFieldLooseBase(this, _request$7)[_request$7].addFlags(data); // send dsync flag when page = 1 - if (typeof urlParams.wzrk_medium !== 'undefined') { - var wm = urlParams.wzrk_medium; - if (wm.match(/^email$|^social$|^search$/)) { - data.wm = wm; // wzrk_medium - } - } - } + if (parseInt(data.pg) === 1) { + _classPrivateFieldLooseBase(this, _overrideDSyncFlag)[_overrideDSyncFlag](data); + } - data = _classPrivateFieldLooseBase(this, _request$7)[_request$7].addSystemDataToObject(data, undefined); - data.cpg = currLocation; - data[CAMP_COOKIE_NAME] = getCampaignObjForLc(); + pageLoadUrl = addToURL(pageLoadUrl, 'type', 'page'); + pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(JSON.stringify(data), _classPrivateFieldLooseBase(this, _logger$a)[_logger$a])); - var pageLoadUrl = _classPrivateFieldLooseBase(this, _account$6)[_account$6].dataPostURL; + _classPrivateFieldLooseBase(this, _request$7)[_request$7].saveAndFireRequest(pageLoadUrl, $ct.blockRequest); - _classPrivateFieldLooseBase(this, _request$7)[_request$7].addFlags(data); // send dsync flag when page = 1 + if (parseInt(data.pg) === 1) { + this.event.push(WZRK_FETCH, { + t: 4 + }); + } + _classPrivateFieldLooseBase(this, _previousUrl)[_previousUrl] = currLocation; + setTimeout(() => { + if (pgCount <= 3) { + // send ping for up to 3 pages + _classPrivateFieldLooseBase(this, _pingRequest)[_pingRequest](); + } - if (parseInt(data.pg) === 1) { - _classPrivateFieldLooseBase(this, _overrideDSyncFlag)[_overrideDSyncFlag](data); + if (_classPrivateFieldLooseBase(this, _isPingContinuous)[_isPingContinuous]()) { + setInterval(() => { + _classPrivateFieldLooseBase(this, _pingRequest)[_pingRequest](); + }, CONTINUOUS_PING_FREQ_IN_MILLIS); } + }, FIRST_PING_FREQ_IN_MILLIS); + } - pageLoadUrl = addToURL(pageLoadUrl, 'type', 'page'); - pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(JSON.stringify(data), _classPrivateFieldLooseBase(this, _logger$a)[_logger$a])); + _isPersonalisationActive() { + return StorageManager._isLocalStorageSupported() && this.enablePersonalization; + } - _classPrivateFieldLooseBase(this, _request$7)[_request$7].saveAndFireRequest(pageLoadUrl, $ct.blockRequest); + // eslint-disable-next-line accessor-pairs + set popupCallback(callback) { + this.popupCallbacks[this.popupCurrentWzrkId] = callback; + } + /** + * + * @param {object} payload + */ - if (parseInt(data.pg) === 1) { - this.event.push(WZRK_FETCH, { - t: 4 - }); - } - _classPrivateFieldLooseBase(this, _previousUrl)[_previousUrl] = currLocation; - setTimeout(function () { - if (pgCount <= 3) { - // send ping for up to 3 pages - _classPrivateFieldLooseBase(_this3, _pingRequest)[_pingRequest](); - } + sendLocationData(payload) { + // Send the updated value to LC + let data = {}; + data.af = {}; + const profileObj = {}; + data.type = 'profile'; - if (_classPrivateFieldLooseBase(_this3, _isPingContinuous)[_isPingContinuous]()) { - setInterval(function () { - _classPrivateFieldLooseBase(_this3, _pingRequest)[_pingRequest](); - }, CONTINUOUS_PING_FREQ_IN_MILLIS); - } - }, FIRST_PING_FREQ_IN_MILLIS); + if (profileObj.tz == null) { + profileObj.tz = new Date().toString().match(/([A-Z]+[\+-][0-9]+)/)[1]; + } + + data.profile = profileObj; + + if (payload) { + const keys = Object.keys(payload); + keys.forEach(key => { + data.af[key] = payload[key]; + }); } - }, { - key: "_isPersonalisationActive", - value: function _isPersonalisationActive() { - return StorageManager._isLocalStorageSupported() && this.enablePersonalization; + + if ($ct.location) { + data.af = { ...data.af, + ...$ct.location + }; } - }, { - key: "sendLocationData", - /** - * - * @param {object} payload - */ - value: function sendLocationData(payload) { - // Send the updated value to LC - var data = {}; - data.af = {}; - var profileObj = {}; - data.type = 'profile'; + data = _classPrivateFieldLooseBase(this, _request$7)[_request$7].addSystemDataToObject(data, true); - if (profileObj.tz == null) { - profileObj.tz = new Date().toString().match(/([A-Z]+[\+-][0-9]+)/)[1]; - } + _classPrivateFieldLooseBase(this, _request$7)[_request$7].addFlags(data); - data.profile = profileObj; + const compressedData = compressData(JSON.stringify(data), _classPrivateFieldLooseBase(this, _logger$a)[_logger$a]); - if (payload) { - var keys = Object.keys(payload); - keys.forEach(function (key) { - data.af[key] = payload[key]; - }); - } + let pageLoadUrl = _classPrivateFieldLooseBase(this, _account$6)[_account$6].dataPostURL; - if ($ct.location) { - data.af = _objectSpread2(_objectSpread2({}, data.af), $ct.location); - } + pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH); + pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData); - data = _classPrivateFieldLooseBase(this, _request$7)[_request$7].addSystemDataToObject(data, true); + _classPrivateFieldLooseBase(this, _request$7)[_request$7].saveAndFireRequest(pageLoadUrl, $ct.blockRequest); + } // offline mode - _classPrivateFieldLooseBase(this, _request$7)[_request$7].addFlags(data); + /** + * events will be recorded and queued locally when passed with true + * but will not be sent to the server until offline is disabled by passing false + * @param {boolean} arg + */ - var compressedData = compressData(JSON.stringify(data), _classPrivateFieldLooseBase(this, _logger$a)[_logger$a]); - var pageLoadUrl = _classPrivateFieldLooseBase(this, _account$6)[_account$6].dataPostURL; + setOffline(arg) { + if (typeof arg !== 'boolean') { + console.error('setOffline should be called with a value of type boolean'); + return; + } - pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH); - pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData); + $ct.offline = arg; // if offline is disabled + // process events from cache - _classPrivateFieldLooseBase(this, _request$7)[_request$7].saveAndFireRequest(pageLoadUrl, $ct.blockRequest); - } // offline mode + if (!arg) { + _classPrivateFieldLooseBase(this, _request$7)[_request$7].processBackupEvents(); + } + } - /** - * events will be recorded and queued locally when passed with true - * but will not be sent to the server until offline is disabled by passing false - * @param {boolean} arg - */ + defineVariable(name, defaultValue) { + return Variable.define(name, defaultValue, _classPrivateFieldLooseBase(this, _variableStore$1)[_variableStore$1]); + } - }, { - key: "setOffline", - value: function setOffline(arg) { - if (typeof arg !== 'boolean') { - console.error('setOffline should be called with a value of type boolean'); - return; - } + syncVariables(onSyncSuccess, onSyncFailure) { + if (_classPrivateFieldLooseBase(this, _logger$a)[_logger$a].logLevel === 4) { + return _classPrivateFieldLooseBase(this, _variableStore$1)[_variableStore$1].syncVariables(onSyncSuccess, onSyncFailure); + } else { + const m = 'App log level is not set to 4'; - $ct.offline = arg; // if offline is disabled - // process events from cache + _classPrivateFieldLooseBase(this, _logger$a)[_logger$a].error(m); - if (!arg) { - _classPrivateFieldLooseBase(this, _request$7)[_request$7].processBackupEvents(); - } + return Promise.reject(new Error(m)); } - }, { - key: "defineVariable", - value: function defineVariable(name, defaultValue) { - return Variable.define(name, defaultValue, _classPrivateFieldLooseBase(this, _variableStore$1)[_variableStore$1]); - } - }, { - key: "syncVariables", - value: function syncVariables(onSyncSuccess, onSyncFailure) { - if (_classPrivateFieldLooseBase(this, _logger$a)[_logger$a].logLevel === 4) { - return _classPrivateFieldLooseBase(this, _variableStore$1)[_variableStore$1].syncVariables(onSyncSuccess, onSyncFailure); - } else { - var m = 'App log level is not set to 4'; + } - _classPrivateFieldLooseBase(this, _logger$a)[_logger$a].error(m); + fetchVariables(onFetchCallback) { + _classPrivateFieldLooseBase(this, _variableStore$1)[_variableStore$1].fetchVariables(onFetchCallback); + } - return Promise.reject(new Error(m)); - } - } - }, { - key: "fetchVariables", - value: function fetchVariables(onFetchCallback) { - _classPrivateFieldLooseBase(this, _variableStore$1)[_variableStore$1].fetchVariables(onFetchCallback); - } - }, { - key: "addVariablesChangedCallback", - value: function addVariablesChangedCallback(callback) { - _classPrivateFieldLooseBase(this, _variableStore$1)[_variableStore$1].addVariablesChangedCallback(callback); - } - }, { - key: "addOneTimeVariablesChangedCallback", - value: function addOneTimeVariablesChangedCallback(callback) { - _classPrivateFieldLooseBase(this, _variableStore$1)[_variableStore$1].addOneTimeVariablesChangedCallback(callback); - } - }, { - key: "popupCallback", - // eslint-disable-next-line accessor-pairs - set: function set(callback) { - this.popupCallbacks[this.popupCurrentWzrkId] = callback; - } - }]); + addVariablesChangedCallback(callback) { + _classPrivateFieldLooseBase(this, _variableStore$1)[_variableStore$1].addVariablesChangedCallback(callback); + } + + addOneTimeVariablesChangedCallback(callback) { + _classPrivateFieldLooseBase(this, _variableStore$1)[_variableStore$1].addOneTimeVariablesChangedCallback(callback); + } - return CleverTap; - }(); + } var _processOldValues2 = function _processOldValues2() { this.onUserLogin._processOldValues(); @@ -9017,8 +8166,8 @@ }; var _debounce2 = function _debounce2(func) { - var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300; - var timeout; + let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300; + let timeout; return function () { clearTimeout(timeout); timeout = setTimeout(func, delay); @@ -9026,11 +8175,9 @@ }; var _checkPageChanged2 = function _checkPageChanged2() { - var _this4 = this; - - var debouncedPageChanged = _classPrivateFieldLooseBase(this, _debounce)[_debounce](function () { - if (_classPrivateFieldLooseBase(_this4, _previousUrl)[_previousUrl] !== location.href) { - _this4.pageChanged(); + const debouncedPageChanged = _classPrivateFieldLooseBase(this, _debounce)[_debounce](() => { + if (_classPrivateFieldLooseBase(this, _previousUrl)[_previousUrl] !== location.href) { + this.pageChanged(); } }); @@ -9038,9 +8185,9 @@ }; var _pingRequest2 = function _pingRequest2() { - var pageLoadUrl = _classPrivateFieldLooseBase(this, _account$6)[_account$6].dataPostURL; + let pageLoadUrl = _classPrivateFieldLooseBase(this, _account$6)[_account$6].dataPostURL; - var data = {}; + let data = {}; data = _classPrivateFieldLooseBase(this, _request$7)[_request$7].addSystemDataToObject(data, undefined); pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PING); pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(JSON.stringify(data), _classPrivateFieldLooseBase(this, _logger$a)[_logger$a])); @@ -9058,7 +8205,7 @@ } }; - var clevertap = new CleverTap(window.clevertap); + const clevertap = new CleverTap(window.clevertap); window.clevertap = window.wizrocket = clevertap; return clevertap; diff --git a/clevertap.js.map b/clevertap.js.map index 86ba7427..34adbcf8 100644 --- a/clevertap.js.map +++ b/clevertap.js.map @@ -1 +1 @@ -{"version":3,"file":"clevertap.js","sources":["src/options.js","src/modules/account.js","src/util/constants.js","src/util/datatypes.js","src/util/datetime.js","src/util/storage.js","src/util/lruCache.js","src/modules/api.js","src/modules/device.js","src/util/messages.js","src/util/validator.js","src/modules/event.js","src/util/url.js","src/util/encoder.js","src/util/requestDispatcher.js","src/util/clevertap.js","src/modules/profile.js","src/modules/userLogin.js","src/util/web-personalisation/banner.js","src/util/web-personalisation/carousel.js","src/util/web-popupImageonly/popupImageonly.js","src/modules/web-inbox/Message.js","src/modules/web-inbox/inboxStyles.js","src/modules/web-inbox/WebInbox.js","src/modules/web-inbox/helper.js","src/util/clevertap-handler.js","src/util/tr.js","src/modules/user.js","src/modules/logger.js","src/modules/session.js","src/modules/request.js","src/modules/privacy.js","src/modules/notification.js","src/modules/variables/variable.js","src/modules/variables/variableStore.js","src/clevertap.js","src/main.js"],"sourcesContent":["export const TARGET_DOMAIN = 'clevertap-prod.com'\nexport const TARGET_PROTOCOL = 'https:'\nexport const DEFAULT_REGION = 'eu1'\n","import { DEFAULT_REGION, TARGET_DOMAIN, TARGET_PROTOCOL } from '../options'\n\nexport default class Account {\n #accountId\n #region = ''\n #targetDomain = TARGET_DOMAIN\n #dcSdkversion = ''\n #token = ''\n\n constructor ({ id } = {}, region = '', targetDomain = TARGET_DOMAIN, token = '') {\n this.id = id\n if (region) {\n this.region = region\n }\n if (targetDomain) {\n this.targetDomain = targetDomain\n }\n if (token) {\n this.token = token\n }\n }\n\n get id () {\n return this.#accountId\n }\n\n set id (accountId) {\n this.#accountId = accountId\n }\n\n get region () {\n return this.#region\n }\n\n set region (region) {\n this.#region = region\n }\n\n get dcSDKVersion () {\n return this.#dcSdkversion\n }\n\n set dcSDKVersion (dcSDKVersion) {\n this.#dcSdkversion = dcSDKVersion\n }\n\n get targetDomain () {\n return this.#targetDomain\n }\n\n set targetDomain (targetDomain) {\n this.#targetDomain = targetDomain\n }\n\n get token () {\n return this.#token\n }\n\n set token (token) {\n this.#token = token\n }\n\n get finalTargetDomain () {\n if (this.region) {\n return `${this.region}.${this.targetDomain}`\n } else {\n if (this.targetDomain === TARGET_DOMAIN) {\n return `${DEFAULT_REGION}.${this.targetDomain}`\n }\n return this.targetDomain\n }\n }\n\n get dataPostPEURL () {\n return `${TARGET_PROTOCOL}//${this.finalTargetDomain}/defineVars`\n }\n\n get dataPostURL () {\n return `${TARGET_PROTOCOL}//${this.finalTargetDomain}/a?t=96`\n }\n\n get recorderURL () {\n return `${TARGET_PROTOCOL}//${this.finalTargetDomain}/r?r=1`\n }\n\n get emailURL () {\n return `${TARGET_PROTOCOL}//${this.finalTargetDomain}/e?r=1`\n }\n}\n","export const unsupportedKeyCharRegex = new RegExp('^\\\\s+|\\\\\\.|\\:|\\\\\\$|\\'|\\\"|\\\\\\\\|\\\\s+$', 'g')\nexport const unsupportedValueCharRegex = new RegExp(\"^\\\\s+|\\'|\\\"|\\\\\\\\|\\\\s+$\", 'g')\nexport const doubleQuoteRegex = new RegExp('\\\"', 'g')\nexport const singleQuoteRegex = new RegExp('\\'', 'g')\nexport const CLEAR = 'clear'\nexport const CHARGED_ID = 'Charged ID'\nexport const CHARGEDID_COOKIE_NAME = 'WZRK_CHARGED_ID'\nexport const GCOOKIE_NAME = 'WZRK_G'\nexport const KCOOKIE_NAME = 'WZRK_K'\nexport const CAMP_COOKIE_NAME = 'WZRK_CAMP'\nexport const CAMP_COOKIE_G = 'WZRK_CAMP_G'// cookie for storing campaign details against guid\nexport const SCOOKIE_PREFIX = 'WZRK_S'\nexport const SCOOKIE_EXP_TIME_IN_SECS = 60 * 20 // 20 mins\nexport const EV_COOKIE = 'WZRK_EV'\nexport const META_COOKIE = 'WZRK_META'\nexport const PR_COOKIE = 'WZRK_PR'\nexport const ARP_COOKIE = 'WZRK_ARP'\nexport const LCOOKIE_NAME = 'WZRK_L'\nexport const NOTIF_COOKIE_NAME = 'WZRK_N'\nexport const GLOBAL = 'global' // used for email unsubscribe also\nexport const TOTAL_COUNT = 'tc'\nexport const DISPLAY = 'display'\nexport const UNDEFINED = 'undefined'\nexport const WEBPUSH_LS_KEY = 'WZRK_WPR'\nexport const OPTOUT_KEY = 'optOut'\nexport const CT_OPTOUT_KEY = 'ct_optout'\nexport const OPTOUT_COOKIE_ENDSWITH = ':OO'\nexport const USEIP_KEY = 'useIP'\nexport const LRU_CACHE = 'WZRK_X'\nexport const LRU_CACHE_SIZE = 100\nexport const IS_OUL = 'isOUL'\nexport const EVT_PUSH = 'push'\nexport const EVT_PING = 'ping'\nexport const COOKIE_EXPIRY = 86400 * 365 // 1 Year in seconds\nexport const MAX_TRIES = 200 // API tries\nexport const FIRST_PING_FREQ_IN_MILLIS = 2 * 60 * 1000 // 2 mins\nexport const CONTINUOUS_PING_FREQ_IN_MILLIS = 5 * 60 * 1000 // 5 mins\nexport const GROUP_SUBSCRIPTION_REQUEST_ID = '2'\nexport const categoryLongKey = 'cUsY'\nexport const WZRK_PREFIX = 'wzrk_'\nexport const WZRK_ID = 'wzrk_id'\nexport const NOTIFICATION_VIEWED = 'Notification Viewed'\nexport const NOTIFICATION_CLICKED = 'Notification Clicked'\nexport const FIRE_PUSH_UNREGISTERED = 'WZRK_FPU'\nexport const PUSH_SUBSCRIPTION_DATA = 'WZRK_PSD' // PUSH SUBSCRIPTION DATA FOR REGISTER/UNREGISTER TOKEN\nexport const COMMAND_INCREMENT = '$incr'\nexport const COMMAND_DECREMENT = '$decr'\nexport const COMMAND_SET = '$set'\nexport const COMMAND_ADD = '$add'\nexport const COMMAND_REMOVE = '$remove'\nexport const COMMAND_DELETE = '$delete'\nexport const WEBINBOX_CONFIG = 'WZRK_INBOX_CONFIG'\nexport const WEBINBOX = 'WZRK_INBOX'\nexport const MAX_INBOX_MSG = 15\nexport const VARIABLES = 'WZRK_PE'\nexport const PUSH_DELAY_MS = 1000\nexport const MAX_DELAY_FREQUENCY = 1000 * 60 * 10\nexport const WZRK_FETCH = 'wzrk_fetch'\nexport const WIZ_IFRAME = 'wiz-iframe'\nexport const WIZ_IFRAME_INTENT = 'wiz-iframe-intent'\nexport const ADJUST_IFRAME_HEIGHT = 'adjustIFrameHeight'\nexport const UPDATE_HEIGHT = 'update height'\nexport const GET_NOTIFICATION = 'getnotif'\nexport const EVENT = 'Event'\nexport const PROFILE = 'Profile'\nexport const OUL = 'OUL'\nexport const CLOSE_BOX_POPUP = 'closeBoxPopUp'\nexport const CLOSE_BANNER_POPUP = 'closeBannerPopUp'\nexport const GET_NOTIFICATION_DATA = 'getnotifData'\nexport const CLOSE_INTERSTITIAL_POPUP = 'closeInterstitialPopUp'\n\nexport const SYSTEM_EVENTS = [\n 'Stayed',\n 'UTM Visited',\n 'App Launched',\n 'Notification Sent',\n NOTIFICATION_VIEWED,\n NOTIFICATION_CLICKED\n]\n","import {\n unsupportedKeyCharRegex,\n unsupportedValueCharRegex\n} from './constants'\n\nexport const isString = (input) => {\n return (typeof input === 'string' || input instanceof String)\n}\n\nexport const isObject = (input) => {\n // TODO: refine\n return Object.prototype.toString.call(input) === '[object Object]'\n}\n\nexport const isDateObject = (input) => {\n return typeof (input) === 'object' && (input instanceof Date)\n}\n\nexport const isObjectEmpty = (obj) => {\n for (const prop in obj) {\n if (obj.hasOwnProperty(prop)) { return false }\n }\n return true\n}\n\nexport const isConvertibleToNumber = (n) => {\n return !isNaN(parseFloat(n)) && isFinite(n)\n}\n\nexport const isNumber = (n) => {\n return /^-?[\\d.]+(?:e-?\\d+)?$/.test(n) && typeof n === 'number'\n}\n\nexport const isValueValid = (value) => {\n if (value === null || value === undefined || value === 'undefined') {\n return false\n }\n return true\n}\n\nexport const arrayContains = (arr, obj) => {\n var i = arr.length\n while (i--) {\n if (arr[i] === obj) {\n return true\n }\n }\n return false\n}\n\nexport const removeUnsupportedChars = (o, logger) => {\n // keys can't be greater than 1024 chars, values can't be greater than 1024 chars\n if (typeof o === 'object') {\n for (const key in o) {\n if (o.hasOwnProperty(key)) {\n const sanitizedVal = removeUnsupportedChars(o[key], logger)\n let sanitizedKey\n sanitizedKey = sanitize(key, unsupportedKeyCharRegex)\n if (sanitizedKey.length > 1024) {\n sanitizedKey = sanitizedKey.substring(0, 1024)\n logger.reportError(520, sanitizedKey + '... length exceeded 1024 chars. Trimmed.')\n }\n delete o[key]\n o[sanitizedKey] = sanitizedVal\n }\n }\n } else {\n let val\n\n if (isString(o)) {\n val = sanitize(o, unsupportedValueCharRegex)\n if (val.length > 1024) {\n val = val.substring(0, 1024)\n logger.reportError(521, val + '... length exceeded 1024 chars. Trimmed.')\n }\n } else {\n val = o\n }\n return val\n }\n return o\n}\n\nexport const sanitize = (input, regex) => {\n return input.replace(regex, '')\n}\n","export const getToday = () => {\n const today = new Date()\n return today.getFullYear() + '' + today.getMonth() + '' + today.getDay()\n}\n\nexport const getNow = () => {\n return Math.floor((new Date()).getTime() / 1000)\n}\n\nexport const convertToWZRKDate = (dateObj) => {\n return ('$D_' + Math.round(dateObj.getTime() / 1000))\n}\n\nexport const setDate = (dt) => {\n // expecting yyyymmdd format either as a number or a string\n if (isDateValid(dt)) {\n return '$D_' + dt\n }\n}\n\nexport const isDateValid = (date) => {\n const matches = /^(\\d{4})(\\d{2})(\\d{2})$/.exec(date)\n if (matches == null) return false\n const d = matches[3]\n const m = matches[2] - 1\n const y = matches[1]\n const composedDate = new Date(y, m, d)\n // eslint-disable-next-line eqeqeq\n return composedDate.getDate() == d && composedDate.getMonth() == m && composedDate.getFullYear() == y\n}\n","import {\n GCOOKIE_NAME,\n META_COOKIE,\n KCOOKIE_NAME,\n LCOOKIE_NAME\n} from './constants'\nexport class StorageManager {\n static save (key, value) {\n if (!key || !value) {\n return false\n }\n if (this._isLocalStorageSupported()) {\n localStorage.setItem(key, typeof value === 'string' ? value : JSON.stringify(value))\n return true\n }\n }\n\n static read (key) {\n if (!key) {\n return false\n }\n let data = null\n if (this._isLocalStorageSupported()) {\n data = localStorage.getItem(key)\n }\n if (data != null) {\n try {\n data = JSON.parse(data)\n } catch (e) {}\n }\n return data\n }\n\n static remove (key) {\n if (!key) {\n return false\n }\n if (this._isLocalStorageSupported()) {\n localStorage.removeItem(key)\n return true\n }\n }\n\n static removeCookie (name, domain) {\n let cookieStr = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;'\n\n if (domain) {\n cookieStr = cookieStr + ' domain=' + domain + '; path=/'\n }\n\n document.cookie = cookieStr\n }\n\n static createCookie (name, value, seconds, domain) {\n let expires = ''\n let domainStr = ''\n if (seconds) {\n const date = new Date()\n date.setTime(date.getTime() + (seconds * 1000))\n\n expires = '; expires=' + date.toGMTString()\n }\n\n if (domain) {\n domainStr = '; domain=' + domain\n }\n\n value = encodeURIComponent(value)\n\n document.cookie = name + '=' + value + expires + domainStr + '; path=/'\n }\n\n static readCookie (name) {\n const nameEQ = name + '='\n const ca = document.cookie.split(';')\n for (let idx = 0; idx < ca.length; idx++) {\n let c = ca[idx]\n while (c.charAt(0) === ' ') {\n c = c.substring(1, c.length)\n }\n // eslint-disable-next-line eqeqeq\n if (c.indexOf(nameEQ) == 0) {\n return decodeURIComponent(c.substring(nameEQ.length, c.length))\n }\n }\n return null\n }\n\n static _isLocalStorageSupported () {\n return 'localStorage' in window && window.localStorage !== null && typeof window.localStorage.setItem === 'function'\n }\n\n static saveToLSorCookie (property, value) {\n if (value == null) {\n return\n }\n try {\n if (this._isLocalStorageSupported()) {\n this.save(property, encodeURIComponent(JSON.stringify(value)))\n } else {\n if (property === GCOOKIE_NAME) {\n this.createCookie(property, encodeURIComponent(value), 0, window.location.hostname)\n } else {\n this.createCookie(property, encodeURIComponent(JSON.stringify(value)), 0, window.location.hostname)\n }\n }\n $ct.globalCache[property] = value\n } catch (e) {}\n }\n\n static readFromLSorCookie (property) {\n let data\n if ($ct.globalCache.hasOwnProperty(property)) {\n return $ct.globalCache[property]\n }\n if (this._isLocalStorageSupported()) {\n data = this.read(property)\n } else {\n data = this.readCookie(property)\n }\n\n if (data !== null && data !== undefined && !(typeof data.trim === 'function' && data.trim() === '')) {\n let value\n try {\n value = JSON.parse(decodeURIComponent(data))\n } catch (err) {\n value = decodeURIComponent(data)\n }\n $ct.globalCache[property] = value\n return value\n }\n }\n\n static createBroadCookie (name, value, seconds, domain) {\n // sets cookie on the base domain. e.g. if domain is baz.foo.bar.com, set cookie on \".bar.com\"\n // To update an existing \"broad domain\" cookie, we need to know what domain it was actually set on.\n // since a retrieved cookie never tells which domain it was set on, we need to set another test cookie\n // to find out which \"broadest\" domain the cookie was set on. Then delete the test cookie, and use that domain\n // for updating the actual cookie.\n\n if (domain) {\n let broadDomain = $ct.broadDomain\n if (broadDomain == null) { // if we don't know the broadDomain yet, then find out\n const domainParts = domain.split('.')\n let testBroadDomain = ''\n for (let idx = domainParts.length - 1; idx >= 0; idx--) {\n if (idx === 0) {\n testBroadDomain = domainParts[idx] + testBroadDomain\n } else {\n testBroadDomain = '.' + domainParts[idx] + testBroadDomain\n }\n\n // only needed if the cookie already exists and needs to be updated. See note above.\n if (this.readCookie(name)) {\n // no guarantee that browser will delete cookie, hence create short lived cookies\n var testCookieName = 'test_' + name + idx\n this.createCookie(testCookieName, value, 10, testBroadDomain) // self-destruct after 10 seconds\n if (!this.readCookie(testCookieName)) { // if test cookie not set, then the actual cookie wouldn't have been set on this domain either.\n continue\n } else { // else if cookie set, then delete the test and the original cookie\n this.removeCookie(testCookieName, testBroadDomain)\n }\n }\n\n this.createCookie(name, value, seconds, testBroadDomain)\n const tempCookie = this.readCookie(name)\n // eslint-disable-next-line eqeqeq\n if (tempCookie == value) {\n broadDomain = testBroadDomain\n $ct.broadDomain = broadDomain\n break\n }\n }\n } else {\n this.createCookie(name, value, seconds, broadDomain)\n }\n } else {\n this.createCookie(name, value, seconds, domain)\n }\n }\n\n static getMetaProp (property) {\n const metaObj = this.readFromLSorCookie(META_COOKIE)\n if (metaObj != null) {\n return metaObj[property]\n }\n }\n\n static setMetaProp (property, value) {\n if (this._isLocalStorageSupported()) {\n let wzrkMetaObj = this.readFromLSorCookie(META_COOKIE)\n if (wzrkMetaObj == null) {\n wzrkMetaObj = {}\n }\n if (value === undefined) {\n delete wzrkMetaObj[property]\n } else {\n wzrkMetaObj[property] = value\n }\n this.saveToLSorCookie(META_COOKIE, wzrkMetaObj)\n }\n }\n\n static getAndClearMetaProp (property) {\n const value = this.getMetaProp(property)\n this.setMetaProp(property, undefined)\n return value\n }\n\n static setInstantDeleteFlagInK () {\n let k = this.readFromLSorCookie(KCOOKIE_NAME)\n if (k == null) {\n k = {}\n }\n k.flag = true\n this.saveToLSorCookie(KCOOKIE_NAME, k)\n }\n\n static backupEvent (data, reqNo, logger) {\n let backupArr = this.readFromLSorCookie(LCOOKIE_NAME)\n if (typeof backupArr === 'undefined') {\n backupArr = {}\n }\n backupArr[reqNo] = { q: data }\n this.saveToLSorCookie(LCOOKIE_NAME, backupArr)\n logger.debug(`stored in ${LCOOKIE_NAME} reqNo : ${reqNo} -> ${data}`)\n }\n\n static removeBackup (respNo, logger) {\n const backupMap = this.readFromLSorCookie(LCOOKIE_NAME)\n if (typeof backupMap !== 'undefined' && backupMap !== null && typeof backupMap[respNo] !== 'undefined') {\n logger.debug(`del event: ${respNo} data-> ${backupMap[respNo].q}`)\n delete backupMap[respNo]\n this.saveToLSorCookie(LCOOKIE_NAME, backupMap)\n }\n }\n}\n\nexport const $ct = {\n globalCache: {\n gcookie: null,\n REQ_N: 0,\n RESP_N: 0\n },\n LRU_CACHE: null,\n globalProfileMap: undefined,\n globalEventsMap: undefined,\n blockRequest: false,\n isOptInRequest: false,\n broadDomain: null,\n webPushEnabled: null,\n campaignDivMap: {},\n currentSessionId: null,\n wiz_counter: 0, // to keep track of number of times we load the body\n notifApi: {\n notifEnabledFromApi: false\n }, // helper variable to handle race condition and check when notifications were called\n unsubGroups: [],\n updatedCategoryLong: null,\n inbox: null,\n isPrivacyArrPushed: false,\n privacyArray: [],\n offline: false,\n location: null,\n dismissSpamControl: false,\n globalUnsubscribe: true,\n flutterVersion: null,\n variableStore: {}\n // domain: window.location.hostname, url -> getHostName()\n // gcookie: -> device\n}\n","import { StorageManager } from './storage'\nimport { LRU_CACHE } from './constants'\n\nexport default class LRUCache {\n #keyOrder\n\n constructor (max) {\n this.max = max\n let lruCache = StorageManager.readFromLSorCookie(LRU_CACHE)\n if (lruCache) {\n const tempLruCache = {}\n this.#keyOrder = []\n lruCache = lruCache.cache\n for (const entry in lruCache) {\n if (lruCache.hasOwnProperty(entry)) {\n tempLruCache[lruCache[entry][0]] = lruCache[entry][1]\n this.#keyOrder.push(lruCache[entry][0])\n }\n }\n this.cache = tempLruCache\n } else {\n this.cache = {}\n this.#keyOrder = []\n }\n }\n\n get (key) {\n const item = this.cache[key]\n if (item) {\n this.cache = this.#deleteFromObject(key, this.cache)\n this.cache[key] = item\n this.#keyOrder.push(key)\n }\n this.saveCacheToLS(this.cache)\n return item\n }\n\n set (key, value) {\n const item = this.cache[key]\n const allKeys = this.#keyOrder\n if (item != null) {\n this.cache = this.#deleteFromObject(key, this.cache)\n } else if (allKeys.length === this.max) {\n this.cache = this.#deleteFromObject(allKeys[0], this.cache)\n }\n this.cache[key] = value\n if (this.#keyOrder[this.#keyOrder - 1] !== key) {\n this.#keyOrder.push(key)\n }\n this.saveCacheToLS(this.cache)\n }\n\n saveCacheToLS (cache) {\n const objToArray = []\n const allKeys = this.#keyOrder\n for (const index in allKeys) {\n if (allKeys.hasOwnProperty(index)) {\n const temp = []\n temp.push(allKeys[index])\n temp.push(cache[allKeys[index]])\n objToArray.push(temp)\n }\n }\n StorageManager.saveToLSorCookie(LRU_CACHE, { cache: objToArray })\n }\n\n getKey (value) {\n if (value === null) {\n return null\n }\n const allKeys = this.#keyOrder\n for (const index in allKeys) {\n if (allKeys.hasOwnProperty(index)) {\n if (this.cache[allKeys[index]] === value) {\n return allKeys[index]\n }\n }\n }\n return null\n }\n\n getSecondLastKey () {\n const keysArr = this.#keyOrder\n if (keysArr != null && keysArr.length > 1) {\n return keysArr[keysArr.length - 2]\n }\n return -1\n }\n\n getLastKey () {\n const keysLength = this.#keyOrder.length\n if (keysLength) {\n return this.#keyOrder[keysLength - 1]\n }\n }\n\n #deleteFromObject (key, obj) {\n const allKeys = JSON.parse(JSON.stringify(this.#keyOrder))\n const newCache = {}\n let indexToDelete\n for (const index in allKeys) {\n if (allKeys.hasOwnProperty(index)) {\n if (allKeys[index] !== key) {\n newCache[allKeys[index]] = obj[allKeys[index]]\n } else {\n indexToDelete = index\n }\n }\n }\n allKeys.splice(indexToDelete, 1)\n this.#keyOrder = JSON.parse(JSON.stringify(allKeys))\n return newCache\n }\n}\n","import { COOKIE_EXPIRY, FIRE_PUSH_UNREGISTERED, GCOOKIE_NAME, KCOOKIE_NAME, LRU_CACHE_SIZE, USEIP_KEY } from '../util/constants'\nimport { isValueValid } from '../util/datatypes'\nimport { getNow } from '../util/datetime'\nimport LRUCache from '../util/lruCache'\nimport { StorageManager, $ct } from '../util/storage'\n\nexport default class CleverTapAPI {\n #logger\n #request\n #device\n #session\n\n constructor ({ logger, request, device, session }) {\n this.#logger = logger\n this.#request = request\n this.#device = device\n this.#session = session\n }\n\n /**\n *\n * @param {string} global gcookie\n * @param {string} session\n * @param {boolean} resume sent true in case of an OUL request from client side, which is returned as it is by server\n * @param {number} respNumber the index of the request in backupmanager\n * @param {boolean} optOutResponse\n * @returns\n */\n\n s (global, session, resume, respNumber, optOutResponse) {\n let oulReq = false\n let newGuid = false\n\n // for a scenario when OUL request is true from client side\n // but resume is returned as false from server end\n // we maintan a OulReqN var in the window object\n // and compare with respNumber to determine the response of an OUL request\n if (window.isOULInProgress) {\n if (resume || (respNumber !== 'undefined' && respNumber === window.oulReqN)) {\n window.isOULInProgress = false\n oulReq = true\n }\n }\n\n // call back function used to store global and session ids for the user\n if (typeof respNumber === 'undefined') {\n respNumber = 0\n }\n\n StorageManager.removeBackup(respNumber, this.#logger)\n\n if (respNumber > $ct.globalCache.REQ_N) {\n // request for some other user so ignore\n return\n }\n\n if (!isValueValid(this.#device.gcookie)) {\n if (global) {\n newGuid = true\n }\n }\n\n if (!isValueValid(this.#device.gcookie) || resume || typeof optOutResponse === 'boolean') {\n const sessionObj = this.#session.getSessionCookieObject()\n\n /* If the received session is less than the session in the cookie,\n then don't update guid as it will be response for old request\n */\n if (window.isOULInProgress || (sessionObj.s && (session < sessionObj.s))) {\n return\n }\n this.#logger.debug(`Cookie was ${this.#device.gcookie} set to ${global}`)\n this.#device.gcookie = global\n if (!isValueValid(this.#device.gcookie)) {\n // clear useIP meta prop\n StorageManager.getAndClearMetaProp(USEIP_KEY)\n }\n if (global && StorageManager._isLocalStorageSupported()) {\n if ($ct.LRU_CACHE == null) {\n $ct.LRU_CACHE = new LRUCache(LRU_CACHE_SIZE)\n }\n\n const kIdFromLS = StorageManager.readFromLSorCookie(KCOOKIE_NAME)\n let guidFromLRUCache\n if (kIdFromLS != null && kIdFromLS.id) {\n guidFromLRUCache = $ct.LRU_CACHE.cache[kIdFromLS.id]\n if (resume) {\n if (!guidFromLRUCache) {\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, true)\n // replace login identity in OUL request\n // with the gcookie returned in exchange\n $ct.LRU_CACHE.set(kIdFromLS.id, global)\n }\n }\n }\n\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, global)\n // lastk provides the guid\n const lastK = $ct.LRU_CACHE.getSecondLastKey()\n if (StorageManager.readFromLSorCookie(FIRE_PUSH_UNREGISTERED) && lastK !== -1) {\n const lastGUID = $ct.LRU_CACHE.cache[lastK]\n // fire the request directly via fireRequest to unregister the token\n // then other requests with the updated guid should follow\n this.#request.unregisterTokenForGuid(lastGUID)\n }\n }\n StorageManager.createBroadCookie(GCOOKIE_NAME, global, COOKIE_EXPIRY, window.location.hostname)\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, global)\n }\n\n if (StorageManager._isLocalStorageSupported()) {\n this.#session.manageSession(session)\n }\n\n // session cookie\n const obj = this.#session.getSessionCookieObject()\n\n // for the race-condition where two responses come back with different session ids. don't write the older session id.\n if (typeof obj.s === 'undefined' || obj.s <= session) {\n obj.s = session\n obj.t = getNow() // time of last response from server\n this.#session.setSessionCookieObject(obj)\n }\n\n // set blockRequest to false only if the device has a valid gcookie\n if (isValueValid(this.#device.gcookie)) {\n $ct.blockRequest = false\n }\n\n // only process the backup events after an OUL request or a new guid is recieved\n if ((oulReq || newGuid) && !this.#request.processingBackup) {\n this.#request.processBackupEvents()\n }\n\n $ct.globalCache.RESP_N = respNumber\n }\n}\n","import { isValueValid } from '../util/datatypes'\nimport { StorageManager } from '../util/storage'\nimport { GCOOKIE_NAME, COOKIE_EXPIRY } from '../util/constants'\n\nexport default class DeviceManager {\n #logger\n gcookie\n\n constructor ({ logger }) {\n this.#logger = logger\n this.gcookie = this.getGuid()\n }\n\n getGuid () {\n let guid = null\n if (isValueValid(this.gcookie)) {\n return this.gcookie\n }\n if (StorageManager._isLocalStorageSupported()) {\n const value = StorageManager.read(GCOOKIE_NAME)\n if (isValueValid(value)) {\n try {\n guid = JSON.parse(decodeURIComponent(value))\n } catch (e) {\n this.#logger.debug('Cannot parse Gcookie from localstorage - must be encoded ' + value)\n // assumming guids are of size 32. supporting both formats.\n // guid can have encodedURIComponent or be without it.\n // 1.56e4078ed15749928c042479ec2b4d47 - breaks on JSON.parse(decodeURIComponent())\n // 2.%2256e4078ed15749928c042479ec2b4d47%22\n if (value.length === 32) {\n guid = value\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, value)\n } else {\n this.#logger.error('Illegal guid ' + value)\n }\n }\n\n // Persist to cookie storage if not present there.\n if (isValueValid(guid)) {\n StorageManager.createBroadCookie(GCOOKIE_NAME, guid, COOKIE_EXPIRY, window.location.hostname)\n }\n }\n }\n\n if (!isValueValid(guid)) {\n guid = StorageManager.readCookie(GCOOKIE_NAME)\n if (isValueValid(guid) && (guid.indexOf('%') === 0 || guid.indexOf('\\'') === 0 || guid.indexOf('\"') === 0)) {\n guid = null\n }\n if (isValueValid(guid)) {\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, guid)\n }\n }\n\n return guid\n }\n}\n","export const DATA_NOT_SENT_TEXT = 'This property has been ignored.'\nexport const INVALID_ACCOUNT = 'Invalid account ID'\nexport const INVALID_EVENT = 'Event structure not valid. Unable to process event'\nexport const CLEVERTAP_ERROR_PREFIX = 'CleverTap error:' // Formerly wzrk_error_txt\nexport const EMBED_ERROR = `${CLEVERTAP_ERROR_PREFIX} Incorrect embed script.`\nexport const EVENT_ERROR = `${CLEVERTAP_ERROR_PREFIX} Event structure not valid. ${DATA_NOT_SENT_TEXT}`\nexport const GENDER_ERROR = `${CLEVERTAP_ERROR_PREFIX} Gender value should be either M or F. ${DATA_NOT_SENT_TEXT}`\nexport const EMPLOYED_ERROR = `${CLEVERTAP_ERROR_PREFIX} Employed value should be either Y or N. ${DATA_NOT_SENT_TEXT}`\nexport const MARRIED_ERROR = `${CLEVERTAP_ERROR_PREFIX} Married value should be either Y or N. ${DATA_NOT_SENT_TEXT}`\nexport const EDUCATION_ERROR = `${CLEVERTAP_ERROR_PREFIX} Education value should be either School, College or Graduate. ${DATA_NOT_SENT_TEXT}`\nexport const AGE_ERROR = `${CLEVERTAP_ERROR_PREFIX} Age value should be a number. ${DATA_NOT_SENT_TEXT}`\nexport const DOB_ERROR = `${CLEVERTAP_ERROR_PREFIX} DOB value should be a Date Object`\nexport const OBJECT_ARRAY_ERROR = `${CLEVERTAP_ERROR_PREFIX} Expecting Object array in profile`\nexport const DATE_FORMAT_ERROR = `${CLEVERTAP_ERROR_PREFIX} setDate(number). number should be formatted as yyyymmdd`\nexport const ENUM_FORMAT_ERROR = `${CLEVERTAP_ERROR_PREFIX} setEnum(value). value should be a string or a number`\nexport const PHONE_FORMAT_ERROR = `${CLEVERTAP_ERROR_PREFIX} Phone number should be formatted as +[country code][number]`\n","import { isObject, isDateObject, isString, isNumber } from './datatypes'\nimport { convertToWZRKDate } from './datetime'\nimport { CHARGED_ID, CHARGEDID_COOKIE_NAME } from './constants'\nimport { StorageManager } from './storage'\n\nlet _globalChargedId\n\nexport const isEventStructureFlat = (eventObj) => {\n // Events cannot have nested structure or Arrays\n if (isObject(eventObj)) {\n for (var key in eventObj) {\n if (eventObj.hasOwnProperty(key)) {\n if (isObject(eventObj[key]) || Array.isArray(eventObj[key])) {\n return false\n } else if (isDateObject(eventObj[key])) {\n eventObj[key] = convertToWZRKDate(eventObj[key])\n }\n }\n }\n return true\n }\n return false\n}\n\nexport const isChargedEventStructureValid = (chargedObj, logger) => {\n if (isObject(chargedObj)) {\n for (var key in chargedObj) {\n if (chargedObj.hasOwnProperty(key)) {\n if (key === 'Items') {\n if (!Array.isArray(chargedObj[key])) {\n return false\n }\n\n if (chargedObj[key].length > 50) {\n logger.reportError(522, 'Charged Items exceed 50 limit. Actual count: ' + chargedObj[key].length)\n }\n\n for (var itemKey in chargedObj[key]) {\n if (chargedObj[key].hasOwnProperty(itemKey)) { // since default array implementation could be overridden - e.g. Teabox site\n if (!isObject(chargedObj[key][itemKey]) || !isEventStructureFlat(chargedObj[key][itemKey])) {\n return false\n }\n }\n }\n } else {\n if (isObject(chargedObj[key]) || Array.isArray(chargedObj[key])) {\n return false\n } else if (isDateObject(chargedObj[key])) {\n chargedObj[key] = convertToWZRKDate(chargedObj[key])\n }\n }\n }\n }\n\n if (isString(chargedObj[CHARGED_ID]) || isNumber(chargedObj[CHARGED_ID])) {\n // save charged Id\n const chargedId = chargedObj[CHARGED_ID] + '' // casting chargedId to string\n\n if (typeof _globalChargedId === 'undefined') {\n _globalChargedId = StorageManager.readFromLSorCookie(CHARGEDID_COOKIE_NAME)\n }\n if (typeof _globalChargedId !== 'undefined' && _globalChargedId.trim() === chargedId.trim()) {\n // drop event- duplicate charged id\n logger.error('Duplicate charged Id - Dropped' + chargedObj)\n return false\n }\n _globalChargedId = chargedId\n StorageManager.saveToLSorCookie(CHARGEDID_COOKIE_NAME, chargedId)\n }\n return true\n } // if object (chargedObject)\n return false\n}\n","import { isString, isObject, sanitize } from '../util/datatypes'\nimport { EVENT_ERROR } from '../util/messages'\nimport { EV_COOKIE, SYSTEM_EVENTS, unsupportedKeyCharRegex } from '../util/constants'\nimport { isChargedEventStructureValid, isEventStructureFlat } from '../util/validator'\nimport { StorageManager, $ct } from '../util/storage'\n\nexport default class EventHandler extends Array {\n #logger\n #oldValues\n #request\n #isPersonalisationActive\n\n constructor ({ logger, request, isPersonalisationActive }, values) {\n super()\n this.#logger = logger\n this.#oldValues = values\n this.#request = request\n this.#isPersonalisationActive = isPersonalisationActive\n }\n\n push (...eventsArr) {\n this.#processEventArray(eventsArr)\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#processEventArray(this.#oldValues)\n }\n this.#oldValues = null\n }\n\n #processEventArray (eventsArr) {\n if (Array.isArray(eventsArr)) {\n while (eventsArr.length > 0) {\n var eventName = eventsArr.shift()\n if (!isString(eventName)) {\n this.#logger.error(EVENT_ERROR)\n continue\n }\n\n if (eventName.length > 1024) {\n eventName = eventName.substring(0, 1024)\n this.#logger.reportError(510, eventName + '... length exceeded 1024 chars. Trimmed.')\n }\n\n if (SYSTEM_EVENTS.includes(eventName)) {\n this.#logger.reportError(513, eventName + ' is a restricted system event. It cannot be used as an event name.')\n continue\n }\n\n const data = {}\n data.type = 'event'\n data.evtName = sanitize(eventName, unsupportedKeyCharRegex)\n\n if (eventsArr.length !== 0) {\n const eventObj = eventsArr.shift()\n if (!isObject(eventObj)) {\n // put it back if it is not an object\n eventsArr.unshift(eventObj)\n } else {\n // check Charged Event vs. other events.\n if (eventName === 'Charged') {\n if (!isChargedEventStructureValid(eventObj, this.#logger)) {\n this.#logger.reportError(511, 'Charged event structure invalid. Not sent.')\n continue\n }\n } else {\n if (!isEventStructureFlat(eventObj)) {\n this.#logger.reportError(512, eventName + ' event structure invalid. Not sent.')\n continue\n }\n }\n data.evtData = eventObj\n }\n }\n\n this.#request.processEvent(data)\n }\n }\n }\n\n getDetails (evtName) {\n if (!this.#isPersonalisationActive()) {\n return\n }\n if (typeof $ct.globalEventsMap === 'undefined') {\n $ct.globalEventsMap = StorageManager.readFromLSorCookie(EV_COOKIE)\n }\n if (typeof $ct.globalEventsMap === 'undefined') {\n return\n }\n const evtObj = $ct.globalEventsMap[evtName]\n const respObj = {}\n if (typeof evtObj !== 'undefined') {\n respObj.firstTime = new Date(evtObj[1] * 1000)\n respObj.lastTime = new Date(evtObj[2] * 1000)\n respObj.count = evtObj[0]\n return respObj\n }\n }\n}\n","export const getURLParams = (url) => {\n const urlParams = {}\n const idx = url.indexOf('?')\n\n if (idx > 1) {\n const uri = url.substring(idx + 1)\n let match\n const pl = /\\+/g // Regex for replacing addition symbol with a space\n const search = /([^&=]+)=?([^&]*)/g\n const decode = function (s) {\n let replacement = s.replace(pl, ' ')\n try {\n replacement = decodeURIComponent(replacement)\n } catch (e) {\n // eat\n }\n return replacement\n }\n match = search.exec(uri)\n while (match) {\n urlParams[decode(match[1])] = decode(match[2])\n match = search.exec(uri)\n }\n }\n return urlParams\n}\n\nexport const getDomain = (url) => {\n if (url === '') return ''\n var a = document.createElement('a')\n a.href = url\n return a.hostname\n}\n\nexport const addToURL = (url, k, v) => {\n return url + '&' + k + '=' + encodeURIComponent(v)\n}\n\nexport const getHostName = () => {\n return window.location.hostname\n}\n","/* eslint-disable */\nexport const urlBase64ToUint8Array = (base64String) => {\n let padding = '='.repeat((4 - base64String.length % 4) % 4)\n let base64 = (base64String + padding)\n .replace(/\\-/g, '+')\n .replace(/_/g, '/')\n\n let rawData = window.atob(base64)\n let processedData = []\n for (let i=0; i {\n logger && typeof logger.debug === 'function' && logger.debug('dobj:' + dataObject)\n return compressToBase64(dataObject)\n}\n\nexport const compress = (uncompressed) => {\n if (uncompressed == null) return ''\n let i, value,\n context_dictionary = {},\n context_dictionaryToCreate = {},\n context_c = '',\n context_wc = '',\n context_w = '',\n context_enlargeIn = 2, // Compensate for the first entry which should not count\n context_dictSize = 3,\n context_numBits = 2,\n context_data_string = '',\n context_data_val = 0,\n context_data_position = 0,\n ii,\n f = String.fromCharCode\n\n for (ii = 0; ii < uncompressed.length; ii += 1) {\n context_c = uncompressed.charAt(ii)\n if (!Object.prototype.hasOwnProperty.call(context_dictionary, context_c)) {\n context_dictionary[context_c] = context_dictSize++\n context_dictionaryToCreate[context_c] = true\n }\n\n context_wc = context_w + context_c\n if (Object.prototype.hasOwnProperty.call(context_dictionary, context_wc)) {\n context_w = context_wc\n } else {\n if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {\n if (context_w.charCodeAt(0) < 256) {\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n }\n value = context_w.charCodeAt(0)\n for (i = 0; i < 8; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n } else {\n value = 1\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1) | value\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = 0\n }\n value = context_w.charCodeAt(0)\n for (i = 0; i < 16; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n }\n context_enlargeIn--\n if (context_enlargeIn == 0) {\n context_enlargeIn = Math.pow(2, context_numBits)\n context_numBits++\n }\n delete context_dictionaryToCreate[context_w]\n } else {\n value = context_dictionary[context_w];\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0;\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n\n\n }\n context_enlargeIn--\n if (context_enlargeIn == 0) {\n context_enlargeIn = Math.pow(2, context_numBits)\n context_numBits++\n }\n // Add wc to the dictionary.\n context_dictionary[context_wc] = context_dictSize++\n context_w = String(context_c)\n }\n }\n\n // Output the code for w.\n if (context_w !== '') {\n if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {\n if (context_w.charCodeAt(0) < 256) {\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n }\n value = context_w.charCodeAt(0)\n for (i = 0; i < 8; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n } else {\n value = 1\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1) | value\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = 0\n }\n value = context_w.charCodeAt(0);\n for (i = 0; i < 16; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n }\n context_enlargeIn--\n if (context_enlargeIn == 0) {\n context_enlargeIn = Math.pow(2, context_numBits)\n context_numBits++\n }\n delete context_dictionaryToCreate[context_w]\n } else {\n value = context_dictionary[context_w]\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n\n\n }\n context_enlargeIn--\n if (context_enlargeIn == 0) {\n context_enlargeIn = Math.pow(2, context_numBits)\n context_numBits++\n }\n }\n\n // Mark the end of the stream\n value = 2\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n\n // Flush the last char\n while (true) {\n context_data_val = (context_data_val << 1)\n if (context_data_position == 15) {\n context_data_string += f(context_data_val)\n break\n } else context_data_position++\n }\n return context_data_string\n}\n\nexport const getKeyStr = () => {\n let key = ''\n let i = 0\n\n for (i = 0; i <= 25; i++) {\n key = key + String.fromCharCode(i + 65)\n }\n\n for (i = 0; i <= 25; i++) {\n key = key + String.fromCharCode(i + 97)\n }\n\n for (i = 0; i < 10; i++) {\n key = key + i\n }\n\n return key + '+/='\n}\n\nconst _keyStr = getKeyStr()\n\nexport const convertToFormattedHex = (byte_arr) => {\n let hex_str = '',\n i,\n len,\n tmp_hex\n\n if (!Array.isArray(byte_arr)) {\n return false\n }\n\n len = byte_arr.length\n\n for (i = 0; i < len; ++i) {\n if (byte_arr[i] < 0) {\n byte_arr[i] = byte_arr[i] + 256\n }\n if (byte_arr[i] === undefined) {\n byte_arr[i] = 0\n }\n tmp_hex = byte_arr[i].toString(16)\n\n if (tmp_hex.length == 1) tmp_hex = '0' + tmp_hex // Add leading zero.\n\n // beautification - needed if you're printing this in the console, else keep commented\n // if ((i + 1) % 16 === 0) {\n // tmp_hex += \"\\n\";\n // } else {\n // tmp_hex += \" \";\n // }\n\n hex_str += tmp_hex\n }\n\n return hex_str.trim()\n}\n\nexport const convertStringToHex = (s) => {\n let byte_arr = []\n for (let i = 0; i < s.length; i++) {\n let value = s.charCodeAt(i)\n byte_arr.push(value & 255)\n byte_arr.push((value >> 8) & 255)\n }\n return convertToFormattedHex(byte_arr)\n}\n\nexport const compressToBase64 = (input) => {\n if (input == null) return ''\n var output = ''\n var chr1, chr2, chr3, enc1, enc2, enc3, enc4\n var i = 0\n\n input = compress(input)\n\n while (i < input.length * 2) {\n\n if (i % 2 == 0) {\n chr1 = input.charCodeAt(i / 2) >> 8\n chr2 = input.charCodeAt(i / 2) & 255\n if (i / 2 + 1 < input.length)\n chr3 = input.charCodeAt(i / 2 + 1) >> 8\n else\n chr3 = NaN\n } else {\n chr1 = input.charCodeAt((i - 1) / 2) & 255\n if ((i + 1) / 2 < input.length) {\n chr2 = input.charCodeAt((i + 1) / 2) >> 8\n chr3 = input.charCodeAt((i + 1) / 2) & 255\n } else\n chr2 = chr3 = NaN\n }\n i += 3\n\n enc1 = chr1 >> 2;\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4)\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6)\n enc4 = chr3 & 63\n\n if (isNaN(chr2)) {\n enc3 = enc4 = 64\n } else if (isNaN(chr3)) {\n enc4 = 64\n }\n\n output = output +\n _keyStr.charAt(enc1) + _keyStr.charAt(enc2) +\n _keyStr.charAt(enc3) + _keyStr.charAt(enc4)\n\n }\n\n return output\n}\n","\nimport { ARP_COOKIE, MAX_TRIES, OPTOUT_COOKIE_ENDSWITH, USEIP_KEY, MAX_DELAY_FREQUENCY, PUSH_DELAY_MS, WZRK_FETCH } from './constants'\nimport { isString, isValueValid } from './datatypes'\nimport { compressData } from './encoder'\nimport { StorageManager, $ct } from './storage'\nimport { addToURL } from './url'\n\nexport default class RequestDispatcher {\n static logger\n static device\n static account\n networkRetryCount = 0\n minDelayFrequency = 0\n\n // ANCHOR - Requests get fired from here\n static #fireRequest (url, tries, skipARP, sendOULFlag, evtName) {\n if (this.#dropRequestDueToOptOut()) {\n this.logger.debug('req dropped due to optout cookie: ' + this.device.gcookie)\n return\n }\n\n // set a request in progress\n // so that if gcookie is not present, no other request can be made asynchronusly\n if (!isValueValid(this.device.gcookie)) {\n $ct.blockRequest = true\n }\n /**\n * if the gcookie is null\n * and the request is not the first request\n * and the tries are less than max tries\n * keep retrying\n */\n\n if (evtName && evtName === WZRK_FETCH) {\n // New retry mechanism\n if (!isValueValid(this.device.gcookie) && ($ct.globalCache.RESP_N < $ct.globalCache.REQ_N - 1)) {\n setTimeout(() => {\n this.logger.debug(`retrying fire request for url: ${url}, tries: ${this.networkRetryCount}`)\n this.#fireRequest(url, undefined, skipARP, sendOULFlag)\n }, this.getDelayFrequency())\n }\n } else {\n if (!isValueValid(this.device.gcookie) &&\n ($ct.globalCache.RESP_N < $ct.globalCache.REQ_N - 1) &&\n tries < MAX_TRIES) {\n // if ongoing First Request is in progress, initiate retry\n setTimeout(() => {\n this.logger.debug(`retrying fire request for url: ${url}, tries: ${tries}`)\n this.#fireRequest(url, tries + 1, skipARP, sendOULFlag)\n }, 50)\n return\n }\n }\n\n // set isOULInProgress to true\n // when sendOULFlag is set to true\n if (!sendOULFlag) {\n if (isValueValid(this.device.gcookie)) {\n // add gcookie to url\n url = addToURL(url, 'gc', this.device.gcookie)\n }\n url = this.#addARPToRequest(url, skipARP)\n } else {\n window.isOULInProgress = true\n }\n\n url = addToURL(url, 'tries', tries) // Add tries to URL\n\n url = this.#addUseIPToRequest(url)\n url = addToURL(url, 'r', new Date().getTime()) // add epoch to beat caching of the URL\n // TODO: Figure out a better way to handle plugin check\n if (window.clevertap?.hasOwnProperty('plugin') || window.wizrocket?.hasOwnProperty('plugin')) {\n // used to add plugin name in request parameter\n const plugin = window.clevertap.plugin || window.wizrocket.plugin\n url = addToURL(url, 'ct_pl', plugin)\n }\n if (url.indexOf('chrome-extension:') !== -1) {\n url = url.replace('chrome-extension:', 'https:')\n }\n // TODO: Try using Function constructor instead of appending script.\n var ctCbScripts = document.getElementsByClassName('ct-jp-cb')\n while (ctCbScripts[0] && ctCbScripts[0].parentNode) {\n ctCbScripts[0].parentNode.removeChild(ctCbScripts[0])\n }\n const s = document.createElement('script')\n s.setAttribute('type', 'text/javascript')\n s.setAttribute('src', url)\n s.setAttribute('class', 'ct-jp-cb')\n s.setAttribute('rel', 'nofollow')\n s.async = true\n document.getElementsByTagName('head')[0].appendChild(s)\n this.logger.debug('req snt -> url: ' + url)\n }\n\n /**\n *\n * @param {string} url\n * @param {*} skipARP\n * @param {boolean} sendOULFlag\n */\n static fireRequest (url, skipARP, sendOULFlag, evtName) {\n this.#fireRequest(url, 1, skipARP, sendOULFlag, evtName)\n }\n\n static #dropRequestDueToOptOut () {\n if ($ct.isOptInRequest || !isValueValid(this.device.gcookie) || !isString(this.device.gcookie)) {\n $ct.isOptInRequest = false\n return false\n }\n return this.device.gcookie.slice(-3) === OPTOUT_COOKIE_ENDSWITH\n }\n\n static #addUseIPToRequest (pageLoadUrl) {\n var useIP = StorageManager.getMetaProp(USEIP_KEY)\n if (typeof useIP !== 'boolean') {\n useIP = false\n }\n return addToURL(pageLoadUrl, USEIP_KEY, useIP ? 'true' : 'false')\n };\n\n static #addARPToRequest (url, skipResARP) {\n if (skipResARP === true) {\n const _arp = {}\n _arp.skipResARP = true\n return addToURL(url, 'arp', compressData(JSON.stringify(_arp), this.logger))\n }\n if (StorageManager._isLocalStorageSupported() && typeof localStorage.getItem(ARP_COOKIE) !== 'undefined' && localStorage.getItem(ARP_COOKIE) !== null) {\n return addToURL(url, 'arp', compressData(JSON.stringify(StorageManager.readFromLSorCookie(ARP_COOKIE)), this.logger))\n }\n return url\n }\n\n getDelayFrequency () {\n this.logger.debug('Network retry #' + this.networkRetryCount)\n\n // Retry with delay as 1s for first 10 retries\n if (this.networkRetryCount < 10) {\n this.logger.debug(this.account.id, 'Failure count is ' + this.networkRetryCount + '. Setting delay frequency to 1s')\n this.minDelayFrequency = PUSH_DELAY_MS // Reset minimum delay to 1s\n return this.minDelayFrequency\n }\n\n if (this.account.region == null) {\n // Retry with delay as 1s if region is null in case of eu1\n this.logger.debug(this.account.id, 'Setting delay frequency to 1s')\n return PUSH_DELAY_MS\n } else {\n // Retry with delay as minimum delay frequency and add random number of seconds to scatter traffic\n const randomDelay = (Math.floor(Math.random() * 10) + 1) * 1000\n this.minDelayFrequency += randomDelay\n if (this.minDelayFrequency < MAX_DELAY_FREQUENCY) {\n this.logger.debug(this.account.id, 'Setting delay frequency to ' + this.minDelayFrequency)\n return this.minDelayFrequency\n } else {\n this.minDelayFrequency = PUSH_DELAY_MS\n }\n this.logger.debug(this.account.id, 'Setting delay frequency to ' + this.minDelayFrequency)\n return this.minDelayFrequency\n }\n }\n}\n","// CleverTap specific utilities\n\nimport {\n StorageManager,\n $ct\n} from './storage'\nimport {\n CAMP_COOKIE_NAME,\n singleQuoteRegex,\n PR_COOKIE,\n ARP_COOKIE,\n GCOOKIE_NAME,\n IS_OUL,\n categoryLongKey,\n CAMP_COOKIE_G,\n GLOBAL\n} from './constants'\nimport {\n GENDER_ERROR,\n EMPLOYED_ERROR,\n MARRIED_ERROR,\n EDUCATION_ERROR,\n AGE_ERROR,\n DOB_ERROR,\n PHONE_FORMAT_ERROR,\n ENUM_FORMAT_ERROR\n} from './messages'\nimport {\n getToday,\n convertToWZRKDate,\n setDate,\n getNow\n} from './datetime'\nimport {\n isObject,\n isDateObject,\n isConvertibleToNumber,\n isObjectEmpty,\n isString,\n isNumber,\n isValueValid\n} from './datatypes'\n\nimport { addToURL, getURLParams } from './url'\nimport { compressData } from './encoder'\nimport RequestDispatcher from './requestDispatcher'\n\nexport const getCampaignObject = () => {\n let finalcampObj = {}\n if (StorageManager._isLocalStorageSupported()) {\n let campObj = StorageManager.read(CAMP_COOKIE_NAME)\n if (campObj != null) {\n campObj = JSON.parse(decodeURIComponent(campObj).replace(singleQuoteRegex, '\\\"'))\n if (campObj.hasOwnProperty('global')) {\n finalcampObj.wp = campObj\n } else {\n finalcampObj = campObj\n }\n } else {\n finalcampObj = {}\n }\n }\n return finalcampObj\n}\n\nexport const saveCampaignObject = (campaignObj) => {\n if (StorageManager._isLocalStorageSupported()) {\n const newObj = { ...getCampaignObject(), ...campaignObj }\n const campObj = JSON.stringify(newObj)\n StorageManager.save(CAMP_COOKIE_NAME, encodeURIComponent(campObj))\n // Update the CAMP_COOKIE_G to be in sync with CAMP_COOKIE_NAME\n setCampaignObjectForGuid()\n }\n}\n\n// set Campaign Object against the guid, with daily count and total count details\nexport const setCampaignObjectForGuid = () => {\n if (StorageManager._isLocalStorageSupported()) {\n let guid = StorageManager.read(GCOOKIE_NAME)\n if (isValueValid(guid)) {\n try {\n guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n const guidCampObj = StorageManager.read(CAMP_COOKIE_G) ? JSON.parse(decodeURIComponent(StorageManager.read(CAMP_COOKIE_G))) : {}\n if (guid && StorageManager._isLocalStorageSupported()) {\n var finalCampObj = {}\n var campObj = getCampaignObject()\n Object.keys(campObj).forEach(key => {\n const campKeyObj = (guid in guidCampObj && Object.keys(guidCampObj[guid]).length && guidCampObj[guid][key]) ? guidCampObj[guid][key] : {}\n const globalObj = campObj[key].global\n const today = getToday()\n const dailyObj = campObj[key][today]\n if (typeof globalObj !== 'undefined') {\n const campaignIdArray = Object.keys(globalObj)\n for (const index in campaignIdArray) {\n let resultObj = []\n if (campaignIdArray.hasOwnProperty(index)) {\n let dailyC = 0\n let totalC = 0\n const campaignId = campaignIdArray[index]\n if (campaignId === 'tc') {\n continue\n }\n if (typeof dailyObj !== 'undefined' && typeof dailyObj[campaignId] !== 'undefined') {\n dailyC = dailyObj[campaignId]\n }\n if (typeof globalObj !== 'undefined' && typeof globalObj[campaignId] !== 'undefined') {\n totalC = globalObj[campaignId]\n }\n resultObj = [campaignId, dailyC, totalC]\n campKeyObj[campaignId] = resultObj\n }\n }\n }\n finalCampObj = { ...finalCampObj, [key]: campKeyObj }\n })\n guidCampObj[guid] = finalCampObj\n StorageManager.save(CAMP_COOKIE_G, encodeURIComponent(JSON.stringify(guidCampObj)))\n }\n } catch (e) {\n console.error('Invalid clevertap Id ' + e)\n }\n }\n }\n}\nexport const getCampaignObjForLc = () => {\n // before preparing data to send to LC , check if the entry for the guid is already there in CAMP_COOKIE_G\n const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n\n let campObj = {}\n if (StorageManager._isLocalStorageSupported()) {\n let resultObj = {}\n campObj = getCampaignObject()\n const storageValue = StorageManager.read(CAMP_COOKIE_G)\n const decodedValue = storageValue ? decodeURIComponent(storageValue) : null\n const parsedValue = decodedValue ? JSON.parse(decodedValue) : null\n\n const resultObjWP = (!!guid &&\n storageValue !== undefined && storageValue !== null &&\n parsedValue && parsedValue[guid] && parsedValue[guid].wp)\n ? Object.values(parsedValue[guid].wp)\n : []\n\n const resultObjWI = (!!guid &&\n storageValue !== undefined && storageValue !== null &&\n parsedValue && parsedValue[guid] && parsedValue[guid].wi)\n ? Object.values(parsedValue[guid].wi)\n : []\n\n const today = getToday()\n let todayCwp = 0\n let todayCwi = 0\n if (campObj.wp && campObj.wp[today] && campObj.wp[today].tc !== 'undefined') {\n todayCwp = campObj.wp[today].tc\n }\n if (campObj.wi && campObj.wi[today] && campObj.wi[today].tc !== 'undefined') {\n todayCwi = campObj.wi[today].tc\n }\n resultObj = {\n wmp: todayCwp,\n wimp: todayCwi,\n tlc: resultObjWP,\n witlc: resultObjWI\n }\n return resultObj\n }\n}\n\nexport const isProfileValid = (profileObj, { logger }) => {\n let valid = false\n if (isObject(profileObj)) {\n for (const profileKey in profileObj) {\n if (profileObj.hasOwnProperty(profileKey)) {\n valid = true\n let profileVal = profileObj[profileKey]\n\n if (profileVal == null) {\n delete profileObj[profileKey]\n continue\n }\n if (profileKey === 'Gender' && !profileVal.match(/^M$|^F$/)) {\n valid = false\n logger.error(GENDER_ERROR)\n }\n\n if (profileKey === 'Employed' && !profileVal.match(/^Y$|^N$/)) {\n valid = false\n logger.error(EMPLOYED_ERROR)\n }\n\n if (profileKey === 'Married' && !profileVal.match(/^Y$|^N$/)) {\n valid = false\n logger.error(MARRIED_ERROR)\n }\n\n if (profileKey === 'Education' && !profileVal.match(/^School$|^College$|^Graduate$/)) {\n valid = false\n logger.error(EDUCATION_ERROR)\n }\n\n if (profileKey === 'Age' && profileVal != null) {\n if (isConvertibleToNumber(profileVal)) {\n profileObj.Age = +profileVal\n } else {\n valid = false\n logger.error(AGE_ERROR)\n }\n }\n // dob will come in like this - $dt_19470815 or dateObject\n if (profileKey === 'DOB') {\n if (((!(/^\\$D_/).test(profileVal) || (profileVal + '').length !== 11)) && !isDateObject(profileVal)) {\n valid = false\n logger.error(DOB_ERROR)\n }\n\n if (isDateObject(profileVal)) {\n profileObj[profileKey] = convertToWZRKDate(profileVal)\n }\n } else if (isDateObject(profileVal)) {\n profileObj[profileKey] = convertToWZRKDate(profileVal)\n }\n\n if (profileKey === 'Phone' && !isObjectEmpty(profileVal)) {\n if (profileVal.length > 8 && (profileVal.charAt(0) === '+')) { // valid phone number\n profileVal = profileVal.substring(1, profileVal.length)\n if (isConvertibleToNumber(profileVal)) {\n profileObj.Phone = +profileVal\n } else {\n valid = false\n logger.error(PHONE_FORMAT_ERROR + '. Removed.')\n }\n } else {\n valid = false\n logger.error(PHONE_FORMAT_ERROR + '. Removed.')\n }\n }\n\n if (!valid) {\n delete profileObj[profileKey]\n }\n }\n }\n }\n return valid\n}\n\nexport const processFBUserObj = (user) => {\n const profileData = {}\n profileData.Name = user.name\n if (user.id != null) {\n profileData.FBID = user.id + ''\n }\n // Feb 2014 - FB announced over 58 gender options, hence we specifically look for male or female. Rest we don't care.\n if (user.gender === 'male') {\n profileData.Gender = 'M'\n } else if (user.gender === 'female') {\n profileData.Gender = 'F'\n } else {\n profileData.Gender = 'O'\n }\n\n const getHighestEducation = function (eduArr) {\n if (eduArr != null) {\n let college = ''\n let highschool = ''\n\n for (let i = 0; i < eduArr.length; i++) {\n const edu = eduArr[i]\n if (edu.type != null) {\n const type = edu.type\n if (type === 'Graduate School') {\n return 'Graduate'\n } else if (type === 'College') {\n college = '1'\n } else if (type === 'High School') {\n highschool = '1'\n }\n }\n }\n\n if (college === '1') {\n return 'College'\n } else if (highschool === '1') {\n return 'School'\n }\n }\n }\n\n if (user.relationship_status != null) {\n profileData.Married = 'N'\n if (user.relationship_status === 'Married') {\n profileData.Married = 'Y'\n }\n }\n\n const edu = getHighestEducation(user.education)\n if (edu != null) {\n profileData.Education = edu\n }\n\n const work = (user.work != null) ? user.work.length : 0\n if (work > 0) {\n profileData.Employed = 'Y'\n } else {\n profileData.Employed = 'N'\n }\n\n if (user.email != null) {\n profileData.Email = user.email\n }\n\n if (user.birthday != null) {\n const mmddyy = user.birthday.split('/') // comes in as \"08/15/1947\"\n profileData.DOB = setDate(mmddyy[2] + mmddyy[0] + mmddyy[1])\n }\n return profileData\n}\n\nexport const processGPlusUserObj = (user, { logger }) => {\n const profileData = {}\n if (user.displayName != null) {\n profileData.Name = user.displayName\n }\n if (user.id != null) {\n profileData.GPID = user.id + ''\n }\n\n if (user.gender != null) {\n if (user.gender === 'male') {\n profileData.Gender = 'M'\n } else if (user.gender === 'female') {\n profileData.Gender = 'F'\n } else if (user.gender === 'other') {\n profileData.Gender = 'O'\n }\n }\n\n if (user.image != null) {\n if (user.image.isDefault === false) {\n profileData.Photo = user.image.url.split('?sz')[0]\n }\n }\n\n if (user.emails != null) {\n for (let emailIdx = 0; emailIdx < user.emails.length; emailIdx++) {\n const emailObj = user.emails[emailIdx]\n if (emailObj.type === 'account') {\n profileData.Email = emailObj.value\n }\n }\n }\n\n if (user.organizations != null) {\n profileData.Employed = 'N'\n for (let i = 0; i < user.organizations.length; i++) {\n const orgObj = user.organizations[i]\n if (orgObj.type === 'work') {\n profileData.Employed = 'Y'\n }\n }\n }\n\n if (user.birthday != null) {\n const yyyymmdd = user.birthday.split('-') // comes in as \"1976-07-27\"\n profileData.DOB = setDate(yyyymmdd[0] + yyyymmdd[1] + yyyymmdd[2])\n }\n\n if (user.relationshipStatus != null) {\n profileData.Married = 'N'\n if (user.relationshipStatus === 'married') {\n profileData.Married = 'Y'\n }\n }\n logger.debug('gplus usr profile ' + JSON.stringify(profileData))\n\n return profileData\n}\n\nexport const addToLocalProfileMap = (profileObj, override) => {\n if (StorageManager._isLocalStorageSupported()) {\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE)\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = {}\n }\n }\n\n // Move props from custom bucket to outside.\n if (profileObj._custom != null) {\n const keys = profileObj._custom\n for (const key in keys) {\n if (keys.hasOwnProperty(key)) {\n profileObj[key] = keys[key]\n }\n }\n delete profileObj._custom\n }\n\n for (const prop in profileObj) {\n if (profileObj.hasOwnProperty(prop)) {\n if ($ct.globalProfileMap.hasOwnProperty(prop) && !override) {\n continue\n }\n $ct.globalProfileMap[prop] = profileObj[prop]\n }\n }\n if ($ct.globalProfileMap._custom != null) {\n delete $ct.globalProfileMap._custom\n }\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n }\n}\n\nexport const closeIframe = (campaignId, divIdIgnored, currentSessionId) => {\n if (campaignId != null && campaignId !== '-1') {\n if (StorageManager._isLocalStorageSupported()) {\n const campaignObj = getCampaignObject()\n\n let sessionCampaignObj = campaignObj.wp[currentSessionId]\n if (sessionCampaignObj == null) {\n sessionCampaignObj = {}\n campaignObj[currentSessionId] = sessionCampaignObj\n }\n sessionCampaignObj[campaignId] = 'dnd'\n saveCampaignObject(campaignObj)\n }\n }\n if ($ct.campaignDivMap != null) {\n const divId = $ct.campaignDivMap[campaignId]\n if (divId != null) {\n document.getElementById(divId).style.display = 'none'\n if (divId === 'intentPreview') {\n if (document.getElementById('intentOpacityDiv') != null) {\n document.getElementById('intentOpacityDiv').style.display = 'none'\n }\n }\n }\n }\n}\n\nexport const arp = (jsonMap) => {\n // For unregister calls dont set arp in LS\n if (jsonMap.skipResARP != null && jsonMap.skipResARP) {\n console.debug('Update ARP Request rejected', jsonMap)\n return null\n }\n\n const isOULARP = jsonMap[IS_OUL] === true\n\n if (StorageManager._isLocalStorageSupported()) {\n // Update arp only if it is null or an oul request\n try {\n let arpFromStorage = StorageManager.readFromLSorCookie(ARP_COOKIE)\n if (arpFromStorage == null || isOULARP) {\n arpFromStorage = {}\n for (const key in jsonMap) {\n if (jsonMap.hasOwnProperty(key)) {\n if (jsonMap[key] === -1) {\n delete arpFromStorage[key]\n } else {\n arpFromStorage[key] = jsonMap[key]\n }\n }\n }\n StorageManager.saveToLSorCookie(ARP_COOKIE, arpFromStorage)\n }\n } catch (e) {\n console.error('Unable to parse ARP JSON: ' + e)\n }\n }\n}\n\nexport const getWrappedLink = (link, targetId, type, request, account, logger) => {\n let data = {}\n data.sendTo = link\n data.targetId = targetId\n data.epoch = getNow()\n\n if (type != null) {\n data.type = type\n } else {\n data.type = 'view'\n }\n\n data = request.addSystemDataToObject(data, undefined)\n return addToURL(account.recorderURL, 'd', compressData(JSON.stringify(data), logger))\n}\n\nexport const getMessageTemplate = () => {\n return `\n
`\n}\n\nexport const getMessageHeadTemplate = () => {\n return `\n \n \n \n \n `\n}\n\nexport const setEnum = (enumVal, logger) => {\n if (isString(enumVal) || isNumber(enumVal)) {\n return '$E_' + enumVal\n }\n logger.error(ENUM_FORMAT_ERROR)\n}\nexport const handleEmailSubscription = (subscription, reEncoded, fetchGroups, account, logger) => {\n const urlParamsAsIs = getURLParams(location.href) // can't use url_params as it is in lowercase above\n const encodedEmailId = urlParamsAsIs.e\n const encodedProfileProps = urlParamsAsIs.p\n const pageType = urlParamsAsIs.page_type\n\n if (typeof encodedEmailId !== 'undefined') {\n const data = {}\n data.id = account.id // accountId\n data.unsubGroups = $ct.unsubGroups // unsubscribe groups\n\n if ($ct.updatedCategoryLong) {\n data[categoryLongKey] = $ct.updatedCategoryLong\n }\n\n let url = account.emailURL\n if (fetchGroups) {\n url = addToURL(url, 'fetchGroups', fetchGroups)\n }\n if (reEncoded) {\n url = addToURL(url, 'encoded', reEncoded)\n }\n url = addToURL(url, 'e', encodedEmailId)\n url = addToURL(url, 'd', compressData(JSON.stringify(data), logger))\n if (encodedProfileProps) {\n url = addToURL(url, 'p', encodedProfileProps)\n }\n\n if (subscription !== '-1') {\n url = addToURL(url, 'sub', subscription)\n }\n\n if (pageType) {\n $ct.globalUnsubscribe = pageType === GLOBAL\n url = addToURL(url, 'page_type', pageType)\n }\n RequestDispatcher.fireRequest(url)\n }\n}\n","import {\n isObjectEmpty\n} from '../util/datatypes'\nimport {\n isProfileValid,\n processFBUserObj,\n processGPlusUserObj,\n addToLocalProfileMap\n} from '../util/clevertap'\nimport {\n COMMAND_DELETE,\n COMMAND_INCREMENT,\n EVT_PUSH,\n PR_COOKIE\n} from '../util/constants'\nimport {\n addToURL\n} from '../util/url'\nimport {\n StorageManager,\n $ct\n} from '../util/storage'\nimport { compressData } from '../util/encoder'\nexport default class ProfileHandler extends Array {\n #logger\n #request\n #account\n #oldValues\n #isPersonalisationActive\n\n constructor ({\n logger,\n request,\n account,\n isPersonalisationActive\n }, values) {\n super()\n this.#logger = logger\n this.#request = request\n this.#account = account\n this.#oldValues = values\n this.#isPersonalisationActive = isPersonalisationActive\n }\n\n push (...profilesArr) {\n this.#processProfileArray(profilesArr)\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#processProfileArray(this.#oldValues)\n }\n this.#oldValues = null\n }\n\n getAttribute (propName) {\n if (!this.#isPersonalisationActive()) {\n return\n }\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE)\n }\n if ($ct.globalProfileMap != null) {\n return $ct.globalProfileMap[propName]\n }\n }\n\n #processProfileArray (profileArr) {\n if (Array.isArray(profileArr) && profileArr.length > 0) {\n for (const index in profileArr) {\n if (profileArr.hasOwnProperty(index)) {\n const outerObj = profileArr[index]\n let data = {}\n let profileObj\n if (outerObj.Site != null) { // organic data from the site\n profileObj = outerObj.Site\n if (isObjectEmpty(profileObj) || !isProfileValid(profileObj, {\n logger: this.#logger\n })) {\n return\n }\n } else if (outerObj.Facebook != null) { // fb connect data\n const FbProfileObj = outerObj.Facebook\n // make sure that the object contains any data at all\n\n if (!isObjectEmpty(FbProfileObj) && (!FbProfileObj.error)) {\n profileObj = processFBUserObj(FbProfileObj)\n }\n } else if (outerObj['Google Plus'] != null) {\n const GPlusProfileObj = outerObj['Google Plus']\n if (!isObjectEmpty(GPlusProfileObj) && (!GPlusProfileObj.error)) {\n profileObj = processGPlusUserObj(GPlusProfileObj, { logger: this.#logger })\n }\n }\n if (profileObj != null && (!isObjectEmpty(profileObj))) { // profile got set from above\n data.type = 'profile'\n if (profileObj.tz == null) {\n // try to auto capture user timezone if not present\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n\n data.profile = profileObj\n addToLocalProfileMap(profileObj, true)\n data = this.#request.addSystemDataToObject(data, undefined)\n\n this.#request.addFlags(data)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n }\n }\n }\n }\n\n /**\n *\n * @param {any} key\n * @param {number} value\n * @param {string} command\n * increases or decreases value of the number type properties in profile object\n */\n _handleIncrementDecrementValue (key, value, command) {\n // Check if the value is greater than 0\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE)\n }\n if ($ct.globalProfileMap == null && !$ct.globalProfileMap?.hasOwnProperty(key)) {\n // Check if the profile map already has the propery defined\n console.error('Kindly create profile with required proprty to increment/decrement.')\n } else if (!value || typeof value !== 'number' || value <= 0) {\n console.error('Value should be a number greater than 0')\n } else {\n // Update the profile property in local storage\n if (command === COMMAND_INCREMENT) {\n $ct.globalProfileMap[key] = $ct.globalProfileMap[key] + value\n } else {\n $ct.globalProfileMap[key] = $ct.globalProfileMap[key] - value\n }\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n\n // Send the updated value to LC\n let data = {}\n const profileObj = {}\n data.type = 'profile'\n profileObj[key] = { [command]: value }\n if (profileObj.tz == null) {\n // try to auto capture user timezone if not present\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n data.profile = profileObj\n data = this.#request.addSystemDataToObject(data, true)\n\n this.#request.addFlags(data)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n }\n\n /**\n *\n * @param {any} key\n * @param {array} arrayVal\n * @param {string} command\n * overwrites/sets new value(s) against a key/property in profile object\n */\n _handleMultiValueSet (key, arrayVal, command) {\n const array = []\n for (let i = 0; i < arrayVal.length; i++) {\n if (typeof arrayVal[i] === 'number' && !array.includes(arrayVal[i])) {\n array.push(arrayVal[i])\n } else if (typeof arrayVal[i] === 'string' && !array.includes(arrayVal[i].toLowerCase())) {\n array.push(arrayVal[i].toLowerCase())\n } else {\n console.error('array supports only string or number type values')\n }\n }\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE) ?? {}\n }\n $ct.globalProfileMap[key] = array\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n this.sendMultiValueData(key, arrayVal, command)\n }\n\n /**\n *\n * @param {any} propKey - the property name to be added in the profile object\n * @param {string, number, array} propVal - the property value to be added against the @propkey key\n * @param {string} command\n * Adds array or single value against a key/property in profile object\n */\n _handleMultiValueAdd (propKey, propVal, command) {\n // Initialize array\n var array = []\n\n // Check if globalProfileMap is null, initialize if needed\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE) || {}\n }\n\n // Check if the value to be set is either string or number\n if (typeof propVal === 'string' || typeof propVal === 'number') {\n if ($ct.globalProfileMap.hasOwnProperty(propKey)) {\n array = $ct.globalProfileMap[propKey]\n array.push(typeof propVal === 'number' ? propVal : propVal.toLowerCase())\n } else {\n $ct.globalProfileMap[propKey] = propVal\n }\n } else {\n // Check if propVal is an array\n if ($ct.globalProfileMap.hasOwnProperty(propKey)) {\n array = Array.isArray($ct.globalProfileMap[propKey]) ? $ct.globalProfileMap[propKey] : [$ct.globalProfileMap[propKey]]\n }\n\n // Check for case-sensitive inputs and filter the same ones\n for (var i = 0; i < propVal.length; i++) {\n if (typeof propVal[i] === 'number' && !array.includes(propVal[i])) {\n array.push(propVal[i])\n } else if (typeof propVal[i] === 'string' && !array.includes(propVal[i].toLowerCase())) {\n array.push(propVal[i].toLowerCase())\n } else if ((typeof propVal[i] === 'number' && array.includes(propVal[i])) || (typeof propVal[i] === 'string' && array.includes(propVal[i].toLowerCase()))) {\n console.error('Values already included')\n } else {\n console.error('Array supports only string or number type values')\n }\n }\n\n // Update globalProfileMap with the array\n $ct.globalProfileMap[propKey] = array\n }\n\n // Save to local storage or cookie\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n\n // Call the sendMultiValueData function\n this.sendMultiValueData(propKey, propVal, command)\n }\n\n /**\n *\n * @param {any} propKey\n * @param {string, number, array} propVal\n * @param {string} command\n * removes value(s) against a key/property in profile object\n */\n _handleMultiValueRemove (propKey, propVal, command) {\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE)\n }\n if (!$ct?.globalProfileMap?.hasOwnProperty(propKey)) {\n console.error(`The property ${propKey} does not exist.`)\n } else {\n if (typeof propVal === 'string' || typeof propVal === 'number') {\n var index = $ct.globalProfileMap[propKey].indexOf(propVal)\n if (index !== -1) {\n $ct.globalProfileMap[propKey].splice(index, 1)\n }\n } else {\n for (var k = 0; k < propVal.length; k++) {\n var idx = $ct.globalProfileMap[propKey].indexOf(propVal[k])\n if (idx !== -1) {\n $ct.globalProfileMap[propKey].splice(idx, 1)\n }\n }\n }\n }\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n this.sendMultiValueData(propKey, propVal, command)\n }\n\n /**\n *\n * @param {any} propKey\n * @param {string} command\n * deletes a key value pair from the profile object\n */\n _handleMultiValueDelete (propKey, command) {\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE)\n }\n if (!$ct?.globalProfileMap?.hasOwnProperty(propKey)) {\n console.error(`The property ${propKey} does not exist.`)\n } else {\n delete $ct.globalProfileMap[propKey]\n }\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n this.sendMultiValueData(propKey, null, command)\n }\n\n sendMultiValueData (propKey, propVal, command) {\n // Send the updated value to LC\n let data = {}\n const profileObj = {}\n data.type = 'profile'\n\n // this removes the property at backend\n profileObj[propKey] = { [command]: command === COMMAND_DELETE ? true : propVal }\n if (profileObj.tz == null) {\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n data.profile = profileObj\n data = this.#request.addSystemDataToObject(data, true)\n this.#request.addFlags(data)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n}\n","import {\n isObject,\n isObjectEmpty\n} from '../util/datatypes'\nimport {\n KCOOKIE_NAME,\n GCOOKIE_NAME,\n EVT_PUSH,\n LRU_CACHE_SIZE,\n IS_OUL,\n CAMP_COOKIE_NAME,\n CHARGEDID_COOKIE_NAME,\n PR_COOKIE,\n EV_COOKIE,\n ARP_COOKIE,\n CLEAR,\n META_COOKIE,\n FIRE_PUSH_UNREGISTERED\n} from '../util/constants'\nimport {\n StorageManager,\n $ct\n} from '../util/storage'\nimport LRUCache from '../util/lruCache'\nimport {\n compressData\n} from '../util/encoder'\nimport {\n addToURL,\n getHostName\n} from '../util/url'\nimport {\n isProfileValid,\n processFBUserObj,\n processGPlusUserObj,\n addToLocalProfileMap\n} from '../util/clevertap'\n\nexport default class UserLoginHandler extends Array {\n #request\n #logger\n #account\n #session\n #oldValues\n #device\n\n constructor ({\n request,\n account,\n session,\n logger,\n device\n },\n values) {\n super()\n this.#request = request\n this.#account = account\n this.#session = session\n this.#logger = logger\n this.#oldValues = values\n this.#device = device\n }\n\n // On User Login\n #processOUL (profileArr) {\n let sendOULFlag = true\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, sendOULFlag)\n const addToK = (ids) => {\n let k = StorageManager.readFromLSorCookie(KCOOKIE_NAME)\n const g = StorageManager.readFromLSorCookie(GCOOKIE_NAME)\n let kId\n if (k == null) {\n k = {}\n kId = ids\n } else {\n /* check if already exists */\n kId = k.id\n let anonymousUser = false\n let foundInCache = false\n if (kId == null) {\n kId = ids[0]\n anonymousUser = true\n }\n if ($ct.LRU_CACHE == null && StorageManager._isLocalStorageSupported()) {\n $ct.LRU_CACHE = new LRUCache(LRU_CACHE_SIZE)\n }\n\n if (anonymousUser) {\n if ((g) != null) {\n // if have gcookie\n $ct.LRU_CACHE.set(kId, g)\n $ct.blockRequest = false\n }\n } else {\n // check if the id is present in the cache\n // set foundInCache to true\n for (const idx in ids) {\n if (ids.hasOwnProperty(idx)) {\n const id = ids[idx]\n if ($ct.LRU_CACHE.cache[id]) {\n kId = id\n foundInCache = true\n break\n }\n }\n }\n }\n\n if (foundInCache) {\n if (kId !== $ct.LRU_CACHE.getLastKey()) {\n // New User found\n // remove the entire cache\n this.#handleCookieFromCache()\n } else {\n sendOULFlag = false\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, sendOULFlag)\n }\n const gFromCache = $ct.LRU_CACHE.get(kId)\n $ct.LRU_CACHE.set(kId, gFromCache)\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, gFromCache)\n this.#device.gcookie = gFromCache\n\n const lastK = $ct.LRU_CACHE.getSecondLastKey()\n if (StorageManager.readFromLSorCookie(FIRE_PUSH_UNREGISTERED) && lastK !== -1) {\n // CACHED OLD USER FOUND. TRANSFER PUSH TOKEN TO THIS USER\n const lastGUID = $ct.LRU_CACHE.cache[lastK]\n this.#request.unregisterTokenForGuid(lastGUID)\n }\n } else {\n if (!anonymousUser) {\n this.clear()\n } else {\n if ((g) != null) {\n this.#device.gcookie = g\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, g)\n sendOULFlag = false\n }\n }\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, false)\n kId = ids[0]\n }\n }\n k.id = kId\n StorageManager.saveToLSorCookie(KCOOKIE_NAME, k)\n }\n\n if (Array.isArray(profileArr) && profileArr.length > 0) {\n for (const index in profileArr) {\n if (profileArr.hasOwnProperty(index)) {\n const outerObj = profileArr[index]\n let data = {}\n let profileObj\n if (outerObj.Site != null) { // organic data from the site\n profileObj = outerObj.Site\n if (isObjectEmpty(profileObj) || !isProfileValid(profileObj, {\n logger: this.#logger\n })) {\n return\n }\n } else if (outerObj.Facebook != null) { // fb connect data\n const FbProfileObj = outerObj.Facebook\n // make sure that the object contains any data at all\n\n if (!isObjectEmpty(FbProfileObj) && (!FbProfileObj.error)) {\n profileObj = processFBUserObj(FbProfileObj)\n }\n } else if (outerObj['Google Plus'] != null) {\n const GPlusProfileObj = outerObj['Google Plus']\n if (isObjectEmpty(GPlusProfileObj) && (!GPlusProfileObj.error)) {\n profileObj = processGPlusUserObj(GPlusProfileObj, { logger: this.#logger })\n }\n }\n if (profileObj != null && (!isObjectEmpty(profileObj))) { // profile got set from above\n data.type = 'profile'\n if (profileObj.tz == null) {\n // try to auto capture user timezone if not present\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n\n data.profile = profileObj\n const ids = []\n if (StorageManager._isLocalStorageSupported()) {\n if (profileObj.Identity) {\n ids.push(profileObj.Identity)\n }\n if (profileObj.Email) {\n ids.push(profileObj.Email)\n }\n if (profileObj.GPID) {\n ids.push('GP:' + profileObj.GPID)\n }\n if (profileObj.FBID) {\n ids.push('FB:' + profileObj.FBID)\n }\n if (ids.length > 0) {\n addToK(ids)\n }\n }\n addToLocalProfileMap(profileObj, true)\n data = this.#request.addSystemDataToObject(data, undefined)\n\n this.#request.addFlags(data)\n // Adding 'isOUL' flag in true for OUL cases which.\n // This flag tells LC to create a new arp object.\n // Also we will receive the same flag in response arp which tells to delete existing arp object.\n if (sendOULFlag) {\n data[IS_OUL] = true\n }\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n // Whenever sendOULFlag is true then dont send arp and gcookie (guid in memory in the request)\n // Also when this flag is set we will get another flag from LC in arp which tells us to delete arp\n // stored in the cache and replace it with the response arp.\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest, sendOULFlag)\n }\n }\n }\n }\n }\n\n clear () {\n this.#logger.debug('clear called. Reset flag has been set.')\n this.#deleteUser()\n StorageManager.setMetaProp(CLEAR, true)\n }\n\n #handleCookieFromCache () {\n $ct.blockRequest = false\n console.debug('Block request is false')\n if (StorageManager._isLocalStorageSupported()) {\n delete localStorage[PR_COOKIE]\n delete localStorage[EV_COOKIE]\n delete localStorage[META_COOKIE]\n delete localStorage[ARP_COOKIE]\n delete localStorage[CAMP_COOKIE_NAME]\n delete localStorage[CHARGEDID_COOKIE_NAME]\n }\n StorageManager.removeCookie(CAMP_COOKIE_NAME, getHostName())\n StorageManager.removeCookie(this.#session.cookieName, $ct.broadDomain)\n StorageManager.removeCookie(ARP_COOKIE, $ct.broadDomain)\n this.#session.setSessionCookieObject('')\n }\n\n #deleteUser () {\n $ct.blockRequest = true\n this.#logger.debug('Block request is true')\n $ct.globalCache = {\n gcookie: null,\n REQ_N: 0,\n RESP_N: 0\n }\n if (StorageManager._isLocalStorageSupported()) {\n delete localStorage[GCOOKIE_NAME]\n delete localStorage[KCOOKIE_NAME]\n delete localStorage[PR_COOKIE]\n delete localStorage[EV_COOKIE]\n delete localStorage[META_COOKIE]\n delete localStorage[ARP_COOKIE]\n delete localStorage[CAMP_COOKIE_NAME]\n delete localStorage[CHARGEDID_COOKIE_NAME]\n }\n StorageManager.removeCookie(GCOOKIE_NAME, $ct.broadDomain)\n StorageManager.removeCookie(CAMP_COOKIE_NAME, getHostName())\n StorageManager.removeCookie(KCOOKIE_NAME, getHostName())\n StorageManager.removeCookie(this.#session.cookieName, $ct.broadDomain)\n StorageManager.removeCookie(ARP_COOKIE, $ct.broadDomain)\n this.#device.gcookie = null\n this.#session.setSessionCookieObject('')\n }\n\n #processLoginArray (loginArr) {\n if (Array.isArray(loginArr) && loginArr.length > 0) {\n const profileObj = loginArr.pop()\n const processProfile = profileObj != null && isObject(profileObj) &&\n ((profileObj.Site != null && Object.keys(profileObj.Site).length > 0) ||\n (profileObj.Facebook != null && Object.keys(profileObj.Facebook).length > 0) ||\n (profileObj['Google Plus'] != null && Object.keys(profileObj['Google Plus']).length > 0))\n if (processProfile) {\n StorageManager.setInstantDeleteFlagInK()\n try {\n this.#processOUL([profileObj])\n } catch (e) {\n this.#logger.debug(e)\n }\n } else {\n this.#logger.error('Profile object is in incorrect format')\n }\n }\n }\n\n push (...profilesArr) {\n this.#processLoginArray(profilesArr)\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#processLoginArray(this.#oldValues)\n }\n this.#oldValues = null\n }\n}\n","export class CTWebPersonalisationBanner extends HTMLElement {\n constructor () {\n super()\n this.shadow = this.attachShadow({ mode: 'open' })\n }\n\n _details = null\n shadow = null\n\n get details () {\n return this._details || ''\n }\n\n set details (val) {\n if (this._details === null) {\n this._details = val\n this.renderBanner()\n }\n }\n\n renderBanner () {\n this.shadow.innerHTML = this.getBannerContent()\n if (this.trackClick !== false) {\n this.addEventListener('click', () => {\n const onClickUrl = this.details.onClick\n if (onClickUrl) {\n this.details.window ? window.open(onClickUrl, '_blank') : window.parent.location.href = onClickUrl\n }\n window.clevertap.renderNotificationClicked({ msgId: this.msgId, pivotId: this.pivotId })\n })\n }\n window.clevertap.renderNotificationViewed({ msgId: this.msgId, pivotId: this.pivotId })\n }\n\n getBannerContent () {\n return `\n \n
\n \n \n \n \"Please\n \n ${this.details.html ? this.details.html : ''}\n
\n `\n }\n}\n","import { CTWebPersonalisationBanner } from './banner'\nexport class CTWebPersonalisationCarousel extends HTMLElement {\n constructor () {\n super()\n this.shadow = this.attachShadow({ mode: 'open' })\n if (customElements.get('ct-web-personalisation-banner') === undefined) {\n customElements.define('ct-web-personalisation-banner', CTWebPersonalisationBanner)\n }\n }\n\n _target = null\n _carousel = null\n shadow = null\n slides = 0\n previouslySelectedItem = -1\n selectedItem = 1\n autoSlide = null\n stopAutoSlideTimeout = null\n\n get target () {\n return this._target || ''\n }\n\n set target (val) {\n if (this._target === null) {\n this._target = val\n this.renderCarousel()\n }\n }\n\n get details () {\n return this.target.display.details\n }\n\n get display () {\n return this.target.display\n }\n\n renderCarousel () {\n this.slides = this.details.length\n this.shadow.innerHTML = this.getStyles()\n const carousel = this.getCarouselContent()\n if (this.display.showNavBtns) {\n carousel.insertAdjacentHTML('beforeend', this.display.navBtnsHtml)\n }\n if (this.display.showNavArrows) {\n carousel.insertAdjacentHTML('beforeend', this.display.leftNavArrowHtml)\n carousel.insertAdjacentHTML('beforeend', this.display.rightNavArrowHtml)\n }\n this._carousel = carousel\n this.shadow.appendChild(carousel)\n this.setupClick()\n this.updateSelectedItem()\n // TODO: enable conditionally\n this.startAutoSlide()\n this.setupOnHover()\n window.clevertap.renderNotificationViewed({ msgId: this.target.wzrk_id, pivotId: this.target.wzrk_pivot })\n }\n\n setupClick () {\n this._carousel.addEventListener('click', (event) => {\n const eventID = event.target.id\n if (eventID.startsWith('carousel__button')) {\n const selected = +eventID.split('-')[1]\n if (selected !== this.selectedItem) {\n this.previouslySelectedItem = this.selectedItem\n this.selectedItem = selected\n this.updateSelectedItem()\n this.startAutoSlide()\n }\n } else if (eventID.startsWith('carousel__arrow')) {\n eventID.endsWith('right') ? this.goToNext() : this.goToPrev()\n this.startAutoSlide()\n } else if (eventID.indexOf('-') > -1) {\n const item = +eventID.split('-')[1]\n const index = item - 1\n if (window.parent.clevertap) {\n // console.log('Raise notification clicked event for ', item)\n window.clevertap.renderNotificationClicked({ msgId: this.target.wzrk_id, pivotId: this.target.wzrk_pivot, wzrk_slideNo: item })\n }\n const url = this.details[index].onClick\n if (url !== '') {\n this.details[index].window ? window.open(url, '_blank') : window.location.href = url\n }\n }\n })\n }\n\n setupOnHover () {\n this._carousel.addEventListener('mouseenter', (event) => {\n this.stopAutoSlideTimeout = setTimeout(() => {\n this.autoSlide = clearInterval(this.autoSlide)\n }, 500)\n })\n\n this._carousel.addEventListener('mouseleave', (event) => {\n clearTimeout(this.stopAutoSlideTimeout)\n if (this.autoSlide === undefined) {\n this.startAutoSlide()\n }\n })\n }\n\n getCarouselContent () {\n const carousel = document.createElement('div')\n carousel.setAttribute('class', 'carousel')\n\n this.details.forEach((detail, i) => {\n const banner = document.createElement('ct-web-personalisation-banner')\n banner.classList.add('carousel__item')\n banner.trackClick = false\n banner.setAttribute('id', `carousel__item-${i + 1}`)\n banner.details = detail\n carousel.appendChild(banner)\n })\n\n return carousel\n }\n\n getStyles () {\n return `\n \n `\n }\n\n updateSelectedItem () {\n if (this.previouslySelectedItem !== -1) {\n const prevItem = this.shadow.getElementById(`carousel__item-${this.previouslySelectedItem}`)\n const prevButton = this.shadow.getElementById(`carousel__button-${this.previouslySelectedItem}`)\n prevItem.classList.remove('carousel__item--selected')\n if (prevButton) {\n prevButton.classList.remove('carousel__button--selected')\n }\n }\n const item = this.shadow.getElementById(`carousel__item-${this.selectedItem}`)\n const button = this.shadow.getElementById(`carousel__button-${this.selectedItem}`)\n item.classList.add('carousel__item--selected')\n if (button) {\n button.classList.add('carousel__button--selected')\n }\n }\n\n startAutoSlide () {\n clearInterval(this.autoSlide)\n this.autoSlide = setInterval(() => {\n this.goToNext()\n }, this.display.sliderTime ? this.display.sliderTime * 1000 : 3000)\n }\n\n goToNext () {\n this.goTo(this.selectedItem, (this.selectedItem + 1) % this.slides)\n }\n\n goToPrev () {\n this.goTo(this.selectedItem, this.selectedItem - 1)\n }\n\n goTo (prev, cur) {\n this.previouslySelectedItem = prev\n this.selectedItem = cur\n if (cur === 0) {\n this.selectedItem = this.slides\n }\n this.updateSelectedItem()\n }\n}\n","import {\n getCampaignObject,\n saveCampaignObject\n} from '../clevertap'\nimport { StorageManager } from '../storage'\n\nexport class CTWebPopupImageOnly extends HTMLElement {\n constructor () {\n super()\n this.shadow = this.attachShadow({ mode: 'open' })\n }\n\n _target = null\n _session = null\n shadow = null\n popup = null\n container = null\n resizeObserver = null\n\n get target () {\n return this._target || ''\n }\n\n set target (val) {\n if (this._target === null) {\n this._target = val\n this.renderImageOnlyPopup()\n }\n }\n\n get session () {\n return this._session || ''\n }\n\n set session (val) {\n this._session = val\n }\n\n get msgId () {\n return this.target.wzrk_id\n }\n\n get pivotId () {\n return this.target.wzrk_pivot\n }\n\n get onClickUrl () {\n return this.target.display.onClickUrl\n }\n\n renderImageOnlyPopup () {\n const campaignId = this.target.wzrk_id.split('_')[0]\n const currentSessionId = this.session.sessionId\n\n this.shadow.innerHTML = this.getImageOnlyPopupContent()\n this.popup = this.shadowRoot.getElementById('imageOnlyPopup')\n this.container = this.shadowRoot.getElementById('container')\n this.closeIcon = this.shadowRoot.getElementById('close')\n\n this.popup.addEventListener('load', this.updateImageAndContainerWidth())\n this.resizeObserver = new ResizeObserver(() => this.handleResize(this.popup, this.container))\n this.resizeObserver.observe(this.popup)\n\n this.closeIcon.addEventListener('click', () => {\n this.resizeObserver.unobserve(this.popup)\n document.getElementById('wzrkImageOnlyDiv').style.display = 'none'\n this.remove()\n if (campaignId != null && campaignId !== '-1') {\n if (StorageManager._isLocalStorageSupported()) {\n const campaignObj = getCampaignObject()\n\n let sessionCampaignObj = campaignObj.wp[currentSessionId]\n if (sessionCampaignObj == null) {\n sessionCampaignObj = {}\n campaignObj[currentSessionId] = sessionCampaignObj\n }\n sessionCampaignObj[campaignId] = 'dnd'\n saveCampaignObject(campaignObj)\n }\n }\n })\n\n window.clevertap.renderNotificationViewed({ msgId: this.msgId, pivotId: this.pivotId })\n\n if (this.onClickUrl) {\n this.popup.addEventListener('click', () => {\n this.target.display.window ? window.open(this.onClickUrl, '_blank') : window.parent.location.href = this.onClickUrl\n window.clevertap.renderNotificationClicked({ msgId: this.msgId, pivotId: this.pivotId })\n })\n }\n }\n\n handleResize (popup, container) {\n const width = this.getRenderedImageWidth(popup)\n container.style.setProperty('width', `${width}px`)\n }\n\n getImageOnlyPopupContent () {\n return `\n ${this.target.msgContent.css}\n ${this.target.msgContent.html}\n `\n }\n\n updateImageAndContainerWidth () {\n return () => {\n const width = this.getRenderedImageWidth(this.popup)\n this.popup.style.setProperty('width', `${width}px`)\n this.container.style.setProperty('width', `${width}px`)\n this.container.style.setProperty('height', 'auto')\n this.container.style.setProperty('position', 'fixed')\n this.popup.style.setProperty('visibility', 'visible')\n this.closeIcon.style.setProperty('visibility', 'visible')\n document.getElementById('wzrkImageOnlyDiv').style.visibility = 'visible'\n }\n }\n\n getRenderedImageWidth (img) {\n const ratio = img.naturalWidth / img.naturalHeight\n return img.height * ratio\n }\n}\n","import { determineTimeStampText, greenTickSvg } from './helper'\nexport class Message extends HTMLElement {\n constructor (config, message) {\n super()\n this.shadow = this.attachShadow({ mode: 'open' })\n this.config = config\n this.message = message\n this.renderMessage(message)\n }\n\n wrapper = null\n snackBar = null\n\n get pivotId () {\n return this.message.wzrk_pivot\n }\n\n get campaignId () {\n return this.message.wzrk_id\n }\n\n createEl (type, id, part) {\n const _el = document.createElement(type)\n _el.setAttribute('id', id)\n _el.setAttribute('part', part || id)\n return _el\n }\n\n renderMessage (msg) {\n this.wrapper = this.createEl('div', 'messageWrapper')\n\n switch (msg.templateType) {\n case 'text-only':\n case 'text-with-icon':\n case 'text-with-icon-and-image': {\n const message = this.prepareBasicMessage(msg.msg[0])\n this.wrapper.appendChild(message)\n }\n }\n\n const timeStamp = this.createEl('div', 'timeStamp')\n timeStamp.innerHTML = `${determineTimeStampText(msg.id.split('_')[1])}`\n if (!msg.viewed) {\n const unreadMarker = this.createEl('span', 'unreadMarker')\n timeStamp.appendChild(unreadMarker)\n }\n\n this.wrapper.appendChild(timeStamp)\n this.shadow.appendChild(this.wrapper)\n }\n\n prepareBasicMessage (msg) {\n const message = this.createEl('div', 'message')\n\n if (msg.imageUrl) {\n const imageContainer = this.addImage(msg.imageUrl, 'mainImg')\n message.appendChild(imageContainer)\n }\n const iconTitleDescWrapper = this.createEl('div', 'iconTitleDescWrapper')\n if (msg.iconUrl) {\n const iconContainer = this.addImage(msg.iconUrl, 'iconImg')\n iconTitleDescWrapper.appendChild(iconContainer)\n }\n const titleDescWrapper = this.createEl('div', 'titleDescWrapper')\n if (msg.title) {\n const title = this.createEl('div', 'title')\n title.innerText = msg.title\n titleDescWrapper.appendChild(title)\n }\n if (msg.description) {\n const description = this.createEl('div', 'description')\n description.innerText = msg.description\n titleDescWrapper.appendChild(description)\n }\n if (msg.title || msg.description) {\n iconTitleDescWrapper.appendChild(titleDescWrapper)\n }\n\n if (msg.iconUrl || msg.title || msg.description) {\n message.appendChild(iconTitleDescWrapper)\n }\n if (msg.buttons && msg.buttons.length) {\n const buttonsContainer = this.addButtons(msg.buttons)\n message.appendChild(buttonsContainer)\n }\n return message\n }\n\n addButtons (buttons = []) {\n const buttonsContainer = this.createEl('div', 'buttonsContainer')\n let hasCopyAction = false\n buttons.forEach((b, i) => {\n const button = this.createEl('button', `button-${i}`, 'button')\n button.innerText = b.text\n if (i > 0) {\n button.style.cssText += 'margin-left: 2px;'\n }\n if (b.action === 'copy') {\n hasCopyAction = true\n }\n buttonsContainer.appendChild(button)\n })\n if (hasCopyAction) {\n this.addSnackbar(buttonsContainer)\n }\n return buttonsContainer\n }\n\n addSnackbar (buttonsContainer) {\n this.snackBar = this.createEl('div', `snackbar-${this.campaignId}`, 'snackbar')\n this.snackBar.innerHTML = greenTickSvg\n const clipboardMsg = this.createEl('span', `snackbar-msg-${this.campaignId}`, 'snackbar-msg')\n clipboardMsg.innerText = 'Copied to clipboard'\n this.snackBar.appendChild(clipboardMsg)\n buttonsContainer.appendChild(this.snackBar)\n }\n\n addImage (url, type) {\n const imageContainer = this.createEl('div', `${type}Container`)\n const image = this.createEl('img', type)\n image.setAttribute('src', url)\n // images will be fetched as and when the element comes into the viewport\n image.setAttribute('loading', 'lazy')\n imageContainer.appendChild(image)\n return imageContainer\n }\n\n raiseClickedEvent (path, isPreview) {\n switch (this.message.templateType) {\n case 'text-only':\n case 'text-with-icon':\n case 'text-with-icon-and-image': {\n this.raiseClickedForBasicTemplates(path, isPreview)\n }\n }\n }\n\n raiseClickedForBasicTemplates (path, isPreview) {\n const msg = this.message.msg[0]\n const payload = { msgId: this.campaignId, pivotId: this.pivotId }\n if (path.tagName === 'BUTTON') {\n const id = path.id.split('-')[1]\n const button = msg.buttons[id]\n payload.kv = {\n wzrk_c2a: button.text\n }\n if (button.action === 'url') {\n button.openUrlInNewTab ? window.open(button.url, '_blank') : (window.location = button.url)\n } else if (button.action === 'copy') {\n window.focus()\n navigator.clipboard.writeText(button.clipboardText)\n this.snackBar.style.setProperty('display', 'flex', 'important')\n setTimeout(() => {\n this.snackBar.style.setProperty('display', 'none', 'important')\n }, 2000)\n }\n } else if (path.tagName === 'CT-INBOX-MESSAGE' && msg.onClickUrl) {\n msg.openUrlInNewTab ? window.open(msg.onClickUrl, '_blank') : (window.location = msg.onClickUrl)\n }\n if (isPreview) {\n console.log('Notifiction clicked event will be raised at run time with payload ::', payload)\n } else {\n window.clevertap.renderNotificationClicked(payload)\n }\n }\n}\n","export const messageStyles = ({ backgroundColor, borderColor, titleColor, descriptionColor, buttonColor, buttonTextColor, unreadMarkerColor }) => {\n return `\n \n `\n}\n\nexport const inboxContainerStyles = ({\n panelBackgroundColor,\n panelBorderColor,\n headerBackgroundColor,\n headerTitleColor,\n closeIconColor,\n categoriesTabColor,\n categoriesTitleColor,\n categoriesBorderColor,\n selectedCategoryTabColor,\n selectedCategoryTitleColor,\n selectedCategoryBorderColor,\n headerCategoryHeight\n}) => {\n return `\n \n `\n}\n","import { StorageManager, $ct } from '../../util/storage'\nimport { Message } from './Message'\nimport { inboxContainerStyles, messageStyles } from './inboxStyles'\nimport { getInboxPosition, determineTimeStampText, arrowSvg, getInboxMessages, saveInboxMessages } from './helper'\nimport { WEBINBOX_CONFIG, MAX_INBOX_MSG } from '../../util/constants'\n\nexport class Inbox extends HTMLElement {\n constructor (logger) {\n super()\n this.logger = logger\n this.shadow = this.attachShadow({ mode: 'open' })\n }\n\n isInboxOpen = false\n isInboxFromFlutter = false\n selectedCategory = null\n unviewedMessages = {}\n unviewedCounter = 0\n isPreview = false\n inboxConfigForPreview = {}\n\n // dom references\n inboxSelector = null\n inbox = null\n emptyInboxMsg = null\n inboxCard = null\n unviewedBadge = null\n observer = null\n selectedCategoryRef = null\n\n get incomingMessages () {\n return []\n }\n\n set incomingMessages (msgs = []) {\n if (msgs.length > 0 && this.inbox) {\n this.updateInboxMessages(msgs)\n }\n }\n\n get incomingMessagesForPreview () {\n return []\n }\n\n set incomingMessagesForPreview (msgs = []) {\n const previewMsgs = {}\n if (msgs.length > 0 && this.inbox) {\n this.isPreview = true\n this.unviewedCounter = 0\n msgs.forEach((m) => {\n const key = `${m.wzrk_id.split('_')[0]}_${Date.now()}`\n m.id = key\n previewMsgs[key] = m\n this.unviewedMessages[key] = m\n this.unviewedCounter++\n })\n this.buildUIForMessages(previewMsgs)\n this.updateUnviewedBadgeCounter()\n }\n }\n\n connectedCallback () {\n this.init()\n }\n\n init () {\n this.config = this.isPreview ? this.inboxConfigForPreview : StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}\n if (Object.keys(this.config).length === 0) {\n return\n }\n this.inboxSelector = document.getElementById(this.config.inboxSelector)\n if (this.inboxSelector === null) {\n return\n }\n\n if (this.config.styles.notificationsBadge) {\n this.addUnviewedBadge()\n } else if (this.unviewedBadge) {\n this.unviewedBadge.remove()\n }\n\n this.createinbox()\n\n /**\n * We need to remove the listener as there could be a scenario where init would be called when\n * we get updated web inbox settings from LC after the inbox has been initialised.\n * It can so happen that the inbox-selector would have changed.\n */\n document.removeEventListener('click', this.addClickListenerOnDocument)\n document.addEventListener('click', this.addClickListenerOnDocument)\n this.config.categories.length && this.updateActiveCategory(this.selectedCategoryRef.innerText)\n\n this.shadow.innerHTML = this.getInboxStyles()\n this.shadow.appendChild(this.inbox)\n }\n\n addMsgsToInboxFromLS () {\n const messages = this.deleteExpiredAndGetUnexpiredMsgs(false)\n const msgIds = messages ? Object.keys(messages) : []\n if (msgIds.length === 0) {\n return\n }\n msgIds.forEach((m) => {\n if (!messages[m].viewed) {\n this.unviewedMessages[m] = messages[m]\n this.unviewedCounter++\n }\n })\n this.buildUIForMessages(messages)\n this.updateUnviewedBadgeCounter()\n }\n\n /**\n * @param {*} deleteMsgsFromUI - If this param is true, then we'll have to check the UI and delete expired messages from the DOM\n * It'll be false when you are building the inbox layout for the very first time.\n *\n * This method reads the inbox messages from LS,\n * based on the deleteMsgsFromUI flag deletes the expired messages from UI and decrements the unviewed counter if the message was not viewed,\n * sorts the messages based on the date,\n * saves the unexpired messages to LS\n * and returns the sorted unexpired messages\n *\n * Scenarios when we encounter expired messages -\n * 1. building ui for the 1st time, no need to decrement the unviewed counter as the correct count will be set at the time of rendering\n * 2. UI is already built (deleteMsgsFromUI = true) and you open the inbox\n * a. You'll find the expired msg in inbox\n * b. You'll not find the expired msg in inbox.\n * This happens when we receive new messages from LC, increment unviewed counter, save it in LS. (We build the UI only when the user opens inbox.)\n * In both the above scenarios, we'll still have to decrement the unviewed counter if the message was not viewed.\n */\n deleteExpiredAndGetUnexpiredMsgs (deleteMsgsFromUI = true) {\n let messages = getInboxMessages()\n\n const now = Math.floor(Date.now() / 1000)\n for (const msg in messages) {\n if (messages[msg].wzrk_ttl && messages[msg].wzrk_ttl > 0 && messages[msg].wzrk_ttl < now) {\n if (deleteMsgsFromUI) {\n const el = this.shadowRoot.getElementById(messages[msg].id)\n el && el.remove()\n if (!messages[msg].viewed) {\n this.unviewedCounter--\n this.updateUnviewedBadgeCounter()\n }\n }\n delete messages[msg]\n }\n }\n if (messages && messages.length > 0) {\n messages = Object.values(messages).sort((a, b) => b.date - a.date).reduce((acc, m) => { acc[m.id] = m; return acc }, {})\n }\n saveInboxMessages(messages)\n return messages\n }\n\n updateInboxMessages (msgs = []) {\n const inboxMsgs = this.deleteExpiredAndGetUnexpiredMsgs()\n const date = Date.now()\n const incomingMsgs = {}\n msgs.forEach((m, i) => {\n const key = `${m.wzrk_id.split('_')[0]}_${Date.now()}`\n m.id = key\n // We are doing this to preserve the order of the messages\n m.date = date - i\n m.viewed = 0\n inboxMsgs[key] = m\n incomingMsgs[key] = m\n this.unviewedMessages[key] = m\n this.unviewedCounter++\n })\n saveInboxMessages(inboxMsgs)\n this.buildUIForMessages(incomingMsgs)\n this.updateUnviewedBadgeCounter()\n }\n\n createEl (type, id, part) {\n const _el = document.createElement(type)\n _el.setAttribute('id', id)\n _el.setAttribute('part', part || id)\n return _el\n }\n\n addUnviewedBadge () {\n if (!this.unviewedBadge) {\n this.unviewedBadge = this.createEl('div', 'unviewedBadge')\n // As this unviewedBadge element will be directly added to the DOM, we are defining inline styles\n this.unviewedBadge.style.cssText = `display: none; position: absolute; height: 16px; width: 26px; border-radius: 8px; background-color: ${this.config.styles.notificationsBadge.backgroundColor}; font-size: 12px; color: ${this.config.styles.notificationsBadge.textColor}; font-weight: bold; align-items: center; justify-content: center;`\n document.body.appendChild(this.unviewedBadge)\n }\n this.updateUnviewedBadgePosition()\n\n // called when user switches b/w portrait and landscape mode.\n window.addEventListener('resize', () => {\n this.updateUnviewedBadgePosition()\n })\n }\n\n updateUnviewedBadgePosition () {\n const { top, right } = this.inboxSelector.getBoundingClientRect()\n this.unviewedBadge.style.top = `${top - 8}px`\n this.unviewedBadge.style.left = `${right - 8}px`\n }\n\n createinbox () {\n this.inbox = this.createEl('div', 'inbox')\n const header = this.createEl('div', 'header')\n\n const headerTitle = this.createEl('div', 'headerTitle')\n headerTitle.innerText = this.config.title\n\n const closeIcon = this.createEl('div', 'closeInbox')\n closeIcon.innerHTML = '×'\n\n header.appendChild(headerTitle)\n header.appendChild(closeIcon)\n this.inbox.appendChild(header)\n if (this.config.categories.length) {\n const categories = this.createCategories()\n this.inbox.appendChild(categories)\n }\n this.inboxCard = this.createEl('div', 'inboxCard')\n this.inbox.appendChild(this.inboxCard)\n\n this.emptyInboxMsg = this.createEl('div', 'emptyInboxMsg')\n this.emptyInboxMsg.innerText = 'All messages will be displayed here.'\n this.inboxCard.appendChild(this.emptyInboxMsg)\n\n // Intersection observer for notification viewed\n const options = {\n root: this.inboxCard,\n rootMargin: '0px',\n threshold: 0.5\n }\n this.observer = new IntersectionObserver((entries, observer) => { this.handleMessageViewed(entries) }, options)\n\n this.addMsgsToInboxFromLS()\n }\n\n createCategories () {\n const categoriesContainer = this.createEl('div', 'categoriesContainer')\n\n const leftArrow = this.createEl('div', 'leftArrow')\n leftArrow.innerHTML = arrowSvg\n leftArrow.children[0].style = 'transform: rotate(180deg)'\n leftArrow.addEventListener('click', () => {\n this.shadowRoot.getElementById('categoriesWrapper').scrollBy(-70, 0)\n })\n categoriesContainer.appendChild(leftArrow)\n\n const categoriesWrapper = this.createEl('div', 'categoriesWrapper')\n const _categories = ['All', ...this.config.categories]\n _categories.forEach((c, i) => {\n const category = this.createEl('div', `category-${i}`, 'category')\n category.innerText = c\n if (i === 0) {\n this.selectedCategoryRef = category\n }\n categoriesWrapper.appendChild(category)\n })\n categoriesContainer.appendChild(categoriesWrapper)\n\n const rightArrow = this.createEl('div', 'rightArrow')\n rightArrow.innerHTML = arrowSvg\n rightArrow.addEventListener('click', () => {\n this.shadowRoot.getElementById('categoriesWrapper').scrollBy(70, 0)\n })\n categoriesContainer.appendChild(rightArrow)\n\n const options = { root: categoriesContainer, threshold: 0.9 }\n const firstCategory = categoriesWrapper.children[0]\n const lastCategory = categoriesWrapper.children[this.config.categories.length]\n\n const firstCategoryObserver = new IntersectionObserver((e) => {\n this.categoryObserverCb(leftArrow, e[0].intersectionRatio >= 0.9)\n }, options)\n firstCategoryObserver.observe(firstCategory)\n\n const lastCategoryObserver = new IntersectionObserver((e) => {\n this.categoryObserverCb(rightArrow, e[0].intersectionRatio >= 0.9)\n }, options)\n lastCategoryObserver.observe(lastCategory)\n\n return categoriesContainer\n }\n\n categoryObserverCb (el, hide) {\n if (!el) {\n return\n }\n el.style.display = hide ? 'none' : 'flex'\n }\n\n updateActiveCategory (activeCategory) {\n this.selectedCategory = activeCategory\n\n this.inboxCard.scrollTop = 0\n let counter = 0\n\n this.prevCategoryRef && this.prevCategoryRef.setAttribute('selected', 'false')\n this.selectedCategoryRef.setAttribute('selected', 'true')\n\n this.inboxCard.childNodes.forEach(c => {\n if (c.getAttribute('id') !== 'emptyInboxMsg') {\n c.style.display = (this.selectedCategory === 'All' || c.getAttribute('category') === this.selectedCategory) ? 'block' : 'none'\n if (c.style.display === 'block') {\n counter++\n }\n }\n })\n if (counter === 0) {\n this.emptyInboxMsg.innerText = `${activeCategory} messages will be displayed here.`\n this.emptyInboxMsg.style.display = 'block'\n } else {\n this.emptyInboxMsg.style.display = 'none'\n }\n }\n\n buildUIForMessages (messages = {}) {\n !this.isPreview && this.updateTSForRenderedMsgs()\n this.inboxCard.scrollTop = 0\n const maxMsgsInInbox = this.config.maxMsgsInInbox ?? MAX_INBOX_MSG\n const firstChild = this.inboxCard.firstChild\n\n const sortedMsgs = Object.values(messages).sort((a, b) => b.date - a.date).map((m) => m.id)\n for (const m of sortedMsgs) {\n const item = new Message(this.config, messages[m])\n item.setAttribute('id', messages[m].id)\n item.setAttribute('pivot', messages[m].wzrk_pivot)\n item.setAttribute('part', 'ct-inbox-message')\n if (this.config.categories.length > 0) {\n item.setAttribute('category', messages[m].tags[0] || '')\n item.style.display = (this.selectedCategory === 'All' || messages[m].category === this.selectedCategory) ? 'block' : 'none'\n } else {\n item.style.display = 'block'\n }\n this.inboxCard.insertBefore(item, firstChild)\n this.observer.observe(item)\n }\n\n let msgTotalCount = this.inboxCard.querySelectorAll('ct-inbox-message').length\n while (msgTotalCount > maxMsgsInInbox) {\n const ctInboxMsgs = this.inboxCard.querySelectorAll('ct-inbox-message')\n if (ctInboxMsgs.length > 0) { ctInboxMsgs[ctInboxMsgs.length - 1].remove() }\n msgTotalCount--\n }\n const hasMessages = this.inboxCard.querySelectorAll('ct-inbox-message[style*=\"display: block\"]').length\n this.emptyInboxMsg.style.display = hasMessages ? 'none' : 'block'\n }\n\n /**\n * Adds a click listener on the document. For every click we check\n * 1. if the click has happenned within the inbox\n * - on close button, we close the inbox\n * - on any of the category, we set that as the activeCategory\n * - on any of the message, we mark raise notification clicked event. To identify the clicks on a button, we have p.id.startsWith('button-')\n * 2. if the user has clicked on the inboxSelector, we toggle inbox\n * 3. if the click is anywhere else on the UI and the inbox is open, we simply close it\n */\n\n addClickListenerOnDocument = (() => {\n return (e) => {\n if (e.composedPath().includes(this.inbox)) {\n // path is not supported on FF. So we fallback to e.composedPath\n const path = e.path || (e.composedPath && e.composedPath())\n if (path.length) {\n const id = path[0].id\n if (id === 'closeInbox') {\n this.toggleInbox()\n } else if (id.startsWith('category-')) {\n this.prevCategoryRef = this.selectedCategoryRef\n this.selectedCategoryRef = path[0]\n this.updateActiveCategory(path[0].innerText)\n } else {\n const _path = path.filter((p) => p.id?.startsWith('button-') || p.tagName === 'CT-INBOX-MESSAGE')\n if (_path.length) {\n const messageEl = _path[_path.length - 1]\n messageEl.raiseClickedEvent(_path[0], this.isPreview)\n }\n }\n }\n } else if (this.inboxSelector.contains(e.target) || this.isInboxOpen) {\n if (this.isInboxFromFlutter) {\n this.isInboxFromFlutter = false\n } else {\n this.toggleInbox(e)\n }\n }\n }\n })()\n\n /**\n * This function will be called every time when a message comes into the inbox viewport and it's visibility increases to 50% or drops below 50%\n * If a msg is 50% visible in the UI, we need to mark the message as viewed in LS and raise notification viewed event\n */\n handleMessageViewed (entries) {\n const raiseViewedEvent = !this.isPreview\n if (this.isInboxOpen) {\n entries.forEach((e) => {\n if (e.isIntersecting && this.unviewedMessages.hasOwnProperty(e.target.id) && e.target.message.viewed === 0) {\n e.target.message.viewed = 1\n if (raiseViewedEvent) {\n window.clevertap.renderNotificationViewed({ msgId: e.target.campaignId, pivotId: e.target.pivotId })\n this.updateMessageInLS(e.target.id, { ...e.target.message, viewed: 1 })\n setTimeout(() => {\n e.target.shadowRoot.getElementById('unreadMarker').style.display = 'none'\n }, 1000)\n } else {\n console.log('Notifiction viewed event will be raised at run time with payload ::', { msgId: e.target.campaignId, pivotId: e.target.pivotId })\n }\n this.unviewedCounter--\n this.updateUnviewedBadgeCounter()\n delete this.unviewedMessages[e.target.id]\n }\n })\n }\n }\n\n updateMessageInLS (key, value) {\n if (!this.isPreview) {\n const messages = getInboxMessages()\n messages[key] = value\n saveInboxMessages(messages)\n }\n }\n\n // create a separte fn fro refactoring\n toggleInbox (e) {\n this.isInboxOpen = !this.isInboxOpen\n this.isInboxFromFlutter = !!e?.rect\n if (this.isInboxOpen) {\n this.inboxCard.scrollTop = 0\n !this.isPreview && this.deleteExpiredAndGetUnexpiredMsgs()\n this.inbox.style.display = 'block'\n this.inbox.style.zIndex = '2147483647' // zIndex should be max for the inbox to be rendered on top of all elements\n if (this.config.categories.length) {\n this.selectedCategoryRef.setAttribute('selected', 'false')\n this.selectedCategoryRef = this.shadowRoot.getElementById('category-0')\n this.updateActiveCategory(this.selectedCategoryRef.innerText)\n this.shadowRoot.getElementById('categoriesWrapper').scrollLeft -= this.shadowRoot.getElementById('categoriesWrapper').scrollWidth\n }\n this.setInboxPosition(e)\n } else {\n this.inbox.style.display = 'none'\n }\n }\n\n setInboxPosition (e) {\n const windowWidth = window.outerWidth\n const customInboxStyles = getComputedStyle($ct.inbox)\n const top = customInboxStyles.getPropertyValue('--inbox-top')\n const bottom = customInboxStyles.getPropertyValue('--inbox-bottom')\n const left = customInboxStyles.getPropertyValue('--inbox-left')\n const right = customInboxStyles.getPropertyValue('--inbox-right')\n const hasPositionDefined = top || bottom || left || right\n if (windowWidth > 481 && !hasPositionDefined) {\n const res = getInboxPosition(e, this.inbox.clientHeight, this.inbox.clientWidth)\n const xPos = res.xPos\n const yPos = res.yPos\n this.inbox.style.top = yPos + 'px'\n this.inbox.style.left = xPos + 'px'\n }\n }\n\n /**\n * Updates the UI with the number of unviewed messages\n * If there are more than 9 unviewed messages, we show the count as 9+\n */\n\n setBadgeStyle = (msgCount) => {\n if (this.unviewedBadge !== null) {\n this.unviewedBadge.innerText = msgCount > 9 ? '9+' : msgCount\n this.unviewedBadge.style.display = msgCount > 0 ? 'flex' : 'none'\n }\n }\n\n updateUnviewedBadgeCounter () {\n if (this.isPreview) {\n this.setBadgeStyle(this.unviewedCounter)\n return\n }\n let counter = 0\n this.inboxCard.querySelectorAll('ct-inbox-message').forEach((m) => {\n const messages = getInboxMessages()\n if (messages[m.id] && messages[m.id].viewed === 0) {\n counter++\n }\n })\n this.setBadgeStyle(counter)\n }\n\n updateTSForRenderedMsgs () {\n this.inboxCard.querySelectorAll('ct-inbox-message').forEach((m) => {\n const ts = m.id.split('_')[1]\n m.shadow.getElementById('timeStamp').firstChild.innerText = determineTimeStampText(ts)\n })\n }\n\n getInboxStyles () {\n const headerHeight = 36\n const categoriesHeight = this.config.categories.length ? 64 : 16\n\n const styles = {\n panelBackgroundColor: this.config.styles.panelBackgroundColor,\n panelBorderColor: this.config.styles.panelBorderColor,\n headerBackgroundColor: this.config.styles.header.backgroundColor,\n headerTitleColor: this.config.styles.header.titleColor,\n closeIconColor: this.config.styles.closeIconColor,\n categoriesTabColor: this.config.styles.categories.tabColor,\n categoriesTitleColor: this.config.styles.categories.titleColor,\n selectedCategoryTabColor: this.config.styles.categories.selectedTab.tabColor,\n selectedCategoryTitleColor: this.config.styles.categories.selectedTab.titleColor,\n headerCategoryHeight: headerHeight + categoriesHeight\n }\n if (this.config.styles.categories.borderColor) {\n styles.categoriesBorderColor = this.config.styles.categories.borderColor\n }\n if (this.config.styles.categories.selectedTab.borderColor) {\n styles.selectedCategoryBorderColor = this.config.styles.categories.selectedTab.borderColor\n }\n\n const inboxStyles = inboxContainerStyles(styles)\n\n const cardStyles = this.config.styles.cards\n const msgStyles = messageStyles({\n backgroundColor: cardStyles.backgroundColor,\n borderColor: cardStyles.borderColor,\n titleColor: cardStyles.titleColor,\n descriptionColor: cardStyles.descriptionColor,\n buttonColor: cardStyles.buttonColor,\n buttonTextColor: cardStyles.buttonTextColor,\n unreadMarkerColor: cardStyles.unreadMarkerColor\n })\n\n return inboxStyles + msgStyles\n }\n}\n","import { StorageManager, $ct } from '../../util/storage'\nimport { Inbox } from './WebInbox'\nimport { Message } from './Message'\nimport { WEBINBOX_CONFIG, GCOOKIE_NAME, WEBINBOX } from '../../util/constants'\nimport { isValueValid } from '../../util/datatypes'\n\nexport const processWebInboxSettings = (webInboxSetting, isPreview = false) => {\n const _settings = StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}\n if (isPreview) {\n $ct.inbox.inboxConfigForPreview = webInboxSetting\n $ct.inbox.isPreview = true\n $ct.inbox && $ct.inbox.init()\n } else if (JSON.stringify(_settings) !== JSON.stringify(webInboxSetting)) {\n StorageManager.saveToLSorCookie(WEBINBOX_CONFIG, webInboxSetting)\n $ct.inbox && $ct.inbox.init()\n }\n}\n\nexport const processInboxNotifs = (msg) => {\n if (msg.inbox_preview) {\n $ct.inbox.incomingMessagesForPreview = msg.inbox_notifs\n } else {\n $ct.inbox.incomingMessages = msg\n }\n}\n\nexport const processWebInboxResponse = (msg) => {\n if (msg.webInboxSetting) {\n processWebInboxSettings(msg.webInboxSetting, msg.inbox_preview)\n }\n if (msg.inbox_notifs != null) {\n processInboxNotifs(msg)\n }\n}\n\nexport const addWebInbox = (logger) => {\n checkAndRegisterWebInboxElements()\n $ct.inbox = new Inbox({ logger })\n document.body.appendChild($ct.inbox)\n}\n\nconst getAndMigrateInboxMessages = (guid) => {\n const messages = StorageManager.readFromLSorCookie(WEBINBOX) || {}\n // Doing this to migrate message to guid level\n if (Object.keys(messages).length > 0 && Object.keys(messages)[0].includes('_')) {\n const gudInboxObj = {}\n gudInboxObj[guid] = messages\n StorageManager.saveToLSorCookie(WEBINBOX, gudInboxObj)\n return gudInboxObj\n }\n return messages\n}\n\nexport const getInboxMessages = () => {\n const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n if (!isValueValid(guid)) { return {} }\n const messages = getAndMigrateInboxMessages(guid)\n\n return messages.hasOwnProperty(guid) ? messages[guid] : {}\n}\n\nexport const saveInboxMessages = (messages) => {\n const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n if (!isValueValid(guid)) { return }\n const storedInboxObj = getAndMigrateInboxMessages(guid)\n\n const newObj = { ...storedInboxObj, [guid]: messages }\n StorageManager.saveToLSorCookie(WEBINBOX, newObj)\n}\n\nexport const initializeWebInbox = (logger) => {\n return new Promise((resolve, reject) => {\n if (document.readyState === 'complete') {\n addWebInbox(logger)\n resolve()\n } else {\n const config = StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}\n const onLoaded = () => {\n /**\n * We need this null check here because $ct.inbox could be initialised via init method too on document load.\n * In that case we don't need to call addWebInbox method\n */\n if ($ct.inbox === null) {\n addWebInbox(logger)\n }\n resolve()\n }\n window.addEventListener('load', () => {\n /**\n * Scripts can be loaded layzily, we may not get element from dom as it may not be mounted yet\n * We will to check element for 10 seconds and give up\n */\n if (document.getElementById(config.inboxSelector)) {\n onLoaded()\n } else {\n // check for element for next 10 seconds\n let count = 0\n if (count < 20) {\n const t = setInterval(() => {\n if (document.getElementById(config.inboxSelector)) {\n onLoaded()\n clearInterval(t)\n resolve()\n } else if (count >= 20) {\n clearInterval(t)\n logger.debug('Failed to add inbox')\n }\n count++\n }, 500)\n }\n }\n })\n }\n })\n}\n\nexport const checkAndRegisterWebInboxElements = () => {\n if (customElements.get('ct-web-inbox') === undefined) {\n customElements.define('ct-web-inbox', Inbox)\n customElements.define('ct-inbox-message', Message)\n }\n}\n\nexport const getInboxPosition = (e, inboxHeight, inboxWidth) => {\n const horizontalScroll = document.scrollingElement.scrollLeft\n const verticalScroll = document.scrollingElement.scrollTop\n const windowWidth = window.innerWidth + horizontalScroll\n const windowHeight = window.innerHeight + verticalScroll\n const selectorRect = e.rect || e.target.getBoundingClientRect()\n const selectorX = selectorRect.x + horizontalScroll\n const selectorY = selectorRect.y + verticalScroll\n const selectorLeft = selectorRect.left + horizontalScroll\n const selectorRight = selectorRect.right + horizontalScroll\n const selectorTop = selectorRect.top + verticalScroll\n // const selectorBottom = selectorRect.bottom + verticalScroll\n const selectorBottom = selectorRect.bottom\n const selectorHeight = selectorRect.height\n const selectorWidth = selectorRect.width\n const selectorCenter = {\n x: selectorX + (selectorWidth / 2),\n y: selectorY + (selectorHeight / 2)\n }\n const halfOfInboxHeight = (inboxHeight / 2)\n const halfOfInboxWidth = (inboxWidth / 2)\n let inboxOnSide = false\n\n let xPos, yPos\n\n const padding = 16\n\n /**\n * y co-ordinates:\n * Try to push the card downwards\n * if that's not possible, push it upwards\n * if that too is not possible, then the card will be placed on the side. Add some padding.\n *\n * x co-ordinates:\n * If the card is on the side,\n * try to place it to the right. If it's not possible,\n * place it to the left\n * If the card is either on top/ bottom, set the x co-ordinate such that the selector center and the inbox card center become the same\n * Now,\n * if the left of the inbox card is < 0,\n * try to get the left aligned to the selectorLeft.\n * if that's not possible, simply set left to 0\n * if the right of the inbox card > windowWidth,\n * try to get the right of rhe inbox card aligned with the selectorRight\n * if that's not possible, simply set the inbox right to the window Right\n */\n if (selectorBottom + inboxHeight <= windowHeight) { // try to place the card down\n const availableHeight = windowHeight - (selectorBottom + inboxHeight)\n yPos = availableHeight >= padding ? selectorBottom + padding : selectorBottom + availableHeight\n } else if (selectorTop - inboxHeight >= verticalScroll) { // try to place the card up\n const availableHeight = selectorTop - inboxHeight\n yPos = availableHeight >= padding ? selectorTop - inboxHeight - padding : selectorTop - inboxHeight - availableHeight\n } else {\n inboxOnSide = true\n yPos = selectorCenter.y - halfOfInboxHeight // with this the y co-ordinate of the selector center and the inbox card center become the same\n if (yPos < verticalScroll) {\n yPos = verticalScroll\n } else if (yPos + inboxHeight > windowHeight) {\n yPos = windowHeight - inboxHeight\n }\n }\n\n if (inboxOnSide) {\n // See if we can place the card to the right of the selector\n const inboxRight = selectorRight + inboxWidth\n if (inboxRight <= windowWidth) {\n const availableWidth = inboxRight + padding <= windowWidth ? padding : windowWidth - inboxRight\n xPos = selectorRight + availableWidth\n } else {\n const inboxLeft = selectorLeft - inboxWidth\n const availableWidth = inboxLeft - padding >= horizontalScroll ? padding : inboxLeft - horizontalScroll\n xPos = inboxLeft - availableWidth\n }\n } else {\n xPos = selectorCenter.x - halfOfInboxWidth\n if (xPos < horizontalScroll) {\n if (selectorLeft + inboxWidth <= windowWidth) {\n xPos = selectorLeft\n } else {\n xPos = horizontalScroll\n }\n } else if (xPos + inboxWidth > windowWidth) {\n if (selectorRight - inboxWidth >= horizontalScroll) {\n xPos = selectorRight - inboxWidth\n } else {\n xPos = windowWidth - inboxWidth\n }\n }\n }\n\n return { xPos, yPos }\n}\n\nexport const determineTimeStampText = (ts) => {\n const now = Date.now()\n let diff = Math.floor((now - ts) / 60000)\n if (diff < 5) {\n return 'Just now'\n }\n if (diff < 60) {\n return `${diff} minute${diff > 1 ? 's' : ''} ago`\n }\n diff = Math.floor(diff / 60)\n if (diff < 24) {\n return `${diff} hour${diff > 1 ? 's' : ''} ago`\n }\n diff = Math.floor(diff / 24)\n return `${diff} day${diff > 1 ? 's' : ''} ago`\n}\n\nexport const hasWebInboxSettingsInLS = () => {\n return Object.keys(StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}).length > 0\n}\n\nexport const arrowSvg = `\n\n\n`\nexport const greenTickSvg = `\n\n\n`\n","// clevertap-handler.js\n\nconst ctEventhandler = (html) => {\n const ctScript = `\n var clevertap = {\n event: {\n push: (eventName) => {\n window.parent.postMessage({\n action: 'Event',\n value: eventName\n },'*');\n }\n },\n profile: {\n push: (eventName) => {\n window.parent.postMessage({\n action: 'Profile',\n value: eventName\n },'*');\n }\n },\n onUserLogin: {\n push: (eventName) => {\n window.parent.postMessage({\n action: 'OUL',\n value: eventName\n },'*');\n }\n },\n closeBoxPopUp: () => {\n window.parent.postMessage({\n action: 'closeBoxPopUp',\n value: 'closeBoxPopUp'\n },'*');\n },\n closeBannerPopUp: () => {\n window.parent.postMessage({\n action: 'closeBannerPopUp',\n value: 'closeBannerPopUp'\n },'*');\n },\n closeInterstitialPopUp: () => {\n window.parent.postMessage({\n action: 'closeInterstitialPopUp',\n value: 'closeInterstitialPopUp'\n },'*');\n }\n }\n `\n const insertPosition = html.indexOf('\n `\n return html.replace(/(<\\s*\\/\\s*body)/, `${script}\\n$1`)\n }\n\n let _callBackCalled = false\n\n const showFooterNotification = (targetingMsgJson) => {\n let onClick = targetingMsgJson.display.onClick\n\n // TODO: Needs wizrocket as a global variable\n if (window.clevertap.hasOwnProperty('notificationCallback') &&\n typeof window.clevertap.notificationCallback !== 'undefined' &&\n typeof window.clevertap.notificationCallback === 'function') {\n const notificationCallback = window.clevertap.notificationCallback\n\n if (!_callBackCalled) {\n const inaObj = {}\n inaObj.msgContent = targetingMsgJson.msgContent\n inaObj.msgId = targetingMsgJson.wzrk_id\n if (targetingMsgJson.wzrk_pivot) {\n inaObj.pivotId = targetingMsgJson.wzrk_pivot\n }\n if (targetingMsgJson.display.kv != null) {\n inaObj.kv = targetingMsgJson.display.kv\n }\n\n window.clevertap.raiseNotificationClicked = () => {\n if (onClick !== '' && onClick != null) {\n const jsFunc = targetingMsgJson.display.jsFunc\n onClick += getCookieParams()\n\n // invoke js function call\n if (jsFunc != null) {\n // track notification clicked event\n RequestDispatcher.fireRequest(onClick)\n invokeExternalJs(jsFunc, targetingMsgJson)\n return\n }\n // pass on the gcookie|page|scookieId for capturing the click event\n if (targetingMsgJson.display.window === 1) {\n window.open(onClick, '_blank')\n } else {\n window.location = onClick\n }\n }\n }\n window.clevertap.raiseNotificationViewed = () => {\n incrementImpression(targetingMsgJson)\n }\n notificationCallback(inaObj)\n _callBackCalled = true\n }\n } else {\n window.clevertap.popupCurrentWzrkId = targetingMsgJson.wzrk_id\n renderFooterNotification(targetingMsgJson)\n\n if (window.clevertap.hasOwnProperty('popupCallbacks') &&\n typeof window.clevertap.popupCallbacks !== 'undefined' &&\n typeof window.clevertap.popupCallbacks[targetingMsgJson.wzrk_id] === 'function') {\n const popupCallback = window.clevertap.popupCallbacks[targetingMsgJson.wzrk_id]\n\n const inaObj = {}\n inaObj.msgContent = targetingMsgJson.msgContent\n inaObj.msgId = targetingMsgJson.wzrk_id\n\n if (targetingMsgJson.wzrk_pivot) {\n inaObj.pivotId = targetingMsgJson.wzrk_pivot\n }\n\n var msgCTkv = []\n for (var wzrkPrefixKey in targetingMsgJson) {\n // ADD WZRK PREFIX KEY VALUE PAIRS\n if (wzrkPrefixKey.startsWith(WZRK_PREFIX) && wzrkPrefixKey !== WZRK_ID) {\n const wzrkJson = { [wzrkPrefixKey]: targetingMsgJson[wzrkPrefixKey] }\n msgCTkv.push(wzrkJson)\n }\n }\n\n if (msgCTkv.length > 0) {\n inaObj.msgCTkv = msgCTkv\n }\n if (targetingMsgJson.display.kv != null) {\n inaObj.kv = targetingMsgJson.display.kv\n }\n\n // PUBLIC API TO RECORD CLICKED EVENT\n window.clevertap.raisePopupNotificationClicked = (notificationData) => {\n if (!notificationData || !notificationData.msgId) { return }\n\n const eventData = {}\n eventData.type = 'event'\n eventData.evtName = NOTIFICATION_CLICKED\n eventData.evtData = { [WZRK_ID]: notificationData.msgId }\n if (targetingMsgJson.wzrk_pivot) {\n eventData.evtData = { ...eventData.evtData, wzrk_pivot: notificationData.pivotId }\n }\n\n // WZRK PREFIX KEY VALUE PAIRS\n if (notificationData.msgCTkv) {\n for (var wzrkPrefixObj of notificationData.msgCTkv) {\n eventData.evtData = { ...eventData.evtData, ...wzrkPrefixObj }\n }\n }\n\n _request.processEvent(eventData)\n }\n popupCallback(inaObj)\n }\n }\n }\n\n let exitintentObj\n const showExitIntent = (event, targetObj) => {\n let targetingMsgJson\n if (event != null && event.clientY > 0) {\n return\n }\n if (targetObj == null) {\n targetingMsgJson = exitintentObj\n } else {\n targetingMsgJson = targetObj\n }\n\n if ($ct.dismissSpamControl && targetingMsgJson.display.wtarget_type === 0 && document.getElementById('intentPreview') != null && document.getElementById('intentOpacityDiv') != null) {\n const element = document.getElementById('intentPreview')\n element.remove()\n document.getElementById('intentOpacityDiv').remove()\n }\n // ImageOnly campaign and Interstitial/Exit Intent shouldn't coexist\n if (document.getElementById('intentPreview') != null || document.getElementById('wzrkImageOnlyDiv') != null) {\n return\n }\n // dont show exit intent on tablet/mobile - only on desktop\n if (targetingMsgJson.display.layout == null &&\n ((/mobile/i.test(navigator.userAgent)) || (/mini/i.test(navigator.userAgent)) || (/iPad/i.test(navigator.userAgent)) ||\n ('ontouchstart' in window) || (/tablet/i.test(navigator.userAgent)))) {\n return\n }\n\n if (doCampHouseKeeping(targetingMsgJson) === false) {\n return\n }\n\n const campaignId = targetingMsgJson.wzrk_id.split('_')[0]\n $ct.campaignDivMap[campaignId] = 'intentPreview'\n let legacy = false\n const opacityDiv = document.createElement('div')\n opacityDiv.id = 'intentOpacityDiv'\n const opacity = targetingMsgJson.display.opacity || 0.7\n const rgbaColor = `rgba(0,0,0,${opacity})`\n opacityDiv.setAttribute('style', `position: fixed;top: 0;bottom: 0;left: 0;width: 100%;height: 100%;z-index: 2147483646;background: ${rgbaColor};`)\n document.body.appendChild(opacityDiv)\n\n const msgDiv = document.createElement('div')\n msgDiv.id = 'intentPreview'\n\n if (targetingMsgJson.display.proto == null) {\n legacy = true\n msgDiv.setAttribute('style', 'display:block;overflow:hidden;top:55% !important;left:50% !important;position:fixed;z-index:2147483647;width:600px !important;height:600px !important;margin:-300px 0 0 -300px !important;')\n } else {\n msgDiv.setAttribute('style', targetingMsgJson.display.iFrameStyle)\n }\n document.body.appendChild(msgDiv)\n const iframe = document.createElement('iframe')\n const borderRadius = targetingMsgJson.display.br === false ? '0' : '8'\n const displayObj = targetingMsgJson.display\n iframe.frameborder = '0px'\n iframe.marginheight = '0px'\n iframe.marginwidth = '0px'\n iframe.scrolling = 'no'\n iframe.id = WIZ_IFRAME_INTENT\n let html = targetingMsgJson.msgContent.html\n if (displayObj['custom-editor'] && !displayObj['bee-editor'] && displayObj['custom-html-sandbox']) { // sandbox the iframe only for custom html\n iframe.sandbox = 'allow-scripts allow-popups allow-popups-to-escape-sandbox allow-forms' // allow popup to open url in new page\n html = ctEventhandler(html)\n }\n const onClick = targetingMsgJson.display.onClick\n let pointerCss = ''\n if (onClick !== '' && onClick != null) {\n pointerCss = 'cursor:pointer;'\n }\n // direct html\n if (targetingMsgJson.msgContent.type === 1) {\n html = html.replace(/##campaignId##/g, campaignId)\n html = html.replace(/##campaignId_batchId##/g, targetingMsgJson.wzrk_id)\n } else {\n const css = '' +\n ''\n\n let bgColor, textColor, btnBg, btColor\n if (targetingMsgJson.display.theme === 'dark') {\n bgColor = '#2d2d2e'\n textColor = '#eaeaea'\n btnBg = '#353535'\n btColor = '#ffffff'\n } else {\n bgColor = '#ffffff'\n textColor = '#000000'\n btnBg = '#a5a6a6'\n btColor = '#ffffff'\n }\n const titleText = targetingMsgJson.msgContent.title\n const descriptionText = targetingMsgJson.msgContent.description\n let ctaText = ''\n if (targetingMsgJson.msgContent.ctaText != null && targetingMsgJson.msgContent.ctaText !== '') {\n ctaText = \"'\n }\n\n let imageTd = ''\n if (targetingMsgJson.msgContent.imageUrl != null && targetingMsgJson.msgContent.imageUrl !== '') {\n imageTd = \"
\"
'\n }\n const onClickStr = 'parent.$WZRK_WR.closeIframe(' + campaignId + \",'intentPreview');\"\n const title = \"
\" +\n \"×\" +\n \"
\" +\n \"
\" + titleText + '
'\n const body = \"
\" + descriptionText + '
' + imageTd + ctaText +\n '
'\n html = css + title + body\n }\n iframe.setAttribute('style', 'z-index: 2147483647; display:block; height: 100% !important; width: 100% !important;min-height:80px !important;border:0px !important; border-color:none !important;')\n msgDiv.appendChild(iframe)\n\n // Dispatch event for interstitial/exit intent close\n const closeCampaign = new Event('CT_campaign_rendered')\n document.dispatchEvent(closeCampaign)\n\n if (targetingMsgJson.display['custom-editor'] && !targetingMsgJson.display['bee-editor'] && targetingMsgJson.display['custom-html-sandbox']) {\n html = appendScriptForCustomEvent(targetingMsgJson, html)\n }\n iframe.srcdoc = html\n\n let contentDiv\n iframe.onload = () => {\n if (targetingMsgJson.display['custom-editor'] && !targetingMsgJson.display['bee-editor'] && targetingMsgJson.display['custom-html-sandbox']) {\n window.addEventListener('message', event => {\n switch (event?.data?.action) {\n case GET_NOTIFICATION_DATA:\n window.clevertap.renderNotificationClicked(event.data.value)\n break\n case EVENT:\n window.clevertap.event.push(event.data.value)\n break\n case PROFILE:\n window.clevertap.profile.push(event.data.value)\n break\n case OUL:\n window.clevertap.onUserLogin.push(event.data.value)\n break\n case CLOSE_INTERSTITIAL_POPUP:\n setTimeout(() => {\n const interstitialWrapper = window.document.getElementById('intentPreview')\n const interstitialOverlay = window.document.getElementById('intentOpacityDiv')\n interstitialOverlay && interstitialOverlay.remove()\n interstitialWrapper && interstitialWrapper.remove()\n }, 0)\n break\n default:\n // Handle unknown action\n break\n }\n })\n contentDiv = ''\n } else {\n contentDiv = document.getElementById(WIZ_IFRAME_INTENT).contentDocument.getElementById('contentDiv')\n }\n setupClickUrl(onClick, targetingMsgJson, contentDiv, 'intentPreview', legacy)\n }\n }\n\n if (!document.body) {\n if (_wizCounter < 6) {\n _wizCounter++\n setTimeout(_tr, 1000, msg, {\n device: _device,\n session: _session,\n request: _request,\n logger: _logger\n })\n }\n return\n }\n const processNativeDisplayArr = (arrInAppNotifs) => {\n Object.keys(arrInAppNotifs).map(key => {\n var elementId, id\n if (arrInAppNotifs[key].display.divId) {\n elementId = arrInAppNotifs[key].display.divId\n id = document.getElementById(elementId)\n } else {\n elementId = arrInAppNotifs[key].display.divSelector\n id = document.querySelector(elementId)\n }\n if (id !== null) {\n arrInAppNotifs[key].msgContent.type === 2 ? renderPersonalisationBanner(arrInAppNotifs[key]) : renderPersonalisationCarousel(arrInAppNotifs[key])\n delete arrInAppNotifs[key]\n }\n })\n }\n\n const addLoadListener = (arrInAppNotifs) => {\n window.addEventListener('load', () => {\n let count = 0\n if (count < 20) {\n const t = setInterval(() => {\n processNativeDisplayArr(arrInAppNotifs)\n if (Object.keys(arrInAppNotifs).length === 0 || count === 20) {\n clearInterval(t)\n arrInAppNotifs = {}\n }\n count++\n }, 500)\n }\n })\n }\n\n if (msg.inapp_notifs != null) {\n const arrInAppNotifs = {}\n for (let index = 0; index < msg.inapp_notifs.length; index++) {\n const targetNotif = msg.inapp_notifs[index]\n if (targetNotif.display.wtarget_type == null || targetNotif.display.wtarget_type === 0) {\n showFooterNotification(targetNotif)\n } else if (targetNotif.display.wtarget_type === 1) { // if display['wtarget_type']==1 then exit intent\n exitintentObj = targetNotif\n window.document.body.onmouseleave = showExitIntent\n } else if (targetNotif.display.wtarget_type === 2) { // if display['wtarget_type']==2 then web native display\n if (targetNotif.msgContent.type === 2 || targetNotif.msgContent.type === 3) { // Check for banner and carousel\n const element = targetNotif.display.divId ? document.getElementById(targetNotif.display.divId) : document.querySelector(targetNotif.display.divSelector)\n if (element !== null) {\n targetNotif.msgContent.type === 2 ? renderPersonalisationBanner(targetNotif) : renderPersonalisationCarousel(targetNotif)\n } else {\n arrInAppNotifs[targetNotif.wzrk_id.split('_')[0]] = targetNotif // Add targetNotif to object\n }\n } else {\n showFooterNotification(targetNotif)\n }\n }\n }\n // Process banner or carousel campaign array\n if (Object.keys(arrInAppNotifs).length) {\n if (document.readyState === 'complete') {\n processNativeDisplayArr(arrInAppNotifs)\n } else {\n addLoadListener(arrInAppNotifs)\n }\n }\n }\n\n const mergeEventMap = (newEvtMap) => {\n if ($ct.globalEventsMap == null) {\n $ct.globalEventsMap = StorageManager.readFromLSorCookie(EV_COOKIE)\n if ($ct.globalEventsMap == null) {\n $ct.globalEventsMap = newEvtMap\n return\n }\n }\n for (const key in newEvtMap) {\n if (newEvtMap.hasOwnProperty(key)) {\n const oldEvtObj = $ct.globalEventsMap[key]\n const newEvtObj = newEvtMap[key]\n if ($ct.globalEventsMap[key] != null) {\n if (newEvtObj[0] != null && newEvtObj[0] > oldEvtObj[0]) {\n $ct.globalEventsMap[key] = newEvtObj\n }\n } else {\n $ct.globalEventsMap[key] = newEvtObj\n }\n }\n }\n }\n\n const handleInboxNotifications = () => {\n if (msg.inbox_preview) {\n processInboxNotifs(msg)\n return\n }\n if (msg.inbox_notifs) {\n const msgArr = []\n for (let index = 0; index < msg.inbox_notifs.length; index++) {\n if (doCampHouseKeeping(msg.inbox_notifs[index]) !== false) {\n msgArr.push(msg.inbox_notifs[index])\n }\n }\n processInboxNotifs(msgArr)\n }\n }\n\n if (msg.webInboxSetting || msg.inbox_notifs != null) {\n /**\n * When the user visits a website for the 1st time after web inbox channel is setup,\n * we need to initialise the inbox here because the initializeWebInbox method within init will not be executed\n * as we would not have any entry related to webInboxSettings in the LS\n */\n\n if (hasWebInboxSettingsInLS()) {\n checkAndRegisterWebInboxElements()\n }\n if ($ct.inbox === null) {\n msg.webInboxSetting && processWebInboxSettings(msg.webInboxSetting)\n initializeWebInbox(_logger)\n .then(() => {\n handleInboxNotifications()\n })\n .catch(e => {})\n } else {\n handleInboxNotifications()\n }\n }\n\n if (msg.vars) {\n $ct.variableStore.mergeVariables(msg.vars)\n return\n }\n\n const staleDataUpdate = (staledata, campType) => {\n const campObj = getCampaignObject()\n const globalObj = campObj[campType].global\n if (globalObj != null && campType) {\n for (const idx in staledata) {\n if (staledata.hasOwnProperty(idx)) {\n delete globalObj[staledata[idx]]\n if (StorageManager.read(CAMP_COOKIE_G)) {\n const guidCampObj = JSON.parse(decodeURIComponent(StorageManager.read(CAMP_COOKIE_G)))\n const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n if (guidCampObj[guid] && guidCampObj[guid][campType] && guidCampObj[guid][campType][staledata[idx]]) {\n delete guidCampObj[guid][campType][staledata[idx]]\n StorageManager.save(CAMP_COOKIE_G, encodeURIComponent(JSON.stringify(guidCampObj)))\n }\n }\n }\n }\n }\n saveCampaignObject(campObj)\n }\n\n if (StorageManager._isLocalStorageSupported()) {\n try {\n if (msg.evpr != null) {\n const eventsMap = msg.evpr.events\n const profileMap = msg.evpr.profile\n const syncExpiry = msg.evpr.expires_in\n const now = getNow()\n StorageManager.setMetaProp('lsTime', now)\n StorageManager.setMetaProp('exTs', syncExpiry)\n mergeEventMap(eventsMap)\n StorageManager.saveToLSorCookie(EV_COOKIE, $ct.globalEventsMap)\n if ($ct.globalProfileMap == null) {\n addToLocalProfileMap(profileMap, true)\n } else {\n addToLocalProfileMap(profileMap, false)\n }\n }\n if (msg.arp != null) {\n arp(msg.arp)\n }\n if (msg.inapp_stale != null && msg.inapp_stale.length > 0) {\n // web popup stale\n staleDataUpdate(msg.inapp_stale, 'wp')\n }\n if (msg.inbox_stale != null && msg.inbox_stale.length > 0) {\n // web inbox stale\n staleDataUpdate(msg.inbox_stale, 'wi')\n }\n } catch (e) {\n _logger.error('Unable to persist evrp/arp: ' + e)\n }\n }\n}\n\nexport default _tr\n","import {\n StorageManager\n} from '../util/storage'\nexport default class User {\n #isPersonalisationActive\n\n constructor ({\n isPersonalisationActive\n }) {\n this.#isPersonalisationActive = isPersonalisationActive\n }\n\n getTotalVisits () {\n if (!this.#isPersonalisationActive()) {\n return\n }\n let visitCount = StorageManager.getMetaProp('sc')\n if (visitCount == null) {\n visitCount = 1\n }\n return visitCount\n }\n\n getLastVisit () {\n if (!this.#isPersonalisationActive()) {\n return\n }\n const prevSession = StorageManager.getMetaProp('ps')\n if (prevSession != null) {\n return new Date(prevSession * 1000)\n }\n }\n}\n","import {\n CLEVERTAP_ERROR_PREFIX\n} from '../util/messages'\n\nexport const logLevels = {\n DISABLE: 0,\n ERROR: 1,\n INFO: 2,\n DEBUG: 3,\n DEBUG_PE: 4\n}\n\nexport class Logger {\n #logLevel\n wzrkError = {}\n constructor (logLevel) {\n this.#logLevel = logLevel == null ? logLevel : logLevels.INFO\n this.wzrkError = {}\n }\n\n get logLevel () {\n return this.#logLevel\n }\n\n set logLevel (logLevel) {\n this.#logLevel = logLevel\n }\n\n error (message) {\n if (this.#logLevel >= logLevels.ERROR) {\n this.#log('error', message)\n }\n }\n\n info (message) {\n if (this.#logLevel >= logLevels.INFO) {\n this.#log('log', message)\n }\n }\n\n debug (message) {\n if (this.#logLevel >= logLevels.DEBUG || this.#isLegacyDebug) {\n this.#log('debug', message)\n }\n }\n\n debugPE (message) {\n if (this.#logLevel >= logLevels.DEBUG_PE) {\n this.#log('debug_pe', message)\n }\n }\n\n reportError (code, description) {\n this.wzrkError.c = code\n this.wzrkError.d = description\n this.error(`${CLEVERTAP_ERROR_PREFIX} ${code}: ${description}`)\n }\n\n #log (level, message) {\n if (window.console) {\n try {\n const ts = new Date().getTime()\n console[level](`CleverTap [${ts}]: ${message}`)\n } catch (e) {}\n }\n }\n\n get #isLegacyDebug () {\n return (typeof sessionStorage !== 'undefined' && sessionStorage.WZRK_D === '')\n }\n}\n\nexport default {\n Logger,\n logLevels\n}\n","import { singleQuoteRegex, SCOOKIE_EXP_TIME_IN_SECS } from '../util/constants'\nimport { isObject } from '../util/datatypes'\nimport { getNow } from '../util/datetime'\nimport { StorageManager } from '../util/storage'\nimport { getHostName } from '../util/url'\n\nexport default class SessionManager {\n #logger\n #sessionId\n #isPersonalisationActive\n cookieName // SCOOKIE_NAME\n scookieObj\n\n constructor ({\n logger,\n isPersonalisationActive\n }) {\n this.sessionId = StorageManager.getMetaProp('cs')\n this.#logger = logger\n this.#isPersonalisationActive = isPersonalisationActive\n }\n\n get sessionId () {\n return this.#sessionId\n }\n\n set sessionId (sessionId) {\n this.#sessionId = sessionId\n }\n\n getSessionCookieObject () {\n let scookieStr = StorageManager.readCookie(this.cookieName)\n let obj = {}\n\n if (scookieStr != null) {\n // converting back single quotes to double for JSON parsing - http://www.iandevlin.com/blog/2012/04/html5/cookies-json-localstorage-and-opera\n scookieStr = scookieStr.replace(singleQuoteRegex, '\"')\n\n obj = JSON.parse(scookieStr)\n if (!isObject(obj)) {\n obj = {}\n } else {\n if (typeof obj.t !== 'undefined') { // check time elapsed since last request\n const lastTime = obj.t\n const now = getNow()\n if ((now - lastTime) > (SCOOKIE_EXP_TIME_IN_SECS + 60)) {\n // adding 60 seconds to compensate for in-journey requests\n // ideally the cookie should've died after SCOOKIE_EXP_TIME_IN_SECS but it's still around as we can read\n // hence we shouldn't use it.\n obj = {}\n }\n }\n }\n }\n this.scookieObj = obj\n return obj\n }\n\n setSessionCookieObject (obj) {\n const objStr = JSON.stringify(obj)\n StorageManager.createBroadCookie(this.cookieName, objStr, SCOOKIE_EXP_TIME_IN_SECS, getHostName())\n }\n\n manageSession (session) {\n // first time. check if current session id in localstorage is same\n // if not same then prev = current and current = this new session\n if (typeof this.sessionId === 'undefined' || this.sessionId !== session) {\n const currentSessionInLS = StorageManager.getMetaProp('cs')\n // if sessionId in meta is undefined - set current to both\n if (typeof currentSessionInLS === 'undefined') {\n StorageManager.setMetaProp('ps', session)\n StorageManager.setMetaProp('cs', session)\n StorageManager.setMetaProp('sc', 1)\n } else if (currentSessionInLS !== session) {\n // not same as session in local storage. new session\n StorageManager.setMetaProp('ps', currentSessionInLS)\n StorageManager.setMetaProp('cs', session)\n let sessionCount = StorageManager.getMetaProp('sc')\n if (typeof sessionCount === 'undefined') {\n sessionCount = 0\n }\n StorageManager.setMetaProp('sc', sessionCount + 1)\n }\n this.sessionId = session\n }\n }\n\n getTimeElapsed () {\n if (!this.#isPersonalisationActive()) {\n return\n }\n if (this.scookieObj != null) { // TODO: check logic?\n this.scookieObj = this.getSessionCookieObject()\n }\n const sessionStart = this.scookieObj.s\n if (sessionStart != null) {\n const ts = getNow()\n return Math.floor(ts - sessionStart)\n }\n }\n\n getPageCount () {\n if (!this.#isPersonalisationActive()) {\n return\n }\n\n if (this.scookieObj != null) { // TODO: check logic\n this.scookieObj = this.getSessionCookieObject()\n }\n return this.scookieObj.p\n }\n}\n","import { CAMP_COOKIE_NAME, CLEAR, EVT_PUSH, EV_COOKIE, FIRE_PUSH_UNREGISTERED, LCOOKIE_NAME, PUSH_SUBSCRIPTION_DATA, WEBPUSH_LS_KEY } from '../util/constants'\nimport { isObjectEmpty, isValueValid, removeUnsupportedChars } from '../util/datatypes'\nimport { getNow } from '../util/datetime'\nimport { compressData } from '../util/encoder'\nimport RequestDispatcher from '../util/requestDispatcher'\nimport { StorageManager, $ct } from '../util/storage'\nimport { addToURL } from '../util/url'\nimport { getCampaignObjForLc } from '../util/clevertap'\n\nlet seqNo = 0\nlet requestTime = 0\n\nexport default class RequestManager {\n #logger\n #account\n #device\n #session\n #isPersonalisationActive\n #clearCookie = false\n processingBackup = false\n\n constructor ({ logger, account, device, session, isPersonalisationActive }) {\n this.#logger = logger\n this.#account = account\n this.#device = device\n this.#session = session\n this.#isPersonalisationActive = isPersonalisationActive\n\n RequestDispatcher.logger = logger\n RequestDispatcher.device = device\n RequestDispatcher.account = account\n }\n\n processBackupEvents () {\n const backupMap = StorageManager.readFromLSorCookie(LCOOKIE_NAME)\n if (typeof backupMap === 'undefined' || backupMap === null) {\n return\n }\n this.processingBackup = true\n for (const idx in backupMap) {\n if (backupMap.hasOwnProperty(idx)) {\n const backupEvent = backupMap[idx]\n if (typeof backupEvent.fired === 'undefined') {\n this.#logger.debug('Processing backup event : ' + backupEvent.q)\n if (typeof backupEvent.q !== 'undefined') {\n RequestDispatcher.fireRequest(backupEvent.q)\n }\n backupEvent.fired = true\n }\n }\n }\n StorageManager.saveToLSorCookie(LCOOKIE_NAME, backupMap)\n this.processingBackup = false\n }\n\n addSystemDataToObject (dataObject, ignoreTrim) {\n // ignore trim for chrome notifications; undefined everywhere else\n if (typeof ignoreTrim === 'undefined') {\n dataObject = removeUnsupportedChars(dataObject, this.#logger)\n }\n\n if (!isObjectEmpty(this.#logger.wzrkError)) {\n dataObject.wzrk_error = this.#logger.wzrkError\n this.#logger.wzrkError = {}\n }\n\n dataObject.id = this.#account.id\n\n if (isValueValid(this.#device.gcookie)) {\n dataObject.g = this.#device.gcookie\n }\n\n const obj = this.#session.getSessionCookieObject()\n dataObject.s = obj.s // session cookie\n dataObject.pg = (typeof obj.p === 'undefined') ? 1 : obj.p // Page count\n let proto = document.location.protocol\n proto = proto.replace(':', '')\n dataObject.af = { lib: 'web-sdk-v$$PACKAGE_VERSION$$', protocol: proto, ...$ct.flutterVersion } // app fields\n if (sessionStorage.hasOwnProperty('WZRK_D')) { dataObject.debug = true }\n\n return dataObject\n }\n\n addFlags (data) {\n // check if cookie should be cleared.\n this.#clearCookie = StorageManager.getAndClearMetaProp(CLEAR)\n if (this.#clearCookie !== undefined && this.#clearCookie) {\n data.rc = true\n this.#logger.debug('reset cookie sent in request and cleared from meta for future requests.')\n }\n if (this.#isPersonalisationActive()) {\n const lastSyncTime = StorageManager.getMetaProp('lsTime')\n const expirySeconds = StorageManager.getMetaProp('exTs')\n\n // dsync not found in local storage - get data from server\n if (typeof lastSyncTime === 'undefined' || typeof expirySeconds === 'undefined') {\n data.dsync = true\n return\n }\n const now = getNow()\n // last sync time has expired - get fresh data from server\n if (lastSyncTime + expirySeconds < now) {\n data.dsync = true\n }\n }\n }\n\n // saves url to backup cache and fires the request\n /**\n *\n * @param {string} url\n * @param {boolean} override whether the request can go through or not\n * @param {Boolean} sendOULFlag - true in case of a On User Login request\n */\n saveAndFireRequest (url, override, sendOULFlag, evtName) {\n const now = getNow()\n url = addToURL(url, 'rn', ++$ct.globalCache.REQ_N)\n const data = url + '&i=' + now + '&sn=' + seqNo\n StorageManager.backupEvent(data, $ct.globalCache.REQ_N, this.#logger)\n\n // if offline is set to true, save the request in backup and return\n if ($ct.offline) return\n // if there is no override\n // and an OUL request is not in progress\n // then process the request as it is\n // else block the request\n // note - $ct.blockRequest should ideally be used for override\n if ((!override || (this.#clearCookie !== undefined && this.#clearCookie)) && !window.isOULInProgress) {\n if (now === requestTime) {\n seqNo++\n } else {\n requestTime = now\n seqNo = 0\n }\n window.oulReqN = $ct.globalCache.REQ_N\n RequestDispatcher.fireRequest(data, false, sendOULFlag, evtName)\n } else {\n this.#logger.debug(`Not fired due to override - ${$ct.blockRequest} or clearCookie - ${this.#clearCookie} or OUL request in progress - ${window.isOULInProgress}`)\n }\n }\n\n unregisterTokenForGuid (givenGUID) {\n const payload = StorageManager.readFromLSorCookie(PUSH_SUBSCRIPTION_DATA)\n // Send unregister event only when token is available\n if (payload) {\n const data = {}\n data.type = 'data'\n if (isValueValid(givenGUID)) {\n data.g = givenGUID\n }\n data.action = 'unregister'\n data.id = this.#account.id\n\n const obj = this.#session.getSessionCookieObject()\n\n data.s = obj.s // session cookie\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', 'data')\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n RequestDispatcher.fireRequest(pageLoadUrl, true)\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, false)\n }\n // REGISTER TOKEN\n this.registerToken(payload)\n }\n\n registerToken (payload) {\n if (!payload) return\n // add gcookie etc to the payload\n payload = this.addSystemDataToObject(payload, true)\n payload = JSON.stringify(payload)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', 'data')\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(payload, this.#logger))\n RequestDispatcher.fireRequest(pageLoadUrl)\n // set in localstorage\n StorageManager.save(WEBPUSH_LS_KEY, 'ok')\n }\n\n processEvent (data) {\n this.#addToLocalEventMap(data.evtName)\n data = this.addSystemDataToObject(data, undefined)\n this.addFlags(data)\n data[CAMP_COOKIE_NAME] = getCampaignObjForLc()\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.saveAndFireRequest(pageLoadUrl, $ct.blockRequest, false, data.evtName)\n }\n\n #addToLocalEventMap (evtName) {\n if (StorageManager._isLocalStorageSupported()) {\n if (typeof $ct.globalEventsMap === 'undefined') {\n $ct.globalEventsMap = StorageManager.readFromLSorCookie(EV_COOKIE)\n if (typeof $ct.globalEventsMap === 'undefined') {\n $ct.globalEventsMap = {}\n }\n }\n\n const nowTs = getNow()\n let evtDetail = $ct.globalEventsMap[evtName]\n if (typeof evtDetail !== 'undefined') {\n evtDetail[2] = nowTs\n evtDetail[0]++\n } else {\n evtDetail = []\n evtDetail.push(1)\n evtDetail.push(nowTs)\n evtDetail.push(nowTs)\n }\n $ct.globalEventsMap[evtName] = evtDetail\n StorageManager.saveToLSorCookie(EV_COOKIE, $ct.globalEventsMap)\n }\n }\n\n post (url, body) {\n return fetch(url, {\n method: 'post',\n headers: { 'Content-Type': 'application/json' },\n body: body\n })\n .then((response) => {\n if (response.ok) {\n return response.json()\n }\n throw response\n })\n .then((data) => {\n this.#logger.debug('Sync data successful', data)\n return data\n })\n .catch((e) => {\n this.#logger.debug('Error in syncing variables', e)\n throw e\n })\n }\n}\n","import {\n isObjectEmpty\n} from '../util/datatypes'\nimport {\n EVT_PUSH,\n USEIP_KEY,\n OPTOUT_KEY,\n CT_OPTOUT_KEY\n} from '../util/constants'\nimport {\n StorageManager,\n $ct\n} from '../util/storage'\nimport {\n compressData\n} from '../util/encoder'\nimport {\n addToURL\n} from '../util/url'\n\nexport default class Privacy extends Array {\n #request\n #account\n #oldValues\n #logger\n\n constructor ({\n request,\n account,\n logger\n },\n values) {\n super()\n this.#logger = logger\n this.#request = request\n this.#account = account\n this.#oldValues = values\n }\n\n push (...privacyArr) {\n if ($ct.isPrivacyArrPushed) {\n this.#processPrivacyArray($ct.privacyArray.length > 0 ? $ct.privacyArray : privacyArr)\n } else {\n $ct.privacyArray.push(...privacyArr)\n }\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#processPrivacyArray(this.#oldValues)\n }\n this.#oldValues = null\n }\n\n #processPrivacyArray (privacyArr) {\n if (Array.isArray(privacyArr) && privacyArr.length > 0) {\n const privacyObj = privacyArr.reduce((prev, curr) => ({ ...prev, ...curr }), {})\n let data = {}\n const profileObj = {}\n var optOut = false\n\n if (privacyObj.hasOwnProperty(OPTOUT_KEY)) {\n optOut = privacyObj[OPTOUT_KEY]\n if (typeof optOut === 'boolean') {\n profileObj[CT_OPTOUT_KEY] = optOut\n // should be true when user wants to opt in\n $ct.isOptInRequest = !optOut\n }\n }\n if (privacyObj.hasOwnProperty(USEIP_KEY)) {\n const useIP = privacyObj[USEIP_KEY]\n const shouldUseIP = (typeof useIP === 'boolean') ? useIP : false\n StorageManager.setMetaProp(USEIP_KEY, shouldUseIP)\n }\n if (!isObjectEmpty(profileObj)) {\n data.type = 'profile'\n data.profile = profileObj\n data = this.#request.addSystemDataToObject(data, undefined)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n pageLoadUrl = addToURL(pageLoadUrl, OPTOUT_KEY, optOut ? 'true' : 'false')\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n privacyArr.splice(0, privacyArr.length)\n }\n }\n }\n}\n","import { StorageManager, $ct } from '../util/storage'\nimport { isObject } from '../util/datatypes'\nimport {\n PUSH_SUBSCRIPTION_DATA\n} from '../util/constants'\nimport {\n urlBase64ToUint8Array\n} from '../util/encoder'\n\nexport default class NotificationHandler extends Array {\n #oldValues\n #logger\n #request\n #account\n #wizAlertJSPath\n #fcmPublicKey\n\n constructor ({\n logger,\n session,\n request,\n account\n }, values) {\n super()\n this.#wizAlertJSPath = 'https://d2r1yp2w7bby2u.cloudfront.net/js/wzrk_dialog.min.js'\n this.#fcmPublicKey = null\n this.#oldValues = values\n this.#logger = logger\n this.#request = request\n this.#account = account\n }\n\n push (...displayArgs) {\n this.#setUpWebPush(displayArgs)\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#setUpWebPush(this.#oldValues)\n }\n this.#oldValues = null\n }\n\n #setUpWebPush (displayArgs) {\n if ($ct.webPushEnabled && displayArgs.length > 0) {\n this.#handleNotificationRegistration(displayArgs)\n } else if ($ct.webPushEnabled == null && displayArgs.length > 0) {\n $ct.notifApi.notifEnabledFromApi = true\n $ct.notifApi.displayArgs = displayArgs.slice()\n } else if ($ct.webPushEnabled === false && displayArgs.length > 0) {\n this.#logger.error('Make sure push notifications are fully enabled and integrated')\n }\n }\n\n #setUpWebPushNotifications (subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsServiceUrl) {\n if (navigator.userAgent.indexOf('Chrome') !== -1 || navigator.userAgent.indexOf('Firefox') !== -1) {\n this.#setUpChromeFirefoxNotifications(subscriptionCallback, serviceWorkerPath)\n } else if (navigator.userAgent.indexOf('Safari') !== -1) {\n this.#setUpSafariNotifications(subscriptionCallback, apnsWebPushId, apnsServiceUrl)\n }\n }\n\n #setApplicationServerKey (applicationServerKey) {\n this.#fcmPublicKey = applicationServerKey\n }\n\n #setUpSafariNotifications (subscriptionCallback, apnsWebPushId, apnsServiceUrl) {\n // ensure that proper arguments are passed\n if (typeof apnsWebPushId === 'undefined') {\n this.#logger.error('Ensure that APNS Web Push ID is supplied')\n }\n if (typeof apnsServiceUrl === 'undefined') {\n this.#logger.error('Ensure that APNS Web Push service path is supplied')\n }\n if ('safari' in window && 'pushNotification' in window.safari) {\n window.safari.pushNotification.requestPermission(\n apnsServiceUrl,\n apnsWebPushId, {}, (subscription) => {\n if (subscription.permission === 'granted') {\n const subscriptionData = JSON.parse(JSON.stringify(subscription))\n subscriptionData.endpoint = subscription.deviceToken\n subscriptionData.browser = 'Safari'\n StorageManager.saveToLSorCookie(PUSH_SUBSCRIPTION_DATA, subscriptionData)\n\n this.#request.registerToken(subscriptionData)\n this.#logger.info('Safari Web Push registered. Device Token: ' + subscription.deviceToken)\n } else if (subscription.permission === 'denied') {\n this.#logger.info('Error subscribing to Safari web push')\n }\n })\n }\n }\n\n /**\n * Sets up a service worker for WebPush(chrome/Firefox) push notifications and sends the data to LC\n */\n #setUpChromeFirefoxNotifications (subscriptionCallback, serviceWorkerPath) {\n let registrationScope = ''\n\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.register(serviceWorkerPath).then((registration) => {\n if (typeof __wzrk_account_id !== 'undefined') { // eslint-disable-line\n // shopify accounts , since the service worker is not at root, serviceWorker.ready is never resolved.\n // hence add a timeout and hope serviceWroker is ready within that time.\n return new Promise(resolve => setTimeout(() => resolve(registration), 5000))\n }\n registrationScope = registration.scope\n\n // IF SERVICE WORKER IS AT ROOT, RETURN THE READY PROMISE\n // ELSE IF CHROME RETURN PROMISE AFTER 5 SECONDS\n // OR getRegistrations PROMISE IF ITS FIREFOX\n const rootDirRegex = /^(\\.?)(\\/?)([^/]*).js$/\n const isServiceWorkerAtRoot = rootDirRegex.test(serviceWorkerPath)\n if (isServiceWorkerAtRoot) {\n return navigator.serviceWorker.ready\n } else {\n if (navigator.userAgent.indexOf('Chrome') !== -1) {\n return new Promise(resolve => setTimeout(() => resolve(registration), 5000))\n } else {\n return navigator.serviceWorker.getRegistrations()\n }\n }\n }).then((serviceWorkerRegistration) => {\n // ITS AN ARRAY IN CASE OF FIREFOX, SO USE THE REGISTRATION WITH PROPER SCOPE\n if (navigator.userAgent.indexOf('Firefox') !== -1 && Array.isArray(serviceWorkerRegistration)) {\n serviceWorkerRegistration = serviceWorkerRegistration.filter((i) => i.scope === registrationScope)[0]\n }\n const subscribeObj = { userVisibleOnly: true }\n\n if (this.#fcmPublicKey != null) {\n subscribeObj.applicationServerKey = urlBase64ToUint8Array(this.#fcmPublicKey)\n }\n\n serviceWorkerRegistration.pushManager.subscribe(subscribeObj)\n .then((subscription) => {\n this.#logger.info('Service Worker registered. Endpoint: ' + subscription.endpoint)\n\n // convert the subscription keys to strings; this sets it up nicely for pushing to LC\n const subscriptionData = JSON.parse(JSON.stringify(subscription))\n\n // remove the common chrome/firefox endpoint at the beginning of the token\n if (navigator.userAgent.indexOf('Chrome') !== -1) {\n subscriptionData.endpoint = subscriptionData.endpoint.split('/').pop()\n subscriptionData.browser = 'Chrome'\n } else if (navigator.userAgent.indexOf('Firefox') !== -1) {\n subscriptionData.endpoint = subscriptionData.endpoint.split('/').pop()\n subscriptionData.browser = 'Firefox'\n }\n StorageManager.saveToLSorCookie(PUSH_SUBSCRIPTION_DATA, subscriptionData)\n this.#request.registerToken(subscriptionData)\n\n if (typeof subscriptionCallback !== 'undefined' && typeof subscriptionCallback === 'function') {\n subscriptionCallback()\n }\n }).catch((error) => {\n this.#logger.error('Error subscribing: ' + error)\n // unsubscribe from webpush if error\n serviceWorkerRegistration.pushManager.getSubscription().then((subscription) => {\n if (subscription !== null) {\n subscription.unsubscribe().then((successful) => {\n // You've successfully unsubscribed\n this.#logger.info('Unsubscription successful')\n }).catch((e) => {\n // Unsubscription failed\n this.#logger.error('Error unsubscribing: ' + e)\n })\n }\n })\n })\n }).catch((err) => {\n this.#logger.error('error registering service worker: ' + err)\n })\n }\n }\n\n #addWizAlertJS () {\n const scriptTag = document.createElement('script')\n scriptTag.setAttribute('type', 'text/javascript')\n scriptTag.setAttribute('id', 'wzrk-alert-js')\n scriptTag.setAttribute('src', this.#wizAlertJSPath)\n\n // add the script tag to the end of the body\n document.getElementsByTagName('body')[0].appendChild(scriptTag)\n\n return scriptTag\n }\n\n #removeWizAlertJS () {\n const scriptTag = document.getElementById('wzrk-alert-js')\n scriptTag.parentNode.removeChild(scriptTag)\n }\n\n #handleNotificationRegistration (displayArgs) {\n // make sure everything is specified\n let titleText\n let bodyText\n let okButtonText\n let rejectButtonText\n let okButtonColor\n let skipDialog\n let askAgainTimeInSeconds\n let okCallback\n let rejectCallback\n let subscriptionCallback\n let serviceWorkerPath\n let httpsPopupPath\n let httpsIframePath\n let apnsWebPushId\n let apnsWebPushServiceUrl\n\n if (displayArgs.length === 1) {\n if (isObject(displayArgs[0])) {\n const notifObj = displayArgs[0]\n titleText = notifObj.titleText\n bodyText = notifObj.bodyText\n okButtonText = notifObj.okButtonText\n rejectButtonText = notifObj.rejectButtonText\n okButtonColor = notifObj.okButtonColor\n skipDialog = notifObj.skipDialog\n askAgainTimeInSeconds = notifObj.askAgainTimeInSeconds\n okCallback = notifObj.okCallback\n rejectCallback = notifObj.rejectCallback\n subscriptionCallback = notifObj.subscriptionCallback\n serviceWorkerPath = notifObj.serviceWorkerPath\n httpsPopupPath = notifObj.httpsPopupPath\n httpsIframePath = notifObj.httpsIframePath\n apnsWebPushId = notifObj.apnsWebPushId\n apnsWebPushServiceUrl = notifObj.apnsWebPushServiceUrl\n }\n } else {\n titleText = displayArgs[0]\n bodyText = displayArgs[1]\n okButtonText = displayArgs[2]\n rejectButtonText = displayArgs[3]\n okButtonColor = displayArgs[4]\n skipDialog = displayArgs[5]\n askAgainTimeInSeconds = displayArgs[6]\n }\n\n if (skipDialog == null) {\n skipDialog = false\n }\n\n if (serviceWorkerPath == null) {\n serviceWorkerPath = '/clevertap_sw.js'\n }\n\n // ensure that the browser supports notifications\n if (typeof navigator.serviceWorker === 'undefined') {\n return\n }\n\n const isHTTP = httpsPopupPath != null && httpsIframePath != null\n\n // make sure the site is on https for chrome notifications\n if (window.location.protocol !== 'https:' && document.location.hostname !== 'localhost' && !isHTTP) {\n this.#logger.error('Make sure you are https or localhost to register for notifications')\n return\n }\n\n // right now, we only support Chrome V50 & higher & Firefox\n if (navigator.userAgent.indexOf('Chrome') !== -1) {\n const chromeAgent = navigator.userAgent.match(/Chrome\\/(\\d+)/)\n if (chromeAgent == null || parseInt(chromeAgent[1], 10) < 50) { return }\n } else if (navigator.userAgent.indexOf('Firefox') !== -1) {\n const firefoxAgent = navigator.userAgent.match(/Firefox\\/(\\d+)/)\n if (firefoxAgent == null || parseInt(firefoxAgent[1], 10) < 50) { return }\n } else if (navigator.userAgent.indexOf('Safari') !== -1) {\n const safariAgent = navigator.userAgent.match(/Safari\\/(\\d+)/)\n if (safariAgent == null || parseInt(safariAgent[1], 10) < 50) { return }\n } else {\n return\n }\n\n // we check for the cookie in setUpChromeNotifications() the tokens may have changed\n\n if (!isHTTP) {\n if (Notification == null) {\n return\n }\n // handle migrations from other services -> chrome notifications may have already been asked for before\n if (Notification.permission === 'granted') {\n // skip the dialog and register\n this.#setUpWebPushNotifications(subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsWebPushServiceUrl)\n return\n } else if (Notification.permission === 'denied') {\n // we've lost this profile :'(\n return\n }\n\n if (skipDialog) {\n this.#setUpWebPushNotifications(subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsWebPushServiceUrl)\n return\n }\n }\n\n // make sure the right parameters are passed\n if (!titleText || !bodyText || !okButtonText || !rejectButtonText) {\n this.#logger.error('Missing input parameters; please specify title, body, ok button and cancel button text')\n return\n }\n\n // make sure okButtonColor is formatted properly\n if (okButtonColor == null || !okButtonColor.match(/^#[a-f\\d]{6}$/i)) {\n okButtonColor = '#f28046' // default color for positive button\n }\n\n // make sure the user isn't asked for notifications more than askAgainTimeInSeconds\n const now = new Date().getTime() / 1000\n if ((StorageManager.getMetaProp('notif_last_time')) == null) {\n StorageManager.setMetaProp('notif_last_time', now)\n } else {\n if (askAgainTimeInSeconds == null) {\n // 7 days by default\n askAgainTimeInSeconds = 7 * 24 * 60 * 60\n }\n\n if (now - StorageManager.getMetaProp('notif_last_time') < askAgainTimeInSeconds) {\n return\n } else {\n // continue asking\n StorageManager.setMetaProp('notif_last_time', now)\n }\n }\n\n if (isHTTP) {\n // add the https iframe\n const httpsIframe = document.createElement('iframe')\n httpsIframe.setAttribute('style', 'display:none;')\n httpsIframe.setAttribute('src', httpsIframePath)\n document.body.appendChild(httpsIframe)\n window.addEventListener('message', (event) => {\n if (event.data != null) {\n let obj = {}\n try {\n obj = JSON.parse(event.data)\n } catch (e) {\n // not a call from our iframe\n return\n }\n if (obj.state != null) {\n if (obj.from === 'ct' && obj.state === 'not') {\n this.#addWizAlertJS().onload = () => {\n // create our wizrocket popup\n window.wzrkPermissionPopup.wizAlert({\n title: titleText,\n body: bodyText,\n confirmButtonText: okButtonText,\n confirmButtonColor: okButtonColor,\n rejectButtonText: rejectButtonText\n }, (enabled) => { // callback function\n if (enabled) {\n // the user accepted on the dialog box\n if (typeof okCallback === 'function') {\n okCallback()\n }\n // redirect to popup.html\n window.open(httpsPopupPath)\n } else {\n if (typeof rejectCallback === 'function') {\n rejectCallback()\n }\n }\n this.#removeWizAlertJS()\n })\n }\n }\n }\n }\n }, false)\n } else {\n this.#addWizAlertJS().onload = () => {\n // create our wizrocket popup\n window.wzrkPermissionPopup.wizAlert({\n title: titleText,\n body: bodyText,\n confirmButtonText: okButtonText,\n confirmButtonColor: okButtonColor,\n rejectButtonText: rejectButtonText\n }, (enabled) => { // callback function\n if (enabled) {\n // the user accepted on the dialog box\n if (typeof okCallback === 'function') {\n okCallback()\n }\n this.#setUpWebPushNotifications(subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsWebPushServiceUrl)\n } else {\n if (typeof rejectCallback === 'function') {\n rejectCallback()\n }\n }\n this.#removeWizAlertJS()\n })\n }\n }\n }\n\n _enableWebPush (enabled, applicationServerKey) {\n $ct.webPushEnabled = enabled\n if (applicationServerKey != null) {\n this.#setApplicationServerKey(applicationServerKey)\n }\n if ($ct.webPushEnabled && $ct.notifApi.notifEnabledFromApi) {\n this.#handleNotificationRegistration($ct.notifApi.displayArgs)\n } else if (!$ct.webPushEnabled && $ct.notifApi.notifEnabledFromApi) {\n this.#logger.error('Ensure that web push notifications are fully enabled and integrated before requesting them')\n }\n }\n}\n","export class Variable {\n #variableStore\n\n /**\n * Creates an instance of the Variable class.\n *\n * @constructor\n * @param {VariableStore} options.variableStore - The VariableStore instance for registration.\n * @param {string|null} options.name - The name of the variable.\n * @param {*} options.defaultValue - The default value of the variable.\n * @param {*} options.value - The current value of the variable.\n * @param {string|null} options.type - The type of the variable (string, number, boolean).\n * @param {boolean} options.hadStarted - A flag indicating whether the variable has started (used internally).\n * @param {Function[]} options.valueChangedCallbacks - Array to store callbacks to be executed when the variable value changes.\n */\n constructor ({ variableStore }) {\n this.name = null\n this.defaultValue = null\n this.value = null\n this.type = null\n this.hadStarted = false\n this.valueChangedCallbacks = []\n this.#variableStore = variableStore\n }\n\n getValue () {\n return this.value\n }\n\n getdefaultValue () {\n return this.defaultValue\n }\n\n /**\n * Defines a new variable with the provided name, default value, and variable store.\n * @static\n * @param {string} name - The name of the variable.\n * @param {*} defaultValue - The default value of the variable.\n * @param {VariableStore} variableStore - The VariableStore instance for registration.\n * @returns {Variable|null} - The created Variable instance or null if invalid parameters are provided.\n */\n static define (name, defaultValue, variableStore) {\n if (!name || typeof name !== 'string') {\n console.error('Empty or invalid name parameter provided.')\n return null\n }\n if (name.startsWith('.') || name.endsWith('.')) {\n console.error('Variable name starts or ends with a `.` which is not allowed: ' + name)\n return null\n }\n\n const typeOfDefaultValue = typeof defaultValue\n if (typeOfDefaultValue !== 'string' && typeOfDefaultValue !== 'number' && typeOfDefaultValue !== 'boolean') {\n console.error('Only primitive types (string, number, boolean) are accepted as value')\n return null\n }\n\n const existing = variableStore.getVariable(name)\n if (existing) {\n return existing\n }\n\n const varInstance = new Variable({ variableStore })\n try {\n varInstance.name = name\n varInstance.defaultValue = defaultValue\n varInstance.value = defaultValue\n varInstance.type = typeOfDefaultValue\n variableStore.registerVariable(varInstance)\n varInstance.update(defaultValue)\n } catch (error) {\n console.error(error)\n }\n return varInstance\n }\n\n /**\n * Updates the variable's value, triggering callbacks if hasVarsRequestCompleted is returned true.\n * @param {*} newValue - The new value to be assigned to the variable.\n */\n update (newValue) {\n const oldValue = this.value\n this.value = newValue\n if (newValue === null && oldValue === null) {\n return\n }\n if (newValue !== null && newValue === oldValue && this.hadStarted) {\n return\n }\n if (this.#variableStore.hasVarsRequestCompleted()) {\n this.hadStarted = true\n this.triggerValueChanged()\n }\n }\n\n /**\n * Invokes all registered callbacks when the variable value changes.\n */\n triggerValueChanged () {\n this.valueChangedCallbacks.forEach((onValueChanged) => {\n onValueChanged(this)\n })\n }\n\n /**\n * Adds a callback function to the array and triggers it immediately if variable requests have completed.\n * @param {Function} onValueChanged - The callback function to be added.\n */\n addValueChangedCallback (onValueChanged) {\n if (!onValueChanged) {\n console.log('Invalid callback parameter provided.')\n return\n }\n this.valueChangedCallbacks.push(onValueChanged)\n\n if (this.#variableStore.hasVarsRequestCompleted()) {\n onValueChanged(this)\n }\n }\n\n /**\n * Removes a callback function from the array.\n * @param {Function} onValueChanged - The callback function to be removed.\n */\n removeValueChangedCallback (onValueChanged) {\n const index = this.valueChangedCallbacks.indexOf(onValueChanged)\n if (index !== -1) {\n this.valueChangedCallbacks.splice(index, 1)\n }\n }\n\n /**\n * Resets the `hadStarted` flag to false.\n */\n clearStartFlag () {\n this.hadStarted = false\n }\n}\n","import { VARIABLES, WZRK_FETCH } from '../../util/constants'\nimport { StorageManager, $ct } from '../../util/storage'\nclass VariableStore {\n #logger\n #account\n #request\n #event\n\n #variables\n #remoteVariables\n #fetchCallback\n #variablesChangedCallbacks\n #oneTimeVariablesChangedCallbacks\n #hasVarsRequestCompleted = false\n\n constructor ({ logger, request, account, event }) {\n this.#logger = logger\n this.#account = account\n this.#request = request\n this.#event = event\n\n this.#variables = {}\n this.#remoteVariables = {}\n this.#variablesChangedCallbacks = []\n this.#oneTimeVariablesChangedCallbacks = []\n\n $ct.variableStore = this\n }\n\n /**\n * Registers a variable instance in the store.\n * @param {Object} varInstance - The variable instance to be registered.\n */\n registerVariable (varInstance) {\n const { name } = varInstance\n this.#variables[name] = varInstance\n console.log('registerVariable', this.#variables)\n }\n\n /**\n * Retrieves a variable by its name.\n * @param {string} name - The name of the variable to retrieve.\n * @returns {Object} - The variable instance.\n */\n getVariable (name) {\n return this.#variables[name]\n }\n\n hasVarsRequestCompleted () {\n return this.#hasVarsRequestCompleted\n }\n\n /**\n * Synchronizes variables with the server.\n * @param {Function} onSyncSuccess - Callback function on successful synchronization.\n * @param {Function} onSyncFailure - Callback function on synchronization failure.\n * @throws Will throw an error if the account token is missing.\n * @returns {Promise} - The result of the synchronization request.\n */\n syncVariables (onSyncSuccess, onSyncFailure) {\n if (!this.#account.token) {\n const m = 'Account token is missing.'\n this.#logger.error(m)\n return Promise.reject(new Error(m))\n }\n\n const payload = {\n type: 'varsPayload',\n vars: {}\n }\n\n for (const name in this.#variables) {\n payload.vars[name] = {\n defaultValue: this.#variables[name].defaultValue,\n type: this.#variables[name].type\n }\n }\n\n // Check if payload.vars is empty\n if (Object.keys(payload.vars).length === 0) {\n const m = 'No variables are defined.'\n this.#logger.error(m)\n return Promise.reject(new Error(m))\n }\n\n let meta = {}\n meta = this.#request.addSystemDataToObject(meta, undefined)\n meta.tk = this.#account.token\n\n meta.type = 'meta'\n const body = JSON.stringify([meta, payload])\n const url = this.#account.dataPostPEURL\n\n return this.#request.post(url, body)\n .then((r) => {\n if (onSyncSuccess && typeof onSyncSuccess === 'function') {\n onSyncSuccess(r)\n }\n return r\n })\n .catch((e) => {\n if (onSyncFailure && typeof onSyncFailure === 'function') {\n onSyncFailure(e)\n }\n if (e.status === 400) {\n this.#logger.error('Invalid sync payload or clear the existing draft')\n } else if (e.status === 401) {\n this.#logger.error('This is not a test profile')\n } else {\n this.#logger.error('Sync variable failed')\n }\n throw e\n })\n }\n\n /**\n * Fetches variables from the server.\n * @param {Function} onFetchCallback - Callback function on fetch completion.\n */\n fetchVariables (onFetchCallback) {\n this.#event.push(WZRK_FETCH, { t: 4 })\n if (onFetchCallback && typeof onFetchCallback === 'function') {\n this.#fetchCallback = onFetchCallback\n }\n }\n\n mergeVariables (vars) {\n console.log('msg vars is ', vars)\n this.#hasVarsRequestCompleted = true\n\n StorageManager.saveToLSorCookie(VARIABLES, vars)\n this.#remoteVariables = vars\n\n for (const name in this.#variables) {\n if (vars.hasOwnProperty(name)) {\n this.#variables[name].update(vars[name])\n }\n }\n\n if (this.#fetchCallback) {\n this.#fetchCallback()\n }\n\n this.#runVariablesChangedCallback()\n }\n\n addVariablesChangedCallback (callback) {\n if (callback && typeof callback === 'function') {\n this.#variablesChangedCallbacks.push(callback)\n\n if (this.hasVarsRequestCompleted()) {\n callback()\n }\n } else {\n this.#logger.error('callback is not a function')\n }\n }\n\n addOneTimeVariablesChangedCallback (callback) {\n if (callback && typeof callback === 'function') {\n if (this.hasVarsRequestCompleted()) {\n callback()\n } else {\n this.#oneTimeVariablesChangedCallbacks.push(callback)\n }\n }\n }\n\n removeVariablesChangedCallback (callback) {\n const index = this.#variablesChangedCallbacks.indexOf(callback)\n if (index !== -1) {\n this.#variablesChangedCallbacks.splice(index, 1)\n }\n }\n\n removeOneTimeVariablesChangedCallback (callback) {\n const index = this.#oneTimeVariablesChangedCallbacks.indexOf(callback)\n if (index !== -1) {\n this.#oneTimeVariablesChangedCallbacks.splice(index, 1)\n }\n }\n\n #runVariablesChangedCallback () {\n for (var callback of this.#variablesChangedCallbacks) {\n callback()\n }\n for (var callBack of this.#oneTimeVariablesChangedCallbacks) {\n callBack()\n }\n this.#oneTimeVariablesChangedCallbacks.length = 0\n }\n}\n\nexport default VariableStore\n","import Account from './modules/account'\nimport CleverTapAPI from './modules/api'\nimport DeviceManager from './modules/device'\nimport EventHandler from './modules/event'\nimport ProfileHandler from './modules/profile'\nimport UserLoginHandler from './modules/userLogin'\nimport _tr from './util/tr'\nimport User from './modules/user'\nimport { Logger, logLevels } from './modules/logger'\nimport SessionManager from './modules/session'\nimport ReqestManager from './modules/request'\nimport {\n CAMP_COOKIE_NAME,\n SCOOKIE_PREFIX,\n NOTIFICATION_VIEWED,\n NOTIFICATION_CLICKED,\n EVT_PING,\n FIRST_PING_FREQ_IN_MILLIS,\n CONTINUOUS_PING_FREQ_IN_MILLIS,\n GROUP_SUBSCRIPTION_REQUEST_ID,\n WZRK_ID,\n WZRK_PREFIX,\n categoryLongKey,\n COMMAND_INCREMENT,\n COMMAND_DECREMENT,\n COMMAND_SET,\n COMMAND_ADD,\n COMMAND_REMOVE,\n COMMAND_DELETE,\n EVT_PUSH,\n WZRK_FETCH\n} from './util/constants'\nimport { EMBED_ERROR } from './util/messages'\nimport { StorageManager, $ct } from './util/storage'\nimport { addToURL, getDomain, getURLParams } from './util/url'\nimport { getCampaignObjForLc, setEnum, handleEmailSubscription, closeIframe } from './util/clevertap'\nimport { compressData } from './util/encoder'\nimport Privacy from './modules/privacy'\nimport NotificationHandler from './modules/notification'\nimport { hasWebInboxSettingsInLS, checkAndRegisterWebInboxElements, initializeWebInbox, getInboxMessages, saveInboxMessages } from './modules/web-inbox/helper'\nimport { Variable } from './modules/variables/variable'\nimport VariableStore from './modules/variables/variableStore'\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.#session = new SessionManager({\n logger: this.#logger,\n isPersonalisationActive: this._isPersonalisationActive\n })\n this.#request = new ReqestManager({\n logger: this.#logger,\n account: this.#account,\n device: this.#device,\n session: this.#session,\n isPersonalisationActive: this._isPersonalisationActive\n })\n this.enablePersonalization = clevertap.enablePersonalization || false\n this.event = new EventHandler({\n logger: this.#logger,\n request: this.#request,\n isPersonalisationActive: this._isPersonalisationActive\n }, clevertap.event)\n\n this.profile = new ProfileHandler({\n logger: this.#logger,\n request: this.#request,\n account: this.#account,\n isPersonalisationActive: this._isPersonalisationActive\n }, clevertap.profile)\n\n this.onUserLogin = new UserLoginHandler({\n request: this.#request,\n account: this.#account,\n session: this.#session,\n logger: this.#logger,\n device: this.#device\n }, clevertap.onUserLogin)\n\n this.privacy = new Privacy({\n request: this.#request,\n account: this.#account,\n logger: this.#logger\n }, clevertap.privacy)\n\n this.notifications = new NotificationHandler({\n logger: this.#logger,\n request: this.#request,\n account: this.#account\n }, clevertap.notifications)\n\n this.#variableStore = new VariableStore({\n logger: this.#logger,\n request: this.#request,\n account: this.#account,\n event: this.event\n })\n\n this.#api = new CleverTapAPI({\n logger: this.#logger,\n request: this.#request,\n device: this.#device,\n session: this.#session\n })\n\n this.spa = clevertap.spa\n this.dismissSpamControl = clevertap.dismissSpamControl\n\n this.user = new User({\n isPersonalisationActive: this._isPersonalisationActive\n })\n\n this.session = {\n getTimeElapsed: () => {\n return this.#session.getTimeElapsed()\n },\n getPageCount: () => {\n return this.#session.getPageCount()\n }\n }\n\n this.logout = () => {\n this.#logger.debug('logout called')\n StorageManager.setInstantDeleteFlagInK()\n }\n\n this.clear = () => {\n this.onUserLogin.clear()\n }\n\n this.getCleverTapID = () => {\n return this.#device.getGuid()\n }\n\n this.getAccountID = () => {\n return this.#account.id\n }\n\n this.getSCDomain = () => {\n return this.#account.finalTargetDomain\n }\n\n this.setLibrary = (libName, libVersion) => {\n $ct.flutterVersion = { [libName]: libVersion }\n }\n\n // Set the Signed Call sdk version and fire request\n this.setSCSDKVersion = (ver) => {\n this.#account.scSDKVersion = ver\n const data = {}\n data.af = { scv: 'sc-sdk-v' + this.#account.scSDKVersion }\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', 'page')\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(JSON.stringify(data), this.#logger))\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n\n if (hasWebInboxSettingsInLS()) {\n checkAndRegisterWebInboxElements()\n initializeWebInbox(this.#logger)\n }\n\n // Get Inbox Message Count\n this.getInboxMessageCount = () => {\n const msgCount = getInboxMessages()\n return Object.keys(msgCount).length\n }\n\n // Get Inbox Unread Message Count\n this.getInboxMessageUnreadCount = () => {\n if ($ct.inbox) {\n return $ct.inbox.unviewedCounter\n } else {\n this.#logger.debug('No unread messages')\n }\n }\n\n // Get All Inbox messages\n this.getAllInboxMessages = () => {\n return getInboxMessages()\n }\n\n // Get only Unread messages\n this.getUnreadInboxMessages = () => {\n if ($ct.inbox) {\n return $ct.inbox.unviewedMessages\n } else {\n this.#logger.debug('No unread messages')\n }\n }\n\n // Get message object belonging to the given message id only. Message id should be a String\n this.getInboxMessageForId = (messageId) => {\n const messages = getInboxMessages()\n if ((messageId !== null || messageId !== '') && messages.hasOwnProperty(messageId)) {\n return messages[messageId]\n } else {\n this.#logger.error('No message available for message Id ' + messageId)\n }\n }\n\n // Delete message from the Inbox. Message id should be a String\n // If the message to be deleted is unviewed then decrement the badge count, delete the message from unviewedMessages list\n // Then remove the message from local storage and update cookie\n this.deleteInboxMessage = (messageId) => {\n const messages = getInboxMessages()\n if ((messageId !== null || messageId !== '') && messages.hasOwnProperty(messageId)) {\n const el = document.querySelector('ct-web-inbox').shadowRoot.getElementById(messageId)\n if (messages[messageId].viewed === 0) {\n $ct.inbox.unviewedCounter--\n delete $ct.inbox.unviewedMessages[messageId]\n document.getElementById('unviewedBadge').innerText = $ct.inbox.unviewedCounter\n document.getElementById('unviewedBadge').style.display = $ct.inbox.unviewedCounter > 0 ? 'flex' : 'none'\n }\n el && el.remove()\n delete messages[messageId]\n saveInboxMessages(messages)\n } else {\n this.#logger.error('No message available for message Id ' + messageId)\n }\n }\n\n /* Mark Message as Read. Message id should be a String\n - Check if the message Id exist in the unread message list\n - Remove the unread marker, update the viewed flag, decrement the bage Count\n - renderNotificationViewed */\n this.markReadInboxMessage = (messageId) => {\n const unreadMsg = $ct.inbox.unviewedMessages\n const messages = getInboxMessages()\n if ((messageId !== null || messageId !== '') && unreadMsg.hasOwnProperty(messageId)) {\n const el = document.querySelector('ct-web-inbox').shadowRoot.getElementById(messageId)\n if (el !== null) { el.shadowRoot.getElementById('unreadMarker').style.display = 'none' }\n messages[messageId].viewed = 1\n if (document.getElementById('unviewedBadge')) {\n var counter = parseInt(document.getElementById('unviewedBadge').innerText) - 1\n document.getElementById('unviewedBadge').innerText = counter\n document.getElementById('unviewedBadge').style.display = counter > 0 ? 'flex' : 'none'\n }\n window.clevertap.renderNotificationViewed({ msgId: messages[messageId].wzrk_id, pivotId: messages[messageId].pivotId })\n $ct.inbox.unviewedCounter--\n delete $ct.inbox.unviewedMessages[messageId]\n saveInboxMessages(messages)\n } else {\n this.#logger.error('No message available for message Id ' + messageId)\n }\n }\n\n /* Mark Message as Read. messageIds should be a an array of string */\n this.markReadInboxMessagesForIds = (messageIds) => {\n if (Array.isArray(messageIds)) {\n for (var id = 0; id < messageIds.length; id++) {\n this.markReadInboxMessage(messageIds[id])\n }\n }\n }\n\n /* Mark all messages as read\n - Get the count of unread messages, update unread marker style\n - renderNotificationViewed, update the badge count and style\n */\n this.markReadAllInboxMessage = () => {\n const unreadMsg = $ct.inbox.unviewedMessages\n const messages = getInboxMessages()\n if (Object.keys(unreadMsg).length > 0) {\n const msgIds = Object.keys(unreadMsg)\n msgIds.forEach(key => {\n const el = document.querySelector('ct-web-inbox').shadowRoot.getElementById(key)\n if (el !== null) { el.shadowRoot.getElementById('unreadMarker').style.display = 'none' }\n messages[key].viewed = 1\n window.clevertap.renderNotificationViewed({ msgId: messages[key].wzrk_id, pivotId: messages[key].wzrk_pivot })\n })\n document.getElementById('unviewedBadge').innerText = 0\n document.getElementById('unviewedBadge').style.display = 'none'\n saveInboxMessages(messages)\n $ct.inbox.unviewedCounter = 0\n $ct.inbox.unviewedMessages = {}\n } else {\n this.#logger.debug('All messages are already read')\n }\n }\n\n this.toggleInbox = (e) => $ct.inbox?.toggleInbox(e)\n\n // method for notification viewed\n this.renderNotificationViewed = (detail) => {\n processNotificationEvent(NOTIFICATION_VIEWED, detail)\n }\n\n // method for notification clicked\n this.renderNotificationClicked = (detail) => {\n processNotificationEvent(NOTIFICATION_CLICKED, detail)\n }\n\n const processNotificationEvent = (eventName, eventDetail) => {\n if (!eventDetail || !eventDetail.msgId) { return }\n const data = {}\n data.type = 'event'\n data.evtName = eventName\n data.evtData = { [WZRK_ID]: eventDetail.msgId }\n\n if (eventDetail.pivotId) {\n data.evtData = { ...data.evtData, wzrk_pivot: eventDetail.pivotId }\n }\n\n if (eventDetail.wzrk_slideNo) {\n data.evtData = { ...data.evtData, wzrk_slideNo: eventDetail.wzrk_slideNo }\n }\n\n // Adding kv pair to event data\n if (eventDetail.kv && eventDetail.kv !== null && eventDetail.kv !== undefined) {\n for (const key in eventDetail.kv) {\n if (key.startsWith(WZRK_PREFIX)) {\n data.evtData = { ...data.evtData, [key]: eventDetail.kv[key] }\n }\n }\n }\n\n // Adding msgCTkv to event data\n if (eventDetail.msgCTkv && eventDetail.msgCTkv !== null && eventDetail.msgCTkv !== undefined) {\n for (const key in eventDetail.msgCTkv) {\n if (key.startsWith(WZRK_PREFIX)) {\n data.evtData = { ...data.evtData, [key]: eventDetail.msgCTkv[key] }\n }\n }\n }\n this.#request.processEvent(data)\n }\n\n this.setLogLevel = (l) => {\n this.#logger.logLevel = Number(l)\n if (l === 3) {\n sessionStorage.WZRK_D = ''\n } else {\n delete sessionStorage.WZRK_D\n }\n }\n /**\n * @param {} key\n * @param {*} value\n */\n this.handleIncrementValue = (key, value) => {\n this.profile._handleIncrementDecrementValue(key, value, COMMAND_INCREMENT)\n }\n\n this.handleDecrementValue = (key, value) => {\n this.profile._handleIncrementDecrementValue(key, value, COMMAND_DECREMENT)\n }\n\n this.setMultiValuesForKey = (key, value) => {\n if (Array.isArray(value)) {\n this.profile._handleMultiValueSet(key, value, COMMAND_SET)\n } else {\n console.error('setMultiValuesForKey should be called with a value of type array')\n }\n }\n\n this.addMultiValueForKey = (key, value) => {\n if (typeof value === 'string' || typeof value === 'number') {\n this.profile._handleMultiValueAdd(key, value, COMMAND_ADD)\n } else {\n console.error('addMultiValueForKey should be called with a value of type string or number.')\n }\n }\n\n this.addMultiValuesForKey = (key, value) => {\n if (Array.isArray(value)) {\n this.profile._handleMultiValueAdd(key, value, COMMAND_ADD)\n } else {\n console.error('addMultiValuesForKey should be called with a value of type array.')\n }\n }\n\n this.removeMultiValueForKey = (key, value) => {\n if (typeof value === 'string' || typeof value === 'number') {\n this.profile._handleMultiValueRemove(key, value, COMMAND_REMOVE)\n } else {\n console.error('removeMultiValueForKey should be called with a value of type string or number.')\n }\n }\n\n this.removeMultiValuesForKey = (key, value) => {\n if (Array.isArray(value)) {\n this.profile._handleMultiValueRemove(key, value, COMMAND_REMOVE)\n } else {\n console.error('removeMultiValuesForKey should be called with a value of type array.')\n }\n }\n\n this.removeValueForKey = (key) => {\n this.profile._handleMultiValueDelete(key, COMMAND_DELETE)\n }\n\n const _handleEmailSubscription = (subscription, reEncoded, fetchGroups) => {\n handleEmailSubscription(subscription, reEncoded, fetchGroups, this.#account, this.#logger)\n }\n\n /**\n *\n * @param {number} lat\n * @param {number} lng\n * @param {callback function} handleCoordinates\n * @returns\n */\n this.getLocation = function (lat, lng) {\n // latitude and longitude should be number type\n if ((lat && typeof lat !== 'number') || (lng && typeof lng !== 'number')) {\n console.log('Latitude and Longitude must be of number type')\n return\n }\n if (lat && lng) {\n // valid latitude ranges bw +-90\n if (lat <= -90 || lat > 90) {\n console.log('A vaid latitude must range between -90 and 90')\n return\n }\n // valid longitude ranges bw +-180\n if (lng <= -180 || lng > 180) {\n console.log('A valid longitude must range between -180 and 180')\n return\n }\n $ct.location = { Latitude: lat, Longitude: lng }\n this.sendLocationData({ Latitude: lat, Longitude: lng })\n } else {\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(showPosition.bind(this), showError)\n } else {\n console.log('Geolocation is not supported by this browser.')\n }\n }\n }\n\n function showPosition (position) {\n var lat = position.coords.latitude\n var lng = position.coords.longitude\n $ct.location = { Latitude: lat, Longitude: lng }\n this.sendLocationData({ Latitude: lat, Longitude: lng })\n }\n\n function showError (error) {\n switch (error.code) {\n case error.PERMISSION_DENIED:\n console.log('User denied the request for Geolocation.')\n break\n case error.POSITION_UNAVAILABLE:\n console.log('Location information is unavailable.')\n break\n case error.TIMEOUT:\n console.log('The request to get user location timed out.')\n break\n case error.UNKNOWN_ERROR:\n console.log('An unknown error occurred.')\n break\n }\n }\n\n const api = this.#api\n api.logout = this.logout\n api.clear = this.clear\n api.closeIframe = (campaignId, divIdIgnored) => {\n closeIframe(campaignId, divIdIgnored, this.#session.sessionId)\n }\n api.enableWebPush = (enabled, applicationServerKey) => {\n this.notifications._enableWebPush(enabled, applicationServerKey)\n }\n api.tr = (msg) => {\n _tr(msg, {\n device: this.#device,\n session: this.#session,\n request: this.#request,\n logger: this.#logger\n })\n }\n api.setEnum = (enumVal) => {\n setEnum(enumVal, this.#logger)\n }\n api.is_onloadcalled = () => {\n return (this.#onloadcalled === 1)\n }\n api.subEmail = (reEncoded) => {\n _handleEmailSubscription('1', reEncoded)\n }\n api.getEmail = (reEncoded, withGroups) => {\n _handleEmailSubscription('-1', reEncoded, withGroups)\n }\n api.unSubEmail = (reEncoded) => {\n _handleEmailSubscription('0', reEncoded)\n }\n api.unsubEmailGroups = (reEncoded) => {\n $ct.unsubGroups = []\n const elements = document.getElementsByClassName('ct-unsub-group-input-item')\n\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i]\n if (element.name) {\n const data = { name: element.name, isUnsubscribed: element.checked }\n $ct.unsubGroups.push(data)\n }\n }\n\n _handleEmailSubscription(GROUP_SUBSCRIPTION_REQUEST_ID, reEncoded)\n }\n api.setSubscriptionGroups = (value) => {\n $ct.unsubGroups = value\n }\n api.getSubscriptionGroups = () => {\n return $ct.unsubGroups\n }\n api.changeSubscriptionGroups = (reEncoded, updatedGroups) => {\n api.setSubscriptionGroups(updatedGroups)\n _handleEmailSubscription(GROUP_SUBSCRIPTION_REQUEST_ID, reEncoded)\n }\n api.isGlobalUnsubscribe = () => {\n return $ct.globalUnsubscribe\n }\n api.setIsGlobalUnsubscribe = (value) => {\n $ct.globalUnsubscribe = value\n }\n api.setUpdatedCategoryLong = (profile) => {\n if (profile[categoryLongKey]) {\n $ct.updatedCategoryLong = profile[categoryLongKey]\n }\n }\n window.$CLTP_WR = window.$WZRK_WR = api\n\n if (clevertap.account?.[0].id) {\n // The accountId is present so can init with empty values.\n // Needed to maintain backward compatability with legacy implementations.\n // Npm imports/require will need to call init explictly with accountId\n this.init()\n }\n }\n\n // starts here\n init (accountId, region, targetDomain, token) {\n if (this.#onloadcalled === 1) {\n // already initailsed\n return\n }\n StorageManager.removeCookie('WZRK_P', window.location.hostname)\n if (!this.#account.id) {\n if (!accountId) {\n this.#logger.error(EMBED_ERROR)\n return\n }\n this.#account.id = accountId\n }\n this.#session.cookieName = SCOOKIE_PREFIX + '_' + this.#account.id\n\n if (region) {\n this.#account.region = region\n }\n if (targetDomain) {\n this.#account.targetDomain = targetDomain\n }\n if (token) {\n this.#account.token = token\n }\n\n const currLocation = location.href\n const urlParams = getURLParams(currLocation.toLowerCase())\n\n // eslint-disable-next-line eqeqeq\n if (typeof urlParams.e !== 'undefined' && urlParams.wzrk_ex == '0') {\n return\n }\n\n $ct.isPrivacyArrPushed = true\n if ($ct.privacyArray.length > 0) {\n this.privacy.push($ct.privacyArray)\n }\n\n this.#processOldValues()\n this.pageChanged()\n const backupInterval = setInterval(() => {\n if (this.#device.gcookie) {\n clearInterval(backupInterval)\n this.#request.processBackupEvents()\n }\n }, 3000)\n if (this.#isSpa) {\n // listen to click on the document and check if URL has changed.\n document.addEventListener('click', this.#boundCheckPageChanged)\n } else {\n // remove existing click listeners if any\n document.removeEventListener('click', this.#boundCheckPageChanged)\n }\n this.#onloadcalled = 1\n }\n\n // process the option array provided to the clevertap object\n // after its been initialized\n #processOldValues () {\n this.onUserLogin._processOldValues()\n this.privacy._processOldValues()\n this.event._processOldValues()\n this.profile._processOldValues()\n this.notifications._processOldValues()\n }\n\n #debounce (func, delay = 300) {\n let timeout\n return function () {\n clearTimeout(timeout)\n timeout = setTimeout(func, delay)\n }\n }\n\n #checkPageChanged () {\n const debouncedPageChanged = this.#debounce(() => {\n if (this.#previousUrl !== location.href) {\n this.pageChanged()\n }\n })\n debouncedPageChanged()\n }\n\n pageChanged () {\n const currLocation = window.location.href\n const urlParams = getURLParams(currLocation.toLowerCase())\n // -- update page count\n const obj = this.#session.getSessionCookieObject()\n let pgCount = (typeof obj.p === 'undefined') ? 0 : obj.p\n obj.p = ++pgCount\n this.#session.setSessionCookieObject(obj)\n // -- update page count\n\n let data = {}\n let referrerDomain = getDomain(document.referrer)\n\n if (window.location.hostname !== referrerDomain) {\n const maxLen = 120\n if (referrerDomain !== '') {\n referrerDomain = referrerDomain.length > maxLen ? referrerDomain.substring(0, maxLen) : referrerDomain\n data.referrer = referrerDomain\n }\n\n let utmSource = urlParams.utm_source || urlParams.wzrk_source\n if (typeof utmSource !== 'undefined') {\n utmSource = utmSource.length > maxLen ? utmSource.substring(0, maxLen) : utmSource\n data.us = utmSource // utm_source\n }\n\n let utmMedium = urlParams.utm_medium || urlParams.wzrk_medium\n if (typeof utmMedium !== 'undefined') {\n utmMedium = utmMedium.length > maxLen ? utmMedium.substring(0, maxLen) : utmMedium\n data.um = utmMedium // utm_medium\n }\n\n let utmCampaign = urlParams.utm_campaign || urlParams.wzrk_campaign\n if (typeof utmCampaign !== 'undefined') {\n utmCampaign = utmCampaign.length > maxLen ? utmCampaign.substring(0, maxLen) : utmCampaign\n data.uc = utmCampaign // utm_campaign\n }\n\n // also independently send wzrk_medium to the backend\n if (typeof urlParams.wzrk_medium !== 'undefined') {\n const wm = urlParams.wzrk_medium\n if (wm.match(/^email$|^social$|^search$/)) {\n data.wm = wm // wzrk_medium\n }\n }\n }\n\n data = this.#request.addSystemDataToObject(data, undefined)\n data.cpg = currLocation\n\n data[CAMP_COOKIE_NAME] = getCampaignObjForLc()\n let pageLoadUrl = this.#account.dataPostURL\n this.#request.addFlags(data)\n // send dsync flag when page = 1\n if (parseInt(data.pg) === 1) {\n this.#overrideDSyncFlag(data)\n }\n pageLoadUrl = addToURL(pageLoadUrl, 'type', 'page')\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(JSON.stringify(data), this.#logger))\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n\n if (parseInt(data.pg) === 1) {\n this.event.push(WZRK_FETCH, { t: 4 })\n }\n\n this.#previousUrl = currLocation\n setTimeout(() => {\n if (pgCount <= 3) {\n // send ping for up to 3 pages\n this.#pingRequest()\n }\n\n if (this.#isPingContinuous()) {\n setInterval(() => {\n this.#pingRequest()\n }, CONTINUOUS_PING_FREQ_IN_MILLIS)\n }\n }, FIRST_PING_FREQ_IN_MILLIS)\n }\n\n #pingRequest () {\n let pageLoadUrl = this.#account.dataPostURL\n let data = {}\n data = this.#request.addSystemDataToObject(data, undefined)\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PING)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(JSON.stringify(data), this.#logger))\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n\n #isPingContinuous () {\n return (typeof window.wzrk_d !== 'undefined' && window.wzrk_d.ping === 'continuous')\n }\n\n _isPersonalisationActive () {\n return StorageManager._isLocalStorageSupported() && this.enablePersonalization\n }\n\n #overrideDSyncFlag (data) {\n if (this._isPersonalisationActive()) {\n data.dsync = true\n }\n }\n\n popupCallbacks = {};\n popupCurrentWzrkId = '';\n\n // eslint-disable-next-line accessor-pairs\n set popupCallback (callback) {\n this.popupCallbacks[this.popupCurrentWzrkId] = callback\n }\n\n /**\n *\n * @param {object} payload\n */\n sendLocationData (payload) {\n // Send the updated value to LC\n let data = {}\n data.af = {}\n const profileObj = {}\n data.type = 'profile'\n if (profileObj.tz == null) {\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n data.profile = profileObj\n if (payload) {\n const keys = Object.keys(payload)\n keys.forEach(key => {\n data.af[key] = payload[key]\n })\n }\n if ($ct.location) {\n data.af = { ...data.af, ...$ct.location }\n }\n data = this.#request.addSystemDataToObject(data, true)\n this.#request.addFlags(data)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n\n // offline mode\n /**\n * events will be recorded and queued locally when passed with true\n * but will not be sent to the server until offline is disabled by passing false\n * @param {boolean} arg\n */\n\n setOffline (arg) {\n if (typeof arg !== 'boolean') {\n console.error('setOffline should be called with a value of type boolean')\n return\n }\n $ct.offline = arg\n // if offline is disabled\n // process events from cache\n if (!arg) {\n this.#request.processBackupEvents()\n }\n }\n\n 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","id","region","targetDomain","token","accountId","dcSDKVersion","finalTargetDomain","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","WIZ_IFRAME","WIZ_IFRAME_INTENT","ADJUST_IFRAME_HEIGHT","UPDATE_HEIGHT","GET_NOTIFICATION","EVENT","PROFILE","OUL","CLOSE_BOX_POPUP","CLOSE_BANNER_POPUP","GET_NOTIFICATION_DATA","CLOSE_INTERSTITIAL_POPUP","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","_isLocalStorageSupported","localStorage","setItem","JSON","stringify","data","getItem","parse","e","removeItem","name","domain","cookieStr","document","cookie","seconds","expires","domainStr","setTime","toGMTString","encodeURIComponent","nameEQ","ca","split","idx","c","charAt","indexOf","decodeURIComponent","window","property","save","createCookie","location","hostname","$ct","globalCache","read","readCookie","trim","err","broadDomain","domainParts","testBroadDomain","testCookieName","removeCookie","tempCookie","metaObj","readFromLSorCookie","wzrkMetaObj","saveToLSorCookie","getMetaProp","setMetaProp","k","flag","reqNo","backupArr","q","debug","respNo","backupMap","gcookie","REQ_N","RESP_N","globalProfileMap","globalEventsMap","blockRequest","isOptInRequest","webPushEnabled","campaignDivMap","currentSessionId","wiz_counter","notifApi","notifEnabledFromApi","unsubGroups","updatedCategoryLong","inbox","isPrivacyArrPushed","privacyArray","offline","dismissSpamControl","globalUnsubscribe","flutterVersion","variableStore","LRUCache","max","lruCache","tempLruCache","cache","entry","push","item","saveCacheToLS","allKeys","objToArray","index","temp","keysArr","keysLength","newCache","indexToDelete","splice","CleverTapAPI","request","device","session","global","resume","respNumber","optOutResponse","oulReq","newGuid","isOULInProgress","oulReqN","removeBackup","sessionObj","getSessionCookieObject","s","getAndClearMetaProp","kIdFromLS","guidFromLRUCache","set","lastK","getSecondLastKey","lastGUID","unregisterTokenForGuid","createBroadCookie","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","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","account","randomDelay","random","skipARP","sendOULFlag","skipResARP","_arp","pageLoadUrl","useIP","slice","tries","setTimeout","getDelayFrequency","clevertap","wizrocket","plugin","ctCbScripts","getElementsByClassName","parentNode","removeChild","setAttribute","async","getElementsByTagName","appendChild","getCampaignObject","finalcampObj","campObj","wp","saveCampaignObject","campaignObj","newObj","setCampaignObjectForGuid","guidCampObj","finalCampObj","keys","forEach","campKeyObj","globalObj","dailyObj","campaignIdArray","resultObj","dailyC","totalC","campaignId","console","getCampaignObjForLc","storageValue","decodedValue","parsedValue","resultObjWP","resultObjWI","wi","todayCwp","todayCwi","tc","wmp","wimp","tlc","witlc","isProfileValid","profileObj","valid","profileKey","profileVal","Age","Phone","processFBUserObj","user","profileData","Name","FBID","gender","Gender","getHighestEducation","eduArr","college","highschool","edu","relationship_status","Married","education","Education","work","Employed","email","Email","birthday","mmddyy","DOB","processGPlusUserObj","displayName","GPID","image","isDefault","Photo","emails","emailIdx","emailObj","organizations","orgObj","yyyymmdd","relationshipStatus","addToLocalProfileMap","override","_custom","closeIframe","divIdIgnored","sessionCampaignObj","divId","getElementById","style","display","arp","jsonMap","isOULARP","arpFromStorage","setEnum","enumVal","handleEmailSubscription","subscription","reEncoded","fetchGroups","urlParamsAsIs","encodedEmailId","encodedProfileProps","p","pageType","page_type","emailURL","fireRequest","ProfileHandler","profilesArr","propName","command","tz","profile","addSystemDataToObject","addFlags","compressedData","dataPostURL","saveAndFireRequest","arrayVal","array","toLowerCase","sendMultiValueData","propKey","propVal","profileArr","outerObj","Site","Facebook","FbProfileObj","GPlusProfileObj","UserLoginHandler","addToK","ids","g","kId","anonymousUser","foundInCache","getLastKey","gFromCache","get","clear","Identity","cookieName","loginArr","pop","processProfile","setInstantDeleteFlagInK","CTWebPersonalisationBanner","_details","shadow","attachShadow","mode","innerHTML","getBannerContent","trackClick","addEventListener","onClickUrl","details","onClick","open","parent","renderNotificationClicked","msgId","pivotId","renderNotificationViewed","divHeight","css","desktopImageURL","mobileImageURL","html","renderBanner","HTMLElement","CTWebPersonalisationCarousel","_target","_carousel","slides","previouslySelectedItem","selectedItem","autoSlide","stopAutoSlideTimeout","customElements","define","getStyles","carousel","getCarouselContent","showNavBtns","insertAdjacentHTML","navBtnsHtml","showNavArrows","leftNavArrowHtml","rightNavArrowHtml","setupClick","updateSelectedItem","startAutoSlide","setupOnHover","target","wzrk_id","wzrk_pivot","event","eventID","startsWith","selected","endsWith","goToNext","goToPrev","wzrk_slideNo","clearInterval","clearTimeout","detail","banner","classList","add","navBtnsCss","navArrowsCss","prevItem","prevButton","remove","button","setInterval","sliderTime","goTo","prev","cur","renderCarousel","CTWebPopupImageOnly","_session","popup","container","resizeObserver","sessionId","getImageOnlyPopupContent","shadowRoot","closeIcon","updateImageAndContainerWidth","ResizeObserver","handleResize","observe","unobserve","width","getRenderedImageWidth","setProperty","msgContent","visibility","img","ratio","naturalWidth","naturalHeight","height","renderImageOnlyPopup","Message","config","message","wrapper","snackBar","renderMessage","part","_el","msg","createEl","templateType","prepareBasicMessage","timeStamp","determineTimeStampText","viewed","unreadMarker","imageUrl","imageContainer","addImage","iconTitleDescWrapper","iconUrl","iconContainer","titleDescWrapper","title","innerText","description","buttons","buttonsContainer","addButtons","hasCopyAction","b","text","cssText","action","addSnackbar","greenTickSvg","clipboardMsg","path","isPreview","raiseClickedForBasicTemplates","payload","tagName","kv","wzrk_c2a","openUrlInNewTab","focus","navigator","clipboard","writeText","clipboardText","log","messageStyles","backgroundColor","borderColor","titleColor","descriptionColor","buttonColor","buttonTextColor","unreadMarkerColor","inboxContainerStyles","panelBackgroundColor","panelBorderColor","headerBackgroundColor","headerTitleColor","closeIconColor","categoriesTabColor","categoriesTitleColor","categoriesBorderColor","selectedCategoryTabColor","selectedCategoryTitleColor","selectedCategoryBorderColor","headerCategoryHeight","Inbox","isInboxOpen","isInboxFromFlutter","selectedCategory","unviewedMessages","unviewedCounter","inboxConfigForPreview","inboxSelector","emptyInboxMsg","inboxCard","unviewedBadge","observer","selectedCategoryRef","addClickListenerOnDocument","composedPath","toggleInbox","prevCategoryRef","updateActiveCategory","_path","filter","messageEl","raiseClickedEvent","contains","setBadgeStyle","msgCount","init","styles","notificationsBadge","addUnviewedBadge","createinbox","removeEventListener","categories","getInboxStyles","messages","deleteExpiredAndGetUnexpiredMsgs","msgIds","buildUIForMessages","updateUnviewedBadgeCounter","deleteMsgsFromUI","getInboxMessages","now","wzrk_ttl","el","sort","reduce","acc","saveInboxMessages","msgs","inboxMsgs","incomingMsgs","textColor","body","updateUnviewedBadgePosition","getBoundingClientRect","top","right","left","header","headerTitle","createCategories","options","root","rootMargin","threshold","IntersectionObserver","entries","handleMessageViewed","addMsgsToInboxFromLS","categoriesContainer","leftArrow","arrowSvg","children","scrollBy","categoriesWrapper","_categories","category","rightArrow","firstCategory","lastCategory","firstCategoryObserver","categoryObserverCb","intersectionRatio","lastCategoryObserver","hide","activeCategory","scrollTop","counter","childNodes","getAttribute","updateTSForRenderedMsgs","maxMsgsInInbox","firstChild","sortedMsgs","map","tags","insertBefore","msgTotalCount","querySelectorAll","ctInboxMsgs","hasMessages","raiseViewedEvent","isIntersecting","updateMessageInLS","rect","zIndex","scrollLeft","scrollWidth","setInboxPosition","windowWidth","outerWidth","customInboxStyles","getComputedStyle","getPropertyValue","bottom","hasPositionDefined","res","getInboxPosition","clientHeight","clientWidth","xPos","yPos","ts","headerHeight","categoriesHeight","tabColor","selectedTab","inboxStyles","cardStyles","cards","msgStyles","updateInboxMessages","previewMsgs","processWebInboxSettings","webInboxSetting","_settings","processInboxNotifs","inbox_preview","incomingMessagesForPreview","inbox_notifs","incomingMessages","addWebInbox","checkAndRegisterWebInboxElements","getAndMigrateInboxMessages","gudInboxObj","storedInboxObj","initializeWebInbox","Promise","resolve","reject","readyState","onLoaded","inboxHeight","inboxWidth","horizontalScroll","scrollingElement","verticalScroll","innerWidth","windowHeight","innerHeight","selectorRect","selectorX","x","selectorY","selectorLeft","selectorRight","selectorTop","selectorBottom","selectorHeight","selectorWidth","selectorCenter","halfOfInboxHeight","halfOfInboxWidth","inboxOnSide","availableHeight","inboxRight","availableWidth","inboxLeft","diff","hasWebInboxSettingsInLS","ctEventhandler","ctScript","insertPosition","join","_tr","_device","_request","_logger","_wizCounter","doCampHouseKeeping","targetingMsgJson","incrCount","excludeFromFreqCaps","currentCount","totalCount","sessionStorage","campTypeObj","wtarget_type","wmc","wimc","campaignSessionLimit","campaignDailyLimit","campaignTotalLimit","totalDailyLimit","totalSessionLimit","totalInboxSessionLimit","efc","parseInt","mdc","tdc","campaignSessionCount","totalSessionCount","campaignDailyCount","totalDailyCount","campaignTotalCount","delay","campKey","newCampObj","getCookieParams","scookieObj","setupClickEvent","contentDiv","isLegacy","ctaElement","jsCTAElements","jsFunc","preview","onclick","invokeExternalJs","func","setupClickUrl","incrementImpression","renderPersonalisationBanner","divSelector","bannerEl","containerEl","querySelector","renderPersonalisationCarousel","renderPopUpImageOnly","popupImageOnly","renderFooterNotification","displayObj","inaObj","kvPairsEvent","CustomEvent","dispatchEvent","layout","showExitIntent","element","msgDiv","isBanner","viewHeight","viewWidth","legacy","marginBottom","contentHeight","bottomPosition","widthPerct","userAgent","proto","iFrameStyle","iframe","borderRadius","br","frameborder","marginheight","marginwidth","scrolling","sandbox","pointerCss","bgColor","btnBg","leftTd","btColor","theme","titleText","descriptionText","imageTd","onClickStr","closeCampaign","Event","appendScriptForCustomEvent","srcdoc","handleMessage","heightAdjust","boxWrapper","bannerWrapper","margin","onUserLogin","handleIframeLoad","contentWindow","postMessage","contentDocument","scrollHeight","onload","script","_callBackCalled","showFooterNotification","notificationCallback","raiseNotificationClicked","raiseNotificationViewed","popupCurrentWzrkId","popupCallbacks","popupCallback","msgCTkv","wzrkPrefixKey","wzrkJson","raisePopupNotificationClicked","notificationData","eventData","wzrkPrefixObj","exitintentObj","targetObj","clientY","opacityDiv","opacity","rgbaColor","ctaText","interstitialWrapper","interstitialOverlay","processNativeDisplayArr","arrInAppNotifs","elementId","addLoadListener","inapp_notifs","targetNotif","onmouseleave","mergeEventMap","newEvtMap","oldEvtObj","newEvtObj","handleInboxNotifications","msgArr","then","catch","vars","mergeVariables","staleDataUpdate","staledata","campType","evpr","eventsMap","events","profileMap","syncExpiry","expires_in","inapp_stale","inbox_stale","User","visitCount","prevSession","logLevels","DISABLE","ERROR","INFO","DEBUG","DEBUG_PE","Logger","logLevel","wzrkError","code","level","WZRK_D","SessionManager","scookieStr","objStr","currentSessionInLS","sessionCount","sessionStart","seqNo","requestTime","RequestManager","backupEvent","fired","ignoreTrim","wzrk_error","pg","protocol","af","lib","rc","lastSyncTime","expirySeconds","dsync","givenGUID","registerToken","fetch","method","headers","response","ok","json","nowTs","evtDetail","Privacy","privacyArr","privacyObj","curr","optOut","shouldUseIP","NotificationHandler","displayArgs","enabled","applicationServerKey","subscriptionCallback","serviceWorkerPath","apnsWebPushId","apnsServiceUrl","safari","pushNotification","requestPermission","permission","subscriptionData","endpoint","deviceToken","browser","info","registrationScope","serviceWorker","register","registration","__wzrk_account_id","scope","rootDirRegex","isServiceWorkerAtRoot","ready","getRegistrations","serviceWorkerRegistration","subscribeObj","userVisibleOnly","pushManager","subscribe","getSubscription","unsubscribe","successful","scriptTag","bodyText","okButtonText","rejectButtonText","okButtonColor","skipDialog","askAgainTimeInSeconds","okCallback","rejectCallback","httpsPopupPath","httpsIframePath","apnsWebPushServiceUrl","notifObj","isHTTP","chromeAgent","firefoxAgent","safariAgent","Notification","httpsIframe","state","from","wzrkPermissionPopup","wizAlert","confirmButtonText","confirmButtonColor","Variable","defaultValue","hadStarted","valueChangedCallbacks","newValue","oldValue","hasVarsRequestCompleted","triggerValueChanged","onValueChanged","typeOfDefaultValue","existing","getVariable","varInstance","registerVariable","update","VariableStore","onSyncSuccess","onSyncFailure","Error","meta","tk","dataPostPEURL","post","r","status","onFetchCallback","callback","callBack","CleverTap","isSpa","bind","enablePersonalization","_isPersonalisationActive","ReqestManager","privacy","notifications","spa","getTimeElapsed","getPageCount","logout","getCleverTapID","getAccountID","getSCDomain","setLibrary","libName","libVersion","setSCSDKVersion","ver","scSDKVersion","scv","getInboxMessageCount","getInboxMessageUnreadCount","getAllInboxMessages","getUnreadInboxMessages","getInboxMessageForId","messageId","deleteInboxMessage","markReadInboxMessage","unreadMsg","markReadInboxMessagesForIds","messageIds","markReadAllInboxMessage","processNotificationEvent","eventDetail","setLogLevel","l","Number","handleIncrementValue","_handleIncrementDecrementValue","handleDecrementValue","setMultiValuesForKey","_handleMultiValueSet","addMultiValueForKey","_handleMultiValueAdd","addMultiValuesForKey","removeMultiValueForKey","_handleMultiValueRemove","removeMultiValuesForKey","removeValueForKey","_handleMultiValueDelete","_handleEmailSubscription","getLocation","lat","lng","Latitude","Longitude","sendLocationData","geolocation","getCurrentPosition","showPosition","showError","position","coords","latitude","longitude","PERMISSION_DENIED","POSITION_UNAVAILABLE","TIMEOUT","UNKNOWN_ERROR","api","enableWebPush","_enableWebPush","tr","is_onloadcalled","subEmail","getEmail","withGroups","unSubEmail","unsubEmailGroups","elements","isUnsubscribed","checked","setSubscriptionGroups","getSubscriptionGroups","changeSubscriptionGroups","updatedGroups","isGlobalUnsubscribe","setIsGlobalUnsubscribe","setUpdatedCategoryLong","$CLTP_WR","$WZRK_WR","currLocation","wzrk_ex","pageChanged","backupInterval","pgCount","referrerDomain","referrer","maxLen","utmSource","utm_source","wzrk_source","us","utmMedium","utm_medium","wzrk_medium","um","utmCampaign","utm_campaign","wzrk_campaign","uc","wm","cpg","arg","syncVariables","fetchVariables","addVariablesChangedCallback","addOneTimeVariablesChangedCallback","_processOldValues","timeout","debouncedPageChanged","wzrk_d","ping","Clevertap"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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 No newline at end of file +{"version":3,"file":"clevertap.js","sources":["src/options.js","src/modules/account.js","src/util/constants.js","src/util/datatypes.js","src/util/datetime.js","src/util/storage.js","src/util/lruCache.js","src/modules/api.js","src/modules/device.js","src/util/messages.js","src/util/validator.js","src/modules/event.js","src/util/url.js","src/util/encoder.js","src/util/requestDispatcher.js","src/util/clevertap.js","src/modules/profile.js","src/modules/userLogin.js","src/util/web-personalisation/banner.js","src/util/web-personalisation/carousel.js","src/util/web-popupImageonly/popupImageonly.js","src/modules/web-inbox/Message.js","src/modules/web-inbox/inboxStyles.js","src/modules/web-inbox/WebInbox.js","src/modules/web-inbox/helper.js","src/util/tr.js","src/modules/user.js","src/modules/logger.js","src/modules/session.js","src/modules/request.js","src/modules/privacy.js","src/modules/notification.js","src/modules/variables/variable.js","src/modules/variables/variableStore.js","src/clevertap.js","src/main.js"],"sourcesContent":["export const TARGET_DOMAIN = 'clevertap-prod.com'\nexport const TARGET_PROTOCOL = 'https:'\nexport const DEFAULT_REGION = 'eu1'\n","import { DEFAULT_REGION, TARGET_DOMAIN, TARGET_PROTOCOL } from '../options'\n\nexport default class Account {\n #accountId\n #region = ''\n #targetDomain = TARGET_DOMAIN\n #dcSdkversion = ''\n #token = ''\n\n constructor ({ id } = {}, region = '', targetDomain = TARGET_DOMAIN, token = '') {\n this.id = id\n if (region) {\n this.region = region\n }\n if (targetDomain) {\n this.targetDomain = targetDomain\n }\n if (token) {\n this.token = token\n }\n }\n\n get id () {\n return this.#accountId\n }\n\n set id (accountId) {\n this.#accountId = accountId\n }\n\n get region () {\n return this.#region\n }\n\n set region (region) {\n this.#region = region\n }\n\n get dcSDKVersion () {\n return this.#dcSdkversion\n }\n\n set dcSDKVersion (dcSDKVersion) {\n this.#dcSdkversion = dcSDKVersion\n }\n\n get targetDomain () {\n return this.#targetDomain\n }\n\n set targetDomain (targetDomain) {\n this.#targetDomain = targetDomain\n }\n\n get token () {\n return this.#token\n }\n\n set token (token) {\n this.#token = token\n }\n\n get finalTargetDomain () {\n if (this.region) {\n return `${this.region}.${this.targetDomain}`\n } else {\n if (this.targetDomain === TARGET_DOMAIN) {\n return `${DEFAULT_REGION}.${this.targetDomain}`\n }\n return this.targetDomain\n }\n }\n\n get dataPostPEURL () {\n return `${TARGET_PROTOCOL}//${this.finalTargetDomain}/defineVars`\n }\n\n get dataPostURL () {\n return `${TARGET_PROTOCOL}//${this.finalTargetDomain}/a?t=96`\n }\n\n get recorderURL () {\n return `${TARGET_PROTOCOL}//${this.finalTargetDomain}/r?r=1`\n }\n\n get emailURL () {\n return `${TARGET_PROTOCOL}//${this.finalTargetDomain}/e?r=1`\n }\n}\n","export const unsupportedKeyCharRegex = new RegExp('^\\\\s+|\\\\\\.|\\:|\\\\\\$|\\'|\\\"|\\\\\\\\|\\\\s+$', 'g')\nexport const unsupportedValueCharRegex = new RegExp(\"^\\\\s+|\\'|\\\"|\\\\\\\\|\\\\s+$\", 'g')\nexport const doubleQuoteRegex = new RegExp('\\\"', 'g')\nexport const singleQuoteRegex = new RegExp('\\'', 'g')\nexport const CLEAR = 'clear'\nexport const CHARGED_ID = 'Charged ID'\nexport const CHARGEDID_COOKIE_NAME = 'WZRK_CHARGED_ID'\nexport const GCOOKIE_NAME = 'WZRK_G'\nexport const KCOOKIE_NAME = 'WZRK_K'\nexport const CAMP_COOKIE_NAME = 'WZRK_CAMP'\nexport const CAMP_COOKIE_G = 'WZRK_CAMP_G'// cookie for storing campaign details against guid\nexport const SCOOKIE_PREFIX = 'WZRK_S'\nexport const SCOOKIE_EXP_TIME_IN_SECS = 60 * 20 // 20 mins\nexport const EV_COOKIE = 'WZRK_EV'\nexport const META_COOKIE = 'WZRK_META'\nexport const PR_COOKIE = 'WZRK_PR'\nexport const ARP_COOKIE = 'WZRK_ARP'\nexport const LCOOKIE_NAME = 'WZRK_L'\nexport const NOTIF_COOKIE_NAME = 'WZRK_N'\nexport const GLOBAL = 'global' // used for email unsubscribe also\nexport const TOTAL_COUNT = 'tc'\nexport const DISPLAY = 'display'\nexport const UNDEFINED = 'undefined'\nexport const WEBPUSH_LS_KEY = 'WZRK_WPR'\nexport const OPTOUT_KEY = 'optOut'\nexport const CT_OPTOUT_KEY = 'ct_optout'\nexport const OPTOUT_COOKIE_ENDSWITH = ':OO'\nexport const USEIP_KEY = 'useIP'\nexport const LRU_CACHE = 'WZRK_X'\nexport const LRU_CACHE_SIZE = 100\nexport const IS_OUL = 'isOUL'\nexport const EVT_PUSH = 'push'\nexport const EVT_PING = 'ping'\nexport const COOKIE_EXPIRY = 86400 * 365 // 1 Year in seconds\nexport const MAX_TRIES = 200 // API tries\nexport const FIRST_PING_FREQ_IN_MILLIS = 2 * 60 * 1000 // 2 mins\nexport const CONTINUOUS_PING_FREQ_IN_MILLIS = 5 * 60 * 1000 // 5 mins\nexport const GROUP_SUBSCRIPTION_REQUEST_ID = '2'\nexport const categoryLongKey = 'cUsY'\nexport const WZRK_PREFIX = 'wzrk_'\nexport const WZRK_ID = 'wzrk_id'\nexport const NOTIFICATION_VIEWED = 'Notification Viewed'\nexport const NOTIFICATION_CLICKED = 'Notification Clicked'\nexport const FIRE_PUSH_UNREGISTERED = 'WZRK_FPU'\nexport const PUSH_SUBSCRIPTION_DATA = 'WZRK_PSD' // PUSH SUBSCRIPTION DATA FOR REGISTER/UNREGISTER TOKEN\nexport const COMMAND_INCREMENT = '$incr'\nexport const COMMAND_DECREMENT = '$decr'\nexport const COMMAND_SET = '$set'\nexport const COMMAND_ADD = '$add'\nexport const COMMAND_REMOVE = '$remove'\nexport const COMMAND_DELETE = '$delete'\nexport const WEBINBOX_CONFIG = 'WZRK_INBOX_CONFIG'\nexport const WEBINBOX = 'WZRK_INBOX'\nexport const MAX_INBOX_MSG = 15\nexport const VARIABLES = 'WZRK_PE'\nexport const PUSH_DELAY_MS = 1000\nexport const MAX_DELAY_FREQUENCY = 1000 * 60 * 10\nexport const WZRK_FETCH = 'wzrk_fetch'\n\nexport const SYSTEM_EVENTS = [\n 'Stayed',\n 'UTM Visited',\n 'App Launched',\n 'Notification Sent',\n NOTIFICATION_VIEWED,\n NOTIFICATION_CLICKED\n]\n","import {\n unsupportedKeyCharRegex,\n unsupportedValueCharRegex\n} from './constants'\n\nexport const isString = (input) => {\n return (typeof input === 'string' || input instanceof String)\n}\n\nexport const isObject = (input) => {\n // TODO: refine\n return Object.prototype.toString.call(input) === '[object Object]'\n}\n\nexport const isDateObject = (input) => {\n return typeof (input) === 'object' && (input instanceof Date)\n}\n\nexport const isObjectEmpty = (obj) => {\n for (const prop in obj) {\n if (obj.hasOwnProperty(prop)) { return false }\n }\n return true\n}\n\nexport const isConvertibleToNumber = (n) => {\n return !isNaN(parseFloat(n)) && isFinite(n)\n}\n\nexport const isNumber = (n) => {\n return /^-?[\\d.]+(?:e-?\\d+)?$/.test(n) && typeof n === 'number'\n}\n\nexport const isValueValid = (value) => {\n if (value === null || value === undefined || value === 'undefined') {\n return false\n }\n return true\n}\n\nexport const arrayContains = (arr, obj) => {\n var i = arr.length\n while (i--) {\n if (arr[i] === obj) {\n return true\n }\n }\n return false\n}\n\nexport const removeUnsupportedChars = (o, logger) => {\n // keys can't be greater than 1024 chars, values can't be greater than 1024 chars\n if (typeof o === 'object') {\n for (const key in o) {\n if (o.hasOwnProperty(key)) {\n const sanitizedVal = removeUnsupportedChars(o[key], logger)\n let sanitizedKey\n sanitizedKey = sanitize(key, unsupportedKeyCharRegex)\n if (sanitizedKey.length > 1024) {\n sanitizedKey = sanitizedKey.substring(0, 1024)\n logger.reportError(520, sanitizedKey + '... length exceeded 1024 chars. Trimmed.')\n }\n delete o[key]\n o[sanitizedKey] = sanitizedVal\n }\n }\n } else {\n let val\n\n if (isString(o)) {\n val = sanitize(o, unsupportedValueCharRegex)\n if (val.length > 1024) {\n val = val.substring(0, 1024)\n logger.reportError(521, val + '... length exceeded 1024 chars. Trimmed.')\n }\n } else {\n val = o\n }\n return val\n }\n return o\n}\n\nexport const sanitize = (input, regex) => {\n return input.replace(regex, '')\n}\n","export const getToday = () => {\n const today = new Date()\n return today.getFullYear() + '' + today.getMonth() + '' + today.getDay()\n}\n\nexport const getNow = () => {\n return Math.floor((new Date()).getTime() / 1000)\n}\n\nexport const convertToWZRKDate = (dateObj) => {\n return ('$D_' + Math.round(dateObj.getTime() / 1000))\n}\n\nexport const setDate = (dt) => {\n // expecting yyyymmdd format either as a number or a string\n if (isDateValid(dt)) {\n return '$D_' + dt\n }\n}\n\nexport const isDateValid = (date) => {\n const matches = /^(\\d{4})(\\d{2})(\\d{2})$/.exec(date)\n if (matches == null) return false\n const d = matches[3]\n const m = matches[2] - 1\n const y = matches[1]\n const composedDate = new Date(y, m, d)\n // eslint-disable-next-line eqeqeq\n return composedDate.getDate() == d && composedDate.getMonth() == m && composedDate.getFullYear() == y\n}\n","import {\n GCOOKIE_NAME,\n META_COOKIE,\n KCOOKIE_NAME,\n LCOOKIE_NAME\n} from './constants'\nexport class StorageManager {\n static save (key, value) {\n if (!key || !value) {\n return false\n }\n if (this._isLocalStorageSupported()) {\n localStorage.setItem(key, typeof value === 'string' ? value : JSON.stringify(value))\n return true\n }\n }\n\n static read (key) {\n if (!key) {\n return false\n }\n let data = null\n if (this._isLocalStorageSupported()) {\n data = localStorage.getItem(key)\n }\n if (data != null) {\n try {\n data = JSON.parse(data)\n } catch (e) {}\n }\n return data\n }\n\n static remove (key) {\n if (!key) {\n return false\n }\n if (this._isLocalStorageSupported()) {\n localStorage.removeItem(key)\n return true\n }\n }\n\n static removeCookie (name, domain) {\n let cookieStr = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;'\n\n if (domain) {\n cookieStr = cookieStr + ' domain=' + domain + '; path=/'\n }\n\n document.cookie = cookieStr\n }\n\n static createCookie (name, value, seconds, domain) {\n let expires = ''\n let domainStr = ''\n if (seconds) {\n const date = new Date()\n date.setTime(date.getTime() + (seconds * 1000))\n\n expires = '; expires=' + date.toGMTString()\n }\n\n if (domain) {\n domainStr = '; domain=' + domain\n }\n\n value = encodeURIComponent(value)\n\n document.cookie = name + '=' + value + expires + domainStr + '; path=/'\n }\n\n static readCookie (name) {\n const nameEQ = name + '='\n const ca = document.cookie.split(';')\n for (let idx = 0; idx < ca.length; idx++) {\n let c = ca[idx]\n while (c.charAt(0) === ' ') {\n c = c.substring(1, c.length)\n }\n // eslint-disable-next-line eqeqeq\n if (c.indexOf(nameEQ) == 0) {\n return decodeURIComponent(c.substring(nameEQ.length, c.length))\n }\n }\n return null\n }\n\n static _isLocalStorageSupported () {\n return 'localStorage' in window && window.localStorage !== null && typeof window.localStorage.setItem === 'function'\n }\n\n static saveToLSorCookie (property, value) {\n if (value == null) {\n return\n }\n try {\n if (this._isLocalStorageSupported()) {\n this.save(property, encodeURIComponent(JSON.stringify(value)))\n } else {\n if (property === GCOOKIE_NAME) {\n this.createCookie(property, encodeURIComponent(value), 0, window.location.hostname)\n } else {\n this.createCookie(property, encodeURIComponent(JSON.stringify(value)), 0, window.location.hostname)\n }\n }\n $ct.globalCache[property] = value\n } catch (e) {}\n }\n\n static readFromLSorCookie (property) {\n let data\n if ($ct.globalCache.hasOwnProperty(property)) {\n return $ct.globalCache[property]\n }\n if (this._isLocalStorageSupported()) {\n data = this.read(property)\n } else {\n data = this.readCookie(property)\n }\n\n if (data !== null && data !== undefined && !(typeof data.trim === 'function' && data.trim() === '')) {\n let value\n try {\n value = JSON.parse(decodeURIComponent(data))\n } catch (err) {\n value = decodeURIComponent(data)\n }\n $ct.globalCache[property] = value\n return value\n }\n }\n\n static createBroadCookie (name, value, seconds, domain) {\n // sets cookie on the base domain. e.g. if domain is baz.foo.bar.com, set cookie on \".bar.com\"\n // To update an existing \"broad domain\" cookie, we need to know what domain it was actually set on.\n // since a retrieved cookie never tells which domain it was set on, we need to set another test cookie\n // to find out which \"broadest\" domain the cookie was set on. Then delete the test cookie, and use that domain\n // for updating the actual cookie.\n\n if (domain) {\n let broadDomain = $ct.broadDomain\n if (broadDomain == null) { // if we don't know the broadDomain yet, then find out\n const domainParts = domain.split('.')\n let testBroadDomain = ''\n for (let idx = domainParts.length - 1; idx >= 0; idx--) {\n if (idx === 0) {\n testBroadDomain = domainParts[idx] + testBroadDomain\n } else {\n testBroadDomain = '.' + domainParts[idx] + testBroadDomain\n }\n\n // only needed if the cookie already exists and needs to be updated. See note above.\n if (this.readCookie(name)) {\n // no guarantee that browser will delete cookie, hence create short lived cookies\n var testCookieName = 'test_' + name + idx\n this.createCookie(testCookieName, value, 10, testBroadDomain) // self-destruct after 10 seconds\n if (!this.readCookie(testCookieName)) { // if test cookie not set, then the actual cookie wouldn't have been set on this domain either.\n continue\n } else { // else if cookie set, then delete the test and the original cookie\n this.removeCookie(testCookieName, testBroadDomain)\n }\n }\n\n this.createCookie(name, value, seconds, testBroadDomain)\n const tempCookie = this.readCookie(name)\n // eslint-disable-next-line eqeqeq\n if (tempCookie == value) {\n broadDomain = testBroadDomain\n $ct.broadDomain = broadDomain\n break\n }\n }\n } else {\n this.createCookie(name, value, seconds, broadDomain)\n }\n } else {\n this.createCookie(name, value, seconds, domain)\n }\n }\n\n static getMetaProp (property) {\n const metaObj = this.readFromLSorCookie(META_COOKIE)\n if (metaObj != null) {\n return metaObj[property]\n }\n }\n\n static setMetaProp (property, value) {\n if (this._isLocalStorageSupported()) {\n let wzrkMetaObj = this.readFromLSorCookie(META_COOKIE)\n if (wzrkMetaObj == null) {\n wzrkMetaObj = {}\n }\n if (value === undefined) {\n delete wzrkMetaObj[property]\n } else {\n wzrkMetaObj[property] = value\n }\n this.saveToLSorCookie(META_COOKIE, wzrkMetaObj)\n }\n }\n\n static getAndClearMetaProp (property) {\n const value = this.getMetaProp(property)\n this.setMetaProp(property, undefined)\n return value\n }\n\n static setInstantDeleteFlagInK () {\n let k = this.readFromLSorCookie(KCOOKIE_NAME)\n if (k == null) {\n k = {}\n }\n k.flag = true\n this.saveToLSorCookie(KCOOKIE_NAME, k)\n }\n\n static backupEvent (data, reqNo, logger) {\n let backupArr = this.readFromLSorCookie(LCOOKIE_NAME)\n if (typeof backupArr === 'undefined') {\n backupArr = {}\n }\n backupArr[reqNo] = { q: data }\n this.saveToLSorCookie(LCOOKIE_NAME, backupArr)\n logger.debug(`stored in ${LCOOKIE_NAME} reqNo : ${reqNo} -> ${data}`)\n }\n\n static removeBackup (respNo, logger) {\n const backupMap = this.readFromLSorCookie(LCOOKIE_NAME)\n if (typeof backupMap !== 'undefined' && backupMap !== null && typeof backupMap[respNo] !== 'undefined') {\n logger.debug(`del event: ${respNo} data-> ${backupMap[respNo].q}`)\n delete backupMap[respNo]\n this.saveToLSorCookie(LCOOKIE_NAME, backupMap)\n }\n }\n}\n\nexport const $ct = {\n globalCache: {\n gcookie: null,\n REQ_N: 0,\n RESP_N: 0\n },\n LRU_CACHE: null,\n globalProfileMap: undefined,\n globalEventsMap: undefined,\n blockRequest: false,\n isOptInRequest: false,\n broadDomain: null,\n webPushEnabled: null,\n campaignDivMap: {},\n currentSessionId: null,\n wiz_counter: 0, // to keep track of number of times we load the body\n notifApi: {\n notifEnabledFromApi: false\n }, // helper variable to handle race condition and check when notifications were called\n unsubGroups: [],\n updatedCategoryLong: null,\n inbox: null,\n isPrivacyArrPushed: false,\n privacyArray: [],\n offline: false,\n location: null,\n dismissSpamControl: false,\n globalUnsubscribe: true,\n flutterVersion: null,\n variableStore: {}\n // domain: window.location.hostname, url -> getHostName()\n // gcookie: -> device\n}\n","import { StorageManager } from './storage'\nimport { LRU_CACHE } from './constants'\n\nexport default class LRUCache {\n #keyOrder\n\n constructor (max) {\n this.max = max\n let lruCache = StorageManager.readFromLSorCookie(LRU_CACHE)\n if (lruCache) {\n const tempLruCache = {}\n this.#keyOrder = []\n lruCache = lruCache.cache\n for (const entry in lruCache) {\n if (lruCache.hasOwnProperty(entry)) {\n tempLruCache[lruCache[entry][0]] = lruCache[entry][1]\n this.#keyOrder.push(lruCache[entry][0])\n }\n }\n this.cache = tempLruCache\n } else {\n this.cache = {}\n this.#keyOrder = []\n }\n }\n\n get (key) {\n const item = this.cache[key]\n if (item) {\n this.cache = this.#deleteFromObject(key, this.cache)\n this.cache[key] = item\n this.#keyOrder.push(key)\n }\n this.saveCacheToLS(this.cache)\n return item\n }\n\n set (key, value) {\n const item = this.cache[key]\n const allKeys = this.#keyOrder\n if (item != null) {\n this.cache = this.#deleteFromObject(key, this.cache)\n } else if (allKeys.length === this.max) {\n this.cache = this.#deleteFromObject(allKeys[0], this.cache)\n }\n this.cache[key] = value\n if (this.#keyOrder[this.#keyOrder - 1] !== key) {\n this.#keyOrder.push(key)\n }\n this.saveCacheToLS(this.cache)\n }\n\n saveCacheToLS (cache) {\n const objToArray = []\n const allKeys = this.#keyOrder\n for (const index in allKeys) {\n if (allKeys.hasOwnProperty(index)) {\n const temp = []\n temp.push(allKeys[index])\n temp.push(cache[allKeys[index]])\n objToArray.push(temp)\n }\n }\n StorageManager.saveToLSorCookie(LRU_CACHE, { cache: objToArray })\n }\n\n getKey (value) {\n if (value === null) {\n return null\n }\n const allKeys = this.#keyOrder\n for (const index in allKeys) {\n if (allKeys.hasOwnProperty(index)) {\n if (this.cache[allKeys[index]] === value) {\n return allKeys[index]\n }\n }\n }\n return null\n }\n\n getSecondLastKey () {\n const keysArr = this.#keyOrder\n if (keysArr != null && keysArr.length > 1) {\n return keysArr[keysArr.length - 2]\n }\n return -1\n }\n\n getLastKey () {\n const keysLength = this.#keyOrder.length\n if (keysLength) {\n return this.#keyOrder[keysLength - 1]\n }\n }\n\n #deleteFromObject (key, obj) {\n const allKeys = JSON.parse(JSON.stringify(this.#keyOrder))\n const newCache = {}\n let indexToDelete\n for (const index in allKeys) {\n if (allKeys.hasOwnProperty(index)) {\n if (allKeys[index] !== key) {\n newCache[allKeys[index]] = obj[allKeys[index]]\n } else {\n indexToDelete = index\n }\n }\n }\n allKeys.splice(indexToDelete, 1)\n this.#keyOrder = JSON.parse(JSON.stringify(allKeys))\n return newCache\n }\n}\n","import { COOKIE_EXPIRY, FIRE_PUSH_UNREGISTERED, GCOOKIE_NAME, KCOOKIE_NAME, LRU_CACHE_SIZE, USEIP_KEY } from '../util/constants'\nimport { isValueValid } from '../util/datatypes'\nimport { getNow } from '../util/datetime'\nimport LRUCache from '../util/lruCache'\nimport { StorageManager, $ct } from '../util/storage'\n\nexport default class CleverTapAPI {\n #logger\n #request\n #device\n #session\n\n constructor ({ logger, request, device, session }) {\n this.#logger = logger\n this.#request = request\n this.#device = device\n this.#session = session\n }\n\n /**\n *\n * @param {string} global gcookie\n * @param {string} session\n * @param {boolean} resume sent true in case of an OUL request from client side, which is returned as it is by server\n * @param {number} respNumber the index of the request in backupmanager\n * @param {boolean} optOutResponse\n * @returns\n */\n\n s (global, session, resume, respNumber, optOutResponse) {\n let oulReq = false\n let newGuid = false\n\n // for a scenario when OUL request is true from client side\n // but resume is returned as false from server end\n // we maintan a OulReqN var in the window object\n // and compare with respNumber to determine the response of an OUL request\n if (window.isOULInProgress) {\n if (resume || (respNumber !== 'undefined' && respNumber === window.oulReqN)) {\n window.isOULInProgress = false\n oulReq = true\n }\n }\n\n // call back function used to store global and session ids for the user\n if (typeof respNumber === 'undefined') {\n respNumber = 0\n }\n\n StorageManager.removeBackup(respNumber, this.#logger)\n\n if (respNumber > $ct.globalCache.REQ_N) {\n // request for some other user so ignore\n return\n }\n\n if (!isValueValid(this.#device.gcookie)) {\n if (global) {\n newGuid = true\n }\n }\n\n if (!isValueValid(this.#device.gcookie) || resume || typeof optOutResponse === 'boolean') {\n const sessionObj = this.#session.getSessionCookieObject()\n\n /* If the received session is less than the session in the cookie,\n then don't update guid as it will be response for old request\n */\n if (window.isOULInProgress || (sessionObj.s && (session < sessionObj.s))) {\n return\n }\n this.#logger.debug(`Cookie was ${this.#device.gcookie} set to ${global}`)\n this.#device.gcookie = global\n if (!isValueValid(this.#device.gcookie)) {\n // clear useIP meta prop\n StorageManager.getAndClearMetaProp(USEIP_KEY)\n }\n if (global && StorageManager._isLocalStorageSupported()) {\n if ($ct.LRU_CACHE == null) {\n $ct.LRU_CACHE = new LRUCache(LRU_CACHE_SIZE)\n }\n\n const kIdFromLS = StorageManager.readFromLSorCookie(KCOOKIE_NAME)\n let guidFromLRUCache\n if (kIdFromLS != null && kIdFromLS.id) {\n guidFromLRUCache = $ct.LRU_CACHE.cache[kIdFromLS.id]\n if (resume) {\n if (!guidFromLRUCache) {\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, true)\n // replace login identity in OUL request\n // with the gcookie returned in exchange\n $ct.LRU_CACHE.set(kIdFromLS.id, global)\n }\n }\n }\n\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, global)\n // lastk provides the guid\n const lastK = $ct.LRU_CACHE.getSecondLastKey()\n if (StorageManager.readFromLSorCookie(FIRE_PUSH_UNREGISTERED) && lastK !== -1) {\n const lastGUID = $ct.LRU_CACHE.cache[lastK]\n // fire the request directly via fireRequest to unregister the token\n // then other requests with the updated guid should follow\n this.#request.unregisterTokenForGuid(lastGUID)\n }\n }\n StorageManager.createBroadCookie(GCOOKIE_NAME, global, COOKIE_EXPIRY, window.location.hostname)\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, global)\n }\n\n if (StorageManager._isLocalStorageSupported()) {\n this.#session.manageSession(session)\n }\n\n // session cookie\n const obj = this.#session.getSessionCookieObject()\n\n // for the race-condition where two responses come back with different session ids. don't write the older session id.\n if (typeof obj.s === 'undefined' || obj.s <= session) {\n obj.s = session\n obj.t = getNow() // time of last response from server\n this.#session.setSessionCookieObject(obj)\n }\n\n // set blockRequest to false only if the device has a valid gcookie\n if (isValueValid(this.#device.gcookie)) {\n $ct.blockRequest = false\n }\n\n // only process the backup events after an OUL request or a new guid is recieved\n if ((oulReq || newGuid) && !this.#request.processingBackup) {\n this.#request.processBackupEvents()\n }\n\n $ct.globalCache.RESP_N = respNumber\n }\n}\n","import { isValueValid } from '../util/datatypes'\nimport { StorageManager } from '../util/storage'\nimport { GCOOKIE_NAME, COOKIE_EXPIRY } from '../util/constants'\n\nexport default class DeviceManager {\n #logger\n gcookie\n\n constructor ({ logger }) {\n this.#logger = logger\n this.gcookie = this.getGuid()\n }\n\n getGuid () {\n let guid = null\n if (isValueValid(this.gcookie)) {\n return this.gcookie\n }\n if (StorageManager._isLocalStorageSupported()) {\n const value = StorageManager.read(GCOOKIE_NAME)\n if (isValueValid(value)) {\n try {\n guid = JSON.parse(decodeURIComponent(value))\n } catch (e) {\n this.#logger.debug('Cannot parse Gcookie from localstorage - must be encoded ' + value)\n // assumming guids are of size 32. supporting both formats.\n // guid can have encodedURIComponent or be without it.\n // 1.56e4078ed15749928c042479ec2b4d47 - breaks on JSON.parse(decodeURIComponent())\n // 2.%2256e4078ed15749928c042479ec2b4d47%22\n if (value.length === 32) {\n guid = value\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, value)\n } else {\n this.#logger.error('Illegal guid ' + value)\n }\n }\n\n // Persist to cookie storage if not present there.\n if (isValueValid(guid)) {\n StorageManager.createBroadCookie(GCOOKIE_NAME, guid, COOKIE_EXPIRY, window.location.hostname)\n }\n }\n }\n\n if (!isValueValid(guid)) {\n guid = StorageManager.readCookie(GCOOKIE_NAME)\n if (isValueValid(guid) && (guid.indexOf('%') === 0 || guid.indexOf('\\'') === 0 || guid.indexOf('\"') === 0)) {\n guid = null\n }\n if (isValueValid(guid)) {\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, guid)\n }\n }\n\n return guid\n }\n}\n","export const DATA_NOT_SENT_TEXT = 'This property has been ignored.'\nexport const INVALID_ACCOUNT = 'Invalid account ID'\nexport const INVALID_EVENT = 'Event structure not valid. Unable to process event'\nexport const CLEVERTAP_ERROR_PREFIX = 'CleverTap error:' // Formerly wzrk_error_txt\nexport const EMBED_ERROR = `${CLEVERTAP_ERROR_PREFIX} Incorrect embed script.`\nexport const EVENT_ERROR = `${CLEVERTAP_ERROR_PREFIX} Event structure not valid. ${DATA_NOT_SENT_TEXT}`\nexport const GENDER_ERROR = `${CLEVERTAP_ERROR_PREFIX} Gender value should be either M or F. ${DATA_NOT_SENT_TEXT}`\nexport const EMPLOYED_ERROR = `${CLEVERTAP_ERROR_PREFIX} Employed value should be either Y or N. ${DATA_NOT_SENT_TEXT}`\nexport const MARRIED_ERROR = `${CLEVERTAP_ERROR_PREFIX} Married value should be either Y or N. ${DATA_NOT_SENT_TEXT}`\nexport const EDUCATION_ERROR = `${CLEVERTAP_ERROR_PREFIX} Education value should be either School, College or Graduate. ${DATA_NOT_SENT_TEXT}`\nexport const AGE_ERROR = `${CLEVERTAP_ERROR_PREFIX} Age value should be a number. ${DATA_NOT_SENT_TEXT}`\nexport const DOB_ERROR = `${CLEVERTAP_ERROR_PREFIX} DOB value should be a Date Object`\nexport const OBJECT_ARRAY_ERROR = `${CLEVERTAP_ERROR_PREFIX} Expecting Object array in profile`\nexport const DATE_FORMAT_ERROR = `${CLEVERTAP_ERROR_PREFIX} setDate(number). number should be formatted as yyyymmdd`\nexport const ENUM_FORMAT_ERROR = `${CLEVERTAP_ERROR_PREFIX} setEnum(value). value should be a string or a number`\nexport const PHONE_FORMAT_ERROR = `${CLEVERTAP_ERROR_PREFIX} Phone number should be formatted as +[country code][number]`\n","import { isObject, isDateObject, isString, isNumber } from './datatypes'\nimport { convertToWZRKDate } from './datetime'\nimport { CHARGED_ID, CHARGEDID_COOKIE_NAME } from './constants'\nimport { StorageManager } from './storage'\n\nlet _globalChargedId\n\nexport const isEventStructureFlat = (eventObj) => {\n // Events cannot have nested structure or Arrays\n if (isObject(eventObj)) {\n for (var key in eventObj) {\n if (eventObj.hasOwnProperty(key)) {\n if (isObject(eventObj[key]) || Array.isArray(eventObj[key])) {\n return false\n } else if (isDateObject(eventObj[key])) {\n eventObj[key] = convertToWZRKDate(eventObj[key])\n }\n }\n }\n return true\n }\n return false\n}\n\nexport const isChargedEventStructureValid = (chargedObj, logger) => {\n if (isObject(chargedObj)) {\n for (var key in chargedObj) {\n if (chargedObj.hasOwnProperty(key)) {\n if (key === 'Items') {\n if (!Array.isArray(chargedObj[key])) {\n return false\n }\n\n if (chargedObj[key].length > 50) {\n logger.reportError(522, 'Charged Items exceed 50 limit. Actual count: ' + chargedObj[key].length)\n }\n\n for (var itemKey in chargedObj[key]) {\n if (chargedObj[key].hasOwnProperty(itemKey)) { // since default array implementation could be overridden - e.g. Teabox site\n if (!isObject(chargedObj[key][itemKey]) || !isEventStructureFlat(chargedObj[key][itemKey])) {\n return false\n }\n }\n }\n } else {\n if (isObject(chargedObj[key]) || Array.isArray(chargedObj[key])) {\n return false\n } else if (isDateObject(chargedObj[key])) {\n chargedObj[key] = convertToWZRKDate(chargedObj[key])\n }\n }\n }\n }\n\n if (isString(chargedObj[CHARGED_ID]) || isNumber(chargedObj[CHARGED_ID])) {\n // save charged Id\n const chargedId = chargedObj[CHARGED_ID] + '' // casting chargedId to string\n\n if (typeof _globalChargedId === 'undefined') {\n _globalChargedId = StorageManager.readFromLSorCookie(CHARGEDID_COOKIE_NAME)\n }\n if (typeof _globalChargedId !== 'undefined' && _globalChargedId.trim() === chargedId.trim()) {\n // drop event- duplicate charged id\n logger.error('Duplicate charged Id - Dropped' + chargedObj)\n return false\n }\n _globalChargedId = chargedId\n StorageManager.saveToLSorCookie(CHARGEDID_COOKIE_NAME, chargedId)\n }\n return true\n } // if object (chargedObject)\n return false\n}\n","import { isString, isObject, sanitize } from '../util/datatypes'\nimport { EVENT_ERROR } from '../util/messages'\nimport { EV_COOKIE, SYSTEM_EVENTS, unsupportedKeyCharRegex } from '../util/constants'\nimport { isChargedEventStructureValid, isEventStructureFlat } from '../util/validator'\nimport { StorageManager, $ct } from '../util/storage'\n\nexport default class EventHandler extends Array {\n #logger\n #oldValues\n #request\n #isPersonalisationActive\n\n constructor ({ logger, request, isPersonalisationActive }, values) {\n super()\n this.#logger = logger\n this.#oldValues = values\n this.#request = request\n this.#isPersonalisationActive = isPersonalisationActive\n }\n\n push (...eventsArr) {\n this.#processEventArray(eventsArr)\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#processEventArray(this.#oldValues)\n }\n this.#oldValues = null\n }\n\n #processEventArray (eventsArr) {\n if (Array.isArray(eventsArr)) {\n while (eventsArr.length > 0) {\n var eventName = eventsArr.shift()\n if (!isString(eventName)) {\n this.#logger.error(EVENT_ERROR)\n continue\n }\n\n if (eventName.length > 1024) {\n eventName = eventName.substring(0, 1024)\n this.#logger.reportError(510, eventName + '... length exceeded 1024 chars. Trimmed.')\n }\n\n if (SYSTEM_EVENTS.includes(eventName)) {\n this.#logger.reportError(513, eventName + ' is a restricted system event. It cannot be used as an event name.')\n continue\n }\n\n const data = {}\n data.type = 'event'\n data.evtName = sanitize(eventName, unsupportedKeyCharRegex)\n\n if (eventsArr.length !== 0) {\n const eventObj = eventsArr.shift()\n if (!isObject(eventObj)) {\n // put it back if it is not an object\n eventsArr.unshift(eventObj)\n } else {\n // check Charged Event vs. other events.\n if (eventName === 'Charged') {\n if (!isChargedEventStructureValid(eventObj, this.#logger)) {\n this.#logger.reportError(511, 'Charged event structure invalid. Not sent.')\n continue\n }\n } else {\n if (!isEventStructureFlat(eventObj)) {\n this.#logger.reportError(512, eventName + ' event structure invalid. Not sent.')\n continue\n }\n }\n data.evtData = eventObj\n }\n }\n\n this.#request.processEvent(data)\n }\n }\n }\n\n getDetails (evtName) {\n if (!this.#isPersonalisationActive()) {\n return\n }\n if (typeof $ct.globalEventsMap === 'undefined') {\n $ct.globalEventsMap = StorageManager.readFromLSorCookie(EV_COOKIE)\n }\n if (typeof $ct.globalEventsMap === 'undefined') {\n return\n }\n const evtObj = $ct.globalEventsMap[evtName]\n const respObj = {}\n if (typeof evtObj !== 'undefined') {\n respObj.firstTime = new Date(evtObj[1] * 1000)\n respObj.lastTime = new Date(evtObj[2] * 1000)\n respObj.count = evtObj[0]\n return respObj\n }\n }\n}\n","export const getURLParams = (url) => {\n const urlParams = {}\n const idx = url.indexOf('?')\n\n if (idx > 1) {\n const uri = url.substring(idx + 1)\n let match\n const pl = /\\+/g // Regex for replacing addition symbol with a space\n const search = /([^&=]+)=?([^&]*)/g\n const decode = function (s) {\n let replacement = s.replace(pl, ' ')\n try {\n replacement = decodeURIComponent(replacement)\n } catch (e) {\n // eat\n }\n return replacement\n }\n match = search.exec(uri)\n while (match) {\n urlParams[decode(match[1])] = decode(match[2])\n match = search.exec(uri)\n }\n }\n return urlParams\n}\n\nexport const getDomain = (url) => {\n if (url === '') return ''\n var a = document.createElement('a')\n a.href = url\n return a.hostname\n}\n\nexport const addToURL = (url, k, v) => {\n return url + '&' + k + '=' + encodeURIComponent(v)\n}\n\nexport const getHostName = () => {\n return window.location.hostname\n}\n","/* eslint-disable */\nexport const urlBase64ToUint8Array = (base64String) => {\n let padding = '='.repeat((4 - base64String.length % 4) % 4)\n let base64 = (base64String + padding)\n .replace(/\\-/g, '+')\n .replace(/_/g, '/')\n\n let rawData = window.atob(base64)\n let processedData = []\n for (let i=0; i {\n logger && typeof logger.debug === 'function' && logger.debug('dobj:' + dataObject)\n return compressToBase64(dataObject)\n}\n\nexport const compress = (uncompressed) => {\n if (uncompressed == null) return ''\n let i, value,\n context_dictionary = {},\n context_dictionaryToCreate = {},\n context_c = '',\n context_wc = '',\n context_w = '',\n context_enlargeIn = 2, // Compensate for the first entry which should not count\n context_dictSize = 3,\n context_numBits = 2,\n context_data_string = '',\n context_data_val = 0,\n context_data_position = 0,\n ii,\n f = String.fromCharCode\n\n for (ii = 0; ii < uncompressed.length; ii += 1) {\n context_c = uncompressed.charAt(ii)\n if (!Object.prototype.hasOwnProperty.call(context_dictionary, context_c)) {\n context_dictionary[context_c] = context_dictSize++\n context_dictionaryToCreate[context_c] = true\n }\n\n context_wc = context_w + context_c\n if (Object.prototype.hasOwnProperty.call(context_dictionary, context_wc)) {\n context_w = context_wc\n } else {\n if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {\n if (context_w.charCodeAt(0) < 256) {\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n }\n value = context_w.charCodeAt(0)\n for (i = 0; i < 8; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n } else {\n value = 1\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1) | value\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = 0\n }\n value = context_w.charCodeAt(0)\n for (i = 0; i < 16; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n }\n context_enlargeIn--\n if (context_enlargeIn == 0) {\n context_enlargeIn = Math.pow(2, context_numBits)\n context_numBits++\n }\n delete context_dictionaryToCreate[context_w]\n } else {\n value = context_dictionary[context_w];\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0;\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n\n\n }\n context_enlargeIn--\n if (context_enlargeIn == 0) {\n context_enlargeIn = Math.pow(2, context_numBits)\n context_numBits++\n }\n // Add wc to the dictionary.\n context_dictionary[context_wc] = context_dictSize++\n context_w = String(context_c)\n }\n }\n\n // Output the code for w.\n if (context_w !== '') {\n if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {\n if (context_w.charCodeAt(0) < 256) {\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n }\n value = context_w.charCodeAt(0)\n for (i = 0; i < 8; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n } else {\n value = 1\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1) | value\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = 0\n }\n value = context_w.charCodeAt(0);\n for (i = 0; i < 16; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n }\n context_enlargeIn--\n if (context_enlargeIn == 0) {\n context_enlargeIn = Math.pow(2, context_numBits)\n context_numBits++\n }\n delete context_dictionaryToCreate[context_w]\n } else {\n value = context_dictionary[context_w]\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n\n\n }\n context_enlargeIn--\n if (context_enlargeIn == 0) {\n context_enlargeIn = Math.pow(2, context_numBits)\n context_numBits++\n }\n }\n\n // Mark the end of the stream\n value = 2\n for (i = 0; i < context_numBits; i++) {\n context_data_val = (context_data_val << 1) | (value & 1)\n if (context_data_position == 15) {\n context_data_position = 0\n context_data_string += f(context_data_val)\n context_data_val = 0\n } else {\n context_data_position++\n }\n value = value >> 1\n }\n\n // Flush the last char\n while (true) {\n context_data_val = (context_data_val << 1)\n if (context_data_position == 15) {\n context_data_string += f(context_data_val)\n break\n } else context_data_position++\n }\n return context_data_string\n}\n\nexport const getKeyStr = () => {\n let key = ''\n let i = 0\n\n for (i = 0; i <= 25; i++) {\n key = key + String.fromCharCode(i + 65)\n }\n\n for (i = 0; i <= 25; i++) {\n key = key + String.fromCharCode(i + 97)\n }\n\n for (i = 0; i < 10; i++) {\n key = key + i\n }\n\n return key + '+/='\n}\n\nconst _keyStr = getKeyStr()\n\nexport const convertToFormattedHex = (byte_arr) => {\n let hex_str = '',\n i,\n len,\n tmp_hex\n\n if (!Array.isArray(byte_arr)) {\n return false\n }\n\n len = byte_arr.length\n\n for (i = 0; i < len; ++i) {\n if (byte_arr[i] < 0) {\n byte_arr[i] = byte_arr[i] + 256\n }\n if (byte_arr[i] === undefined) {\n byte_arr[i] = 0\n }\n tmp_hex = byte_arr[i].toString(16)\n\n if (tmp_hex.length == 1) tmp_hex = '0' + tmp_hex // Add leading zero.\n\n // beautification - needed if you're printing this in the console, else keep commented\n // if ((i + 1) % 16 === 0) {\n // tmp_hex += \"\\n\";\n // } else {\n // tmp_hex += \" \";\n // }\n\n hex_str += tmp_hex\n }\n\n return hex_str.trim()\n}\n\nexport const convertStringToHex = (s) => {\n let byte_arr = []\n for (let i = 0; i < s.length; i++) {\n let value = s.charCodeAt(i)\n byte_arr.push(value & 255)\n byte_arr.push((value >> 8) & 255)\n }\n return convertToFormattedHex(byte_arr)\n}\n\nexport const compressToBase64 = (input) => {\n if (input == null) return ''\n var output = ''\n var chr1, chr2, chr3, enc1, enc2, enc3, enc4\n var i = 0\n\n input = compress(input)\n\n while (i < input.length * 2) {\n\n if (i % 2 == 0) {\n chr1 = input.charCodeAt(i / 2) >> 8\n chr2 = input.charCodeAt(i / 2) & 255\n if (i / 2 + 1 < input.length)\n chr3 = input.charCodeAt(i / 2 + 1) >> 8\n else\n chr3 = NaN\n } else {\n chr1 = input.charCodeAt((i - 1) / 2) & 255\n if ((i + 1) / 2 < input.length) {\n chr2 = input.charCodeAt((i + 1) / 2) >> 8\n chr3 = input.charCodeAt((i + 1) / 2) & 255\n } else\n chr2 = chr3 = NaN\n }\n i += 3\n\n enc1 = chr1 >> 2;\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4)\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6)\n enc4 = chr3 & 63\n\n if (isNaN(chr2)) {\n enc3 = enc4 = 64\n } else if (isNaN(chr3)) {\n enc4 = 64\n }\n\n output = output +\n _keyStr.charAt(enc1) + _keyStr.charAt(enc2) +\n _keyStr.charAt(enc3) + _keyStr.charAt(enc4)\n\n }\n\n return output\n}\n","\nimport { ARP_COOKIE, MAX_TRIES, OPTOUT_COOKIE_ENDSWITH, USEIP_KEY, MAX_DELAY_FREQUENCY, PUSH_DELAY_MS, WZRK_FETCH } from './constants'\nimport { isString, isValueValid } from './datatypes'\nimport { compressData } from './encoder'\nimport { StorageManager, $ct } from './storage'\nimport { addToURL } from './url'\n\nexport default class RequestDispatcher {\n static logger\n static device\n static account\n networkRetryCount = 0\n minDelayFrequency = 0\n\n // ANCHOR - Requests get fired from here\n static #fireRequest (url, tries, skipARP, sendOULFlag, evtName) {\n if (this.#dropRequestDueToOptOut()) {\n this.logger.debug('req dropped due to optout cookie: ' + this.device.gcookie)\n return\n }\n\n // set a request in progress\n // so that if gcookie is not present, no other request can be made asynchronusly\n if (!isValueValid(this.device.gcookie)) {\n $ct.blockRequest = true\n }\n /**\n * if the gcookie is null\n * and the request is not the first request\n * and the tries are less than max tries\n * keep retrying\n */\n\n if (evtName && evtName === WZRK_FETCH) {\n // New retry mechanism\n if (!isValueValid(this.device.gcookie) && ($ct.globalCache.RESP_N < $ct.globalCache.REQ_N - 1)) {\n setTimeout(() => {\n this.logger.debug(`retrying fire request for url: ${url}, tries: ${this.networkRetryCount}`)\n this.#fireRequest(url, undefined, skipARP, sendOULFlag)\n }, this.getDelayFrequency())\n }\n } else {\n if (!isValueValid(this.device.gcookie) &&\n ($ct.globalCache.RESP_N < $ct.globalCache.REQ_N - 1) &&\n tries < MAX_TRIES) {\n // if ongoing First Request is in progress, initiate retry\n setTimeout(() => {\n this.logger.debug(`retrying fire request for url: ${url}, tries: ${tries}`)\n this.#fireRequest(url, tries + 1, skipARP, sendOULFlag)\n }, 50)\n return\n }\n }\n\n // set isOULInProgress to true\n // when sendOULFlag is set to true\n if (!sendOULFlag) {\n if (isValueValid(this.device.gcookie)) {\n // add gcookie to url\n url = addToURL(url, 'gc', this.device.gcookie)\n }\n url = this.#addARPToRequest(url, skipARP)\n } else {\n window.isOULInProgress = true\n }\n\n url = addToURL(url, 'tries', tries) // Add tries to URL\n\n url = this.#addUseIPToRequest(url)\n url = addToURL(url, 'r', new Date().getTime()) // add epoch to beat caching of the URL\n // TODO: Figure out a better way to handle plugin check\n if (window.clevertap?.hasOwnProperty('plugin') || window.wizrocket?.hasOwnProperty('plugin')) {\n // used to add plugin name in request parameter\n const plugin = window.clevertap.plugin || window.wizrocket.plugin\n url = addToURL(url, 'ct_pl', plugin)\n }\n if (url.indexOf('chrome-extension:') !== -1) {\n url = url.replace('chrome-extension:', 'https:')\n }\n // TODO: Try using Function constructor instead of appending script.\n var ctCbScripts = document.getElementsByClassName('ct-jp-cb')\n while (ctCbScripts[0] && ctCbScripts[0].parentNode) {\n ctCbScripts[0].parentNode.removeChild(ctCbScripts[0])\n }\n const s = document.createElement('script')\n s.setAttribute('type', 'text/javascript')\n s.setAttribute('src', url)\n s.setAttribute('class', 'ct-jp-cb')\n s.setAttribute('rel', 'nofollow')\n s.async = true\n document.getElementsByTagName('head')[0].appendChild(s)\n this.logger.debug('req snt -> url: ' + url)\n }\n\n /**\n *\n * @param {string} url\n * @param {*} skipARP\n * @param {boolean} sendOULFlag\n */\n static fireRequest (url, skipARP, sendOULFlag, evtName) {\n this.#fireRequest(url, 1, skipARP, sendOULFlag, evtName)\n }\n\n static #dropRequestDueToOptOut () {\n if ($ct.isOptInRequest || !isValueValid(this.device.gcookie) || !isString(this.device.gcookie)) {\n $ct.isOptInRequest = false\n return false\n }\n return this.device.gcookie.slice(-3) === OPTOUT_COOKIE_ENDSWITH\n }\n\n static #addUseIPToRequest (pageLoadUrl) {\n var useIP = StorageManager.getMetaProp(USEIP_KEY)\n if (typeof useIP !== 'boolean') {\n useIP = false\n }\n return addToURL(pageLoadUrl, USEIP_KEY, useIP ? 'true' : 'false')\n };\n\n static #addARPToRequest (url, skipResARP) {\n if (skipResARP === true) {\n const _arp = {}\n _arp.skipResARP = true\n return addToURL(url, 'arp', compressData(JSON.stringify(_arp), this.logger))\n }\n if (StorageManager._isLocalStorageSupported() && typeof localStorage.getItem(ARP_COOKIE) !== 'undefined' && localStorage.getItem(ARP_COOKIE) !== null) {\n return addToURL(url, 'arp', compressData(JSON.stringify(StorageManager.readFromLSorCookie(ARP_COOKIE)), this.logger))\n }\n return url\n }\n\n getDelayFrequency () {\n this.logger.debug('Network retry #' + this.networkRetryCount)\n\n // Retry with delay as 1s for first 10 retries\n if (this.networkRetryCount < 10) {\n this.logger.debug(this.account.id, 'Failure count is ' + this.networkRetryCount + '. Setting delay frequency to 1s')\n this.minDelayFrequency = PUSH_DELAY_MS // Reset minimum delay to 1s\n return this.minDelayFrequency\n }\n\n if (this.account.region == null) {\n // Retry with delay as 1s if region is null in case of eu1\n this.logger.debug(this.account.id, 'Setting delay frequency to 1s')\n return PUSH_DELAY_MS\n } else {\n // Retry with delay as minimum delay frequency and add random number of seconds to scatter traffic\n const randomDelay = (Math.floor(Math.random() * 10) + 1) * 1000\n this.minDelayFrequency += randomDelay\n if (this.minDelayFrequency < MAX_DELAY_FREQUENCY) {\n this.logger.debug(this.account.id, 'Setting delay frequency to ' + this.minDelayFrequency)\n return this.minDelayFrequency\n } else {\n this.minDelayFrequency = PUSH_DELAY_MS\n }\n this.logger.debug(this.account.id, 'Setting delay frequency to ' + this.minDelayFrequency)\n return this.minDelayFrequency\n }\n }\n}\n","// CleverTap specific utilities\n\nimport {\n StorageManager,\n $ct\n} from './storage'\nimport {\n CAMP_COOKIE_NAME,\n singleQuoteRegex,\n PR_COOKIE,\n ARP_COOKIE,\n GCOOKIE_NAME,\n IS_OUL,\n categoryLongKey,\n CAMP_COOKIE_G,\n GLOBAL\n} from './constants'\nimport {\n GENDER_ERROR,\n EMPLOYED_ERROR,\n MARRIED_ERROR,\n EDUCATION_ERROR,\n AGE_ERROR,\n DOB_ERROR,\n PHONE_FORMAT_ERROR,\n ENUM_FORMAT_ERROR\n} from './messages'\nimport {\n getToday,\n convertToWZRKDate,\n setDate,\n getNow\n} from './datetime'\nimport {\n isObject,\n isDateObject,\n isConvertibleToNumber,\n isObjectEmpty,\n isString,\n isNumber,\n isValueValid\n} from './datatypes'\n\nimport { addToURL, getURLParams } from './url'\nimport { compressData } from './encoder'\nimport RequestDispatcher from './requestDispatcher'\n\nexport const getCampaignObject = () => {\n let finalcampObj = {}\n if (StorageManager._isLocalStorageSupported()) {\n let campObj = StorageManager.read(CAMP_COOKIE_NAME)\n if (campObj != null) {\n campObj = JSON.parse(decodeURIComponent(campObj).replace(singleQuoteRegex, '\\\"'))\n if (campObj.hasOwnProperty('global')) {\n finalcampObj.wp = campObj\n } else {\n finalcampObj = campObj\n }\n } else {\n finalcampObj = {}\n }\n }\n return finalcampObj\n}\n\nexport const saveCampaignObject = (campaignObj) => {\n if (StorageManager._isLocalStorageSupported()) {\n const newObj = { ...getCampaignObject(), ...campaignObj }\n const campObj = JSON.stringify(newObj)\n StorageManager.save(CAMP_COOKIE_NAME, encodeURIComponent(campObj))\n // Update the CAMP_COOKIE_G to be in sync with CAMP_COOKIE_NAME\n setCampaignObjectForGuid()\n }\n}\n\n// set Campaign Object against the guid, with daily count and total count details\nexport const setCampaignObjectForGuid = () => {\n if (StorageManager._isLocalStorageSupported()) {\n let guid = StorageManager.read(GCOOKIE_NAME)\n if (isValueValid(guid)) {\n try {\n guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n const guidCampObj = StorageManager.read(CAMP_COOKIE_G) ? JSON.parse(decodeURIComponent(StorageManager.read(CAMP_COOKIE_G))) : {}\n if (guid && StorageManager._isLocalStorageSupported()) {\n var finalCampObj = {}\n var campObj = getCampaignObject()\n Object.keys(campObj).forEach(key => {\n const campKeyObj = (guid in guidCampObj && Object.keys(guidCampObj[guid]).length && guidCampObj[guid][key]) ? guidCampObj[guid][key] : {}\n const globalObj = campObj[key].global\n const today = getToday()\n const dailyObj = campObj[key][today]\n if (typeof globalObj !== 'undefined') {\n const campaignIdArray = Object.keys(globalObj)\n for (const index in campaignIdArray) {\n let resultObj = []\n if (campaignIdArray.hasOwnProperty(index)) {\n let dailyC = 0\n let totalC = 0\n const campaignId = campaignIdArray[index]\n if (campaignId === 'tc') {\n continue\n }\n if (typeof dailyObj !== 'undefined' && typeof dailyObj[campaignId] !== 'undefined') {\n dailyC = dailyObj[campaignId]\n }\n if (typeof globalObj !== 'undefined' && typeof globalObj[campaignId] !== 'undefined') {\n totalC = globalObj[campaignId]\n }\n resultObj = [campaignId, dailyC, totalC]\n campKeyObj[campaignId] = resultObj\n }\n }\n }\n finalCampObj = { ...finalCampObj, [key]: campKeyObj }\n })\n guidCampObj[guid] = finalCampObj\n StorageManager.save(CAMP_COOKIE_G, encodeURIComponent(JSON.stringify(guidCampObj)))\n }\n } catch (e) {\n console.error('Invalid clevertap Id ' + e)\n }\n }\n }\n}\nexport const getCampaignObjForLc = () => {\n // before preparing data to send to LC , check if the entry for the guid is already there in CAMP_COOKIE_G\n const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n\n let campObj = {}\n if (StorageManager._isLocalStorageSupported()) {\n let resultObj = {}\n campObj = getCampaignObject()\n const storageValue = StorageManager.read(CAMP_COOKIE_G)\n const decodedValue = storageValue ? decodeURIComponent(storageValue) : null\n const parsedValue = decodedValue ? JSON.parse(decodedValue) : null\n\n const resultObjWP = (!!guid &&\n storageValue !== undefined && storageValue !== null &&\n parsedValue && parsedValue[guid] && parsedValue[guid].wp)\n ? Object.values(parsedValue[guid].wp)\n : []\n\n const resultObjWI = (!!guid &&\n storageValue !== undefined && storageValue !== null &&\n parsedValue && parsedValue[guid] && parsedValue[guid].wi)\n ? Object.values(parsedValue[guid].wi)\n : []\n\n const today = getToday()\n let todayCwp = 0\n let todayCwi = 0\n if (campObj.wp && campObj.wp[today] && campObj.wp[today].tc !== 'undefined') {\n todayCwp = campObj.wp[today].tc\n }\n if (campObj.wi && campObj.wi[today] && campObj.wi[today].tc !== 'undefined') {\n todayCwi = campObj.wi[today].tc\n }\n resultObj = {\n wmp: todayCwp,\n wimp: todayCwi,\n tlc: resultObjWP,\n witlc: resultObjWI\n }\n return resultObj\n }\n}\n\nexport const isProfileValid = (profileObj, { logger }) => {\n let valid = false\n if (isObject(profileObj)) {\n for (const profileKey in profileObj) {\n if (profileObj.hasOwnProperty(profileKey)) {\n valid = true\n let profileVal = profileObj[profileKey]\n\n if (profileVal == null) {\n delete profileObj[profileKey]\n continue\n }\n if (profileKey === 'Gender' && !profileVal.match(/^M$|^F$/)) {\n valid = false\n logger.error(GENDER_ERROR)\n }\n\n if (profileKey === 'Employed' && !profileVal.match(/^Y$|^N$/)) {\n valid = false\n logger.error(EMPLOYED_ERROR)\n }\n\n if (profileKey === 'Married' && !profileVal.match(/^Y$|^N$/)) {\n valid = false\n logger.error(MARRIED_ERROR)\n }\n\n if (profileKey === 'Education' && !profileVal.match(/^School$|^College$|^Graduate$/)) {\n valid = false\n logger.error(EDUCATION_ERROR)\n }\n\n if (profileKey === 'Age' && profileVal != null) {\n if (isConvertibleToNumber(profileVal)) {\n profileObj.Age = +profileVal\n } else {\n valid = false\n logger.error(AGE_ERROR)\n }\n }\n // dob will come in like this - $dt_19470815 or dateObject\n if (profileKey === 'DOB') {\n if (((!(/^\\$D_/).test(profileVal) || (profileVal + '').length !== 11)) && !isDateObject(profileVal)) {\n valid = false\n logger.error(DOB_ERROR)\n }\n\n if (isDateObject(profileVal)) {\n profileObj[profileKey] = convertToWZRKDate(profileVal)\n }\n } else if (isDateObject(profileVal)) {\n profileObj[profileKey] = convertToWZRKDate(profileVal)\n }\n\n if (profileKey === 'Phone' && !isObjectEmpty(profileVal)) {\n if (profileVal.length > 8 && (profileVal.charAt(0) === '+')) { // valid phone number\n profileVal = profileVal.substring(1, profileVal.length)\n if (isConvertibleToNumber(profileVal)) {\n profileObj.Phone = +profileVal\n } else {\n valid = false\n logger.error(PHONE_FORMAT_ERROR + '. Removed.')\n }\n } else {\n valid = false\n logger.error(PHONE_FORMAT_ERROR + '. Removed.')\n }\n }\n\n if (!valid) {\n delete profileObj[profileKey]\n }\n }\n }\n }\n return valid\n}\n\nexport const processFBUserObj = (user) => {\n const profileData = {}\n profileData.Name = user.name\n if (user.id != null) {\n profileData.FBID = user.id + ''\n }\n // Feb 2014 - FB announced over 58 gender options, hence we specifically look for male or female. Rest we don't care.\n if (user.gender === 'male') {\n profileData.Gender = 'M'\n } else if (user.gender === 'female') {\n profileData.Gender = 'F'\n } else {\n profileData.Gender = 'O'\n }\n\n const getHighestEducation = function (eduArr) {\n if (eduArr != null) {\n let college = ''\n let highschool = ''\n\n for (let i = 0; i < eduArr.length; i++) {\n const edu = eduArr[i]\n if (edu.type != null) {\n const type = edu.type\n if (type === 'Graduate School') {\n return 'Graduate'\n } else if (type === 'College') {\n college = '1'\n } else if (type === 'High School') {\n highschool = '1'\n }\n }\n }\n\n if (college === '1') {\n return 'College'\n } else if (highschool === '1') {\n return 'School'\n }\n }\n }\n\n if (user.relationship_status != null) {\n profileData.Married = 'N'\n if (user.relationship_status === 'Married') {\n profileData.Married = 'Y'\n }\n }\n\n const edu = getHighestEducation(user.education)\n if (edu != null) {\n profileData.Education = edu\n }\n\n const work = (user.work != null) ? user.work.length : 0\n if (work > 0) {\n profileData.Employed = 'Y'\n } else {\n profileData.Employed = 'N'\n }\n\n if (user.email != null) {\n profileData.Email = user.email\n }\n\n if (user.birthday != null) {\n const mmddyy = user.birthday.split('/') // comes in as \"08/15/1947\"\n profileData.DOB = setDate(mmddyy[2] + mmddyy[0] + mmddyy[1])\n }\n return profileData\n}\n\nexport const processGPlusUserObj = (user, { logger }) => {\n const profileData = {}\n if (user.displayName != null) {\n profileData.Name = user.displayName\n }\n if (user.id != null) {\n profileData.GPID = user.id + ''\n }\n\n if (user.gender != null) {\n if (user.gender === 'male') {\n profileData.Gender = 'M'\n } else if (user.gender === 'female') {\n profileData.Gender = 'F'\n } else if (user.gender === 'other') {\n profileData.Gender = 'O'\n }\n }\n\n if (user.image != null) {\n if (user.image.isDefault === false) {\n profileData.Photo = user.image.url.split('?sz')[0]\n }\n }\n\n if (user.emails != null) {\n for (let emailIdx = 0; emailIdx < user.emails.length; emailIdx++) {\n const emailObj = user.emails[emailIdx]\n if (emailObj.type === 'account') {\n profileData.Email = emailObj.value\n }\n }\n }\n\n if (user.organizations != null) {\n profileData.Employed = 'N'\n for (let i = 0; i < user.organizations.length; i++) {\n const orgObj = user.organizations[i]\n if (orgObj.type === 'work') {\n profileData.Employed = 'Y'\n }\n }\n }\n\n if (user.birthday != null) {\n const yyyymmdd = user.birthday.split('-') // comes in as \"1976-07-27\"\n profileData.DOB = setDate(yyyymmdd[0] + yyyymmdd[1] + yyyymmdd[2])\n }\n\n if (user.relationshipStatus != null) {\n profileData.Married = 'N'\n if (user.relationshipStatus === 'married') {\n profileData.Married = 'Y'\n }\n }\n logger.debug('gplus usr profile ' + JSON.stringify(profileData))\n\n return profileData\n}\n\nexport const addToLocalProfileMap = (profileObj, override) => {\n if (StorageManager._isLocalStorageSupported()) {\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE)\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = {}\n }\n }\n\n // Move props from custom bucket to outside.\n if (profileObj._custom != null) {\n const keys = profileObj._custom\n for (const key in keys) {\n if (keys.hasOwnProperty(key)) {\n profileObj[key] = keys[key]\n }\n }\n delete profileObj._custom\n }\n\n for (const prop in profileObj) {\n if (profileObj.hasOwnProperty(prop)) {\n if ($ct.globalProfileMap.hasOwnProperty(prop) && !override) {\n continue\n }\n $ct.globalProfileMap[prop] = profileObj[prop]\n }\n }\n if ($ct.globalProfileMap._custom != null) {\n delete $ct.globalProfileMap._custom\n }\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n }\n}\n\nexport const closeIframe = (campaignId, divIdIgnored, currentSessionId) => {\n if (campaignId != null && campaignId !== '-1') {\n if (StorageManager._isLocalStorageSupported()) {\n const campaignObj = getCampaignObject()\n\n let sessionCampaignObj = campaignObj.wp[currentSessionId]\n if (sessionCampaignObj == null) {\n sessionCampaignObj = {}\n campaignObj[currentSessionId] = sessionCampaignObj\n }\n sessionCampaignObj[campaignId] = 'dnd'\n saveCampaignObject(campaignObj)\n }\n }\n if ($ct.campaignDivMap != null) {\n const divId = $ct.campaignDivMap[campaignId]\n if (divId != null) {\n document.getElementById(divId).style.display = 'none'\n if (divId === 'intentPreview') {\n if (document.getElementById('intentOpacityDiv') != null) {\n document.getElementById('intentOpacityDiv').style.display = 'none'\n }\n }\n }\n }\n}\n\nexport const arp = (jsonMap) => {\n // For unregister calls dont set arp in LS\n if (jsonMap.skipResARP != null && jsonMap.skipResARP) {\n console.debug('Update ARP Request rejected', jsonMap)\n return null\n }\n\n const isOULARP = jsonMap[IS_OUL] === true\n\n if (StorageManager._isLocalStorageSupported()) {\n // Update arp only if it is null or an oul request\n try {\n let arpFromStorage = StorageManager.readFromLSorCookie(ARP_COOKIE)\n if (arpFromStorage == null || isOULARP) {\n arpFromStorage = {}\n for (const key in jsonMap) {\n if (jsonMap.hasOwnProperty(key)) {\n if (jsonMap[key] === -1) {\n delete arpFromStorage[key]\n } else {\n arpFromStorage[key] = jsonMap[key]\n }\n }\n }\n StorageManager.saveToLSorCookie(ARP_COOKIE, arpFromStorage)\n }\n } catch (e) {\n console.error('Unable to parse ARP JSON: ' + e)\n }\n }\n}\n\nexport const getWrappedLink = (link, targetId, type, request, account, logger) => {\n let data = {}\n data.sendTo = link\n data.targetId = targetId\n data.epoch = getNow()\n\n if (type != null) {\n data.type = type\n } else {\n data.type = 'view'\n }\n\n data = request.addSystemDataToObject(data, undefined)\n return addToURL(account.recorderURL, 'd', compressData(JSON.stringify(data), logger))\n}\n\nexport const getMessageTemplate = () => {\n return `\n
`\n}\n\nexport const getMessageHeadTemplate = () => {\n return `\n \n \n \n \n `\n}\n\nexport const setEnum = (enumVal, logger) => {\n if (isString(enumVal) || isNumber(enumVal)) {\n return '$E_' + enumVal\n }\n logger.error(ENUM_FORMAT_ERROR)\n}\nexport const handleEmailSubscription = (subscription, reEncoded, fetchGroups, account, logger) => {\n const urlParamsAsIs = getURLParams(location.href) // can't use url_params as it is in lowercase above\n const encodedEmailId = urlParamsAsIs.e\n const encodedProfileProps = urlParamsAsIs.p\n const pageType = urlParamsAsIs.page_type\n\n if (typeof encodedEmailId !== 'undefined') {\n const data = {}\n data.id = account.id // accountId\n data.unsubGroups = $ct.unsubGroups // unsubscribe groups\n\n if ($ct.updatedCategoryLong) {\n data[categoryLongKey] = $ct.updatedCategoryLong\n }\n\n let url = account.emailURL\n if (fetchGroups) {\n url = addToURL(url, 'fetchGroups', fetchGroups)\n }\n if (reEncoded) {\n url = addToURL(url, 'encoded', reEncoded)\n }\n url = addToURL(url, 'e', encodedEmailId)\n url = addToURL(url, 'd', compressData(JSON.stringify(data), logger))\n if (encodedProfileProps) {\n url = addToURL(url, 'p', encodedProfileProps)\n }\n\n if (subscription !== '-1') {\n url = addToURL(url, 'sub', subscription)\n }\n\n if (pageType) {\n $ct.globalUnsubscribe = pageType === GLOBAL\n url = addToURL(url, 'page_type', pageType)\n }\n RequestDispatcher.fireRequest(url)\n }\n}\n","import {\n isObjectEmpty\n} from '../util/datatypes'\nimport {\n isProfileValid,\n processFBUserObj,\n processGPlusUserObj,\n addToLocalProfileMap\n} from '../util/clevertap'\nimport {\n COMMAND_DELETE,\n COMMAND_INCREMENT,\n EVT_PUSH,\n PR_COOKIE\n} from '../util/constants'\nimport {\n addToURL\n} from '../util/url'\nimport {\n StorageManager,\n $ct\n} from '../util/storage'\nimport { compressData } from '../util/encoder'\nexport default class ProfileHandler extends Array {\n #logger\n #request\n #account\n #oldValues\n #isPersonalisationActive\n\n constructor ({\n logger,\n request,\n account,\n isPersonalisationActive\n }, values) {\n super()\n this.#logger = logger\n this.#request = request\n this.#account = account\n this.#oldValues = values\n this.#isPersonalisationActive = isPersonalisationActive\n }\n\n push (...profilesArr) {\n this.#processProfileArray(profilesArr)\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#processProfileArray(this.#oldValues)\n }\n this.#oldValues = null\n }\n\n getAttribute (propName) {\n if (!this.#isPersonalisationActive()) {\n return\n }\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE)\n }\n if ($ct.globalProfileMap != null) {\n return $ct.globalProfileMap[propName]\n }\n }\n\n #processProfileArray (profileArr) {\n if (Array.isArray(profileArr) && profileArr.length > 0) {\n for (const index in profileArr) {\n if (profileArr.hasOwnProperty(index)) {\n const outerObj = profileArr[index]\n let data = {}\n let profileObj\n if (outerObj.Site != null) { // organic data from the site\n profileObj = outerObj.Site\n if (isObjectEmpty(profileObj) || !isProfileValid(profileObj, {\n logger: this.#logger\n })) {\n return\n }\n } else if (outerObj.Facebook != null) { // fb connect data\n const FbProfileObj = outerObj.Facebook\n // make sure that the object contains any data at all\n\n if (!isObjectEmpty(FbProfileObj) && (!FbProfileObj.error)) {\n profileObj = processFBUserObj(FbProfileObj)\n }\n } else if (outerObj['Google Plus'] != null) {\n const GPlusProfileObj = outerObj['Google Plus']\n if (!isObjectEmpty(GPlusProfileObj) && (!GPlusProfileObj.error)) {\n profileObj = processGPlusUserObj(GPlusProfileObj, { logger: this.#logger })\n }\n }\n if (profileObj != null && (!isObjectEmpty(profileObj))) { // profile got set from above\n data.type = 'profile'\n if (profileObj.tz == null) {\n // try to auto capture user timezone if not present\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n\n data.profile = profileObj\n addToLocalProfileMap(profileObj, true)\n data = this.#request.addSystemDataToObject(data, undefined)\n\n this.#request.addFlags(data)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n }\n }\n }\n }\n\n /**\n *\n * @param {any} key\n * @param {number} value\n * @param {string} command\n * increases or decreases value of the number type properties in profile object\n */\n _handleIncrementDecrementValue (key, value, command) {\n // Check if the value is greater than 0\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE)\n }\n if ($ct.globalProfileMap == null && !$ct.globalProfileMap?.hasOwnProperty(key)) {\n // Check if the profile map already has the propery defined\n console.error('Kindly create profile with required proprty to increment/decrement.')\n } else if (!value || typeof value !== 'number' || value <= 0) {\n console.error('Value should be a number greater than 0')\n } else {\n // Update the profile property in local storage\n if (command === COMMAND_INCREMENT) {\n $ct.globalProfileMap[key] = $ct.globalProfileMap[key] + value\n } else {\n $ct.globalProfileMap[key] = $ct.globalProfileMap[key] - value\n }\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n\n // Send the updated value to LC\n let data = {}\n const profileObj = {}\n data.type = 'profile'\n profileObj[key] = { [command]: value }\n if (profileObj.tz == null) {\n // try to auto capture user timezone if not present\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n data.profile = profileObj\n data = this.#request.addSystemDataToObject(data, true)\n\n this.#request.addFlags(data)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n }\n\n /**\n *\n * @param {any} key\n * @param {array} arrayVal\n * @param {string} command\n * overwrites/sets new value(s) against a key/property in profile object\n */\n _handleMultiValueSet (key, arrayVal, command) {\n const array = []\n for (let i = 0; i < arrayVal.length; i++) {\n if (typeof arrayVal[i] === 'number' && !array.includes(arrayVal[i])) {\n array.push(arrayVal[i])\n } else if (typeof arrayVal[i] === 'string' && !array.includes(arrayVal[i].toLowerCase())) {\n array.push(arrayVal[i].toLowerCase())\n } else {\n console.error('array supports only string or number type values')\n }\n }\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE) ?? {}\n }\n $ct.globalProfileMap[key] = array\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n this.sendMultiValueData(key, arrayVal, command)\n }\n\n /**\n *\n * @param {any} propKey - the property name to be added in the profile object\n * @param {string, number, array} propVal - the property value to be added against the @propkey key\n * @param {string} command\n * Adds array or single value against a key/property in profile object\n */\n _handleMultiValueAdd (propKey, propVal, command) {\n // Initialize array\n var array = []\n\n // Check if globalProfileMap is null, initialize if needed\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE) || {}\n }\n\n // Check if the value to be set is either string or number\n if (typeof propVal === 'string' || typeof propVal === 'number') {\n if ($ct.globalProfileMap.hasOwnProperty(propKey)) {\n array = $ct.globalProfileMap[propKey]\n array.push(typeof propVal === 'number' ? propVal : propVal.toLowerCase())\n } else {\n $ct.globalProfileMap[propKey] = propVal\n }\n } else {\n // Check if propVal is an array\n if ($ct.globalProfileMap.hasOwnProperty(propKey)) {\n array = Array.isArray($ct.globalProfileMap[propKey]) ? $ct.globalProfileMap[propKey] : [$ct.globalProfileMap[propKey]]\n }\n\n // Check for case-sensitive inputs and filter the same ones\n for (var i = 0; i < propVal.length; i++) {\n if (typeof propVal[i] === 'number' && !array.includes(propVal[i])) {\n array.push(propVal[i])\n } else if (typeof propVal[i] === 'string' && !array.includes(propVal[i].toLowerCase())) {\n array.push(propVal[i].toLowerCase())\n } else if ((typeof propVal[i] === 'number' && array.includes(propVal[i])) || (typeof propVal[i] === 'string' && array.includes(propVal[i].toLowerCase()))) {\n console.error('Values already included')\n } else {\n console.error('Array supports only string or number type values')\n }\n }\n\n // Update globalProfileMap with the array\n $ct.globalProfileMap[propKey] = array\n }\n\n // Save to local storage or cookie\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n\n // Call the sendMultiValueData function\n this.sendMultiValueData(propKey, propVal, command)\n }\n\n /**\n *\n * @param {any} propKey\n * @param {string, number, array} propVal\n * @param {string} command\n * removes value(s) against a key/property in profile object\n */\n _handleMultiValueRemove (propKey, propVal, command) {\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE)\n }\n if (!$ct?.globalProfileMap?.hasOwnProperty(propKey)) {\n console.error(`The property ${propKey} does not exist.`)\n } else {\n if (typeof propVal === 'string' || typeof propVal === 'number') {\n var index = $ct.globalProfileMap[propKey].indexOf(propVal)\n if (index !== -1) {\n $ct.globalProfileMap[propKey].splice(index, 1)\n }\n } else {\n for (var k = 0; k < propVal.length; k++) {\n var idx = $ct.globalProfileMap[propKey].indexOf(propVal[k])\n if (idx !== -1) {\n $ct.globalProfileMap[propKey].splice(idx, 1)\n }\n }\n }\n }\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n this.sendMultiValueData(propKey, propVal, command)\n }\n\n /**\n *\n * @param {any} propKey\n * @param {string} command\n * deletes a key value pair from the profile object\n */\n _handleMultiValueDelete (propKey, command) {\n if ($ct.globalProfileMap == null) {\n $ct.globalProfileMap = StorageManager.readFromLSorCookie(PR_COOKIE)\n }\n if (!$ct?.globalProfileMap?.hasOwnProperty(propKey)) {\n console.error(`The property ${propKey} does not exist.`)\n } else {\n delete $ct.globalProfileMap[propKey]\n }\n StorageManager.saveToLSorCookie(PR_COOKIE, $ct.globalProfileMap)\n this.sendMultiValueData(propKey, null, command)\n }\n\n sendMultiValueData (propKey, propVal, command) {\n // Send the updated value to LC\n let data = {}\n const profileObj = {}\n data.type = 'profile'\n\n // this removes the property at backend\n profileObj[propKey] = { [command]: command === COMMAND_DELETE ? true : propVal }\n if (profileObj.tz == null) {\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n data.profile = profileObj\n data = this.#request.addSystemDataToObject(data, true)\n this.#request.addFlags(data)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n}\n","import {\n isObject,\n isObjectEmpty\n} from '../util/datatypes'\nimport {\n KCOOKIE_NAME,\n GCOOKIE_NAME,\n EVT_PUSH,\n LRU_CACHE_SIZE,\n IS_OUL,\n CAMP_COOKIE_NAME,\n CHARGEDID_COOKIE_NAME,\n PR_COOKIE,\n EV_COOKIE,\n ARP_COOKIE,\n CLEAR,\n META_COOKIE,\n FIRE_PUSH_UNREGISTERED\n} from '../util/constants'\nimport {\n StorageManager,\n $ct\n} from '../util/storage'\nimport LRUCache from '../util/lruCache'\nimport {\n compressData\n} from '../util/encoder'\nimport {\n addToURL,\n getHostName\n} from '../util/url'\nimport {\n isProfileValid,\n processFBUserObj,\n processGPlusUserObj,\n addToLocalProfileMap\n} from '../util/clevertap'\n\nexport default class UserLoginHandler extends Array {\n #request\n #logger\n #account\n #session\n #oldValues\n #device\n\n constructor ({\n request,\n account,\n session,\n logger,\n device\n },\n values) {\n super()\n this.#request = request\n this.#account = account\n this.#session = session\n this.#logger = logger\n this.#oldValues = values\n this.#device = device\n }\n\n // On User Login\n #processOUL (profileArr) {\n let sendOULFlag = true\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, sendOULFlag)\n const addToK = (ids) => {\n let k = StorageManager.readFromLSorCookie(KCOOKIE_NAME)\n const g = StorageManager.readFromLSorCookie(GCOOKIE_NAME)\n let kId\n if (k == null) {\n k = {}\n kId = ids\n } else {\n /* check if already exists */\n kId = k.id\n let anonymousUser = false\n let foundInCache = false\n if (kId == null) {\n kId = ids[0]\n anonymousUser = true\n }\n if ($ct.LRU_CACHE == null && StorageManager._isLocalStorageSupported()) {\n $ct.LRU_CACHE = new LRUCache(LRU_CACHE_SIZE)\n }\n\n if (anonymousUser) {\n if ((g) != null) {\n // if have gcookie\n $ct.LRU_CACHE.set(kId, g)\n $ct.blockRequest = false\n }\n } else {\n // check if the id is present in the cache\n // set foundInCache to true\n for (const idx in ids) {\n if (ids.hasOwnProperty(idx)) {\n const id = ids[idx]\n if ($ct.LRU_CACHE.cache[id]) {\n kId = id\n foundInCache = true\n break\n }\n }\n }\n }\n\n if (foundInCache) {\n if (kId !== $ct.LRU_CACHE.getLastKey()) {\n // New User found\n // remove the entire cache\n this.#handleCookieFromCache()\n } else {\n sendOULFlag = false\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, sendOULFlag)\n }\n const gFromCache = $ct.LRU_CACHE.get(kId)\n $ct.LRU_CACHE.set(kId, gFromCache)\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, gFromCache)\n this.#device.gcookie = gFromCache\n\n const lastK = $ct.LRU_CACHE.getSecondLastKey()\n if (StorageManager.readFromLSorCookie(FIRE_PUSH_UNREGISTERED) && lastK !== -1) {\n // CACHED OLD USER FOUND. TRANSFER PUSH TOKEN TO THIS USER\n const lastGUID = $ct.LRU_CACHE.cache[lastK]\n this.#request.unregisterTokenForGuid(lastGUID)\n }\n } else {\n if (!anonymousUser) {\n this.clear()\n } else {\n if ((g) != null) {\n this.#device.gcookie = g\n StorageManager.saveToLSorCookie(GCOOKIE_NAME, g)\n sendOULFlag = false\n }\n }\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, false)\n kId = ids[0]\n }\n }\n k.id = kId\n StorageManager.saveToLSorCookie(KCOOKIE_NAME, k)\n }\n\n if (Array.isArray(profileArr) && profileArr.length > 0) {\n for (const index in profileArr) {\n if (profileArr.hasOwnProperty(index)) {\n const outerObj = profileArr[index]\n let data = {}\n let profileObj\n if (outerObj.Site != null) { // organic data from the site\n profileObj = outerObj.Site\n if (isObjectEmpty(profileObj) || !isProfileValid(profileObj, {\n logger: this.#logger\n })) {\n return\n }\n } else if (outerObj.Facebook != null) { // fb connect data\n const FbProfileObj = outerObj.Facebook\n // make sure that the object contains any data at all\n\n if (!isObjectEmpty(FbProfileObj) && (!FbProfileObj.error)) {\n profileObj = processFBUserObj(FbProfileObj)\n }\n } else if (outerObj['Google Plus'] != null) {\n const GPlusProfileObj = outerObj['Google Plus']\n if (isObjectEmpty(GPlusProfileObj) && (!GPlusProfileObj.error)) {\n profileObj = processGPlusUserObj(GPlusProfileObj, { logger: this.#logger })\n }\n }\n if (profileObj != null && (!isObjectEmpty(profileObj))) { // profile got set from above\n data.type = 'profile'\n if (profileObj.tz == null) {\n // try to auto capture user timezone if not present\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n\n data.profile = profileObj\n const ids = []\n if (StorageManager._isLocalStorageSupported()) {\n if (profileObj.Identity) {\n ids.push(profileObj.Identity)\n }\n if (profileObj.Email) {\n ids.push(profileObj.Email)\n }\n if (profileObj.GPID) {\n ids.push('GP:' + profileObj.GPID)\n }\n if (profileObj.FBID) {\n ids.push('FB:' + profileObj.FBID)\n }\n if (ids.length > 0) {\n addToK(ids)\n }\n }\n addToLocalProfileMap(profileObj, true)\n data = this.#request.addSystemDataToObject(data, undefined)\n\n this.#request.addFlags(data)\n // Adding 'isOUL' flag in true for OUL cases which.\n // This flag tells LC to create a new arp object.\n // Also we will receive the same flag in response arp which tells to delete existing arp object.\n if (sendOULFlag) {\n data[IS_OUL] = true\n }\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n // Whenever sendOULFlag is true then dont send arp and gcookie (guid in memory in the request)\n // Also when this flag is set we will get another flag from LC in arp which tells us to delete arp\n // stored in the cache and replace it with the response arp.\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest, sendOULFlag)\n }\n }\n }\n }\n }\n\n clear () {\n this.#logger.debug('clear called. Reset flag has been set.')\n this.#deleteUser()\n StorageManager.setMetaProp(CLEAR, true)\n }\n\n #handleCookieFromCache () {\n $ct.blockRequest = false\n console.debug('Block request is false')\n if (StorageManager._isLocalStorageSupported()) {\n delete localStorage[PR_COOKIE]\n delete localStorage[EV_COOKIE]\n delete localStorage[META_COOKIE]\n delete localStorage[ARP_COOKIE]\n delete localStorage[CAMP_COOKIE_NAME]\n delete localStorage[CHARGEDID_COOKIE_NAME]\n }\n StorageManager.removeCookie(CAMP_COOKIE_NAME, getHostName())\n StorageManager.removeCookie(this.#session.cookieName, $ct.broadDomain)\n StorageManager.removeCookie(ARP_COOKIE, $ct.broadDomain)\n this.#session.setSessionCookieObject('')\n }\n\n #deleteUser () {\n $ct.blockRequest = true\n this.#logger.debug('Block request is true')\n $ct.globalCache = {\n gcookie: null,\n REQ_N: 0,\n RESP_N: 0\n }\n if (StorageManager._isLocalStorageSupported()) {\n delete localStorage[GCOOKIE_NAME]\n delete localStorage[KCOOKIE_NAME]\n delete localStorage[PR_COOKIE]\n delete localStorage[EV_COOKIE]\n delete localStorage[META_COOKIE]\n delete localStorage[ARP_COOKIE]\n delete localStorage[CAMP_COOKIE_NAME]\n delete localStorage[CHARGEDID_COOKIE_NAME]\n }\n StorageManager.removeCookie(GCOOKIE_NAME, $ct.broadDomain)\n StorageManager.removeCookie(CAMP_COOKIE_NAME, getHostName())\n StorageManager.removeCookie(KCOOKIE_NAME, getHostName())\n StorageManager.removeCookie(this.#session.cookieName, $ct.broadDomain)\n StorageManager.removeCookie(ARP_COOKIE, $ct.broadDomain)\n this.#device.gcookie = null\n this.#session.setSessionCookieObject('')\n }\n\n #processLoginArray (loginArr) {\n if (Array.isArray(loginArr) && loginArr.length > 0) {\n const profileObj = loginArr.pop()\n const processProfile = profileObj != null && isObject(profileObj) &&\n ((profileObj.Site != null && Object.keys(profileObj.Site).length > 0) ||\n (profileObj.Facebook != null && Object.keys(profileObj.Facebook).length > 0) ||\n (profileObj['Google Plus'] != null && Object.keys(profileObj['Google Plus']).length > 0))\n if (processProfile) {\n StorageManager.setInstantDeleteFlagInK()\n try {\n this.#processOUL([profileObj])\n } catch (e) {\n this.#logger.debug(e)\n }\n } else {\n this.#logger.error('Profile object is in incorrect format')\n }\n }\n }\n\n push (...profilesArr) {\n this.#processLoginArray(profilesArr)\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#processLoginArray(this.#oldValues)\n }\n this.#oldValues = null\n }\n}\n","export class CTWebPersonalisationBanner extends HTMLElement {\n constructor () {\n super()\n this.shadow = this.attachShadow({ mode: 'open' })\n }\n\n _details = null\n shadow = null\n\n get details () {\n return this._details || ''\n }\n\n set details (val) {\n if (this._details === null) {\n this._details = val\n this.renderBanner()\n }\n }\n\n renderBanner () {\n this.shadow.innerHTML = this.getBannerContent()\n if (this.trackClick !== false) {\n this.addEventListener('click', () => {\n const onClickUrl = this.details.onClick\n if (onClickUrl) {\n this.details.window ? window.open(onClickUrl, '_blank') : window.parent.location.href = onClickUrl\n }\n window.clevertap.renderNotificationClicked({ msgId: this.msgId, pivotId: this.pivotId })\n })\n }\n window.clevertap.renderNotificationViewed({ msgId: this.msgId, pivotId: this.pivotId })\n }\n\n getBannerContent () {\n return `\n \n
\n \n \n \n \"Please\n \n ${this.details.html ? this.details.html : ''}\n
\n `\n }\n}\n","import { CTWebPersonalisationBanner } from './banner'\nexport class CTWebPersonalisationCarousel extends HTMLElement {\n constructor () {\n super()\n this.shadow = this.attachShadow({ mode: 'open' })\n if (customElements.get('ct-web-personalisation-banner') === undefined) {\n customElements.define('ct-web-personalisation-banner', CTWebPersonalisationBanner)\n }\n }\n\n _target = null\n _carousel = null\n shadow = null\n slides = 0\n previouslySelectedItem = -1\n selectedItem = 1\n autoSlide = null\n stopAutoSlideTimeout = null\n\n get target () {\n return this._target || ''\n }\n\n set target (val) {\n if (this._target === null) {\n this._target = val\n this.renderCarousel()\n }\n }\n\n get details () {\n return this.target.display.details\n }\n\n get display () {\n return this.target.display\n }\n\n renderCarousel () {\n this.slides = this.details.length\n this.shadow.innerHTML = this.getStyles()\n const carousel = this.getCarouselContent()\n if (this.display.showNavBtns) {\n carousel.insertAdjacentHTML('beforeend', this.display.navBtnsHtml)\n }\n if (this.display.showNavArrows) {\n carousel.insertAdjacentHTML('beforeend', this.display.leftNavArrowHtml)\n carousel.insertAdjacentHTML('beforeend', this.display.rightNavArrowHtml)\n }\n this._carousel = carousel\n this.shadow.appendChild(carousel)\n this.setupClick()\n this.updateSelectedItem()\n // TODO: enable conditionally\n this.startAutoSlide()\n this.setupOnHover()\n window.clevertap.renderNotificationViewed({ msgId: this.target.wzrk_id, pivotId: this.target.wzrk_pivot })\n }\n\n setupClick () {\n this._carousel.addEventListener('click', (event) => {\n const eventID = event.target.id\n if (eventID.startsWith('carousel__button')) {\n const selected = +eventID.split('-')[1]\n if (selected !== this.selectedItem) {\n this.previouslySelectedItem = this.selectedItem\n this.selectedItem = selected\n this.updateSelectedItem()\n this.startAutoSlide()\n }\n } else if (eventID.startsWith('carousel__arrow')) {\n eventID.endsWith('right') ? this.goToNext() : this.goToPrev()\n this.startAutoSlide()\n } else if (eventID.indexOf('-') > -1) {\n const item = +eventID.split('-')[1]\n const index = item - 1\n if (window.parent.clevertap) {\n // console.log('Raise notification clicked event for ', item)\n window.clevertap.renderNotificationClicked({ msgId: this.target.wzrk_id, pivotId: this.target.wzrk_pivot, wzrk_slideNo: item })\n }\n const url = this.details[index].onClick\n if (url !== '') {\n this.details[index].window ? window.open(url, '_blank') : window.location.href = url\n }\n }\n })\n }\n\n setupOnHover () {\n this._carousel.addEventListener('mouseenter', (event) => {\n this.stopAutoSlideTimeout = setTimeout(() => {\n this.autoSlide = clearInterval(this.autoSlide)\n }, 500)\n })\n\n this._carousel.addEventListener('mouseleave', (event) => {\n clearTimeout(this.stopAutoSlideTimeout)\n if (this.autoSlide === undefined) {\n this.startAutoSlide()\n }\n })\n }\n\n getCarouselContent () {\n const carousel = document.createElement('div')\n carousel.setAttribute('class', 'carousel')\n\n this.details.forEach((detail, i) => {\n const banner = document.createElement('ct-web-personalisation-banner')\n banner.classList.add('carousel__item')\n banner.trackClick = false\n banner.setAttribute('id', `carousel__item-${i + 1}`)\n banner.details = detail\n carousel.appendChild(banner)\n })\n\n return carousel\n }\n\n getStyles () {\n return `\n \n `\n }\n\n updateSelectedItem () {\n if (this.previouslySelectedItem !== -1) {\n const prevItem = this.shadow.getElementById(`carousel__item-${this.previouslySelectedItem}`)\n const prevButton = this.shadow.getElementById(`carousel__button-${this.previouslySelectedItem}`)\n prevItem.classList.remove('carousel__item--selected')\n if (prevButton) {\n prevButton.classList.remove('carousel__button--selected')\n }\n }\n const item = this.shadow.getElementById(`carousel__item-${this.selectedItem}`)\n const button = this.shadow.getElementById(`carousel__button-${this.selectedItem}`)\n item.classList.add('carousel__item--selected')\n if (button) {\n button.classList.add('carousel__button--selected')\n }\n }\n\n startAutoSlide () {\n clearInterval(this.autoSlide)\n this.autoSlide = setInterval(() => {\n this.goToNext()\n }, this.display.sliderTime ? this.display.sliderTime * 1000 : 3000)\n }\n\n goToNext () {\n this.goTo(this.selectedItem, (this.selectedItem + 1) % this.slides)\n }\n\n goToPrev () {\n this.goTo(this.selectedItem, this.selectedItem - 1)\n }\n\n goTo (prev, cur) {\n this.previouslySelectedItem = prev\n this.selectedItem = cur\n if (cur === 0) {\n this.selectedItem = this.slides\n }\n this.updateSelectedItem()\n }\n}\n","import {\n getCampaignObject,\n saveCampaignObject\n} from '../clevertap'\nimport { StorageManager } from '../storage'\n\nexport class CTWebPopupImageOnly extends HTMLElement {\n constructor () {\n super()\n this.shadow = this.attachShadow({ mode: 'open' })\n }\n\n _target = null\n _session = null\n shadow = null\n popup = null\n container = null\n resizeObserver = null\n\n get target () {\n return this._target || ''\n }\n\n set target (val) {\n if (this._target === null) {\n this._target = val\n this.renderImageOnlyPopup()\n }\n }\n\n get session () {\n return this._session || ''\n }\n\n set session (val) {\n this._session = val\n }\n\n get msgId () {\n return this.target.wzrk_id\n }\n\n get pivotId () {\n return this.target.wzrk_pivot\n }\n\n get onClickUrl () {\n return this.target.display.onClickUrl\n }\n\n renderImageOnlyPopup () {\n const campaignId = this.target.wzrk_id.split('_')[0]\n const currentSessionId = this.session.sessionId\n\n this.shadow.innerHTML = this.getImageOnlyPopupContent()\n this.popup = this.shadowRoot.getElementById('imageOnlyPopup')\n this.container = this.shadowRoot.getElementById('container')\n this.closeIcon = this.shadowRoot.getElementById('close')\n\n this.popup.addEventListener('load', this.updateImageAndContainerWidth())\n this.resizeObserver = new ResizeObserver(() => this.handleResize(this.popup, this.container))\n this.resizeObserver.observe(this.popup)\n\n this.closeIcon.addEventListener('click', () => {\n this.resizeObserver.unobserve(this.popup)\n document.getElementById('wzrkImageOnlyDiv').style.display = 'none'\n this.remove()\n if (campaignId != null && campaignId !== '-1') {\n if (StorageManager._isLocalStorageSupported()) {\n const campaignObj = getCampaignObject()\n\n let sessionCampaignObj = campaignObj.wp[currentSessionId]\n if (sessionCampaignObj == null) {\n sessionCampaignObj = {}\n campaignObj[currentSessionId] = sessionCampaignObj\n }\n sessionCampaignObj[campaignId] = 'dnd'\n saveCampaignObject(campaignObj)\n }\n }\n })\n\n window.clevertap.renderNotificationViewed({ msgId: this.msgId, pivotId: this.pivotId })\n\n if (this.onClickUrl) {\n this.popup.addEventListener('click', () => {\n this.target.display.window ? window.open(this.onClickUrl, '_blank') : window.parent.location.href = this.onClickUrl\n window.clevertap.renderNotificationClicked({ msgId: this.msgId, pivotId: this.pivotId })\n })\n }\n }\n\n handleResize (popup, container) {\n const width = this.getRenderedImageWidth(popup)\n container.style.setProperty('width', `${width}px`)\n }\n\n getImageOnlyPopupContent () {\n return `\n ${this.target.msgContent.css}\n ${this.target.msgContent.html}\n `\n }\n\n updateImageAndContainerWidth () {\n return () => {\n const width = this.getRenderedImageWidth(this.popup)\n this.popup.style.setProperty('width', `${width}px`)\n this.container.style.setProperty('width', `${width}px`)\n this.container.style.setProperty('height', 'auto')\n this.container.style.setProperty('position', 'fixed')\n this.popup.style.setProperty('visibility', 'visible')\n this.closeIcon.style.setProperty('visibility', 'visible')\n document.getElementById('wzrkImageOnlyDiv').style.visibility = 'visible'\n }\n }\n\n getRenderedImageWidth (img) {\n const ratio = img.naturalWidth / img.naturalHeight\n return img.height * ratio\n }\n}\n","import { determineTimeStampText, greenTickSvg } from './helper'\nexport class Message extends HTMLElement {\n constructor (config, message) {\n super()\n this.shadow = this.attachShadow({ mode: 'open' })\n this.config = config\n this.message = message\n this.renderMessage(message)\n }\n\n wrapper = null\n snackBar = null\n\n get pivotId () {\n return this.message.wzrk_pivot\n }\n\n get campaignId () {\n return this.message.wzrk_id\n }\n\n createEl (type, id, part) {\n const _el = document.createElement(type)\n _el.setAttribute('id', id)\n _el.setAttribute('part', part || id)\n return _el\n }\n\n renderMessage (msg) {\n this.wrapper = this.createEl('div', 'messageWrapper')\n\n switch (msg.templateType) {\n case 'text-only':\n case 'text-with-icon':\n case 'text-with-icon-and-image': {\n const message = this.prepareBasicMessage(msg.msg[0])\n this.wrapper.appendChild(message)\n }\n }\n\n const timeStamp = this.createEl('div', 'timeStamp')\n timeStamp.innerHTML = `${determineTimeStampText(msg.id.split('_')[1])}`\n if (!msg.viewed) {\n const unreadMarker = this.createEl('span', 'unreadMarker')\n timeStamp.appendChild(unreadMarker)\n }\n\n this.wrapper.appendChild(timeStamp)\n this.shadow.appendChild(this.wrapper)\n }\n\n prepareBasicMessage (msg) {\n const message = this.createEl('div', 'message')\n\n if (msg.imageUrl) {\n const imageContainer = this.addImage(msg.imageUrl, 'mainImg')\n message.appendChild(imageContainer)\n }\n const iconTitleDescWrapper = this.createEl('div', 'iconTitleDescWrapper')\n if (msg.iconUrl) {\n const iconContainer = this.addImage(msg.iconUrl, 'iconImg')\n iconTitleDescWrapper.appendChild(iconContainer)\n }\n const titleDescWrapper = this.createEl('div', 'titleDescWrapper')\n if (msg.title) {\n const title = this.createEl('div', 'title')\n title.innerText = msg.title\n titleDescWrapper.appendChild(title)\n }\n if (msg.description) {\n const description = this.createEl('div', 'description')\n description.innerText = msg.description\n titleDescWrapper.appendChild(description)\n }\n if (msg.title || msg.description) {\n iconTitleDescWrapper.appendChild(titleDescWrapper)\n }\n\n if (msg.iconUrl || msg.title || msg.description) {\n message.appendChild(iconTitleDescWrapper)\n }\n if (msg.buttons && msg.buttons.length) {\n const buttonsContainer = this.addButtons(msg.buttons)\n message.appendChild(buttonsContainer)\n }\n return message\n }\n\n addButtons (buttons = []) {\n const buttonsContainer = this.createEl('div', 'buttonsContainer')\n let hasCopyAction = false\n buttons.forEach((b, i) => {\n const button = this.createEl('button', `button-${i}`, 'button')\n button.innerText = b.text\n if (i > 0) {\n button.style.cssText += 'margin-left: 2px;'\n }\n if (b.action === 'copy') {\n hasCopyAction = true\n }\n buttonsContainer.appendChild(button)\n })\n if (hasCopyAction) {\n this.addSnackbar(buttonsContainer)\n }\n return buttonsContainer\n }\n\n addSnackbar (buttonsContainer) {\n this.snackBar = this.createEl('div', `snackbar-${this.campaignId}`, 'snackbar')\n this.snackBar.innerHTML = greenTickSvg\n const clipboardMsg = this.createEl('span', `snackbar-msg-${this.campaignId}`, 'snackbar-msg')\n clipboardMsg.innerText = 'Copied to clipboard'\n this.snackBar.appendChild(clipboardMsg)\n buttonsContainer.appendChild(this.snackBar)\n }\n\n addImage (url, type) {\n const imageContainer = this.createEl('div', `${type}Container`)\n const image = this.createEl('img', type)\n image.setAttribute('src', url)\n // images will be fetched as and when the element comes into the viewport\n image.setAttribute('loading', 'lazy')\n imageContainer.appendChild(image)\n return imageContainer\n }\n\n raiseClickedEvent (path, isPreview) {\n switch (this.message.templateType) {\n case 'text-only':\n case 'text-with-icon':\n case 'text-with-icon-and-image': {\n this.raiseClickedForBasicTemplates(path, isPreview)\n }\n }\n }\n\n raiseClickedForBasicTemplates (path, isPreview) {\n const msg = this.message.msg[0]\n const payload = { msgId: this.campaignId, pivotId: this.pivotId }\n if (path.tagName === 'BUTTON') {\n const id = path.id.split('-')[1]\n const button = msg.buttons[id]\n payload.kv = {\n wzrk_c2a: button.text\n }\n if (button.action === 'url') {\n button.openUrlInNewTab ? window.open(button.url, '_blank') : (window.location = button.url)\n } else if (button.action === 'copy') {\n window.focus()\n navigator.clipboard.writeText(button.clipboardText)\n this.snackBar.style.setProperty('display', 'flex', 'important')\n setTimeout(() => {\n this.snackBar.style.setProperty('display', 'none', 'important')\n }, 2000)\n }\n } else if (path.tagName === 'CT-INBOX-MESSAGE' && msg.onClickUrl) {\n msg.openUrlInNewTab ? window.open(msg.onClickUrl, '_blank') : (window.location = msg.onClickUrl)\n }\n if (isPreview) {\n console.log('Notifiction clicked event will be raised at run time with payload ::', payload)\n } else {\n window.clevertap.renderNotificationClicked(payload)\n }\n }\n}\n","export const messageStyles = ({ backgroundColor, borderColor, titleColor, descriptionColor, buttonColor, buttonTextColor, unreadMarkerColor }) => {\n return `\n \n `\n}\n\nexport const inboxContainerStyles = ({\n panelBackgroundColor,\n panelBorderColor,\n headerBackgroundColor,\n headerTitleColor,\n closeIconColor,\n categoriesTabColor,\n categoriesTitleColor,\n categoriesBorderColor,\n selectedCategoryTabColor,\n selectedCategoryTitleColor,\n selectedCategoryBorderColor,\n headerCategoryHeight\n}) => {\n return `\n \n `\n}\n","import { StorageManager, $ct } from '../../util/storage'\nimport { Message } from './Message'\nimport { inboxContainerStyles, messageStyles } from './inboxStyles'\nimport { getInboxPosition, determineTimeStampText, arrowSvg, getInboxMessages, saveInboxMessages } from './helper'\nimport { WEBINBOX_CONFIG, MAX_INBOX_MSG } from '../../util/constants'\n\nexport class Inbox extends HTMLElement {\n constructor (logger) {\n super()\n this.logger = logger\n this.shadow = this.attachShadow({ mode: 'open' })\n }\n\n isInboxOpen = false\n isInboxFromFlutter = false\n selectedCategory = null\n unviewedMessages = {}\n unviewedCounter = 0\n isPreview = false\n inboxConfigForPreview = {}\n\n // dom references\n inboxSelector = null\n inbox = null\n emptyInboxMsg = null\n inboxCard = null\n unviewedBadge = null\n observer = null\n selectedCategoryRef = null\n\n get incomingMessages () {\n return []\n }\n\n set incomingMessages (msgs = []) {\n if (msgs.length > 0 && this.inbox) {\n this.updateInboxMessages(msgs)\n }\n }\n\n get incomingMessagesForPreview () {\n return []\n }\n\n set incomingMessagesForPreview (msgs = []) {\n const previewMsgs = {}\n if (msgs.length > 0 && this.inbox) {\n this.isPreview = true\n this.unviewedCounter = 0\n msgs.forEach((m) => {\n const key = `${m.wzrk_id.split('_')[0]}_${Date.now()}`\n m.id = key\n previewMsgs[key] = m\n this.unviewedMessages[key] = m\n this.unviewedCounter++\n })\n this.buildUIForMessages(previewMsgs)\n this.updateUnviewedBadgeCounter()\n }\n }\n\n connectedCallback () {\n this.init()\n }\n\n init () {\n this.config = this.isPreview ? this.inboxConfigForPreview : StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}\n if (Object.keys(this.config).length === 0) {\n return\n }\n this.inboxSelector = document.getElementById(this.config.inboxSelector)\n if (this.inboxSelector === null) {\n return\n }\n\n if (this.config.styles.notificationsBadge) {\n this.addUnviewedBadge()\n } else if (this.unviewedBadge) {\n this.unviewedBadge.remove()\n }\n\n this.createinbox()\n\n /**\n * We need to remove the listener as there could be a scenario where init would be called when\n * we get updated web inbox settings from LC after the inbox has been initialised.\n * It can so happen that the inbox-selector would have changed.\n */\n document.removeEventListener('click', this.addClickListenerOnDocument)\n document.addEventListener('click', this.addClickListenerOnDocument)\n this.config.categories.length && this.updateActiveCategory(this.selectedCategoryRef.innerText)\n\n this.shadow.innerHTML = this.getInboxStyles()\n this.shadow.appendChild(this.inbox)\n }\n\n addMsgsToInboxFromLS () {\n const messages = this.deleteExpiredAndGetUnexpiredMsgs(false)\n const msgIds = messages ? Object.keys(messages) : []\n if (msgIds.length === 0) {\n return\n }\n msgIds.forEach((m) => {\n if (!messages[m].viewed) {\n this.unviewedMessages[m] = messages[m]\n this.unviewedCounter++\n }\n })\n this.buildUIForMessages(messages)\n this.updateUnviewedBadgeCounter()\n }\n\n /**\n * @param {*} deleteMsgsFromUI - If this param is true, then we'll have to check the UI and delete expired messages from the DOM\n * It'll be false when you are building the inbox layout for the very first time.\n *\n * This method reads the inbox messages from LS,\n * based on the deleteMsgsFromUI flag deletes the expired messages from UI and decrements the unviewed counter if the message was not viewed,\n * sorts the messages based on the date,\n * saves the unexpired messages to LS\n * and returns the sorted unexpired messages\n *\n * Scenarios when we encounter expired messages -\n * 1. building ui for the 1st time, no need to decrement the unviewed counter as the correct count will be set at the time of rendering\n * 2. UI is already built (deleteMsgsFromUI = true) and you open the inbox\n * a. You'll find the expired msg in inbox\n * b. You'll not find the expired msg in inbox.\n * This happens when we receive new messages from LC, increment unviewed counter, save it in LS. (We build the UI only when the user opens inbox.)\n * In both the above scenarios, we'll still have to decrement the unviewed counter if the message was not viewed.\n */\n deleteExpiredAndGetUnexpiredMsgs (deleteMsgsFromUI = true) {\n let messages = getInboxMessages()\n\n const now = Math.floor(Date.now() / 1000)\n for (const msg in messages) {\n if (messages[msg].wzrk_ttl && messages[msg].wzrk_ttl > 0 && messages[msg].wzrk_ttl < now) {\n if (deleteMsgsFromUI) {\n const el = this.shadowRoot.getElementById(messages[msg].id)\n el && el.remove()\n if (!messages[msg].viewed) {\n this.unviewedCounter--\n this.updateUnviewedBadgeCounter()\n }\n }\n delete messages[msg]\n }\n }\n if (messages && messages.length > 0) {\n messages = Object.values(messages).sort((a, b) => b.date - a.date).reduce((acc, m) => { acc[m.id] = m; return acc }, {})\n }\n saveInboxMessages(messages)\n return messages\n }\n\n updateInboxMessages (msgs = []) {\n const inboxMsgs = this.deleteExpiredAndGetUnexpiredMsgs()\n const date = Date.now()\n const incomingMsgs = {}\n msgs.forEach((m, i) => {\n const key = `${m.wzrk_id.split('_')[0]}_${Date.now()}`\n m.id = key\n // We are doing this to preserve the order of the messages\n m.date = date - i\n m.viewed = 0\n inboxMsgs[key] = m\n incomingMsgs[key] = m\n this.unviewedMessages[key] = m\n this.unviewedCounter++\n })\n saveInboxMessages(inboxMsgs)\n this.buildUIForMessages(incomingMsgs)\n this.updateUnviewedBadgeCounter()\n }\n\n createEl (type, id, part) {\n const _el = document.createElement(type)\n _el.setAttribute('id', id)\n _el.setAttribute('part', part || id)\n return _el\n }\n\n addUnviewedBadge () {\n if (!this.unviewedBadge) {\n this.unviewedBadge = this.createEl('div', 'unviewedBadge')\n // As this unviewedBadge element will be directly added to the DOM, we are defining inline styles\n this.unviewedBadge.style.cssText = `display: none; position: absolute; height: 16px; width: 26px; border-radius: 8px; background-color: ${this.config.styles.notificationsBadge.backgroundColor}; font-size: 12px; color: ${this.config.styles.notificationsBadge.textColor}; font-weight: bold; align-items: center; justify-content: center;`\n document.body.appendChild(this.unviewedBadge)\n }\n this.updateUnviewedBadgePosition()\n\n // called when user switches b/w portrait and landscape mode.\n window.addEventListener('resize', () => {\n this.updateUnviewedBadgePosition()\n })\n }\n\n updateUnviewedBadgePosition () {\n const { top, right } = this.inboxSelector.getBoundingClientRect()\n this.unviewedBadge.style.top = `${top - 8}px`\n this.unviewedBadge.style.left = `${right - 8}px`\n }\n\n createinbox () {\n this.inbox = this.createEl('div', 'inbox')\n const header = this.createEl('div', 'header')\n\n const headerTitle = this.createEl('div', 'headerTitle')\n headerTitle.innerText = this.config.title\n\n const closeIcon = this.createEl('div', 'closeInbox')\n closeIcon.innerHTML = '×'\n\n header.appendChild(headerTitle)\n header.appendChild(closeIcon)\n this.inbox.appendChild(header)\n if (this.config.categories.length) {\n const categories = this.createCategories()\n this.inbox.appendChild(categories)\n }\n this.inboxCard = this.createEl('div', 'inboxCard')\n this.inbox.appendChild(this.inboxCard)\n\n this.emptyInboxMsg = this.createEl('div', 'emptyInboxMsg')\n this.emptyInboxMsg.innerText = 'All messages will be displayed here.'\n this.inboxCard.appendChild(this.emptyInboxMsg)\n\n // Intersection observer for notification viewed\n const options = {\n root: this.inboxCard,\n rootMargin: '0px',\n threshold: 0.5\n }\n this.observer = new IntersectionObserver((entries, observer) => { this.handleMessageViewed(entries) }, options)\n\n this.addMsgsToInboxFromLS()\n }\n\n createCategories () {\n const categoriesContainer = this.createEl('div', 'categoriesContainer')\n\n const leftArrow = this.createEl('div', 'leftArrow')\n leftArrow.innerHTML = arrowSvg\n leftArrow.children[0].style = 'transform: rotate(180deg)'\n leftArrow.addEventListener('click', () => {\n this.shadowRoot.getElementById('categoriesWrapper').scrollBy(-70, 0)\n })\n categoriesContainer.appendChild(leftArrow)\n\n const categoriesWrapper = this.createEl('div', 'categoriesWrapper')\n const _categories = ['All', ...this.config.categories]\n _categories.forEach((c, i) => {\n const category = this.createEl('div', `category-${i}`, 'category')\n category.innerText = c\n if (i === 0) {\n this.selectedCategoryRef = category\n }\n categoriesWrapper.appendChild(category)\n })\n categoriesContainer.appendChild(categoriesWrapper)\n\n const rightArrow = this.createEl('div', 'rightArrow')\n rightArrow.innerHTML = arrowSvg\n rightArrow.addEventListener('click', () => {\n this.shadowRoot.getElementById('categoriesWrapper').scrollBy(70, 0)\n })\n categoriesContainer.appendChild(rightArrow)\n\n const options = { root: categoriesContainer, threshold: 0.9 }\n const firstCategory = categoriesWrapper.children[0]\n const lastCategory = categoriesWrapper.children[this.config.categories.length]\n\n const firstCategoryObserver = new IntersectionObserver((e) => {\n this.categoryObserverCb(leftArrow, e[0].intersectionRatio >= 0.9)\n }, options)\n firstCategoryObserver.observe(firstCategory)\n\n const lastCategoryObserver = new IntersectionObserver((e) => {\n this.categoryObserverCb(rightArrow, e[0].intersectionRatio >= 0.9)\n }, options)\n lastCategoryObserver.observe(lastCategory)\n\n return categoriesContainer\n }\n\n categoryObserverCb (el, hide) {\n if (!el) {\n return\n }\n el.style.display = hide ? 'none' : 'flex'\n }\n\n updateActiveCategory (activeCategory) {\n this.selectedCategory = activeCategory\n\n this.inboxCard.scrollTop = 0\n let counter = 0\n\n this.prevCategoryRef && this.prevCategoryRef.setAttribute('selected', 'false')\n this.selectedCategoryRef.setAttribute('selected', 'true')\n\n this.inboxCard.childNodes.forEach(c => {\n if (c.getAttribute('id') !== 'emptyInboxMsg') {\n c.style.display = (this.selectedCategory === 'All' || c.getAttribute('category') === this.selectedCategory) ? 'block' : 'none'\n if (c.style.display === 'block') {\n counter++\n }\n }\n })\n if (counter === 0) {\n this.emptyInboxMsg.innerText = `${activeCategory} messages will be displayed here.`\n this.emptyInboxMsg.style.display = 'block'\n } else {\n this.emptyInboxMsg.style.display = 'none'\n }\n }\n\n buildUIForMessages (messages = {}) {\n !this.isPreview && this.updateTSForRenderedMsgs()\n this.inboxCard.scrollTop = 0\n const maxMsgsInInbox = this.config.maxMsgsInInbox ?? MAX_INBOX_MSG\n const firstChild = this.inboxCard.firstChild\n\n const sortedMsgs = Object.values(messages).sort((a, b) => b.date - a.date).map((m) => m.id)\n for (const m of sortedMsgs) {\n const item = new Message(this.config, messages[m])\n item.setAttribute('id', messages[m].id)\n item.setAttribute('pivot', messages[m].wzrk_pivot)\n item.setAttribute('part', 'ct-inbox-message')\n if (this.config.categories.length > 0) {\n item.setAttribute('category', messages[m].tags[0] || '')\n item.style.display = (this.selectedCategory === 'All' || messages[m].category === this.selectedCategory) ? 'block' : 'none'\n } else {\n item.style.display = 'block'\n }\n this.inboxCard.insertBefore(item, firstChild)\n this.observer.observe(item)\n }\n\n let msgTotalCount = this.inboxCard.querySelectorAll('ct-inbox-message').length\n while (msgTotalCount > maxMsgsInInbox) {\n const ctInboxMsgs = this.inboxCard.querySelectorAll('ct-inbox-message')\n if (ctInboxMsgs.length > 0) { ctInboxMsgs[ctInboxMsgs.length - 1].remove() }\n msgTotalCount--\n }\n const hasMessages = this.inboxCard.querySelectorAll('ct-inbox-message[style*=\"display: block\"]').length\n this.emptyInboxMsg.style.display = hasMessages ? 'none' : 'block'\n }\n\n /**\n * Adds a click listener on the document. For every click we check\n * 1. if the click has happenned within the inbox\n * - on close button, we close the inbox\n * - on any of the category, we set that as the activeCategory\n * - on any of the message, we mark raise notification clicked event. To identify the clicks on a button, we have p.id.startsWith('button-')\n * 2. if the user has clicked on the inboxSelector, we toggle inbox\n * 3. if the click is anywhere else on the UI and the inbox is open, we simply close it\n */\n\n addClickListenerOnDocument = (() => {\n return (e) => {\n if (e.composedPath().includes(this.inbox)) {\n // path is not supported on FF. So we fallback to e.composedPath\n const path = e.path || (e.composedPath && e.composedPath())\n if (path.length) {\n const id = path[0].id\n if (id === 'closeInbox') {\n this.toggleInbox()\n } else if (id.startsWith('category-')) {\n this.prevCategoryRef = this.selectedCategoryRef\n this.selectedCategoryRef = path[0]\n this.updateActiveCategory(path[0].innerText)\n } else {\n const _path = path.filter((p) => p.id?.startsWith('button-') || p.tagName === 'CT-INBOX-MESSAGE')\n if (_path.length) {\n const messageEl = _path[_path.length - 1]\n messageEl.raiseClickedEvent(_path[0], this.isPreview)\n }\n }\n }\n } else if (this.inboxSelector.contains(e.target) || this.isInboxOpen) {\n if (this.isInboxFromFlutter) {\n this.isInboxFromFlutter = false\n } else {\n this.toggleInbox(e)\n }\n }\n }\n })()\n\n /**\n * This function will be called every time when a message comes into the inbox viewport and it's visibility increases to 50% or drops below 50%\n * If a msg is 50% visible in the UI, we need to mark the message as viewed in LS and raise notification viewed event\n */\n handleMessageViewed (entries) {\n const raiseViewedEvent = !this.isPreview\n if (this.isInboxOpen) {\n entries.forEach((e) => {\n if (e.isIntersecting && this.unviewedMessages.hasOwnProperty(e.target.id) && e.target.message.viewed === 0) {\n e.target.message.viewed = 1\n if (raiseViewedEvent) {\n window.clevertap.renderNotificationViewed({ msgId: e.target.campaignId, pivotId: e.target.pivotId })\n this.updateMessageInLS(e.target.id, { ...e.target.message, viewed: 1 })\n setTimeout(() => {\n e.target.shadowRoot.getElementById('unreadMarker').style.display = 'none'\n }, 1000)\n } else {\n console.log('Notifiction viewed event will be raised at run time with payload ::', { msgId: e.target.campaignId, pivotId: e.target.pivotId })\n }\n this.unviewedCounter--\n this.updateUnviewedBadgeCounter()\n delete this.unviewedMessages[e.target.id]\n }\n })\n }\n }\n\n updateMessageInLS (key, value) {\n if (!this.isPreview) {\n const messages = getInboxMessages()\n messages[key] = value\n saveInboxMessages(messages)\n }\n }\n\n // create a separte fn fro refactoring\n toggleInbox (e) {\n this.isInboxOpen = !this.isInboxOpen\n this.isInboxFromFlutter = !!e?.rect\n if (this.isInboxOpen) {\n this.inboxCard.scrollTop = 0\n !this.isPreview && this.deleteExpiredAndGetUnexpiredMsgs()\n this.inbox.style.display = 'block'\n this.inbox.style.zIndex = '2147483647' // zIndex should be max for the inbox to be rendered on top of all elements\n if (this.config.categories.length) {\n this.selectedCategoryRef.setAttribute('selected', 'false')\n this.selectedCategoryRef = this.shadowRoot.getElementById('category-0')\n this.updateActiveCategory(this.selectedCategoryRef.innerText)\n this.shadowRoot.getElementById('categoriesWrapper').scrollLeft -= this.shadowRoot.getElementById('categoriesWrapper').scrollWidth\n }\n this.setInboxPosition(e)\n } else {\n this.inbox.style.display = 'none'\n }\n }\n\n setInboxPosition (e) {\n const windowWidth = window.outerWidth\n const customInboxStyles = getComputedStyle($ct.inbox)\n const top = customInboxStyles.getPropertyValue('--inbox-top')\n const bottom = customInboxStyles.getPropertyValue('--inbox-bottom')\n const left = customInboxStyles.getPropertyValue('--inbox-left')\n const right = customInboxStyles.getPropertyValue('--inbox-right')\n const hasPositionDefined = top || bottom || left || right\n if (windowWidth > 481 && !hasPositionDefined) {\n const res = getInboxPosition(e, this.inbox.clientHeight, this.inbox.clientWidth)\n const xPos = res.xPos\n const yPos = res.yPos\n this.inbox.style.top = yPos + 'px'\n this.inbox.style.left = xPos + 'px'\n }\n }\n\n /**\n * Updates the UI with the number of unviewed messages\n * If there are more than 9 unviewed messages, we show the count as 9+\n */\n\n setBadgeStyle = (msgCount) => {\n if (this.unviewedBadge !== null) {\n this.unviewedBadge.innerText = msgCount > 9 ? '9+' : msgCount\n this.unviewedBadge.style.display = msgCount > 0 ? 'flex' : 'none'\n }\n }\n\n updateUnviewedBadgeCounter () {\n if (this.isPreview) {\n this.setBadgeStyle(this.unviewedCounter)\n return\n }\n let counter = 0\n this.inboxCard.querySelectorAll('ct-inbox-message').forEach((m) => {\n const messages = getInboxMessages()\n if (messages[m.id] && messages[m.id].viewed === 0) {\n counter++\n }\n })\n this.setBadgeStyle(counter)\n }\n\n updateTSForRenderedMsgs () {\n this.inboxCard.querySelectorAll('ct-inbox-message').forEach((m) => {\n const ts = m.id.split('_')[1]\n m.shadow.getElementById('timeStamp').firstChild.innerText = determineTimeStampText(ts)\n })\n }\n\n getInboxStyles () {\n const headerHeight = 36\n const categoriesHeight = this.config.categories.length ? 64 : 16\n\n const styles = {\n panelBackgroundColor: this.config.styles.panelBackgroundColor,\n panelBorderColor: this.config.styles.panelBorderColor,\n headerBackgroundColor: this.config.styles.header.backgroundColor,\n headerTitleColor: this.config.styles.header.titleColor,\n closeIconColor: this.config.styles.closeIconColor,\n categoriesTabColor: this.config.styles.categories.tabColor,\n categoriesTitleColor: this.config.styles.categories.titleColor,\n selectedCategoryTabColor: this.config.styles.categories.selectedTab.tabColor,\n selectedCategoryTitleColor: this.config.styles.categories.selectedTab.titleColor,\n headerCategoryHeight: headerHeight + categoriesHeight\n }\n if (this.config.styles.categories.borderColor) {\n styles.categoriesBorderColor = this.config.styles.categories.borderColor\n }\n if (this.config.styles.categories.selectedTab.borderColor) {\n styles.selectedCategoryBorderColor = this.config.styles.categories.selectedTab.borderColor\n }\n\n const inboxStyles = inboxContainerStyles(styles)\n\n const cardStyles = this.config.styles.cards\n const msgStyles = messageStyles({\n backgroundColor: cardStyles.backgroundColor,\n borderColor: cardStyles.borderColor,\n titleColor: cardStyles.titleColor,\n descriptionColor: cardStyles.descriptionColor,\n buttonColor: cardStyles.buttonColor,\n buttonTextColor: cardStyles.buttonTextColor,\n unreadMarkerColor: cardStyles.unreadMarkerColor\n })\n\n return inboxStyles + msgStyles\n }\n}\n","import { StorageManager, $ct } from '../../util/storage'\nimport { Inbox } from './WebInbox'\nimport { Message } from './Message'\nimport { WEBINBOX_CONFIG, GCOOKIE_NAME, WEBINBOX } from '../../util/constants'\nimport { isValueValid } from '../../util/datatypes'\n\nexport const processWebInboxSettings = (webInboxSetting, isPreview = false) => {\n const _settings = StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}\n if (isPreview) {\n $ct.inbox.inboxConfigForPreview = webInboxSetting\n $ct.inbox.isPreview = true\n $ct.inbox && $ct.inbox.init()\n } else if (JSON.stringify(_settings) !== JSON.stringify(webInboxSetting)) {\n StorageManager.saveToLSorCookie(WEBINBOX_CONFIG, webInboxSetting)\n $ct.inbox && $ct.inbox.init()\n }\n}\n\nexport const processInboxNotifs = (msg) => {\n if (msg.inbox_preview) {\n $ct.inbox.incomingMessagesForPreview = msg.inbox_notifs\n } else {\n $ct.inbox.incomingMessages = msg\n }\n}\n\nexport const processWebInboxResponse = (msg) => {\n if (msg.webInboxSetting) {\n processWebInboxSettings(msg.webInboxSetting, msg.inbox_preview)\n }\n if (msg.inbox_notifs != null) {\n processInboxNotifs(msg)\n }\n}\n\nexport const addWebInbox = (logger) => {\n checkAndRegisterWebInboxElements()\n $ct.inbox = new Inbox({ logger })\n document.body.appendChild($ct.inbox)\n}\n\nconst getAndMigrateInboxMessages = (guid) => {\n const messages = StorageManager.readFromLSorCookie(WEBINBOX) || {}\n // Doing this to migrate message to guid level\n if (Object.keys(messages).length > 0 && Object.keys(messages)[0].includes('_')) {\n const gudInboxObj = {}\n gudInboxObj[guid] = messages\n StorageManager.saveToLSorCookie(WEBINBOX, gudInboxObj)\n return gudInboxObj\n }\n return messages\n}\n\nexport const getInboxMessages = () => {\n const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n if (!isValueValid(guid)) { return {} }\n const messages = getAndMigrateInboxMessages(guid)\n\n return messages.hasOwnProperty(guid) ? messages[guid] : {}\n}\n\nexport const saveInboxMessages = (messages) => {\n const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n if (!isValueValid(guid)) { return }\n const storedInboxObj = getAndMigrateInboxMessages(guid)\n\n const newObj = { ...storedInboxObj, [guid]: messages }\n StorageManager.saveToLSorCookie(WEBINBOX, newObj)\n}\n\nexport const initializeWebInbox = (logger) => {\n return new Promise((resolve, reject) => {\n if (document.readyState === 'complete') {\n addWebInbox(logger)\n resolve()\n } else {\n const config = StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}\n const onLoaded = () => {\n /**\n * We need this null check here because $ct.inbox could be initialised via init method too on document load.\n * In that case we don't need to call addWebInbox method\n */\n if ($ct.inbox === null) {\n addWebInbox(logger)\n }\n resolve()\n }\n window.addEventListener('load', () => {\n /**\n * Scripts can be loaded layzily, we may not get element from dom as it may not be mounted yet\n * We will to check element for 10 seconds and give up\n */\n if (document.getElementById(config.inboxSelector)) {\n onLoaded()\n } else {\n // check for element for next 10 seconds\n let count = 0\n if (count < 20) {\n const t = setInterval(() => {\n if (document.getElementById(config.inboxSelector)) {\n onLoaded()\n clearInterval(t)\n resolve()\n } else if (count >= 20) {\n clearInterval(t)\n logger.debug('Failed to add inbox')\n }\n count++\n }, 500)\n }\n }\n })\n }\n })\n}\n\nexport const checkAndRegisterWebInboxElements = () => {\n if (customElements.get('ct-web-inbox') === undefined) {\n customElements.define('ct-web-inbox', Inbox)\n customElements.define('ct-inbox-message', Message)\n }\n}\n\nexport const getInboxPosition = (e, inboxHeight, inboxWidth) => {\n const horizontalScroll = document.scrollingElement.scrollLeft\n const verticalScroll = document.scrollingElement.scrollTop\n const windowWidth = window.innerWidth + horizontalScroll\n const windowHeight = window.innerHeight + verticalScroll\n const selectorRect = e.rect || e.target.getBoundingClientRect()\n const selectorX = selectorRect.x + horizontalScroll\n const selectorY = selectorRect.y + verticalScroll\n const selectorLeft = selectorRect.left + horizontalScroll\n const selectorRight = selectorRect.right + horizontalScroll\n const selectorTop = selectorRect.top + verticalScroll\n // const selectorBottom = selectorRect.bottom + verticalScroll\n const selectorBottom = selectorRect.bottom\n const selectorHeight = selectorRect.height\n const selectorWidth = selectorRect.width\n const selectorCenter = {\n x: selectorX + (selectorWidth / 2),\n y: selectorY + (selectorHeight / 2)\n }\n const halfOfInboxHeight = (inboxHeight / 2)\n const halfOfInboxWidth = (inboxWidth / 2)\n let inboxOnSide = false\n\n let xPos, yPos\n\n const padding = 16\n\n /**\n * y co-ordinates:\n * Try to push the card downwards\n * if that's not possible, push it upwards\n * if that too is not possible, then the card will be placed on the side. Add some padding.\n *\n * x co-ordinates:\n * If the card is on the side,\n * try to place it to the right. If it's not possible,\n * place it to the left\n * If the card is either on top/ bottom, set the x co-ordinate such that the selector center and the inbox card center become the same\n * Now,\n * if the left of the inbox card is < 0,\n * try to get the left aligned to the selectorLeft.\n * if that's not possible, simply set left to 0\n * if the right of the inbox card > windowWidth,\n * try to get the right of rhe inbox card aligned with the selectorRight\n * if that's not possible, simply set the inbox right to the window Right\n */\n if (selectorBottom + inboxHeight <= windowHeight) { // try to place the card down\n const availableHeight = windowHeight - (selectorBottom + inboxHeight)\n yPos = availableHeight >= padding ? selectorBottom + padding : selectorBottom + availableHeight\n } else if (selectorTop - inboxHeight >= verticalScroll) { // try to place the card up\n const availableHeight = selectorTop - inboxHeight\n yPos = availableHeight >= padding ? selectorTop - inboxHeight - padding : selectorTop - inboxHeight - availableHeight\n } else {\n inboxOnSide = true\n yPos = selectorCenter.y - halfOfInboxHeight // with this the y co-ordinate of the selector center and the inbox card center become the same\n if (yPos < verticalScroll) {\n yPos = verticalScroll\n } else if (yPos + inboxHeight > windowHeight) {\n yPos = windowHeight - inboxHeight\n }\n }\n\n if (inboxOnSide) {\n // See if we can place the card to the right of the selector\n const inboxRight = selectorRight + inboxWidth\n if (inboxRight <= windowWidth) {\n const availableWidth = inboxRight + padding <= windowWidth ? padding : windowWidth - inboxRight\n xPos = selectorRight + availableWidth\n } else {\n const inboxLeft = selectorLeft - inboxWidth\n const availableWidth = inboxLeft - padding >= horizontalScroll ? padding : inboxLeft - horizontalScroll\n xPos = inboxLeft - availableWidth\n }\n } else {\n xPos = selectorCenter.x - halfOfInboxWidth\n if (xPos < horizontalScroll) {\n if (selectorLeft + inboxWidth <= windowWidth) {\n xPos = selectorLeft\n } else {\n xPos = horizontalScroll\n }\n } else if (xPos + inboxWidth > windowWidth) {\n if (selectorRight - inboxWidth >= horizontalScroll) {\n xPos = selectorRight - inboxWidth\n } else {\n xPos = windowWidth - inboxWidth\n }\n }\n }\n\n return { xPos, yPos }\n}\n\nexport const determineTimeStampText = (ts) => {\n const now = Date.now()\n let diff = Math.floor((now - ts) / 60000)\n if (diff < 5) {\n return 'Just now'\n }\n if (diff < 60) {\n return `${diff} minute${diff > 1 ? 's' : ''} ago`\n }\n diff = Math.floor(diff / 60)\n if (diff < 24) {\n return `${diff} hour${diff > 1 ? 's' : ''} ago`\n }\n diff = Math.floor(diff / 24)\n return `${diff} day${diff > 1 ? 's' : ''} ago`\n}\n\nexport const hasWebInboxSettingsInLS = () => {\n return Object.keys(StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}).length > 0\n}\n\nexport const arrowSvg = `\n\n\n`\nexport const greenTickSvg = `\n\n\n`\n","import {\n addToLocalProfileMap,\n arp,\n getCampaignObject,\n saveCampaignObject,\n closeIframe\n} from './clevertap'\n\nimport {\n CAMP_COOKIE_NAME,\n DISPLAY,\n GLOBAL,\n EV_COOKIE,\n NOTIFICATION_VIEWED,\n NOTIFICATION_CLICKED,\n WZRK_PREFIX,\n WZRK_ID,\n CAMP_COOKIE_G,\n GCOOKIE_NAME\n} from './constants'\n\nimport {\n getNow,\n getToday\n} from './datetime'\n\nimport {\n compressToBase64\n} from './encoder'\n\nimport { StorageManager, $ct } from './storage'\nimport RequestDispatcher from './requestDispatcher'\nimport { CTWebPersonalisationBanner } from './web-personalisation/banner'\nimport { CTWebPersonalisationCarousel } from './web-personalisation/carousel'\nimport { CTWebPopupImageOnly } from './web-popupImageonly/popupImageonly'\nimport { checkAndRegisterWebInboxElements, initializeWebInbox, processWebInboxSettings, hasWebInboxSettingsInLS, processInboxNotifs } from '../modules/web-inbox/helper'\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\n // Campaign House keeping\n const doCampHouseKeeping = (targetingMsgJson) => {\n const campaignId = targetingMsgJson.wzrk_id.split('_')[0]\n const today = getToday()\n\n const incrCount = (obj, campaignId, excludeFromFreqCaps) => {\n let currentCount = 0\n let totalCount = 0\n if (obj[campaignId] != null) {\n currentCount = obj[campaignId]\n }\n currentCount++\n if (obj.tc != null) {\n totalCount = obj.tc\n }\n // if exclude from caps then dont add to total counts\n if (excludeFromFreqCaps < 0) {\n totalCount++\n }\n\n obj.tc = totalCount\n obj[campaignId] = currentCount\n }\n\n if (StorageManager._isLocalStorageSupported()) {\n delete sessionStorage[CAMP_COOKIE_NAME]\n var campTypeObj = {}\n const campObj = getCampaignObject()\n if (targetingMsgJson.display.wtarget_type === 3 && campObj.hasOwnProperty('wi')) {\n campTypeObj = campObj.wi\n } else if ((targetingMsgJson.display.wtarget_type === 0 || targetingMsgJson.display.wtarget_type === 1) && campObj.hasOwnProperty('wp')) {\n campTypeObj = campObj.wp\n } else {\n campTypeObj = {}\n }\n if (campObj.hasOwnProperty('global')) {\n campTypeObj.wp = campObj\n }\n // global session limit. default is 1\n if (targetingMsgJson[DISPLAY].wmc == null) {\n targetingMsgJson[DISPLAY].wmc = 1\n }\n\n // global session limit for web inbox. default is 1\n if (targetingMsgJson[DISPLAY].wimc == null) {\n targetingMsgJson[DISPLAY].wimc = 1\n }\n\n var excludeFromFreqCaps = -1 // efc - Exclude from frequency caps\n let campaignSessionLimit = -1 // mdc - Once per session\n let campaignDailyLimit = -1 // tdc - Once per day\n let campaignTotalLimit = -1 // tlc - Once per user for the duration of campaign\n let totalDailyLimit = -1\n let totalSessionLimit = -1 // wmc - Web Popup Global Session Limit\n let totalInboxSessionLimit = -1 // wimc - Web Inbox Global Session Limit\n\n if (targetingMsgJson[DISPLAY].efc != null) { // exclude from frequency cap\n excludeFromFreqCaps = parseInt(targetingMsgJson[DISPLAY].efc, 10)\n }\n if (targetingMsgJson[DISPLAY].mdc != null) { // Campaign Session Limit\n campaignSessionLimit = parseInt(targetingMsgJson[DISPLAY].mdc, 10)\n }\n if (targetingMsgJson[DISPLAY].tdc != null) { // No of web popups in a day per campaign\n campaignDailyLimit = parseInt(targetingMsgJson[DISPLAY].tdc, 10)\n }\n if (targetingMsgJson[DISPLAY].tlc != null) { // Total lifetime count\n campaignTotalLimit = parseInt(targetingMsgJson[DISPLAY].tlc, 10)\n }\n if (targetingMsgJson[DISPLAY].wmp != null) { // No of campaigns per day\n totalDailyLimit = parseInt(targetingMsgJson[DISPLAY].wmp, 10)\n }\n if (targetingMsgJson[DISPLAY].wmc != null) { // No of campaigns per session\n totalSessionLimit = parseInt(targetingMsgJson[DISPLAY].wmc, 10)\n }\n\n if (targetingMsgJson[DISPLAY].wimc != null) { // No of inbox campaigns per session\n totalInboxSessionLimit = parseInt(targetingMsgJson[DISPLAY].wimc, 10)\n }\n // session level capping\n var sessionObj = campTypeObj[_session.sessionId]\n if (sessionObj) {\n const campaignSessionCount = sessionObj[campaignId]\n const totalSessionCount = sessionObj.tc\n // dnd\n if (campaignSessionCount === 'dnd' && !$ct.dismissSpamControl) {\n return false\n }\n\n if (targetingMsgJson[DISPLAY].wtarget_type === 3) {\n // Inbox session\n if (totalInboxSessionLimit > 0 && totalSessionCount >= totalInboxSessionLimit && excludeFromFreqCaps < 0) {\n return false\n }\n } else {\n // session\n if (totalSessionLimit > 0 && totalSessionCount >= totalSessionLimit && excludeFromFreqCaps < 0) {\n return false\n }\n }\n\n // campaign session\n if (campaignSessionLimit > 0 && campaignSessionCount >= campaignSessionLimit) {\n return false\n }\n } else {\n sessionObj = {}\n campTypeObj[_session.sessionId] = sessionObj\n }\n\n // daily level capping\n var dailyObj = campTypeObj[today]\n if (dailyObj != null) {\n const campaignDailyCount = dailyObj[campaignId]\n const totalDailyCount = dailyObj.tc\n // daily\n if (totalDailyLimit > 0 && totalDailyCount >= totalDailyLimit && excludeFromFreqCaps < 0) {\n return false\n }\n // campaign daily\n if (campaignDailyLimit > 0 && campaignDailyCount >= campaignDailyLimit) {\n return false\n }\n } else {\n dailyObj = {}\n campTypeObj[today] = dailyObj\n }\n\n var globalObj = campTypeObj[GLOBAL]\n if (globalObj != null) {\n const campaignTotalCount = globalObj[campaignId]\n // campaign total\n if (campaignTotalLimit > 0 && campaignTotalCount >= campaignTotalLimit) {\n return false\n }\n } else {\n globalObj = {}\n campTypeObj[GLOBAL] = globalObj\n }\n }\n // delay\n if (targetingMsgJson[DISPLAY].delay != null && targetingMsgJson[DISPLAY].delay > 0) {\n const delay = targetingMsgJson[DISPLAY].delay\n targetingMsgJson[DISPLAY].delay = 0\n setTimeout(_tr, delay * 1000, msg, {\n device: _device,\n session: _session,\n request: _request,\n logger: _logger\n })\n return false\n }\n\n incrCount(sessionObj, campaignId, excludeFromFreqCaps)\n incrCount(dailyObj, campaignId, excludeFromFreqCaps)\n incrCount(globalObj, campaignId, excludeFromFreqCaps)\n\n let campKey = 'wp'\n if (targetingMsgJson[DISPLAY].wtarget_type === 3) {\n campKey = 'wi'\n }\n // get ride of stale sessions and day entries\n const newCampObj = {}\n newCampObj[_session.sessionId] = sessionObj\n newCampObj[today] = dailyObj\n newCampObj[GLOBAL] = globalObj\n saveCampaignObject({ [campKey]: newCampObj })\n }\n\n const getCookieParams = () => {\n const gcookie = _device.getGuid()\n const scookieObj = _session.getSessionCookieObject()\n return '&t=wc&d=' + encodeURIComponent(compressToBase64(gcookie + '|' + scookieObj.p + '|' + scookieObj.s))\n }\n\n const setupClickEvent = (onClick, targetingMsgJson, contentDiv, divId, isLegacy) => {\n if (onClick !== '' && onClick != null) {\n let ctaElement\n let jsCTAElements\n if (isLegacy) {\n ctaElement = contentDiv\n } else if (contentDiv !== null) {\n jsCTAElements = contentDiv.getElementsByClassName('jsCT_CTA')\n if (jsCTAElements != null && jsCTAElements.length === 1) {\n ctaElement = jsCTAElements[0]\n }\n }\n const jsFunc = targetingMsgJson.display.jsFunc\n const isPreview = targetingMsgJson.display.preview\n if (isPreview == null) {\n onClick += getCookieParams()\n }\n\n if (ctaElement != null) {\n ctaElement.onclick = () => {\n // invoke js function call\n if (jsFunc != null) {\n // track notification clicked event\n if (isPreview == null) {\n RequestDispatcher.fireRequest(onClick)\n }\n invokeExternalJs(jsFunc, targetingMsgJson)\n // close iframe. using -1 for no campaignId\n closeIframe('-1', divId, _session.sessionId)\n return\n }\n // pass on the gcookie|page|scookieId for capturing the click event\n if (targetingMsgJson.display.window === 1) {\n window.open(onClick, '_blank')\n } else {\n window.location = onClick\n }\n }\n }\n }\n }\n\n const invokeExternalJs = (jsFunc, targetingMsgJson) => {\n const func = window.parent[jsFunc]\n if (typeof func === 'function') {\n if (targetingMsgJson.display.kv != null) {\n func(targetingMsgJson.display.kv)\n } else {\n func()\n }\n }\n }\n\n const setupClickUrl = (onClick, targetingMsgJson, contentDiv, divId, isLegacy) => {\n incrementImpression(targetingMsgJson)\n setupClickEvent(onClick, targetingMsgJson, contentDiv, divId, isLegacy)\n }\n\n const incrementImpression = (targetingMsgJson) => {\n const data = {}\n data.type = 'event'\n data.evtName = NOTIFICATION_VIEWED\n data.evtData = { [WZRK_ID]: targetingMsgJson.wzrk_id }\n if (targetingMsgJson.wzrk_pivot) {\n data.evtData = { ...data.evtData, wzrk_pivot: targetingMsgJson.wzrk_pivot }\n }\n _request.processEvent(data)\n }\n\n const renderPersonalisationBanner = (targetingMsgJson) => {\n if (customElements.get('ct-web-personalisation-banner') === undefined) {\n customElements.define('ct-web-personalisation-banner', CTWebPersonalisationBanner)\n }\n const divId = targetingMsgJson.display.divId ?? targetingMsgJson.display.divSelector\n const bannerEl = document.createElement('ct-web-personalisation-banner')\n bannerEl.msgId = targetingMsgJson.wzrk_id\n bannerEl.pivotId = targetingMsgJson.wzrk_pivot\n bannerEl.divHeight = targetingMsgJson.display.divHeight\n bannerEl.details = targetingMsgJson.display.details[0]\n const containerEl = targetingMsgJson.display.divId ? document.getElementById(divId) : document.querySelector(divId)\n containerEl.innerHTML = ''\n containerEl.appendChild(bannerEl)\n }\n\n const renderPersonalisationCarousel = (targetingMsgJson) => {\n if (customElements.get('ct-web-personalisation-carousel') === undefined) {\n customElements.define('ct-web-personalisation-carousel', CTWebPersonalisationCarousel)\n }\n const divId = targetingMsgJson.display.divId ?? targetingMsgJson.display.divSelector\n const carousel = document.createElement('ct-web-personalisation-carousel')\n carousel.target = targetingMsgJson\n const container = targetingMsgJson.display.divId ? document.getElementById(divId) : document.querySelector(divId)\n container.innerHTML = ''\n container.appendChild(carousel)\n }\n\n const renderPopUpImageOnly = (targetingMsgJson) => {\n const divId = 'wzrkImageOnlyDiv'\n const popupImageOnly = document.createElement('ct-web-popup-imageonly')\n popupImageOnly.session = _session\n popupImageOnly.target = targetingMsgJson\n const containerEl = document.getElementById(divId)\n containerEl.innerHTML = ''\n containerEl.style.visibility = 'hidden'\n containerEl.appendChild(popupImageOnly)\n }\n\n const renderFooterNotification = (targetingMsgJson) => {\n const campaignId = targetingMsgJson.wzrk_id.split('_')[0]\n const displayObj = targetingMsgJson.display\n\n if (displayObj.wtarget_type === 2) { // Handling Web Native display\n // Logic for kv pair data\n if (targetingMsgJson.msgContent.type === 1) {\n const inaObj = {}\n\n inaObj.msgId = targetingMsgJson.wzrk_id\n if (targetingMsgJson.wzrk_pivot) {\n inaObj.pivotId = targetingMsgJson.wzrk_pivot\n }\n if (targetingMsgJson.msgContent.kv != null) {\n inaObj.kv = targetingMsgJson.msgContent.kv\n }\n const kvPairsEvent = new CustomEvent('CT_web_native_display', { detail: inaObj })\n document.dispatchEvent(kvPairsEvent)\n return\n }\n }\n if (displayObj.layout === 1) { // Handling Web Exit Intent\n return showExitIntent(undefined, targetingMsgJson)\n }\n if (displayObj.layout === 3) { // Handling Web Popup Image Only\n const divId = 'wzrkImageOnlyDiv'\n if (doCampHouseKeeping(targetingMsgJson) === false) {\n return\n }\n if ($ct.dismissSpamControl && document.getElementById(divId) != null) {\n const element = document.getElementById(divId)\n element.remove()\n }\n // ImageOnly campaign and Interstitial/Exit Intent shouldn't coexist\n if (document.getElementById(divId) != null || document.getElementById('intentPreview') != null) {\n return\n }\n const msgDiv = document.createElement('div')\n msgDiv.id = divId\n document.body.appendChild(msgDiv)\n if (customElements.get('ct-web-popup-imageonly') === undefined) {\n customElements.define('ct-web-popup-imageonly', CTWebPopupImageOnly)\n }\n return renderPopUpImageOnly(targetingMsgJson)\n }\n\n if (doCampHouseKeeping(targetingMsgJson) === false) {\n return\n }\n\n const divId = 'wizParDiv' + displayObj.layout\n\n if ($ct.dismissSpamControl && document.getElementById(divId) != null) {\n const element = document.getElementById(divId)\n element.remove()\n }\n if (document.getElementById(divId) != null) {\n return\n }\n\n $ct.campaignDivMap[campaignId] = divId\n const isBanner = displayObj.layout === 2\n const msgDiv = document.createElement('div')\n msgDiv.id = divId\n const viewHeight = window.innerHeight\n const viewWidth = window.innerWidth\n let legacy = false\n\n if (!isBanner) {\n const marginBottom = viewHeight * 5 / 100\n var contentHeight = 10\n let right = viewWidth * 5 / 100\n let bottomPosition = contentHeight + marginBottom\n let width = viewWidth * 30 / 100 + 20\n let widthPerct = 'width:30%;'\n // for small devices - mobile phones\n if ((/mobile/i.test(navigator.userAgent) || (/mini/i.test(navigator.userAgent))) && /iPad/i.test(navigator.userAgent) === false) {\n width = viewWidth * 85 / 100 + 20\n right = viewWidth * 5 / 100\n bottomPosition = viewHeight * 5 / 100\n widthPerct = 'width:80%;'\n // medium devices - tablets\n } else if ('ontouchstart' in window || (/tablet/i.test(navigator.userAgent))) {\n width = viewWidth * 50 / 100 + 20\n right = viewWidth * 5 / 100\n bottomPosition = viewHeight * 5 / 100\n widthPerct = 'width:50%;'\n }\n // legacy footer notif\n if (displayObj.proto == null) {\n legacy = true\n msgDiv.setAttribute('style', 'display:block;overflow:hidden; bottom:' + bottomPosition + 'px !important;width:' + width + 'px !important;right:' + right + 'px !important;position:fixed;z-index:2147483647;')\n } else {\n msgDiv.setAttribute('style', widthPerct + displayObj.iFrameStyle)\n }\n } else {\n msgDiv.setAttribute('style', displayObj.iFrameStyle)\n }\n document.body.appendChild(msgDiv)\n const iframe = document.createElement('iframe')\n\n const borderRadius = displayObj.br === false ? '0' : '8'\n\n iframe.frameborder = '0px'\n iframe.marginheight = '0px'\n iframe.marginwidth = '0px'\n iframe.scrolling = 'no'\n iframe.id = 'wiz-iframe'\n const onClick = targetingMsgJson.display.onClick\n let pointerCss = ''\n if (onClick !== '' && onClick != null) {\n pointerCss = 'cursor:pointer;'\n }\n\n let html\n // direct html\n if (targetingMsgJson.msgContent.type === 1) {\n html = targetingMsgJson.msgContent.html\n html = html.replace(/##campaignId##/g, campaignId)\n html = html.replace(/##campaignId_batchId##/g, targetingMsgJson.wzrk_id)\n } else {\n const css = '' +\n ''\n\n let bgColor, textColor, btnBg, leftTd, btColor\n if (targetingMsgJson.display.theme === 'dark') {\n bgColor = '#2d2d2e'\n textColor = '#eaeaea'\n btnBg = '#353535'\n leftTd = '#353535'\n btColor = '#ffffff'\n } else {\n bgColor = '#ffffff'\n textColor = '#000000'\n leftTd = '#f4f4f4'\n btnBg = '#a5a6a6'\n btColor = '#ffffff'\n }\n const titleText = targetingMsgJson.msgContent.title\n const descriptionText = targetingMsgJson.msgContent.description\n let imageTd = ''\n if (targetingMsgJson.msgContent.imageUrl != null && targetingMsgJson.msgContent.imageUrl !== '') {\n imageTd = \"\"\n }\n const onClickStr = 'parent.$WZRK_WR.closeIframe(' + campaignId + \",'\" + divId + \"');\"\n const title = \"
\" +\n \"×\" +\n \"
\" +\n \"\" +\n // \"\"+\n '' + imageTd + \"
\" +\n \"
\" + titleText + '
'\n const body = \"
\" + descriptionText + '
'\n html = css + title + body\n }\n\n iframe.setAttribute('style', 'z-index: 2147483647; display:block; width: 100% !important; border:0px !important; border-color:none !important;')\n msgDiv.appendChild(iframe)\n const ifrm = (iframe.contentWindow) ? iframe.contentWindow : (iframe.contentDocument.document) ? iframe.contentDocument.document : iframe.contentDocument\n const doc = ifrm.document\n\n // Dispatch event for popup box/banner close\n const closeCampaign = new Event('CT_campaign_rendered')\n document.dispatchEvent(closeCampaign)\n\n doc.open()\n doc.write(html)\n\n if (displayObj['custom-editor']) {\n appendScriptForCustomEvent(targetingMsgJson, doc)\n }\n doc.close()\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 adjustIFrameHeight()\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 }, 10)\n }\n } else {\n iframe.onload = () => {\n // adjust iframe and body height of html inside correctly\n adjustIFrameHeight()\n const contentDiv = document.getElementById('wiz-iframe').contentDocument.getElementById('contentDiv')\n setupClickUrl(onClick, targetingMsgJson, contentDiv, divId, legacy)\n }\n }\n }\n\n const appendScriptForCustomEvent = (targetingMsgJson, doc) => {\n const script = doc.createElement('script')\n script.innerHTML = `\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 `\n doc.body.appendChild(script)\n }\n\n let _callBackCalled = false\n\n const showFooterNotification = (targetingMsgJson) => {\n let onClick = targetingMsgJson.display.onClick\n\n // TODO: Needs wizrocket as a global variable\n if (window.clevertap.hasOwnProperty('notificationCallback') &&\n typeof window.clevertap.notificationCallback !== 'undefined' &&\n typeof window.clevertap.notificationCallback === 'function') {\n const notificationCallback = window.clevertap.notificationCallback\n\n if (!_callBackCalled) {\n const inaObj = {}\n inaObj.msgContent = targetingMsgJson.msgContent\n inaObj.msgId = targetingMsgJson.wzrk_id\n if (targetingMsgJson.wzrk_pivot) {\n inaObj.pivotId = targetingMsgJson.wzrk_pivot\n }\n if (targetingMsgJson.display.kv != null) {\n inaObj.kv = targetingMsgJson.display.kv\n }\n\n window.clevertap.raiseNotificationClicked = () => {\n if (onClick !== '' && onClick != null) {\n const jsFunc = targetingMsgJson.display.jsFunc\n onClick += getCookieParams()\n\n // invoke js function call\n if (jsFunc != null) {\n // track notification clicked event\n RequestDispatcher.fireRequest(onClick)\n invokeExternalJs(jsFunc, targetingMsgJson)\n return\n }\n // pass on the gcookie|page|scookieId for capturing the click event\n if (targetingMsgJson.display.window === 1) {\n window.open(onClick, '_blank')\n } else {\n window.location = onClick\n }\n }\n }\n window.clevertap.raiseNotificationViewed = () => {\n incrementImpression(targetingMsgJson)\n }\n notificationCallback(inaObj)\n _callBackCalled = true\n }\n } else {\n window.clevertap.popupCurrentWzrkId = targetingMsgJson.wzrk_id\n renderFooterNotification(targetingMsgJson)\n\n if (window.clevertap.hasOwnProperty('popupCallbacks') &&\n typeof window.clevertap.popupCallbacks !== 'undefined' &&\n typeof window.clevertap.popupCallbacks[targetingMsgJson.wzrk_id] === 'function') {\n const popupCallback = window.clevertap.popupCallbacks[targetingMsgJson.wzrk_id]\n\n const inaObj = {}\n inaObj.msgContent = targetingMsgJson.msgContent\n inaObj.msgId = targetingMsgJson.wzrk_id\n\n if (targetingMsgJson.wzrk_pivot) {\n inaObj.pivotId = targetingMsgJson.wzrk_pivot\n }\n\n var msgCTkv = []\n for (var wzrkPrefixKey in targetingMsgJson) {\n // ADD WZRK PREFIX KEY VALUE PAIRS\n if (wzrkPrefixKey.startsWith(WZRK_PREFIX) && wzrkPrefixKey !== WZRK_ID) {\n const wzrkJson = { [wzrkPrefixKey]: targetingMsgJson[wzrkPrefixKey] }\n msgCTkv.push(wzrkJson)\n }\n }\n\n if (msgCTkv.length > 0) {\n inaObj.msgCTkv = msgCTkv\n }\n if (targetingMsgJson.display.kv != null) {\n inaObj.kv = targetingMsgJson.display.kv\n }\n\n // PUBLIC API TO RECORD CLICKED EVENT\n window.clevertap.raisePopupNotificationClicked = (notificationData) => {\n if (!notificationData || !notificationData.msgId) { return }\n\n const eventData = {}\n eventData.type = 'event'\n eventData.evtName = NOTIFICATION_CLICKED\n eventData.evtData = { [WZRK_ID]: notificationData.msgId }\n if (targetingMsgJson.wzrk_pivot) {\n eventData.evtData = { ...eventData.evtData, wzrk_pivot: notificationData.pivotId }\n }\n\n // WZRK PREFIX KEY VALUE PAIRS\n if (notificationData.msgCTkv) {\n for (var wzrkPrefixObj of notificationData.msgCTkv) {\n eventData.evtData = { ...eventData.evtData, ...wzrkPrefixObj }\n }\n }\n\n _request.processEvent(eventData)\n }\n popupCallback(inaObj)\n }\n }\n }\n\n let exitintentObj\n const showExitIntent = (event, targetObj) => {\n let targetingMsgJson\n if (event != null && event.clientY > 0) {\n return\n }\n if (targetObj == null) {\n targetingMsgJson = exitintentObj\n } else {\n targetingMsgJson = targetObj\n }\n\n if ($ct.dismissSpamControl && targetingMsgJson.display.wtarget_type === 0 && document.getElementById('intentPreview') != null && document.getElementById('intentOpacityDiv') != null) {\n const element = document.getElementById('intentPreview')\n element.remove()\n document.getElementById('intentOpacityDiv').remove()\n }\n // ImageOnly campaign and Interstitial/Exit Intent shouldn't coexist\n if (document.getElementById('intentPreview') != null || document.getElementById('wzrkImageOnlyDiv') != null) {\n return\n }\n // dont show exit intent on tablet/mobile - only on desktop\n if (targetingMsgJson.display.layout == null &&\n ((/mobile/i.test(navigator.userAgent)) || (/mini/i.test(navigator.userAgent)) || (/iPad/i.test(navigator.userAgent)) ||\n ('ontouchstart' in window) || (/tablet/i.test(navigator.userAgent)))) {\n return\n }\n\n if (doCampHouseKeeping(targetingMsgJson) === false) {\n return\n }\n\n const campaignId = targetingMsgJson.wzrk_id.split('_')[0]\n $ct.campaignDivMap[campaignId] = 'intentPreview'\n let legacy = false\n const opacityDiv = document.createElement('div')\n opacityDiv.id = 'intentOpacityDiv'\n const opacity = targetingMsgJson.display.opacity || 0.7\n const rgbaColor = `rgba(0,0,0,${opacity})`\n opacityDiv.setAttribute('style', `position: fixed;top: 0;bottom: 0;left: 0;width: 100%;height: 100%;z-index: 2147483646;background: ${rgbaColor};`)\n document.body.appendChild(opacityDiv)\n\n const msgDiv = document.createElement('div')\n msgDiv.id = 'intentPreview'\n\n if (targetingMsgJson.display.proto == null) {\n legacy = true\n msgDiv.setAttribute('style', 'display:block;overflow:hidden;top:55% !important;left:50% !important;position:fixed;z-index:2147483647;width:600px !important;height:600px !important;margin:-300px 0 0 -300px !important;')\n } else {\n msgDiv.setAttribute('style', targetingMsgJson.display.iFrameStyle)\n }\n document.body.appendChild(msgDiv)\n const iframe = document.createElement('iframe')\n const borderRadius = targetingMsgJson.display.br === false ? '0' : '8'\n iframe.frameborder = '0px'\n iframe.marginheight = '0px'\n iframe.marginwidth = '0px'\n iframe.scrolling = 'no'\n iframe.id = 'wiz-iframe-intent'\n const onClick = targetingMsgJson.display.onClick\n let pointerCss = ''\n if (onClick !== '' && onClick != null) {\n pointerCss = 'cursor:pointer;'\n }\n let html\n // direct html\n if (targetingMsgJson.msgContent.type === 1) {\n html = targetingMsgJson.msgContent.html\n html = html.replace(/##campaignId##/g, campaignId)\n html = html.replace(/##campaignId_batchId##/g, targetingMsgJson.wzrk_id)\n } else {\n const css = '' +\n ''\n\n let bgColor, textColor, btnBg, btColor\n if (targetingMsgJson.display.theme === 'dark') {\n bgColor = '#2d2d2e'\n textColor = '#eaeaea'\n btnBg = '#353535'\n btColor = '#ffffff'\n } else {\n bgColor = '#ffffff'\n textColor = '#000000'\n btnBg = '#a5a6a6'\n btColor = '#ffffff'\n }\n const titleText = targetingMsgJson.msgContent.title\n const descriptionText = targetingMsgJson.msgContent.description\n let ctaText = ''\n if (targetingMsgJson.msgContent.ctaText != null && targetingMsgJson.msgContent.ctaText !== '') {\n ctaText = \"'\n }\n\n let imageTd = ''\n if (targetingMsgJson.msgContent.imageUrl != null && targetingMsgJson.msgContent.imageUrl !== '') {\n imageTd = \"
\"
'\n }\n const onClickStr = 'parent.$WZRK_WR.closeIframe(' + campaignId + \",'intentPreview');\"\n const title = \"
\" +\n \"×\" +\n \"
\" +\n \"
\" + titleText + '
'\n const body = \"
\" + descriptionText + '
' + imageTd + ctaText +\n '
'\n html = css + title + body\n }\n iframe.setAttribute('style', 'z-index: 2147483647; display:block; height: 100% !important; width: 100% !important;min-height:80px !important;border:0px !important; border-color:none !important;')\n msgDiv.appendChild(iframe)\n const ifrm = (iframe.contentWindow) ? iframe.contentWindow : (iframe.contentDocument.document) ? iframe.contentDocument.document : iframe.contentDocument\n const doc = ifrm.document\n\n // Dispatch event for interstitial/exit intent close\n const closeCampaign = new Event('CT_campaign_rendered')\n document.dispatchEvent(closeCampaign)\n\n doc.open()\n doc.write(html)\n if (targetingMsgJson.display['custom-editor']) {\n appendScriptForCustomEvent(targetingMsgJson, doc)\n }\n doc.close()\n\n const contentDiv = document.getElementById('wiz-iframe-intent').contentDocument.getElementById('contentDiv')\n setupClickUrl(onClick, targetingMsgJson, contentDiv, 'intentPreview', legacy)\n }\n\n if (!document.body) {\n if (_wizCounter < 6) {\n _wizCounter++\n setTimeout(_tr, 1000, msg, {\n device: _device,\n session: _session,\n request: _request,\n logger: _logger\n })\n }\n return\n }\n const processNativeDisplayArr = (arrInAppNotifs) => {\n Object.keys(arrInAppNotifs).map(key => {\n var elementId, id\n if (arrInAppNotifs[key].display.divId) {\n elementId = arrInAppNotifs[key].display.divId\n id = document.getElementById(elementId)\n } else {\n elementId = arrInAppNotifs[key].display.divSelector\n id = document.querySelector(elementId)\n }\n if (id !== null) {\n arrInAppNotifs[key].msgContent.type === 2 ? renderPersonalisationBanner(arrInAppNotifs[key]) : renderPersonalisationCarousel(arrInAppNotifs[key])\n delete arrInAppNotifs[key]\n }\n })\n }\n\n const addLoadListener = (arrInAppNotifs) => {\n window.addEventListener('load', () => {\n let count = 0\n if (count < 20) {\n const t = setInterval(() => {\n processNativeDisplayArr(arrInAppNotifs)\n if (Object.keys(arrInAppNotifs).length === 0 || count === 20) {\n clearInterval(t)\n arrInAppNotifs = {}\n }\n count++\n }, 500)\n }\n })\n }\n\n if (msg.inapp_notifs != null) {\n const arrInAppNotifs = {}\n for (let index = 0; index < msg.inapp_notifs.length; index++) {\n const targetNotif = msg.inapp_notifs[index]\n if (targetNotif.display.wtarget_type == null || targetNotif.display.wtarget_type === 0) {\n showFooterNotification(targetNotif)\n } else if (targetNotif.display.wtarget_type === 1) { // if display['wtarget_type']==1 then exit intent\n exitintentObj = targetNotif\n window.document.body.onmouseleave = showExitIntent\n } else if (targetNotif.display.wtarget_type === 2) { // if display['wtarget_type']==2 then web native display\n if (targetNotif.msgContent.type === 2 || targetNotif.msgContent.type === 3) { // Check for banner and carousel\n const element = targetNotif.display.divId ? document.getElementById(targetNotif.display.divId) : document.querySelector(targetNotif.display.divSelector)\n if (element !== null) {\n targetNotif.msgContent.type === 2 ? renderPersonalisationBanner(targetNotif) : renderPersonalisationCarousel(targetNotif)\n } else {\n arrInAppNotifs[targetNotif.wzrk_id.split('_')[0]] = targetNotif // Add targetNotif to object\n }\n } else {\n showFooterNotification(targetNotif)\n }\n }\n }\n // Process banner or carousel campaign array\n if (Object.keys(arrInAppNotifs).length) {\n if (document.readyState === 'complete') {\n processNativeDisplayArr(arrInAppNotifs)\n } else {\n addLoadListener(arrInAppNotifs)\n }\n }\n }\n\n const mergeEventMap = (newEvtMap) => {\n if ($ct.globalEventsMap == null) {\n $ct.globalEventsMap = StorageManager.readFromLSorCookie(EV_COOKIE)\n if ($ct.globalEventsMap == null) {\n $ct.globalEventsMap = newEvtMap\n return\n }\n }\n for (const key in newEvtMap) {\n if (newEvtMap.hasOwnProperty(key)) {\n const oldEvtObj = $ct.globalEventsMap[key]\n const newEvtObj = newEvtMap[key]\n if ($ct.globalEventsMap[key] != null) {\n if (newEvtObj[0] != null && newEvtObj[0] > oldEvtObj[0]) {\n $ct.globalEventsMap[key] = newEvtObj\n }\n } else {\n $ct.globalEventsMap[key] = newEvtObj\n }\n }\n }\n }\n\n const handleInboxNotifications = () => {\n if (msg.inbox_preview) {\n processInboxNotifs(msg)\n return\n }\n if (msg.inbox_notifs) {\n const msgArr = []\n for (let index = 0; index < msg.inbox_notifs.length; index++) {\n if (doCampHouseKeeping(msg.inbox_notifs[index]) !== false) {\n msgArr.push(msg.inbox_notifs[index])\n }\n }\n processInboxNotifs(msgArr)\n }\n }\n\n if (msg.webInboxSetting || msg.inbox_notifs != null) {\n /**\n * When the user visits a website for the 1st time after web inbox channel is setup,\n * we need to initialise the inbox here because the initializeWebInbox method within init will not be executed\n * as we would not have any entry related to webInboxSettings in the LS\n */\n\n if (hasWebInboxSettingsInLS()) {\n checkAndRegisterWebInboxElements()\n }\n if ($ct.inbox === null) {\n msg.webInboxSetting && processWebInboxSettings(msg.webInboxSetting)\n initializeWebInbox(_logger)\n .then(() => {\n handleInboxNotifications()\n })\n .catch(e => {})\n } else {\n handleInboxNotifications()\n }\n }\n\n if (msg.vars) {\n $ct.variableStore.mergeVariables(msg.vars)\n return\n }\n\n const staleDataUpdate = (staledata, campType) => {\n const campObj = getCampaignObject()\n const globalObj = campObj[campType].global\n if (globalObj != null && campType) {\n for (const idx in staledata) {\n if (staledata.hasOwnProperty(idx)) {\n delete globalObj[staledata[idx]]\n if (StorageManager.read(CAMP_COOKIE_G)) {\n const guidCampObj = JSON.parse(decodeURIComponent(StorageManager.read(CAMP_COOKIE_G)))\n const guid = JSON.parse(decodeURIComponent(StorageManager.read(GCOOKIE_NAME)))\n if (guidCampObj[guid] && guidCampObj[guid][campType] && guidCampObj[guid][campType][staledata[idx]]) {\n delete guidCampObj[guid][campType][staledata[idx]]\n StorageManager.save(CAMP_COOKIE_G, encodeURIComponent(JSON.stringify(guidCampObj)))\n }\n }\n }\n }\n }\n saveCampaignObject(campObj)\n }\n\n if (StorageManager._isLocalStorageSupported()) {\n try {\n if (msg.evpr != null) {\n const eventsMap = msg.evpr.events\n const profileMap = msg.evpr.profile\n const syncExpiry = msg.evpr.expires_in\n const now = getNow()\n StorageManager.setMetaProp('lsTime', now)\n StorageManager.setMetaProp('exTs', syncExpiry)\n mergeEventMap(eventsMap)\n StorageManager.saveToLSorCookie(EV_COOKIE, $ct.globalEventsMap)\n if ($ct.globalProfileMap == null) {\n addToLocalProfileMap(profileMap, true)\n } else {\n addToLocalProfileMap(profileMap, false)\n }\n }\n if (msg.arp != null) {\n arp(msg.arp)\n }\n if (msg.inapp_stale != null && msg.inapp_stale.length > 0) {\n // web popup stale\n staleDataUpdate(msg.inapp_stale, 'wp')\n }\n if (msg.inbox_stale != null && msg.inbox_stale.length > 0) {\n // web inbox stale\n staleDataUpdate(msg.inbox_stale, 'wi')\n }\n } catch (e) {\n _logger.error('Unable to persist evrp/arp: ' + e)\n }\n }\n}\n\nexport default _tr\n","import {\n StorageManager\n} from '../util/storage'\nexport default class User {\n #isPersonalisationActive\n\n constructor ({\n isPersonalisationActive\n }) {\n this.#isPersonalisationActive = isPersonalisationActive\n }\n\n getTotalVisits () {\n if (!this.#isPersonalisationActive()) {\n return\n }\n let visitCount = StorageManager.getMetaProp('sc')\n if (visitCount == null) {\n visitCount = 1\n }\n return visitCount\n }\n\n getLastVisit () {\n if (!this.#isPersonalisationActive()) {\n return\n }\n const prevSession = StorageManager.getMetaProp('ps')\n if (prevSession != null) {\n return new Date(prevSession * 1000)\n }\n }\n}\n","import {\n CLEVERTAP_ERROR_PREFIX\n} from '../util/messages'\n\nexport const logLevels = {\n DISABLE: 0,\n ERROR: 1,\n INFO: 2,\n DEBUG: 3,\n DEBUG_PE: 4\n}\n\nexport class Logger {\n #logLevel\n wzrkError = {}\n constructor (logLevel) {\n this.#logLevel = logLevel == null ? logLevel : logLevels.INFO\n this.wzrkError = {}\n }\n\n get logLevel () {\n return this.#logLevel\n }\n\n set logLevel (logLevel) {\n this.#logLevel = logLevel\n }\n\n error (message) {\n if (this.#logLevel >= logLevels.ERROR) {\n this.#log('error', message)\n }\n }\n\n info (message) {\n if (this.#logLevel >= logLevels.INFO) {\n this.#log('log', message)\n }\n }\n\n debug (message) {\n if (this.#logLevel >= logLevels.DEBUG || this.#isLegacyDebug) {\n this.#log('debug', message)\n }\n }\n\n debugPE (message) {\n if (this.#logLevel >= logLevels.DEBUG_PE) {\n this.#log('debug_pe', message)\n }\n }\n\n reportError (code, description) {\n this.wzrkError.c = code\n this.wzrkError.d = description\n this.error(`${CLEVERTAP_ERROR_PREFIX} ${code}: ${description}`)\n }\n\n #log (level, message) {\n if (window.console) {\n try {\n const ts = new Date().getTime()\n console[level](`CleverTap [${ts}]: ${message}`)\n } catch (e) {}\n }\n }\n\n get #isLegacyDebug () {\n return (typeof sessionStorage !== 'undefined' && sessionStorage.WZRK_D === '')\n }\n}\n\nexport default {\n Logger,\n logLevels\n}\n","import { singleQuoteRegex, SCOOKIE_EXP_TIME_IN_SECS } from '../util/constants'\nimport { isObject } from '../util/datatypes'\nimport { getNow } from '../util/datetime'\nimport { StorageManager } from '../util/storage'\nimport { getHostName } from '../util/url'\n\nexport default class SessionManager {\n #logger\n #sessionId\n #isPersonalisationActive\n cookieName // SCOOKIE_NAME\n scookieObj\n\n constructor ({\n logger,\n isPersonalisationActive\n }) {\n this.sessionId = StorageManager.getMetaProp('cs')\n this.#logger = logger\n this.#isPersonalisationActive = isPersonalisationActive\n }\n\n get sessionId () {\n return this.#sessionId\n }\n\n set sessionId (sessionId) {\n this.#sessionId = sessionId\n }\n\n getSessionCookieObject () {\n let scookieStr = StorageManager.readCookie(this.cookieName)\n let obj = {}\n\n if (scookieStr != null) {\n // converting back single quotes to double for JSON parsing - http://www.iandevlin.com/blog/2012/04/html5/cookies-json-localstorage-and-opera\n scookieStr = scookieStr.replace(singleQuoteRegex, '\"')\n\n obj = JSON.parse(scookieStr)\n if (!isObject(obj)) {\n obj = {}\n } else {\n if (typeof obj.t !== 'undefined') { // check time elapsed since last request\n const lastTime = obj.t\n const now = getNow()\n if ((now - lastTime) > (SCOOKIE_EXP_TIME_IN_SECS + 60)) {\n // adding 60 seconds to compensate for in-journey requests\n // ideally the cookie should've died after SCOOKIE_EXP_TIME_IN_SECS but it's still around as we can read\n // hence we shouldn't use it.\n obj = {}\n }\n }\n }\n }\n this.scookieObj = obj\n return obj\n }\n\n setSessionCookieObject (obj) {\n const objStr = JSON.stringify(obj)\n StorageManager.createBroadCookie(this.cookieName, objStr, SCOOKIE_EXP_TIME_IN_SECS, getHostName())\n }\n\n manageSession (session) {\n // first time. check if current session id in localstorage is same\n // if not same then prev = current and current = this new session\n if (typeof this.sessionId === 'undefined' || this.sessionId !== session) {\n const currentSessionInLS = StorageManager.getMetaProp('cs')\n // if sessionId in meta is undefined - set current to both\n if (typeof currentSessionInLS === 'undefined') {\n StorageManager.setMetaProp('ps', session)\n StorageManager.setMetaProp('cs', session)\n StorageManager.setMetaProp('sc', 1)\n } else if (currentSessionInLS !== session) {\n // not same as session in local storage. new session\n StorageManager.setMetaProp('ps', currentSessionInLS)\n StorageManager.setMetaProp('cs', session)\n let sessionCount = StorageManager.getMetaProp('sc')\n if (typeof sessionCount === 'undefined') {\n sessionCount = 0\n }\n StorageManager.setMetaProp('sc', sessionCount + 1)\n }\n this.sessionId = session\n }\n }\n\n getTimeElapsed () {\n if (!this.#isPersonalisationActive()) {\n return\n }\n if (this.scookieObj != null) { // TODO: check logic?\n this.scookieObj = this.getSessionCookieObject()\n }\n const sessionStart = this.scookieObj.s\n if (sessionStart != null) {\n const ts = getNow()\n return Math.floor(ts - sessionStart)\n }\n }\n\n getPageCount () {\n if (!this.#isPersonalisationActive()) {\n return\n }\n\n if (this.scookieObj != null) { // TODO: check logic\n this.scookieObj = this.getSessionCookieObject()\n }\n return this.scookieObj.p\n }\n}\n","import { CAMP_COOKIE_NAME, CLEAR, EVT_PUSH, EV_COOKIE, FIRE_PUSH_UNREGISTERED, LCOOKIE_NAME, PUSH_SUBSCRIPTION_DATA, WEBPUSH_LS_KEY } from '../util/constants'\nimport { isObjectEmpty, isValueValid, removeUnsupportedChars } from '../util/datatypes'\nimport { getNow } from '../util/datetime'\nimport { compressData } from '../util/encoder'\nimport RequestDispatcher from '../util/requestDispatcher'\nimport { StorageManager, $ct } from '../util/storage'\nimport { addToURL } from '../util/url'\nimport { getCampaignObjForLc } from '../util/clevertap'\n\nlet seqNo = 0\nlet requestTime = 0\n\nexport default class RequestManager {\n #logger\n #account\n #device\n #session\n #isPersonalisationActive\n #clearCookie = false\n processingBackup = false\n\n constructor ({ logger, account, device, session, isPersonalisationActive }) {\n this.#logger = logger\n this.#account = account\n this.#device = device\n this.#session = session\n this.#isPersonalisationActive = isPersonalisationActive\n\n RequestDispatcher.logger = logger\n RequestDispatcher.device = device\n RequestDispatcher.account = account\n }\n\n processBackupEvents () {\n const backupMap = StorageManager.readFromLSorCookie(LCOOKIE_NAME)\n if (typeof backupMap === 'undefined' || backupMap === null) {\n return\n }\n this.processingBackup = true\n for (const idx in backupMap) {\n if (backupMap.hasOwnProperty(idx)) {\n const backupEvent = backupMap[idx]\n if (typeof backupEvent.fired === 'undefined') {\n this.#logger.debug('Processing backup event : ' + backupEvent.q)\n if (typeof backupEvent.q !== 'undefined') {\n RequestDispatcher.fireRequest(backupEvent.q)\n }\n backupEvent.fired = true\n }\n }\n }\n StorageManager.saveToLSorCookie(LCOOKIE_NAME, backupMap)\n this.processingBackup = false\n }\n\n addSystemDataToObject (dataObject, ignoreTrim) {\n // ignore trim for chrome notifications; undefined everywhere else\n if (typeof ignoreTrim === 'undefined') {\n dataObject = removeUnsupportedChars(dataObject, this.#logger)\n }\n\n if (!isObjectEmpty(this.#logger.wzrkError)) {\n dataObject.wzrk_error = this.#logger.wzrkError\n this.#logger.wzrkError = {}\n }\n\n dataObject.id = this.#account.id\n\n if (isValueValid(this.#device.gcookie)) {\n dataObject.g = this.#device.gcookie\n }\n\n const obj = this.#session.getSessionCookieObject()\n dataObject.s = obj.s // session cookie\n dataObject.pg = (typeof obj.p === 'undefined') ? 1 : obj.p // Page count\n let proto = document.location.protocol\n proto = proto.replace(':', '')\n dataObject.af = { lib: 'web-sdk-v$$PACKAGE_VERSION$$', protocol: proto, ...$ct.flutterVersion } // app fields\n if (sessionStorage.hasOwnProperty('WZRK_D')) { dataObject.debug = true }\n\n return dataObject\n }\n\n addFlags (data) {\n // check if cookie should be cleared.\n this.#clearCookie = StorageManager.getAndClearMetaProp(CLEAR)\n if (this.#clearCookie !== undefined && this.#clearCookie) {\n data.rc = true\n this.#logger.debug('reset cookie sent in request and cleared from meta for future requests.')\n }\n if (this.#isPersonalisationActive()) {\n const lastSyncTime = StorageManager.getMetaProp('lsTime')\n const expirySeconds = StorageManager.getMetaProp('exTs')\n\n // dsync not found in local storage - get data from server\n if (typeof lastSyncTime === 'undefined' || typeof expirySeconds === 'undefined') {\n data.dsync = true\n return\n }\n const now = getNow()\n // last sync time has expired - get fresh data from server\n if (lastSyncTime + expirySeconds < now) {\n data.dsync = true\n }\n }\n }\n\n // saves url to backup cache and fires the request\n /**\n *\n * @param {string} url\n * @param {boolean} override whether the request can go through or not\n * @param {Boolean} sendOULFlag - true in case of a On User Login request\n */\n saveAndFireRequest (url, override, sendOULFlag, evtName) {\n const now = getNow()\n url = addToURL(url, 'rn', ++$ct.globalCache.REQ_N)\n const data = url + '&i=' + now + '&sn=' + seqNo\n StorageManager.backupEvent(data, $ct.globalCache.REQ_N, this.#logger)\n\n // if offline is set to true, save the request in backup and return\n if ($ct.offline) return\n // if there is no override\n // and an OUL request is not in progress\n // then process the request as it is\n // else block the request\n // note - $ct.blockRequest should ideally be used for override\n if ((!override || (this.#clearCookie !== undefined && this.#clearCookie)) && !window.isOULInProgress) {\n if (now === requestTime) {\n seqNo++\n } else {\n requestTime = now\n seqNo = 0\n }\n window.oulReqN = $ct.globalCache.REQ_N\n RequestDispatcher.fireRequest(data, false, sendOULFlag, evtName)\n } else {\n this.#logger.debug(`Not fired due to override - ${$ct.blockRequest} or clearCookie - ${this.#clearCookie} or OUL request in progress - ${window.isOULInProgress}`)\n }\n }\n\n unregisterTokenForGuid (givenGUID) {\n const payload = StorageManager.readFromLSorCookie(PUSH_SUBSCRIPTION_DATA)\n // Send unregister event only when token is available\n if (payload) {\n const data = {}\n data.type = 'data'\n if (isValueValid(givenGUID)) {\n data.g = givenGUID\n }\n data.action = 'unregister'\n data.id = this.#account.id\n\n const obj = this.#session.getSessionCookieObject()\n\n data.s = obj.s // session cookie\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', 'data')\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n RequestDispatcher.fireRequest(pageLoadUrl, true)\n StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, false)\n }\n // REGISTER TOKEN\n this.registerToken(payload)\n }\n\n registerToken (payload) {\n if (!payload) return\n // add gcookie etc to the payload\n payload = this.addSystemDataToObject(payload, true)\n payload = JSON.stringify(payload)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', 'data')\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(payload, this.#logger))\n RequestDispatcher.fireRequest(pageLoadUrl)\n // set in localstorage\n StorageManager.save(WEBPUSH_LS_KEY, 'ok')\n }\n\n processEvent (data) {\n this.#addToLocalEventMap(data.evtName)\n data = this.addSystemDataToObject(data, undefined)\n this.addFlags(data)\n data[CAMP_COOKIE_NAME] = getCampaignObjForLc()\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.saveAndFireRequest(pageLoadUrl, $ct.blockRequest, false, data.evtName)\n }\n\n #addToLocalEventMap (evtName) {\n if (StorageManager._isLocalStorageSupported()) {\n if (typeof $ct.globalEventsMap === 'undefined') {\n $ct.globalEventsMap = StorageManager.readFromLSorCookie(EV_COOKIE)\n if (typeof $ct.globalEventsMap === 'undefined') {\n $ct.globalEventsMap = {}\n }\n }\n\n const nowTs = getNow()\n let evtDetail = $ct.globalEventsMap[evtName]\n if (typeof evtDetail !== 'undefined') {\n evtDetail[2] = nowTs\n evtDetail[0]++\n } else {\n evtDetail = []\n evtDetail.push(1)\n evtDetail.push(nowTs)\n evtDetail.push(nowTs)\n }\n $ct.globalEventsMap[evtName] = evtDetail\n StorageManager.saveToLSorCookie(EV_COOKIE, $ct.globalEventsMap)\n }\n }\n\n post (url, body) {\n return fetch(url, {\n method: 'post',\n headers: { 'Content-Type': 'application/json' },\n body: body\n })\n .then((response) => {\n if (response.ok) {\n return response.json()\n }\n throw response\n })\n .then((data) => {\n this.#logger.debug('Sync data successful', data)\n return data\n })\n .catch((e) => {\n this.#logger.debug('Error in syncing variables', e)\n throw e\n })\n }\n}\n","import {\n isObjectEmpty\n} from '../util/datatypes'\nimport {\n EVT_PUSH,\n USEIP_KEY,\n OPTOUT_KEY,\n CT_OPTOUT_KEY\n} from '../util/constants'\nimport {\n StorageManager,\n $ct\n} from '../util/storage'\nimport {\n compressData\n} from '../util/encoder'\nimport {\n addToURL\n} from '../util/url'\n\nexport default class Privacy extends Array {\n #request\n #account\n #oldValues\n #logger\n\n constructor ({\n request,\n account,\n logger\n },\n values) {\n super()\n this.#logger = logger\n this.#request = request\n this.#account = account\n this.#oldValues = values\n }\n\n push (...privacyArr) {\n if ($ct.isPrivacyArrPushed) {\n this.#processPrivacyArray($ct.privacyArray.length > 0 ? $ct.privacyArray : privacyArr)\n } else {\n $ct.privacyArray.push(...privacyArr)\n }\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#processPrivacyArray(this.#oldValues)\n }\n this.#oldValues = null\n }\n\n #processPrivacyArray (privacyArr) {\n if (Array.isArray(privacyArr) && privacyArr.length > 0) {\n const privacyObj = privacyArr.reduce((prev, curr) => ({ ...prev, ...curr }), {})\n let data = {}\n const profileObj = {}\n var optOut = false\n\n if (privacyObj.hasOwnProperty(OPTOUT_KEY)) {\n optOut = privacyObj[OPTOUT_KEY]\n if (typeof optOut === 'boolean') {\n profileObj[CT_OPTOUT_KEY] = optOut\n // should be true when user wants to opt in\n $ct.isOptInRequest = !optOut\n }\n }\n if (privacyObj.hasOwnProperty(USEIP_KEY)) {\n const useIP = privacyObj[USEIP_KEY]\n const shouldUseIP = (typeof useIP === 'boolean') ? useIP : false\n StorageManager.setMetaProp(USEIP_KEY, shouldUseIP)\n }\n if (!isObjectEmpty(profileObj)) {\n data.type = 'profile'\n data.profile = profileObj\n data = this.#request.addSystemDataToObject(data, undefined)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n pageLoadUrl = addToURL(pageLoadUrl, OPTOUT_KEY, optOut ? 'true' : 'false')\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n privacyArr.splice(0, privacyArr.length)\n }\n }\n }\n}\n","import { StorageManager, $ct } from '../util/storage'\nimport { isObject } from '../util/datatypes'\nimport {\n PUSH_SUBSCRIPTION_DATA\n} from '../util/constants'\nimport {\n urlBase64ToUint8Array\n} from '../util/encoder'\n\nexport default class NotificationHandler extends Array {\n #oldValues\n #logger\n #request\n #account\n #wizAlertJSPath\n #fcmPublicKey\n\n constructor ({\n logger,\n session,\n request,\n account\n }, values) {\n super()\n this.#wizAlertJSPath = 'https://d2r1yp2w7bby2u.cloudfront.net/js/wzrk_dialog.min.js'\n this.#fcmPublicKey = null\n this.#oldValues = values\n this.#logger = logger\n this.#request = request\n this.#account = account\n }\n\n push (...displayArgs) {\n this.#setUpWebPush(displayArgs)\n return 0\n }\n\n _processOldValues () {\n if (this.#oldValues) {\n this.#setUpWebPush(this.#oldValues)\n }\n this.#oldValues = null\n }\n\n #setUpWebPush (displayArgs) {\n if ($ct.webPushEnabled && displayArgs.length > 0) {\n this.#handleNotificationRegistration(displayArgs)\n } else if ($ct.webPushEnabled == null && displayArgs.length > 0) {\n $ct.notifApi.notifEnabledFromApi = true\n $ct.notifApi.displayArgs = displayArgs.slice()\n } else if ($ct.webPushEnabled === false && displayArgs.length > 0) {\n this.#logger.error('Make sure push notifications are fully enabled and integrated')\n }\n }\n\n #setUpWebPushNotifications (subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsServiceUrl) {\n if (navigator.userAgent.indexOf('Chrome') !== -1 || navigator.userAgent.indexOf('Firefox') !== -1) {\n this.#setUpChromeFirefoxNotifications(subscriptionCallback, serviceWorkerPath)\n } else if (navigator.userAgent.indexOf('Safari') !== -1) {\n this.#setUpSafariNotifications(subscriptionCallback, apnsWebPushId, apnsServiceUrl)\n }\n }\n\n #setApplicationServerKey (applicationServerKey) {\n this.#fcmPublicKey = applicationServerKey\n }\n\n #setUpSafariNotifications (subscriptionCallback, apnsWebPushId, apnsServiceUrl) {\n // ensure that proper arguments are passed\n if (typeof apnsWebPushId === 'undefined') {\n this.#logger.error('Ensure that APNS Web Push ID is supplied')\n }\n if (typeof apnsServiceUrl === 'undefined') {\n this.#logger.error('Ensure that APNS Web Push service path is supplied')\n }\n if ('safari' in window && 'pushNotification' in window.safari) {\n window.safari.pushNotification.requestPermission(\n apnsServiceUrl,\n apnsWebPushId, {}, (subscription) => {\n if (subscription.permission === 'granted') {\n const subscriptionData = JSON.parse(JSON.stringify(subscription))\n subscriptionData.endpoint = subscription.deviceToken\n subscriptionData.browser = 'Safari'\n StorageManager.saveToLSorCookie(PUSH_SUBSCRIPTION_DATA, subscriptionData)\n\n this.#request.registerToken(subscriptionData)\n this.#logger.info('Safari Web Push registered. Device Token: ' + subscription.deviceToken)\n } else if (subscription.permission === 'denied') {\n this.#logger.info('Error subscribing to Safari web push')\n }\n })\n }\n }\n\n /**\n * Sets up a service worker for WebPush(chrome/Firefox) push notifications and sends the data to LC\n */\n #setUpChromeFirefoxNotifications (subscriptionCallback, serviceWorkerPath) {\n let registrationScope = ''\n\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.register(serviceWorkerPath).then((registration) => {\n if (typeof __wzrk_account_id !== 'undefined') { // eslint-disable-line\n // shopify accounts , since the service worker is not at root, serviceWorker.ready is never resolved.\n // hence add a timeout and hope serviceWroker is ready within that time.\n return new Promise(resolve => setTimeout(() => resolve(registration), 5000))\n }\n registrationScope = registration.scope\n\n // IF SERVICE WORKER IS AT ROOT, RETURN THE READY PROMISE\n // ELSE IF CHROME RETURN PROMISE AFTER 5 SECONDS\n // OR getRegistrations PROMISE IF ITS FIREFOX\n const rootDirRegex = /^(\\.?)(\\/?)([^/]*).js$/\n const isServiceWorkerAtRoot = rootDirRegex.test(serviceWorkerPath)\n if (isServiceWorkerAtRoot) {\n return navigator.serviceWorker.ready\n } else {\n if (navigator.userAgent.indexOf('Chrome') !== -1) {\n return new Promise(resolve => setTimeout(() => resolve(registration), 5000))\n } else {\n return navigator.serviceWorker.getRegistrations()\n }\n }\n }).then((serviceWorkerRegistration) => {\n // ITS AN ARRAY IN CASE OF FIREFOX, SO USE THE REGISTRATION WITH PROPER SCOPE\n if (navigator.userAgent.indexOf('Firefox') !== -1 && Array.isArray(serviceWorkerRegistration)) {\n serviceWorkerRegistration = serviceWorkerRegistration.filter((i) => i.scope === registrationScope)[0]\n }\n const subscribeObj = { userVisibleOnly: true }\n\n if (this.#fcmPublicKey != null) {\n subscribeObj.applicationServerKey = urlBase64ToUint8Array(this.#fcmPublicKey)\n }\n\n serviceWorkerRegistration.pushManager.subscribe(subscribeObj)\n .then((subscription) => {\n this.#logger.info('Service Worker registered. Endpoint: ' + subscription.endpoint)\n\n // convert the subscription keys to strings; this sets it up nicely for pushing to LC\n const subscriptionData = JSON.parse(JSON.stringify(subscription))\n\n // remove the common chrome/firefox endpoint at the beginning of the token\n if (navigator.userAgent.indexOf('Chrome') !== -1) {\n subscriptionData.endpoint = subscriptionData.endpoint.split('/').pop()\n subscriptionData.browser = 'Chrome'\n } else if (navigator.userAgent.indexOf('Firefox') !== -1) {\n subscriptionData.endpoint = subscriptionData.endpoint.split('/').pop()\n subscriptionData.browser = 'Firefox'\n }\n StorageManager.saveToLSorCookie(PUSH_SUBSCRIPTION_DATA, subscriptionData)\n this.#request.registerToken(subscriptionData)\n\n if (typeof subscriptionCallback !== 'undefined' && typeof subscriptionCallback === 'function') {\n subscriptionCallback()\n }\n }).catch((error) => {\n this.#logger.error('Error subscribing: ' + error)\n // unsubscribe from webpush if error\n serviceWorkerRegistration.pushManager.getSubscription().then((subscription) => {\n if (subscription !== null) {\n subscription.unsubscribe().then((successful) => {\n // You've successfully unsubscribed\n this.#logger.info('Unsubscription successful')\n }).catch((e) => {\n // Unsubscription failed\n this.#logger.error('Error unsubscribing: ' + e)\n })\n }\n })\n })\n }).catch((err) => {\n this.#logger.error('error registering service worker: ' + err)\n })\n }\n }\n\n #addWizAlertJS () {\n const scriptTag = document.createElement('script')\n scriptTag.setAttribute('type', 'text/javascript')\n scriptTag.setAttribute('id', 'wzrk-alert-js')\n scriptTag.setAttribute('src', this.#wizAlertJSPath)\n\n // add the script tag to the end of the body\n document.getElementsByTagName('body')[0].appendChild(scriptTag)\n\n return scriptTag\n }\n\n #removeWizAlertJS () {\n const scriptTag = document.getElementById('wzrk-alert-js')\n scriptTag.parentNode.removeChild(scriptTag)\n }\n\n #handleNotificationRegistration (displayArgs) {\n // make sure everything is specified\n let titleText\n let bodyText\n let okButtonText\n let rejectButtonText\n let okButtonColor\n let skipDialog\n let askAgainTimeInSeconds\n let okCallback\n let rejectCallback\n let subscriptionCallback\n let serviceWorkerPath\n let httpsPopupPath\n let httpsIframePath\n let apnsWebPushId\n let apnsWebPushServiceUrl\n\n if (displayArgs.length === 1) {\n if (isObject(displayArgs[0])) {\n const notifObj = displayArgs[0]\n titleText = notifObj.titleText\n bodyText = notifObj.bodyText\n okButtonText = notifObj.okButtonText\n rejectButtonText = notifObj.rejectButtonText\n okButtonColor = notifObj.okButtonColor\n skipDialog = notifObj.skipDialog\n askAgainTimeInSeconds = notifObj.askAgainTimeInSeconds\n okCallback = notifObj.okCallback\n rejectCallback = notifObj.rejectCallback\n subscriptionCallback = notifObj.subscriptionCallback\n serviceWorkerPath = notifObj.serviceWorkerPath\n httpsPopupPath = notifObj.httpsPopupPath\n httpsIframePath = notifObj.httpsIframePath\n apnsWebPushId = notifObj.apnsWebPushId\n apnsWebPushServiceUrl = notifObj.apnsWebPushServiceUrl\n }\n } else {\n titleText = displayArgs[0]\n bodyText = displayArgs[1]\n okButtonText = displayArgs[2]\n rejectButtonText = displayArgs[3]\n okButtonColor = displayArgs[4]\n skipDialog = displayArgs[5]\n askAgainTimeInSeconds = displayArgs[6]\n }\n\n if (skipDialog == null) {\n skipDialog = false\n }\n\n if (serviceWorkerPath == null) {\n serviceWorkerPath = '/clevertap_sw.js'\n }\n\n // ensure that the browser supports notifications\n if (typeof navigator.serviceWorker === 'undefined') {\n return\n }\n\n const isHTTP = httpsPopupPath != null && httpsIframePath != null\n\n // make sure the site is on https for chrome notifications\n if (window.location.protocol !== 'https:' && document.location.hostname !== 'localhost' && !isHTTP) {\n this.#logger.error('Make sure you are https or localhost to register for notifications')\n return\n }\n\n // right now, we only support Chrome V50 & higher & Firefox\n if (navigator.userAgent.indexOf('Chrome') !== -1) {\n const chromeAgent = navigator.userAgent.match(/Chrome\\/(\\d+)/)\n if (chromeAgent == null || parseInt(chromeAgent[1], 10) < 50) { return }\n } else if (navigator.userAgent.indexOf('Firefox') !== -1) {\n const firefoxAgent = navigator.userAgent.match(/Firefox\\/(\\d+)/)\n if (firefoxAgent == null || parseInt(firefoxAgent[1], 10) < 50) { return }\n } else if (navigator.userAgent.indexOf('Safari') !== -1) {\n const safariAgent = navigator.userAgent.match(/Safari\\/(\\d+)/)\n if (safariAgent == null || parseInt(safariAgent[1], 10) < 50) { return }\n } else {\n return\n }\n\n // we check for the cookie in setUpChromeNotifications() the tokens may have changed\n\n if (!isHTTP) {\n if (Notification == null) {\n return\n }\n // handle migrations from other services -> chrome notifications may have already been asked for before\n if (Notification.permission === 'granted') {\n // skip the dialog and register\n this.#setUpWebPushNotifications(subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsWebPushServiceUrl)\n return\n } else if (Notification.permission === 'denied') {\n // we've lost this profile :'(\n return\n }\n\n if (skipDialog) {\n this.#setUpWebPushNotifications(subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsWebPushServiceUrl)\n return\n }\n }\n\n // make sure the right parameters are passed\n if (!titleText || !bodyText || !okButtonText || !rejectButtonText) {\n this.#logger.error('Missing input parameters; please specify title, body, ok button and cancel button text')\n return\n }\n\n // make sure okButtonColor is formatted properly\n if (okButtonColor == null || !okButtonColor.match(/^#[a-f\\d]{6}$/i)) {\n okButtonColor = '#f28046' // default color for positive button\n }\n\n // make sure the user isn't asked for notifications more than askAgainTimeInSeconds\n const now = new Date().getTime() / 1000\n if ((StorageManager.getMetaProp('notif_last_time')) == null) {\n StorageManager.setMetaProp('notif_last_time', now)\n } else {\n if (askAgainTimeInSeconds == null) {\n // 7 days by default\n askAgainTimeInSeconds = 7 * 24 * 60 * 60\n }\n\n if (now - StorageManager.getMetaProp('notif_last_time') < askAgainTimeInSeconds) {\n return\n } else {\n // continue asking\n StorageManager.setMetaProp('notif_last_time', now)\n }\n }\n\n if (isHTTP) {\n // add the https iframe\n const httpsIframe = document.createElement('iframe')\n httpsIframe.setAttribute('style', 'display:none;')\n httpsIframe.setAttribute('src', httpsIframePath)\n document.body.appendChild(httpsIframe)\n window.addEventListener('message', (event) => {\n if (event.data != null) {\n let obj = {}\n try {\n obj = JSON.parse(event.data)\n } catch (e) {\n // not a call from our iframe\n return\n }\n if (obj.state != null) {\n if (obj.from === 'ct' && obj.state === 'not') {\n this.#addWizAlertJS().onload = () => {\n // create our wizrocket popup\n window.wzrkPermissionPopup.wizAlert({\n title: titleText,\n body: bodyText,\n confirmButtonText: okButtonText,\n confirmButtonColor: okButtonColor,\n rejectButtonText: rejectButtonText\n }, (enabled) => { // callback function\n if (enabled) {\n // the user accepted on the dialog box\n if (typeof okCallback === 'function') {\n okCallback()\n }\n // redirect to popup.html\n window.open(httpsPopupPath)\n } else {\n if (typeof rejectCallback === 'function') {\n rejectCallback()\n }\n }\n this.#removeWizAlertJS()\n })\n }\n }\n }\n }\n }, false)\n } else {\n this.#addWizAlertJS().onload = () => {\n // create our wizrocket popup\n window.wzrkPermissionPopup.wizAlert({\n title: titleText,\n body: bodyText,\n confirmButtonText: okButtonText,\n confirmButtonColor: okButtonColor,\n rejectButtonText: rejectButtonText\n }, (enabled) => { // callback function\n if (enabled) {\n // the user accepted on the dialog box\n if (typeof okCallback === 'function') {\n okCallback()\n }\n this.#setUpWebPushNotifications(subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsWebPushServiceUrl)\n } else {\n if (typeof rejectCallback === 'function') {\n rejectCallback()\n }\n }\n this.#removeWizAlertJS()\n })\n }\n }\n }\n\n _enableWebPush (enabled, applicationServerKey) {\n $ct.webPushEnabled = enabled\n if (applicationServerKey != null) {\n this.#setApplicationServerKey(applicationServerKey)\n }\n if ($ct.webPushEnabled && $ct.notifApi.notifEnabledFromApi) {\n this.#handleNotificationRegistration($ct.notifApi.displayArgs)\n } else if (!$ct.webPushEnabled && $ct.notifApi.notifEnabledFromApi) {\n this.#logger.error('Ensure that web push notifications are fully enabled and integrated before requesting them')\n }\n }\n}\n","export class Variable {\n #variableStore\n\n /**\n * Creates an instance of the Variable class.\n *\n * @constructor\n * @param {VariableStore} options.variableStore - The VariableStore instance for registration.\n * @param {string|null} options.name - The name of the variable.\n * @param {*} options.defaultValue - The default value of the variable.\n * @param {*} options.value - The current value of the variable.\n * @param {string|null} options.type - The type of the variable (string, number, boolean).\n * @param {boolean} options.hadStarted - A flag indicating whether the variable has started (used internally).\n * @param {Function[]} options.valueChangedCallbacks - Array to store callbacks to be executed when the variable value changes.\n */\n constructor ({ variableStore }) {\n this.name = null\n this.defaultValue = null\n this.value = null\n this.type = null\n this.hadStarted = false\n this.valueChangedCallbacks = []\n this.#variableStore = variableStore\n }\n\n getValue () {\n return this.value\n }\n\n getdefaultValue () {\n return this.defaultValue\n }\n\n /**\n * Defines a new variable with the provided name, default value, and variable store.\n * @static\n * @param {string} name - The name of the variable.\n * @param {*} defaultValue - The default value of the variable.\n * @param {VariableStore} variableStore - The VariableStore instance for registration.\n * @returns {Variable|null} - The created Variable instance or null if invalid parameters are provided.\n */\n static define (name, defaultValue, variableStore) {\n if (!name || typeof name !== 'string') {\n console.error('Empty or invalid name parameter provided.')\n return null\n }\n if (name.startsWith('.') || name.endsWith('.')) {\n console.error('Variable name starts or ends with a `.` which is not allowed: ' + name)\n return null\n }\n\n const typeOfDefaultValue = typeof defaultValue\n if (typeOfDefaultValue !== 'string' && typeOfDefaultValue !== 'number' && typeOfDefaultValue !== 'boolean') {\n console.error('Only primitive types (string, number, boolean) are accepted as value')\n return null\n }\n\n const existing = variableStore.getVariable(name)\n if (existing) {\n return existing\n }\n\n const varInstance = new Variable({ variableStore })\n try {\n varInstance.name = name\n varInstance.defaultValue = defaultValue\n varInstance.value = defaultValue\n varInstance.type = typeOfDefaultValue\n variableStore.registerVariable(varInstance)\n varInstance.update(defaultValue)\n } catch (error) {\n console.error(error)\n }\n return varInstance\n }\n\n /**\n * Updates the variable's value, triggering callbacks if hasVarsRequestCompleted is returned true.\n * @param {*} newValue - The new value to be assigned to the variable.\n */\n update (newValue) {\n const oldValue = this.value\n this.value = newValue\n if (newValue === null && oldValue === null) {\n return\n }\n if (newValue !== null && newValue === oldValue && this.hadStarted) {\n return\n }\n if (this.#variableStore.hasVarsRequestCompleted()) {\n this.hadStarted = true\n this.triggerValueChanged()\n }\n }\n\n /**\n * Invokes all registered callbacks when the variable value changes.\n */\n triggerValueChanged () {\n this.valueChangedCallbacks.forEach((onValueChanged) => {\n onValueChanged(this)\n })\n }\n\n /**\n * Adds a callback function to the array and triggers it immediately if variable requests have completed.\n * @param {Function} onValueChanged - The callback function to be added.\n */\n addValueChangedCallback (onValueChanged) {\n if (!onValueChanged) {\n console.log('Invalid callback parameter provided.')\n return\n }\n this.valueChangedCallbacks.push(onValueChanged)\n\n if (this.#variableStore.hasVarsRequestCompleted()) {\n onValueChanged(this)\n }\n }\n\n /**\n * Removes a callback function from the array.\n * @param {Function} onValueChanged - The callback function to be removed.\n */\n removeValueChangedCallback (onValueChanged) {\n const index = this.valueChangedCallbacks.indexOf(onValueChanged)\n if (index !== -1) {\n this.valueChangedCallbacks.splice(index, 1)\n }\n }\n\n /**\n * Resets the `hadStarted` flag to false.\n */\n clearStartFlag () {\n this.hadStarted = false\n }\n}\n","import { VARIABLES, WZRK_FETCH } from '../../util/constants'\nimport { StorageManager, $ct } from '../../util/storage'\nclass VariableStore {\n #logger\n #account\n #request\n #event\n\n #variables\n #remoteVariables\n #fetchCallback\n #variablesChangedCallbacks\n #oneTimeVariablesChangedCallbacks\n #hasVarsRequestCompleted = false\n\n constructor ({ logger, request, account, event }) {\n this.#logger = logger\n this.#account = account\n this.#request = request\n this.#event = event\n\n this.#variables = {}\n this.#remoteVariables = {}\n this.#variablesChangedCallbacks = []\n this.#oneTimeVariablesChangedCallbacks = []\n\n $ct.variableStore = this\n }\n\n /**\n * Registers a variable instance in the store.\n * @param {Object} varInstance - The variable instance to be registered.\n */\n registerVariable (varInstance) {\n const { name } = varInstance\n this.#variables[name] = varInstance\n console.log('registerVariable', this.#variables)\n }\n\n /**\n * Retrieves a variable by its name.\n * @param {string} name - The name of the variable to retrieve.\n * @returns {Object} - The variable instance.\n */\n getVariable (name) {\n return this.#variables[name]\n }\n\n hasVarsRequestCompleted () {\n return this.#hasVarsRequestCompleted\n }\n\n /**\n * Synchronizes variables with the server.\n * @param {Function} onSyncSuccess - Callback function on successful synchronization.\n * @param {Function} onSyncFailure - Callback function on synchronization failure.\n * @throws Will throw an error if the account token is missing.\n * @returns {Promise} - The result of the synchronization request.\n */\n syncVariables (onSyncSuccess, onSyncFailure) {\n if (!this.#account.token) {\n const m = 'Account token is missing.'\n this.#logger.error(m)\n return Promise.reject(new Error(m))\n }\n\n const payload = {\n type: 'varsPayload',\n vars: {}\n }\n\n for (const name in this.#variables) {\n payload.vars[name] = {\n defaultValue: this.#variables[name].defaultValue,\n type: this.#variables[name].type\n }\n }\n\n // Check if payload.vars is empty\n if (Object.keys(payload.vars).length === 0) {\n const m = 'No variables are defined.'\n this.#logger.error(m)\n return Promise.reject(new Error(m))\n }\n\n let meta = {}\n meta = this.#request.addSystemDataToObject(meta, undefined)\n meta.tk = this.#account.token\n\n meta.type = 'meta'\n const body = JSON.stringify([meta, payload])\n const url = this.#account.dataPostPEURL\n\n return this.#request.post(url, body)\n .then((r) => {\n if (onSyncSuccess && typeof onSyncSuccess === 'function') {\n onSyncSuccess(r)\n }\n return r\n })\n .catch((e) => {\n if (onSyncFailure && typeof onSyncFailure === 'function') {\n onSyncFailure(e)\n }\n if (e.status === 400) {\n this.#logger.error('Invalid sync payload or clear the existing draft')\n } else if (e.status === 401) {\n this.#logger.error('This is not a test profile')\n } else {\n this.#logger.error('Sync variable failed')\n }\n throw e\n })\n }\n\n /**\n * Fetches variables from the server.\n * @param {Function} onFetchCallback - Callback function on fetch completion.\n */\n fetchVariables (onFetchCallback) {\n this.#event.push(WZRK_FETCH, { t: 4 })\n if (onFetchCallback && typeof onFetchCallback === 'function') {\n this.#fetchCallback = onFetchCallback\n }\n }\n\n mergeVariables (vars) {\n console.log('msg vars is ', vars)\n this.#hasVarsRequestCompleted = true\n\n StorageManager.saveToLSorCookie(VARIABLES, vars)\n this.#remoteVariables = vars\n\n for (const name in this.#variables) {\n if (vars.hasOwnProperty(name)) {\n this.#variables[name].update(vars[name])\n }\n }\n\n if (this.#fetchCallback) {\n this.#fetchCallback()\n }\n\n this.#runVariablesChangedCallback()\n }\n\n addVariablesChangedCallback (callback) {\n if (callback && typeof callback === 'function') {\n this.#variablesChangedCallbacks.push(callback)\n\n if (this.hasVarsRequestCompleted()) {\n callback()\n }\n } else {\n this.#logger.error('callback is not a function')\n }\n }\n\n addOneTimeVariablesChangedCallback (callback) {\n if (callback && typeof callback === 'function') {\n if (this.hasVarsRequestCompleted()) {\n callback()\n } else {\n this.#oneTimeVariablesChangedCallbacks.push(callback)\n }\n }\n }\n\n removeVariablesChangedCallback (callback) {\n const index = this.#variablesChangedCallbacks.indexOf(callback)\n if (index !== -1) {\n this.#variablesChangedCallbacks.splice(index, 1)\n }\n }\n\n removeOneTimeVariablesChangedCallback (callback) {\n const index = this.#oneTimeVariablesChangedCallbacks.indexOf(callback)\n if (index !== -1) {\n this.#oneTimeVariablesChangedCallbacks.splice(index, 1)\n }\n }\n\n #runVariablesChangedCallback () {\n for (var callback of this.#variablesChangedCallbacks) {\n callback()\n }\n for (var callBack of this.#oneTimeVariablesChangedCallbacks) {\n callBack()\n }\n this.#oneTimeVariablesChangedCallbacks.length = 0\n }\n}\n\nexport default VariableStore\n","import Account from './modules/account'\nimport CleverTapAPI from './modules/api'\nimport DeviceManager from './modules/device'\nimport EventHandler from './modules/event'\nimport ProfileHandler from './modules/profile'\nimport UserLoginHandler from './modules/userLogin'\nimport _tr from './util/tr'\nimport User from './modules/user'\nimport { Logger, logLevels } from './modules/logger'\nimport SessionManager from './modules/session'\nimport ReqestManager from './modules/request'\nimport {\n CAMP_COOKIE_NAME,\n SCOOKIE_PREFIX,\n NOTIFICATION_VIEWED,\n NOTIFICATION_CLICKED,\n EVT_PING,\n FIRST_PING_FREQ_IN_MILLIS,\n CONTINUOUS_PING_FREQ_IN_MILLIS,\n GROUP_SUBSCRIPTION_REQUEST_ID,\n WZRK_ID,\n WZRK_PREFIX,\n categoryLongKey,\n COMMAND_INCREMENT,\n COMMAND_DECREMENT,\n COMMAND_SET,\n COMMAND_ADD,\n COMMAND_REMOVE,\n COMMAND_DELETE,\n EVT_PUSH,\n WZRK_FETCH\n} from './util/constants'\nimport { EMBED_ERROR } from './util/messages'\nimport { StorageManager, $ct } from './util/storage'\nimport { addToURL, getDomain, getURLParams } from './util/url'\nimport { getCampaignObjForLc, setEnum, handleEmailSubscription, closeIframe } from './util/clevertap'\nimport { compressData } from './util/encoder'\nimport Privacy from './modules/privacy'\nimport NotificationHandler from './modules/notification'\nimport { hasWebInboxSettingsInLS, checkAndRegisterWebInboxElements, initializeWebInbox, getInboxMessages, saveInboxMessages } from './modules/web-inbox/helper'\nimport { Variable } from './modules/variables/variable'\nimport VariableStore from './modules/variables/variableStore'\n\nexport default class CleverTap {\n #logger\n #api\n #onloadcalled\n #device\n #session\n #account\n #request\n #variableStore\n #isSpa\n #previousUrl\n #boundCheckPageChanged = this.#checkPageChanged.bind(this)\n #dismissSpamControl\n enablePersonalization\n\n get spa () {\n return this.#isSpa\n }\n\n set spa (value) {\n const isSpa = value === true\n if (this.#isSpa !== isSpa && this.#onloadcalled === 1) {\n // if clevertap.spa is changed after init has been called then update the click listeners\n if (isSpa) {\n document.addEventListener('click', this.#boundCheckPageChanged)\n } else {\n document.removeEventListener('click', this.#boundCheckPageChanged)\n }\n }\n this.#isSpa = isSpa\n }\n\n get dismissSpamControl () {\n return this.#dismissSpamControl\n }\n\n set dismissSpamControl (value) {\n const dismissSpamControl = value === true\n this.#dismissSpamControl = dismissSpamControl\n $ct.dismissSpamControl = dismissSpamControl\n }\n\n constructor (clevertap = {}) {\n this.#onloadcalled = 0\n this._isPersonalisationActive = this._isPersonalisationActive.bind(this)\n this.raiseNotificationClicked = () => { }\n this.#logger = new Logger(logLevels.INFO)\n this.#account = new Account(clevertap.account?.[0], clevertap.region || clevertap.account?.[1], clevertap.targetDomain || clevertap.account?.[2], clevertap.token || clevertap.account?.[3])\n this.#device = new DeviceManager({ logger: this.#logger })\n this.#dismissSpamControl = clevertap.dismissSpamControl || false\n this.shpfyProxyPath = clevertap.shpfyProxyPath || ''\n this.#session = new SessionManager({\n logger: this.#logger,\n isPersonalisationActive: this._isPersonalisationActive\n })\n this.#request = new ReqestManager({\n logger: this.#logger,\n account: this.#account,\n device: this.#device,\n session: this.#session,\n isPersonalisationActive: this._isPersonalisationActive\n })\n this.enablePersonalization = clevertap.enablePersonalization || false\n this.event = new EventHandler({\n logger: this.#logger,\n request: this.#request,\n isPersonalisationActive: this._isPersonalisationActive\n }, clevertap.event)\n\n this.profile = new ProfileHandler({\n logger: this.#logger,\n request: this.#request,\n account: this.#account,\n isPersonalisationActive: this._isPersonalisationActive\n }, clevertap.profile)\n\n this.onUserLogin = new UserLoginHandler({\n request: this.#request,\n account: this.#account,\n session: this.#session,\n logger: this.#logger,\n device: this.#device\n }, clevertap.onUserLogin)\n\n this.privacy = new Privacy({\n request: this.#request,\n account: this.#account,\n logger: this.#logger\n }, clevertap.privacy)\n\n this.notifications = new NotificationHandler({\n logger: this.#logger,\n request: this.#request,\n account: this.#account\n }, clevertap.notifications)\n\n this.#variableStore = new VariableStore({\n logger: this.#logger,\n request: this.#request,\n account: this.#account,\n event: this.event\n })\n\n this.#api = new CleverTapAPI({\n logger: this.#logger,\n request: this.#request,\n device: this.#device,\n session: this.#session\n })\n\n this.spa = clevertap.spa\n this.dismissSpamControl = clevertap.dismissSpamControl\n\n this.user = new User({\n isPersonalisationActive: this._isPersonalisationActive\n })\n\n this.session = {\n getTimeElapsed: () => {\n return this.#session.getTimeElapsed()\n },\n getPageCount: () => {\n return this.#session.getPageCount()\n }\n }\n\n this.logout = () => {\n this.#logger.debug('logout called')\n StorageManager.setInstantDeleteFlagInK()\n }\n\n this.clear = () => {\n this.onUserLogin.clear()\n }\n\n this.getCleverTapID = () => {\n return this.#device.getGuid()\n }\n\n this.getAccountID = () => {\n return this.#account.id\n }\n\n this.getSCDomain = () => {\n return this.#account.finalTargetDomain\n }\n\n this.setLibrary = (libName, libVersion) => {\n $ct.flutterVersion = { [libName]: libVersion }\n }\n\n // Set the Signed Call sdk version and fire request\n this.setSCSDKVersion = (ver) => {\n this.#account.scSDKVersion = ver\n const data = {}\n data.af = { scv: 'sc-sdk-v' + this.#account.scSDKVersion }\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', 'page')\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(JSON.stringify(data), this.#logger))\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n\n if (hasWebInboxSettingsInLS()) {\n checkAndRegisterWebInboxElements()\n initializeWebInbox(this.#logger)\n }\n\n // Get Inbox Message Count\n this.getInboxMessageCount = () => {\n const msgCount = getInboxMessages()\n return Object.keys(msgCount).length\n }\n\n // Get Inbox Unread Message Count\n this.getInboxMessageUnreadCount = () => {\n if ($ct.inbox) {\n return $ct.inbox.unviewedCounter\n } else {\n this.#logger.debug('No unread messages')\n }\n }\n\n // Get All Inbox messages\n this.getAllInboxMessages = () => {\n return getInboxMessages()\n }\n\n // Get only Unread messages\n this.getUnreadInboxMessages = () => {\n if ($ct.inbox) {\n return $ct.inbox.unviewedMessages\n } else {\n this.#logger.debug('No unread messages')\n }\n }\n\n // Get message object belonging to the given message id only. Message id should be a String\n this.getInboxMessageForId = (messageId) => {\n const messages = getInboxMessages()\n if ((messageId !== null || messageId !== '') && messages.hasOwnProperty(messageId)) {\n return messages[messageId]\n } else {\n this.#logger.error('No message available for message Id ' + messageId)\n }\n }\n\n // Delete message from the Inbox. Message id should be a String\n // If the message to be deleted is unviewed then decrement the badge count, delete the message from unviewedMessages list\n // Then remove the message from local storage and update cookie\n this.deleteInboxMessage = (messageId) => {\n const messages = getInboxMessages()\n if ((messageId !== null || messageId !== '') && messages.hasOwnProperty(messageId)) {\n const el = document.querySelector('ct-web-inbox').shadowRoot.getElementById(messageId)\n if (messages[messageId].viewed === 0) {\n $ct.inbox.unviewedCounter--\n delete $ct.inbox.unviewedMessages[messageId]\n document.getElementById('unviewedBadge').innerText = $ct.inbox.unviewedCounter\n document.getElementById('unviewedBadge').style.display = $ct.inbox.unviewedCounter > 0 ? 'flex' : 'none'\n }\n el && el.remove()\n delete messages[messageId]\n saveInboxMessages(messages)\n } else {\n this.#logger.error('No message available for message Id ' + messageId)\n }\n }\n\n /* Mark Message as Read. Message id should be a String\n - Check if the message Id exist in the unread message list\n - Remove the unread marker, update the viewed flag, decrement the bage Count\n - renderNotificationViewed */\n this.markReadInboxMessage = (messageId) => {\n const unreadMsg = $ct.inbox.unviewedMessages\n const messages = getInboxMessages()\n if ((messageId !== null || messageId !== '') && unreadMsg.hasOwnProperty(messageId)) {\n const el = document.querySelector('ct-web-inbox').shadowRoot.getElementById(messageId)\n if (el !== null) { el.shadowRoot.getElementById('unreadMarker').style.display = 'none' }\n messages[messageId].viewed = 1\n if (document.getElementById('unviewedBadge')) {\n var counter = parseInt(document.getElementById('unviewedBadge').innerText) - 1\n document.getElementById('unviewedBadge').innerText = counter\n document.getElementById('unviewedBadge').style.display = counter > 0 ? 'flex' : 'none'\n }\n window.clevertap.renderNotificationViewed({ msgId: messages[messageId].wzrk_id, pivotId: messages[messageId].pivotId })\n $ct.inbox.unviewedCounter--\n delete $ct.inbox.unviewedMessages[messageId]\n saveInboxMessages(messages)\n } else {\n this.#logger.error('No message available for message Id ' + messageId)\n }\n }\n\n /* Mark Message as Read. messageIds should be a an array of string */\n this.markReadInboxMessagesForIds = (messageIds) => {\n if (Array.isArray(messageIds)) {\n for (var id = 0; id < messageIds.length; id++) {\n this.markReadInboxMessage(messageIds[id])\n }\n }\n }\n\n /* Mark all messages as read\n - Get the count of unread messages, update unread marker style\n - renderNotificationViewed, update the badge count and style\n */\n this.markReadAllInboxMessage = () => {\n const unreadMsg = $ct.inbox.unviewedMessages\n const messages = getInboxMessages()\n if (Object.keys(unreadMsg).length > 0) {\n const msgIds = Object.keys(unreadMsg)\n msgIds.forEach(key => {\n const el = document.querySelector('ct-web-inbox').shadowRoot.getElementById(key)\n if (el !== null) { el.shadowRoot.getElementById('unreadMarker').style.display = 'none' }\n messages[key].viewed = 1\n window.clevertap.renderNotificationViewed({ msgId: messages[key].wzrk_id, pivotId: messages[key].wzrk_pivot })\n })\n document.getElementById('unviewedBadge').innerText = 0\n document.getElementById('unviewedBadge').style.display = 'none'\n saveInboxMessages(messages)\n $ct.inbox.unviewedCounter = 0\n $ct.inbox.unviewedMessages = {}\n } else {\n this.#logger.debug('All messages are already read')\n }\n }\n\n this.toggleInbox = (e) => $ct.inbox?.toggleInbox(e)\n\n // method for notification viewed\n this.renderNotificationViewed = (detail) => {\n processNotificationEvent(NOTIFICATION_VIEWED, detail)\n }\n\n // method for notification clicked\n this.renderNotificationClicked = (detail) => {\n processNotificationEvent(NOTIFICATION_CLICKED, detail)\n }\n\n const processNotificationEvent = (eventName, eventDetail) => {\n if (!eventDetail || !eventDetail.msgId) { return }\n const data = {}\n data.type = 'event'\n data.evtName = eventName\n data.evtData = { [WZRK_ID]: eventDetail.msgId }\n\n if (eventDetail.pivotId) {\n data.evtData = { ...data.evtData, wzrk_pivot: eventDetail.pivotId }\n }\n\n if (eventDetail.wzrk_slideNo) {\n data.evtData = { ...data.evtData, wzrk_slideNo: eventDetail.wzrk_slideNo }\n }\n\n // Adding kv pair to event data\n if (eventDetail.kv && eventDetail.kv !== null && eventDetail.kv !== undefined) {\n for (const key in eventDetail.kv) {\n if (key.startsWith(WZRK_PREFIX)) {\n data.evtData = { ...data.evtData, [key]: eventDetail.kv[key] }\n }\n }\n }\n\n // Adding msgCTkv to event data\n if (eventDetail.msgCTkv && eventDetail.msgCTkv !== null && eventDetail.msgCTkv !== undefined) {\n for (const key in eventDetail.msgCTkv) {\n if (key.startsWith(WZRK_PREFIX)) {\n data.evtData = { ...data.evtData, [key]: eventDetail.msgCTkv[key] }\n }\n }\n }\n this.#request.processEvent(data)\n }\n\n this.setLogLevel = (l) => {\n this.#logger.logLevel = Number(l)\n if (l === 3) {\n sessionStorage.WZRK_D = ''\n } else {\n delete sessionStorage.WZRK_D\n }\n }\n /**\n * @param {} key\n * @param {*} value\n */\n this.handleIncrementValue = (key, value) => {\n this.profile._handleIncrementDecrementValue(key, value, COMMAND_INCREMENT)\n }\n\n this.handleDecrementValue = (key, value) => {\n this.profile._handleIncrementDecrementValue(key, value, COMMAND_DECREMENT)\n }\n\n this.setMultiValuesForKey = (key, value) => {\n if (Array.isArray(value)) {\n this.profile._handleMultiValueSet(key, value, COMMAND_SET)\n } else {\n console.error('setMultiValuesForKey should be called with a value of type array')\n }\n }\n\n this.addMultiValueForKey = (key, value) => {\n if (typeof value === 'string' || typeof value === 'number') {\n this.profile._handleMultiValueAdd(key, value, COMMAND_ADD)\n } else {\n console.error('addMultiValueForKey should be called with a value of type string or number.')\n }\n }\n\n this.addMultiValuesForKey = (key, value) => {\n if (Array.isArray(value)) {\n this.profile._handleMultiValueAdd(key, value, COMMAND_ADD)\n } else {\n console.error('addMultiValuesForKey should be called with a value of type array.')\n }\n }\n\n this.removeMultiValueForKey = (key, value) => {\n if (typeof value === 'string' || typeof value === 'number') {\n this.profile._handleMultiValueRemove(key, value, COMMAND_REMOVE)\n } else {\n console.error('removeMultiValueForKey should be called with a value of type string or number.')\n }\n }\n\n this.removeMultiValuesForKey = (key, value) => {\n if (Array.isArray(value)) {\n this.profile._handleMultiValueRemove(key, value, COMMAND_REMOVE)\n } else {\n console.error('removeMultiValuesForKey should be called with a value of type array.')\n }\n }\n\n this.removeValueForKey = (key) => {\n this.profile._handleMultiValueDelete(key, COMMAND_DELETE)\n }\n\n const _handleEmailSubscription = (subscription, reEncoded, fetchGroups) => {\n handleEmailSubscription(subscription, reEncoded, fetchGroups, this.#account, this.#logger)\n }\n\n /**\n *\n * @param {number} lat\n * @param {number} lng\n * @param {callback function} handleCoordinates\n * @returns\n */\n this.getLocation = function (lat, lng) {\n // latitude and longitude should be number type\n if ((lat && typeof lat !== 'number') || (lng && typeof lng !== 'number')) {\n console.log('Latitude and Longitude must be of number type')\n return\n }\n if (lat && lng) {\n // valid latitude ranges bw +-90\n if (lat <= -90 || lat > 90) {\n console.log('A vaid latitude must range between -90 and 90')\n return\n }\n // valid longitude ranges bw +-180\n if (lng <= -180 || lng > 180) {\n console.log('A valid longitude must range between -180 and 180')\n return\n }\n $ct.location = { Latitude: lat, Longitude: lng }\n this.sendLocationData({ Latitude: lat, Longitude: lng })\n } else {\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(showPosition.bind(this), showError)\n } else {\n console.log('Geolocation is not supported by this browser.')\n }\n }\n }\n\n function showPosition (position) {\n var lat = position.coords.latitude\n var lng = position.coords.longitude\n $ct.location = { Latitude: lat, Longitude: lng }\n this.sendLocationData({ Latitude: lat, Longitude: lng })\n }\n\n function showError (error) {\n switch (error.code) {\n case error.PERMISSION_DENIED:\n console.log('User denied the request for Geolocation.')\n break\n case error.POSITION_UNAVAILABLE:\n console.log('Location information is unavailable.')\n break\n case error.TIMEOUT:\n console.log('The request to get user location timed out.')\n break\n case error.UNKNOWN_ERROR:\n console.log('An unknown error occurred.')\n break\n }\n }\n\n const api = this.#api\n api.logout = this.logout\n api.clear = this.clear\n api.closeIframe = (campaignId, divIdIgnored) => {\n closeIframe(campaignId, divIdIgnored, this.#session.sessionId)\n }\n api.enableWebPush = (enabled, applicationServerKey) => {\n this.notifications._enableWebPush(enabled, applicationServerKey)\n }\n api.tr = (msg) => {\n _tr(msg, {\n device: this.#device,\n session: this.#session,\n request: this.#request,\n logger: this.#logger\n })\n }\n api.setEnum = (enumVal) => {\n setEnum(enumVal, this.#logger)\n }\n api.is_onloadcalled = () => {\n return (this.#onloadcalled === 1)\n }\n api.subEmail = (reEncoded) => {\n _handleEmailSubscription('1', reEncoded)\n }\n api.getEmail = (reEncoded, withGroups) => {\n _handleEmailSubscription('-1', reEncoded, withGroups)\n }\n api.unSubEmail = (reEncoded) => {\n _handleEmailSubscription('0', reEncoded)\n }\n api.unsubEmailGroups = (reEncoded) => {\n $ct.unsubGroups = []\n const elements = document.getElementsByClassName('ct-unsub-group-input-item')\n\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i]\n if (element.name) {\n const data = { name: element.name, isUnsubscribed: element.checked }\n $ct.unsubGroups.push(data)\n }\n }\n\n _handleEmailSubscription(GROUP_SUBSCRIPTION_REQUEST_ID, reEncoded)\n }\n api.setSubscriptionGroups = (value) => {\n $ct.unsubGroups = value\n }\n api.getSubscriptionGroups = () => {\n return $ct.unsubGroups\n }\n api.changeSubscriptionGroups = (reEncoded, updatedGroups) => {\n api.setSubscriptionGroups(updatedGroups)\n _handleEmailSubscription(GROUP_SUBSCRIPTION_REQUEST_ID, reEncoded)\n }\n api.isGlobalUnsubscribe = () => {\n return $ct.globalUnsubscribe\n }\n api.setIsGlobalUnsubscribe = (value) => {\n $ct.globalUnsubscribe = value\n }\n api.setUpdatedCategoryLong = (profile) => {\n if (profile[categoryLongKey]) {\n $ct.updatedCategoryLong = profile[categoryLongKey]\n }\n }\n window.$CLTP_WR = window.$WZRK_WR = api\n\n if (clevertap.account?.[0].id) {\n // The accountId is present so can init with empty values.\n // Needed to maintain backward compatability with legacy implementations.\n // Npm imports/require will need to call init explictly with accountId\n this.init()\n }\n }\n\n // starts here\n init (accountId, region, targetDomain, token) {\n if (this.#onloadcalled === 1) {\n // already initailsed\n return\n }\n StorageManager.removeCookie('WZRK_P', window.location.hostname)\n if (!this.#account.id) {\n if (!accountId) {\n this.#logger.error(EMBED_ERROR)\n return\n }\n this.#account.id = accountId\n }\n this.#session.cookieName = SCOOKIE_PREFIX + '_' + this.#account.id\n\n if (region) {\n this.#account.region = region\n }\n if (targetDomain) {\n this.#account.targetDomain = targetDomain\n }\n if (token) {\n this.#account.token = token\n }\n\n const currLocation = location.href\n const urlParams = getURLParams(currLocation.toLowerCase())\n\n // eslint-disable-next-line eqeqeq\n if (typeof urlParams.e !== 'undefined' && urlParams.wzrk_ex == '0') {\n return\n }\n\n $ct.isPrivacyArrPushed = true\n if ($ct.privacyArray.length > 0) {\n this.privacy.push($ct.privacyArray)\n }\n\n this.#processOldValues()\n this.pageChanged()\n const backupInterval = setInterval(() => {\n if (this.#device.gcookie) {\n clearInterval(backupInterval)\n this.#request.processBackupEvents()\n }\n }, 3000)\n if (this.#isSpa) {\n // listen to click on the document and check if URL has changed.\n document.addEventListener('click', this.#boundCheckPageChanged)\n } else {\n // remove existing click listeners if any\n document.removeEventListener('click', this.#boundCheckPageChanged)\n }\n this.#onloadcalled = 1\n }\n\n // process the option array provided to the clevertap object\n // after its been initialized\n #processOldValues () {\n this.onUserLogin._processOldValues()\n this.privacy._processOldValues()\n this.event._processOldValues()\n this.profile._processOldValues()\n this.notifications._processOldValues()\n }\n\n #debounce (func, delay = 300) {\n let timeout\n return function () {\n clearTimeout(timeout)\n timeout = setTimeout(func, delay)\n }\n }\n\n #checkPageChanged () {\n const debouncedPageChanged = this.#debounce(() => {\n if (this.#previousUrl !== location.href) {\n this.pageChanged()\n }\n })\n debouncedPageChanged()\n }\n\n pageChanged () {\n const currLocation = window.location.href\n const urlParams = getURLParams(currLocation.toLowerCase())\n // -- update page count\n const obj = this.#session.getSessionCookieObject()\n let pgCount = (typeof obj.p === 'undefined') ? 0 : obj.p\n obj.p = ++pgCount\n this.#session.setSessionCookieObject(obj)\n // -- update page count\n\n let data = {}\n let referrerDomain = getDomain(document.referrer)\n\n if (window.location.hostname !== referrerDomain) {\n const maxLen = 120\n if (referrerDomain !== '') {\n referrerDomain = referrerDomain.length > maxLen ? referrerDomain.substring(0, maxLen) : referrerDomain\n data.referrer = referrerDomain\n }\n\n let utmSource = urlParams.utm_source || urlParams.wzrk_source\n if (typeof utmSource !== 'undefined') {\n utmSource = utmSource.length > maxLen ? utmSource.substring(0, maxLen) : utmSource\n data.us = utmSource // utm_source\n }\n\n let utmMedium = urlParams.utm_medium || urlParams.wzrk_medium\n if (typeof utmMedium !== 'undefined') {\n utmMedium = utmMedium.length > maxLen ? utmMedium.substring(0, maxLen) : utmMedium\n data.um = utmMedium // utm_medium\n }\n\n let utmCampaign = urlParams.utm_campaign || urlParams.wzrk_campaign\n if (typeof utmCampaign !== 'undefined') {\n utmCampaign = utmCampaign.length > maxLen ? utmCampaign.substring(0, maxLen) : utmCampaign\n data.uc = utmCampaign // utm_campaign\n }\n\n // also independently send wzrk_medium to the backend\n if (typeof urlParams.wzrk_medium !== 'undefined') {\n const wm = urlParams.wzrk_medium\n if (wm.match(/^email$|^social$|^search$/)) {\n data.wm = wm // wzrk_medium\n }\n }\n }\n\n data = this.#request.addSystemDataToObject(data, undefined)\n data.cpg = currLocation\n\n data[CAMP_COOKIE_NAME] = getCampaignObjForLc()\n let pageLoadUrl = this.#account.dataPostURL\n this.#request.addFlags(data)\n // send dsync flag when page = 1\n if (parseInt(data.pg) === 1) {\n this.#overrideDSyncFlag(data)\n }\n pageLoadUrl = addToURL(pageLoadUrl, 'type', 'page')\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(JSON.stringify(data), this.#logger))\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n\n if (parseInt(data.pg) === 1) {\n this.event.push(WZRK_FETCH, { t: 4 })\n }\n\n this.#previousUrl = currLocation\n setTimeout(() => {\n if (pgCount <= 3) {\n // send ping for up to 3 pages\n this.#pingRequest()\n }\n\n if (this.#isPingContinuous()) {\n setInterval(() => {\n this.#pingRequest()\n }, CONTINUOUS_PING_FREQ_IN_MILLIS)\n }\n }, FIRST_PING_FREQ_IN_MILLIS)\n }\n\n #pingRequest () {\n let pageLoadUrl = this.#account.dataPostURL\n let data = {}\n data = this.#request.addSystemDataToObject(data, undefined)\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PING)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressData(JSON.stringify(data), this.#logger))\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n\n #isPingContinuous () {\n return (typeof window.wzrk_d !== 'undefined' && window.wzrk_d.ping === 'continuous')\n }\n\n _isPersonalisationActive () {\n return StorageManager._isLocalStorageSupported() && this.enablePersonalization\n }\n\n #overrideDSyncFlag (data) {\n if (this._isPersonalisationActive()) {\n data.dsync = true\n }\n }\n\n popupCallbacks = {};\n popupCurrentWzrkId = '';\n\n // eslint-disable-next-line accessor-pairs\n set popupCallback (callback) {\n this.popupCallbacks[this.popupCurrentWzrkId] = callback\n }\n\n /**\n *\n * @param {object} payload\n */\n sendLocationData (payload) {\n // Send the updated value to LC\n let data = {}\n data.af = {}\n const profileObj = {}\n data.type = 'profile'\n if (profileObj.tz == null) {\n profileObj.tz = new Date().toString().match(/([A-Z]+[\\+-][0-9]+)/)[1]\n }\n data.profile = profileObj\n if (payload) {\n const keys = Object.keys(payload)\n keys.forEach(key => {\n data.af[key] = payload[key]\n })\n }\n if ($ct.location) {\n data.af = { ...data.af, ...$ct.location }\n }\n data = this.#request.addSystemDataToObject(data, true)\n this.#request.addFlags(data)\n const compressedData = compressData(JSON.stringify(data), this.#logger)\n let pageLoadUrl = this.#account.dataPostURL\n pageLoadUrl = addToURL(pageLoadUrl, 'type', EVT_PUSH)\n pageLoadUrl = addToURL(pageLoadUrl, 'd', compressedData)\n\n this.#request.saveAndFireRequest(pageLoadUrl, $ct.blockRequest)\n }\n\n // offline mode\n /**\n * events will be recorded and queued locally when passed with true\n * but will not be sent to the server until offline is disabled by passing false\n * @param {boolean} arg\n */\n\n setOffline (arg) {\n if (typeof arg !== 'boolean') {\n console.error('setOffline should be called with a value of type boolean')\n return\n }\n $ct.offline = arg\n // if offline is disabled\n // process events from cache\n if (!arg) {\n this.#request.processBackupEvents()\n }\n }\n\n defineVariable (name, defaultValue) {\n return Variable.define(name, defaultValue, this.#variableStore)\n }\n\n syncVariables (onSyncSuccess, onSyncFailure) {\n if (this.#logger.logLevel === 4) {\n return this.#variableStore.syncVariables(onSyncSuccess, onSyncFailure)\n } else {\n const m = 'App log level is not set to 4'\n this.#logger.error(m)\n return Promise.reject(new Error(m))\n }\n }\n\n fetchVariables (onFetchCallback) {\n this.#variableStore.fetchVariables(onFetchCallback)\n }\n\n addVariablesChangedCallback (callback) {\n this.#variableStore.addVariablesChangedCallback(callback)\n }\n\n addOneTimeVariablesChangedCallback (callback) {\n this.#variableStore.addOneTimeVariablesChangedCallback(callback)\n }\n}\n","import Clevertap from './clevertap'\n\nconst clevertap = new Clevertap(window.clevertap)\n\nwindow.clevertap = window.wizrocket = clevertap\n\nexport default clevertap\n"],"names":["TARGET_DOMAIN","TARGET_PROTOCOL","DEFAULT_REGION","Account","constructor","id","region","targetDomain","token","accountId","dcSDKVersion","finalTargetDomain","dataPostPEURL","dataPostURL","recorderURL","emailURL","unsupportedKeyCharRegex","RegExp","unsupportedValueCharRegex","singleQuoteRegex","CLEAR","CHARGED_ID","CHARGEDID_COOKIE_NAME","GCOOKIE_NAME","KCOOKIE_NAME","CAMP_COOKIE_NAME","CAMP_COOKIE_G","SCOOKIE_PREFIX","SCOOKIE_EXP_TIME_IN_SECS","EV_COOKIE","META_COOKIE","PR_COOKIE","ARP_COOKIE","LCOOKIE_NAME","GLOBAL","DISPLAY","WEBPUSH_LS_KEY","OPTOUT_KEY","CT_OPTOUT_KEY","OPTOUT_COOKIE_ENDSWITH","USEIP_KEY","LRU_CACHE","LRU_CACHE_SIZE","IS_OUL","EVT_PUSH","EVT_PING","COOKIE_EXPIRY","MAX_TRIES","FIRST_PING_FREQ_IN_MILLIS","CONTINUOUS_PING_FREQ_IN_MILLIS","GROUP_SUBSCRIPTION_REQUEST_ID","categoryLongKey","WZRK_PREFIX","WZRK_ID","NOTIFICATION_VIEWED","NOTIFICATION_CLICKED","FIRE_PUSH_UNREGISTERED","PUSH_SUBSCRIPTION_DATA","COMMAND_INCREMENT","COMMAND_DECREMENT","COMMAND_SET","COMMAND_ADD","COMMAND_REMOVE","COMMAND_DELETE","WEBINBOX_CONFIG","WEBINBOX","MAX_INBOX_MSG","VARIABLES","PUSH_DELAY_MS","MAX_DELAY_FREQUENCY","WZRK_FETCH","SYSTEM_EVENTS","isString","input","String","isObject","Object","prototype","toString","call","isDateObject","Date","isObjectEmpty","obj","prop","hasOwnProperty","isConvertibleToNumber","n","isNaN","parseFloat","isFinite","isNumber","test","isValueValid","value","undefined","removeUnsupportedChars","o","logger","key","sanitizedVal","sanitizedKey","sanitize","length","substring","reportError","val","regex","replace","getToday","today","getFullYear","getMonth","getDay","getNow","Math","floor","getTime","convertToWZRKDate","dateObj","round","setDate","dt","isDateValid","date","matches","exec","d","m","y","composedDate","getDate","StorageManager","save","_isLocalStorageSupported","localStorage","setItem","JSON","stringify","read","data","getItem","parse","e","remove","removeItem","removeCookie","name","domain","cookieStr","document","cookie","createCookie","seconds","expires","domainStr","setTime","toGMTString","encodeURIComponent","readCookie","nameEQ","ca","split","idx","c","charAt","indexOf","decodeURIComponent","window","saveToLSorCookie","property","location","hostname","$ct","globalCache","readFromLSorCookie","trim","err","createBroadCookie","broadDomain","domainParts","testBroadDomain","testCookieName","tempCookie","getMetaProp","metaObj","setMetaProp","wzrkMetaObj","getAndClearMetaProp","setInstantDeleteFlagInK","k","flag","backupEvent","reqNo","backupArr","q","debug","removeBackup","respNo","backupMap","gcookie","REQ_N","RESP_N","globalProfileMap","globalEventsMap","blockRequest","isOptInRequest","webPushEnabled","campaignDivMap","currentSessionId","wiz_counter","notifApi","notifEnabledFromApi","unsubGroups","updatedCategoryLong","inbox","isPrivacyArrPushed","privacyArray","offline","dismissSpamControl","globalUnsubscribe","flutterVersion","variableStore","LRUCache","max","lruCache","tempLruCache","cache","entry","push","get","item","saveCacheToLS","set","allKeys","objToArray","index","temp","getKey","getSecondLastKey","keysArr","getLastKey","keysLength","newCache","indexToDelete","splice","CleverTapAPI","request","device","session","s","global","resume","respNumber","optOutResponse","oulReq","newGuid","isOULInProgress","oulReqN","sessionObj","getSessionCookieObject","kIdFromLS","guidFromLRUCache","lastK","lastGUID","unregisterTokenForGuid","manageSession","t","setSessionCookieObject","processingBackup","processBackupEvents","DeviceManager","getGuid","guid","error","DATA_NOT_SENT_TEXT","CLEVERTAP_ERROR_PREFIX","EMBED_ERROR","EVENT_ERROR","GENDER_ERROR","EMPLOYED_ERROR","MARRIED_ERROR","EDUCATION_ERROR","AGE_ERROR","DOB_ERROR","ENUM_FORMAT_ERROR","PHONE_FORMAT_ERROR","_globalChargedId","isEventStructureFlat","eventObj","Array","isArray","isChargedEventStructureValid","chargedObj","itemKey","chargedId","EventHandler","values","isPersonalisationActive","eventsArr","_processOldValues","getDetails","evtName","evtObj","respObj","firstTime","lastTime","count","eventName","shift","includes","type","unshift","evtData","processEvent","getURLParams","url","urlParams","uri","match","pl","search","decode","replacement","getDomain","a","createElement","href","addToURL","v","getHostName","urlBase64ToUint8Array","base64String","padding","repeat","base64","rawData","atob","processedData","i","charCodeAt","Uint8Array","compressData","dataObject","compressToBase64","compress","uncompressed","context_dictionary","context_dictionaryToCreate","context_c","context_wc","context_w","context_enlargeIn","context_dictSize","context_numBits","context_data_string","context_data_val","context_data_position","ii","f","fromCharCode","pow","getKeyStr","_keyStr","output","chr1","chr2","chr3","enc1","enc2","enc3","enc4","NaN","RequestDispatcher","networkRetryCount","minDelayFrequency","fireRequest","skipARP","sendOULFlag","getDelayFrequency","account","randomDelay","random","skipResARP","_arp","pageLoadUrl","useIP","slice","tries","setTimeout","clevertap","wizrocket","plugin","ctCbScripts","getElementsByClassName","parentNode","removeChild","setAttribute","async","getElementsByTagName","appendChild","getCampaignObject","finalcampObj","campObj","wp","saveCampaignObject","campaignObj","newObj","setCampaignObjectForGuid","guidCampObj","finalCampObj","keys","forEach","campKeyObj","globalObj","dailyObj","campaignIdArray","resultObj","dailyC","totalC","campaignId","console","getCampaignObjForLc","storageValue","decodedValue","parsedValue","resultObjWP","resultObjWI","wi","todayCwp","todayCwi","tc","wmp","wimp","tlc","witlc","isProfileValid","profileObj","valid","profileKey","profileVal","Age","Phone","processFBUserObj","user","profileData","Name","FBID","gender","Gender","getHighestEducation","eduArr","college","highschool","edu","relationship_status","Married","education","Education","work","Employed","email","Email","birthday","mmddyy","DOB","processGPlusUserObj","displayName","GPID","image","isDefault","Photo","emails","emailIdx","emailObj","organizations","orgObj","yyyymmdd","relationshipStatus","addToLocalProfileMap","override","_custom","closeIframe","divIdIgnored","sessionCampaignObj","divId","getElementById","style","display","arp","jsonMap","isOULARP","arpFromStorage","setEnum","enumVal","handleEmailSubscription","subscription","reEncoded","fetchGroups","urlParamsAsIs","encodedEmailId","encodedProfileProps","p","pageType","page_type","ProfileHandler","profilesArr","getAttribute","propName","_handleIncrementDecrementValue","command","tz","profile","addSystemDataToObject","addFlags","compressedData","saveAndFireRequest","_handleMultiValueSet","arrayVal","array","toLowerCase","sendMultiValueData","_handleMultiValueAdd","propKey","propVal","_handleMultiValueRemove","_handleMultiValueDelete","profileArr","outerObj","Site","Facebook","FbProfileObj","GPlusProfileObj","UserLoginHandler","clear","addToK","ids","g","kId","anonymousUser","foundInCache","gFromCache","Identity","cookieName","loginArr","pop","processProfile","CTWebPersonalisationBanner","HTMLElement","_details","shadow","attachShadow","mode","details","renderBanner","innerHTML","getBannerContent","trackClick","addEventListener","onClickUrl","onClick","open","parent","renderNotificationClicked","msgId","pivotId","renderNotificationViewed","divHeight","css","desktopImageURL","mobileImageURL","html","CTWebPersonalisationCarousel","_target","_carousel","slides","previouslySelectedItem","selectedItem","autoSlide","stopAutoSlideTimeout","customElements","define","target","renderCarousel","getStyles","carousel","getCarouselContent","showNavBtns","insertAdjacentHTML","navBtnsHtml","showNavArrows","leftNavArrowHtml","rightNavArrowHtml","setupClick","updateSelectedItem","startAutoSlide","setupOnHover","wzrk_id","wzrk_pivot","event","eventID","startsWith","selected","endsWith","goToNext","goToPrev","wzrk_slideNo","clearInterval","clearTimeout","detail","banner","classList","add","navBtnsCss","navArrowsCss","prevItem","prevButton","button","setInterval","sliderTime","goTo","prev","cur","CTWebPopupImageOnly","_session","popup","container","resizeObserver","renderImageOnlyPopup","sessionId","getImageOnlyPopupContent","shadowRoot","closeIcon","updateImageAndContainerWidth","ResizeObserver","handleResize","observe","unobserve","width","getRenderedImageWidth","setProperty","msgContent","visibility","img","ratio","naturalWidth","naturalHeight","height","Message","config","message","wrapper","snackBar","renderMessage","createEl","part","_el","msg","templateType","prepareBasicMessage","timeStamp","determineTimeStampText","viewed","unreadMarker","imageUrl","imageContainer","addImage","iconTitleDescWrapper","iconUrl","iconContainer","titleDescWrapper","title","innerText","description","buttons","buttonsContainer","addButtons","hasCopyAction","b","text","cssText","action","addSnackbar","greenTickSvg","clipboardMsg","raiseClickedEvent","path","isPreview","raiseClickedForBasicTemplates","payload","tagName","kv","wzrk_c2a","openUrlInNewTab","focus","navigator","clipboard","writeText","clipboardText","log","messageStyles","backgroundColor","borderColor","titleColor","descriptionColor","buttonColor","buttonTextColor","unreadMarkerColor","inboxContainerStyles","panelBackgroundColor","panelBorderColor","headerBackgroundColor","headerTitleColor","closeIconColor","categoriesTabColor","categoriesTitleColor","categoriesBorderColor","selectedCategoryTabColor","selectedCategoryTitleColor","selectedCategoryBorderColor","headerCategoryHeight","Inbox","isInboxOpen","isInboxFromFlutter","selectedCategory","unviewedMessages","unviewedCounter","inboxConfigForPreview","inboxSelector","emptyInboxMsg","inboxCard","unviewedBadge","observer","selectedCategoryRef","addClickListenerOnDocument","composedPath","toggleInbox","prevCategoryRef","updateActiveCategory","_path","filter","messageEl","contains","setBadgeStyle","msgCount","incomingMessages","msgs","updateInboxMessages","incomingMessagesForPreview","previewMsgs","now","buildUIForMessages","updateUnviewedBadgeCounter","connectedCallback","init","styles","notificationsBadge","addUnviewedBadge","createinbox","removeEventListener","categories","getInboxStyles","addMsgsToInboxFromLS","messages","deleteExpiredAndGetUnexpiredMsgs","msgIds","deleteMsgsFromUI","getInboxMessages","wzrk_ttl","el","sort","reduce","acc","saveInboxMessages","inboxMsgs","incomingMsgs","textColor","body","updateUnviewedBadgePosition","top","right","getBoundingClientRect","left","header","headerTitle","createCategories","options","root","rootMargin","threshold","IntersectionObserver","entries","handleMessageViewed","categoriesContainer","leftArrow","arrowSvg","children","scrollBy","categoriesWrapper","_categories","category","rightArrow","firstCategory","lastCategory","firstCategoryObserver","categoryObserverCb","intersectionRatio","lastCategoryObserver","hide","activeCategory","scrollTop","counter","childNodes","updateTSForRenderedMsgs","maxMsgsInInbox","firstChild","sortedMsgs","map","tags","insertBefore","msgTotalCount","querySelectorAll","ctInboxMsgs","hasMessages","raiseViewedEvent","isIntersecting","updateMessageInLS","rect","zIndex","scrollLeft","scrollWidth","setInboxPosition","windowWidth","outerWidth","customInboxStyles","getComputedStyle","getPropertyValue","bottom","hasPositionDefined","res","getInboxPosition","clientHeight","clientWidth","xPos","yPos","ts","headerHeight","categoriesHeight","tabColor","selectedTab","inboxStyles","cardStyles","cards","msgStyles","processWebInboxSettings","webInboxSetting","_settings","processInboxNotifs","inbox_preview","inbox_notifs","addWebInbox","checkAndRegisterWebInboxElements","getAndMigrateInboxMessages","gudInboxObj","storedInboxObj","initializeWebInbox","Promise","resolve","reject","readyState","onLoaded","inboxHeight","inboxWidth","horizontalScroll","scrollingElement","verticalScroll","innerWidth","windowHeight","innerHeight","selectorRect","selectorX","x","selectorY","selectorLeft","selectorRight","selectorTop","selectorBottom","selectorHeight","selectorWidth","selectorCenter","halfOfInboxHeight","halfOfInboxWidth","inboxOnSide","availableHeight","inboxRight","availableWidth","inboxLeft","diff","hasWebInboxSettingsInLS","_tr","_device","_request","_logger","_wizCounter","doCampHouseKeeping","targetingMsgJson","incrCount","excludeFromFreqCaps","currentCount","totalCount","sessionStorage","campTypeObj","wtarget_type","wmc","wimc","campaignSessionLimit","campaignDailyLimit","campaignTotalLimit","totalDailyLimit","totalSessionLimit","totalInboxSessionLimit","efc","parseInt","mdc","tdc","campaignSessionCount","totalSessionCount","campaignDailyCount","totalDailyCount","campaignTotalCount","delay","campKey","newCampObj","getCookieParams","scookieObj","setupClickEvent","contentDiv","isLegacy","ctaElement","jsCTAElements","jsFunc","preview","onclick","invokeExternalJs","func","setupClickUrl","incrementImpression","renderPersonalisationBanner","divSelector","bannerEl","containerEl","querySelector","renderPersonalisationCarousel","renderPopUpImageOnly","popupImageOnly","renderFooterNotification","displayObj","inaObj","kvPairsEvent","CustomEvent","dispatchEvent","layout","showExitIntent","element","msgDiv","isBanner","viewHeight","viewWidth","legacy","marginBottom","contentHeight","bottomPosition","widthPerct","userAgent","proto","iFrameStyle","iframe","borderRadius","br","frameborder","marginheight","marginwidth","scrolling","pointerCss","bgColor","btnBg","leftTd","btColor","theme","titleText","descriptionText","imageTd","onClickStr","ifrm","contentWindow","contentDocument","doc","closeCampaign","Event","write","appendScriptForCustomEvent","close","adjustIFrameHeight","scrollHeight","margin","ua","onload","inDoc","_timer","script","_callBackCalled","showFooterNotification","notificationCallback","raiseNotificationClicked","raiseNotificationViewed","popupCurrentWzrkId","popupCallbacks","popupCallback","msgCTkv","wzrkPrefixKey","wzrkJson","raisePopupNotificationClicked","notificationData","eventData","wzrkPrefixObj","exitintentObj","targetObj","clientY","opacityDiv","opacity","rgbaColor","ctaText","processNativeDisplayArr","arrInAppNotifs","elementId","addLoadListener","inapp_notifs","targetNotif","onmouseleave","mergeEventMap","newEvtMap","oldEvtObj","newEvtObj","handleInboxNotifications","msgArr","then","catch","vars","mergeVariables","staleDataUpdate","staledata","campType","evpr","eventsMap","events","profileMap","syncExpiry","expires_in","inapp_stale","inbox_stale","User","getTotalVisits","visitCount","getLastVisit","prevSession","logLevels","DISABLE","ERROR","INFO","DEBUG","DEBUG_PE","Logger","logLevel","wzrkError","info","debugPE","code","level","WZRK_D","SessionManager","scookieStr","objStr","currentSessionInLS","sessionCount","getTimeElapsed","sessionStart","getPageCount","seqNo","requestTime","RequestManager","fired","ignoreTrim","wzrk_error","pg","protocol","af","lib","rc","lastSyncTime","expirySeconds","dsync","givenGUID","registerToken","post","fetch","method","headers","response","ok","json","nowTs","evtDetail","Privacy","privacyArr","privacyObj","curr","optOut","shouldUseIP","NotificationHandler","displayArgs","_enableWebPush","enabled","applicationServerKey","subscriptionCallback","serviceWorkerPath","apnsWebPushId","apnsServiceUrl","safari","pushNotification","requestPermission","permission","subscriptionData","endpoint","deviceToken","browser","registrationScope","serviceWorker","register","registration","__wzrk_account_id","scope","rootDirRegex","isServiceWorkerAtRoot","ready","getRegistrations","serviceWorkerRegistration","subscribeObj","userVisibleOnly","pushManager","subscribe","getSubscription","unsubscribe","successful","scriptTag","bodyText","okButtonText","rejectButtonText","okButtonColor","skipDialog","askAgainTimeInSeconds","okCallback","rejectCallback","httpsPopupPath","httpsIframePath","apnsWebPushServiceUrl","notifObj","isHTTP","chromeAgent","firefoxAgent","safariAgent","Notification","httpsIframe","state","from","wzrkPermissionPopup","wizAlert","confirmButtonText","confirmButtonColor","Variable","defaultValue","hadStarted","valueChangedCallbacks","getValue","getdefaultValue","typeOfDefaultValue","existing","getVariable","varInstance","registerVariable","update","newValue","oldValue","hasVarsRequestCompleted","triggerValueChanged","onValueChanged","addValueChangedCallback","removeValueChangedCallback","clearStartFlag","VariableStore","syncVariables","onSyncSuccess","onSyncFailure","Error","meta","tk","r","status","fetchVariables","onFetchCallback","addVariablesChangedCallback","callback","addOneTimeVariablesChangedCallback","removeVariablesChangedCallback","removeOneTimeVariablesChangedCallback","callBack","CleverTap","spa","isSpa","bind","enablePersonalization","_isPersonalisationActive","shpfyProxyPath","ReqestManager","onUserLogin","privacy","notifications","logout","getCleverTapID","getAccountID","getSCDomain","setLibrary","libName","libVersion","setSCSDKVersion","ver","scSDKVersion","scv","getInboxMessageCount","getInboxMessageUnreadCount","getAllInboxMessages","getUnreadInboxMessages","getInboxMessageForId","messageId","deleteInboxMessage","markReadInboxMessage","unreadMsg","markReadInboxMessagesForIds","messageIds","markReadAllInboxMessage","processNotificationEvent","eventDetail","setLogLevel","l","Number","handleIncrementValue","handleDecrementValue","setMultiValuesForKey","addMultiValueForKey","addMultiValuesForKey","removeMultiValueForKey","removeMultiValuesForKey","removeValueForKey","_handleEmailSubscription","getLocation","lat","lng","Latitude","Longitude","sendLocationData","geolocation","getCurrentPosition","showPosition","showError","position","coords","latitude","longitude","PERMISSION_DENIED","POSITION_UNAVAILABLE","TIMEOUT","UNKNOWN_ERROR","api","enableWebPush","tr","is_onloadcalled","subEmail","getEmail","withGroups","unSubEmail","unsubEmailGroups","elements","isUnsubscribed","checked","setSubscriptionGroups","getSubscriptionGroups","changeSubscriptionGroups","updatedGroups","isGlobalUnsubscribe","setIsGlobalUnsubscribe","setUpdatedCategoryLong","$CLTP_WR","$WZRK_WR","currLocation","wzrk_ex","pageChanged","backupInterval","pgCount","referrerDomain","referrer","maxLen","utmSource","utm_source","wzrk_source","us","utmMedium","utm_medium","wzrk_medium","um","utmCampaign","utm_campaign","wzrk_campaign","uc","wm","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,4DAAcwX,kBAAd,CAAiCnI,WAAjC,EAA8CpN,GAAG,CAACgC,YAAlD;EACD;;yDAEoB;EACnB,SAAQ,OAAOrC,MAAM,CAACyoC,MAAd,KAAyB,WAAzB,IAAwCzoC,MAAM,CAACyoC,MAAP,CAAcC,IAAd,KAAuB,YAAvE;EACD;;yDAMmBtqC,MAAM;EACxB,MAAI,KAAKwjC,wBAAL,EAAJ,EAAqC;EACnCxjC,IAAAA,IAAI,CAACg8B,KAAL,GAAa,IAAb;EACD;EACF;;QC7vBGtsB,SAAS,GAAG,IAAI66B,SAAJ,CAAc3oC,MAAM,CAAC8N,SAArB;EAElB9N,MAAM,CAAC8N,SAAP,GAAmB9N,MAAM,CAAC+N,SAAP,GAAmBD,SAAtC;;;;;;;;"} \ No newline at end of file diff --git a/clevertap.min.js b/clevertap.min.js index 9d761fbe..2572cbee 100644 --- a/clevertap.min.js +++ b/clevertap.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).clevertap=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var i=0;ie.length)&&(t=e.length);for(var i=0,n=new Array(t);i=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){i=e[Symbol.iterator]()},n:function(){var e=i.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw r}}}}var w=0;function k(e){return"__private_"+w+++"_"+e}function C(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var x,P="clevertap-prod.com",S="https:",O=k("accountId"),I=k("region"),_=k("targetDomain"),E=k("dcSdkversion"),A=k("token"),M=function(){function e(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=i.id,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:P,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";t(this,e),Object.defineProperty(this,O,{writable:!0,value:void 0}),Object.defineProperty(this,I,{writable:!0,value:""}),Object.defineProperty(this,_,{writable:!0,value:P}),Object.defineProperty(this,E,{writable:!0,value:""}),Object.defineProperty(this,A,{writable:!0,value:""}),this.id=n,o&&(this.region=o),r&&(this.targetDomain=r),a&&(this.token=a)}return n(e,[{key:"id",get:function(){return C(this,O)[O]},set:function(e){C(this,O)[O]=e}},{key:"region",get:function(){return C(this,I)[I]},set:function(e){C(this,I)[I]=e}},{key:"dcSDKVersion",get:function(){return C(this,E)[E]},set:function(e){C(this,E)[E]=e}},{key:"targetDomain",get:function(){return C(this,_)[_]},set:function(e){C(this,_)[_]=e}},{key:"token",get:function(){return C(this,A)[A]},set:function(e){C(this,A)[A]=e}},{key:"finalTargetDomain",get:function(){return this.region?"".concat(this.region,".").concat(this.targetDomain):this.targetDomain===P?"".concat("eu1",".").concat(this.targetDomain):this.targetDomain}},{key:"dataPostPEURL",get:function(){return"".concat(S,"//").concat(this.finalTargetDomain,"/defineVars")}},{key:"dataPostURL",get:function(){return"".concat(S,"//").concat(this.finalTargetDomain,"/a?t=96")}},{key:"recorderURL",get:function(){return"".concat(S,"//").concat(this.finalTargetDomain,"/r?r=1")}},{key:"emailURL",get:function(){return"".concat(S,"//").concat(this.finalTargetDomain,"/e?r=1")}}]),e}(),L=new RegExp("^\\s+|\\.|:|\\$|'|\"|\\\\|\\s+$","g"),T=new RegExp("^\\s+|'|\"|\\\\|\\s+$","g"),R=new RegExp("'","g"),j="clear",D="Charged ID",B="WZRK_CHARGED_ID",N="WZRK_G",z="WZRK_K",U="WZRK_CAMP",F="WZRK_CAMP_G",q="WZRK_EV",V="WZRK_META",W="WZRK_PR",K="WZRK_ARP",H="WZRK_L",G="global",J="optOut",Z="useIP",$="WZRK_X",Y="push",Q=31536e3,X="2",ee="wzrk_",te="wzrk_id",ie="Notification Viewed",ne="Notification Clicked",oe="WZRK_FPU",re="WZRK_PSD",ae="$incr",se="$decr",le="$set",ce="$add",de="$remove",ue="$delete",pe="WZRK_INBOX_CONFIG",he="WZRK_INBOX",ve=1e3,ge="wzrk_fetch",fe="wiz-iframe",be="wiz-iframe-intent",ye="Event",me="Profile",we=["Stayed","UTM Visited","App Launched","Notification Sent",ie,ne],ke=function(e){return"string"==typeof e||e instanceof String},Ce=function(e){return"[object Object]"===Object.prototype.toString.call(e)},xe=function(t){return"object"===e(t)&&t instanceof Date},Pe=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},Se=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},Oe=function(e){return/^-?[\d.]+(?:e-?\d+)?$/.test(e)&&"number"==typeof e},Ie=function(e){return null!=e&&"undefined"!==e},_e=function t(i,n){var o;if("object"!==e(i))return ke(i)?(o=Ee(i,T)).length>1024&&(o=o.substring(0,1024),n.reportError(521,o+"... length exceeded 1024 chars. Trimmed.")):o=i,o;for(var r in i)if(i.hasOwnProperty(r)){var a=t(i[r],n),s=void 0;(s=Ee(r,L)).length>1024&&(s=s.substring(0,1024),n.reportError(520,s+"... length exceeded 1024 chars. Trimmed.")),delete i[r],i[s]=a}return i},Ee=function(e,t){return e.replace(t,"")},Ae=function(){var e=new Date;return e.getFullYear()+""+e.getMonth()+e.getDay()},Me=function(){return Math.floor((new Date).getTime()/1e3)},Le=function(e){return"$D_"+Math.round(e.getTime()/1e3)},Te=function(e){if(Re(e))return"$D_"+e},Re=function(e){var t=/^(\d{4})(\d{2})(\d{2})$/.exec(e);if(null==t)return!1;var i=t[3],n=t[2]-1,o=t[1],r=new Date(o,n,i);return r.getDate()==i&&r.getMonth()==n&&r.getFullYear()==o},je=function(){function e(){t(this,e)}return n(e,null,[{key:"save",value:function(e,t){return!(!e||!t)&&(this._isLocalStorageSupported()?(localStorage.setItem(e,"string"==typeof t?t:JSON.stringify(t)),!0):void 0)}},{key:"read",value:function(e){if(!e)return!1;var t=null;if(this._isLocalStorageSupported()&&(t=localStorage.getItem(e)),null!=t)try{t=JSON.parse(t)}catch(e){}return t}},{key:"remove",value:function(e){return!!e&&(this._isLocalStorageSupported()?(localStorage.removeItem(e),!0):void 0)}},{key:"removeCookie",value:function(e,t){var i=e+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT;";t&&(i=i+" domain="+t+"; path=/"),document.cookie=i}},{key:"createCookie",value:function(e,t,i,n){var o="",r="";if(i){var a=new Date;a.setTime(a.getTime()+1e3*i),o="; expires="+a.toGMTString()}n&&(r="; domain="+n),t=encodeURIComponent(t),document.cookie=e+"="+t+o+r+"; path=/"}},{key:"readCookie",value:function(e){for(var t=e+"=",i=document.cookie.split(";"),n=0;n=0;s--){if(a=0===s?r[s]+a:"."+r[s]+a,this.readCookie(e)){var l="test_"+e+s;if(this.createCookie(l,t,10,a),!this.readCookie(l))continue;this.removeCookie(l,a)}if(this.createCookie(e,t,i,a),this.readCookie(e)==t){o=a,De.broadDomain=o;break}}else this.createCookie(e,t,i,o)}else this.createCookie(e,t,i,n)}},{key:"getMetaProp",value:function(e){var t=this.readFromLSorCookie(V);if(null!=t)return t[e]}},{key:"setMetaProp",value:function(e,t){if(this._isLocalStorageSupported()){var i=this.readFromLSorCookie(V);null==i&&(i={}),void 0===t?delete i[e]:i[e]=t,this.saveToLSorCookie(V,i)}}},{key:"getAndClearMetaProp",value:function(e){var t=this.getMetaProp(e);return this.setMetaProp(e,void 0),t}},{key:"setInstantDeleteFlagInK",value:function(){var e=this.readFromLSorCookie(z);null==e&&(e={}),e.flag=!0,this.saveToLSorCookie(z,e)}},{key:"backupEvent",value:function(e,t,i){var n=this.readFromLSorCookie(H);void 0===n&&(n={}),n[t]={q:e},this.saveToLSorCookie(H,n),i.debug("stored in ".concat(H," reqNo : ").concat(t," -> ").concat(e))}},{key:"removeBackup",value:function(e,t){var i=this.readFromLSorCookie(H);null!=i&&void 0!==i[e]&&(t.debug("del event: ".concat(e," data-> ").concat(i[e].q)),delete i[e],this.saveToLSorCookie(H,i))}}]),e}(),De={globalCache:{gcookie:null,REQ_N:0,RESP_N:0},LRU_CACHE:null,globalProfileMap:void 0,globalEventsMap:void 0,blockRequest:!1,isOptInRequest:!1,broadDomain:null,webPushEnabled:null,campaignDivMap:{},currentSessionId:null,wiz_counter:0,notifApi:{notifEnabledFromApi:!1},unsubGroups:[],updatedCategoryLong:null,inbox:null,isPrivacyArrPushed:!1,privacyArray:[],offline:!1,location:null,dismissSpamControl:!1,globalUnsubscribe:!0,flutterVersion:null,variableStore:{}},Be=k("keyOrder"),Ne=k("deleteFromObject"),ze=function(){function e(i){t(this,e),Object.defineProperty(this,Ne,{value:Ue}),Object.defineProperty(this,Be,{writable:!0,value:void 0}),this.max=i;var n=je.readFromLSorCookie($);if(n){var o={};for(var r in C(this,Be)[Be]=[],n=n.cache)n.hasOwnProperty(r)&&(o[n[r][0]]=n[r][1],C(this,Be)[Be].push(n[r][0]));this.cache=o}else this.cache={},C(this,Be)[Be]=[]}return n(e,[{key:"get",value:function(e){var t=this.cache[e];return t&&(this.cache=C(this,Ne)[Ne](e,this.cache),this.cache[e]=t,C(this,Be)[Be].push(e)),this.saveCacheToLS(this.cache),t}},{key:"set",value:function(e,t){var i=this.cache[e],n=C(this,Be)[Be];null!=i?this.cache=C(this,Ne)[Ne](e,this.cache):n.length===this.max&&(this.cache=C(this,Ne)[Ne](n[0],this.cache)),this.cache[e]=t,C(this,Be)[Be][C(this,Be)[Be]-1]!==e&&C(this,Be)[Be].push(e),this.saveCacheToLS(this.cache)}},{key:"saveCacheToLS",value:function(e){var t=[],i=C(this,Be)[Be];for(var n in i)if(i.hasOwnProperty(n)){var o=[];o.push(i[n]),o.push(e[i[n]]),t.push(o)}je.saveToLSorCookie($,{cache:t})}},{key:"getKey",value:function(e){if(null===e)return null;var t=C(this,Be)[Be];for(var i in t)if(t.hasOwnProperty(i)&&this.cache[t[i]]===e)return t[i];return null}},{key:"getSecondLastKey",value:function(){var e=C(this,Be)[Be];return null!=e&&e.length>1?e[e.length-2]:-1}},{key:"getLastKey",value:function(){var e=C(this,Be)[Be].length;if(e)return C(this,Be)[Be][e-1]}}]),e}(),Ue=function(e,t){var i,n=JSON.parse(JSON.stringify(C(this,Be)[Be])),o={};for(var r in n)n.hasOwnProperty(r)&&(n[r]!==e?o[n[r]]=t[n[r]]:i=r);return n.splice(i,1),C(this,Be)[Be]=JSON.parse(JSON.stringify(n)),o},Fe=k("logger"),qe=k("request"),Ve=k("device"),We=k("session"),Ke=function(){function e(i){var n=i.logger,o=i.request,r=i.device,a=i.session;t(this,e),Object.defineProperty(this,Fe,{writable:!0,value:void 0}),Object.defineProperty(this,qe,{writable:!0,value:void 0}),Object.defineProperty(this,Ve,{writable:!0,value:void 0}),Object.defineProperty(this,We,{writable:!0,value:void 0}),C(this,Fe)[Fe]=n,C(this,qe)[qe]=o,C(this,Ve)[Ve]=r,C(this,We)[We]=a}return n(e,[{key:"s",value:function(e,t,i,n,o){var r=!1,a=!1;if(window.isOULInProgress&&(i||"undefined"!==n&&n===window.oulReqN)&&(window.isOULInProgress=!1,r=!0),void 0===n&&(n=0),je.removeBackup(n,C(this,Fe)[Fe]),!(n>De.globalCache.REQ_N)){if(Ie(C(this,Ve)[Ve].gcookie)||e&&(a=!0),!Ie(C(this,Ve)[Ve].gcookie)||i||"boolean"==typeof o){var s=C(this,We)[We].getSessionCookieObject();if(window.isOULInProgress||s.s&&t50&&t.reportError(522,"Charged Items exceed 50 limit. Actual count: "+e[i].length),e[i])if(e[i].hasOwnProperty(n)&&(!Ce(e[i][n])||!at(e[i][n])))return!1}else{if(Ce(e[i])||Array.isArray(e[i]))return!1;xe(e[i])&&(e[i]=Le(e[i]))}if(ke(e[D])||Oe(e[D])){var o=e[D]+"";if(void 0===x&&(x=je.readFromLSorCookie(B)),void 0!==x&&x.trim()===o.trim())return t.error("Duplicate charged Id - Dropped"+e),!1;x=o,je.saveToLSorCookie(B,o)}return!0}return!1},lt=k("logger"),ct=k("oldValues"),dt=k("request"),ut=k("isPersonalisationActive"),pt=k("processEventArray"),ht=function(e){s(o,e);var i=g(o);function o(e,n){var r,a=e.logger,s=e.request,l=e.isPersonalisationActive;return t(this,o),r=i.call(this),Object.defineProperty(h(r),pt,{value:vt}),Object.defineProperty(h(r),lt,{writable:!0,value:void 0}),Object.defineProperty(h(r),ct,{writable:!0,value:void 0}),Object.defineProperty(h(r),dt,{writable:!0,value:void 0}),Object.defineProperty(h(r),ut,{writable:!0,value:void 0}),C(h(r),lt)[lt]=a,C(h(r),ct)[ct]=n,C(h(r),dt)[dt]=s,C(h(r),ut)[ut]=l,r}return n(o,[{key:"push",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i0;){var t=e.shift();if(ke(t))if(t.length>1024&&(t=t.substring(0,1024),C(this,lt)[lt].reportError(510,t+"... length exceeded 1024 chars. Trimmed.")),we.includes(t))C(this,lt)[lt].reportError(513,t+" is a restricted system event. It cannot be used as an event name.");else{var i={type:"event"};if(i.evtName=Ee(t,L),0!==e.length){var n=e.shift();if(Ce(n)){if("Charged"===t){if(!st(n,C(this,lt)[lt])){C(this,lt)[lt].reportError(511,"Charged event structure invalid. Not sent.");continue}}else if(!at(n)){C(this,lt)[lt].reportError(512,t+" event structure invalid. Not sent.");continue}i.evtData=n}else e.unshift(n)}C(this,dt)[dt].processEvent(i)}else C(this,lt)[lt].error(Ye)}},gt=function(e){var t={},i=e.indexOf("?");if(i>1){var n,o=e.substring(i+1),r=/\+/g,a=/([^&=]+)=?([^&]*)/g,s=function(e){var t=e.replace(r," ");try{t=decodeURIComponent(t)}catch(e){}return t};for(n=a.exec(o);n;)t[s(n[1])]=s(n[2]),n=a.exec(o)}return t},ft=function(e,t,i){return e+"&"+t+"="+encodeURIComponent(i)},bt=function(){return window.location.hostname},yt=function(e,t){return t&&"function"==typeof t.debug&&t.debug("dobj:"+e),wt(e)},mt=function(){var e="",t=0;for(t=0;t<=25;t++)e+=String.fromCharCode(t+65);for(t=0;t<=25;t++)e+=String.fromCharCode(t+97);for(t=0;t<10;t++)e+=t;return e+"+/="}(),wt=function(e){if(null==e)return"";var t,i,n,o,r,a,s,l="",c=0;for(e=function(e){if(null==e)return"";var t,i,n,o={},r={},a="",s="",l="",c=2,d=3,u=2,p="",h=0,v=0,g=String.fromCharCode;for(n=0;n>=1}else{for(i=1,t=0;t>=1}0==--c&&(c=Math.pow(2,u),u++),delete r[l]}else for(i=o[l],t=0;t>=1;0==--c&&(c=Math.pow(2,u),u++),o[s]=d++,l=String(a)}if(""!==l){if(Object.prototype.hasOwnProperty.call(r,l)){if(l.charCodeAt(0)<256){for(t=0;t>=1}else{for(i=1,t=0;t>=1}0==--c&&(c=Math.pow(2,u),u++),delete r[l]}else for(i=o[l],t=0;t>=1;0==--c&&(c=Math.pow(2,u),u++)}for(i=2,t=0;t>=1;for(;;){if(h<<=1,15==v){p+=g(h);break}v++}return p}(e);c<2*e.length;)c%2==0?(t=e.charCodeAt(c/2)>>8,i=255&e.charCodeAt(c/2),n=c/2+1>8:NaN):(t=255&e.charCodeAt((c-1)/2),(c+1)/2>8,n=255&e.charCodeAt((c+1)/2)):i=n=NaN),c+=3,o=t>>2,r=(3&t)<<4|i>>4,a=(15&i)<<2|n>>6,s=63&n,isNaN(i)?a=s=64:isNaN(n)&&(s=64),l=l+mt.charAt(o)+mt.charAt(r)+mt.charAt(a)+mt.charAt(s);return l},kt=k("fireRequest"),Ct=k("dropRequestDueToOptOut"),xt=k("addUseIPToRequest"),Pt=k("addARPToRequest"),St=function(){function e(){t(this,e),this.networkRetryCount=0,this.minDelayFrequency=0}return n(e,[{key:"getDelayFrequency",value:function(){if(this.logger.debug("Network retry #"+this.networkRetryCount),this.networkRetryCount<10)return this.logger.debug(this.account.id,"Failure count is "+this.networkRetryCount+". Setting delay frequency to 1s"),this.minDelayFrequency=ve,this.minDelayFrequency;if(null==this.account.region)return this.logger.debug(this.account.id,"Setting delay frequency to 1s"),ve;var e=1e3*(Math.floor(10*Math.random())+1);return this.minDelayFrequency+=e,this.minDelayFrequency<6e5?(this.logger.debug(this.account.id,"Setting delay frequency to "+this.minDelayFrequency),this.minDelayFrequency):(this.minDelayFrequency=ve,this.logger.debug(this.account.id,"Setting delay frequency to "+this.minDelayFrequency),this.minDelayFrequency)}}],[{key:"fireRequest",value:function(e,t,i,n){C(this,kt)[kt](e,1,t,i,n)}}]),e}();St.logger=void 0,St.device=void 0,St.account=void 0,Object.defineProperty(St,kt,{value:function(e,t,i,n,o){var r,a,s=this;if(C(this,Ct)[Ct]())this.logger.debug("req dropped due to optout cookie: "+this.device.gcookie);else{if(Ie(this.device.gcookie)||(De.blockRequest=!0),o&&o===ge)!Ie(this.device.gcookie)&&De.globalCache.RESP_N url: "+e)}}}),Object.defineProperty(St,Ct,{value:function(){return!De.isOptInRequest&&Ie(this.device.gcookie)&&ke(this.device.gcookie)?":OO"===this.device.gcookie.slice(-3):(De.isOptInRequest=!1,!1)}}),Object.defineProperty(St,xt,{value:function(e){var t=je.getMetaProp(Z);return"boolean"!=typeof t&&(t=!1),ft(e,Z,t?"true":"false")}}),Object.defineProperty(St,Pt,{value:function(e,t){if(!0===t){var i={skipResARP:!0};return ft(e,"arp",yt(JSON.stringify(i),this.logger))}return je._isLocalStorageSupported()&&void 0!==localStorage.getItem(K)&&null!==localStorage.getItem(K)?ft(e,"arp",yt(JSON.stringify(je.readFromLSorCookie(K)),this.logger)):e}});var Ot=function(){var e={};if(je._isLocalStorageSupported()){var t=je.read(U);null!=t?(t=JSON.parse(decodeURIComponent(t).replace(R,'"'))).hasOwnProperty("global")?e.wp=t:e=t:e={}}return e},It=function(e){if(je._isLocalStorageSupported()){var t=a(a({},Ot()),e),i=JSON.stringify(t);je.save(U,encodeURIComponent(i)),_t()}},_t=function(){if(je._isLocalStorageSupported()){var e=je.read(N);if(Ie(e))try{e=JSON.parse(decodeURIComponent(je.read(N)));var t=je.read(F)?JSON.parse(decodeURIComponent(je.read(F))):{};if(e&&je._isLocalStorageSupported()){var i={},n=Ot();Object.keys(n).forEach((function(r){var s=e in t&&Object.keys(t[e]).length&&t[e][r]?t[e][r]:{},l=n[r].global,c=Ae(),d=n[r][c];if(void 0!==l){var u=Object.keys(l);for(var p in u){var h=[];if(u.hasOwnProperty(p)){var v=0,g=0,f=u[p];if("tc"===f)continue;void 0!==d&&void 0!==d[f]&&(v=d[f]),void 0!==l&&void 0!==l[f]&&(g=l[f]),h=[f,v,g],s[f]=h}}}i=a(a({},i),{},o({},r,s))})),t[e]=i,je.save(F,encodeURIComponent(JSON.stringify(t)))}}catch(e){console.error("Invalid clevertap Id "+e)}}},Et=function(){var e=JSON.parse(decodeURIComponent(je.read(N))),t={};if(je._isLocalStorageSupported()){t=Ot();var i=je.read(F),n=i?decodeURIComponent(i):null,o=n?JSON.parse(n):null,r=e&&null!=i&&o&&o[e]&&o[e].wp?Object.values(o[e].wp):[],a=e&&null!=i&&o&&o[e]&&o[e].wi?Object.values(o[e].wi):[],s=Ae(),l=0,c=0;return t.wp&&t.wp[s]&&"undefined"!==t.wp[s].tc&&(l=t.wp[s].tc),t.wi&&t.wi[s]&&"undefined"!==t.wi[s].tc&&(c=t.wi[s].tc),{wmp:l,wimp:c,tlc:r,witlc:a}}},At=function(e,t){var i=t.logger,n=!1;if(Ce(e))for(var o in e)if(e.hasOwnProperty(o)){n=!0;var r=e[o];if(null==r){delete e[o];continue}"Gender"!==o||r.match(/^M$|^F$/)||(n=!1,i.error(Qe)),"Employed"!==o||r.match(/^Y$|^N$/)||(n=!1,i.error(Xe)),"Married"!==o||r.match(/^Y$|^N$/)||(n=!1,i.error(et)),"Education"!==o||r.match(/^School$|^College$|^Graduate$/)||(n=!1,i.error(tt)),"Age"===o&&null!=r&&(Se(r)?e.Age=+r:(n=!1,i.error(it))),"DOB"===o?(/^\$D_/.test(r)&&11===(r+"").length||xe(r)||(n=!1,i.error(nt)),xe(r)&&(e[o]=Le(r))):xe(r)&&(e[o]=Le(r)),"Phone"!==o||Pe(r)||(r.length>8&&"+"===r.charAt(0)?(r=r.substring(1,r.length),Se(r)?e.Phone=+r:(n=!1,i.error(rt+". Removed."))):(n=!1,i.error(rt+". Removed."))),n||delete e[o]}return n},Mt=function(e){var t={};t.Name=e.name,null!=e.id&&(t.FBID=e.id+""),"male"===e.gender?t.Gender="M":"female"===e.gender?t.Gender="F":t.Gender="O";null!=e.relationship_status&&(t.Married="N","Married"===e.relationship_status&&(t.Married="Y"));var i=function(e){if(null!=e){for(var t="",i="",n=0;n0?"Y":"N",null!=e.email&&(t.Email=e.email),null!=e.birthday){var o=e.birthday.split("/");t.DOB=Te(o[2]+o[0]+o[1])}return t},Lt=function(e,t){var i=t.logger,n={};if(null!=e.displayName&&(n.Name=e.displayName),null!=e.id&&(n.GPID=e.id+""),null!=e.gender&&("male"===e.gender?n.Gender="M":"female"===e.gender?n.Gender="F":"other"===e.gender&&(n.Gender="O")),null!=e.image&&!1===e.image.isDefault&&(n.Photo=e.image.url.split("?sz")[0]),null!=e.emails)for(var o=0;o0)for(var t in e)if(e.hasOwnProperty(t)){var i=e[t],n={},o=void 0;if(null!=i.Site){if(o=i.Site,Pe(o)||!At(o,{logger:C(this,Bt)[Bt]}))return}else if(null!=i.Facebook){var r=i.Facebook;Pe(r)||r.error||(o=Mt(r))}else if(null!=i["Google Plus"]){var a=i["Google Plus"];Pe(a)||a.error||(o=Lt(a,{logger:C(this,Bt)[Bt]}))}if(null!=o&&!Pe(o)){n.type="profile",null==o.tz&&(o.tz=(new Date).toString().match(/([A-Z]+[\+-][0-9]+)/)[1]),n.profile=o,Tt(o,!0),n=C(this,Nt)[Nt].addSystemDataToObject(n,void 0),C(this,Nt)[Nt].addFlags(n);var s=yt(JSON.stringify(n),C(this,Bt)[Bt]),l=C(this,zt)[zt].dataPostURL;l=ft(l,"type",Y),l=ft(l,"d",s),C(this,Nt)[Nt].saveAndFireRequest(l,De.blockRequest)}}},Kt=k("request"),Ht=k("logger"),Gt=k("account"),Jt=k("session"),Zt=k("oldValues"),$t=k("device"),Yt=k("processOUL"),Qt=k("handleCookieFromCache"),Xt=k("deleteUser"),ei=k("processLoginArray"),ti=function(e){s(o,e);var i=g(o);function o(e,n){var r,a=e.request,s=e.account,l=e.session,c=e.logger,d=e.device;return t(this,o),r=i.call(this),Object.defineProperty(h(r),ei,{value:ri}),Object.defineProperty(h(r),Xt,{value:oi}),Object.defineProperty(h(r),Qt,{value:ni}),Object.defineProperty(h(r),Yt,{value:ii}),Object.defineProperty(h(r),Kt,{writable:!0,value:void 0}),Object.defineProperty(h(r),Ht,{writable:!0,value:void 0}),Object.defineProperty(h(r),Gt,{writable:!0,value:void 0}),Object.defineProperty(h(r),Jt,{writable:!0,value:void 0}),Object.defineProperty(h(r),Zt,{writable:!0,value:void 0}),Object.defineProperty(h(r),$t,{writable:!0,value:void 0}),C(h(r),Kt)[Kt]=a,C(h(r),Gt)[Gt]=s,C(h(r),Jt)[Jt]=l,C(h(r),Ht)[Ht]=c,C(h(r),Zt)[Zt]=n,C(h(r),$t)[$t]=d,r}return n(o,[{key:"clear",value:function(){C(this,Ht)[Ht].debug("clear called. Reset flag has been set."),C(this,Xt)[Xt](),je.setMetaProp(j,!0)}},{key:"push",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i0)for(var o in e)if(e.hasOwnProperty(o)){var r=e[o],a={},s=void 0;if(null!=r.Site){if(s=r.Site,Pe(s)||!At(s,{logger:C(this,Ht)[Ht]}))return}else if(null!=r.Facebook){var l=r.Facebook;Pe(l)||l.error||(s=Mt(l))}else if(null!=r["Google Plus"]){var c=r["Google Plus"];Pe(c)&&!c.error&&(s=Lt(c,{logger:C(this,Ht)[Ht]}))}if(null!=s&&!Pe(s)){a.type="profile",null==s.tz&&(s.tz=(new Date).toString().match(/([A-Z]+[\+-][0-9]+)/)[1]),a.profile=s;var d=[];je._isLocalStorageSupported()&&(s.Identity&&d.push(s.Identity),s.Email&&d.push(s.Email),s.GPID&&d.push("GP:"+s.GPID),s.FBID&&d.push("FB:"+s.FBID),d.length>0&&n(d)),Tt(s,!0),a=C(this,Kt)[Kt].addSystemDataToObject(a,void 0),C(this,Kt)[Kt].addFlags(a),i&&(a.isOUL=!0);var u=yt(JSON.stringify(a),C(this,Ht)[Ht]),p=C(this,Gt)[Gt].dataPostURL;p=ft(p,"type",Y),p=ft(p,"d",u),C(this,Kt)[Kt].saveAndFireRequest(p,De.blockRequest,i)}}},ni=function(){De.blockRequest=!1,console.debug("Block request is false"),je._isLocalStorageSupported()&&(delete localStorage.WZRK_PR,delete localStorage.WZRK_EV,delete localStorage.WZRK_META,delete localStorage.WZRK_ARP,delete localStorage.WZRK_CAMP,delete localStorage.WZRK_CHARGED_ID),je.removeCookie(U,bt()),je.removeCookie(C(this,Jt)[Jt].cookieName,De.broadDomain),je.removeCookie(K,De.broadDomain),C(this,Jt)[Jt].setSessionCookieObject("")},oi=function(){De.blockRequest=!0,C(this,Ht)[Ht].debug("Block request is true"),De.globalCache={gcookie:null,REQ_N:0,RESP_N:0},je._isLocalStorageSupported()&&(delete localStorage.WZRK_G,delete localStorage.WZRK_K,delete localStorage.WZRK_PR,delete localStorage.WZRK_EV,delete localStorage.WZRK_META,delete localStorage.WZRK_ARP,delete localStorage.WZRK_CAMP,delete localStorage.WZRK_CHARGED_ID),je.removeCookie(N,De.broadDomain),je.removeCookie(U,bt()),je.removeCookie(z,bt()),je.removeCookie(C(this,Jt)[Jt].cookieName,De.broadDomain),je.removeCookie(K,De.broadDomain),C(this,$t)[$t].gcookie=null,C(this,Jt)[Jt].setSessionCookieObject("")},ri=function(e){if(Array.isArray(e)&&e.length>0){var t=e.pop();if(null!=t&&Ce(t)&&(null!=t.Site&&Object.keys(t.Site).length>0||null!=t.Facebook&&Object.keys(t.Facebook).length>0||null!=t["Google Plus"]&&Object.keys(t["Google Plus"]).length>0)){je.setInstantDeleteFlagInK();try{C(this,Yt)[Yt]([t])}catch(e){C(this,Ht)[Ht].debug(e)}}else C(this,Ht)[Ht].error("Profile object is in incorrect format")}},ai=function(e){s(o,e);var i=g(o);function o(){var e;return t(this,o),(e=i.call(this))._details=null,e.shadow=null,e.shadow=e.attachShadow({mode:"open"}),e}return n(o,[{key:"renderBanner",value:function(){var e=this;this.shadow.innerHTML=this.getBannerContent(),!1!==this.trackClick&&this.addEventListener("click",(function(){var t=e.details.onClick;t&&(e.details.window?window.open(t,"_blank"):window.parent.location.href=t),window.clevertap.renderNotificationClicked({msgId:e.msgId,pivotId:e.pivotId})})),window.clevertap.renderNotificationViewed({msgId:this.msgId,pivotId:this.pivotId})}},{key:"getBannerContent",value:function(){return'\n \n \n ")}},{key:"details",get:function(){return this._details||""},set:function(e){null===this._details&&(this._details=e,this.renderBanner())}}]),o}(p(HTMLElement)),si=function(e){s(o,e);var i=g(o);function o(){var e;return t(this,o),(e=i.call(this))._target=null,e._carousel=null,e.shadow=null,e.slides=0,e.previouslySelectedItem=-1,e.selectedItem=1,e.autoSlide=null,e.stopAutoSlideTimeout=null,e.shadow=e.attachShadow({mode:"open"}),void 0===customElements.get("ct-web-personalisation-banner")&&customElements.define("ct-web-personalisation-banner",ai),e}return n(o,[{key:"renderCarousel",value:function(){this.slides=this.details.length,this.shadow.innerHTML=this.getStyles();var e=this.getCarouselContent();this.display.showNavBtns&&e.insertAdjacentHTML("beforeend",this.display.navBtnsHtml),this.display.showNavArrows&&(e.insertAdjacentHTML("beforeend",this.display.leftNavArrowHtml),e.insertAdjacentHTML("beforeend",this.display.rightNavArrowHtml)),this._carousel=e,this.shadow.appendChild(e),this.setupClick(),this.updateSelectedItem(),this.startAutoSlide(),this.setupOnHover(),window.clevertap.renderNotificationViewed({msgId:this.target.wzrk_id,pivotId:this.target.wzrk_pivot})}},{key:"setupClick",value:function(){var e=this;this._carousel.addEventListener("click",(function(t){var i=t.target.id;if(i.startsWith("carousel__button")){var n=+i.split("-")[1];n!==e.selectedItem&&(e.previouslySelectedItem=e.selectedItem,e.selectedItem=n,e.updateSelectedItem(),e.startAutoSlide())}else if(i.startsWith("carousel__arrow"))i.endsWith("right")?e.goToNext():e.goToPrev(),e.startAutoSlide();else if(i.indexOf("-")>-1){var o=+i.split("-")[1],r=o-1;window.parent.clevertap&&window.clevertap.renderNotificationClicked({msgId:e.target.wzrk_id,pivotId:e.target.wzrk_pivot,wzrk_slideNo:o});var a=e.details[r].onClick;""!==a&&(e.details[r].window?window.open(a,"_blank"):window.location.href=a)}}))}},{key:"setupOnHover",value:function(){var e=this;this._carousel.addEventListener("mouseenter",(function(t){e.stopAutoSlideTimeout=setTimeout((function(){e.autoSlide=clearInterval(e.autoSlide)}),500)})),this._carousel.addEventListener("mouseleave",(function(t){clearTimeout(e.stopAutoSlideTimeout),void 0===e.autoSlide&&e.startAutoSlide()}))}},{key:"getCarouselContent",value:function(){var e=document.createElement("div");return e.setAttribute("class","carousel"),this.details.forEach((function(t,i){var n=document.createElement("ct-web-personalisation-banner");n.classList.add("carousel__item"),n.trackClick=!1,n.setAttribute("id","carousel__item-".concat(i+1)),n.details=t,e.appendChild(n)})),e}},{key:"getStyles",value:function(){var e,t;return"\n \n ")}},{key:"updateSelectedItem",value:function(){if(-1!==this.previouslySelectedItem){var e=this.shadow.getElementById("carousel__item-".concat(this.previouslySelectedItem)),t=this.shadow.getElementById("carousel__button-".concat(this.previouslySelectedItem));e.classList.remove("carousel__item--selected"),t&&t.classList.remove("carousel__button--selected")}var i=this.shadow.getElementById("carousel__item-".concat(this.selectedItem)),n=this.shadow.getElementById("carousel__button-".concat(this.selectedItem));i.classList.add("carousel__item--selected"),n&&n.classList.add("carousel__button--selected")}},{key:"startAutoSlide",value:function(){var e=this;clearInterval(this.autoSlide),this.autoSlide=setInterval((function(){e.goToNext()}),this.display.sliderTime?1e3*this.display.sliderTime:3e3)}},{key:"goToNext",value:function(){this.goTo(this.selectedItem,(this.selectedItem+1)%this.slides)}},{key:"goToPrev",value:function(){this.goTo(this.selectedItem,this.selectedItem-1)}},{key:"goTo",value:function(e,t){this.previouslySelectedItem=e,this.selectedItem=t,0===t&&(this.selectedItem=this.slides),this.updateSelectedItem()}},{key:"target",get:function(){return this._target||""},set:function(e){null===this._target&&(this._target=e,this.renderCarousel())}},{key:"details",get:function(){return this.target.display.details}},{key:"display",get:function(){return this.target.display}}]),o}(p(HTMLElement)),li=function(e){s(o,e);var i=g(o);function o(){var e;return t(this,o),(e=i.call(this))._target=null,e._session=null,e.shadow=null,e.popup=null,e.container=null,e.resizeObserver=null,e.shadow=e.attachShadow({mode:"open"}),e}return n(o,[{key:"renderImageOnlyPopup",value:function(){var e=this,t=this.target.wzrk_id.split("_")[0],i=this.session.sessionId;this.shadow.innerHTML=this.getImageOnlyPopupContent(),this.popup=this.shadowRoot.getElementById("imageOnlyPopup"),this.container=this.shadowRoot.getElementById("container"),this.closeIcon=this.shadowRoot.getElementById("close"),this.popup.addEventListener("load",this.updateImageAndContainerWidth()),this.resizeObserver=new ResizeObserver((function(){return e.handleResize(e.popup,e.container)})),this.resizeObserver.observe(this.popup),this.closeIcon.addEventListener("click",(function(){if(e.resizeObserver.unobserve(e.popup),document.getElementById("wzrkImageOnlyDiv").style.display="none",e.remove(),null!=t&&"-1"!==t&&je._isLocalStorageSupported()){var n=Ot(),o=n.wp[i];null==o&&(o={},n[i]=o),o[t]="dnd",It(n)}})),window.clevertap.renderNotificationViewed({msgId:this.msgId,pivotId:this.pivotId}),this.onClickUrl&&this.popup.addEventListener("click",(function(){e.target.display.window?window.open(e.onClickUrl,"_blank"):window.parent.location.href=e.onClickUrl,window.clevertap.renderNotificationClicked({msgId:e.msgId,pivotId:e.pivotId})}))}},{key:"handleResize",value:function(e,t){var i=this.getRenderedImageWidth(e);t.style.setProperty("width","".concat(i,"px"))}},{key:"getImageOnlyPopupContent",value:function(){return"\n ".concat(this.target.msgContent.css,"\n ").concat(this.target.msgContent.html,"\n ")}},{key:"updateImageAndContainerWidth",value:function(){var e=this;return function(){var t=e.getRenderedImageWidth(e.popup);e.popup.style.setProperty("width","".concat(t,"px")),e.container.style.setProperty("width","".concat(t,"px")),e.container.style.setProperty("height","auto"),e.container.style.setProperty("position","fixed"),e.popup.style.setProperty("visibility","visible"),e.closeIcon.style.setProperty("visibility","visible"),document.getElementById("wzrkImageOnlyDiv").style.visibility="visible"}}},{key:"getRenderedImageWidth",value:function(e){var t=e.naturalWidth/e.naturalHeight;return e.height*t}},{key:"target",get:function(){return this._target||""},set:function(e){null===this._target&&(this._target=e,this.renderImageOnlyPopup())}},{key:"session",get:function(){return this._session||""},set:function(e){this._session=e}},{key:"msgId",get:function(){return this.target.wzrk_id}},{key:"pivotId",get:function(){return this.target.wzrk_pivot}},{key:"onClickUrl",get:function(){return this.target.display.onClickUrl}}]),o}(p(HTMLElement)),ci=function(e){s(o,e);var i=g(o);function o(e,n){var r;return t(this,o),(r=i.call(this)).wrapper=null,r.snackBar=null,r.shadow=r.attachShadow({mode:"open"}),r.config=e,r.message=n,r.renderMessage(n),r}return n(o,[{key:"createEl",value:function(e,t,i){var n=document.createElement(e);return n.setAttribute("id",t),n.setAttribute("part",i||t),n}},{key:"renderMessage",value:function(e){switch(this.wrapper=this.createEl("div","messageWrapper"),e.templateType){case"text-only":case"text-with-icon":case"text-with-icon-and-image":var t=this.prepareBasicMessage(e.msg[0]);this.wrapper.appendChild(t)}var i=this.createEl("div","timeStamp");if(i.innerHTML="".concat(mi(e.id.split("_")[1]),""),!e.viewed){var n=this.createEl("span","unreadMarker");i.appendChild(n)}this.wrapper.appendChild(i),this.shadow.appendChild(this.wrapper)}},{key:"prepareBasicMessage",value:function(e){var t=this.createEl("div","message");if(e.imageUrl){var i=this.addImage(e.imageUrl,"mainImg");t.appendChild(i)}var n=this.createEl("div","iconTitleDescWrapper");if(e.iconUrl){var o=this.addImage(e.iconUrl,"iconImg");n.appendChild(o)}var r=this.createEl("div","titleDescWrapper");if(e.title){var a=this.createEl("div","title");a.innerText=e.title,r.appendChild(a)}if(e.description){var s=this.createEl("div","description");s.innerText=e.description,r.appendChild(s)}if((e.title||e.description)&&n.appendChild(r),(e.iconUrl||e.title||e.description)&&t.appendChild(n),e.buttons&&e.buttons.length){var l=this.addButtons(e.buttons);t.appendChild(l)}return t}},{key:"addButtons",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=this.createEl("div","buttonsContainer"),n=!1;return t.forEach((function(t,o){var r=e.createEl("button","button-".concat(o),"button");r.innerText=t.text,o>0&&(r.style.cssText+="margin-left: 2px;"),"copy"===t.action&&(n=!0),i.appendChild(r)})),n&&this.addSnackbar(i),i}},{key:"addSnackbar",value:function(e){this.snackBar=this.createEl("div","snackbar-".concat(this.campaignId),"snackbar"),this.snackBar.innerHTML=Ci;var t=this.createEl("span","snackbar-msg-".concat(this.campaignId),"snackbar-msg");t.innerText="Copied to clipboard",this.snackBar.appendChild(t),e.appendChild(this.snackBar)}},{key:"addImage",value:function(e,t){var i=this.createEl("div","".concat(t,"Container")),n=this.createEl("img",t);return n.setAttribute("src",e),n.setAttribute("loading","lazy"),i.appendChild(n),i}},{key:"raiseClickedEvent",value:function(e,t){switch(this.message.templateType){case"text-only":case"text-with-icon":case"text-with-icon-and-image":this.raiseClickedForBasicTemplates(e,t)}}},{key:"raiseClickedForBasicTemplates",value:function(e,t){var i=this,n=this.message.msg[0],o={msgId:this.campaignId,pivotId:this.pivotId};if("BUTTON"===e.tagName){var r=e.id.split("-")[1],a=n.buttons[r];o.kv={wzrk_c2a:a.text},"url"===a.action?a.openUrlInNewTab?window.open(a.url,"_blank"):window.location=a.url:"copy"===a.action&&(window.focus(),navigator.clipboard.writeText(a.clipboardText),this.snackBar.style.setProperty("display","flex","important"),setTimeout((function(){i.snackBar.style.setProperty("display","none","important")}),2e3))}else"CT-INBOX-MESSAGE"===e.tagName&&n.onClickUrl&&(n.openUrlInNewTab?window.open(n.onClickUrl,"_blank"):window.location=n.onClickUrl);t?console.log("Notifiction clicked event will be raised at run time with payload ::",o):window.clevertap.renderNotificationClicked(o)}},{key:"pivotId",get:function(){return this.message.wzrk_pivot}},{key:"campaignId",get:function(){return this.message.wzrk_id}}]),o}(p(HTMLElement)),di=function(e){s(o,e);var i=g(o);function o(e){var n;return t(this,o),(n=i.call(this)).isInboxOpen=!1,n.isInboxFromFlutter=!1,n.selectedCategory=null,n.unviewedMessages={},n.unviewedCounter=0,n.isPreview=!1,n.inboxConfigForPreview={},n.inboxSelector=null,n.inbox=null,n.emptyInboxMsg=null,n.inboxCard=null,n.unviewedBadge=null,n.observer=null,n.selectedCategoryRef=null,n.addClickListenerOnDocument=function(e){if(e.composedPath().includes(n.inbox)){var t=e.path||e.composedPath&&e.composedPath();if(t.length){var i=t[0].id;if("closeInbox"===i)n.toggleInbox();else if(i.startsWith("category-"))n.prevCategoryRef=n.selectedCategoryRef,n.selectedCategoryRef=t[0],n.updateActiveCategory(t[0].innerText);else{var o=t.filter((function(e){var t;return(null===(t=e.id)||void 0===t?void 0:t.startsWith("button-"))||"CT-INBOX-MESSAGE"===e.tagName}));o.length&&o[o.length-1].raiseClickedEvent(o[0],n.isPreview)}}}else(n.inboxSelector.contains(e.target)||n.isInboxOpen)&&(n.isInboxFromFlutter?n.isInboxFromFlutter=!1:n.toggleInbox(e))},n.setBadgeStyle=function(e){null!==n.unviewedBadge&&(n.unviewedBadge.innerText=e>9?"9+":e,n.unviewedBadge.style.display=e>0?"flex":"none")},n.logger=e,n.shadow=n.attachShadow({mode:"open"}),n}return n(o,[{key:"connectedCallback",value:function(){this.init()}},{key:"init",value:function(){this.config=this.isPreview?this.inboxConfigForPreview:je.readFromLSorCookie(pe)||{},0!==Object.keys(this.config).length&&(this.inboxSelector=document.getElementById(this.config.inboxSelector),null!==this.inboxSelector&&(this.config.styles.notificationsBadge?this.addUnviewedBadge():this.unviewedBadge&&this.unviewedBadge.remove(),this.createinbox(),document.removeEventListener("click",this.addClickListenerOnDocument),document.addEventListener("click",this.addClickListenerOnDocument),this.config.categories.length&&this.updateActiveCategory(this.selectedCategoryRef.innerText),this.shadow.innerHTML=this.getInboxStyles(),this.shadow.appendChild(this.inbox)))}},{key:"addMsgsToInboxFromLS",value:function(){var e=this,t=this.deleteExpiredAndGetUnexpiredMsgs(!1),i=t?Object.keys(t):[];0!==i.length&&(i.forEach((function(i){t[i].viewed||(e.unviewedMessages[i]=t[i],e.unviewedCounter++)})),this.buildUIForMessages(t),this.updateUnviewedBadgeCounter())}},{key:"deleteExpiredAndGetUnexpiredMsgs",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=vi(),i=Math.floor(Date.now()/1e3);for(var n in t)if(t[n].wzrk_ttl&&t[n].wzrk_ttl>0&&t[n].wzrk_ttl0&&(t=Object.values(t).sort((function(e,t){return t.date-e.date})).reduce((function(e,t){return e[t.id]=t,e}),{})),gi(t),t}},{key:"updateInboxMessages",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=this.deleteExpiredAndGetUnexpiredMsgs(),n=Date.now(),o={};t.forEach((function(t,r){var a="".concat(t.wzrk_id.split("_")[0],"_").concat(Date.now());t.id=a,t.date=n-r,t.viewed=0,i[a]=t,o[a]=t,e.unviewedMessages[a]=t,e.unviewedCounter++})),gi(i),this.buildUIForMessages(o),this.updateUnviewedBadgeCounter()}},{key:"createEl",value:function(e,t,i){var n=document.createElement(e);return n.setAttribute("id",t),n.setAttribute("part",i||t),n}},{key:"addUnviewedBadge",value:function(){var e=this;this.unviewedBadge||(this.unviewedBadge=this.createEl("div","unviewedBadge"),this.unviewedBadge.style.cssText="display: none; position: absolute; height: 16px; width: 26px; border-radius: 8px; background-color: ".concat(this.config.styles.notificationsBadge.backgroundColor,"; font-size: 12px; color: ").concat(this.config.styles.notificationsBadge.textColor,"; font-weight: bold; align-items: center; justify-content: center;"),document.body.appendChild(this.unviewedBadge)),this.updateUnviewedBadgePosition(),window.addEventListener("resize",(function(){e.updateUnviewedBadgePosition()}))}},{key:"updateUnviewedBadgePosition",value:function(){var e=this.inboxSelector.getBoundingClientRect(),t=e.top,i=e.right;this.unviewedBadge.style.top="".concat(t-8,"px"),this.unviewedBadge.style.left="".concat(i-8,"px")}},{key:"createinbox",value:function(){var e=this;this.inbox=this.createEl("div","inbox");var t=this.createEl("div","header"),i=this.createEl("div","headerTitle");i.innerText=this.config.title;var n=this.createEl("div","closeInbox");if(n.innerHTML="×",t.appendChild(i),t.appendChild(n),this.inbox.appendChild(t),this.config.categories.length){var o=this.createCategories();this.inbox.appendChild(o)}this.inboxCard=this.createEl("div","inboxCard"),this.inbox.appendChild(this.inboxCard),this.emptyInboxMsg=this.createEl("div","emptyInboxMsg"),this.emptyInboxMsg.innerText="All messages will be displayed here.",this.inboxCard.appendChild(this.emptyInboxMsg);var r={root:this.inboxCard,rootMargin:"0px",threshold:.5};this.observer=new IntersectionObserver((function(t,i){e.handleMessageViewed(t)}),r),this.addMsgsToInboxFromLS()}},{key:"createCategories",value:function(){var e=this,t=this.createEl("div","categoriesContainer"),i=this.createEl("div","leftArrow");i.innerHTML=ki,i.children[0].style="transform: rotate(180deg)",i.addEventListener("click",(function(){e.shadowRoot.getElementById("categoriesWrapper").scrollBy(-70,0)})),t.appendChild(i);var n=this.createEl("div","categoriesWrapper");["All"].concat(f(this.config.categories)).forEach((function(t,i){var o=e.createEl("div","category-".concat(i),"category");o.innerText=t,0===i&&(e.selectedCategoryRef=o),n.appendChild(o)})),t.appendChild(n);var o=this.createEl("div","rightArrow");o.innerHTML=ki,o.addEventListener("click",(function(){e.shadowRoot.getElementById("categoriesWrapper").scrollBy(70,0)})),t.appendChild(o);var r={root:t,threshold:.9},a=n.children[0],s=n.children[this.config.categories.length];return new IntersectionObserver((function(t){e.categoryObserverCb(i,t[0].intersectionRatio>=.9)}),r).observe(a),new IntersectionObserver((function(t){e.categoryObserverCb(o,t[0].intersectionRatio>=.9)}),r).observe(s),t}},{key:"categoryObserverCb",value:function(e,t){e&&(e.style.display=t?"none":"flex")}},{key:"updateActiveCategory",value:function(e){var t=this;this.selectedCategory=e,this.inboxCard.scrollTop=0;var i=0;this.prevCategoryRef&&this.prevCategoryRef.setAttribute("selected","false"),this.selectedCategoryRef.setAttribute("selected","true"),this.inboxCard.childNodes.forEach((function(e){"emptyInboxMsg"!==e.getAttribute("id")&&(e.style.display="All"===t.selectedCategory||e.getAttribute("category")===t.selectedCategory?"block":"none","block"===e.style.display&&i++)})),0===i?(this.emptyInboxMsg.innerText="".concat(e," messages will be displayed here."),this.emptyInboxMsg.style.display="block"):this.emptyInboxMsg.style.display="none"}},{key:"buildUIForMessages",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!this.isPreview&&this.updateTSForRenderedMsgs(),this.inboxCard.scrollTop=0;var i,n=null!==(e=this.config.maxMsgsInInbox)&&void 0!==e?e:15,o=this.inboxCard.firstChild,r=Object.values(t).sort((function(e,t){return t.date-e.date})).map((function(e){return e.id})),a=m(r);try{for(a.s();!(i=a.n()).done;){var s=i.value,l=new ci(this.config,t[s]);l.setAttribute("id",t[s].id),l.setAttribute("pivot",t[s].wzrk_pivot),l.setAttribute("part","ct-inbox-message"),this.config.categories.length>0?(l.setAttribute("category",t[s].tags[0]||""),l.style.display="All"===this.selectedCategory||t[s].category===this.selectedCategory?"block":"none"):l.style.display="block",this.inboxCard.insertBefore(l,o),this.observer.observe(l)}}catch(e){a.e(e)}finally{a.f()}for(var c=this.inboxCard.querySelectorAll("ct-inbox-message").length;c>n;){var d=this.inboxCard.querySelectorAll("ct-inbox-message");d.length>0&&d[d.length-1].remove(),c--}var u=this.inboxCard.querySelectorAll('ct-inbox-message[style*="display: block"]').length;this.emptyInboxMsg.style.display=u?"none":"block"}},{key:"handleMessageViewed",value:function(e){var t=this,i=!this.isPreview;this.isInboxOpen&&e.forEach((function(e){e.isIntersecting&&t.unviewedMessages.hasOwnProperty(e.target.id)&&0===e.target.message.viewed&&(e.target.message.viewed=1,i?(window.clevertap.renderNotificationViewed({msgId:e.target.campaignId,pivotId:e.target.pivotId}),t.updateMessageInLS(e.target.id,a(a({},e.target.message),{},{viewed:1})),setTimeout((function(){e.target.shadowRoot.getElementById("unreadMarker").style.display="none"}),1e3)):console.log("Notifiction viewed event will be raised at run time with payload ::",{msgId:e.target.campaignId,pivotId:e.target.pivotId}),t.unviewedCounter--,t.updateUnviewedBadgeCounter(),delete t.unviewedMessages[e.target.id])}))}},{key:"updateMessageInLS",value:function(e,t){if(!this.isPreview){var i=vi();i[e]=t,gi(i)}}},{key:"toggleInbox",value:function(e){this.isInboxOpen=!this.isInboxOpen,this.isInboxFromFlutter=!!(null==e?void 0:e.rect),this.isInboxOpen?(this.inboxCard.scrollTop=0,!this.isPreview&&this.deleteExpiredAndGetUnexpiredMsgs(),this.inbox.style.display="block",this.inbox.style.zIndex="2147483647",this.config.categories.length&&(this.selectedCategoryRef.setAttribute("selected","false"),this.selectedCategoryRef=this.shadowRoot.getElementById("category-0"),this.updateActiveCategory(this.selectedCategoryRef.innerText),this.shadowRoot.getElementById("categoriesWrapper").scrollLeft-=this.shadowRoot.getElementById("categoriesWrapper").scrollWidth),this.setInboxPosition(e)):this.inbox.style.display="none"}},{key:"setInboxPosition",value:function(e){var t=window.outerWidth,i=getComputedStyle(De.inbox),n=i.getPropertyValue("--inbox-top"),o=i.getPropertyValue("--inbox-bottom"),r=i.getPropertyValue("--inbox-left"),a=i.getPropertyValue("--inbox-right");if(t>481&&!(n||o||r||a)){var s=yi(e,this.inbox.clientHeight,this.inbox.clientWidth),l=s.xPos,c=s.yPos;this.inbox.style.top=c+"px",this.inbox.style.left=l+"px"}}},{key:"updateUnviewedBadgeCounter",value:function(){if(this.isPreview)this.setBadgeStyle(this.unviewedCounter);else{var e=0;this.inboxCard.querySelectorAll("ct-inbox-message").forEach((function(t){var i=vi();i[t.id]&&0===i[t.id].viewed&&e++})),this.setBadgeStyle(e)}}},{key:"updateTSForRenderedMsgs",value:function(){this.inboxCard.querySelectorAll("ct-inbox-message").forEach((function(e){var t=e.id.split("_")[1];e.shadow.getElementById("timeStamp").firstChild.innerText=mi(t)}))}},{key:"getInboxStyles",value:function(){var e=this.config.categories.length?64:16,t={panelBackgroundColor:this.config.styles.panelBackgroundColor,panelBorderColor:this.config.styles.panelBorderColor,headerBackgroundColor:this.config.styles.header.backgroundColor,headerTitleColor:this.config.styles.header.titleColor,closeIconColor:this.config.styles.closeIconColor,categoriesTabColor:this.config.styles.categories.tabColor,categoriesTitleColor:this.config.styles.categories.titleColor,selectedCategoryTabColor:this.config.styles.categories.selectedTab.tabColor,selectedCategoryTitleColor:this.config.styles.categories.selectedTab.titleColor,headerCategoryHeight:36+e};this.config.styles.categories.borderColor&&(t.categoriesBorderColor=this.config.styles.categories.borderColor),this.config.styles.categories.selectedTab.borderColor&&(t.selectedCategoryBorderColor=this.config.styles.categories.selectedTab.borderColor);var i,n,o,r,a,s,l,c,d,u,p,h,v,g,f,b,y,m,w,k,C,x=(n=(i=t).panelBackgroundColor,o=i.panelBorderColor,r=i.headerBackgroundColor,a=i.headerTitleColor,s=i.closeIconColor,l=i.categoriesTabColor,c=i.categoriesTitleColor,d=i.categoriesBorderColor,u=i.selectedCategoryTabColor,p=i.selectedCategoryTitleColor,h=i.selectedCategoryBorderColor,v=i.headerCategoryHeight,'\n \n ")),P=this.config.styles.cards;return x+(g={backgroundColor:P.backgroundColor,borderColor:P.borderColor,titleColor:P.titleColor,descriptionColor:P.descriptionColor,buttonColor:P.buttonColor,buttonTextColor:P.buttonTextColor,unreadMarkerColor:P.unreadMarkerColor},f=g.backgroundColor,b=g.borderColor,y=g.titleColor,m=g.descriptionColor,w=g.buttonColor,k=g.buttonTextColor,C=g.unreadMarkerColor,'\n \n "))}},{key:"incomingMessages",get:function(){return[]},set:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.length>0&&this.inbox&&this.updateInboxMessages(e)}},{key:"incomingMessagesForPreview",get:function(){return[]},set:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i={};t.length>0&&this.inbox&&(this.isPreview=!0,this.unviewedCounter=0,t.forEach((function(t){var n="".concat(t.wzrk_id.split("_")[0],"_").concat(Date.now());t.id=n,i[n]=t,e.unviewedMessages[n]=t,e.unviewedCounter++})),this.buildUIForMessages(i),this.updateUnviewedBadgeCounter())}}]),o}(p(HTMLElement)),ui=function(e){e.inbox_preview?De.inbox.incomingMessagesForPreview=e.inbox_notifs:De.inbox.incomingMessages=e},pi=function(e){bi(),De.inbox=new di({logger:e}),document.body.appendChild(De.inbox)},hi=function(e){var t=je.readFromLSorCookie(he)||{};if(Object.keys(t).length>0&&Object.keys(t)[0].includes("_")){var i={};return i[e]=t,je.saveToLSorCookie(he,i),i}return t},vi=function(){var e=JSON.parse(decodeURIComponent(je.read(N)));if(!Ie(e))return{};var t=hi(e);return t.hasOwnProperty(e)?t[e]:{}},gi=function(e){var t=JSON.parse(decodeURIComponent(je.read(N)));if(Ie(t)){var i=a(a({},hi(t)),{},o({},t,e));je.saveToLSorCookie(he,i)}},fi=function(e){return new Promise((function(t,i){if("complete"===document.readyState)pi(e),t();else{var n=je.readFromLSorCookie(pe)||{},o=function(){null===De.inbox&&pi(e),t()};window.addEventListener("load",(function(){if(document.getElementById(n.inboxSelector))o();else{var i=0;if(i<20)var r=setInterval((function(){document.getElementById(n.inboxSelector)?(o(),clearInterval(r),t()):i>=20&&(clearInterval(r),e.debug("Failed to add inbox")),i++}),500)}}))}}))},bi=function(){void 0===customElements.get("ct-web-inbox")&&(customElements.define("ct-web-inbox",di),customElements.define("ct-inbox-message",ci))},yi=function(e,t,i){var n,o,r=document.scrollingElement.scrollLeft,a=document.scrollingElement.scrollTop,s=window.innerWidth+r,l=window.innerHeight+a,c=e.rect||e.target.getBoundingClientRect(),d=c.x+r,u=c.y+a,p=c.left+r,h=c.right+r,v=c.top+a,g=c.bottom,f=c.height,b=c.width,y=!1,m=16;if(g+t<=l){var w=l-(g+t);o=w>=m?g+m:g+w}else if(v-t>=a){var k=v-t;o=k>=m?v-t-m:v-t-k}else y=!0,(o=u+f/2-t/2)l&&(o=l-t);if(y){var C=h+i;if(C<=s){n=h+(C+m<=s?m:s-C)}else{var x=p-i;n=x-(x-m>=r?m:x-r)}}else(n=d+b/2-i/2)s&&(n=h-i>=r?h-i:s-i);return{xPos:n,yPos:o}},mi=function(e){var t=Date.now(),i=Math.floor((t-e)/6e4);return i<5?"Just now":i<60?"".concat(i," minute").concat(i>1?"s":""," ago"):(i=Math.floor(i/60))<24?"".concat(i," hour").concat(i>1?"s":""," ago"):(i=Math.floor(i/24),"".concat(i," day").concat(i>1?"s":""," ago"))},wi=function(){return Object.keys(je.readFromLSorCookie(pe)||{}).length>0},ki='\n\n\n',Ci='\n\n\n',xi=function(e){var t=e.indexOf(" ` - return html.replace(/(<\s*\/\s*body)/, `${script}\n$1`) + doc.body.appendChild(script) } let _callBackCalled = false @@ -823,24 +748,20 @@ const _tr = (msg, { document.body.appendChild(msgDiv) const iframe = document.createElement('iframe') const borderRadius = targetingMsgJson.display.br === false ? '0' : '8' - const displayObj = targetingMsgJson.display iframe.frameborder = '0px' iframe.marginheight = '0px' iframe.marginwidth = '0px' iframe.scrolling = 'no' - iframe.id = WIZ_IFRAME_INTENT - let html = targetingMsgJson.msgContent.html - if (displayObj['custom-editor'] && !displayObj['bee-editor'] && displayObj['custom-html-sandbox']) { // sandbox the iframe only for custom html - iframe.sandbox = 'allow-scripts allow-popups allow-popups-to-escape-sandbox allow-forms' // allow popup to open url in new page - html = ctEventhandler(html) - } + iframe.id = 'wiz-iframe-intent' const onClick = targetingMsgJson.display.onClick let pointerCss = '' if (onClick !== '' && onClick != null) { pointerCss = 'cursor:pointer;' } + let html // direct html if (targetingMsgJson.msgContent.type === 1) { + html = targetingMsgJson.msgContent.html html = html.replace(/##campaignId##/g, campaignId) html = html.replace(/##campaignId_batchId##/g, targetingMsgJson.wzrk_id) } else { @@ -894,52 +815,22 @@ const _tr = (msg, { } iframe.setAttribute('style', 'z-index: 2147483647; display:block; height: 100% !important; width: 100% !important;min-height:80px !important;border:0px !important; border-color:none !important;') msgDiv.appendChild(iframe) + const ifrm = (iframe.contentWindow) ? iframe.contentWindow : (iframe.contentDocument.document) ? iframe.contentDocument.document : iframe.contentDocument + const doc = ifrm.document // Dispatch event for interstitial/exit intent close const closeCampaign = new Event('CT_campaign_rendered') document.dispatchEvent(closeCampaign) - if (targetingMsgJson.display['custom-editor'] && !targetingMsgJson.display['bee-editor'] && targetingMsgJson.display['custom-html-sandbox']) { - html = appendScriptForCustomEvent(targetingMsgJson, html) - } - iframe.srcdoc = html - - let contentDiv - iframe.onload = () => { - if (targetingMsgJson.display['custom-editor'] && !targetingMsgJson.display['bee-editor'] && targetingMsgJson.display['custom-html-sandbox']) { - window.addEventListener('message', event => { - switch (event?.data?.action) { - case GET_NOTIFICATION_DATA: - window.clevertap.renderNotificationClicked(event.data.value) - break - case EVENT: - window.clevertap.event.push(event.data.value) - break - case PROFILE: - window.clevertap.profile.push(event.data.value) - break - case OUL: - window.clevertap.onUserLogin.push(event.data.value) - break - case CLOSE_INTERSTITIAL_POPUP: - setTimeout(() => { - const interstitialWrapper = window.document.getElementById('intentPreview') - const interstitialOverlay = window.document.getElementById('intentOpacityDiv') - interstitialOverlay && interstitialOverlay.remove() - interstitialWrapper && interstitialWrapper.remove() - }, 0) - break - default: - // Handle unknown action - break - } - }) - contentDiv = '' - } else { - contentDiv = document.getElementById(WIZ_IFRAME_INTENT).contentDocument.getElementById('contentDiv') - } - setupClickUrl(onClick, targetingMsgJson, contentDiv, 'intentPreview', legacy) + doc.open() + doc.write(html) + if (targetingMsgJson.display['custom-editor']) { + appendScriptForCustomEvent(targetingMsgJson, doc) } + doc.close() + + const contentDiv = document.getElementById('wiz-iframe-intent').contentDocument.getElementById('contentDiv') + setupClickUrl(onClick, targetingMsgJson, contentDiv, 'intentPreview', legacy) } if (!document.body) {