{"version":3,"file":"dfc.timex.ga4.min.js","sources":["dfc.timex.ga4.js"],"sourcesContent":["\"use strict\";\n\ndfc.safe(async () => {\n const log = dfc.log.bind(dfc, 'ga4');\n log('running');\n if (/demandware\\.net$/i.test(location.hostname)) return log('disabled');\n\n // cspell: disable\n const G_CODE = (hn => {\n if (/timex\\.ca/i.test(hn)) return 'G-2QDEYZNVJD';\n if (/timex\\.(eu|it|de|es|fr)/i.test(hn)) return 'G-3MMDXB6ZS1';\n if (/timex\\.co\\.uk/i.test(hn)) return 'G-SEFJSKJWY5';\n if (/timex\\.com/i.test(hn)) return 'G-J0GB29QS3H';\n if (/gcwatches\\.com/i.test(hn)) return 'G-2R28LT9XP0';\n if (/guesswatches\\.com/i.test(hn)) return 'G-2R28LT9XP0';\n })(location.hostname);\n // cspell: enable\n\n if (!G_CODE) return log(`No G_CODE for ${location.hostname}`);\n if (dfc.env !== 'dev') dfc.loadScript(`https://www.googletagmanager.com/gtag/js?id=${G_CODE}`);\n window.dataLayer = window.dataLayer || [];\n /*global dataLayer*/\n function gtag() {\n if (dfc.env !== 'dev') dataLayer.push(arguments);\n log('gtag', ...arguments);\n }\n dfc.track = event_name => {\n // eslint-disable-next-line no-console\n if (/^[a-z0-9_]+$/.test(event_name)) return console.error('event_name required to match ^[a-z0-9_]+$');\n gtag('event', event_name);\n };\n await dfc.waitFor(() => window.utag_data);\n const _get = k => {\n return window.utag_data[k];\n };\n const _getArray = k => _get(k) || [];\n const page_name = _get('page_name');\n const page_type = _get('page_type');\n const page_context_type = _get('page_context_type');\n const page_context_title = _get('page_context_title');\n const user_anonymous = _get('user_anonymous');\n const user_authenticated = _get('user_authenticated');\n const user_registered = _get('user_registered');\n const customer_id = _get('customer_id');\n const locale = _get('locale');\n const flow_experience = _get('flow_experience');\n const currency = (() => {\n try {\n return JSON.parse(localStorage.getItem('_f60_session')).experience.currency;\n } catch (e) {\n // continue\n }\n\n // try from dl for order if exist\n const orderCurrency = _get('order_currency');\n if (orderCurrency) return orderCurrency;\n\n // \n const flowSession = document.getElementById('js-flow-session');\n if (flowSession && flowSession.dataset && flowSession.dataset.currency) {\n return flowSession.dataset.currency;\n }\n const currencyCode = window.googlepayvariables && window.googlepayvariables.currencyCode;\n if (currencyCode) {\n return currencyCode;\n }\n const hn = location.hostname;\n if (/^(www\\.)?timex\\.ca$/i.test(hn)) return 'CAD';\n if (/^(www\\.)?timex\\.(eu|it|de|es|fr)$/i.test(hn)) return 'EUR';\n if (/^(www\\.)?timex\\.co\\.uk$/i.test(hn)) return 'GBP';\n if (/^(www\\.)?timex\\.com$/i.test(hn)) return 'USD';\n if (/^(www\\.)?gcwatches\\.com$/i.test(hn)) return 'USD';\n\n // default\n return 'USD';\n })();\n\n // trim down to avoid undefined issues\n\n gtag('js', new Date());\n gtag('config', G_CODE, {\n page_name,\n page_type,\n page_context_type,\n page_context_title,\n user_anonymous,\n user_authenticated,\n user_registered,\n user_id: customer_id,\n locale,\n flow_experience\n });\n const $ = await dfc.jQuery;\n const _itemFromData = data => {\n // \n return {\n item_id: data.prdSku,\n item_name: data.prdName,\n currency,\n index: parseInt(data.prdPos, 10),\n item_brand: data.prdBrand,\n item_category: data.prdCat,\n item_list_id: data.prdList,\n item_variant: data.prdId,\n price: parseFloat(data.prdPrice),\n quantity: 1\n };\n };\n const _setStock = item => {\n const in_stock = function () {\n try {\n if (document.querySelector('.in-stock-msg')) return 'in_stock';\n if (document.querySelector('#email-when-in-stock')) return 'email_when_in_stock';\n if (document.querySelector('.not-available-msg')) return 'out_of_stock';\n // quickview\n //