1"use strict";(self.webpackChunk_mvps_genesis_quickstart_theme=self.webpackChunk_mvps_genesis_quickstart_theme||[]).push([[6650],{6650:(t,e,i)=>{i.d(e,{default:()=>s});var a=i(7889);const s=class{constructor(t){this.context=t,this.classes={eventClick:"js-gtm-event-click",impression:"js-gtm-impression",list:"js-gtm-list",promo:"js-gtm-promo",promoLink:"js-gtm-promo-link"},this.attributes={eventClick:"data-event-click-event",impression:"data-impression-event-sent",productClick:"data-product-click-event",promo:"data-promo-event-sent",promoLink:"data-promo-click-event"}}init(){this.dataLayerCheck(),this.setLists(),this.bindEvents(),this.getImpressions(),this.getPromos()}bindEvents(){this.bindLazyLoads(),this.addToCartEventListener(),this.multiAddToCartEventListener(),this.bindClickEvents()}bindClickEvents(){this.bindProductClickEvents(),this.bindEventClickEvents(),this.bindPromoClicks()}bindLazyLoads(){this.bindLazyPromos(),this.bindLazyImpressions()}addToCartEventListener(){a.default.addEventListener("MVPS:addToCart",(t=>{if(t.detail&&t.detail.success&&t.detail.form){const e=document.getElementById("price-value");if(e){const i=t.detail.form.querySelector('input[name="Quantity"]'),a=Number(e.innerHTML.replace(/[^0-9.-]+/g,""));let s=this.productData(t.detail.form);s.price=a,s.quantity=i?parseInt(i.value,10):1,this.addToCart([s],this.context.Currency_Code)}}}))}multiAddToCartEventListener(){a.default.addEventListener("MVPS:multiAddToCart",(t=>{if(!t.detail?.success||!Array.isArray(t.detail?.iterations))return;const e=[];t.detail.iterations.forEach((t=>{if(!t.form||!t.formData)return;const i=this.productData(t.form),a=t.formData;i.price=Number(a.get("Variant_Price")?.replace(/[^0-9.-]+/g,"")??0),i.quantity=parseInt(a.get("Quantity")??1,10),i.item_variant=a.get("Variant_Part_Code")??"",e.push(i)})),e.length&&this.addToCart(e,this.context.Currency_Code)}))}addToCart(t,e){this.dataLayerCheck(),this.clearEcommerce(),window.dataLayer.push({ecommerce:{add:{products:t},currencyCode:e},event:"addToCart",ga_event_action:"Add To Cart",ga_event_category:"Ecommerce",ga_event_label:"",ga_event_noninteraction_hit:!1,ga_event_value:""})}setLists(){const t=document.getElementsByClassName(this.classes.list);if(t&&t.length)for(const e of t){const t=e.getAttribute("data-gtm-list")||this.determineList();if(!t)continue;const i=e.getElementsByClassName(this.classes.impression);let a=0;for(const e of i)a++,e.getAttribute("data-gtm-list")||e.setAttribute("data-gtm-list",t),e.getAttribute("data-gtm-position")||e.setAttribute("data-gtm-position",a)}}determineList(){switch(this.context.Screen){case"CTGY":return"Category Listing";case"SRCH":return"Search Listing";case"PLST":return"Product Listing";default:return""}}getImpressions(){const t=document.getElementsByClassName(this.classes.impression),e=[];for(const i of t)i.classList.contains("lazyload")&&!i.classList.contains("lazyloaded")||i.getAttribute(this.attributes.impression)||e.push(i);this.sendImpressions(e,this.context.Currency_Code)}sendImpressions(t,e){if(!t||!t.length)return;this.dataLayerCheck();const i=[];for(const e of t)e.getAttribute(this.attributes.impression)||(e.setAttribute(this.attributes.impression,!0),i.push(this.productData(e)));i.length&&(this.clearEcommerce(),window.dataLayer.push({ecommerce:{currencyCode:e,impressions:i},event:"impressions",ga_event_action:"Impressions",ga_event_category:"Ecommerce",ga_event_label:"",ga_event_noninteraction_hit:!0,ga_event_value:""}))}bindLazyImpressions(){document.addEventListener("lazybeforeunveil",(t=>{if(!t.target.classList.contains(this.classes.impression))return;const e=t.target;e.getAttribute(this.attributes.impression)||this.sendImpressions([e],this.context.Currency_Code)}))}bindProductClickEvents(){const t=document.getElementsByClassName(this.classes.impression);for(const e of t){const t=this.productData(e),i=e.getElementsByTagName("a");"A"===e.nodeName&&this.bindProductClickEvent(e,t);for(const e of i)this.bindProductClickEvent(e,t)}}bindProductClickEvent(t,e){t.getAttribute(this.attributes.productClick)||(t.setAttribute(this.attributes.productClick,!0),t.addEventListener("click",(i=>this.productClick(i,t,e))))}
1productClick(t,e,i){if(void 0===window.google_tag_manager)return;this.dataLayerCheck();const a=e.getAttribute("href");t&&a&&t.preventDefault(),this.clearEcommerce(),window.dataLayer.push({ecommerce:{click:{actionField:{list:e.getAttribute("data-gtm-list")||""},products:[i]}},event:"productClick",eventCallback:()=>{this.clickEventCallback(t,a)},eventTimeout:1500,ga_event_action:"Product Click",ga_event_category:"Ecommerce",ga_event_label:"",ga_event_noninteraction_hit:!1,ga_event_value:""})}productData(t){const e={brand:t.getAttribute("data-gtm-brand")||"",id:t.getAttribute("data-gtm-id")||"",item_brand:t.getAttribute("data-gtm-brand")||"",item_id:t.getAttribute("data-gtm-id")||"",item_list_id:t.getAttribute("data-gtm-list")?this.slugify(t.getAttribute("data-gtm-list")):"",item_list_name:t.getAttribute("data-gtm-list")||"",item_name:t.getAttribute("data-gtm-name")||"",name:t.getAttribute("data-gtm-name")||"",position:t.getAttribute("data-gtm-position")||"",price:t.getAttribute("data-gtm-price")},i=(t.getAttribute("data-gtm-category")||"").split("|").reverse(),a=i.length;if(a){const t=[];for(let s=0;s<a&&5!==s;s++){const a=i[s];let n="item_category";s>0&&(n+=s+1),e[n]=a,t.push(a)}e.category=t.reverse().join("/")}return e}clickEventCallback(t,e){t&&e&&(t.ctrlKey||t.metaKey?window.open(e,"_blank").focus():t.shiftKey?window.open(e):document.location=e)}bindEventClickEvents(){const t=document.getElementsByClassName(this.classes.eventClick);for(const e of t)e.getAttribute(this.attributes.eventClick)||(e.setAttribute(this.attributes.eventClick,!0),e.addEventListener("click",(t=>this.eventClick(t,e))))}eventClick(t,e){if(void 0===window.google_tag_manager)return;this.dataLayerCheck();const i=e.getAttribute("href");t&&i&&t.preventDefault(),this.clearEcommerce(),this.sendEvent({action:e.getAttribute("data-gtm-action")||"",category:e.getAttribute("data-gtm-category")||"",event:t,label:e.getAttribute("data-gtm-label")||"",link:i,noninteractionHit:!1,value:e.getAttribute("data-gtm-value")||""})}getPromos(){const t=document.getElementsByClassName(this.classes.promo);let e=[];for(const i of t)i.classList.contains("lazyload")&&!i.classList.contains("lazyloaded")||i.getAttribute(this.attributes.promo)||(i.setAttribute(this.attributes.promo,!0),e.push(this.promoData(i)));0!==e.length&&this.sendPromos(e)}promoData(t){return{creative:t.getAttribute("data-gtm-promo-creative")||"",creative_name:t.getAttribute("data-gtm-promo-creative")||"",id:t.getAttribute("data-gtm-promo-id")||"",name:t.getAttribute("data-gtm-promo-name")||"",position:t.getAttribute("data-gtm-promo-position")||"",promotion_id:t.getAttribute("data-gtm-promo-id")||"",promotion_name:t.getAttribute("data-gtm-promo-name")||""}}sendPromos(t){0!==t.length&&(this.dataLayerCheck(),this.clearEcommerce(),window.dataLayer.push({ecommerce:{promoView:{promotions:t}},event:"view_promotions"}))}bindLazyPromos(){document.addEventListener("lazybeforeunveil",(t=>{if(!t.target.classList.contains(this.classes.promo))return;const e=t.target;e.getAttribute(this.attributes.promo)||(e.setAttribute(this.attributes.promo,!0),this.sendPromos([this.promoData(e)]))}))}bindPromoClicks(){const t=document.getElementsByClassName(this.classes.promoLink);for(const e of t)e.getAttribute(this.attributes.promoLink)||(e.setAttribute(this.attributes.promoLink,!0),e.addEventListener("click",(t=>this.promoClick(t,e))))}promoClick(t,e){if(void 0===window.google_tag_manager)return;this.dataLayerCheck();const i=e.getAttribute("href");t&&i&&t.preventDefault(),this.clearEcommerce(),window.dataLayer.push({ecommerce:{promoClick:{promotions:[this.promoData(e)]}},event:"promotion_click",eventCallback:()=>{this.clickEventCallback(t,i)},eventTimeout:1500,ga_event_action:"Promotion Click",ga_event_category:"Ecommerce",ga_event_label:"",ga_event_noninteraction_hit:!1,ga_event_value:""})}sendEvent(t){this.dataLayerCheck(),window.dataLayer.push({event:"ga_event",eventCallback:()=>{this.clickEventCallback(t.event,t.link)},eventTimeout:1500,ga_event_action:t.action,ga_event_category:t.category,ga_event_label:t.label,ga_event_noninteraction_hit:t.noninteraction_hit,ga_event_value:t.value})}dataLayerCheck(){window.dataLayer=window.dataLayer||[]}clearEcommerce(){this.dataLayerCheck(),window.dataLayer.push({ecommerce:null})}slugify(t){return t.toLowerCase().replace(/[^\w ]+/g,"").replace(/ +/g,"-")}}}}]); 2//# sourceMappingURL=6650.f8bab9bc87b7cb2f6aa5.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.