1import { D as Directive, j as getLastSeenPromo, k as SuperTracker, H as HostAttr, b as HostChildren, a as autobind } from './bundled-app.js'; 2import { H as HostChild } from './bundled-HostChild.js'; 3import { H as HostListener } from './bundled-HostListener.js'; 4 5function t(t,e,i,o){var r,n=arguments.length,s=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(r=t[c])&&(s=(n<3?r(s):n>3?r(e,i,s):r(e,i))||s);return n>3&&s&&Object.defineProperty(e,i,s),s}function e(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}class ProductCard extends Directive{onAppDestroy(){this._intersectionObserver?.disconnect(),this.host.removeEventListener("click",this.onClick),this.wishlistBtn?.removeEventListener("click",this.onWishlistClick),this.btns.forEach(t=>t.removeEventListener("click",this.onBtnClick));}onHostClick(t){let e=window.getSelection().toString();if(t.metaKey||t.ctrlKey){window.open(this.link.getAttribute("href"),"_blank");return}let i=t.target.closest(".productCard__link");e||!this.link||i||(t.__productCardHandled=!0,this.link.click());}onAppInit(){this.bindEvents();}bindEvents(){this._intersectionObserver=new IntersectionObserver(this.onIntersectionChange,{threshold:.5}),this._intersectionObserver.observe(this.host),this.host.addEventListener("click",this.onClick),this.wishlistBtn?.addEventListener("click",this.onWishlistClick),this.btns.forEach(t=>{t.addEventListener("click",this.onBtnClick);});}onClick(t){if(t.__productCardHandled)return;let e=t.target,i=this.host.querySelector(".productCard__swatches");if(i?.contains(e)){t.preventDefault(),t.stopPropagation();return}let r=getLastSeenPromo();r&&(this.dataLayerConfig.promotion_id=r.promotion_id,this.dataLayerConfig.promotion_name=r.promotion_name);let n=this.getListName(),s={event:"select_item",ecommerce:{currency:window.Shopify.currency.active,view_type:this.getListName(),items:[{...this.dataLayerConfig,item_list_id:n,item_list_name:n,module_type:n}]},_clear:!0};this.host.closest("[promotional-tracking]")||"/"===window.location.pathname||SuperTracker.getInstance().trackGa(s);}onWishlistClick(t){t.preventDefault(),t.stopPropagation();}onBtnClick(t){t.preventDefault(),t.stopPropagation();}getListName(){let t=this.host.closest("[datalayer-item-list-name]"),e=t||this.host.closest(".shopify-section"),i=e?.querySelector("h1, h2, h3, h4, h5, h6");return t?.getAttribute("datalayer-item-list-name")||i?.textContent||"Unnamed List"}isPromotionGrid(){return !!this.host.closest(".collectionListing__items[promotional-tracking]")}onIntersectionChange(t,e){t.forEach(t=>{if(t.isIntersecting){e.disconnect();let t=this.getListName(),i=this.isPromotionGrid()?"view_promotion":"view_item_list";if(this.host.closest("[promotional-tracking][silent]"))return;let r=this.getListName();ProductCard.productsQueue[t]=ProductCard.productsQueue[t]||{items:[],timer:null,type:i},ProductCard.productsQueue[t].items.push({...this.dataLayerConfig,module_type:r,item_list_id:r,item_list_name:r}),clearTimeout(ProductCard.productsQueue[t].timer);let n=getLastSeenPromo(),s=ProductCard.productsQueue[t].items;n&&s.forEach(t=>{t.promotion_id=n.promotion_id,t.promotion_name=n.promotion_name;}),ProductCard.productsQueue[t].timer=setTimeout(()=>{SuperTracker.getInstance().trackGa({event:ProductCard.productsQueue[t].type,ecommerce:{currency:window.Shopify.currency.active,module_type:t,items:s},_clear:!0}),delete ProductCard.productsQueue[t];},1e3);}});}}ProductCard.selector=".productCard:not(.productCard--skeleton)",ProductCard.productsQueue={},t([HostChild(".productCard__link"),e("design:type","undefined"==typeof HTMLElement?Object:HTMLElement)],ProductCard.prototype,"link",void 0),t([HostAttr("=datalayer-config",!1,t=>(Object.keys(t).forEach(e=>{"undefined"===t[e]&&(t[e]=void 0);}),t)),e("design:type",Object)],ProductCard.prototype,"dataLayerConfig",void 0),t([HostListener("click"),e("design:type",Function),e("design:paramtypes",["undefined"==typeof PointerEvent?Object:PointerEvent]),e("design:returntype",void 0)],ProductCard.prototype,"onHostClick",null),t([HostChildren("button"),e("design:type","undefined"==typeof NodeListOf?Object:NodeListOf)],ProductCard.prototype,"btns",void 0),t([HostChild(".wk-button"),e("design:type","undefined"==typeof HTMLElement?Object:HTMLElement)],ProductCard.prototype,"wishlistBtn",void 0),t([autobind,e("design:type",Function),e("design:paramtypes",["undefined"==typeof MouseEvent?Object:MouseEvent]),e("design:returntype",void 0)],ProductCard.prototype,"onClick",null),t([autobind,e("design:type",Function),e("design:paramtypes",[Array,"undefined"==typeof IntersectionObserver?Object:IntersectionObserver]),e("design:returntype",void 0)],ProductCard.prototype,"onIntersectionChange",null); 6 7export { ProductCard };
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.