PageSourceSearch

https://www.astridandmiyu.com/cdn/shop/t/1379/assets/push-cart-tag…?v=6480595521350397251789975632

js astridandmiyu.com collected 2026-09-24 21:57:25 UTC 4,312 bytes, 5 lines download raw bytes

1const{getElement,waitForConsentSettingsAvailability}=window.BAO.Utils;class PushCartTagalysRecommendations extends window.BAO.CustomElement(){connectedCallback(){super.connectedCallback();const aside=this.externalEls["drawer-aside"]?.element;aside&&aside.setAttribute("aria-hidden","true")}setupListeners(){super.setupListeners(),this.fetchTagalysRecommendations=this.fetchTagalysRecommendations.bind(this),this.setupTagalysRecs(),window.addEventListener("resize",()=>{this.visibility=this.checkVisibility()}),this.onCartChanged=this.onCartChanged.bind(this),this.onAfterRender=this.onAfterRender.bind(this),window.BAO.eventBus.addEventListener(window.BAO.EVENTS.PUSH_CART.AFTER_ADD,this.onCartChanged),window.BAO.eventBus.addEventListener(window.BAO.EVENTS.PUSH_CART.AFTER_UPDATE_REMOVE_ITEM,this.onCartChanged),window.BAO.eventBus.addEventListener(window.BAO.EVENTS.PUSH_CART.AFTER_RENDER,this.onAfterRender)}setupTagalysRecs(){window?.onTagalysReady&&this.widgetId&&this.visibility&&onTagalysReady(()=>{waitForConsentSettingsAvailability(()=>{this.fetchTagalysRecommendations()})})}onCartChanged(e){const state=e?.detail?.state;this.dataset.type!=="SmartWidget"&&(state?.items?.length||(window.tagalysCartRecs=null,this.setSectionVisibility(!1)))}onAfterRender(){if(this.dataset.type==="SmartWidget")return;const cartStateEl=document.querySelector("[data-cart-state]");if(!cartStateEl?.innerHTML)return;let state;try{state=JSON.parse(cartStateEl.innerHTML)}catch{return}const productIds=(state?.items??[]).map(item=>item.product_id).filter(Boolean),productIdsStr=productIds.join(",");if(productIds.length===0){window.tagalysCartRecs=null,this.setSectionVisibility(!1);return}window.tagalysCartRecs=null,this.setSectionVisibility(!1),this.dataset.productId=productIdsStr,waitForConsentSettingsAvailability(()=>{typeof window?.onTagalysReady=="function"?onTagalysReady(()=>this.fetchTagalysRecommendations()):this.fetchTagalysRecommendations()})}async fetchTagalysRecommendations(){if(window.tagalysCartRecs?.length>0){const cards=await this.createProductCards(window.tagalysCartRecs),hasCards=typeof cards=="string"?cards.trim().length>0:!1;this.renderCarousel(cards),this.setSectionVisibility(hasCards)}else try{const response=await this.getTagalysRecommendations();if((response?.products?.length??0)>0){window.tagalysCartRecs=response.products;const cards=await this.createProductCards(response.products),hasCards=typeof cards=="string"?cards.trim().length>0:!1;this.renderCarousel(cards),this.setSectionVisibility(hasCards)}else this.setSectionVisibility(!1)}catch(error){this.handleError(error),this.setSectionVisibility(!1)}}setSectionVisibility(open){const aside=this.externalEls["drawer-aside"]?.element;aside&&aside.setAttribute("aria-hidden",open?"false":"true")}getTagalysRecommendations(){const productIds=(this.dataset.productId||"").split(",").filter(Boolean);return new Promise((resolve,reject)=>{window.Tagalys.APIConnector.Recommendations.call({params:{recommendationId:this.widgetId,count:this.limit,productIds},onSuccess:response=>resolve(response),onFailure:error=>reject(error)})})}async createProductCards(products){return(await Promise.all(products.map(async product=>{const productUrl=`${window.Shopify.routes.root}products/${product.handle}`;try{const res=await window.BAO.sectionRenderer.fetchSingle("push-cart-recommendations-item",productUrl),article=window.BAO.sectionRenderer.convertToDOM(res).querySelector("li");return article?`${article.outerHTML}`:""}catch(error){return this.handleError(error),""}}))).join("")}renderCarousel(cards){const targetEl=getElement(".psh-Recommendations_Body",{context:this});targetEl&&(targetEl.innerHTML=`
2      <ul class="psh-Recommendations_List">
3        ${cards}
4      </ul>`)}handleError(error){console.error("Error:",error)}get limit(){return this.dataset.limit||8}get widgetId(){return this.dataset.widgetId||""}get visibility(){return this._visibility||this.checkVisibility()}set visibility(value){value!==this._visibility&&(this.setupTagalysRecs(),this._visibility=value)}}customElements.get("push-cart-tagalys-recommendations")||customElements.define("push-cart-tagalys-recommendations",PushCartTagalysRecommendations);
5//# sourceMappingURL=/cdn/shop/t/1379/assets/push-cart-tagalys-recommendations.js.map?v=6480595521350397251789975632

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.