1import{a as s}from"./shopify-D3QC7vO0.js";async function c(t){const e=await(await fetch(window.shopifyApiEndpoint,{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":window.shopifyPublicAccessToken},body:JSON.stringify({query:` 2 query CartDetails($id: ID!) { 3 cart(id: $id) { 4 id 5 totalQuantity 6 cost { 7 subtotalAmount { 8 amount 9 currencyCode 10 } 11 totalAmount { 12 amount 13 currencyCode 14 } 15 } 16 lines(first: 100) { 17 edges { 18 node { 19 id 20 quantity 21 cost { 22 totalAmount { 23 amount 24 currencyCode 25 } 26 } 27 merchandise { 28 __typename 29 ... on ProductVariant { 30 id 31 title 32 sku 33 availableForSale 34 quantityAvailable 35 selectedOptions { 36 name 37 value 38 } 39 product { 40 title 41 featuredImage { 42 url 43 altText 44 } 45 add_ons: metafield(namespace: "custom", key: "add_ons") { 46 id 47 type 48 references(first: 10) { 49 edges { 50 node { 51 __typename 52 ... on Product { 53 id 54 title 55 handle 56 featuredImage { 57 url 58 altText 59 } 60 priceRange { 61 minVariantPrice { 62 amount 63 currencyCode 64 } 65 maxVariantPrice { 66 amount 67 currencyCode 68 } 69 } 70 variants(first: 1) { 71 edges { 72 node { 73 id 74 } 75 } 76 } 77 } 78 } 79 } 80 } 81 } 82 } 83 } 84 } 85 } 86 } 87 } 88 } 89 } 90 `,variables:{id:t}})})).json();return e.errors?(console.error("CartCount errors:",e.errors),0):e.data}async function d(t){return console.log("Sending cart data to server for HTML generation:",t),await(await fetch("/html-test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).text()}async function y(){const t=document.getElementById("cart-details");if(!t)return;const a=await c(s());console.log("Cart details:",a);const n=await d(a);t.innerHTML=n;for(const e of t.querySelectorAll("button[data-variant-id]"))e.addEventListener("click",l=>{const o=e.getAttribute("data-variant-id"),r=parseInt(e.getAttribute("data-quantity"))||1;console.log(`Add to cart clicked for variant ${o} with quantity ${r}`);const i=new CustomEvent("add-to-cart",{detail:{variantId:o,quantity:r},bubbles:!0});e.dispatchEvent(i)})}export{y as initCartPage};
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.