PageSourceSearch

https://www.dermalogica.co.uk/cdn/shop/t/333/assets/product-recommendations.js?v=97926535033848065771779255448

js dermalogica.co.uk collected 2026-09-24 21:06:47 UTC 3,247 bytes, 2 lines download raw bytes

1class ProductRecommendations extends HTMLElement{#intersectionObserver=new IntersectionObserver((entries,observer)=>{entries[0]?.isIntersecting&&(observer.disconnect(),this.#loadRecommendations())},{rootMargin:"0px 0px 400px 0px"});#mutationObserver=new MutationObserver(mutations=>{for(const mutation of mutations)if(!(mutation.target!==this||mutation.type!=="attributes")&&!(mutation.attributeName==="data-recommendations-performed"&&this.dataset.recommendationsPerformed==="true")){this.#loadRecommendations();break}});#cachedRecommendations={};#activeFetch=null;connectedCallback(){this.#intersectionObserver.observe(this),this.#mutationObserver.observe(this,{attributes:!0})}#loadRecommendations(){const{productId,recommendationsPerformed,sectionId,intent}=this.dataset,id=this.id;if(!productId||!id)throw new Error("Product ID and an ID attribute are required");recommendationsPerformed!=="true"&&this.#fetchCachedRecommendations(productId,sectionId,intent).then(result=>{if(!result.success){Shopify.designMode||this.#handleError(new Error(`Server returned ${result.status}`));return}const html=document.createElement("div");html.innerHTML=result.data||"";const recommendations=html.querySelector(`product-recommendations[id="${id}"]`);recommendations?.innerHTML&&recommendations.innerHTML.trim().length?(this.dataset.recommendationsPerformed="true",this.innerHTML=recommendations.innerHTML,this.#initializeReviewsIO()):this.#handleError(new Error("No recommendations available"))}).catch(e=>{this.#handleError(e)})}async#fetchCachedRecommendations(productId,sectionId,intent){const url=`${this.dataset.url}&product_id=${productId}&section_id=${sectionId}&intent=${intent}`,cachedResponse=this.#cachedRecommendations[url];if(cachedResponse)return{success:!0,data:cachedResponse};this.#activeFetch?.abort(),this.#activeFetch=new AbortController;try{const response=await fetch(url,{signal:this.#activeFetch.signal});if(!response.ok)return{success:!1,status:response.status};const text=await response.text();return this.#cachedRecommendations[url]=text,{success:!0,data:text}}finally{this.#activeFetch=null}}#handleError(error){console.error("Product recommendations error:",error),this.classList.add("hidden"),this.dataset.error="Error loading product recommendations"}#initializeReviewsIO(retryCount=0){if(typeof window.ratingSnippet!="function"){retryCount<10&&setTimeout(()=>this.#initializeReviewsIO(retryCount+1),100);return}if(this.querySelectorAll(".ruk_rating_snippet").length>0)try{const starColor=typeof window.getReviewsIoStarColor=="function"?window.getReviewsIoStarColor():"#FFC830";window.ratingSnippet?.("ruk_rating_snippet",{store:"dermalogica1",mode:"default",color:starColor,linebreak:!1,text:"Reviews",singularText:"Review",lang:"en",usePolaris:!1,showEmptyStars:!1,enableSyndication:!0}),typeof window.enforceReviewCountVisibility=="function"&&window.enforceReviewCountVisibility()}catch(error){console.warn("Failed to initialize Reviews.io rating snippets for product recommendations:",error)}}}customElements.get("product-recommendations")||customElements.define("product-recommendations",ProductRecommendations);
2//# sourceMappingURL=/cdn/shop/t/333/assets/product-recommendations.js.map?v=97926535033848065771779255448

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.