"use strict"; window.etag = window.etag || {}; (function (__) { const _ = {}; _.update = () => { Object.entries(_.modules) .forEach((module) => { const [moduleName, moduleObject] = module; moduleObject.update?.(); }); }; _.init = () => { _.modules = {}; _.config = { uuid: "A652EFA4-9D50-412E-878D-3F528A73886A", modules: {"core":(data, root) => { const _ = root; const moduleName = "core"; const api = () => { const sessionName = _.utils.sessionName(); const headers = { Accept: "application/json", "Content-Type": "application/json;charset=UTF-8", }; const get = (url, endpoint, data) => { const _session = _.utils.cookies.get(sessionName); const sendData = { location: _.utils.currentURL(), uuid: _session.uuid, session: _session.sessionId, ...data }; const params = new URLSearchParams(sendData).toString(); const options = { method: "GET", headers: headers, }; return fetch(url + endpoint + (params ? "?" : "") + params, options) .then((response) => response); }; const post = (url, endpoint, data) => { const _session = _.utils.cookies.get(sessionName); data["location"] = _.utils.currentURL(); data["uuid"] = _session.uuid; data["session"] = _session.sessionId; data["device"] = _.utils.getDevice(); data["isMobile"] = _.utils.isMobile(); const options = { method: "POST", headers: headers, body: JSON.stringify(data), }; return fetch(url + endpoint, options).then((response) => response); }; return { get: get, post: post, track: { url: (url, data = {}) => { const _session = _.utils.cookies.get(sessionName); data["location"] = _.utils.currentURL(); data["uuid"] = _session.uuid; data["session"] = _session.sessionId; data["url"] = url; return _.config.urls.trackingService + "/link?rd=" + encodeURIComponent(btoa(JSON.stringify(data))); }, interaction: (target, trigger, action, data = {}) => { data["target"] = target; data["trigger"] = trigger; data["action"] = action; _.api.post(_.api.urlTrackingService, "/interaction", data); } }, report: { ping: async () => { const _session = _.utils.cookies.get(sessionName); const result = await _.api.post(_.api.urlReportService, `/ping/${_session.uuid}`, {}); return !!result.uuid; }, }, urlApiCapture: _.config.urls.apiCapture, urlCaptureService: _.config.urls.captureService, urlTrackingService: _.config.urls.trackingService, urlReportService: _.config.urls.reportService, sessionName: sessionName }; }; const utils = { uuid: () => { return _.config.uuid; }, sessionName: () => { return "_etg_" + _.config.uuid.split("-")[0]; }, debug: (msg, ...arg) => { _.config.debugMode && console.log("[ETAG] " + msg, ...arg); }, ping: () => { const session = _.utils.session(_.utils.sessionName()); const lastPing = session.get("lastPing") || 0; const ttl = 1000 * 60 * 60; const send = Date.now() - lastPing > ttl; utils.debug(`%c## Ping ${send}`, "color:#fecc30"); if (send) { session.set("lastPing", Date.now()); _.api.report.ping(); } }, currentURL: (removeParam = true) => { return removeParam ? window.location.href.split("?")[0] ?? window.location.href : window.location.href; }, isMobile: () => { return ((agent) => { return (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(agent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(agent.substring(0, 4))); })(navigator.userAgent || navigator.vendor || window.opera); }, getMobileOS: () => { const isIOS = /iPhone|iPad|iPod/i.test(navigator.userAgent); const isAndroid = /Android/i.test(navigator.userAgent); if (isIOS) return "IOS"; if (isAndroid) return "Android"; return "Other Mobile OS"; }, getDevice: () => { if (utils.isMobile()) return utils.getMobileOS(); return "Desktop"; }, uuidv4: () => { return `${1e7}-${1e3}-${4e3}-${8e3}-${1e11}`.replace(/[018]/g, (c) => { const b = c; return (b ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (b / 4)))).toString(16); }); }, delay: (ms) => { return new Promise(resolve => setTimeout(resolve, ms)); }, isEmailValid: (email) => { return /^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$/.test(email); }, normalizeEmail: (email) => { return email.trim().toLowerCase(); }, isEmpty: (value) => { return value == null || !(Object.keys(value) || value.trim()).length; }, session: (sessionName) => { return { set: function (key, value) { const session = this.get(); session[key] = value; localStorage.setItem(sessionName, JSON.stringify(session)); }, get: function (key) { let initValues = {}; if (localStorage.getItem(sessionName)) initValues = JSON.parse(localStorage.getItem(sessionName)); else localStorage.setItem(sessionName, JSON.stringify(initValues)); return key ? initValues[key] : initValues; }, delete: function (key) { const session = this.get(); delete session[key]; localStorage.setItem(sessionName, JSON.stringify(session)); }, }; }, filterValidProducts: (objects, qtdItens = 10) => { const requiredAttributes = ["image", "url", "description", "price", "name"]; return objects.filter((obj) => requiredAttributes.every((attr) => Object.keys(obj).some((key) => key.toLowerCase() === attr.toLowerCase()) && typeof obj[attr] !== "undefined" && obj[attr] !== null && String(obj[attr]).trim() !== "")).slice(0, qtdItens); }, cookies: { set: (name, value, days) => { const date = new Date(); date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); const expires = "; expires=" + date.toUTCString(); document.cookie = name + "=" + (btoa(JSON.stringify(value)) || "") + (days ? expires : "") + "; path=/; SameSite=None; Secure; domain=" + _.utils.getRootDomain(window.location.href); }, get: (name) => { const pattern = new RegExp(name + "=([^;]+)"); const match = pattern.exec(document.cookie); if (match) return JSON.parse(atob(match[1])); const initValues = { uuid: _.config.uuid, sessionId: _.utils.uuidv4(), }; _.utils.cookies.set(name, initValues, 365); return initValues; }, delete: (name) => { document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC;" + "path=/; Max-Age=-9999; domain=" + _.utils.getRootDomain(window.location.href); } }, getElements: (selector) => { if (!selector || selector.trim() == "") return null; if (selector.indexOf("evaluate:") == 0) { const xpathExpression = selector.substring(9); const result = document.evaluate(xpathExpression, document, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null); let element; const elements = []; while ((element = result.iterateNext())) elements.push(element); return elements; } else if (selector.indexOf("shadow:") == 0) { const partials = selector.substring(7).split("::shadow"); if (!partials.length) return null; let elems = Array.from(document.querySelectorAll(partials[0])); for (let i = 1; partials.length > i; i++) { const partial = partials[i]; let elemsInside = []; for (let j = 0; elems.length > j; j++) { const shadow = elems[j].shadowRoot; if (shadow) { const matchesInShadow = shadow.querySelectorAll(partial); elemsInside = elemsInside.concat([...matchesInShadow]); } } elems = elemsInside; } return elems; } else return Array.from(document.querySelectorAll(selector)); }, getURLParameter: (parameterName) => { const params = new URLSearchParams(window.location.search); return params.get(parameterName); }, isCampaignOnDate: (startDateString, endDateString) => { const today = Date.now(); const startDate = startDateString ? new Date(startDateString).getTime() : Date.now(); const endDate = endDateString ? new Date(endDateString).getTime() : Date.now(); return today >= startDate && endDate >= today; }, isRequiredElementOnPage: (selector) => { const element = document.querySelector(selector); return element; }, applyCampaign: (item, type) => { const isCampaignOnDate = _.utils.isCampaignOnDate(item["startDate"], item["endDate"]); const apply = (!item["includeIfUrlRegex"] || _.utils.matchPageURL(item["includeIfUrlRegex"])) && ((item["active"] && isCampaignOnDate) || (item["preview"] && _.utils.getURLParameter("preview") == type && _.utils.getURLParameter("id") == item["id"])); const isRequiredElementOnPage = !item["includeIfHtmlSelector"] || _.utils.isRequiredElementOnPage(item["includeIfHtmlSelector"]); return !!(apply && isRequiredElementOnPage); }, addUtmToLinks: (content, utm) => { const contentLinks = content.querySelectorAll("a"); contentLinks.forEach((link) => { link.href = _.utils.formatLink(link.href, utm); }); }, addPixelToLinks: (content, pixel) => { const contentLinks = content.querySelectorAll("a"); contentLinks.forEach((link) => { link.href = pixel + link.href; }); }, addTrackToLinks: (content, data = {}) => { const contentLinks = content.querySelectorAll("a"); contentLinks.forEach((link) => { link.href = _.api.track.url(link.href, data); }); }, matchPageURL: (includeUrl) => { const regexp = new RegExp(includeUrl); const pageUrl = window.location.href; return regexp.test(pageUrl); }, formatLink: (link, utm = "") => { return link + (utm ? (link.indexOf("?") == -1 ? "?" : "&") + utm : ""); }, getRootDomain: (urlBase) => { const url = new URL(urlBase); const domain = url.hostname; const elems = domain.split("."); const iMax = elems.length - 1; const elem1 = elems[iMax - 1]; const elem2 = elems[iMax]; const isSecondLevelDomain = iMax >= 2 && 5 >= (elem1 + elem2).length; return ((isSecondLevelDomain ? elems[iMax - 2] + "." : "") + (elem1 ? elem1 + "." : "") + elem2); }, fetchURL: async (url, successCallback, failCallback) => { try { const response = await fetch(url); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const json = await response.json(); successCallback(json); } catch (error) { failCallback(error); } }, }; const init = async () => { _.config.debugMode && console.log("%c" + " _____ __ ______ \n" + " / ___/____ ___ ____ _____/ //_ __/___ ____ \n" + " \\__ \\/ __ `__ \\/ __ `/ ___/ __// / / __ `/ __ `/\n" + " ___/ / / / / / / /_/ / / / /_ / / / /_/ / /_/ / \n" + "/____/_/ /_/ /_/\\__,_/_/ \\__//_/ \\__,_/\\__, / \n" + " /____/ \n" + " By EtagDigital \n" + "\n", "color:#fecc30"); _.utils = utils; _.api = api(); utils.debug("%c" + "###### Initializing module " + moduleName, "color:#fecc30"); utils.ping(); if (data[0].isSPA) { let oldHref = document.location.href; const body = document.querySelector("body"); const observer = new MutationObserver(() => { if (oldHref !== document.location.href) { oldHref = document.location.href; window.etag && window.etag.update(); } }); observer.observe(body, { childList: true, subtree: true }); } }; init(); return { name: moduleName, };},"tag-capture":(data, root) => { const _ = root; const moduleName = "tag-capture"; const debug = (value, ...args) => { _.utils.debug(`%c[${moduleName}] ` + value, "color:#77dd77; padding-top:10px", ...args); }; const captureTypeMap = { LEAD: "lead", CART: "cart", CONVERSION: "conversion", PRODUCT: "product", REGISTER: "register" }; const eventMap = { LOAD: "load", CHANGE: "change", LOAD_CHANGE: "load-change", CLICK: "click" }; const htmlAttributeMap = { VALUE: { value: "value", type: "prop" }, SRC: { value: "src", type: "attr" }, HREF: { value: "href", type: "attr" }, BACKGROUND_IMAGE: { value: "background-image", type: "style" }, INNER_HTML: { value: "innerHTML", type: "prop" }, INNER_TEXT: { value: "innerText", type: "prop" }, META_CONTENT: { value: "content", type: "meta" }, URL: { value: "url", type: "script" }, NONE: { value: "none", type: "none" }, }; const Capture = () => { const itens = []; const add = (item) => { const captureItem = CaptureItem(item); if (captureItem) itens.push(captureItem); }; const capture = () => { for (const item of itens) item.capture(); }; const deactivate = () => { for (const item of itens) item.deactivate(); }; const CaptureItem = (item) => { const captureTypeValid = Object.keys(captureTypeMap).indexOf(item["type"]) > -1; if (!captureTypeValid) return null; const type = captureTypeMap[item["type"]]; const id = item["id"]; let captureOnLoad = true; let lastCaptureInfo = null; let checkinterval; let fields = {}; const itemData = { id: id, type: type, fields: fields }; const dataCapture = () => { const capturedData = { captureId: item.id, info: {} }; let hasCapturedAny = false; for (const [field, value] of Object.entries(fields)) { if (Array.isArray(value)) { const qtyObjects = value[0].elements ? value[0].elements.length : 1; const group = capturedData.info[field] = []; for (let index = qtyObjects - 1; index >= 0; index--) { const groupObject = {}; for (const groupField of value) { const currentValue = groupField.value(index); const value = type == captureTypeMap.LEAD ? (_.utils.isEmailValid(currentValue) ? _.utils.normalizeEmail(currentValue) : "") : currentValue; groupObject[groupField.name] = value.trim(); hasCapturedAny = hasCapturedAny || !_.utils.isEmpty(groupObject[groupField.name]); } group.push(groupObject); } } else { const currentValue = value.value(); capturedData.info[field] = type == captureTypeMap.LEAD ? (_.utils.isEmailValid(currentValue) ? _.utils.normalizeEmail(currentValue) : "") : currentValue; hasCapturedAny = hasCapturedAny || !_.utils.isEmpty(capturedData.info[field]); } } return [hasCapturedAny, capturedData]; }; const checkCapture = () => { const [hasCapturedAny, capturedData] = dataCapture(); if (hasCapturedAny && JSON.stringify(lastCaptureInfo) != JSON.stringify(capturedData.info)) { doDeactivate(); init(); } }; const doCapture = () => { const [hasCapturedAny, capturedData] = dataCapture(); lastCaptureInfo = capturedData.info; debug("###### Captured", hasCapturedAny, capturedData); if (!hasCapturedAny) return null; _.api.post(_.api.urlCaptureService, "/capture/" + type, capturedData); if (type == captureTypeMap.CONVERSION) { _.utils.cookies.delete(_.utils.sessionName()); _.utils.session(_.utils.sessionName()).delete(); } return capturedData; }; const doDeactivate = () => { for (const [field, value] of Object.entries(fields)) if (Array.isArray(value)) { const qtyObjects = value[0].elements ? value[0].elements.length : 1; for (let index = qtyObjects - 1; index >= 0; index--) for (const groupField of value) groupField.deactivate(); } else value.deactivate(); clearInterval(checkinterval); }; const init = () => { fields = {}; for (const field of item["fields"]) { const validEvent = Object.keys(eventMap).indexOf(field["triggerEvent"]) > -1; captureOnLoad = captureOnLoad && validEvent; const capturedField = CaptureField(field, doCapture); if (capturedField.isElement && capturedField.elements.length == 0) { debug(`Field not found: ${capturedField.name}`); } else { if (field.group) { const group = fields[field.group] = fields[field.group] || []; group.push(capturedField); } else { fields[field["name"]] = capturedField; } } } if (captureOnLoad) doCapture(); if (type == "cart") checkinterval = setInterval(checkCapture, 2000); debug(`###### Capturing on${captureOnLoad ? "Load" : "Change"}`, item); }; init(); return { ...itemData, capture: doCapture, deactivate: doDeactivate }; }; const CaptureField = (field, captureFunction) => { const htmlAttributeObj = htmlAttributeMap[field["htmlAttribute"]]; const attribute = htmlAttributeObj.value; const attributeType = htmlAttributeObj.type; const isElement = attributeType != "script"; const elements = isElement ? _.utils.getElements(field["selector"]) : null; const value = (index = 0) => { if (attribute && isElement && elements.length > 0) { const element = elements[index]; if (!element || attribute == "none") return null; else if (attributeType == "attr") if (attribute === "src") return element[attribute]; else if (attribute === "href") return element[attribute]; else return element.getAttribute(attribute); else if (attributeType == "prop") { if (attribute === "innerHTML" || attribute === "innerText") return element[attribute] || null; else if (attribute === "value") return element[attribute] || null; } else if (attribute == "url") return _.utils.currentURL(); else if (attribute == "background-image") { const style = window.getComputedStyle(element, null); const url = style.backgroundImage.match(/"+(.+)"+/); return url ? url[1] : null; } else if (attribute == "content") return element.getAttribute(attribute) || null; } else { if (attribute == "url") return _.utils.currentURL(); } return null; }; let event = eventMap[field["triggerEvent"]]; event = event == eventMap.LOAD_CHANGE ? eventMap.CHANGE : event; if (isElement && event !== "load") { for (const element of elements) element.addEventListener(event, captureFunction); } const deactivate = () => { if (!isElement) return; for (const element of elements) element.removeEventListener(event, captureFunction); }; return { name: field["name"], type: attributeType, isElement: isElement, elements: elements, value: value, deactivate: deactivate }; }; return { add: add, capture: capture, deactivate: deactivate }; }; const capture = Capture(); const init = async (reset = false) => { debug(`${reset ? "Update" : "Initialize"} module`); for (const item of data) { const name = item["name"]; let event = eventMap[item["triggerEvent"]]; debug(`${reset ? "Update" : "Initialize"} item ${name} on ${event}`, item); event = event == eventMap.LOAD_CHANGE ? eventMap.CHANGE : event; if (event != eventMap.LOAD) { const delay = item.delay || 0; await _.utils.delay(delay); const apply = !item["includeIfUrlRegex"] || _.utils.matchPageURL(item["includeIfUrlRegex"]); const el = _.utils.getElements(item["selector"])[0]; if (!apply || !el) continue; el.dataset.item = JSON.stringify(item); el.dataset.reset = JSON.stringify(reset); el.addEventListener(event, initializer); } else initCapture(item, reset); } }; const initializer = (evt) => { const target = evt.currentTarget; const item = JSON.parse(target.dataset.item); const reset = JSON.parse(target.dataset.reset); initCapture(item, reset); }; const initCapture = async (item, reset = false) => { const name = item["name"]; const delay = item.delay || 0; debug(`${reset ? "Update" : "Initialize"} item ${name} in ${delay}ms`, item); await _.utils.delay(delay); const apply = !item["includeIfUrlRegex"] || _.utils.matchPageURL(item["includeIfUrlRegex"]); debug(`#### Capture ${name}`, apply); if (apply) capture.add(item); }; const update = () => { capture.deactivate(); for (const item of data) { let event = eventMap[item["triggerEvent"]]; event = event == eventMap.LOAD_CHANGE ? eventMap.CHANGE : event; if (event != eventMap.LOAD) { const el = _.utils.getElements(item["selector"])[0]; if (el) el.removeEventListener(event, initializer); } } init(true); }; init(); return { name: moduleName, update: update };},}, modulesData: JSON.parse("{\"core\":[{\"debug\":false,\"isSPA\":true,\"status\":\"ACTIVE\"}],\"tag-capture\":[{\"id\":86,\"name\":\"Email Login\",\"delay\":15000,\"includeIfUrlRegex\":\".+.com.br\\\\/checkout\",\"type\":\"LEAD\",\"triggerEvent\":\"LOAD\",\"selector\":null,\"systemCapture\":false,\"passiveCapture\":true,\"clientId\":36,\"createdAt\":\"2024-04-10T13:55:11.557Z\",\"updatedAt\":\"2024-05-29T18:33:22.215Z\",\"fields\":[{\"id\":236,\"name\":\"lead\",\"group\":\"\",\"selector\":\".container-checkout .email\",\"captureId\":86,\"htmlAttribute\":\"VALUE\",\"triggerEvent\":\"CHANGE\",\"createdAt\":\"2024-04-10T13:55:11.557Z\",\"updatedAt\":\"2024-04-10T13:55:11.557Z\"}]},{\"id\":87,\"name\":\"Conversão\",\"delay\":1000,\"includeIfUrlRegex\":\".+.com.br\\\\/confirmation\",\"type\":\"CONVERSION\",\"triggerEvent\":\"LOAD\",\"selector\":null,\"systemCapture\":false,\"passiveCapture\":true,\"clientId\":36,\"createdAt\":\"2024-04-10T14:40:09.258Z\",\"updatedAt\":\"2024-06-24T15:31:07.466Z\",\"fields\":[{\"id\":238,\"name\":\"OrderNumber\",\"group\":\"\",\"selector\":\".checkout-container-inner.checkout-orderplaced h3\",\"captureId\":87,\"htmlAttribute\":\"INNER_TEXT\",\"triggerEvent\":\"LOAD\",\"createdAt\":\"2024-04-10T14:40:09.258Z\",\"updatedAt\":\"2024-04-10T14:40:09.258Z\"}]},{\"id\":85,\"name\":\"Carrinho\",\"delay\":6000,\"includeIfUrlRegex\":\".+.com.br\\\\/checkout\",\"type\":\"CART\",\"triggerEvent\":\"LOAD\",\"selector\":null,\"systemCapture\":false,\"passiveCapture\":true,\"clientId\":36,\"createdAt\":\"2024-04-10T13:30:56.476Z\",\"updatedAt\":\"2024-05-29T19:03:00.969Z\",\"fields\":[{\"id\":230,\"name\":\"Image\",\"group\":\"cart\",\"selector\":\".cart-item-list .product-image img\",\"captureId\":85,\"htmlAttribute\":\"SRC\",\"triggerEvent\":\"LOAD\",\"createdAt\":\"2024-04-10T13:30:56.476Z\",\"updatedAt\":\"2024-04-10T13:30:56.476Z\"},{\"id\":231,\"name\":\"Name\",\"group\":\"cart\",\"selector\":\".cart-item-list .product-name\",\"captureId\":85,\"htmlAttribute\":\"INNER_TEXT\",\"triggerEvent\":\"LOAD\",\"createdAt\":\"2024-04-10T13:30:56.476Z\",\"updatedAt\":\"2024-04-10T13:30:56.476Z\"},{\"id\":232,\"name\":\"URL\",\"group\":\"cart\",\"selector\":\".cart-item-list .product-image a\",\"captureId\":85,\"htmlAttribute\":\"HREF\",\"triggerEvent\":\"LOAD\",\"createdAt\":\"2024-04-10T13:30:56.476Z\",\"updatedAt\":\"2024-04-10T13:30:56.476Z\"},{\"id\":234,\"name\":\"UnitPrice\",\"group\":\"cart\",\"selector\":\".cart-item-list .product-price span\",\"captureId\":85,\"htmlAttribute\":\"INNER_TEXT\",\"triggerEvent\":\"LOAD\",\"createdAt\":\"2024-04-10T13:30:56.476Z\",\"updatedAt\":\"2024-04-10T13:30:56.476Z\"},{\"id\":235,\"name\":\"TotalBasket\",\"group\":\"\",\"selector\":\".minicart-price-box .price-value span\",\"captureId\":85,\"htmlAttribute\":\"INNER_TEXT\",\"triggerEvent\":\"LOAD\",\"createdAt\":\"2024-04-10T13:30:56.476Z\",\"updatedAt\":\"2024-04-10T13:30:56.476Z\"},{\"id\":233,\"name\":\"Quantity\",\"group\":\"cart\",\"selector\":\".cart-item-list .product-qty span\",\"captureId\":85,\"htmlAttribute\":\"INNER_TEXT\",\"triggerEvent\":\"LOAD\",\"createdAt\":\"2024-04-10T13:30:56.476Z\",\"updatedAt\":\"2024-04-10T13:58:48.076Z\"}]},{\"id\":234,\"name\":\"Email Cadastro\",\"delay\":4000,\"includeIfUrlRegex\":\".+.com.br\\\\/checkout\",\"type\":\"LEAD\",\"triggerEvent\":\"CLICK\",\"selector\":\".container-checkout > .checkout-container-inner.checkout-login > h3 > a\",\"systemCapture\":false,\"passiveCapture\":true,\"clientId\":36,\"createdAt\":\"2024-05-22T15:17:12.610Z\",\"updatedAt\":\"2024-05-29T18:36:17.586Z\",\"fields\":[{\"id\":605,\"name\":\"lead\",\"group\":\"\",\"selector\":\".container-checkout .identification-form #email\",\"captureId\":234,\"htmlAttribute\":\"VALUE\",\"triggerEvent\":\"CHANGE\",\"createdAt\":\"2024-05-22T15:17:12.610Z\",\"updatedAt\":\"2024-05-22T15:17:12.610Z\"}]}]}"), debugMode: true, allowedSites: [".*"], urls: { modules: "/dist/modules/", ...JSON.parse("{\"apicapture\":\"https://api.etagdigital.com\",\"captureService\":\"https://capture.etagdigital.com\",\"trackingService\":\"https://tracking.etagdigital.com\",\"reportService\":\"https://report.etagdigital.com\"}") }, }; const modulesData = _.config.modulesData; _.config.debugMode = modulesData.core[0].debug || false; _.config.modulesData = { ...modulesData, ...(modulesData["tag-wid"] && { "tag-wid": modulesData["tag-wid"]?.map((tw) => { const twd = tw; return { ...tw, content: decodeURI(twd.content), customCss: decodeURI(twd.customCss), customJs: decodeURI(twd.customJs), }; }) }), ...(modulesData["tag-assist"] && { "tag-assist": modulesData["tag-assist"]?.map((ta) => { const tad = ta; return { ...ta, contentPromoContent: decodeURI(tad.contentPromoContent), customCss: decodeURI(tad.customCss), customJs: decodeURI(tad.customJs), }; }) }), ...(modulesData["tag-assist-remind"] && { "tag-assist-remind": modulesData["tag-assist-remind"]?.map((tar) => { const tard = tar; return { ...tar, contentContent: decodeURI(tard.content), contentContentSuccess: decodeURI(tard.contentSuccess), contentContentFail: decodeURI(tard.contentFail), customCss: decodeURI(tard.customCss), customJs: decodeURI(tard.customJs), }; }) }), }; Object.entries(_.config.modules) .forEach((module) => { const [moduleName, moduleFunction] = module; _.modules[moduleName] = moduleFunction(modulesData[moduleName], _); }); window.etag = __ = { get debug() { return _.config.debugMode; }, set debug(value) { _.config.debugMode = value; if (value) { __.utils = _.utils; __.modules = _.modules; } else { delete __.utils; delete __.modules; } }, update: _.update }; __.debug = _.config.debugMode; }; __.update || _.init(); }).call(this, window.etag);