PageSourceSearch

https://ifethomas.com/cdn/shop/t/42/assets/product-info.js?v=159581681776331687511772969367

js ifethomas.com collected 2026-10-08 03:52:52 UTC 7,235 bytes, 2 lines download raw bytes

1customElements.get("product-info")||customElements.define("product-info",class extends HTMLElement{quantityInput=void 0;quantityForm=void 0;onVariantChangeUnsubscriber=void 0;cartUpdateUnsubscriber=void 0;abortController=void 0;pendingRequestUrl=null;preProcessHtmlCallbacks=[];postProcessHtmlCallbacks=[];constructor(){super(),this.quantityInput=this.querySelector(".js-quantity-selector-input")}connectedCallback(){this.initializeProductSwapUtility(),this.onVariantChangeUnsubscriber=subscribe(PUB_SUB_EVENTS.optionValueSelectionChange,this.handleOptionValueChange.bind(this)),this.initQuantityHandlers(),this.dispatchEvent(new CustomEvent("product-info:loaded",{bubbles:!0}))}addPreProcessCallback(callback){this.preProcessHtmlCallbacks.push(callback)}initQuantityHandlers(){this.quantityInput&&(this.quantityForm=this.querySelector(".js-quantity-selector-wrapper"),this.quantityForm)}disconnectedCallback(){this.onVariantChangeUnsubscriber(),this.cartUpdateUnsubscriber?.()}initializeProductSwapUtility(){this.postProcessHtmlCallbacks.push(newNode=>{window?.Shopify?.PaymentButton?.init(),window?.ProductModel?.loadShopifyXR()})}handleOptionValueChange({data:{event,target,selectedOptionValues}}){if(!this.contains(event.target))return;this.resetProductFormState();const productUrl=target.dataset.productUrl||this.pendingRequestUrl||this.dataset.url;this.pendingRequestUrl=productUrl;const shouldSwapProduct=this.dataset.url!==productUrl,shouldFetchFullPage=this.dataset.updateUrl==="true"&&shouldSwapProduct;this.renderProductInfo({requestUrl:this.buildRequestUrlWithParams(productUrl,selectedOptionValues,shouldFetchFullPage),targetId:target.id,callback:shouldSwapProduct?this.handleSwapProduct(productUrl,shouldFetchFullPage):this.handleUpdateProductInfo(productUrl)})}resetProductFormState(){const productForm=this.productForm;productForm?.toggleSubmitButton(!0),productForm?.handleErrorMessage()}handleSwapProduct(productUrl,updateFullPage){return html=>{const selector=updateFullPage?"product-info[id^='MainProduct']":"product-info",variant=this.getSelectedVariant(html.querySelector(selector));this.updateURL(productUrl,variant?.id),updateFullPage?(document.querySelector("head title").innerHTML=html.querySelector("head title").innerHTML,HTMLUpdateUtility.viewTransition(document.querySelector("main"),html.querySelector("main"),this.preProcessHtmlCallbacks,this.postProcessHtmlCallbacks)):HTMLUpdateUtility.viewTransition(this,html.querySelector("product-info"),this.preProcessHtmlCallbacks,this.postProcessHtmlCallbacks)}}renderProductInfo({requestUrl,targetId,callback}){this.abortController?.abort(),this.abortController=new AbortController,fetch(requestUrl,{signal:this.abortController.signal}).then(response=>response.text()).then(responseText=>{this.pendingRequestUrl=null;const html=new DOMParser().parseFromString(responseText,"text/html");callback(html)}).then(()=>{document.getElementById(`${targetId}`)?.focus()}).catch(error=>{error.name==="AbortError"?console.log("Fetch aborted by user"):console.error(error)})}getSelectedVariant(productInfoNode){const selectedVariant=productInfoNode.querySelector("variant-selects [data-selected-variant]")?.innerHTML;return selectedVariant?JSON.parse(selectedVariant):null}buildRequestUrlWithParams(url,optionValues,shouldFetchFullPage=!1){const params=[];return!shouldFetchFullPage&&params.push(`section_id=${this.sectionId}`),optionValues.length&&params.push(`option_values=${optionValues.join(",")}`),`${url}?${params.join("&")}`}updateOptionValues(html){const newVariantSelects=html.querySelectorAll("variant-selects"),oldVariantSelects=this.querySelectorAll("variant-selects");newVariantSelects&&newVariantSelects.forEach((newVariantSelect,index)=>{HTMLUpdateUtility.viewTransition(oldVariantSelects[index],newVariantSelects[index],this.preProcessHtmlCallbacks)})}handleUpdateProductInfo(productUrl){return html=>{const variant=this.getSelectedVariant(html),mediaId=variant?.featured_media?.id,productId=variant?.featured_image?.product_id;if(mediaId&&productId&&this.updateMedia(mediaId,productId),this.updateSelectedVariant(variant?.id),this.pickupAvailability?.update(variant),this.updateOptionValues(html),this.updateURL(productUrl,variant?.id),this.updateV
1ariantInputs(variant?.id),!variant){this.setUnavailable();return}const updateSourceFromDestination=(id,shouldHide=source=>!1)=>{const source=html.getElementById(`${id}-${this.sectionId}`),destination=this.querySelector(`#${id}-${this.dataset.section}`);source&&destination&&(destination.innerHTML=source.innerHTML,destination.classList.toggle("display--hidden",shouldHide(source)))};updateSourceFromDestination("Price"),updateSourceFromDestination("SkuBarcode",({classList})=>classList.contains("display--hidden")),updateSourceFromDestination("Inventory",({innerText})=>innerText===""),updateSourceFromDestination("ProductQuickAdd",({classList})=>classList.contains("display--hidden")),this.productForm?.toggleSubmitButton(html.getElementById(`ProductSubmitButton-${this.sectionId}`)?.hasAttribute("disabled")??!0,window.variantStrings.soldOut),publish(PUB_SUB_EVENTS.variantChange,{data:{sectionId:this.sectionId,html,variant}})}}updateMedia(mediaId,productId){if(!mediaId||!productId)return;const mediaGallery=document.getElementById(`MediaGallery-${this.sectionId}-${productId}`),productCardMediaGallery=document.getElementById(`ProductCardMediaGallery-${this.sectionId}-${productId}`);mediaGallery?(mediaGallery.setActiveMedia(`${this.sectionId}-${productId}-${mediaId}`,!0),mediaGallery.updateThumbnail(mediaId)):productCardMediaGallery&&productCardMediaGallery.setActiveMedia(`${this.sectionId}-${productId}-${mediaId}`,!0)}updateSelectedVariant(variantId){this.querySelectorAll("input[data-main-product-id]").forEach(input=>{input.value=variantId})}updateVariantInputs(variantId){const productFormInstallments=document.getElementById(`product-form-installment-${this.dataset.section}`);let inputsToUpdate=[];productFormInstallments?(inputsToUpdate.push(...this.querySelectorAll("input[data-main-product-id]")),inputsToUpdate.push(productFormInstallments.querySelector('input[name="id"]'))):inputsToUpdate.push(...this.querySelectorAll("input[data-main-product-id]")),inputsToUpdate.forEach(input=>{input.value=variantId??"",input.dispatchEvent(new Event("change",{bubbles:!0}))})}updateURL(url,variantId){const updatedURL=`${url}${variantId?`?variant=${variantId}`:""}`,socialShares=document.querySelectorAll("social-share");this.dataset.updateUrl!=="false"&&(window.history.replaceState({}
1,"",updatedURL),socialShares.forEach(socialShare=>{socialShare.updateShareUrl(updatedURL)}))}setUnavailable(){this.productForm?.toggleSubmitButton(!0,window.variantStrings.unavailable);const selectors=["price","Inventory","SkuBarcode","ProductQuickAdd"].map(id=>`#${id}-${this.dataset.section}`).join(", ");document.querySelectorAll(selectors).forEach(({classList})=>classList.add("display--hidden"))}get productForm(){return this.querySelector("product-form")}get pickupAvailability(){return this.querySelector("pickup-availability")}get sectionId(){return this.dataset.originalSection||this.dataset.section}});
2//# sourceMappingURL=/cdn/shop/t/42/assets/product-info.js.map?v=159581681776331687511772969367

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.