PageSourceSearch

https://tewines.com/cdn/shop/t/3/assets/layout-store.js?v=63141772116759686071773967668&cv=35e504a

js tewines.com collected 2026-10-09 18:25:16 UTC 3,955 bytes, 2 lines download raw bytes

1import{d,E}from"./preact-signals.js";function shopifyFetchConfig(type="json"){return{method:"POST",headers:{"X-Requested-With":"XMLHttpRequest","Content-Type":"application/json",Accept:`application/${type}`}}}const convertStringToHTML=htmlString=>new DOMParser().parseFromString(htmlString,"text/html").body;function updateCartTrigger(){fetch("/?sections=cart-icon-bubble").then(response=>response.json()).then(data=>{const newCartCount=convertStringToHTML(data["cart-icon-bubble"]).querySelector("#cart-trigger"),oldCartCount=document.querySelector("#cart-trigger");oldCartCount&&newCartCount&&(oldCartCount.innerHTML=newCartCount.innerHTML)})}function updateCartDom(){fetch("/?sections=cart-slideover,main-cart-items").then(response=>response.json()).then(data=>{const slideoverHTML=convertStringToHTML(data["cart-slideover"]),mainCartHTML=convertStringToHTML(data["main-cart-items"]),newSlideoverContent=slideoverHTML.querySelector("shopify-cart .shopify-cart__update-section"),newMainCartContent=mainCartHTML.querySelector("shopify-cart .shopify-cart__update-section");document.querySelectorAll("shopify-cart").forEach(cart=>{const setting=cart.getAttribute("setting"),updateSection=cart.querySelector(".shopify-cart__update-section");updateSection&&(setting==="slideover"&&newSlideoverContent?updateSection.innerHTML=newSlideoverContent.innerHTML:setting==="cart"&&newMainCartContent&&(updateSection.innerHTML=newMainCartContent.innerHTML))})})}function setMoney(money){return`${window.currencySymbol?window.currencySymbol:"$"}${(money/100).toFixed(2)}`}class Layout{constructor(){this.slideover=null,this.clickReveal=null,this.modal=null,this.cart=null,this.cartError=null,this.gatedDownloads=null,this.windowWidth=null,this.slideover=d(null),this.clickReveal=d(null),this.modal=d(null),this.cart=d(null),this.cartError=d(null),this.gatedDownloads=d([]),this.windowWidth=d(window?window.innerWidth:0),this.cart.value==null&&this.fetchCart(),E(()=>{window.addEventListener("resize",()=>{this.windowWidth.value=window.innerWidth})})}async fetchCart(){this.cart.value=await fetch("/cart.js").then(r=>r.json())}async upateLineItemQty(body){return await fetch("/cart/change.js",{...shopifyFetchConfig(),body}).then(response=>(updateCartTrigger(),updateCartDom(),response.json())).then(data=>(console.log(data),data))}async cartAddItem(body){return await fetch("/cart/add.js",{...shopifyFetchConfig(),body}).then(response=>(updateCartTrigger(),updateCartDom(),response.json()))}async updateQuantity(line,quantity){let bodyObject={[line]:quantity};console.log("bodyObject",bodyObject);const body=JSON.stringify({updates:bodyObject});fetch("/cart/update.js",{...shopifyFetchConfig(),body}).then(response=>response.json()).then(data=>{this.cart.value=data,updateCartTrigger(),updateCartDom(),this.fetchCart()}).catch(error=>{console.error(error)})}async updateCartNote(note){const body=JSON.stringify({note});return fetch("/cart/update.js",{...shopifyFetchConfig(),body}).then(response=>response.json()).then(response=>response.status?response.description:this.fetchCart())}async removeBundle(bundleUid){const bundleItems=this.cart.value.items.filter(item=>item.properties&&item.properties._bundleUid===bundleUid);if(bundleItems.length!==0)return console.log(JSON.stringify({updates:bundleItems.reduce((acc,item)=>(acc[item.id]=0,acc),{})})),fetch("/cart/update.js",{...shopifyFetchConfig(),body:JSON.stringify({updates:bundleItems.reduce((acc,item)=>(acc[item.key]=0,acc),{})})}).then(response=>{if(!response.ok)throw new Error("Failed to remove bundle items");return response.json()}).then(response=>{this.cart.value=response,updateCartTrigger(),updateCartDom(),this.fetchCart()}).catch(error=>{console.error("Error removing bundle items:",error)})}}const layout=new Layout;export{updateCartDom as a,layout as l,setMoney as s,updateCartTrigger as u};
2//# sourceMappingURL=/cdn/shop/t/3/assets/layout-store.js.map?cv=35e504a&v=63141772116759686071773967668

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.