{"version":3,"file":"shelf-category-analytics-ba2712e0.js","sources":["../../../client/src/javascripts/customer_pages/_shelf-category/shelf-category-google-tag-manager.js","../../../client/src/javascripts/customer_pages/_shelf-category/shelf-category-omni-analytics.js"],"sourcesContent":["if (typeof dataLayer === 'object') {\n dataLayer.push({\n event: 'shelfPage',\n });\n}\n","import { builderDispatch, ShelfUI } from '../_utils/ui';\nimport Events from './flux-events';\n\nlet searchSerialNumber = 0;\n\n(function () {\n if (typeof s_omni !== 'object') return;\n\n const old_omni = {};\n\n const omni = {\n adid: s_omni.getQueryParam('adid'),\n fbref: s_omni.getQueryParam('fb_ref'),\n sourceid: s_omni.getQueryParam('sourceid'),\n povid: s_omni.getQueryParam('povid'),\n findingMethod: s_omni.getQueryParam('findingMethod'),\n getCampaignId() {\n if (this.adid) { return this.adid; }\n if (this.fbref) { return this.fbref.split('_')[1]; }\n if (this.sourceid) { return this.sourceid; } return '';\n },\n }; s_omni.campaign = omni.getCampaignId(); s_omni.channel = window.location.hostname;\n // Create IE + others compatible event handler\n const eventMethod = window.addEventListener ? 'addEventListener' : 'attachEvent';\n const eventer = window[eventMethod];\n const messageEvent = (eventMethod === 'attachEvent') ? 'onmessage' : 'message';\n\n function getEventName(event, eventType) {\n if (ShelfUI && eventType && eventType.hasOwnProperty(event)) {\n return eventType[event];\n }\n return 'Unknown';\n }\n\n // Click Event Listeners\n const clickDispatchToken = builderDispatch.register((payload) => {\n try {\n switch (payload.type) {\n // Left Hand Nav Selection Cases\n case Events.OMNI_FILTER_SELECTED:\n omniLinkClick('o', getEventName(payload.type, ShelfUI.EventStrings), payload.filter, payload.option, payload.succeeded);\n break;\n case Events.OMNI_FILTER_CLEARED:\n omniLinkClick('o', getEventName(payload.type, ShelfUI.EventStrings), `Filter ${payload.filter} Cleared`, '');\n break;\n case Events.SEARCH_CLEARED:\n omniLinkClick('o', getEventName(payload.type, ShelfUI.EventStrings), 'Clear Search', payload.option);\n break;\n case Events.SEARCH_SELECTED:\n ++searchSerialNumber;\n omniLinkClick('o', getEventName(payload.type, ShelfUI.EventStrings), 'Search Text:', payload.option, payload.succeeded);\n break;\n }\n } catch (e) {\n window.console && window.console.warn && window.console.warn(e);\n }\n });\n\n // Omni Dispatcher\n function omniLinkClick(linkType, omniLinkName, filter, option, searchSucceeded) {\n const s_linkTrackVarsTemp = s_omni.linkTrackVars;\n const s_linkTrackEventsTemp = s_omni.linkTrackEvents;\n\n s_omni.trackExternalLinks = false;\n s_omni.linkTrackVars = 'prop54';\n s_omni.linkTrackEvents = 'None';\n s_omni.prop1 = 'Shelf';\n s_omni.prop2 = `${s_omni.prop1} ${s_omni.pageName}, Selected Filter: ${filter} ${option}`;\n s_omni.events = 'event37';\n s_omni.eVar2 = undefined;\n s_omni.prop14 = undefined;\n\n if (filter.indexOf('Search') > -1 && filter.indexOf('Clear Search') < 0) {\n s_omni.prop1 = 'Search Shelf';\n delete s_omni.prop3;\n delete s_omni.prop4;\n delete s_omni.prop5;\n s_omni.events = searchSucceeded ? `event108, event109:${searchSerialNumber}` : `event108, event109:${searchSerialNumber}, event110`;\n s_omni.eVar2 = option;\n s_omni.prop14 = option;\n }\n s_omni.t(s_omni, linkType, 'Filter Select');\n\n // Reset\n s_omni.linkTrackVars = s_linkTrackVarsTemp;\n s_omni.linkTrackEvents = s_linkTrackEventsTemp;\n }\n\n // Clean Up\n window.addEventListener('unload', () => {\n builderDispatch.unregister(clickDispatchToken); // Clean up on exit\n });\n}());\n"],"names":["searchSerialNumber","omni","getEventName","event","eventType","ShelfUI","clickDispatchToken","builderDispatch","payload","Events","omniLinkClick","e","linkType","omniLinkName","filter","option","searchSucceeded","s_linkTrackVarsTemp","s_linkTrackEventsTemp"],"mappings":"0FAAI,OAAO,WAAc,UACvB,UAAU,KAAK,CACb,MAAO,WACX,CAAG,ECAH,IAAIA,EAAqB,GAExB,UAAY,CACX,GAAI,OAAO,QAAW,SAAU,OAIhC,MAAMC,EAAO,CACX,KAAM,OAAO,cAAc,MAAM,EACjC,MAAO,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