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I,uBAAuBC,MAG5BpG,OAAOb,QAAQkB,GAAG,QAAQ,WAGzB,IAAKnC,IAAIY,UAAU,eAElB,GAAImB,SAAS2M,SAAU,CACtB,IACIwF,EADmB,IAAIf,IAAIpR,SAAS2M,UACLyF,SAE/BD,IAAqBjT,OAAOgB,SAASgD,KACxCjF,IAAI8M,UAAU,cAAeoH,GAE7BlU,IAAI8M,UAAU,cAAe,SAI9B9M,IAAI8M,UAAU,cAAe,SC7tD5BsH,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBpU,IAAjBqU,EACH,OAAOA,EAAaC,QAGrB,IAAIC,EAASL,EAAyBE,GAAY,CAGjDE,QAAS,IAOV,OAHAE,EAAoBJ,GAAUG,EAAQA,EAAOD,QAASH,GAG/CI,EAAOD,QCpBfH,EAAoBM,EAAKF,IACxB,IAAIG,EAASH,GAAUA,EAAOI,WAC7B,IAAOJ,EAAiB,QACxB,IAAM,EAEP,OADAJ,EAAoBpH,EAAE2H,EAAQ,CAAEE,EAAGF,IAC5BA,GCLRP,EAAoBpH,EAAI,CAACuH,EAASO,KACjC,IAAI,IAAIhR,KAAOgR,EACXV,EAAoBW,EAAED,EAAYhR,KAASsQ,EAAoBW,EAAER,EAASzQ,IAC5EC,OAAOiR,eAAeT,EAASzQ,EAAK,CAAEmR,YAAY,EAAMnL,IAAKgL,EAAWhR,MCJ3EsQ,EAAoBW,EAAI,CAACG,EAAKC,IAAUpR,OAAOqR,UAAUhN,eAAeiN,KAAKH,EAAKC,G","sources":["webpack://wgact/./src/js/public/facebook.jsx","webpack://wgact/./src/js/public/google-ads.jsx","webpack://wgact/./src/js/public/wpm.jsx","webpack://wgact/webpack/bootstrap","webpack://wgact/webpack/runtime/compat get default export","webpack://wgact/webpack/runtime/define property getters","webpack://wgact/webpack/runtime/hasOwnProperty shorthand"],"sourcesContent":["(function (wpm, $, undefined) {\n\n\tlet fBUserData;\n\n\twpm.getRandomEventId = function () {\n\t\treturn (Math.random() + 1).toString(36).substring(2);\n\t}\n\n\twpm.getFbUserData = function () {\n\t\t// We need the first one for InitiateCheckout\n\t\t// where getting the user_data from the browser is too slow\n\t\t// using wpm.getCookie(), so we cache the user_data earlier.\n\t\t// And we need the second one because the ViewContent hit happens too fast\n\t\t// after adding a variation to the cart because the function to cache\n\t\t// the user_data is too slow. But we can get the user_data using wpm.getCookie()\n\t\t// because we don't move away from the page and can wait for the browser\n\t\t// to get it.\n\t\tif (fBUserData) {\n\t\t\treturn fBUserData;\n\t\t} else {\n\t\t\treturn wpm.getFbUserDataFromBrowser();\n\t\t}\n\t}\n\n\twpm.setFbUserData = function () {\n\t\tfBUserData = wpm.getFbUserDataFromBrowser();\n\t}\n\n\twpm.getFbUserDataFromBrowser = function () {\n\t\treturn {\n\t\t\t\"fbp\" : wpm.getCookie('_fbp'),\n\t\t\t\"fbc\" : wpm.getCookie('_fbc'),\n\t\t\t\"client_user_agent\": navigator.userAgent\n\t\t}\n\t}\n\n\twpm.fbViewContent = function (product) {\n\n\t\tif (!window.fbq) return;\n\n\t\tlet eventId = wpm.getRandomEventId();\n\n\t\tfbq(\"track\", \"ViewContent\", {\n\t\t\t\"content_type\": \"product\",\n\t\t\t\"content_name\": product.name,\n\t\t\t// \"content_category\": product.category,\n\t\t\t\"content_ids\": product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\"currency\" : wpmDataLayer.shop.currency,\n\t\t\t\"value\" : product.price,\n\t\t}, {\n\t\t\t\"eventID\": eventId,\n\t\t});\n\n\t\tproduct['currency'] = wpmDataLayer.shop.currency;\n\n\t\tjQuery(document).trigger('wpmFbCapiEvent', {\n\t\t\t\"event_name\" : \"ViewContent\",\n\t\t\t\"event_id\" : eventId,\n\t\t\t\"user_data\" : wpm.getFbUserData(),\n\t\t\t\"product_data\" : product,\n\t\t\t\"product_id\" : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\"event_source_url\": window.location.href\n\t\t});\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\njQuery(function () {\n\n\tif (wpmDataLayer?.pixels?.facebook) {\n\n\t\t// AddToCart event\n\t\tjQuery(document).on('wpmAddToCart', function (event, product) {\n\n\t\t\t// console.log('firing facebook ads AddToCart event');\n\t\t\t// console.log(product);\n\t\t\t// console.log('value: ' + product.quantity * product.price);\n\n\t\t\tif (!window.fbq) return;\n\n\t\t\tlet eventId = wpm.getRandomEventId();\n\n\t\t\t// console.log('eventId: ' + eventId);\n\n\t\t\tfbq(\"track\", \"AddToCart\", {\n\t\t\t\t\"content_type\": \"product\",\n\t\t\t\t\"content_name\": product.name,\n\t\t\t\t\"content_ids\" : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\t\"value\" : parseFloat(product.quantity * product.price),\n\t\t\t\t\"currency\" : product.currency,\n\t\t\t}, {\n\t\t\t\t\"eventID\": eventId,\n\t\t\t});\n\n\t\t\tproduct['currency'] = wpmDataLayer.shop.currency;\n\n\t\t\tjQuery(document).trigger('wpmFbCapiEvent', {\n\t\t\t\t\"event_name\" : \"AddToCart\",\n\t\t\t\t\"event_id\" : eventId,\n\t\t\t\t\"user_data\" : wpm.getFbUserData(),\n\t\t\t\t\"product_data\" : product,\n\t\t\t\t\"product_id\" : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\t\"event_source_url\": window.location.href\n\t\t\t});\n\t\t});\n\n\t\t// InitiateCheckout event\n\t\tjQuery(document).on('wpmBeginCheckout', function (event) {\n\n\t\t\t// console.log('firing facebook ads InitiateCheckout event');\n\n\t\t\tif (!window.fbq) return;\n\n\t\t\tlet eventId = wpm.getRandomEventId();\n\n\t\t\tfbq(\"track\", \"InitiateCheckout\", {}, {\n\t\t\t\t\"eventID\": eventId,\n\t\t\t});\n\n\n\t\t\tjQuery(document).trigger('wpmFbCapiEvent', {\n\t\t\t\t\"event_name\" : \"InitiateCheckout\",\n\t\t\t\t\"event_id\" : eventId,\n\t\t\t\t\"user_data\" : wpm.getFbUserData(),\n\t\t\t\t\"event_source_url\": window.location.href\n\t\t\t});\n\t\t});\n\n\t\t// AddToWishlist event\n\t\tjQuery(document).on('wpmAddToWishlist', function (event, product) {\n\n\t\t\t// console.log('firing facebook ads AddToWishlist event');\n\t\t\t// console.log(product);\n\n\t\t\tif (!window.fbq) return;\n\n\t\t\tlet eventId = wpm.getRandomEventId();\n\n\t\t\tfbq(\"track\", \"AddToWishlist\", {\n\t\t\t\t\"content_type\": \"product\",\n\t\t\t\t\"content_name\": product.name,\n\t\t\t\t\"content_ids\" : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\t\"value\" : parseFloat(product.quantity * product.price),\n\t\t\t\t\"currency\" : product.currency,\n\t\t\t}, {\n\t\t\t\t\"eventID\": eventId,\n\t\t\t});\n\n\t\t\tproduct['currency'] = wpmDataLayer.shop.currency;\n\n\t\t\tjQuery(document).trigger('wpmFbCapiEvent', {\n\t\t\t\t\"event_name\" : \"AddToWishlist\",\n\t\t\t\t\"event_id\" : eventId,\n\t\t\t\t\"user_data\" : wpm.getFbUserData(),\n\t\t\t\t\"product_data\" : product,\n\t\t\t\t\"product_id\" : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\t\"event_source_url\": window.location.href\n\t\t\t});\n\t\t});\n\n\t\t// ViewContent event\n\t\tjQuery(document).on('wpmViewItem', function (event, product) {\n\n\t\t\t// console.log('firing facebook ads ViewContent event');\n\t\t\t// console.log(product);\n\n\t\t\tif (!window.fbq) return;\n\n\t\t\twpm.fbViewContent(product);\n\t\t});\n\t}\n})\n\njQuery(window).on('load', function () {\n\n\tif (wpmDataLayer?.pixels?.facebook) {\n\n\t\twpm.setFbUserData();\n\n\t\twpmExists().then(function () {\n\n\t\t\ttry {\n\t\t\t\tif (wpmDataLayer.shop.page_type === 'product' && wpmDataLayer.shop.product_type !== 'variable' && wpm.getMainProductIdFromProductPage()) {\n\n\t\t\t\t\tlet product = wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage());\n\n\t\t\t\t\t// console.log('fbq ViewContent');\n\t\t\t\t\t// console.log(product);\n\n\t\t\t\t\twpm.fbViewContent(product);\n\n\t\t\t\t} else if (wpmDataLayer.shop.page_type === 'search') {\n\n\t\t\t\t\tif (!window.fbq) return;\n\n\t\t\t\t\tlet eventId = wpm.getRandomEventId();\n\n\t\t\t\t\tfbq(\"track\", \"Search\", {}, {\n\t\t\t\t\t\t\"eventID\": eventId,\n\t\t\t\t\t});\n\n\t\t\t\t\tjQuery(document).trigger('wpmFbCapiEvent', {\n\t\t\t\t\t\t\"event_name\" : \"Search\",\n\t\t\t\t\t\t\"event_id\" : eventId,\n\t\t\t\t\t\t\"user_data\" : wpm.getFbUserData(),\n\t\t\t\t\t\t\"event_source_url\": window.location.href\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tconsole.log(e);\n\t\t\t}\n\t\t})\n\t}\n})\n","jQuery(function () {\n\n\tif (wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) {\n\n\t\t// view_item_list event\n\t\tjQuery(document).on('wpmViewItemList', function (event, product) {\n\n\t\t\tif (\n\t\t\t\twpmDataLayer.general.variationsOutput &&\n\t\t\t\tproduct.isVariable &&\n\t\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t\t) return;\n\n\t\t\t// try to prevent that WC sends cached hits to Google\n\t\t\tif (!product) return;\n\n\t\t\t// console.log('firing google view_item_list event');\n\t\t\t// console.log(product);\n\n\t\t\t// console.log('send to: ' + wpmDataLayer.pixels.google.ads.conversionIds);\n\n\t\t\tif (googleConfigConditionsMet('ads')) gtag('event', 'view_item_list', {\n\t\t\t\tsend_to: wpmDataLayer.pixels.google.ads.conversionIds,\n\t\t\t\titems : [{\n\t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t\t}]\n\t\t\t});\n\t\t});\n\n\t\t// add_to_cart event\n\t\tjQuery(document).on('wpmAddToCart', function (event, product) {\n\n\t\t\t// console.log('firing google ads add_to_cart event');\n\t\t\t// console.log(product);\n\t\t\t// console.log(wpmDataLayer.pixels.google.ads.conversionIds);\n\t\t\t// console.log('dyn_r_id: ' + product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]);\n\t\t\t// console.log('dyn_r_id: ' + product.dyn_r_ids['gpf']);\n\n\t\t\tgtag(\"event\", \"add_to_cart\", {\n\t\t\t\t\"send_to\": wpmDataLayer.pixels.google.ads.conversionIds,\n\t\t\t\t\"value\" : product.quantity * product.price,\n\t\t\t\t\"items\" : [{\n\t\t\t\t\t\"id\" : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\t\t\"quantity\" : product.quantity,\n\t\t\t\t\t\"price\" : product.price,\n\t\t\t\t\t\"google_business_vertical\": wpmDataLayer.pixels.google.ads.google_business_vertical\n\t\t\t\t}]\n\t\t\t});\n\t\t});\n\n\t\t// view_item event\n\t\tjQuery(document).on('wpmViewItem', function (event, product) {\n\n\t\t\t// console.log('firing google ads view_item event');\n\t\t\t// console.log(product);\n\t\t\t// console.log(wpmDataLayer.pixels.google.ads.conversionIds);\n\t\t\t// console.log('dyn_r_id: ' + product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]);\n\t\t\t// console.log('dyn_r_id: ' + product.dyn_r_ids['gpf']);\n\n\t\t\tgtag(\"event\", \"view_item\", {\n\t\t\t\t\"send_to\": wpmDataLayer.pixels.google.ads.conversionIds,\n\t\t\t\t\"value\" : product.quantity * product.price,\n\t\t\t\t\"items\" : [{\n\t\t\t\t\t\"id\" : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\t\t\"quantity\" : 1,\n\t\t\t\t\t\"price\" : product.price,\n\t\t\t\t\t\"google_business_vertical\": wpmDataLayer.pixels.google.ads.google_business_vertical\n\t\t\t\t}]\n\t\t\t});\n\t\t});\n\t}\n})\n\njQuery(window).on('load', function () {\n\n\twpmExists().then(function () {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer.shop.page_type === 'product' && wpmDataLayer.shop.product_type !== 'variable' && wpm.getMainProductIdFromProductPage()) {\n\n\t\t\t\t// console.log('productId: ' + wpm.getMainProductIdFromProductPage());\n\n\t\t\t\tlet product = wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage());\n\n\t\t\t\tgtag(\"event\", \"view_item\", {\n\t\t\t\t\t\"send_to\": wpmDataLayer.pixels.google.ads.conversionIds,\n\t\t\t\t\t\"value\" : 1 * product.price,\n\t\t\t\t\t\"items\" : [{\n\t\t\t\t\t\t\"id\" : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\t\t\t\"google_business_vertical\": wpmDataLayer.pixels.google.ads.google_business_vertical\n\t\t\t\t\t}]\n\t\t\t\t});\n\t\t\t} else if (wpmDataLayer.shop.page_type === 'search') {\n\n\t\t\t\tlet products = [];\n\n\t\t\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\n\t\t\t\t\tif (\n\t\t\t\t\t\twpmDataLayer.general.variationsOutput &&\n\t\t\t\t\t\tproduct.isVariable &&\n\t\t\t\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t\t\t\t) return;\n\n\t\t\t\t\tproducts.push({\n\t\t\t\t\t\t\"id\" : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\t\t\t\"google_business_vertical\": wpmDataLayer.pixels.google.ads.google_business_vertical\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// console.log(products);\n\n\t\t\t\tgtag(\"event\", \"view_search_results\", {\n\t\t\t\t\t\"send_to\": wpmDataLayer.pixels.google.ads.conversionIds,\n\t\t\t\t\t// \"value\" : 1 * product.price,\n\t\t\t\t\t\"items\": products\n\t\t\t\t});\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\t\t}\n\t})\n})\n","// if (typeof varExists !== 'function') {\n// window.varExists = function (varName) {\n// return new Promise(function (resolve, reject) {\n// (function waitForVar() {\n// if (typeof window[varName] !== 'undefined') return resolve();\n// setTimeout(waitForVar, 30);\n// })();\n// });\n// }\n// }\n\n// Promise.allSettled(\n// [\n// varExists('jQuery'),\n// varExists('wpm')\n// ]).then(function () {\n// // do something\n//\n// }).catch(function (e) {\n// console.log(e);\n// })\n\n\n(function (wpm, $, undefined) {\n\n\tconst wpmDeduper = {\n\t\tkeyName : '_wpm_order_ids',\n\t\tcookieExpiresDays: 365\n\t};\n\n\tconst wpmRestSettings = {\n\t\t// cookiesAvailable : '_wpm_cookies_are_available',\n\t\tcookieWpmRestEndpointAvailable: '_wpm_endpoint_available',\n\t\trestEndpoint : '/wp-json/',\n\t\trestFails : 0,\n\t\trestFailsThreshold : 10,\n\t}\n\n\n\t// wpm.checkIfCookiesAvailable = function () {\n\t//\n\t// // read the cookie if previously set, if it is return true, otherwise continue\n\t// if (wpm.getCookie(wpmRestSettings.cookiesAvailable)) {\n\t// return true;\n\t// }\n\t//\n\t// // set the cookie for the session\n\t// Cookies.set(wpmRestSettings.cookiesAvailable, true);\n\t//\n\t// // read cookie, true if ok, false if not ok\n\t// return !!wpm.getCookie(wpmRestSettings.cookiesAvailable);\n\t// }\n\n\twpm.useRestEndpoint = function () {\n\n\t\t// only if sessionStorage is available\n\n\t\t// only if REST API endpoint is generally accessible\n\t\t// check in sessionStorage if we checked before and return answer\n\t\t// otherwise check if the endpoint is available, save answer in sessionStorage and return answer\n\n\t\t// only if not too many REST API errors happened\n\n\t\treturn wpm.isSessionStorageAvailable() &&\n\t\t\twpm.isRestEndpointAvailable() &&\n\t\t\twpm.isBelowRestErrorThreshold();\n\t}\n\n\twpm.isBelowRestErrorThreshold = function () {\n\t\treturn window.sessionStorage.getItem(wpmRestSettings.restFails) <= wpmRestSettings.restFailsThreshold;\n\t}\n\n\twpm.isRestEndpointAvailable = function () {\n\n\t\tif (window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable)) {\n\t\t\treturn JSON.parse(window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable));\n\t\t} else {\n\t\t\t// return wpm.testEndpoint();\n\t\t\t// just set the value whenever possible in order not to wait or block the main thread\n\t\t\twpm.testEndpoint();\n\t\t}\n\t}\n\n\twpm.isSessionStorageAvailable = function () {\n\n\t\treturn !!window.sessionStorage;\n\t}\n\n\twpm.testEndpoint = function (\n\t\turl = location.protocol + '//' + location.host + wpmRestSettings.restEndpoint,\n\t\tcookieName = wpmRestSettings.cookieWpmRestEndpointAvailable\n\t) {\n\t\t// console.log('testing endpoint');\n\n\t\tjQuery.ajax(url, {\n\t\t\ttype : 'HEAD',\n\t\t\ttimeout: 1000,\n\t\t\t// async: false,\n\t\t\tstatusCode: {\n\t\t\t\t200: function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, true);\n\t\t\t\t\t// console.log('endpoint works');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(true));\n\t\t\t\t},\n\t\t\t\t404: function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, false);\n\t\t\t\t\t// console.log('endpoint doesn\\'t work');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false));\n\t\t\t\t},\n\t\t\t\t0 : function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, false);\n\t\t\t\t\t// console.log('endpoint doesn\\'t work');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false));\n\t\t\t\t}\n\t\t\t}\n\t\t}).then(r => {\n\t\t\t// console.log('test done')\n\t\t\t// console.log('result: ' + JSON.parse(window.sessionStorage.getItem(cookieName)));\n\t\t\t// return JSON.parse(window.sessionStorage.getItem(cookieName));\n\t\t});\n\t}\n\n\twpm.isWpmRestEndpointAvailable = function (cookieName = wpmRestSettings.cookieWpmRestEndpointAvailable) {\n\n\t\treturn !!wpm.getCookie(cookieName);\n\t}\n\n\twpm.writeOrderIdToStorage = function (orderId, expireDays = 365) {\n\n\t\t// save the order ID in the browser storage\n\n\t\tif (!window.Storage) {\n\t\t\tlet expiresDate = new Date();\n\t\t\texpiresDate.setDate(expiresDate.getDate() + wpmDeduper.cookieExpiresDays);\n\n\t\t\tlet ids = [];\n\t\t\tif (checkCookie()) {\n\t\t\t\tids = JSON.parse(wpm.getCookie(wpmDeduper.keyName));\n\t\t\t}\n\n\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\tids.push(orderId);\n\t\t\t\tdocument.cookie = wpmDeduper.keyName + '=' + JSON.stringify(ids) + ';expires=' + expiresDate.toUTCString();\n\t\t\t}\n\n\t\t} else {\n\t\t\tif (localStorage.getItem(wpmDeduper.keyName) === null) {\n\t\t\t\tlet ids = [];\n\t\t\t\tids.push(orderId);\n\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids));\n\n\t\t\t} else {\n\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName));\n\t\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\t\tids.push(orderId);\n\t\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (typeof wpm.storeOrderIdOnServer === 'function' && wpmDataLayer.orderDeduplication) {\n\t\t\twpm.storeOrderIdOnServer(orderId);\n\t\t}\n\t}\n\n\tfunction checkCookie() {\n\t\tlet key = wpm.getCookie(wpmDeduper.keyName);\n\t\treturn key !== '';\n\t}\n\n\twpm.isOrderIdStored = function (orderId) {\n\n\t\t// console.log('deduper: ' + wpmDataLayer.orderDeduplication);\n\t\tif (wpmDataLayer.orderDeduplication) {\n\t\t\t// console.log('order deduplication: on');\n\t\t\tif (!window.Storage) {\n\n\t\t\t\tif (checkCookie()) {\n\t\t\t\t\tlet ids = JSON.parse(wpm.getCookie(wpmDeduper.keyName));\n\t\t\t\t\treturn ids.includes(orderId);\n\t\t\t\t} else {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (localStorage.getItem(wpmDeduper.keyName) !== null) {\n\t\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName));\n\t\t\t\t\treturn ids.includes(orderId);\n\t\t\t\t} else {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.log('order deduplication: off');\n\t\t\treturn false;\n\t\t}\n\t}\n\n\twpm.isEmail = function (email) {\n\t\t// https://emailregex.com/\n\t\tlet regex = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n\t\treturn regex.test(email);\n\t}\n\n\twpm.removeProductFromCart = function (productId, quantityToRemove = null) {\n\t\t// console.log('product_id: ' + productId + ' | quantityToRemove: ' + quantityToRemove);\n\n\t\ttry {\n\n\t\t\tif (!productId) throw Error('Wasn\\'t able to retrieve a productId');\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId);\n\n\t\t\tif (!productId) throw Error('Wasn\\'t able to retrieve a productId');\n\n\t\t\tlet quantity;\n\n\t\t\tif (quantityToRemove == null) {\n\t\t\t\tquantity = wpmDataLayer.cart[productId].quantity;\n\t\t\t} else {\n\t\t\t\tquantity = quantityToRemove;\n\t\t\t}\n\n\t\t\t// console.log('product_id: ' + productId + ' | qty: ' + quantity);\n\t\t\t// console.log(productId);\n\t\t\t// console.log(wpmDataLayer.cart);\n\t\t\t// console.log(wpmDataLayer.cart[productId]);\n\n\t\t\tif (wpmDataLayer.cart[productId]) {\n\n\t\t\t\t// let product = {\n\t\t\t\t// id : productId.toString(),\n\t\t\t\t// dyn_r_ids: wpmDataLayer.cart[productId].dyn_r_ids,\n\t\t\t\t// name : wpmDataLayer.cart[productId].name,\n\t\t\t\t// // list_name: wpmDataLayer.shop.list_name, // doesn't make sense on mini_cart\n\t\t\t\t// brand : wpmDataLayer.cart[productId].brand,\n\t\t\t\t// category: wpmDataLayer.cart[productId].category,\n\t\t\t\t// variant : wpmDataLayer.cart[productId].variant,\n\t\t\t\t// // list_position: wpmDataLayer.cart[productId].position, // doesn't make sense on mini_cart\n\t\t\t\t// quantity : quantity,\n\t\t\t\t// price : wpmDataLayer.cart[productId].price,\n\t\t\t\t// isVariation: wpmDataLayer.products[productId].isVariation,\n\t\t\t\t// };\n\t\t\t\t//\n\t\t\t\t// if (product.isVariation) product['parentId_dyn_r_ids'] = wpmDataLayer.products[productId].parentId_dyn_r_ids;\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity);\n\n\t\t\t\t// console.log('removing');\n\t\t\t\t// console.log(data);\n\n\t\t\t\tjQuery(document).trigger('wpmRemoveFromCart', product);\n\n\t\t\t\tif (quantityToRemove == null || wpmDataLayer.cart[productId].quantity === quantityToRemove) {\n\t\t\t\t\tdelete wpmDataLayer.cart[productId];\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem('wpmDataLayerCart', JSON.stringify(wpmDataLayer.cart));\n\t\t\t\t} else {\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity - quantity;\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem('wpmDataLayerCart', JSON.stringify(wpmDataLayer.cart));\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\t\t\t// console.log('getting cart from back end');\n\t\t\t// wpm.getCartItemsFromBackend();\n\t\t\t// console.log('getting cart from back end done');\n\n\t\t}\n\t}\n\n\tgetIdBasedOndVariationsOutputSetting = function (productId) {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer.general.variationsOutput) {\n\t\t\t\t// console.log('test');\n\t\t\t\treturn productId;\n\t\t\t} else {\n\t\t\t\tif (wpmDataLayer.products[productId].isVariation) {\n\t\t\t\t\treturn wpmDataLayer.products[productId].parentId;\n\t\t\t\t} else {\n\t\t\t\t\treturn productId;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\t\t}\n\t}\n\n\t// add_to_cart\n\twpm.addProductToCart = function (productId, quantity) {\n\n\t\ttry {\n\t\t\t// console.log('productId: ' + productId + ' | qty: ' + quantity);\n\t\t\t// console.log('productId: ' + productId + ' | variationId: ' + variationId + ' | qty: ' + quantity);\n\n\t\t\tif (!productId) throw Error('Wasn\\'t able to retrieve a productId');\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId);\n\n\t\t\tif (!productId) throw Error('Wasn\\'t able to retrieve a productId');\n\n\t\t\tif (wpmDataLayer.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity);\n\n\t\t\t\t// console.log(productId);\n\n\t\t\t\tjQuery(document).trigger('wpmAddToCart', product);\n\n\t\t\t\t// add product to cart wpmDataLayer['cart']\n\n\t\t\t\t// if the product already exists in the object, only add the additional quantity\n\t\t\t\t// otherwise create that product object in the wpmDataLayer['cart']\n\t\t\t\tif (wpmDataLayer.cart !== undefined && wpmDataLayer.cart[productId] !== undefined) {\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity + quantity;\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem('wpmDataLayerCart', JSON.stringify(wpmDataLayer.cart));\n\t\t\t\t} else {\n\n\t\t\t\t\tif (!wpmDataLayer.cart) {\n\n\t\t\t\t\t\t// wpmDataLayer['cart'] = {\n\t\t\t\t\t\t// [productId]: {\n\t\t\t\t\t\t// id : productId,\n\t\t\t\t\t\t// dyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,\n\t\t\t\t\t\t// name : wpmDataLayer.products[productId].name,\n\t\t\t\t\t\t// brand : wpmDataLayer.products[productId].brand,\n\t\t\t\t\t\t// category : wpmDataLayer.products[productId].category,\n\t\t\t\t\t\t// variant : wpmDataLayer.products[productId].variant,\n\t\t\t\t\t\t// quantity : quantity,\n\t\t\t\t\t\t// price : wpmDataLayer.products[productId].price,\n\t\t\t\t\t\t// isVariation: wpmDataLayer.products[productId].isVariation,\n\t\t\t\t\t\t// parentId : wpmDataLayer.products[productId].parentId,\n\t\t\t\t\t\t// }\n\t\t\t\t\t\t// };\n\t\t\t\t\t\t//\n\t\t\t\t\t\t// if (wpmDataLayer['cart'][productId].isVariation) wpmDataLayer['cart'][productId]['parentId_dyn_r_ids'] = wpmDataLayer.products[productId].parentId_dyn_r_ids;\n\n\t\t\t\t\t\twpmDataLayer['cart'] = {\n\t\t\t\t\t\t\t[productId]: wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tif (sessionStorage) sessionStorage.setItem('wpmDataLayerCart', JSON.stringify(wpmDataLayer.cart));\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// wpmDataLayer.cart[productId] = {\n\t\t\t\t\t\t// id : productId,\n\t\t\t\t\t\t// dyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,\n\t\t\t\t\t\t// name : wpmDataLayer.products[productId].name,\n\t\t\t\t\t\t// brand : wpmDataLayer.products[productId].brand,\n\t\t\t\t\t\t// category : wpmDataLayer.products[productId].category,\n\t\t\t\t\t\t// variant : wpmDataLayer.products[productId].variant,\n\t\t\t\t\t\t// quantity : quantity,\n\t\t\t\t\t\t// price : wpmDataLayer.products[productId].price,\n\t\t\t\t\t\t// isVariation: wpmDataLayer.products[productId].isVariation,\n\t\t\t\t\t\t// parentId : wpmDataLayer.products[productId].parentId,\n\t\t\t\t\t\t// };\n\t\t\t\t\t\t//\n\t\t\t\t\t\t// if (wpmDataLayer.cart[productId].isVariation) wpmDataLayer.cart[productId]['parentId_dyn_r_ids'] = wpmDataLayer.products[productId].parentId_dyn_r_ids;\n\n\t\t\t\t\t\twpmDataLayer.cart[productId] = wpm.getProductDetailsFormattedForEvent(productId, quantity);\n\n\t\t\t\t\t\tif (sessionStorage) sessionStorage.setItem('wpmDataLayerCart', JSON.stringify(wpmDataLayer.cart));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\n\t\t\t// fallback if wpmDataLayer.cart and wpmDataLayer.products got out of sync in case cart caching has an issue\n\t\t\twpm.getCartItemsFromBackend();\n\t\t}\n\t}\n\n\twpm.getCartItems = function () {\n\n\t\t// console.log('get cart items');\n\n\t\tif (sessionStorage) {\n\t\t\tif (!sessionStorage.getItem('wpmDataLayerCart') || wpmDataLayer.shop.page_type === 'order_received_page') {\n\t\t\t\tsessionStorage.setItem('wpmDataLayerCart', JSON.stringify({}));\n\t\t\t} else {\n\t\t\t\twpm.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem('wpmDataLayerCart')));\n\t\t\t}\n\t\t} else {\n\t\t\twpm.getCartItemsFromBackend();\n\t\t}\n\t}\n\n\twpm.getCartItemsFromBackend = function () {\n\t\t// get all cart items from the backend\n\t\ttry {\n\t\t\tlet data = {\n\t\t\t\taction: 'wpm_get_cart_items',\n\t\t\t};\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : 'get',\n\t\t\t\t\tdataType: 'json',\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (cartItems) {\n\n\t\t\t\t\t\t// save all cart items into wpmDataLayer\n\n\t\t\t\t\t\tif (!cartItems['cart']) cartItems['cart'] = {};\n\n\t\t\t\t\t\twpm.saveCartObjectToDataLayer(cartItems['cart']);\n\t\t\t\t\t\tif (sessionStorage) sessionStorage.setItem('wpmDataLayerCart', JSON.stringify(cartItems['cart']));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\t\t}\n\t}\n\n\twpm.getProductsFromBackend = function (productIds) {\n\t\t// console.log('getting pids from back-end: ' + productIds)\n\t\t// get productIds from the backend\n\n\t\t// reduce productIds by products already in the dataLayer\n\t\tproductIds = productIds.filter(item => !wpmDataLayer.products.hasOwnProperty(item));\n\n\t\t// if no products IDs are in the object, don't try to get anything from the server\n\t\tif (!productIds || productIds.length === 0) return;\n\n\t\ttry {\n\t\t\tlet data = {\n\t\t\t\taction : 'wpm_get_product_ids',\n\t\t\t\tproductIds: productIds,\n\t\t\t};\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : 'get',\n\t\t\t\t\tdataType: 'json',\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (products) {\n\n\t\t\t\t\t\t// merge products into wpmDataLayer.products\n\t\t\t\t\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, products);\n\t\t\t\t\t},\n\t\t\t\t\terror : function (response) {\n\t\t\t\t\t\tconsole.log(response);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\t\t}\n\t}\n\n\twpm.saveCartObjectToDataLayer = function (cartObject) {\n\t\twpmDataLayer.cart = cartObject;\n\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, cartObject);\n\t}\n\n\twpm.fireCheckoutOption = function (step, checkout_option = null, value = null) {\n\n\t\tlet data = {\n\t\t\tstep : step,\n\t\t\tcheckout_option: checkout_option,\n\t\t\tvalue : value\n\t\t};\n\n\t\tjQuery(document).trigger('wpmFireCheckoutOption', data);\n\t}\n\n\twpm.fireCheckoutProgress = function (step) {\n\n\t\tlet data = {\n\t\t\tstep: step,\n\t\t};\n\n\t\tjQuery(document).trigger('wpmFireCheckoutProgress', data);\n\t}\n\n\twpm.getPostIdFromString = function (string) {\n\t\t// console.log(string);\n\t\ttry {\n\t\t\treturn string.match(/(post-)(\\d+)/)[2];\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\t\t}\n\t}\n\n\twpm.triggerViewItemList = function (productId) {\n\n\t\t// productId = null;\n\n\t\tif (!productId) throw Error('Wasn\\'t able to retrieve a productId');\n\n\t\tproductId = getIdBasedOndVariationsOutputSetting(productId);\n\n\t\tif (!productId) throw Error('Wasn\\'t able to retrieve a productId');\n\n\t\tjQuery(document).trigger('wpmViewItemList', wpm.getProductDataForViewItemEvent(productId));\n\t}\n\n\twpm.getProductDataForViewItemEvent = function (productId) {\n\n\t\tif (!productId) throw Error('Wasn\\'t able to retrieve a productId');\n\n\t\ttry {\n\t\t\tif (wpmDataLayer.products[productId]) {\n\n\t\t\t\treturn wpm.getProductDetailsFormattedForEvent(productId);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\t\t}\n\t}\n\twpm.getMainProductIdFromProductPage = function () {\n\t\ttry {\n\t\t\tif (['simple', 'variable', 'grouped', 'composite', 'bundle'].indexOf(wpmDataLayer.shop.product_type) >= 0) {\n\t\t\t\treturn jQuery('.wpmProductId:first').data('id');\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\t\t}\n\t}\n\n\twpm.viewItemListTriggerTestMode = function (target) {\n\n\t\tjQuery(target).css({\"position\": \"relative\"});\n\t\tjQuery(target).append('
')\n\t\tjQuery(target).find('#viewItemListTriggerOverlay').css({\n\t\t\t\"z-index\" : \"10\",\n\t\t\t\"display\" : \"block\",\n\t\t\t\"position\" : \"absolute\",\n\t\t\t\"height\" : \"100%\",\n\t\t\t\"top\" : \"0\",\n\t\t\t\"left\" : \"0\",\n\t\t\t\"right\" : \"0\",\n\t\t\t\"opacity\" : wpmDataLayer.viewItemListTrigger.opacity,\n\t\t\t\"background-color\": wpmDataLayer.viewItemListTrigger.backgroundColor,\n\t\t})\n\t}\n\n\twpm.getSearchTermFromUrl = function () {\n\t\ttry {\n\t\t\tlet urlParameters = new URLSearchParams(window.location.search)\n\t\t\treturn urlParameters.get('s');\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\t\t}\n\t}\n\n\t// we need this to track timeouts for intersection observers\n\tlet ioTimeouts = {};\n\n\twpm.observerCallback = function (entries, observer) {\n\n\t\tentries.forEach((entry) => {\n\n\t\t\ttry {\n\t\t\t\tlet productId;\n\n\t\t\t\tlet elementId = jQuery(entry.target).data('ioid');\n\n\t\t\t\t// Get the productId from next element, if wpmProductId is a sibling, like in Gutenberg blocks\n\t\t\t\t// otherwise go search in children, like in regular WC loop items\n\t\t\t\tif (jQuery(entry.target).next('.wpmProductId').length) {\n\t\t\t\t\t// console.log('test 1');\n\t\t\t\t\tproductId = jQuery(entry.target).next('.wpmProductId').data('id');\n\t\t\t\t} else {\n\t\t\t\t\tproductId = jQuery(entry.target).find('.wpmProductId').data('id');\n\t\t\t\t}\n\n\t\t\t\t// productId = null;\n\n\t\t\t\tif (!productId) throw Error('wpmProductId element not found');\n\n\t\t\t\tif (entry.isIntersecting) {\n\n\t\t\t\t\t// console.log('prodid: ' + productId);\n\t\t\t\t\tioTimeouts[elementId] = setTimeout(() => {\n\t\t\t\t\t\t// console.log('prodid: ' + productId);\n\t\t\t\t\t\twpm.triggerViewItemList(productId);\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) wpm.viewItemListTriggerTestMode(entry.target);\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.repeat === false) observer.unobserve(entry.target);\n\t\t\t\t\t}, wpmDataLayer.viewItemListTrigger.timeout)\n\n\t\t\t\t} else {\n\n\t\t\t\t\tclearTimeout(ioTimeouts[elementId])\n\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) jQuery(entry.target).find('#viewItemListTriggerOverlay').remove();\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tconsole.log(e);\n\t\t\t}\n\t\t});\n\t}\n\n\t// fire view_item_list only on products that have become visible\n\tlet io;\n\tlet ioid = 0;\n\tlet allIoElementsToWatch;\n\n\tlet getAllElementsToWatch = function () {\n\n\t\tallIoElementsToWatch = jQuery('.wpmProductId')\n\t\t\t.map(function (i, elem) {\n\t\t\t\t// console.log(elem);\n\t\t\t\tif (\n\t\t\t\t\tjQuery(elem).parent().hasClass('type-product') ||\n\t\t\t\t\tjQuery(elem).parent().hasClass('product') ||\n\t\t\t\t\tjQuery(elem).parent().hasClass('product-item-inner')\n\t\t\t\t) {\n\t\t\t\t\t// console.log(elem);\n\t\t\t\t\treturn jQuery(elem).parent();\n\t\t\t\t} else if (\n\t\t\t\t\tjQuery(elem).prev().hasClass('wc-block-grid__product') ||\n\t\t\t\t\tjQuery(elem).prev().hasClass('product') ||\n\t\t\t\t\tjQuery(elem).prev().hasClass('product-small') ||\n\t\t\t\t\tjQuery(elem).prev().hasClass('woocommerce-LoopProduct-link')\n\t\t\t\t) {\n\t\t\t\t\treturn jQuery(this).prev();\n\t\t\t\t} else if (jQuery(elem).closest('.product').length) {\n\t\t\t\t\treturn jQuery(elem).closest('.product');\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\twpm.startIntersectionObserverToWatch = function () {\n\n\t\ttry {\n\t\t\t// enable view_item_list test mode from browser\n\t\t\tlet urlParams = new URLSearchParams(window.location.search);\n\t\t\tif (urlParams.has('vildemomode')) wpmDataLayer.viewItemListTrigger.testMode = true;\n\n\t\t\t// set up intersection observer\n\t\t\tio = new IntersectionObserver(wpm.observerCallback, {\n\t\t\t\tthreshold: wpmDataLayer.viewItemListTrigger.threshold,\n\t\t\t});\n\n\t\t\tgetAllElementsToWatch();\n\n\t\t\t// console.log(allElementsToWatch);\n\n\t\t\tallIoElementsToWatch.each(function (i, elem) {\n\t\t\t\t// console.log(elem[0]);\n\t\t\t\t// jQuery(elem[0]).attr('data-ioid', ioid++);\n\t\t\t\tjQuery(elem[0]).data('ioid', ioid++);\n\n\t\t\t\tio.observe(elem[0])\n\t\t\t});\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\t\t}\n\t}\n\n\t// watch DOM for new lazy loaded products and add them to the intersection observer\n\twpm.startProductsMutationObserverToWatch = function () {\n\n\t\ttry {\n\t\t\t// Pass in the target node, as well as the observer options\n\n\t\t\t// selects the most common parent node\n\t\t\t// https://stackoverflow.com/a/7648323/4688612\n\t\t\tlet productsNode = jQuery('.wpmProductId:eq(0)').parents().has(jQuery('.wpmProductId:eq(1)').parents()).first()\n\n\t\t\tif (productsNode.length) {\n\t\t\t\tproductsMutationObserver.observe(productsNode[0], {\n\t\t\t\t\tattributes : true,\n\t\t\t\t\tchildList : true,\n\t\t\t\t\tcharacterData: true\n\t\t\t\t});\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\t\t}\n\t}\n\n\t// Create an observer instance\n\tlet productsMutationObserver = new MutationObserver(function (mutations) {\n\n\t\tmutations.forEach(function (mutation) {\n\t\t\tlet newNodes = mutation.addedNodes; // DOM NodeList\n\t\t\tif (newNodes !== null) { // If there are new nodes added\n\t\t\t\tlet nodes = jQuery(newNodes); // jQuery set\n\t\t\t\tnodes.each(function () {\n\t\t\t\t\tif (\n\t\t\t\t\t\tjQuery(this).hasClass(\"type-product\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"product-small\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"wc-block-grid__product\")\n\t\t\t\t\t) {\n\t\t\t\t\t\t// check if the node has a child or sibling wpmProductId\n\t\t\t\t\t\t// if yes add it to the intersectionObserver\n\t\t\t\t\t\tif (hasWpmProductIdElement(this)) {\n\t\t\t\t\t\t\tjQuery(this).data('ioid', ioid++);\n\t\t\t\t\t\t\tio.observe(this)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t});\n\n\tlet hasWpmProductIdElement = function (elem) {\n\t\treturn !!(jQuery(elem).find('.wpmProductId').length ||\n\t\t\tjQuery(elem).siblings('.wpmProductId').length);\n\t}\n\n\twpm.setCookie = function (cookieName, cookieValue = '', expiryDays = null) {\n\t\tif (expiryDays) {\n\t\t\tlet d = new Date();\n\t\t\td.setTime(d.getTime() + (expiryDays * 24 * 60 * 60 * 1000));\n\t\t\tlet expires = \"expires=\" + d.toUTCString();\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";\" + expires + \";path=/\";\n\t\t} else {\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";path=/\";\n\t\t}\n\t}\n\n\twpm.getCookie = function (cookieName) {\n\t\tlet name = cookieName + \"=\";\n\t\tlet decodedCookie = decodeURIComponent(document.cookie);\n\t\tlet ca = decodedCookie.split(';');\n\t\tfor (let i = 0; i < ca.length; i++) {\n\t\t\tlet c = ca[i];\n\t\t\twhile (c.charAt(0) == ' ') {\n\t\t\t\tc = c.substring(1);\n\t\t\t}\n\t\t\tif (c.indexOf(name) == 0) {\n\t\t\t\treturn c.substring(name.length, c.length);\n\t\t\t}\n\t\t}\n\t\treturn \"\";\n\t}\n\n\twpm.storeOrderIdOnServer = function (orderId) {\n\n\t\t// console.log('saving wpm_purchase_pixels_fired');\n\n\t\t// console.log('url: ' + wpm_premium_only_ajax_object.ajax_url);\n\t\t// console.log('nonce: ' + wpm_premium_only_ajax_object.nonce);\n\t\t// console.log('url: ' + wpm.ajax_url);\n\t\t// console.log('nonce: ' + wpm.nonce);\n\n\t\ttry {\n\t\t\t// save the state in the database\n\t\t\tlet data = {\n\t\t\t\taction : 'wpm_purchase_pixels_fired',\n\t\t\t\torder_id: orderId,\n\t\t\t\t// nonce : ajax_object.nonce,\n\t\t\t\tnonce: wpm.nonce,\n\t\t\t};\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : 'post',\n\t\t\t\t\tdataType: 'json',\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (response) {\n\t\t\t\t\t\tif (response.success === false) {\n\t\t\t\t\t\t\tconsole.log(response);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\terror : function (response) {\n\t\t\t\t\t\tconsole.log(response);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\t\t}\n\t}\n\n\twpm.getProductIdByCartItemKeyUrl = function (url) {\n\t\tlet searchParams = new URLSearchParams(url.search);\n\t\tlet cartItemKey = searchParams.get('remove_item');\n\n\t\tlet productId = null;\n\n\t\tif (wpmDataLayer.cartItemKeys[cartItemKey]['variation_id'] === 0) {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey]['product_id'];\n\t\t} else {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey]['variation_id'];\n\t\t}\n\n\t\treturn productId;\n\t}\n\n\twpm.getAddToCartLinkProductIds = function () {\n\t\treturn jQuery('a').map(function () {\n\t\t\tlet href = jQuery(this).attr('href');\n\n\t\t\tif (href && href.includes('?add-to-cart=')) {\n\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/);\n\t\t\t\tif (matches) return matches[2];\n\t\t\t}\n\t\t}).get()\n\t}\n\n\twpm.getProductDetailsFormattedForEvent = function (productId, quantity = 1) {\n\n\t\tlet product = {\n\t\t\tid : productId.toString(),\n\t\t\tdyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,\n\t\t\tname : wpmDataLayer.products[productId].name,\n\t\t\tlist_name : wpmDataLayer.shop.list_name,\n\t\t\tbrand : wpmDataLayer.products[productId].brand,\n\t\t\tcategory : wpmDataLayer.products[productId].category,\n\t\t\tvariant : wpmDataLayer.products[productId].variant,\n\t\t\tlist_position: wpmDataLayer.products[productId].position,\n\t\t\tquantity : quantity,\n\t\t\tprice : wpmDataLayer.products[productId].price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tisVariable : wpmDataLayer.products[productId].isVariable,\n\t\t\tisVariation : wpmDataLayer.products[productId].isVariation,\n\t\t\tparentId : wpmDataLayer.products[productId].parentId,\n\t\t};\n\n\t\tif (product.isVariation) product['parentId_dyn_r_ids'] = wpmDataLayer.products[productId].parentId_dyn_r_ids;\n\n\t\treturn product;\n\t}\n\n\twpm.setReferrerToCookie = function () {\n\t\t// can't use session storage as we can't read it from the server\n\t\tif (!wpm.getCookie('wpmReferrer')) {\n\t\t\twpm.setCookie('wpmReferrer', document.referrer);\n\t\t}\n\t}\n\n\twpm.getReferrerFromCookie = function () {\n\t\tif (wpm.getCookie('wpmReferrer')) {\n\t\t\treturn wpm.getCookie('wpmReferrer');\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\twpm.getClidFromBrowser = function (clidId = 'gclid') {\n\n\t\tlet clidCookieId;\n\n\t\tclidCookieId = {\n\t\t\tgclid: '_gcl_aw',\n\t\t\tdclid: '_gcl_dc',\n\t\t};\n\n\t\tif (wpm.getCookie(clidCookieId[clidId])) {\n\t\t\tlet clidCookie = wpm.getCookie(clidCookieId[clidId]);\n\t\t\tlet matches = clidCookie.match(/(GCL.[\\d]*.)(.*)/);\n\t\t\treturn matches[2];\n\t\t} else {\n\t\t\treturn '';\n\t\t}\n\t}\n\n\twpm.getUserAgent = function () {\n\t\treturn navigator.userAgent;\n\t}\n\n\twpm.getViewPort = function () {\n\t\treturn {\n\t\t\twidth : Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0),\n\t\t\theight: Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0),\n\t\t};\n\t}\n\n\t/*\n\t* Handle Cookie Management Platforms\n\t* */\n\n\tlet getComplianzCookies = function () {\n\n\t\tlet cmplz_statistics = wpm.getCookie('cmplz_statistics')\n\t\tlet cmplz_marketing = wpm.getCookie('cmplz_marketing')\n\t\tlet cmplz_consent_status = wpm.getCookie('cmplz_consent_status') || wpm.getCookie('cmplz_banner-status')\n\n\n\t\tif (cmplz_consent_status) {\n\t\t\treturn {\n\t\t\t\tanalytics : cmplz_statistics === 'allow',\n\t\t\t\tads : cmplz_marketing === 'allow',\n\t\t\t\tvisitorHasChosen: true\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tlet getCookieLawInfoCookies = function () {\n\n\t\tlet analyticsCookie = wpm.getCookie('cookielawinfo-checkbox-analytics')\n\t\tlet adsCookie = wpm.getCookie('cookielawinfo-checkbox-advertisement')\n\t\tlet visitorHasChosen = wpm.getCookie('CookieLawInfoConsent')\n\n\t\tif (analyticsCookie || adsCookie) {\n\n\t\t\treturn {\n\t\t\t\tanalytics : analyticsCookie === 'yes',\n\t\t\t\tads : adsCookie === 'yes',\n\t\t\t\tvisitorHasChosen: !!visitorHasChosen,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\n\tlet\n\t\twpmConsentValues = {}\n\twpmConsentValues.categories = {}\n\twpmConsentValues.pixels = []\n\twpmConsentValues.mode = 'category'\n\twpmConsentValues.visitorHasChosen = false\n\n\twpm.getConsentValues = function () {\n\t\treturn wpmConsentValues\n\t}\n\n\twpm.updateConsentCookieValues = function (explicitConsent = false) {\n\n\t\t// ad_storage\n\t\t// analytics_storage\n\t\t// functionality_storage\n\t\t// personalization_storage\n\t\t// security_storage\n\n\t\t// console.log('exp cons: ' + explicitConsent)\n\n\t\tlet cookie\n\n\t\tif (cookie = wpm.getCookie('CookieConsent')) {\n\t\t\t// Cookiebot\n\t\t\t// https://wordpress.org/plugins/cookiebot/\n\t\t\tcookie = decodeURI(cookie)\n\n\t\t\t// console.log(cookie.indexOf('statistics:true'))\n\t\t\t// console.log(cookie.indexOf('marketing:true'))\n\n\t\t\twpmConsentValues.categories.analytics = cookie.indexOf('statistics:true') >= 0\n\t\t\twpmConsentValues.categories.ads = cookie.indexOf('marketing:true') >= 0\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie('CookieScriptConsent')) {\n\t\t\t// Cookie Script\n\t\t\t// https://wordpress.org/plugins/cookie-script-com/\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\t// console.log(cookie)\n\t\t\t// console.log(cookie.action)\n\t\t\t// console.log('cat length: ' + cookie.categories.length)\n\t\t\t// console.log(cookie.categories.indexOf('performance'))\n\n\t\t\tif (cookie.action === 'reject') {\n\t\t\t\twpmConsentValues.categories.analytics = false\n\t\t\t\twpmConsentValues.categories.ads = false\n\t\t\t} else if (cookie.categories.length === 2) {\n\t\t\t\twpmConsentValues.categories.analytics = true\n\t\t\t\twpmConsentValues.categories.ads = true\n\t\t\t} else {\n\t\t\t\twpmConsentValues.categories.analytics = cookie.categories.indexOf('performance') >= 0\n\t\t\t\twpmConsentValues.categories.ads = cookie.categories.indexOf('targeting') >= 0\n\t\t\t}\n\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else if (cookie = wpm.getCookie('borlabs-cookie')) {\n\t\t\t// Borlabs Cookie\n\t\t\t// https://borlabs.io/borlabs-cookie/\n\n\t\t\tcookie = decodeURI(cookie)\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie?.consents?.statistics\n\t\t\twpmConsentValues.categories.ads = !!cookie?.consents?.marketing\n\t\t\twpmConsentValues.visitorHasChosen = true\n\t\t\twpmConsentValues.pixels = [...cookie?.consents?.statistics || [], ...cookie?.consents?.marketing || []]\n\t\t\twpmConsentValues.mode = 'pixel'\n\n\t\t} else if (cookie = getComplianzCookies()) {\n\t\t\t// Complianz Cookie\n\t\t\t// https://wordpress.org/plugins/complianz-gdpr/\n\n\t\t\t// console.log(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else if (cookie = wpm.getCookie('cookie_notice_accepted')) {\n\t\t\t// Cookie Compliance (free version)\n\t\t\t// https://wordpress.org/plugins/cookie-notice/\n\n\t\t\twpmConsentValues.categories.analytics = true\n\t\t\twpmConsentValues.categories.ads = true\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie('hu-consent')) {\n\t\t\t// Cookie Compliance (pro version)\n\t\t\t// https://wordpress.org/plugins/cookie-notice/\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie.categories['3']\n\t\t\twpmConsentValues.categories.ads = !!cookie.categories['4']\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = getCookieLawInfoCookies()) {\n\t\t\t// CookieYes, GDPR Cookie Consent (Cookie Law Info)\n\t\t\t// https://wordpress.org/plugins/cookie-law-info/\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen === true\n\n\t\t} else if (cookie = wpm.getCookie('moove_gdpr_popup')) {\n\t\t\t// GDPR Cookie Compliance Plugin by Moove Agency\n\t\t\t// https://wordpress.org/plugins/gdpr-cookie-compliance/\n\t\t\t// TODO write documentation on how to set up the plugin in order for this to work properly\n\n\t\t\tcookie = JSON.parse(cookie)\n\t\t\t// console.log('moove cookie thirdparty: ' + cookie.thirdparty)\n\t\t\t// console.log('moove cookie advanced: ' + cookie.advanced)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.thirdparty === '1'\n\t\t\twpmConsentValues.categories.ads = cookie.advanced === '1'\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else {\n\t\t\t// consentValues.categories.analytics = true\n\t\t\t// consentValues.categories.ads = true\n\n\t\t\twpmConsentValues.categories.analytics = !explicitConsent\n\t\t\twpmConsentValues.categories.ads = !explicitConsent\n\t\t}\n\t}\n\n\twpm.updateConsentCookieValues();\n\n\twpm.setConsentDefaultValuesToExplicit = function () {\n\t\twpmConsentValues.categories = {\n\t\t\tanalytics: false,\n\t\t\tads : false,\n\t\t}\n\t}\n\n\t/*\n\t* Runs through each script in and blocks / unblocks it according to the plugin settings\n\t* and user consent.\n\t*/\n\n\t// https://stackoverflow.com/q/65453565/4688612\n\twpm.scriptTagObserver = new MutationObserver((mutations) => {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif ($(node).data('wpm-cookie-category')) {\n\n\t\t\t\t\t\t// console.log(node)\n\n\t\t\t\t\t\t// If the pixel category has been approved > unblock\n\t\t\t\t\t\t// If the pixel belongs to more than one category, then unblock if one of the categories has been approved\n\t\t\t\t\t\t// If no category has been approved, but the Google Consent Mode is active, then only unblock the Google scripts\n\n\t\t\t\t\t\tif (wpm.shouldScriptBeActive(node)) {\n\t\t\t\t\t\t\twpm.unblockScript(node)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twpm.blockScript(node)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t});\n\t})\n\n\twpm.scriptTagObserver.observe(document.head, {childList: true, subtree: true});\n\twindow.addEventListener('DOMContentLoaded', () => wpm.scriptTagObserver.disconnect());\n\n\twpm.shouldScriptBeActive = function (node) {\n\n\t\tif (\n\t\t\twpmDataLayer.shop.cookie_consent_mgmt.explicit_consent ||\n\t\t\twpmConsentValues.visitorHasChosen\n\t\t) {\n\n\t\t\tif (wpmConsentValues.mode === 'category' && $(node).data('wpm-cookie-category').split(',').some(element => wpmConsentValues.categories[element])) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === 'pixel' && wpmConsentValues.pixels.includes($(node).data('wpm-pixel-name'))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === 'pixel' && $(node).data('wpm-pixel-name') === 'google' && ['google-analytics', 'google-ads'].some(element => wpmConsentValues.pixels.includes(element))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmDataLayer?.pixels?.google?.consent_mode?.active && $(node).data('wpm-pixel-name') === 'google') {\n\t\t\t\treturn true\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} else {\n\t\t\treturn true\n\t\t}\n\t}\n\n\n\twpm.unblockScript = function (scriptNode, removeAttach = false) {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tlet wpmSrc = $(scriptNode).data('wpm-src')\n\t\tif (wpmSrc) $(scriptNode).attr('src', wpmSrc)\n\n\t\tscriptNode.type = 'text/javascript'\n\n\t\tif (removeAttach) $(scriptNode).appendTo('head')\n\t}\n\n\twpm.blockScript = function (scriptNode, removeAttach = false) {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tif ($(scriptNode).attr('src')) $(scriptNode).removeAttr('src')\n\t\tscriptNode.type = 'blocked/javascript'\n\n\t\tif (removeAttach) $(scriptNode).appendTo('head')\n\t}\n\n\twpm.unblockAllScripts = function (analytics = true, ads = true) {\n\t\t// console.log('unblocking all scripts')\n\n\t\t$.each(\n\t\t\t$('script[type=\"blocked/javascript\"]'), function (index, scriptNode) {\n\n\t\t\t\tif ($(scriptNode).data('wpm-cookie-category').includes('analytics') && analytics) {\n\t\t\t\t\twpm.unblockScript(scriptNode, true)\n\t\t\t\t} else if ($(scriptNode).data('wpm-cookie-category').includes('ads') && ads) {\n\t\t\t\t\twpm.unblockScript(scriptNode, true)\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\twpm.unblockSelectedPixels = function () {\n\t\t$.each(\n\t\t\t$('script[type=\"blocked/javascript\"]'), function (index, node) {\n\n\t\t\t\tif (wpmConsentValues.pixels.includes($(node).data('wpm-pixel-name'))) {\n\t\t\t\t\twpm.unblockScript(node, true)\n\t\t\t\t} else if ($(node).data('wpm-pixel-name') === 'google' && ['google-analytics', 'google-ads'].some(element => wpmConsentValues.pixels.includes(element))) {\n\t\t\t\t\twpm.unblockScript(node, true)\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\twpm.googleConfigConditionsMet = function (type) {\n\t\t// always returns true if Google Consent Mode is active\n\t\tif (wpmDataLayer.pixels.google.consent_mode.active) {\n\t\t\treturn true\n\t\t} else if (wpmConsentValues.mode === 'category') {\n\t\t\treturn wpmConsentValues.categories[type] === true\n\t\t} else if (wpmConsentValues.mode === 'pixel') {\n\t\t\treturn wpmConsentValues.pixels.includes('google-' + type)\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings = function (google_consent_settings) {\n\n\t\tif (wpmConsentValues.mode === 'category') {\n\t\t\tif (wpmConsentValues.categories.analytics) google_consent_settings.analytics_storage = 'granted'\n\t\t\tif (wpmConsentValues.categories.ads) google_consent_settings.ad_storage = 'granted'\n\t\t} else if ((wpmConsentValues.mode === 'pixel')) {\n\t\t\tgoogle_consent_settings.analytics_storage = wpmConsentValues.pixels.includes('google-analytics') ? 'granted' : 'denied'\n\t\t\tgoogle_consent_settings.ad_storage = wpmConsentValues.pixels.includes('google-ads') ? 'granted' : 'denied'\n\t\t}\n\n\t\treturn google_consent_settings\n\t}\n\n\twpm.updateGoogleConsentMode = function (analytics = true, ads = true) {\n\n\t\tif (\n\t\t\t!window.gtag ||\n\t\t\t!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent\n\t\t) return\n\n\t\tgtag('consent', 'update', {\n\t\t\t'analytics_storage': analytics ? 'granted' : 'denied',\n\t\t\t'ad_storage' : ads ? 'granted' : 'denied'\n\t\t});\n\t}\n\n\n\t/*\n\t* Block or unblock scripts for each CMP immediately after cookie consent has been updated\n\t* by the visitor.\n\t */\n\n\t// Borlabs Cookie\n\t// If visitor accepts cookies in Borlabs Cookie unblock the scripts\n\twindow.addEventListener('borlabs-cookie-consent-saved', function (e) {\n\n\t\twpm.updateConsentCookieValues();\n\n\t\tif (wpmConsentValues.mode === 'pixel') {\n\n\t\t\twpm.unblockSelectedPixels()\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.pixels.includes('google-analytics'), wpmConsentValues.pixels.includes('google-ads'))\n\t\t} else {\n\n\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t}\n\t});\n\n\t// Cookiebot\n\t// If visitor accepts cookies in Cookiebot unblock the scripts\n\t// https://www.cookiebot.com/en/developer/\n\twindow.addEventListener('CookiebotOnAccept', function (e) {\n\t\tif (Cookiebot.consent.statistics) wpmConsentValues.categories.analytics = true\n\t\tif (Cookiebot.consent.marketing) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\n\t}, false);\n\n\t// Cookie Script\n\t// If visitor accepts cookies in Cookie Script unblock the scripts\n\t// https://support.cookie-script.com/article/20-custom-events\n\twindow.addEventListener('CookieScriptAccept', function (e) {\n\t\tif (e.detail.categories.includes('performance')) wpmConsentValues.categories.analytics = true\n\t\tif (e.detail.categories.includes('targeting')) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t// Cookie Script\n\t// If visitor accepts cookies in Cookie Script unblock the scripts\n\t// https://support.cookie-script.com/\n\twindow.addEventListener('CookieScriptAcceptAll', function (e) {\n\t\twpm.unblockAllScripts(true, true)\n\t\twpm.updateGoogleConsentMode(true, true)\n\t})\n\n\t// Complianz Cookie\n\t// If visitor accepts cookies in Complianz unblock the scripts\n\tdocument.addEventListener(\"cmplzStatusChange\", function (e) {\n\n\t\twpm.updateConsentCookieValues();\n\n\t\t// console.log(wpmConsentValues)\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t});\n\n\t// Cookie Compliance by hu-manity.co (free and pro)\n\t// If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (free version)\n\t// https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\tdocument.addEventListener(\"setCookieNotice\", function (e) {\n\n\t\twpm.updateConsentCookieValues();\n\n\t\t// console.log(wpmConsentValues)\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t});\n\n\t// Cookie Compliance by hu-manity.co (free and pro)\n\t// If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (pro version)\n\t// https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\t// Because Cookie Notice has no documented API or event that is being triggered on consent save or update\n\t// we have to solve this by using a mutation observer.\n\twpm.huObserver = new MutationObserver(function (mutations) {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif (node.id === 'hu') {\n\n\t\t\t\t\t\tjQuery('.hu-cookies-save').on('click', function (e) {\n\t\t\t\t\t\t\twpm.updateConsentCookieValues();\n\t\t\t\t\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t});\n\t});\n\n\tif (window.hu) {\n\t\twpm.huObserver.observe(document.documentElement || document.body, {childList: true, subtree: true});\n\t}\n\n\twpm.version = function () {\n\t\tconsole.log(wpmDataLayer.version)\n\t}\n\n\t// wpm['load'] = {\n\t// base: true\n\t// };\n\n\twindow['wpmLoaded'] = {};\n\n\t// return {\n\t// writeOrderIdToStorage : writeOrderIdToStorage,\n\t// isOrderIdStored : isOrderIdStored,\n\t// isEmail : isEmail,\n\t// removeProductFromCart : removeProductFromCart,\n\t// getViewItemProducts : getViewItemProducts,\n\t// addProductToCart : addProductToCart,\n\t// getCartItemsFromBackEnd: getCartItemsFromBackEnd,\n\t// fireCheckoutOption : fireCheckoutOption,\n\t// getCartItems : getCartItems\n\t// }\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n// run when window ready\njQuery(function () {\n// jQuery(window).on('load', function () {\n\n\t// watch for products visible in viewport\n\twpm.startIntersectionObserverToWatch();\n\n\t// watch for lazy loaded products\n\twpm.startProductsMutationObserverToWatch();\n\n\tlet body = jQuery('body');\n\tlet products = jQuery('.products, .product');\n\n\t// remove_from_cart event\n\t// body.on('click', '.remove_from_cart_button, .remove', function (e) {\n\tjQuery(document).on('click', '.remove_from_cart_button, .remove', function (e) {\n\t\t// jQuery('.remove_from_cart_button, .remove').on('click', function (e) {\n\n\t\ttry {\n\t\t\t// console.log('remove_from_cart: ' + jQuery(this).data('product_id'));\n\n\t\t\tlet url = new URL(jQuery(this).attr('href'));\n\t\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url);\n\n\t\t\twpm.removeProductFromCart(productId);\n\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\t\t}\n\t});\n\n\n\t// add_to_cart event\n\t// body.on('click', '.add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button', function (e) {\n\tjQuery(document).on('click', '.add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button', function (e) {\n\t\t// jQuery('.add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .js-ajax-add-to-cart, .single_add_to_cart_button, .btn_color-2').on('click', function (e) {\n\n\t\ttry {\n\t\t\t// console.log('add_to_cart');\n\n\t\t\tif (wpmDataLayer.shop.page_type === 'product') {\n\n\t\t\t\t// first process related and upsell products\n\t\t\t\tif (typeof jQuery(this).attr('href') !== 'undefined' && jQuery(this).attr('href').includes('add-to-cart')) {\n\t\t\t\t\t// console.log('add-to-cart on upsell and related products');\n\t\t\t\t\tlet quantity = 1;\n\t\t\t\t\tlet productId = jQuery(this).data('product_id');\n\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\twpm.addProductToCart(productId, quantity);\n\t\t\t\t} else {\n\n\t\t\t\t\tif (wpmDataLayer.shop.product_type === 'simple') {\n\n\t\t\t\t\t\t// console.log('test');\n\t\t\t\t\t\tlet quantity = Number(jQuery('.input-text.qty').val());\n\n\t\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1;\n\n\t\t\t\t\t\tlet productId = jQuery(this).val();\n\n\t\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\t\twpm.addProductToCart(productId, quantity);\n\n\t\t\t\t\t} else if (wpmDataLayer.shop.product_type === 'variable') {\n\n\t\t\t\t\t\t// console.log('variable');\n\n\t\t\t\t\t\tlet quantity = Number(jQuery('.input-text.qty').val());\n\n\t\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1;\n\n\t\t\t\t\t\tlet productId = jQuery(\"[name='variation_id']\").val();\n\n\t\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\t\twpm.addProductToCart(productId, quantity);\n\n\t\t\t\t\t} else if (wpmDataLayer.shop.product_type === 'grouped') {\n\n\t\t\t\t\t\t// console.log('grouped');\n\n\t\t\t\t\t\tjQuery('.woocommerce-grouped-product-list-item').each(function () {\n\n\t\t\t\t\t\t\tlet quantity = Number(jQuery(this).find('.input-text.qty').val());\n\n\t\t\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1;\n\n\t\t\t\t\t\t\tlet classes = jQuery(this).attr('class');\n\t\t\t\t\t\t\tlet productId = wpm.getPostIdFromString(classes);\n\n\t\t\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\t\t\twpm.addProductToCart(productId, quantity);\n\t\t\t\t\t\t});\n\t\t\t\t\t} else if (wpmDataLayer.shop.product_type === 'bundle') {\n\n\t\t\t\t\t\t// console.log('bundle');\n\n\t\t\t\t\t\tlet quantity = Number(jQuery('.input-text.qty').val());\n\n\t\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1;\n\n\t\t\t\t\t\tlet productId = jQuery('input[name=add-to-cart]').val();\n\n\t\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\t\twpm.addProductToCart(productId, quantity);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\n\t\t\t\t// console.log('non product page');\n\n\t\t\t\tlet quantity = 1;\n\t\t\t\tlet productId = jQuery(this).data('product_id');\n\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\twpm.addProductToCart(productId, quantity);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\t\t}\n\t});\n\n\t// if someone clicks anywhere on a custom /?add-to-cart=123 link\n\t// trigger the add to cart event\n\t// body.one('click', function (e) {\n\t//\n\t// try {\n\t// if (jQuery(this)[0].URL) {\n\t//\n\t// let href = new URL(jQuery(this)[0].URL);\n\t// let searchParams = new URLSearchParams(href.search);\n\t//\n\t// if (searchParams.has('add-to-cart')) {\n\t// // console.log('non product page, /?add-to-cart=123 link');\n\t//\n\t// let productId = searchParams.get('add-to-cart');\n\t// wpm.addProductToCart(productId, 1);\n\t// }\n\t// }\n\t// } catch (e) {\n\t// console.log(e);\n\t// }\n\t// });\n\n\t// if someone clicks anywhere on a custom /?add-to-cart=123 link\n\t// trigger the add to cart event\n\t// body.one('click', 'a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)', function (event) {\n\tjQuery(document).one('click', 'a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)', function (event) {\n\t\t// jQuery('a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)').one('click', function (event) {\n\n\t\ttry {\n\t\t\tif (jQuery(event.target).closest('a').attr('href')) {\n\n\t\t\t\tlet href = jQuery(event.target).closest('a').attr('href');\n\n\t\t\t\tif (href.includes('add-to-cart=')) {\n\t\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/);\n\t\t\t\t\t// console.log('pid: ' + matches[2])\n\t\t\t\t\tif (matches) wpm.addProductToCart(matches[2], 1);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\t\t}\n\t});\n\n\t// select_content GA UA event\n\t// select_item GA 4 event\n\t// jQuery(document).on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product-small.box', function (e) {\n\t// body.on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product', function (e) {\n\tjQuery(document).on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product', function (e) {\n\t\t// jQuery('.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product').on('click', function (e) {\n\n\t\ttry {\n\n\t\t\t// On some pages the event fires multiple times, and on product pages\n\t\t\t// even on page load. Using e.stopPropagation helps to prevent this,\n\t\t\t// but I dont know why. We don't even have to use this, since only a real\n\t\t\t// product click yields a valid productId. So we filter the invalid click\n\t\t\t// events out later down the code. I'll keep it that way because this is\n\t\t\t// the most compatible way across shops.\n\t\t\t// e.stopPropagation();\n\n\t\t\t// console.log('select_content and select_item');\n\n\t\t\tlet productId = jQuery(this).nextAll('.wpmProductId:first').data('id');\n\t\t\t// console.log('select_content and select_item: ' + productId);\n\n\n\t\t\t// On product pages, for some reason, the click event is triggered on the main product on page load.\n\t\t\t// In that case no ID is found. But we can discard it, since we only want to trigger the event on\n\t\t\t// related products, which are found below.\n\t\t\tif (productId) {\n\n\t\t\t\t// console.log('select_content and select_item: ' + productId);\n\n\t\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId);\n\n\t\t\t\tif (!productId) throw Error('Wasn\\'t able to retrieve a productId');\n\n\t\t\t\t// console.log('prodid: ' + productId);\n\n\t\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId);\n\n\t\t\t\t\tjQuery(document).trigger('wpmSelectContentGaUa', product);\n\t\t\t\t\tjQuery(document).trigger('wpmSelectItem', product);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\t\t}\n\t});\n\n\t// begin_checkout event\n\t// body.one('click', '.checkout-button, .cart-checkout-button, .button.checkout', function (e) {\n\tjQuery(document).one('click', '.checkout-button, .cart-checkout-button, .button.checkout', function (e) {\n\t\t// jQuery('.checkout-button, .cart-checkout-button, .button.checkout').one('click', function (e) {\n\t\t// console.log('begin_checkout');\n\n\t\tjQuery(document).trigger('wpmBeginCheckout');\n\t});\n\n\tlet emailSelected = false;\n\n\t// checkout_progress event\n\t// track checkout option event: entered valid billing email\n\t// body.on('input', '#billing_email', function () {\n\tjQuery(document).on('input', '#billing_email', function () {\n\t\t// jQuery('#billing_email').on('input', function () {\n\n\t\tif (wpm.isEmail(jQuery(this).val())) {\n\t\t\t// wpm.fireCheckoutOption(2);\n\t\t\twpm.fireCheckoutProgress(2);\n\t\t\temailSelected = true;\n\t\t}\n\t});\n\n\t// track checkout option event: purchase click\n\tlet paymentMethodSelected = false;\n\n\t// body.on('click', '.wc_payment_methods', function () {\n\tjQuery(document).on('click', '.wc_payment_methods', function () {\n\t\t// jQuery('.wc_payment_methods').on('click', function () {\n\n\t\tif (paymentMethodSelected === false) {\n\t\t\twpm.fireCheckoutProgress(3);\n\t\t}\n\n\t\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val());\n\t\tpaymentMethodSelected = true;\n\t});\n\n\t// track checkout option event: purchase click\n\t// body.one('click', '#place_order', function () {\n\tjQuery(document).one('click', '#place_order', function () {\n\t\t// jQuery('#place_order').one('click', function () {\n\n\t\tif (emailSelected === false) {\n\t\t\twpm.fireCheckoutProgress(2);\n\t\t}\n\n\t\tif (paymentMethodSelected === false) {\n\t\t\twpm.fireCheckoutProgress(3);\n\t\t\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val());\n\t\t}\n\n\t\twpm.fireCheckoutProgress(4);\n\t});\n\n\t// update cart event\n\t// body.on('click', \"[name='update_cart']\", function (e) {\n\tjQuery(document).on('click', \"[name='update_cart']\", function (e) {\n\t\t// jQuery(\"[name='update_cart']\").on('click', function (e) {\n\n\t\ttry {\n\t\t\tjQuery('.cart_item').each(function () {\n\n\t\t\t\t// let productId = jQuery(this).find('[data-product_id]').data('product_id');\n\n\t\t\t\tlet url = new URL(jQuery(this).find('.product-remove').find('a').attr('href'));\n\t\t\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url);\n\n\t\t\t\t// console.log(productId)\n\n\t\t\t\tlet quantity = jQuery(this).find('.qty').val();\n\n\t\t\t\tif (quantity === 0) {\n\t\t\t\t\twpm.removeProductFromCart(productId);\n\t\t\t\t} else if (quantity < wpmDataLayer.cart[productId].quantity) {\n\t\t\t\t\twpm.removeProductFromCart(productId, wpmDataLayer.cart[productId].quantity - quantity);\n\t\t\t\t} else if (quantity > wpmDataLayer.cart[productId].quantity) {\n\t\t\t\t\twpm.addProductToCart(productId, quantity - wpmDataLayer.cart[productId].quantity);\n\t\t\t\t}\n\t\t\t});\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\t\t\twpm.getCartItemsFromBackend();\n\t\t}\n\t});\n\n\t// Fired when the user selects all the required dropdowns / attributes\n\t// https://stackoverflow.com/a/27849208/4688612\n\tjQuery(\".single_variation_wrap\").on('show_variation', function (event, variation) {\n\n\t\ttry {\n\t\t\t// Fired when the user selects all the required dropdowns / attributes\n\t\t\t// console.log('product selected');\n\t\t\t// console.log(variation);\n\n\t\t\tlet productId = getIdBasedOndVariationsOutputSetting(variation.variation_id);\n\n\t\t\tif (!productId) throw Error('Wasn\\'t able to retrieve a productId');\n\n\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\t// console.log('productId: ' + productId);\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId);\n\n\t\t\t\tjQuery(document).trigger('wpmViewItem', product);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\t\t}\n\t});\n\n\t// add_to_wishlist\n\t// body.on('click', '.add_to_wishlist, .wl-add-to', function () {\n\tjQuery(document).on('click', '.add_to_wishlist, .wl-add-to', function () {\n\t\t// jQuery('.add_to_wishlist, .wl-add-to').on('click', function () {\n\n\t\ttry {\n\t\t\t// console.log('add_to_wishlist');\n\t\t\t// console.log('this:' + jQuery(this).data('product-id'));\n\n\t\t\tlet productId;\n\n\t\t\tif (jQuery(this).data('productid')) { // for the WooCommerce wishlist plugin\n\t\t\t\tproductId = jQuery(this).data('productid');\n\t\t\t} else if (jQuery(this).data('product-id')) { // for the YITH wishlist plugin\n\t\t\t\tproductId = jQuery(this).data('product-id');\n\t\t\t}\n\n\t\t\tif (!productId) throw Error('Wasn\\'t able to retrieve a productId');\n\n\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId);\n\n\t\t\t// console.log('add_to_wishlist');\n\t\t\t// console.log(product);\n\n\t\t\tjQuery(document).trigger('wpmAddToWishlist', product);\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\t\t}\n\t})\n\n\t// body.on('updated_cart_totals', function () {\n\tjQuery(document).on('updated_cart_totals', function () {\n\n\t\tjQuery(document).trigger('wpmViewCart');\n\t});\n});\n\njQuery(document).ajaxSend(function (event, jqxhr, settings) {\n\t// console.log('settings.url: ' + settings.url);\n\n\tif (settings.url.includes('get_refreshed_fragments') && sessionStorage) {\n\t\tif (!sessionStorage.getItem('wpmMiniCartActive')) {\n\t\t\tsessionStorage.setItem('wpmMiniCartActive', JSON.stringify(true));\n\t\t}\n\t}\n});\n\n// populate the wpmDataLayer with the cart items\njQuery(window).on('load', function () {\n\t// console.log('getting cart');\n\n\ttry {\n\t\t// console.log('wpmMiniCartActive: ' + JSON.parse(sessionStorage.getItem('wpmMiniCartActive')));\n\t\t// if ( wpmDataLayer.shop.page_type === 'cart' || wpmDataLayer.shop.mini_cart.track === true) {\n\n\t\tif (\n\t\t\tJSON.parse(sessionStorage.getItem('wpmMiniCartActive')) && // if we detected calls to get_refreshed_fragments\n\t\t\tJSON.parse(sessionStorage.getItem('wpmFirstPageLoad')) && // when a new session is initiated there are no items in the cart, so we can save that call\n\t\t\twpmDataLayer.shop.mini_cart.track === true // if shop owner generally allows the plugin to track the mini cart\n\t\t) {\n\t\t\t// console.log('getting cart');\n\t\t\twpm.getCartItems();\n\n\t\t} else {\n\t\t\tsessionStorage.setItem('wpmFirstPageLoad', JSON.stringify(true));\n\t\t}\n\t} catch (e) {\n\t\tconsole.log(e);\n\t}\n});\n\n// get all add-to-cart= products from backend\njQuery(window).on('load', function () {\n\n\twpmDataLayer.products = wpmDataLayer.products || {};\n\t// wpmDataLayer.products = {14: 'x', 31: 'x', 16: 'x', 22: 'x', 40: 'x'};\n\n\t// scan page for add-to-cart= links\n\tlet productIds = wpm.getAddToCartLinkProductIds();\n\n\twpm.getProductsFromBackend(productIds);\n})\n\njQuery(window).on('load', function () {\n\n\t// can't use session storage as we can't read it from the server\n\tif (!wpm.getCookie('wpmReferrer')) {\n\n\t\tif (document.referrer) {\n\t\t\tlet referrerUrl = new URL(document.referrer);\n\t\t\tlet referrerHostname = referrerUrl.hostname;\n\n\t\t\tif (referrerHostname !== window.location.host) {\n\t\t\t\twpm.setCookie('wpmReferrer', referrerHostname);\n\t\t\t} else {\n\t\t\t\twpm.setCookie('wpmReferrer', '');\n\t\t\t}\n\n\t\t} else {\n\t\t\twpm.setCookie('wpmReferrer', '');\n\t\t}\n\t}\n})\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))"],"names":["wpm","$","undefined","fBUserData","getRandomEventId","Math","random","toString","substring","getFbUserData","getFbUserDataFromBrowser","setFbUserData","getCookie","navigator","userAgent","fbViewContent","product","window","fbq","eventId","name","dyn_r_ids","wpmDataLayer","pixels","facebook","dynamic_remarketing","id_type","shop","currency","price","jQuery","document","trigger","location","href","on","event","parseFloat","quantity","wpmExists","then","page_type","product_type","getMainProductIdFromProductPage","getProductDataForViewItemEvent","e","console","log","google","ads","status","general","variationsOutput","isVariable","send_events_with_parent_ids","googleConfigConditionsMet","gtag","send_to","conversionIds","items","id","google_business_vertical","products","key","Object","entries","push","wpmDeduper","wpmRestSettings","checkCookie","useRestEndpoint","isSessionStorageAvailable","isRestEndpointAvailable","isBelowRestErrorThreshold","sessionStorage","getItem","JSON","parse","testEndpoint","url","protocol","host","cookieName","ajax","type","timeout","statusCode","response","setItem","stringify","r","isWpmRestEndpointAvailable","writeOrderIdToStorage","orderId","Storage","localStorage","ids","includes","expiresDate","Date","setDate","getDate","cookie","toUTCString","storeOrderIdOnServer","orderDeduplication","isOrderIdStored","isEmail","email","test","removeProductFromCart","productId","quantityToRemove","Error","getIdBasedOndVariationsOutputSetting","cart","getProductDetailsFormattedForEvent","isVariation","parentId","addProductToCart","getCartItemsFromBackend","getCartItems","saveCartObjectToDataLayer","data","action","dataType","ajax_url","success","cartItems","getProductsFromBackend","productIds","filter","item","hasOwnProperty","length","assign","error","cartObject","fireCheckoutOption","step","checkout_option","value","fireCheckoutProgress","getPostIdFromString","string","match","triggerViewItemList","indexOf","viewItemListTriggerTestMode","target","css","append","find","viewItemListTrigger","opacity","backgroundColor","getSearchTermFromUrl","URLSearchParams","search","get","io","ioTimeouts","observerCallback","observer","forEach","entry","elementId","next","isIntersecting","setTimeout","testMode","repeat","unobserve","clearTimeout","remove","allIoElementsToWatch","ioid","startIntersectionObserverToWatch","has","IntersectionObserver","threshold","map","i","elem","parent","hasClass","prev","this","closest","each","observe","startProductsMutationObserverToWatch","productsNode","parents","first","productsMutationObserver","attributes","childList","characterData","MutationObserver","mutations","mutation","newNodes","addedNodes","hasWpmProductIdElement","siblings","setCookie","cookieValue","expiryDays","d","setTime","getTime","expires","ca","decodeURIComponent","split","c","charAt","order_id","nonce","getProductIdByCartItemKeyUrl","cartItemKey","cartItemKeys","getAddToCartLinkProductIds","attr","matches","list_name","brand","category","variant","list_position","position","parentId_dyn_r_ids","setReferrerToCookie","referrer","getReferrerFromCookie","getClidFromBrowser","clidCookieId","clidId","gclid","dclid","getUserAgent","getViewPort","width","max","documentElement","clientWidth","innerWidth","height","clientHeight","innerHeight","getComplianzCookies","cmplz_statistics","cmplz_marketing","analytics","visitorHasChosen","getCookieLawInfoCookies","analyticsCookie","adsCookie","wpmConsentValues","getConsentValues","updateConsentCookieValues","explicitConsent","decodeURI","categories","consents","statistics","marketing","mode","thirdparty","advanced","setConsentDefaultValuesToExplicit","scriptTagObserver","node","shouldScriptBeActive","unblockScript","blockScript","head","subtree","addEventListener","disconnect","cookie_consent_mgmt","explicit_consent","some","element","consent_mode","active","scriptNode","removeAttach","wpmSrc","appendTo","removeAttr","unblockAllScripts","index","unblockSelectedPixels","getVisitorConsentStatusAndUpdateGoogleConsentSettings","google_consent_settings","analytics_storage","ad_storage","updateGoogleConsentMode","Cookiebot","consent","detail","huObserver","hu","body","version","URL","Number","val","classes","one","nextAll","emailSelected","paymentMethodSelected","variation","variation_id","ajaxSend","jqxhr","settings","mini_cart","track","referrerHostname","hostname","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","__webpack_modules__","n","getter","__esModule","a","definition","o","defineProperty","enumerable","obj","prop","prototype","call"],"sourceRoot":""}