@shopify/hydrogen 2026.4.6 → 2026.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/development/index.cjs +26 -9
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +27 -10
- package/dist/development/index.js.map +1 -1
- package/dist/production/index.cjs +45 -45
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +45 -45
- package/dist/production/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var react=require('react'),reactRouter=require('react-router'),jsxRuntime=require('react/jsx-runtime'),hydrogenReact=require('@shopify/hydrogen-react'),loadScript=require('@shopify/hydrogen-react/load-script'),graphqlClient=require('@shopify/graphql-client'),cookie=require('worktop/cookie'),As=require('content-security-policy-builder');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var As__default=/*#__PURE__*/_interopDefault(As);var mn=Object.defineProperty;var Ir=(e,t)=>()=>(e&&(t=e(e=0)),t);var Er=(e,t)=>{for(var r in t)mn(e,r,{get:t[r],enumerable:true});};var Qo={};Er(Qo,{VIRTUAL_ROUTES_DIR:()=>Ge,VIRTUAL_ROUTES_DIR_PARTS:()=>Go,VIRTUAL_ROUTES_ROUTES_DIR_PARTS:()=>Be,createVirtualRoutesPath:()=>Bo,getVirtualRoutesV3:()=>bs});function Bo(e,t,r){let o=new URL("../",e),n=t.reduce((s,c)=>new URL(`${c}/`,s),o),a=new URL(r,n).pathname.replace(/^\/[a-zA-Z]:\//,"/");return decodeURIComponent(a)}function qe(e,t){return Bo((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)),e,t)}async function bs(){return {routes:[{id:`${Ge}/graphiql`,path:"graphiql",file:qe(Be,"graphiql.jsx"),index:false},{id:`${Ge}/subrequest-profiler`,path:"subrequest-profiler",file:qe(Be,"subrequest-profiler.jsx"),index:false},{id:`${Ge}/[.]well-known.appspecific.com[.]chrome[.]devtools[.]json`,path:".well-known/appspecific/com.chrome.devtools.json",file:qe(Be,"[.]well-known.appspecific.com[.]chrome[.]devtools[.]json.jsx"),index:false},{id:`${Ge}/index`,path:"",file:qe(Be,"index.jsx"),index:true}],layout:{file:qe(Go,"layout.jsx")}}}var Ge,Be,Go;var un={};Er(un,{default:()=>sn,logSeoTags:()=>cn});function sn({headTags:e}){return cn(e),null}function cn(e){console.log(" "),console.log("%cSEO Meta Tags",`${ci}`),console.log(" "),e.forEach(t=>{if(t.tag==="script"){if(console.log("%c\u2022 JSON LD ",Tr),t.children)try{console.table(JSON.parse(t.children),["name","content"]);}catch{console.log(t.children);}}else {if(console.log(`%c\u2022 ${t.tag} `,Tr),t.children)if(typeof t.children=="string")console.log(`\u21B3 ${t.children}`);else try{Object.entries(JSON.parse(t.children)).map(([r,o])=>console.log(`\u21B3 ${o}`));}catch{console.log(t.children);}if(t.props.property==="og:image:url"){let r=t.props.content;ui(r).then(o=>{let n=`font-size: 400px; padding: 10px; background: white url(${o}) no-repeat center; background-size: contain;`;console.log("%c\u2022 Share image preview",Tr),console.log("%c ",n),console.log(`\u21B3 ${r}`);}).catch(o=>{console.error(o);});}Object.entries(t.props).map(([r,o])=>{console.log(`\u21B3 ${r} \u2192 ${o}`);});}console.log(" ");});}async function ui(e){let o=await(await(await fetch(e)).blob()).arrayBuffer();return `data:image/png;base64,${di(o)}`}function di(e){let t="",r=new Uint8Array(e),o=r.byteLength;for(let n=0;n<o;n++)t+=String.fromCharCode(r[n]);return btoa(t)}var Tr,ci,dn=Ir(()=>{Tr="text-transform: uppercase;",ci="text-transform: uppercase; font-weight: bold; text-transform: uppercase;font-weight: bold";});function ge(e){let{type:t,data:r={},customData:o}=e,n=reactRouter.useLocation(),{publish:a,cart:s,prevCart:c,shop:i,customData:u}=ee(),d=n.pathname+n.search,y={...r,customData:{...u,...o},cart:s,prevCart:c,shop:i};return react.useEffect(()=>{i?.shopId&&(y={...y,url:window.location.href},a(t,y));},[a,d,i?.shopId]),null}function br(e){return jsxRuntime.jsx(ge,{...e,type:"page_viewed"})}function wr(e){return jsxRuntime.jsx(ge,{...e,type:"product_viewed"})}function xr(e){return jsxRuntime.jsx(ge,{...e,type:"collection_viewed"})}function Dr(e){return jsxRuntime.jsx(ge,{...e,type:"cart_viewed"})}function Or(e){return jsxRuntime.jsx(ge,{...e,type:"search_viewed"})}function _r(e){return jsxRuntime.jsx(ge,{...e})}function Ye(){try{let e=window.Shopify?.customerPrivacy;return e?.consentStatus!=="loaded"||e.currentVisitorConsent?.().analytics==="no"?!1:e.analyticsProcessingAllowed?.()??!1}catch{return false}}function Ur(e){if(!e.shouldShowBanner())return false;let t=e.currentVisitorConsent();return ![t.marketing,t.analytics,t.preferences].some(r=>r==="yes"||r==="no")}var B={PAGE_VIEWED:"page_viewed",PRODUCT_VIEWED:"product_viewed",COLLECTION_VIEWED:"collection_viewed",CART_VIEWED:"cart_viewed",SEARCH_VIEWED:"search_viewed",CART_UPDATED:"cart_updated",PRODUCT_ADD_TO_CART:"product_added_to_cart",PRODUCT_REMOVED_FROM_CART:"product_removed_from_cart",CUSTOM_EVENT:"custom_"};var vn="https://cdn.shopify.com/shopifycloud/consent-tracking-api/v0.2/consent-tracking-api.js",In="https://cdn.shopify.com/shopifycloud/privacy-banner/storefront-banner.js";function Lr(e){console.error(`[h2:error:useCustomerPrivacy] Unable to setup Customer Privacy API: Missing consent.${e} configuration.`);}function En(){console.warn("[h2:warn:useCustomerPrivacy] `sameDomainForStorefrontApi: false` is ignored. Consent and analytics require the same-origin Storefront API proxy included in Hydrogen's `createRequestHandler`, so consent requests always use it. Remove this option. See https://shopify.dev/changelog/posts/tracking-cookie-deprecation-hydrogen");}function Tt(e){let{withPrivacyBanner:t=false,onVisitorConsentCollected:r,onReady:o,checkoutDomain:n,storefrontAccessToken:a,country:s,locale:c,sameDomainForStorefrontApi:i}=e,{revalidate:u}=reactRouter.useRevalidator(),d=react.useRef({onReady:o,onVisitorConsentCollected:r,revalidate:u});d.current={onReady:o,onVisitorConsentCollected:r,revalidate:u};let y=react.useRef(false),C=react.useRef(),[m,p]=react.useState(()=>({customerPrivacy:pe(),privacyBanner:we()})),l=react.useMemo(()=>{n||Lr("checkoutDomain"),a||Lr("storefrontAccessToken"),(a.startsWith("shpat_")||a.length!==32)&&console.error("[h2:error:useCustomerPrivacy] It looks like you passed a private access token, make sure to use the public token"),i===false&&En();let h=On(n);return {checkoutRootDomain:typeof window<"u"?window.location.host:n,storefrontRootDomain:h?"."+h:void 0,storefrontAccessToken:a,country:s,locale:c}},[i,n,a,s,c]);return react.useEffect(()=>{let h=true,f=window.Shopify??={},v=f.customerPrivacy??={};v.config={...v.config,isHeadless:true,asyncConsent:true,asyncVisitorState:true,consentDomain:l.checkoutRootDomain,storefrontAccessToken:l.storefrontAccessToken,debug:{...v.config?.debug,hydrogen:wn}},l.country&&(f.country=l.country),l.locale&&(f.locale=l.locale.toLowerCase());let R=()=>{let T=hydrogenReact.getTrackingValues(),P=C.current;C.current=T,P&&(P.visitToken!==T.visitToken||P.uniqueToken!==T.uniqueToken)&&d.current.revalidate().catch(()=>{console.warn("[h2:warn:useCustomerPrivacy] Revalidation failed after consent change.");});},S=()=>{if(!h)return false;let T=pe(),P=we();return T&&xn(T,l),t&&P&&Dn(P,l),p(U=>U.customerPrivacy===T&&U.privacyBanner===P?U:{customerPrivacy:T,privacyBanner:P}),T?.consentStatus!=="loaded"||t&&!P?false:(y.current||(y.current=true,R(),bn(T),d.current.onReady?.()),true)},A=T=>{S()&&(R(),d.current.onVisitorConsentCollected?.(T.detail));};return document.addEventListener("consentTrackingApiLoaded",S),document.addEventListener("visitorConsentCollected",A),S()||loadScript.loadScript(t?In:vn,{attributes:{id:"customer-privacy-api"}}).then(S,()=>{h&&console.error("[h2:error:useCustomerPrivacy] Unable to load the Customer Privacy API.");}),()=>{h=false,document.removeEventListener("consentTrackingApiLoaded",S),document.removeEventListener("visitorConsentCollected",A);}},[l,t]),{customerPrivacy:m.customerPrivacy,...t?{privacyBanner:m.privacyBanner}:{}}}var kr=new WeakSet;function bn(e){kr.has(e)||(kr.add(e),document.dispatchEvent(new CustomEvent("shopifyCustomerPrivacyApiLoaded")));}var wn={generation:2,serverTiming:false},Vr=new WeakMap;function xn(e,t){let r=Vr.get(e);if(r){r.config=t;return}let o={config:t};Vr.set(e,o);let n=e.setTrackingConsent;e.setTrackingConsent=(a,s)=>{let{locale:c,country:i,...u}=o.config,d={...u,headlessStorefront:true,...a};n.call(e,d,s);};}var Nr=new WeakMap;function Dn(e,t){let r=Nr.get(e);if(r){r.config=t;return}let o={config:t};Nr.set(e,o);let{loadBanner:n,showPreferences:a}=e;e.loadBanner=s=>n.call(e,{...o.config,...s}),e.showPreferences=s=>a.call(e,{...o.config,...s});}function On(e){if(typeof window>"u")return;let t=window.location.host,r=e.split(".").reverse(),o=t.split(".").reverse(),n=[];return r.forEach((a,s)=>{a===o[s]&&n.push(a);}),n.reverse().join(".")||void 0}function pe(){try{let e=window.Shopify?.customerPrivacy;return typeof e?.setTrackingConsent=="function"?e:null}catch{return null}}function we(){try{let e=window.privacyBanner;return typeof e?.loadBanner=="function"&&typeof e.showPreferences=="function"?e:null}catch{return null}}var Mr="2026.4.6";function Hr(){let e=pe();if(!e)throw new Error("Shopify Customer Privacy API not available. Must be used within a useEffect. Make sure to load the Shopify Customer Privacy API with useCustomerPrivacy() or <AnalyticsProvider>.");return e}function $r({consent:e,onConsentChange:t}){let{subscribe:r,register:o}=ee(),[n,a]=react.useState(false),s=react.useRef(false),{checkoutDomain:c,storefrontAccessToken:i,language:u}=e,{ready:d}=o("Internal_Shopify_Analytics");react.useEffect(()=>{s.current||(s.current=true,r(B.PAGE_VIEWED,Nn),r(B.PRODUCT_VIEWED,Mn),r(B.COLLECTION_VIEWED,Fn),r(B.SEARCH_VIEWED,Hn),r(B.PRODUCT_ADD_TO_CART,$n));},[r]);let y=()=>{n?t():(!e.withPrivacyBanner||!Ur(Hr()))&&a(true);};return Tt({...e,locale:u,checkoutDomain:c||"mock.shop",storefrontAccessToken:i||"abcdefghijklmnopqrstuvwxyz123456",onReady:y,onVisitorConsentCollected:y}),react.useEffect(()=>{n&&(d(),t());},[n,t]),null}function Je(e){console.error(`[h2:error:ShopifyAnalytics] Unable to send Shopify analytics: Missing shop.${e} configuration.`);}function Oe(e){let t=Hr(),r=Ye();if(!r)return;if(!e?.shop?.shopId){Je("shopId");return}if(!e?.shop?.acceptedLanguage){Je("acceptedLanguage");return}if(!e?.shop?.currency){Je("currency");return}if(!e?.shop?.hydrogenSubchannelId){Je("hydrogenSubchannelId");return}return {shopifySalesChannel:"hydrogen",assetVersionId:Mr,...e.shop,hasUserConsent:r,...hydrogenReact.getClientBrowserParameters(),analyticsAllowed:t.analyticsProcessingAllowed(),marketingAllowed:t.marketingAllowed(),saleOfDataAllowed:t.saleOfDataAllowed(),ccpaEnforced:!t.saleOfDataAllowed(),gdprEnforced:!(t.marketingAllowed()&&t.analyticsProcessingAllowed())}}function Vn(e,t){if(t===null)return;let r=Oe(e);return r?{...r,cartId:t.id}:void 0}var se={};function Nn(e){let t=Oe(e);t&&(hydrogenReact.sendShopifyAnalytics({eventName:hydrogenReact.AnalyticsEventName.PAGE_VIEW_2,payload:{...t,...se}}),se={});}function Mn(e){let t=Oe(e);if(t&&qr({type:"product",products:e.products})){let r=St(e.products);se={pageType:hydrogenReact.AnalyticsPageType.product,resourceId:r[0].productGid},t={...t,...se,products:St(e.products)},hydrogenReact.sendShopifyAnalytics({eventName:hydrogenReact.AnalyticsEventName.PRODUCT_VIEW,payload:t});}}function Fn(e){let t=Oe(e);t&&(se={pageType:hydrogenReact.AnalyticsPageType.collection,resourceId:e.collection.id},t={...t,...se,collectionHandle:e.collection.handle,collectionId:e.collection.id},hydrogenReact.sendShopifyAnalytics({eventName:hydrogenReact.AnalyticsEventName.COLLECTION_VIEW,payload:t}));}function Hn(e){let t=Oe(e);t&&(se={pageType:hydrogenReact.AnalyticsPageType.search},t={...t,...se,searchString:e.searchTerm},hydrogenReact.sendShopifyAnalytics({eventName:hydrogenReact.AnalyticsEventName.SEARCH_VIEW,payload:t}));}function $n(e){let{cart:t,currentLine:r}=e,o=Vn(e,t);!o||!r?.id||qn({matchedLine:r,eventPayload:o});}function qn({matchedLine:e,eventPayload:t}){let r={id:e.merchandise.product.id,variantId:e.merchandise.id,title:e.merchandise.product.title,variantTitle:e.merchandise.title,vendor:e.merchandise.product.vendor,price:e.merchandise.price.amount,quantity:e.quantity,productType:e.merchandise.product.productType,sku:e.merchandise.sku};qr({type:"cart",products:[r]})&&hydrogenReact.sendShopifyAnalytics({eventName:hydrogenReact.AnalyticsEventName.ADD_TO_CART,payload:{...t,products:St([r])}});}function le(e,t,r,o){if(e==="cart"){let n=`${r?"merchandise":"merchandise.product"}.${t}`;console.error(`[h2:error:ShopifyAnalytics] Can't set up cart analytics events because the \`cart.lines[].${n}\` value is missing from your GraphQL cart query. In your project, search for where \`fragment CartLine on CartLine\` is defined and make sure \`${n}\` is part of your cart query. Check the Hydrogen Skeleton template for reference: https://github.com/Shopify/hydrogen/blob/main/templates/skeleton/app/lib/fragments.ts#L25-L56.`);}else {let n=`${o||t}`;console.error(`[h2:error:ShopifyAnalytics] Can't set up product view analytics events because the \`${n}\` is missing from your \`<Analytics.ProductView>\`. Make sure \`${n}\` is part of your products data prop. Check the Hydrogen Skeleton template for reference: https://github.com/Shopify/hydrogen/blob/main/templates/skeleton/app/routes/products.%24handle.tsx#L159-L165.`);}}function qr({type:e,products:t}){return !t||t.length===0?(le(e,"",false,"data.products"),false):(t.forEach(r=>{if(!r.id)return le(e,"id",false),false;if(!r.title)return le(e,"title",false),false;if(!r.price)return le(e,"price.amount",true,"price"),false;if(!r.vendor)return le(e,"vendor",false),false;if(!r.variantId)return le(e,"id",true,"variantId"),false;if(!r.variantTitle)return le(e,"title",true,"variantTitle"),false}),true)}function St(e){return e.map(t=>{let r={productGid:t.id,variantGid:t.variantId,name:t.title,variantName:t.variantTitle,brand:t.vendor,price:t.price,quantity:t.quantity||1,category:t.productType};return t.sku&&(r.sku=t.sku),t.productType&&(r.category=t.productType),r})}function Qr(e){console.error(`[h2:error:CartAnalytics] Can't set up cart analytics events because the \`cart.${e}\` value is missing from your GraphQL cart query. In your project, search for where \`fragment CartApiQuery on Cart\` is defined and make sure \`${e}\` is part of your cart query. Check the Hydrogen Skeleton template for reference: https://github.com/Shopify/hydrogen/blob/main/templates/skeleton/app/lib/fragments.ts#L59.`);}function Wr({cart:e,setCarts:t}){let{publish:r,shop:o,customData:n,canTrack:a,cart:s,prevCart:c}=ee(),i=react.useRef(null);return react.useEffect(()=>{if(e)return Promise.resolve(e).then(u=>{if(u&&u.lines){if(!u.id){Qr("id");return}if(!u.updatedAt){Qr("updatedAt");return}}t(({cart:d,prevCart:y})=>u?.updatedAt!==d?.updatedAt?{cart:u,prevCart:d}:{cart:d,prevCart:y});}),()=>{}},[t,e]),react.useEffect(()=>{if(!s||!s?.updatedAt||s?.updatedAt===c?.updatedAt)return;let u;try{u=JSON.parse(localStorage.getItem("cartLastUpdatedAt")||"");}catch{u=null;}if(s.id===u?.id&&s.updatedAt===u?.updatedAt)return;let d={eventTimestamp:Date.now(),cart:s,prevCart:c,shop:o,customData:n};if(s.updatedAt===i.current)return;i.current=s.updatedAt,r("cart_updated",d),localStorage.setItem("cartLastUpdatedAt",JSON.stringify({id:s.id,updatedAt:s.updatedAt}));let y=c?.lines?hydrogenReact.flattenConnection(c?.lines):[],C=s.lines?hydrogenReact.flattenConnection(s.lines):[];y?.forEach(m=>{let p=C.filter(l=>m.id===l.id);if(p?.length===1){let l=p[0];m.quantity<l.quantity?r("product_added_to_cart",{...d,prevLine:m,currentLine:l}):m.quantity>l.quantity&&r("product_removed_from_cart",{...d,prevLine:m,currentLine:l});}else r("product_removed_from_cart",{...d,prevLine:m});}),C?.forEach(m=>{let p=y.filter(l=>m.id===l.id);(!p||p.length===0)&&r("product_added_to_cart",{...d,currentLine:m});});},[s,c,r,o,n,a]),null}var Kn="https://cdn.shopify.com/shopifycloud/perf-kit/shopify-perf-kit-spa.min.js";function jr({shop:e}){let t=react.useRef(false),{subscribe:r,register:o}=ee(),{ready:n}=o("Internal_Shopify_Perf_Kit"),a=hydrogenReact.useLoadScript(Kn,{attributes:{id:"perfkit","data-application":"hydrogen","data-shop-id":hydrogenReact.parseGid(e.shopId).id.toString(),"data-storefront-id":e.hydrogenSubchannelId,"data-monorail-region":"global","data-spa-mode":"true","data-resource-timing-sampling-rate":"10"}});return react.useEffect(()=>{a!=="done"||t.current||(t.current=true,r(B.PAGE_VIEWED,()=>{window.PerfKit?.navigate();}),r(B.PRODUCT_VIEWED,()=>{window.PerfKit?.setPageType("product");}),r(B.COLLECTION_VIEWED,()=>{window.PerfKit?.setPageType("collection");}),r(B.SEARCH_VIEWED,()=>{window.PerfKit?.setPageType("search");}),r(B.CART_VIEWED,()=>{window.PerfKit?.setPageType("cart");}),n());},[r,n,a]),null}var Kr=new Set,J=e=>{Kr.has(e)||(console.warn(e),Kr.add(e));},Yr=new Set,Pt=e=>{Yr.has(e)||(console.error(new Error(e)),Yr.add(e));};var ea={canTrack:()=>false,cart:null,customData:{},prevCart:null,publish:()=>{},shop:null,subscribe:()=>{},register:()=>({ready:()=>{}}),customerPrivacy:null,privacyBanner:null},eo=react.createContext(ea),Ze=new Map,_e={};function to(){return Object.values(_e).every(Boolean)}function Jr(e,t){Ze.has(e)||Ze.set(e,new Map),Ze.get(e)?.set(t.toString(),t);}var et=new Map;function zr(e,t){if(!to()){et.set(e,t);return}ro(e,t);}function ro(e,t){(Ze.get(e)??new Map).forEach((r,o)=>{try{r(t);}catch(n){typeof n=="object"&&n instanceof Error?console.error("Analytics publish error",n.message,o,n.stack):console.error("Analytics publish error",n,o);}});}function Xr(e){return _e.hasOwnProperty(e)||(_e[e]=false),{ready:()=>{_e[e]=true,to()&&et.size>0&&(et.forEach((t,r)=>{ro(r,t);}),et.clear());}}}function Zr(e,t){return `[h2:error:Analytics.Provider] - ${e} is required. Make sure ${t} is defined in your environment variables. See https://h2o.fyi/analytics/consent to learn how to setup environment variables in the Shopify admin.`}function ta({canTrack:e,cart:t,children:r,consent:o,customData:n={},shop:a=null}){let{shop:s}=ra(a),[c,i]=react.useState(0),[u,d]=react.useState(false),[y,C]=react.useState({cart:null,prevCart:null}),m=e??Ye,p=react.useCallback(()=>{d(true),i(h=>h+1);},[]);if(s)if(/\/68817551382$/.test(s.shopId))J("[h2:error:Analytics.Provider] - Mock shop is used. Analytics will not work properly.");else {if(!o.checkoutDomain){let h=Zr("consent.checkoutDomain","PUBLIC_CHECKOUT_DOMAIN");Pt(h);}if(!o.storefrontAccessToken){let h=Zr("consent.storefrontAccessToken","PUBLIC_STOREFRONT_API_TOKEN");Pt(h);}o?.country||(o.country="US"),o?.language||(o.language="EN"),o.withPrivacyBanner===void 0&&(o.withPrivacyBanner=false);}let l=react.useMemo(()=>({canTrack:m,...y,customData:n,publish:m()?zr:()=>{},shop:s,subscribe:Jr,register:Xr,customerPrivacy:pe(),privacyBanner:we()}),[c,m,y,y.cart?.updatedAt,y.prevCart,zr,Jr,n,s,Xr,JSON.stringify(_e),pe,we]);return jsxRuntime.jsxs(eo.Provider,{value:l,children:[r,!!s&&jsxRuntime.jsx(br,{}),!!s&&!!t&&jsxRuntime.jsx(Wr,{cart:t,setCarts:C}),!!s&&jsxRuntime.jsx($r,{consent:o,onConsentChange:p}),!!s&&u&&jsxRuntime.jsx(jr,{shop:s})]})}function ee(){let e=react.useContext(eo);if(!e)throw new Error("[h2:error:useAnalytics] 'useAnalytics()' must be a descendent of <AnalyticsProvider/>");return e}function ra(e){let[t,r]=react.useState(null);return react.useEffect(()=>(Promise.resolve(e).then(r),()=>{}),[r,e]),{shop:t}}async function oa({storefront:e,publicStorefrontId:t="0"}){return e.query(na,{cache:e.CacheLong()}).then(({shop:r,localization:o})=>({shopId:r.id,acceptedLanguage:o.language.isoCode,currency:o.country.currency.isoCode,hydrogenSubchannelId:t}))}var na=`#graphql
|
|
1
|
+
'use strict';var react=require('react'),reactRouter=require('react-router'),jsxRuntime=require('react/jsx-runtime'),hydrogenReact=require('@shopify/hydrogen-react'),loadScript=require('@shopify/hydrogen-react/load-script'),graphqlClient=require('@shopify/graphql-client'),cookie=require('worktop/cookie'),Rs=require('content-security-policy-builder');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Rs__default=/*#__PURE__*/_interopDefault(Rs);var Cn=Object.defineProperty;var br=(e,t)=>()=>(e&&(t=e(e=0)),t);var wr=(e,t)=>{for(var r in t)Cn(e,r,{get:t[r],enumerable:true});};var Wo={};wr(Wo,{VIRTUAL_ROUTES_DIR:()=>Ge,VIRTUAL_ROUTES_DIR_PARTS:()=>Bo,VIRTUAL_ROUTES_ROUTES_DIR_PARTS:()=>Be,createVirtualRoutesPath:()=>Qo,getVirtualRoutesV3:()=>Ds});function Qo(e,t,r){let o=new URL("../",e),n=t.reduce((s,c)=>new URL(`${c}/`,s),o),a=new URL(r,n).pathname.replace(/^\/[a-zA-Z]:\//,"/");return decodeURIComponent(a)}function qe(e,t){return Qo((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)),e,t)}async function Ds(){return {routes:[{id:`${Ge}/graphiql`,path:"graphiql",file:qe(Be,"graphiql.jsx"),index:false},{id:`${Ge}/subrequest-profiler`,path:"subrequest-profiler",file:qe(Be,"subrequest-profiler.jsx"),index:false},{id:`${Ge}/[.]well-known.appspecific.com[.]chrome[.]devtools[.]json`,path:".well-known/appspecific/com.chrome.devtools.json",file:qe(Be,"[.]well-known.appspecific.com[.]chrome[.]devtools[.]json.jsx"),index:false},{id:`${Ge}/index`,path:"",file:qe(Be,"index.jsx"),index:true}],layout:{file:qe(Bo,"layout.jsx")}}}var Ge,Be,Bo;var dn={};wr(dn,{default:()=>cn,logSeoTags:()=>un});function cn({headTags:e}){return un(e),null}function un(e){console.log(" "),console.log("%cSEO Meta Tags",`${pi}`),console.log(" "),e.forEach(t=>{if(t.tag==="script"){if(console.log("%c\u2022 JSON LD ",Rr),t.children)try{console.table(JSON.parse(t.children),["name","content"]);}catch{console.log(t.children);}}else {if(console.log(`%c\u2022 ${t.tag} `,Rr),t.children)if(typeof t.children=="string")console.log(`\u21B3 ${t.children}`);else try{Object.entries(JSON.parse(t.children)).map(([r,o])=>console.log(`\u21B3 ${o}`));}catch{console.log(t.children);}if(t.props.property==="og:image:url"){let r=t.props.content;li(r).then(o=>{let n=`font-size: 400px; padding: 10px; background: white url(${o}) no-repeat center; background-size: contain;`;console.log("%c\u2022 Share image preview",Rr),console.log("%c ",n),console.log(`\u21B3 ${r}`);}).catch(o=>{console.error(o);});}Object.entries(t.props).map(([r,o])=>{console.log(`\u21B3 ${r} \u2192 ${o}`);});}console.log(" ");});}async function li(e){let o=await(await(await fetch(e)).blob()).arrayBuffer();return `data:image/png;base64,${yi(o)}`}function yi(e){let t="",r=new Uint8Array(e),o=r.byteLength;for(let n=0;n<o;n++)t+=String.fromCharCode(r[n]);return btoa(t)}var Rr,pi,pn=br(()=>{Rr="text-transform: uppercase;",pi="text-transform: uppercase; font-weight: bold; text-transform: uppercase;font-weight: bold";});function ge(e){let{type:t,data:r={},customData:o}=e,n=reactRouter.useLocation(),{publish:a,cart:s,prevCart:c,shop:i,customData:u}=ee(),d=n.pathname+n.search,y={...r,customData:{...u,...o},cart:s,prevCart:c,shop:i};return react.useEffect(()=>{i?.shopId&&(y={...y,url:window.location.href},a(t,y));},[a,d,i?.shopId]),null}function xr(e){return jsxRuntime.jsx(ge,{...e,type:"page_viewed"})}function Dr(e){return jsxRuntime.jsx(ge,{...e,type:"product_viewed"})}function Or(e){return jsxRuntime.jsx(ge,{...e,type:"collection_viewed"})}function _r(e){return jsxRuntime.jsx(ge,{...e,type:"cart_viewed"})}function Ur(e){return jsxRuntime.jsx(ge,{...e,type:"search_viewed"})}function Lr(e){return jsxRuntime.jsx(ge,{...e})}function Ye(){try{let e=window.Shopify?.customerPrivacy;return e?.consentStatus!=="loaded"||e.currentVisitorConsent?.().analytics==="no"?!1:e.analyticsProcessingAllowed?.()??!1}catch{return false}}function kr(e){if(!e.shouldShowBanner())return false;let t=e.currentVisitorConsent();return ![t.marketing,t.analytics,t.preferences].some(r=>r==="yes"||r==="no")}var B={PAGE_VIEWED:"page_viewed",PRODUCT_VIEWED:"product_viewed",COLLECTION_VIEWED:"collection_viewed",CART_VIEWED:"cart_viewed",SEARCH_VIEWED:"search_viewed",CART_UPDATED:"cart_updated",PRODUCT_ADD_TO_CART:"product_added_to_cart",PRODUCT_REMOVED_FROM_CART:"product_removed_from_cart",CUSTOM_EVENT:"custom_"};var In="https://cdn.shopify.com/shopifycloud/consent-tracking-api/v0.2/consent-tracking-api.js",En="https://cdn.shopify.com/shopifycloud/privacy-banner/storefront-banner.js";function Vr(e){console.error(`[h2:error:useCustomerPrivacy] Unable to setup Customer Privacy API: Missing consent.${e} configuration.`);}function bn(){console.warn("[h2:warn:useCustomerPrivacy] `sameDomainForStorefrontApi: false` is ignored. Consent and analytics require the same-origin Storefront API proxy included in Hydrogen's `createRequestHandler`, so consent requests always use it. Remove this option. See https://shopify.dev/changelog/posts/tracking-cookie-deprecation-hydrogen");}function Tt(e){let{withPrivacyBanner:t=false,onVisitorConsentCollected:r,onReady:o,checkoutDomain:n,storefrontAccessToken:a,country:s,locale:c,sameDomainForStorefrontApi:i}=e,{revalidate:u}=reactRouter.useRevalidator(),d=react.useRef({onReady:o,onVisitorConsentCollected:r,revalidate:u});d.current={onReady:o,onVisitorConsentCollected:r,revalidate:u};let y=react.useRef(false),C=react.useRef(),[m,p]=react.useState(()=>({customerPrivacy:pe(),privacyBanner:we()})),l=react.useMemo(()=>{n||Vr("checkoutDomain"),a||Vr("storefrontAccessToken"),(a.startsWith("shpat_")||a.length!==32)&&console.error("[h2:error:useCustomerPrivacy] It looks like you passed a private access token, make sure to use the public token"),i===false&&bn();let T=_n(n);return {checkoutRootDomain:typeof window<"u"?window.location.host:n,storefrontRootDomain:T?"."+T:void 0,storefrontAccessToken:a,country:s,locale:c}},[i,n,a,s,c]);return react.useEffect(()=>{let T=true,f=window.Shopify??={},v=f.customerPrivacy??={};v.config={...v.config,isHeadless:true,asyncConsent:true,asyncVisitorState:true,consentDomain:l.checkoutRootDomain,storefrontAccessToken:l.storefrontAccessToken,debug:{...v.config?.debug,hydrogen:xn}},l.country&&(f.country=l.country),l.locale&&(f.locale=l.locale.toLowerCase());let h=()=>{let R=hydrogenReact.getTrackingValues(),P=C.current;C.current=R,P&&(P.visitToken!==R.visitToken||P.uniqueToken!==R.uniqueToken)&&d.current.revalidate().catch(()=>{console.warn("[h2:warn:useCustomerPrivacy] Revalidation failed after consent change.");});},S=()=>{if(!T)return false;let R=pe(),P=we();return R&&Dn(R,l),t&&P&&On(P,l),p(U=>U.customerPrivacy===R&&U.privacyBanner===P?U:{customerPrivacy:R,privacyBanner:P}),R?.consentStatus!=="loaded"||t&&!P?false:(y.current||(y.current=true,h(),wn(R),d.current.onReady?.()),true)},A=R=>{S()&&(h(),d.current.onVisitorConsentCollected?.(R.detail));};return document.addEventListener("consentTrackingApiLoaded",S),document.addEventListener("visitorConsentCollected",A),S()||loadScript.loadScript(t?En:In,{attributes:{id:"customer-privacy-api"}}).then(S,()=>{T&&console.error("[h2:error:useCustomerPrivacy] Unable to load the Customer Privacy API.");}),()=>{T=false,document.removeEventListener("consentTrackingApiLoaded",S),document.removeEventListener("visitorConsentCollected",A);}},[l,t]),{customerPrivacy:m.customerPrivacy,...t?{privacyBanner:m.privacyBanner}:{}}}var Nr=new WeakSet;function wn(e){Nr.has(e)||(Nr.add(e),document.dispatchEvent(new CustomEvent("shopifyCustomerPrivacyApiLoaded")));}var xn={generation:2,serverTiming:false},Mr=new WeakMap;function Dn(e,t){let r=Mr.get(e);if(r){r.config=t;return}let o={config:t};Mr.set(e,o);let n=e.setTrackingConsent;e.setTrackingConsent=(a,s)=>{let{locale:c,country:i,...u}=o.config,d={...u,headlessStorefront:true,...a};n.call(e,d,s);};}var Fr=new WeakMap;function On(e,t){let r=Fr.get(e);if(r){r.config=t;return}let o={config:t};Fr.set(e,o);let{loadBanner:n,showPreferences:a}=e;e.loadBanner=s=>n.call(e,{...o.config,...s}),e.showPreferences=s=>a.call(e,{...o.config,...s});}function _n(e){if(typeof window>"u")return;let t=window.location.host,r=e.split(".").reverse(),o=t.split(".").reverse(),n=[];return r.forEach((a,s)=>{a===o[s]&&n.push(a);}),n.reverse().join(".")||void 0}function pe(){try{let e=window.Shopify?.customerPrivacy;return typeof e?.setTrackingConsent=="function"?e:null}catch{return null}}function we(){try{let e=window.privacyBanner;return typeof e?.loadBanner=="function"&&typeof e.showPreferences=="function"?e:null}catch{return null}}var Hr="2026.4.7";function qr(){let e=pe();if(!e)throw new Error("Shopify Customer Privacy API not available. Must be used within a useEffect. Make sure to load the Shopify Customer Privacy API with useCustomerPrivacy() or <AnalyticsProvider>.");return e}function Gr({consent:e,onConsentChange:t}){let{subscribe:r,register:o}=ee(),[n,a]=react.useState(false),s=react.useRef(false),{checkoutDomain:c,storefrontAccessToken:i,language:u}=e,{ready:d}=o("Internal_Shopify_Analytics");react.useEffect(()=>{s.current||(s.current=true,r(B.PAGE_VIEWED,Mn),r(B.PRODUCT_VIEWED,Fn),r(B.COLLECTION_VIEWED,Hn),r(B.SEARCH_VIEWED,$n),r(B.PRODUCT_ADD_TO_CART,qn));},[r]);let y=()=>{n?t():(!e.withPrivacyBanner||!kr(qr()))&&a(true);};return Tt({...e,locale:u,checkoutDomain:c||"mock.shop",storefrontAccessToken:i||"abcdefghijklmnopqrstuvwxyz123456",onReady:y,onVisitorConsentCollected:y}),react.useEffect(()=>{n&&(d(),t());},[n,t]),null}function Je(e){console.error(`[h2:error:ShopifyAnalytics] Unable to send Shopify analytics: Missing shop.${e} configuration.`);}function Oe(e){let t=qr(),r=Ye();if(!r)return;if(!e?.shop?.shopId){Je("shopId");return}if(!e?.shop?.acceptedLanguage){Je("acceptedLanguage");return}if(!e?.shop?.currency){Je("currency");return}if(!e?.shop?.hydrogenSubchannelId){Je("hydrogenSubchannelId");return}return {shopifySalesChannel:"hydrogen",assetVersionId:Hr,...e.shop,hasUserConsent:r,...hydrogenReact.getClientBrowserParameters(),analyticsAllowed:t.analyticsProcessingAllowed(),marketingAllowed:t.marketingAllowed(),saleOfDataAllowed:t.saleOfDataAllowed(),ccpaEnforced:!t.saleOfDataAllowed(),gdprEnforced:!(t.marketingAllowed()&&t.analyticsProcessingAllowed())}}function Nn(e,t){if(t===null)return;let r=Oe(e);return r?{...r,cartId:t.id}:void 0}var se={};function Mn(e){let t=Oe(e);t&&(hydrogenReact.sendShopifyAnalytics({eventName:hydrogenReact.AnalyticsEventName.PAGE_VIEW_2,payload:{...t,...se}}),se={});}function Fn(e){let t=Oe(e);if(t&&Br({type:"product",products:e.products})){let r=St(e.products);se={pageType:hydrogenReact.AnalyticsPageType.product,resourceId:r[0].productGid},t={...t,...se,products:St(e.products)},hydrogenReact.sendShopifyAnalytics({eventName:hydrogenReact.AnalyticsEventName.PRODUCT_VIEW,payload:t});}}function Hn(e){let t=Oe(e);t&&(se={pageType:hydrogenReact.AnalyticsPageType.collection,resourceId:e.collection.id},t={...t,...se,collectionHandle:e.collection.handle,collectionId:e.collection.id},hydrogenReact.sendShopifyAnalytics({eventName:hydrogenReact.AnalyticsEventName.COLLECTION_VIEW,payload:t}));}function $n(e){let t=Oe(e);t&&(se={pageType:hydrogenReact.AnalyticsPageType.search},t={...t,...se,searchString:e.searchTerm},hydrogenReact.sendShopifyAnalytics({eventName:hydrogenReact.AnalyticsEventName.SEARCH_VIEW,payload:t}));}function qn(e){let{cart:t,currentLine:r}=e,o=Nn(e,t);!o||!r?.id||Gn({matchedLine:r,eventPayload:o});}function Gn({matchedLine:e,eventPayload:t}){let r={id:e.merchandise.product.id,variantId:e.merchandise.id,title:e.merchandise.product.title,variantTitle:e.merchandise.title,vendor:e.merchandise.product.vendor,price:e.merchandise.price.amount,quantity:e.quantity,productType:e.merchandise.product.productType,sku:e.merchandise.sku};Br({type:"cart",products:[r]})&&hydrogenReact.sendShopifyAnalytics({eventName:hydrogenReact.AnalyticsEventName.ADD_TO_CART,payload:{...t,products:St([r])}});}function le(e,t,r,o){if(e==="cart"){let n=`${r?"merchandise":"merchandise.product"}.${t}`;console.error(`[h2:error:ShopifyAnalytics] Can't set up cart analytics events because the \`cart.lines[].${n}\` value is missing from your GraphQL cart query. In your project, search for where \`fragment CartLine on CartLine\` is defined and make sure \`${n}\` is part of your cart query. Check the Hydrogen Skeleton template for reference: https://github.com/Shopify/hydrogen/blob/main/templates/skeleton/app/lib/fragments.ts#L25-L56.`);}else {let n=`${o||t}`;console.error(`[h2:error:ShopifyAnalytics] Can't set up product view analytics events because the \`${n}\` is missing from your \`<Analytics.ProductView>\`. Make sure \`${n}\` is part of your products data prop. Check the Hydrogen Skeleton template for reference: https://github.com/Shopify/hydrogen/blob/main/templates/skeleton/app/routes/products.%24handle.tsx#L159-L165.`);}}function Br({type:e,products:t}){return !t||t.length===0?(le(e,"",false,"data.products"),false):(t.forEach(r=>{if(!r.id)return le(e,"id",false),false;if(!r.title)return le(e,"title",false),false;if(!r.price)return le(e,"price.amount",true,"price"),false;if(!r.vendor)return le(e,"vendor",false),false;if(!r.variantId)return le(e,"id",true,"variantId"),false;if(!r.variantTitle)return le(e,"title",true,"variantTitle"),false}),true)}function St(e){return e.map(t=>{let r={productGid:t.id,variantGid:t.variantId,name:t.title,variantName:t.variantTitle,brand:t.vendor,price:t.price,quantity:t.quantity||1,category:t.productType};return t.sku&&(r.sku=t.sku),t.productType&&(r.category=t.productType),r})}function jr(e){console.error(`[h2:error:CartAnalytics] Can't set up cart analytics events because the \`cart.${e}\` value is missing from your GraphQL cart query. In your project, search for where \`fragment CartApiQuery on Cart\` is defined and make sure \`${e}\` is part of your cart query. Check the Hydrogen Skeleton template for reference: https://github.com/Shopify/hydrogen/blob/main/templates/skeleton/app/lib/fragments.ts#L59.`);}function Kr({cart:e,setCarts:t}){let{publish:r,shop:o,customData:n,canTrack:a,cart:s,prevCart:c}=ee(),i=react.useRef(null);return react.useEffect(()=>{if(e)return Promise.resolve(e).then(u=>{if(u&&u.lines){if(!u.id){jr("id");return}if(!u.updatedAt){jr("updatedAt");return}}t(({cart:d,prevCart:y})=>u?.updatedAt!==d?.updatedAt?{cart:u,prevCart:d}:{cart:d,prevCart:y});}),()=>{}},[t,e]),react.useEffect(()=>{if(!s||!s?.updatedAt||s?.updatedAt===c?.updatedAt)return;let u;try{u=JSON.parse(localStorage.getItem("cartLastUpdatedAt")||"");}catch{u=null;}if(s.id===u?.id&&s.updatedAt===u?.updatedAt)return;let d={eventTimestamp:Date.now(),cart:s,prevCart:c,shop:o,customData:n};if(s.updatedAt===i.current)return;i.current=s.updatedAt,r("cart_updated",d),localStorage.setItem("cartLastUpdatedAt",JSON.stringify({id:s.id,updatedAt:s.updatedAt}));let y=c?.lines?hydrogenReact.flattenConnection(c?.lines):[],C=s.lines?hydrogenReact.flattenConnection(s.lines):[];y?.forEach(m=>{let p=C.filter(l=>m.id===l.id);if(p?.length===1){let l=p[0];m.quantity<l.quantity?r("product_added_to_cart",{...d,prevLine:m,currentLine:l}):m.quantity>l.quantity&&r("product_removed_from_cart",{...d,prevLine:m,currentLine:l});}else r("product_removed_from_cart",{...d,prevLine:m});}),C?.forEach(m=>{let p=y.filter(l=>m.id===l.id);(!p||p.length===0)&&r("product_added_to_cart",{...d,currentLine:m});});},[s,c,r,o,n,a]),null}var Yn="https://cdn.shopify.com/shopifycloud/perf-kit/shopify-perf-kit-spa.min.js";function Yr({shop:e}){let t=react.useRef(false),{subscribe:r,register:o}=ee(),{ready:n}=o("Internal_Shopify_Perf_Kit"),a=hydrogenReact.useLoadScript(Yn,{attributes:{id:"perfkit","data-application":"hydrogen","data-shop-id":hydrogenReact.parseGid(e.shopId).id.toString(),"data-storefront-id":e.hydrogenSubchannelId,"data-monorail-region":"global","data-spa-mode":"true","data-resource-timing-sampling-rate":"10"}});return react.useEffect(()=>{a!=="done"||t.current||(t.current=true,r(B.PAGE_VIEWED,()=>{window.PerfKit?.navigate();}),r(B.PRODUCT_VIEWED,()=>{window.PerfKit?.setPageType("product");}),r(B.COLLECTION_VIEWED,()=>{window.PerfKit?.setPageType("collection");}),r(B.SEARCH_VIEWED,()=>{window.PerfKit?.setPageType("search");}),r(B.CART_VIEWED,()=>{window.PerfKit?.setPageType("cart");}),n());},[r,n,a]),null}var Jr=new Set,J=e=>{Jr.has(e)||(console.warn(e),Jr.add(e));},zr=new Set,Pt=e=>{zr.has(e)||(console.error(new Error(e)),zr.add(e));};var ta={canTrack:()=>false,cart:null,customData:{},prevCart:null,publish:()=>{},shop:null,subscribe:()=>{},register:()=>({ready:()=>{}}),customerPrivacy:null,privacyBanner:null},to=react.createContext(ta),Ze=new Map,_e={};function ro(){return Object.values(_e).every(Boolean)}function Xr(e,t){Ze.has(e)||Ze.set(e,new Map),Ze.get(e)?.set(t.toString(),t);}var et=new Map;function ra(e,t){if(!ro()){et.set(e,t);return}oo(e,t);}function oo(e,t){(Ze.get(e)??new Map).forEach((r,o)=>{try{r(t);}catch(n){typeof n=="object"&&n instanceof Error?console.error("Analytics publish error",n.message,o,n.stack):console.error("Analytics publish error",n,o);}});}function Zr(e){return _e.hasOwnProperty(e)||(_e[e]=false),{ready:()=>{_e[e]=true,ro()&&et.size>0&&(et.forEach((t,r)=>{oo(r,t);}),et.clear());}}}var oa=()=>{};function eo(e,t){return `[h2:error:Analytics.Provider] - ${e} is required. Make sure ${t} is defined in your environment variables. See https://h2o.fyi/analytics/consent to learn how to setup environment variables in the Shopify admin.`}function na({canTrack:e,cart:t,children:r,consent:o,customData:n={},shop:a=null}){let{shop:s}=aa(a),[c,i]=react.useState(0),[u,d]=react.useState(false),[y,C]=react.useState({cart:null,prevCart:null}),m=react.useCallback(h=>react.startTransition(()=>C(h)),[]),p=e??Ye,l=react.useRef(p);l.current=p;let T=react.useCallback((h,S)=>{l.current()&&ra(h,S);},[]),f=react.useCallback(()=>{react.startTransition(()=>{d(true),i(h=>h+1);});},[]);if(s)if(/\/68817551382$/.test(s.shopId))J("[h2:error:Analytics.Provider] - Mock shop is used. Analytics will not work properly.");else {if(!o.checkoutDomain){let h=eo("consent.checkoutDomain","PUBLIC_CHECKOUT_DOMAIN");Pt(h);}if(!o.storefrontAccessToken){let h=eo("consent.storefrontAccessToken","PUBLIC_STOREFRONT_API_TOKEN");Pt(h);}o?.country||(o.country="US"),o?.language||(o.language="EN"),o.withPrivacyBanner===void 0&&(o.withPrivacyBanner=false);}let v=react.useMemo(()=>({canTrack:p,...y,customData:n,publish:p()?T:oa,shop:s,subscribe:Xr,register:Zr,customerPrivacy:pe(),privacyBanner:we()}),[c,p,y,y.cart?.updatedAt,y.prevCart,T,Xr,n,s,Zr,JSON.stringify(_e),pe,we]);return jsxRuntime.jsxs(to.Provider,{value:v,children:[r,!!s&&jsxRuntime.jsx(xr,{}),!!s&&!!t&&jsxRuntime.jsx(Kr,{cart:t,setCarts:m}),!!s&&jsxRuntime.jsx(Gr,{consent:o,onConsentChange:f}),!!s&&u&&jsxRuntime.jsx(Yr,{shop:s})]})}function ee(){let e=react.useContext(to);if(!e)throw new Error("[h2:error:useAnalytics] 'useAnalytics()' must be a descendent of <AnalyticsProvider/>");return e}function aa(e){let[t,r]=react.useState(null);return react.useEffect(()=>(Promise.resolve(e).then(o=>{react.startTransition(()=>r(o));}),()=>{}),[r,e]),{shop:t}}async function sa({storefront:e,publicStorefrontId:t="0"}){return e.query(ia,{cache:e.CacheLong()}).then(({shop:r,localization:o})=>({shopId:r.id,acceptedLanguage:o.language.isoCode,currency:o.country.currency.isoCode,hydrogenSubchannelId:t}))}var ia=`#graphql
|
|
2
2
|
query ShopData(
|
|
3
3
|
$country: CountryCode
|
|
4
4
|
$language: LanguageCode
|
|
@@ -17,17 +17,17 @@
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
`,
|
|
20
|
+
`,ca={CartView:_r,CollectionView:Or,CustomView:Lr,ProductView:Dr,Provider:na,SearchView:Ur};var Ue="Custom-Storefront-Request-Group-ID",Le="X-Shopify-Storefront-Access-Token",Et="X-SDK-Variant",bt="X-SDK-Variant-Source",wt="X-SDK-Version",tt="X-Shopify-Client-IP",Ae="X-Shopify-Client-IP-Sig",no="_sfapi_proxy",ao="Shopify-Storefront-Consent-Management";function z(e,t){return xt(e.headers,t)}function xt(e,t){let r=e?.get?.(t)??e?.[t];return typeof r=="string"?r:null}function ie(e){return {requestId:e?z(e,"request-id"):void 0,purpose:e?z(e,"purpose"):void 0}}function so(e){return {requestGroupId:z(e,"request-id"),buyerIp:z(e,"oxygen-buyer-ip"),buyerIpSig:z(e,Ae),cookie:z(e,"cookie"),purpose:z(e,"sec-purpose")||z(e,"purpose")}}var Dt=/^\/api\/(unstable|2\d{3}-\d{2})\/graphql\.json$/,io=/^\/api\/mcp$/,rt=e=>{try{return new URL(e,"http://e.c").pathname}catch{return "/"}};function ke(e,t){return t.reduce((r,o)=>{let n=e(o);return n&&r.push([o,n]),r},[])}function Te(e,t={}){let r=new Error,o=(n,a="Error")=>{let s=(r.stack??"").split(`
|
|
21
21
|
`).slice(3+(t.stackOffset??0)).join(`
|
|
22
22
|
`).replace(/ at loader(\d+) \(/,(c,i)=>c.replace(i,""));return `${a}: ${n}
|
|
23
|
-
`+s};return e.then(n=>{if(n?.errors&&Array.isArray(n.errors)){let a=typeof t.logErrors=="function"?t.logErrors:()=>t.logErrors??false;n.errors.forEach(s=>{s&&(s.stack=o(s.message,s.name),a(s)&&console.error(s));});}return n}).catch(n=>{throw n&&(n.stack=o(n.message,n.name)),n})}var X=void 0;var ot="public",
|
|
23
|
+
`+s};return e.then(n=>{if(n?.errors&&Array.isArray(n.errors)){let a=typeof t.logErrors=="function"?t.logErrors:()=>t.logErrors??false;n.errors.forEach(s=>{s&&(s.stack=o(s.message,s.name),a(s)&&console.error(s));});}return n}).catch(n=>{throw n&&(n.stack=o(n.message,n.name)),n})}var X=void 0;var ot="public",da="private",Ot="no-store",co={maxAge:"max-age",staleWhileRevalidate:"stale-while-revalidate",sMaxAge:"s-maxage",staleIfError:"stale-if-error"};function Ve(e){let t=[];return Object.keys(e).forEach(r=>{r==="mode"?t.push(e[r]):co[r]&&t.push(`${co[r]}=${e[r]}`);}),t.join(", ")}function _t(){return {mode:Ot}}function Ut(e){if(e?.mode&&e?.mode!==ot&&e?.mode!==da)throw Error("'mode' must be either 'public' or 'private'")}function ye(e){return Ut(e),{mode:ot,maxAge:1,staleWhileRevalidate:9,...e}}function Lt(e){return Ut(e),{mode:ot,maxAge:3600,staleWhileRevalidate:82800,...e}}function Se(e){return Ut(e),{mode:ot,maxAge:1,staleWhileRevalidate:86399,...e}}function kt(e){return e}function te(e){return String(e).includes("__proto__")?JSON.parse(e,pa):JSON.parse(e)}function pa(e,t){if(e!=="__proto__")return t}function nt(e,t){return e&&t?{...e,...t}:e||Se()}function Vt(e){return Ve(nt(e))}async function la(e,t){if(!e)return;let r=await e.match(t);if(!r){return}return r}async function ya(e,t,r,o){if(!e)return;let n=nt(o),a=Vt(nt(n,{maxAge:(n.maxAge||0)+(n.staleWhileRevalidate||0)})),s=Vt(nt(n));r.headers.set("cache-control",a),r.headers.set("real-cache-control",s),r.headers.set("cache-put-date",String(Date.now())),await e.put(t,r);}async function fa(e,t){e&&await e.delete(t);}function ma(e,t){let r=e.headers.get("real-cache-control"),o=0;if(r){let a=r.match(/max-age=(\d*)/);a&&a.length>1&&(o=parseFloat(a[1]));}return [(Date.now()-Number(t))/1e3,o]}function Ca(e,t){let r=t.headers.get("cache-put-date");if(!r)return false;let[o,n]=ma(t,r),a=o>n;return a}var at={get:la,set:ya,delete:fa,generateDefaultCacheControlHeader:Vt,isStale:Ca};function Ne(e){return `https://shopify.dev/?${e}`}function ga(e){return e||Se()}async function uo(e,t){if(!e)return;let r=Ne(t),o=new Request(r),n=await at.get(e,o);if(!n)return;let a=await n.text();try{return [te(a),n]}catch{return [a,n]}}async function po(e,t,r,o){if(!e)return;let n=Ne(t),a=new Request(n),s=new Response(JSON.stringify(r));await at.set(e,a,s,ga(o));}function lo(e,t){return at.isStale(new Request(Ne(e)),t)}function yo(e){let t=Array.isArray(e)?e:[e],r="";for(let o of t)o!=null&&(typeof o=="object"?r+=JSON.stringify(o):r+=o.toString());return encodeURIComponent(r)}var Nt=new Set;async function st(e,t,{strategy:r=ye(),cacheInstance:o,shouldCacheResult:n=()=>true,waitUntil:a,debugInfo:s}){let i=yo([...typeof e=="string"?[e]:e]),y=f=>{({displayName:f.displayName,url:f.response?.url,responseInit:{status:f.response?.status||0,statusText:f.response?.statusText||"",headers:Array.from(f.response?.headers.entries()||[])}});},m=void 0;if(!o||!r||r.mode===Ot){let f=await t({addDebugData:y});return f}let p=f=>po(o,i,{value:f,debugInfo:void 0},r),l=await uo(o,i);if(l&&typeof l[0]!="string"){let[{value:f,debugInfo:v},h]=l;let S=lo(i,h)?"STALE":"HIT";if(!Nt.has(i)&&S==="STALE"){Nt.add(i);let A=Promise.resolve().then(async()=>{let R=Date.now();try{let P=await t({addDebugData:y});n(P)&&(await p(P),m?.({result:P,cacheStatus:"PUT",overrideStartTime:R}));}catch(P){P.message&&(P.message="SWR in sub-request failed: "+P.message),console.error(P);}finally{Nt.delete(i);}});a?.(A);}return f}let T=await t({addDebugData:y});if(n(T)){let f=Promise.resolve().then(async()=>{await p(T);});a?.(f);}return T}var Aa=["set-cookie","server-timing"];function fo(e,t){return [e,{status:t.status,statusText:t.statusText,headers:[...t.headers].filter(([r])=>!Aa.includes(r.toLowerCase()))}]}function mo([e,t]){return [e,new Response(e,t)]}async function it(e,t,{cacheInstance:r,cache:o,cacheKey:n=[e,t],shouldCacheResponse:a,waitUntil:s,debugInfo:c,streamConfig:i,onRawHeaders:u}){return !o&&(!t.method||t.method==="GET")&&(o=ye()),st(n,async()=>{if(i){let C=null,p=await graphqlClient.createGraphQLClient({url:e,customFetchApi:async(f,v)=>(C=await fetch(f,v),u?.(C.headers),C),headers:t.headers}).requestStream(i.query,{variables:i.variables}),l,T;for await(let f of p){let{data:v,errors:h}=f;l=v,T=h?.graphQLErrors??h;}return C?.ok?fo({data:l,errors:T},C):C}let d=await fetch(e,t);if(u?.(d.headers),!d.ok)return d;let y=await d.text().catch(()=>"");try{y&&(y=te(y));}catch{}return fo(y,d)},{cacheInstance:r,waitUntil:s,strategy:o??null,debugInfo:c,shouldCacheResult:d=>"ok"in d?!1:a(...mo(d))}).then(d=>"ok"in d?[null,d]:mo(d))}function Ta(e){let{cache:t,waitUntil:r,request:o}=e;return {run:({cacheKey:n,cacheStrategy:a,shouldCacheResult:s},c)=>st(n,c,{shouldCacheResult:s,strategy:a,cacheInstance:t,waitUntil:r,debugInfo:{...ie(o),stackInfo:X?.()}}),fetch:(n,a,s)=>it(n,a??{},{waitUntil:r,cacheKey:[n,a],cacheInstance:t,debugInfo:{url:n,...ie(o),stackInfo:X?.(),displayName:s?.displayName},cache:s.cacheStrategy,...s}).then(([c,i])=>({data:c,response:i}))}}var Mt=class{#e;constructor(){this.#e=new Map;}add(t){throw new Error("Method not implemented. Use `put` instead.")}addAll(t){throw new Error("Method not implemented. Use `put` instead.")}matchAll(t,r){throw new Error("Method not implemented. Use `match` instead.")}async put(t,r){if(t.method!=="GET")throw new TypeError("Cannot cache response to non-GET request.");if(r.status===206)throw new TypeError("Cannot cache response to a range request (206 Partial Content).");if(r.headers.get("vary")?.includes("*"))throw new TypeError("Cannot cache response with 'Vary: *' header.");this.#e.set(t.url,{body:new Uint8Array(await r.arrayBuffer()),status:r.status,headers:[...r.headers],timestamp:Date.now()});}async match(t){if(t.method!=="GET")return;let r=this.#e.get(t.url);if(!r)return;let{body:o,timestamp:n,...a}=r,s=new Headers(a.headers),c=s.get("cache-control")||s.get("real-cache-control")||"",i=parseInt(c.match(/max-age=(\d+)/)?.[1]||"0",10),u=parseInt(c.match(/stale-while-revalidate=(\d+)/)?.[1]||"0",10),d=(Date.now()-n)/1e3;if(d>i+u){this.#e.delete(t.url);return}let C=d>i;return s.set("cache",C?"STALE":"HIT"),s.set("date",new Date(n).toUTCString()),new Response(o,{status:a.status??200,headers:s})}async delete(t){return this.#e.has(t.url)?(this.#e.delete(t.url),true):false}keys(t){let r=[];for(let o of this.#e.keys())(!t||t.url===o)&&r.push(new Request(o));return Promise.resolve(r)}};var Co="cartFormInput";function re({children:e,action:t,inputs:r,route:o,fetcherKey:n}){let a=reactRouter.useFetcher({key:n});return jsxRuntime.jsxs(a.Form,{action:o||"",method:"post",children:[(t||r)&&jsxRuntime.jsx("input",{type:"hidden",name:Co,value:JSON.stringify({action:t,inputs:r})}),typeof e=="function"?e(a):e]})}re.INPUT_NAME=Co;re.ACTIONS={AttributesUpdateInput:"AttributesUpdateInput",BuyerIdentityUpdate:"BuyerIdentityUpdate",Create:"Create",DiscountCodesUpdate:"DiscountCodesUpdate",GiftCardCodesUpdate:"GiftCardCodesUpdate",GiftCardCodesAdd:"GiftCardCodesAdd",GiftCardCodesRemove:"GiftCardCodesRemove",LinesAdd:"LinesAdd",LinesRemove:"LinesRemove",LinesUpdate:"LinesUpdate",NoteUpdate:"NoteUpdate",SelectedDeliveryOptionsUpdate:"SelectedDeliveryOptionsUpdate",MetafieldsSet:"MetafieldsSet",MetafieldDelete:"MetafieldDelete",DeliveryAddressesAdd:"DeliveryAddressesAdd",DeliveryAddressesUpdate:"DeliveryAddressesUpdate",DeliveryAddressesRemove:"DeliveryAddressesRemove",DeliveryAddressesReplace:"DeliveryAddressesReplace"};function Ra(e){let t={};for(let s of e.entries()){let c=s[0],i=e.getAll(c);t[c]=i.length>1?i:s[1],t[c]==="on"?t[c]=true:t[c]==="off"&&(t[c]=false);}let{cartFormInput:r,...o}=t,{action:n,inputs:a}=r?JSON.parse(String(r)):{};return {action:n,inputs:{...a,...o}}}re.getFormInput=Ra;var Ft=e=>{let t=cookie.parse(xt(e,"Cookie")||"");return ()=>t.cart?`gid://shopify/Cart/${t.cart}`:void 0};var Ht=e=>t=>{let r=new Headers;return r.append("Set-Cookie",cookie.stringify("cart",t.split("/").pop()||"",{path:"/",...e})),r};function ct(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`weak-${Math.random().toString(16).substring(2)}`}var Me="2026.4.7";function Re(e){return e.replace(/\s*#.*$/gm,"").replace(/\s+/gm," ").trim()}var ba=/(^|}\s)query[\s({]/im,wa=/(^|}\s)mutation[\s({]/im;function ut(e,t){if(!ba.test(e))throw new Error(`[h2:error:${t}] Can only execute queries`)}function dt(e,t){if(!wa.test(e))throw new Error(`[h2:error:${t}] Can only execute mutations`)}var fe=class extends Error{locations;path;extensions;constructor(t,r={}){let n=(r.clientOperation?`[h2:error:${r.clientOperation}] `:"")+t+(r.requestId?` - Request ID: ${r.requestId}`:"");super(n),this.name="GraphQLError",this.extensions=r.extensions,this.locations=r.locations,this.path=r.path,this.stack=r.stack||void 0;try{this.cause=JSON.stringify({...typeof r.cause=="object"?r.cause:{},requestId:r.requestId});}catch{r.cause&&(this.cause=r.cause);}}get[Symbol.toStringTag](){return this.name}toString(){let t=`${this.name}: ${this.message}`;if(this.path)try{t+=` | path: ${JSON.stringify(this.path)}`;}catch{}if(this.extensions)try{t+=` | extensions: ${JSON.stringify(this.extensions)}`;}catch{}return t+=`
|
|
24
24
|
`,this.stack&&(t+=`${this.stack.slice(this.stack.indexOf(`
|
|
25
25
|
`)+1)}
|
|
26
26
|
`),t}toJSON(){return {name:"Error",message:""}}};function Fe({url:e,response:t,errors:r,type:o,query:n,queryVariables:a,ErrorConstructor:s=Error,client:c="storefront"}){let i=(typeof r=="string"?r:r?.map?.(d=>d.message).join(`
|
|
27
27
|
`))||`URL: ${e}
|
|
28
|
-
API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{errors:r},clientOperation:`${c}.${o}`,requestId:t.headers.get("x-request-id")});throw new s(u.message,{cause:u.cause})}var
|
|
28
|
+
API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{errors:r},clientOperation:`${c}.${o}`,requestId:t.headers.get("x-request-id")});throw new s(u.message,{cause:u.cause})}var _a={language:"EN",country:"US"};function To(e){let {storefrontHeaders:t,cache:r,waitUntil:o,i18n:n,storefrontId:a,logErrors:s=true,...c}=e,{getPublicTokenHeaders:u,getPrivateTokenHeaders:d,getStorefrontApiUrl:y,getShopifyDomain:C}=hydrogenReact.createStorefrontClient(c),p=(c.privateStorefrontToken?d:u)({contentType:"json",buyerIp:t?.buyerIp||""});t?.buyerIp&&(p[tt]=t.buyerIp),t?.buyerIpSig&&(p[Ae]=t.buyerIpSig),p[Ue]=t?.requestGroupId||ct(),a&&(p[hydrogenReact.SHOPIFY_STOREFRONT_ID_HEADER]=a),(p["user-agent"]=`Hydrogen ${Me}`);let l=t?.cookie??"";l&&(p.cookie=l);let T,f;if(!/\b_shopify_(analytics|marketing)=/.test(l)){let A=l.match(/\b_shopify_y=([^;]+)/)?.[1],R=l.match(/\b_shopify_s=([^;]+)/)?.[1];A&&(p[hydrogenReact.SHOPIFY_STOREFRONT_Y_HEADER]=A),R&&(p[hydrogenReact.SHOPIFY_STOREFRONT_S_HEADER]=R),T=A??ct(),f=R??ct(),p[hydrogenReact.SHOPIFY_UNIQUE_TOKEN_HEADER]=T,p[hydrogenReact.SHOPIFY_VISIT_TOKEN_HEADER]=f;}let v,h=JSON.stringify({"content-type":p["content-type"],"user-agent":p["user-agent"],[Et]:p[Et],[bt]:p[bt],[wt]:p[wt],[Le]:p[Le]});async function S({query:A,mutation:R,variables:P,cache:U,headers:M=[],storefrontApiVersion:j,displayName:de,stackInfo:ht}){let je=M instanceof Headers?Object.fromEntries(M.entries()):Array.isArray(M)?Object.fromEntries(M):M,K=A??R,g={...P};n&&(!P?.country&&/\$country/.test(K)&&(g.country=n.country),!P?.language&&/\$language/.test(K)&&(g.language=n.language));let E=y({storefrontApiVersion:j}),L=JSON.stringify({query:K,variables:g}),V={method:"POST",headers:{...p,...je},body:L},N=[E,V.method,h,V.body],Z=K.includes("@defer")?{query:K,variables:g}:void 0,[$,q]=await it(E,V,{cacheInstance:R?void 0:r,cache:U||Se(),cacheKey:N,waitUntil:o,shouldCacheResponse:G=>!G?.errors,debugInfo:{requestId:V.headers[Ue],displayName:de,url:E,stackInfo:ht,graphql:L,purpose:t?.purpose},streamConfig:Z,onRawHeaders:G=>{v??={setCookie:G.getSetCookie()};}}),ae={url:E,response:q,type:R?"mutation":"query",query:K,queryVariables:g,errors:void 0};if(!q.ok){let G,Y=$;try{Y??=await q.text(),G=te(Y);}catch{G=[{message:Y??"Could not parse Storefront API response"}];}Fe({...ae,errors:G});}let{data:W,errors:k}=$;k=k?Array.isArray(k)?k:[k]:void 0;let Ce=k?.map(({message:G,...Y})=>new fe(G,{...Y,clientOperation:`storefront.${ae.type}`,requestId:q.headers.get("x-request-id"),queryVariables:g,query:K}));return I(W,Ce)}return {storefront:{query(A,R){A=Re(A),ut(A,"storefront.query");let P=Ao?.(A);return Te(S({...R,query:A,stackInfo:X?.(P)}),{stackOffset:P,logErrors:s})},mutate(A,R){A=Re(A),dt(A,"storefront.mutate");let P=Ao?.(A);return Te(S({...R,mutation:A,stackInfo:X?.(P)}),{stackOffset:P,logErrors:s})},cache:r,CacheNone:_t,CacheLong:Lt,CacheShort:ye,CacheCustom:kt,generateCacheControlHeader:Ve,getPublicTokenHeaders:u,getPrivateTokenHeaders:d,getHeaders:()=>({...p}),getShopifyDomain:C,getApiUrl:y,i18n:n??_a,isStorefrontApiUrl(A){return Dt.test(rt(A.url??""))},async forward(A,R){let P=new Headers([...ke(de=>A.headers.get(de),["accept","accept-encoding","accept-language","access-control-request-headers","access-control-request-method","content-type","content-length","cookie","origin","referer","user-agent",ao,Le,hydrogenReact.SHOPIFY_UNIQUE_TOKEN_HEADER,hydrogenReact.SHOPIFY_VISIT_TOKEN_HEADER]),...ke(de=>p[de],[tt,Ae,hydrogenReact.SHOPIFY_STOREFRONT_ID_HEADER,Ue])]);t?.buyerIp&&P.set("x-forwarded-for",t.buyerIp);let U=R?.storefrontApiVersion??rt(A.url).match(Dt)?.[1],M=await fetch(y({storefrontApiVersion:U}),{method:A.method,body:A.body,headers:P}),j=new Response(M.body,M);return j.headers.delete("server-timing"),j},isMcpUrl(A){return io.test(rt(A.url??""))},async forwardMcp(A){let R=new Headers([...ke(U=>A.headers.get(U),["accept","accept-encoding","accept-language","content-type","cookie","origin","referer","user-agent"]),...ke(U=>p[U],[tt,Ae,Le,Ue,hydrogenReact.SHOPIFY_STOREFRONT_ID_HEADER])]);t?.buyerIp&&R.set("x-forwarded-for",t.buyerIp);let P=`${C()}/api/mcp`;try{let U=await fetch(P,{method:A.method,body:A.body,headers:R}),M=new Response(U.body,U);return M.headers.delete("server-timing"),M}catch(U){let j=U instanceof Error?U.message:"Internal proxy error";return new Response(JSON.stringify({jsonrpc:"2.0",error:{code:-32603,message:j},id:null}),{status:502,headers:{"content-type":"application/json"}})}},setCollectedSubrequestHeaders:A=>{if(v)for(let R of v.setCookie)A.headers.append("Set-Cookie",R);}}}}var Ao=void 0;function I(e,t){return {...e,...t&&{errors:t}}}function b(e){return e?.visitorConsent!==void 0}function w(e=false){let t=`$country: CountryCode = ZZ
|
|
29
29
|
$language: LanguageCode`;return e?`${t}
|
|
30
|
-
$visitorConsent: VisitorConsent`:t}function x(e=false){return e?"@inContext(country: $country, language: $language, visitorConsent: $visitorConsent)":"@inContext(country: $country, language: $language)"}function
|
|
30
|
+
$visitorConsent: VisitorConsent`:t}function x(e=false){return e?"@inContext(country: $country, language: $language, visitorConsent: $visitorConsent)":"@inContext(country: $country, language: $language)"}function qt({storefront:e,customerAccount:t,getCartId:r,cartFragment:o}){return async n=>{let a=n?.cartId??r();if(!a)return null;let s=b(n),[c,{cart:i,errors:u}]=await Promise.all([t?t.isLoggedIn():false,e.query(Ua(o,{includeVisitorConsent:s}),{variables:{cartId:a,...n},cache:e.CacheNone()})]);if(c&&i&&typeof i=="object"&&"checkoutUrl"in i&&typeof i.checkoutUrl=="string"){let d=new URL(i.checkoutUrl);d.searchParams.set("logged_in","true"),Object.assign(i,{checkoutUrl:d.toString()});}return i||u?I(i,u):null}}var Ua=(e=La,t={})=>`#graphql
|
|
31
31
|
query CartQuery(
|
|
32
32
|
$cartId: ID!
|
|
33
33
|
$numCartLines: Int = 100
|
|
@@ -39,7 +39,7 @@ API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{err
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
${e}
|
|
42
|
-
`,
|
|
42
|
+
`,La=`#graphql
|
|
43
43
|
fragment CartApiQuery on Cart {
|
|
44
44
|
updatedAt
|
|
45
45
|
id
|
|
@@ -172,7 +172,7 @@ API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{err
|
|
|
172
172
|
message
|
|
173
173
|
target
|
|
174
174
|
}
|
|
175
|
-
`;function
|
|
175
|
+
`;function Gt(e){return async(t,r)=>{let o=e.customerAccount?await e.customerAccount.getBuyer():void 0,{cartId:n,...a}=r||{},{buyerIdentity:s,...c}=t,i=b(r),{cartCreate:u,errors:d}=await e.storefront.mutate(ka(e.cartFragment,{includeVisitorConsent:i}),{variables:{input:{...c,buyerIdentity:{...o,...s}},...a}});return I(u,d)}}var ka=(e=O,t={})=>`#graphql
|
|
176
176
|
mutation cartCreate(
|
|
177
177
|
$input: CartInput!
|
|
178
178
|
${w(t.includeVisitorConsent)}
|
|
@@ -193,7 +193,7 @@ API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{err
|
|
|
193
193
|
${e}
|
|
194
194
|
${D}
|
|
195
195
|
${_}
|
|
196
|
-
`;function
|
|
196
|
+
`;function Bt(e){return async(t,r)=>{let o=b(r),{cartLinesAdd:n,errors:a}=await e.storefront.mutate(Va(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),lines:t,...r}});return I(n,a)}}var Va=(e=O,t={})=>`#graphql
|
|
197
197
|
mutation cartLinesAdd(
|
|
198
198
|
$cartId: ID!
|
|
199
199
|
$lines: [CartLineInput!]!
|
|
@@ -214,7 +214,7 @@ API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{err
|
|
|
214
214
|
${e}
|
|
215
215
|
${D}
|
|
216
216
|
${_}
|
|
217
|
-
`;var
|
|
217
|
+
`;var So="__h_pending_";function Ro(e){return So+e}function pt(e){return e.startsWith(So)}function lt(e,t){if(t.some(r=>pt(typeof r=="string"?r:r.id)))throw new Error(`Tried to perform an action on an optimistic line. Make sure to disable your "${e}" CartForm action when the line is optimistic.`)}function Qt(e){return async(t,r)=>{lt("updateLines",t);let o=b(r),{cartLinesUpdate:n,errors:a}=await e.storefront.mutate(Na(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),lines:t,...r}});return I(n,a)}}var Na=(e=O,t={})=>`#graphql
|
|
218
218
|
mutation cartLinesUpdate(
|
|
219
219
|
$cartId: ID!
|
|
220
220
|
$lines: [CartLineUpdateInput!]!
|
|
@@ -235,7 +235,7 @@ API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{err
|
|
|
235
235
|
${e}
|
|
236
236
|
${D}
|
|
237
237
|
${_}
|
|
238
|
-
`;function
|
|
238
|
+
`;function Wt(e){return async(t,r)=>{lt("removeLines",t);let o=b(r),{cartLinesRemove:n,errors:a}=await e.storefront.mutate(Ma(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),lineIds:t,...r}});return I(n,a)}}var Ma=(e=O,t={})=>`#graphql
|
|
239
239
|
mutation cartLinesRemove(
|
|
240
240
|
$cartId: ID!
|
|
241
241
|
$lineIds: [ID!]!
|
|
@@ -256,7 +256,7 @@ API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{err
|
|
|
256
256
|
${e}
|
|
257
257
|
${D}
|
|
258
258
|
${_}
|
|
259
|
-
`;function
|
|
259
|
+
`;function jt(e){return async(t,r)=>{let o=t.filter((c,i,u)=>u.indexOf(c)===i),n=b(r),{cartDiscountCodesUpdate:a,errors:s}=await e.storefront.mutate(Fa(e.cartFragment,{includeVisitorConsent:n}),{variables:{cartId:e.getCartId(),discountCodes:o,...r}});return I(a,s)}}var Fa=(e=O,t={})=>`#graphql
|
|
260
260
|
mutation cartDiscountCodesUpdate(
|
|
261
261
|
$cartId: ID!
|
|
262
262
|
$discountCodes: [String!]!
|
|
@@ -279,7 +279,7 @@ API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{err
|
|
|
279
279
|
${e}
|
|
280
280
|
${D}
|
|
281
281
|
${_}
|
|
282
|
-
`;function
|
|
282
|
+
`;function Kt(e){return async(t,r)=>{t.companyLocationId&&e.customerAccount&&e.customerAccount.setBuyer({companyLocationId:t.companyLocationId});let o=e.customerAccount?await e.customerAccount.getBuyer():void 0,n=b(r),{cartBuyerIdentityUpdate:a,errors:s}=await e.storefront.mutate(Ha(e.cartFragment,{includeVisitorConsent:n}),{variables:{cartId:e.getCartId(),buyerIdentity:{...o,...t},...r}});return I(a,s)}}var Ha=(e=O,t={})=>`#graphql
|
|
283
283
|
mutation cartBuyerIdentityUpdate(
|
|
284
284
|
$cartId: ID!
|
|
285
285
|
$buyerIdentity: CartBuyerIdentityInput!
|
|
@@ -300,7 +300,7 @@ API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{err
|
|
|
300
300
|
${e}
|
|
301
301
|
${D}
|
|
302
302
|
${_}
|
|
303
|
-
`;function
|
|
303
|
+
`;function Yt(e){return async(t,r)=>{let o=b(r),{cartNoteUpdate:n,errors:a}=await e.storefront.mutate($a(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),note:t,...r}});return I(n,a)}}var $a=(e=O,t={})=>`#graphql
|
|
304
304
|
mutation cartNoteUpdate(
|
|
305
305
|
$cartId: ID!
|
|
306
306
|
$note: String!
|
|
@@ -321,7 +321,7 @@ API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{err
|
|
|
321
321
|
${e}
|
|
322
322
|
${D}
|
|
323
323
|
${_}
|
|
324
|
-
`;function
|
|
324
|
+
`;function Jt(e){return async(t,r)=>{let o=b(r),{cartSelectedDeliveryOptionsUpdate:n,errors:a}=await e.storefront.mutate(qa(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),selectedDeliveryOptions:t,...r}});return I(n,a)}}var qa=(e=O,t={})=>`#graphql
|
|
325
325
|
mutation cartSelectedDeliveryOptionsUpdate(
|
|
326
326
|
$cartId: ID!
|
|
327
327
|
$selectedDeliveryOptions: [CartSelectedDeliveryOptionInput!]!
|
|
@@ -342,7 +342,7 @@ API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{err
|
|
|
342
342
|
${e}
|
|
343
343
|
${D}
|
|
344
344
|
${_}
|
|
345
|
-
`;function
|
|
345
|
+
`;function zt(e){return async(t,r)=>{let o=b(r),{cartAttributesUpdate:n,errors:a}=await e.storefront.mutate(Ga(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:r?.cartId||e.getCartId(),attributes:t,...r}});return I(n,a)}}var Ga=(e=O,t={})=>`#graphql
|
|
346
346
|
mutation cartAttributesUpdate(
|
|
347
347
|
$cartId: ID!
|
|
348
348
|
$attributes: [AttributeInput!]!
|
|
@@ -363,7 +363,7 @@ API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{err
|
|
|
363
363
|
${e}
|
|
364
364
|
${D}
|
|
365
365
|
${_}
|
|
366
|
-
`;function
|
|
366
|
+
`;function Xt(e){return async(t,r)=>{let o=r?.cartId||e.getCartId(),n=t.map(i=>({...i,ownerId:o})),a=b(r),{cartMetafieldsSet:s,errors:c}=await e.storefront.mutate(Ba({includeVisitorConsent:a}),{variables:{metafields:n,...r}});return I({cart:{id:o},...s},c)}}var Ba=(e={})=>`#graphql
|
|
367
367
|
mutation cartMetafieldsSet(
|
|
368
368
|
$metafields: [CartMetafieldsSetInput!]!
|
|
369
369
|
${w(e.includeVisitorConsent)}
|
|
@@ -377,7 +377,7 @@ API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{err
|
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
|
-
`;function
|
|
380
|
+
`;function Zt(e){return async(t,r)=>{let o=r?.cartId||e.getCartId(),n=b(r),{cartMetafieldDelete:a,errors:s}=await e.storefront.mutate(Qa({includeVisitorConsent:n}),{variables:{input:{ownerId:o,key:t},...r}});return I({cart:{id:o},...a},s)}}var Qa=(e={})=>`#graphql
|
|
381
381
|
mutation cartMetafieldDelete(
|
|
382
382
|
$input: CartMetafieldDeleteInput!
|
|
383
383
|
${w(e.includeVisitorConsent)}
|
|
@@ -390,7 +390,7 @@ API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{err
|
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
|
-
`;function
|
|
393
|
+
`;function er(e){return async(t,r)=>{let o=b(r),{cartGiftCardCodesUpdate:n,errors:a}=await e.storefront.mutate(Wa(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),giftCardCodes:t,...r}});return I(n,a)}}var Wa=(e=O,t={})=>`#graphql
|
|
394
394
|
mutation cartGiftCardCodesUpdate(
|
|
395
395
|
$cartId: ID!
|
|
396
396
|
$giftCardCodes: [String!]!
|
|
@@ -411,7 +411,7 @@ API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{err
|
|
|
411
411
|
${e}
|
|
412
412
|
${D}
|
|
413
413
|
${_}
|
|
414
|
-
`;function
|
|
414
|
+
`;function tr(e){return async(t,r)=>{let{cartGiftCardCodesAdd:o,errors:n}=await e.storefront.mutate(ja(e.cartFragment),{variables:{cartId:e.getCartId(),giftCardCodes:t,...r}});return I(o,n)}}var ja=(e=O)=>`#graphql
|
|
415
415
|
mutation cartGiftCardCodesAdd(
|
|
416
416
|
$cartId: ID!
|
|
417
417
|
$giftCardCodes: [String!]!
|
|
@@ -433,7 +433,7 @@ API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{err
|
|
|
433
433
|
${e}
|
|
434
434
|
${D}
|
|
435
435
|
${_}
|
|
436
|
-
`;function
|
|
436
|
+
`;function rr(e){return async(t,r)=>{let o=b(r),{cartGiftCardCodesRemove:n,errors:a}=await e.storefront.mutate(Ka(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),appliedGiftCardIds:t,...r}});return I(n,a)}}var Ka=(e=O,t={})=>`#graphql
|
|
437
437
|
mutation cartGiftCardCodesRemove(
|
|
438
438
|
$cartId: ID!
|
|
439
439
|
$appliedGiftCardIds: [ID!]!
|
|
@@ -454,7 +454,7 @@ API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{err
|
|
|
454
454
|
${e}
|
|
455
455
|
${D}
|
|
456
456
|
${_}
|
|
457
|
-
`;function
|
|
457
|
+
`;function Po(e){return async(t,r)=>{let o=b(r),{cartDeliveryAddressesAdd:n,errors:a}=await e.storefront.mutate(Ya(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),addresses:t,...r}});return I(n,a)}}var Ya=(e=O,t={})=>`#graphql
|
|
458
458
|
mutation cartDeliveryAddressesAdd(
|
|
459
459
|
$cartId: ID!
|
|
460
460
|
$addresses: [CartSelectableAddressInput!]!,
|
|
@@ -475,7 +475,7 @@ API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{err
|
|
|
475
475
|
${e}
|
|
476
476
|
${D}
|
|
477
477
|
${_}
|
|
478
|
-
`;function
|
|
478
|
+
`;function vo(e){return async(t,r)=>{let o=b(r),{cartDeliveryAddressesRemove:n,errors:a}=await e.storefront.mutate(Ja(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),addressIds:t,...r}});return I(n,a)}}var Ja=(e=O,t={})=>`#graphql
|
|
479
479
|
mutation cartDeliveryAddressesRemove(
|
|
480
480
|
$cartId: ID!
|
|
481
481
|
$addressIds: [ID!]!,
|
|
@@ -496,7 +496,7 @@ API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{err
|
|
|
496
496
|
${e}
|
|
497
497
|
${D}
|
|
498
498
|
${_}
|
|
499
|
-
`;function
|
|
499
|
+
`;function Io(e){return async(t,r)=>{let o=b(r),{cartDeliveryAddressesUpdate:n,errors:a}=await e.storefront.mutate(za(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),addresses:t,...r}});return I(n,a)}}var za=(e=O,t={})=>`#graphql
|
|
500
500
|
mutation cartDeliveryAddressesUpdate(
|
|
501
501
|
$cartId: ID!
|
|
502
502
|
$addresses: [CartSelectableAddressUpdateInput!]!,
|
|
@@ -517,7 +517,7 @@ API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{err
|
|
|
517
517
|
${e}
|
|
518
518
|
${D}
|
|
519
519
|
${_}
|
|
520
|
-
`;function
|
|
520
|
+
`;function Eo(e){return async(t,r)=>{let{cartDeliveryAddressesReplace:o,errors:n}=await e.storefront.mutate(Xa(e.cartFragment),{variables:{cartId:e.getCartId(),addresses:t,...r}});return I(o,n)}}var Xa=(e=O)=>`#graphql
|
|
521
521
|
mutation cartDeliveryAddressesReplace(
|
|
522
522
|
$cartId: ID!
|
|
523
523
|
$addresses: [CartSelectableAddressInput!]!,
|
|
@@ -539,7 +539,7 @@ API response error: ${t.status}`,u=new fe(i,{query:n,queryVariables:a,cause:{err
|
|
|
539
539
|
${e}
|
|
540
540
|
${D}
|
|
541
541
|
${_}
|
|
542
|
-
`;function tr(e){let{getCartId:t,setCartId:r,storefront:o,customerAccount:n,cartQueryFragment:a,cartMutateFragment:s,buyerIdentity:c}=e,i=t(),u=()=>i||t(),d={storefront:o,getCartId:u,cartFragment:s,customerAccount:n},y=$t(d),C=async function(...p){p[0].buyerIdentity={...c,...p[0].buyerIdentity};let l=await y(...p);if(l?.cart&&(typeof l.cart!="object"||!("id"in l.cart)||typeof l.cart.id!="string"))throw new Error("[h2:error:createCartHandler] Cart created but response is missing a valid `id` field. Ensure your cart query fragment includes the `id` field.");return i=l?.cart&&typeof l.cart=="object"&&"id"in l.cart&&typeof l.cart.id=="string"?l.cart.id:void 0,l},m={get:Ht({storefront:o,customerAccount:n,getCartId:u,cartFragment:a}),getCartId:u,setCartId:r,create:C,addLines:async(p,l)=>{let h=p.map(f=>({attributes:f.attributes,quantity:f.quantity,merchandiseId:f.merchandiseId,sellingPlanId:f.sellingPlanId,parent:f.parent}));return i||l?.cartId?await qt(d)(h,l):await C({lines:h,buyerIdentity:c},l)},updateLines:Gt(d),removeLines:Bt(d),updateDiscountCodes:async(p,l)=>i||l?.cartId?await Qt(d)(p,l):await C({discountCodes:p},l),updateGiftCardCodes:async(p,l)=>i||l?.cartId?await Xt(d)(p,l):await C({giftCardCodes:p},l),addGiftCardCodes:Zt(d),removeGiftCardCodes:er(d),updateBuyerIdentity:async(p,l)=>i||l?.cartId?await Wt(d)(p,l):await C({buyerIdentity:p},l),updateNote:async(p,l)=>i||l?.cartId?await jt(d)(p,l):await C({note:p},l),updateSelectedDeliveryOption:Kt(d),updateAttributes:async(p,l)=>i||l?.cartId?await Yt(d)(p,l):await C({attributes:p},l),setMetafields:async(p,l)=>i||l?.cartId?await Jt(d)(p,l):await C({metafields:p},l),deleteMetafield:zt(d),addDeliveryAddresses:Ro(d),removeDeliveryAddresses:Po(d),updateDeliveryAddresses:vo(d),replaceDeliveryAddresses:Io(d)};return "customMethods"in e?{...m,...e.customMethods??{}}:m}function za(e){let t=reactRouter.useFetchers();if(!t||!t.length)return e;let r=e?.lines?structuredClone(e):{lines:{nodes:[]}},o=r.lines.nodes,n=false;for(let{formData:a}of t){if(!a)continue;let s=re.getFormInput(a);if(s.action===re.ACTIONS.LinesAdd)for(let c of s.inputs.lines){if(!c.selectedVariant){console.error("[h2:error:useOptimisticCart] No selected variant was passed in the cart action. Make sure to pass the selected variant if you want to use an optimistic cart");continue}let i=o.find(u=>u.merchandise.id===c.selectedVariant?.id);n=true,i?(i.quantity=(i.quantity||1)+(c.quantity||1),i.isOptimistic=true):o.unshift({id:So(c.selectedVariant.id),merchandise:c.selectedVariant,isOptimistic:true,quantity:c.quantity||1});}else if(s.action===re.ACTIONS.LinesRemove)for(let c of s.inputs.lineIds){let i=o.findIndex(u=>u.id===c);if(i!==-1){if(pt(o[i].id)){console.error("[h2:error:useOptimisticCart] Tried to remove an optimistic line that has not been added to the cart yet");continue}o.splice(i,1),n=true;}else console.warn(`[h2:warn:useOptimisticCart] Tried to remove line '${c}' but it doesn't exist in the cart`);}else if(s.action===re.ACTIONS.LinesUpdate)for(let c of s.inputs.lines){let i=o.findIndex(u=>c.id===u.id);if(i>-1){if(pt(o[i].id)){console.error("[h2:error:useOptimisticCart] Tried to update an optimistic line that has not been added to the cart yet");continue}o[i].quantity=c.quantity,o[i].quantity===0&&o.splice(i,1),n=true;}else console.warn(`[h2:warn:useOptimisticCart] Tried to update line '${c.id}' but it doesn't exist in the cart`);}}return n&&(r.isOptimistic=n),r.totalQuantity=o.reduce((a,s)=>a+s.quantity,0),r}var Xa="https://raw.githubusercontent.com/Shopify/hydrogen/main/docs/changelog.json";async function Za({request:e,changelogUrl:t}){new URL(e.url).searchParams;return fetch(t||Xa)}var He=reactRouter.createContext(),rr=reactRouter.createContext(),or=reactRouter.createContext(),nr=reactRouter.createContext(),ar=reactRouter.createContext(),sr=reactRouter.createContext(),es={storefront:He,cart:rr,customerAccount:or,env:nr,session:ar,waitUntil:sr};var yt="2026-04",ve=`Shopify Hydrogen ${Me}`,Eo="30243aa5-17c1-465a-8493-944bcc4e88aa",F="customerAccount",Ie="buyer";var Q=class extends Response{constructor(t,r,o){super(`Bad request: ${t}`,{status:400,headers:o});}};function be(e,t={}){let r=t.headers?new Headers(t.headers):new Headers({});return r.set("location",e),new Response(null,{status:t.status||302,headers:r})}async function ts({session:e,customerAccountId:t,customerAccountTokenExchangeUrl:r,httpsOrigin:o,debugInfo:n}){let a=new URLSearchParams,s=e.get(F),c=s?.refreshToken,i=s?.idToken;if(!c)throw Ee(e),new Q("Unauthorized","No refreshToken found in the session. Make sure your session is configured correctly and passed to `createCustomerAccountClient`.");a.append("grant_type","refresh_token"),a.append("refresh_token",c),a.append("client_id",t);let u={"content-type":"application/x-www-form-urlencoded","User-Agent":ve,Origin:o};new Date().getTime();let y=r,C=await fetch(y,{method:"POST",headers:u,body:a});if(!C.ok){let f=await C.text();throw rs(f)==="invalid_grant"&&Ee(e),new Response(f,{status:C.status,headers:{"Content-Type":"text/html; charset=utf-8"}})}let{access_token:m,expires_in:p,refresh_token:l,error:h}=await C.json();if(!m||m.length===0)throw h==="invalid_grant"&&Ee(e),new Q("Unauthorized","Invalid access token received.");e.set(F,{accessToken:m,expiresAt:new Date(new Date().getTime()+(p-120)*1e3).getTime()+"",refreshToken:l,idToken:i});}function Ee(e){e.unset(F),e.unset(Ie);}async function bo({locks:e,expiresAt:t,session:r,customerAccountId:o,customerAccountTokenExchangeUrl:n,httpsOrigin:a,debugInfo:s}){if(parseInt(t,10)-1e3<new Date().getTime())try{e.refresh||(e.refresh=ts({session:r,customerAccountId:o,customerAccountTokenExchangeUrl:n,httpsOrigin:a,debugInfo:s})),await e.refresh,delete e.refresh;}catch(c){throw c&&c.status!==401?c:new Q("Unauthorized","Login before querying the Customer Account API.")}}function rs(e){try{let t=JSON.parse(e);return typeof t?.error=="string"?t.error:void 0}catch{return}}function wo(){let e=Do();return ir(e)}async function xo(e){let t=await crypto.subtle.digest({name:"SHA-256"},new TextEncoder().encode(e)),r=os(t);return ir(r)}function Do(){let e=new Uint8Array(32);return crypto.getRandomValues(e),String.fromCharCode.apply(null,Array.from(e))}function ir(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function os(e){let t=new Uint8Array(e),r=Array.from(t);return String.fromCharCode(...r)}function Oo(){return ir(Do())}async function _o(e,t,r,o,n){let a=t;if(!e)throw new Q("Unauthorized","oAuth access token was not provided during token exchange.");let s=new URLSearchParams;s.append("grant_type","urn:ietf:params:oauth:grant-type:token-exchange"),s.append("client_id",a),s.append("audience",Eo),s.append("subject_token",e),s.append("subject_token_type","urn:ietf:params:oauth:token-type:access_token"),s.append("scopes","https://api.customers.com/auth/customer.graphql");let c={"content-type":"application/x-www-form-urlencoded","User-Agent":ve,Origin:o};new Date().getTime();let u=r,d=await fetch(u,{method:"POST",headers:c,body:s});let y=await d.json();if(y.error)throw new Q(y.error_description);return y.access_token}function Uo(e){return ns(e).payload.nonce}function ns(e){let[t,r,o]=e.split("."),n=JSON.parse(atob(t)),a=JSON.parse(atob(r));return {header:n,payload:a,signature:o}}function ft(){return ss(as())}function as(){try{return crypto.getRandomValues(new Uint8Array(16))}catch{return new Uint8Array(16).map(()=>Math.random()*255|0)}}function ss(e){return Array.from(e,function(t){return ("0"+(t&255).toString(16)).slice(-2)}).join("")}function mt(e){if(!e)return;let{pathname:t,search:r}=new URL(e),o=t+r,n=new URLSearchParams(r),a=n.get("return_to")||n.get("redirect");if(a){if(ko(e,a))return a;console.warn(`Cross-domain redirects are not supported. Tried to redirect from ${o} to ${a}`);}}function ko(e,t){try{return new URL(e).origin===new URL(t,e).origin}catch{return false}}function cr({requestUrl:e,defaultUrl:t,redirectUrl:r}){let o=e,n=Lo(e,t),a=r?Lo(e,r):n;return ko(e,a.toString())?a.toString():(console.warn(`Cross-domain redirects are not supported. Tried to redirect from ${o} to ${a}. Default url ${n} is used instead.`),n.toString())}function Lo(e,t){return is(t)?new URL(t):new URL(t,new URL(e).origin)}function is(e){try{return new URL(e),!0}catch{return false}}function Vo(e,t){let r=`https://shopify.com/${t}`,o=`https://shopify.com/authentication/${t}`;return function(a){switch(a){case "CA_BASE_URL":return r;case "CA_BASE_AUTH_URL":return o;case "GRAPHQL":return `${r}/account/customer/api/${e}/graphql`;case "AUTH":return `${o}/oauth/authorize`;case "LOGIN_SCOPE":return t?"openid email customer-account-api:full":"openid email https://api.customers.com/auth/customer.graphql";case "TOKEN_EXCHANGE":return `${o}/oauth/token`;case "LOGOUT":return `${o}/logout`}}}var No="oauth_recovery",Mo="oauth-recovery.";function cs(e,t){if(!e.url)return t;let{pathname:r}=new URL(e.url),o=r.replace(/\.data$/,"").replace(/\/_root$/,"/").replace(/(.+)\/$/,"$1"),n=t+`?${new URLSearchParams({return_to:o}).toString()}`;return be(n)}function dr({session:e,customerAccountId:t,shopId:r,customerApiVersion:o=yt,request:n,waitUntil:a,authUrl:s,customAuthStatusHandler:c,logErrors:i=true,loginPath:u="/account/login",authorizePath:d="/account/authorize",defaultRedirectPath:y="/account",language:C,useCustomAuthDomain:m}){if(o!==yt&&console.warn(`[h2:warn:createCustomerAccountClient] You are using Customer Account API version ${o} when this version of Hydrogen was built for ${yt}.`),e||console.warn("[h2:warn:createCustomerAccountClient] session is required to use Customer Account API. Ensure the session object passed in exist."),!n?.url)throw new Error("[h2:error:createCustomerAccountClient] The request object does not contain a URL.");let p=new URL(n.url),l=p.protocol==="http:"?p.origin.replace("http","https"):p.origin,h=cr({requestUrl:l,defaultUrl:d,redirectUrl:s}),f=g=>void 0,v=c||(()=>(f(p.hostname),cs(n,u))),R=Vo(o,r),S=us(R,t),A=R("GRAPHQL"),T={};async function P({query:g,type:E,variables:L={}}){let V=await j();if(!V)throw v();new Date().getTime();let $=await fetch(A,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":ve,Origin:l,Authorization:V},body:JSON.stringify({query:g,variables:L})});let q=await $.text(),ae={url:A,response:$,type:E,query:g,queryVariables:L,errors:void 0,client:"customer"};if(!$.ok){if($.status===401)throw Ee(e),v();let W;try{W=te(q);}catch{W=[{message:q}];}Fe({...ae,errors:W});}try{let W=te(q),{errors:k}=W,Ce=k?.map(({message:G,...Y})=>new fe(G,{...Y,clientOperation:`customerAccount.${ae.type}`,requestId:$.headers.get("x-request-id"),queryVariables:L,query:g}));return {...W,...k&&{errors:Ce}}}catch{Fe({...ae,errors:[{message:q}]});}}async function U(){if(!r)return false;let g=e.get(F),E=g?.accessToken,L=g?.expiresAt;if(!E||!L)return false;let V=X?.();try{await bo({locks:T,expiresAt:L,session:e,customerAccountId:t,customerAccountTokenExchangeUrl:R("TOKEN_EXCHANGE"),httpsOrigin:l,debugInfo:{waitUntil:a,stackInfo:V,...ie(n)}});}catch{return false}return true}async function M(){if(!await U())throw v()}async function j(){if(await U())return e.get(F)?.accessToken}async function de(g,E){return f(p.hostname),S(),g=Re(g),dt(g,"customer.mutate"),Te(P({query:g,type:"mutation",...E}),{logErrors:i})}async function ht(g,E){return f(p.hostname),S(),g=Re(g),ut(g,"customer.query"),Te(P({query:g,type:"query",...E}),{logErrors:i})}function je(g){e.set(Ie,{...e.get(Ie),...g});}async function K(){let g=await j();if(g)return {...e.get(Ie),customerAccessToken:g}}return {i18n:{language:C??"EN"},login:async g=>{f(p.hostname),S();let E=new URL(R("AUTH")),V=`${p.searchParams.get(No)==="true"?Mo:""}${Oo()}`,N=ft();E.searchParams.set("client_id",t),E.searchParams.set("scope","openid email"),E.searchParams.append("response_type","code"),E.searchParams.append("redirect_uri",h),E.searchParams.set("scope",R("LOGIN_SCOPE")),E.searchParams.append("state",V),E.searchParams.append("nonce",N);let Z=ds({contextLanguage:C??null,localeOverride:g?.locale??null,uiLocalesOverride:g?.uiLocales??null});Z!=null&&E.searchParams.append("locale",Z),g?.countryCode&&E.searchParams.append("region_country",g.countryCode),g?.acrValues&&E.searchParams.append("acr_values",g.acrValues),g?.loginHint&&(E.searchParams.append("login_hint",g.loginHint),g?.loginHintMode&&E.searchParams.append("login_hint_mode",g.loginHintMode));let $=wo(),q=await xo($);return e.set(F,{...e.get(F),codeVerifier:$,state:V,nonce:N,redirectPath:mt(n.url)||z(n,"Referer")||y}),E.searchParams.append("code_challenge",q),E.searchParams.append("code_challenge_method","S256"),be(E.toString())},logout:async g=>{f(p.hostname),S();let E=e.get(F)?.idToken,L=cr({requestUrl:l,defaultUrl:l,redirectUrl:g?.postLogoutRedirectUri}),V=E?new URL(`${R("LOGOUT")}?${new URLSearchParams([["id_token_hint",E],["post_logout_redirect_uri",L]]).toString()}`).toString():L;Ee(e);let N=g?.headers instanceof Headers?g?.headers:new Headers(g?.headers);return g?.keepSession||(e.destroy?N.set("Set-Cookie",await e.destroy()):console.warn("[h2:warn:customerAccount] session.destroy is not available on your session implementation. All session data might not be cleared on logout."),e.isPending=false),be(V,{headers:N})},isLoggedIn:U,handleAuthStatus:M,getAccessToken:j,getApiUrl:()=>A,mutate:de,query:ht,authorize:async()=>{f(p.hostname),S();let g=p.searchParams.get("code"),E=p.searchParams.get("state");if(!g||!E)throw new Q("Unauthorized","No code or state parameter found in the redirect URL.");let L=e.get(F);if(L?.state!==E){if(E.startsWith(Mo))throw new Q("Unable to complete sign in. Please try again.","The session state does not match the state parameter. Make sure that the session is configured correctly and passed to `createCustomerAccountClient`.");J("[h2:warn:customerAccount] OAuth callback state mismatch. Restarting customer login once.");let Ke=new URL(u,n.url);return Ke.searchParams.set("return_to",L?.redirectPath??y),Ke.searchParams.set(No,"true"),be(`${Ke.pathname}${Ke.search}`)}let V=t,N=new URLSearchParams;N.append("grant_type","authorization_code"),N.append("client_id",V),N.append("redirect_uri",h),N.append("code",g);let Z=e.get(F)?.codeVerifier;if(!Z)throw new Q("Unauthorized","No code verifier found in the session. Make sure that the session is configured correctly and passed to `createCustomerAccountClient`.");N.append("code_verifier",Z);let $={"content-type":"application/x-www-form-urlencoded","User-Agent":ve,Origin:l};new Date().getTime();let W=R("TOKEN_EXCHANGE"),k=await fetch(W,{method:"POST",headers:$,body:N});if(!k.ok)throw new Response(await k.text(),{status:k.status,headers:{"Content-Type":"text/html; charset=utf-8"}});let{access_token:Ce,expires_in:G,id_token:Y,refresh_token:Sr}=await k.json(),Rr=e.get(F)?.nonce,Pr=await Uo(Y);if(Rr!==Pr)throw new Q("Unauthorized",`Returned nonce does not match: ${Rr} !== ${Pr}`);let vr=Ce;r||(vr=await _o(Ce,t,R("TOKEN_EXCHANGE"),l,{...ie(n)}));let fn=e.get(F)?.redirectPath;return e.set(F,{accessToken:vr,expiresAt:new Date(new Date().getTime()+(G-120)*1e3).getTime()+"",refreshToken:Sr,idToken:Y}),be(fn||y)},setBuyer:je,getBuyer:K,UNSTABLE_setBuyer:g=>{J("[h2:warn:customerAccount] `customerAccount.UNSTABLE_setBuyer` is deprecated. Please use `customerAccount.setBuyer`."),je(g);},UNSTABLE_getBuyer:()=>(J("[h2:warn:customerAccount] `customerAccount.UNSTABLE_getBuyer` is deprecated. Please use `customerAccount.getBuyer`."),K())}}function us(e,t){return function(){try{if(!t)throw Error();new URL(e("CA_BASE_URL")),new URL(e("CA_BASE_AUTH_URL"));}catch{console.error(new Error("[h2:error:customerAccount] You do not have the valid credential to use Customer Account API.\nRun `h2 env pull` to link your store credentials."));let o="Internal Server Error";throw new Response(o,{status:500})}}}function ds(e){return e.localeOverride!=null?ur(e.localeOverride):e.uiLocalesOverride!=null?ur(e.uiLocalesOverride):e.contextLanguage!=null?ur(e.contextLanguage):null}function ur(e){let r=e.toLowerCase().replaceAll("_","-").split("-"),o=r[0],n=r[1];return n?`${o}-${n.toUpperCase()}`:o}function ls(e,t){let{env:r,request:o,cache:n,waitUntil:a,i18n:s,session:c,logErrors:i,storefront:u={},customerAccount:d,cart:y={},buyerIdentity:C}=e;c||console.warn("[h2:warn:createHydrogenContext] A session object is required to create hydrogen context."),d?.unstableB2b&&J("[h2:warn:createHydrogenContext] `customerAccount.unstableB2b` is now stable. Please remove the `unstableB2b` option.");let{storefront:m}=Ao({cache:n,waitUntil:a,i18n:s,logErrors:i,storefrontHeaders:u.headers||ao(o),storefrontApiVersion:u.apiVersion,storefrontId:r.PUBLIC_STOREFRONT_ID,storeDomain:r.PUBLIC_STORE_DOMAIN,privateStorefrontToken:r.PRIVATE_STOREFRONT_API_TOKEN,publicStorefrontToken:r.PUBLIC_STOREFRONT_API_TOKEN}),p=dr({session:c,request:o,waitUntil:a,logErrors:i,customerApiVersion:d?.apiVersion,authUrl:d?.authUrl,customAuthStatusHandler:d?.customAuthStatusHandler,useCustomAuthDomain:d?.useCustomAuthDomain,language:s?.language,customerAccountId:r.PUBLIC_CUSTOMER_ACCOUNT_API_CLIENT_ID,shopId:r.SHOP_ID}),l=tr({getCartId:y.getId||Nt(o.headers),setCartId:y.setId||Mt(),cartQueryFragment:y.queryFragment,cartMutateFragment:y.mutateFragment,...y.customMethods&&{customMethods:y.customMethods},buyerIdentity:C,storefront:m,customerAccount:p}),h=new reactRouter.RouterContextProvider;h.set(He,m),h.set(rr,l),h.set(or,p),h.set(nr,r),h.set(ar,c),a&&h.set(sr,a);let f={storefront:m,cart:l,customerAccount:p,env:r,session:c,waitUntil:a,...t||{}};return new Proxy(h,{get(R,S,A){if(S in R){let T=R[S];return typeof T=="function"?T.bind(R):T}return S in f?f[S]:Reflect.get(R,S,A)},has(R,S){return S in R||S in f},ownKeys(R){return [...Reflect.ownKeys(R),...Object.keys(f)]},getOwnPropertyDescriptor(R,S){if(S in R)return Reflect.getOwnPropertyDescriptor(R,S);if(S in f)return {enumerable:true,configurable:true,writable:false,value:f[S]}}})}function ys(e){return Object.entries(e).map(([t,r])=>r?`${t};desc=${r}`:void 0).filter(Boolean).join(", ")}function Fo(e,t){let r=typeof t=="string"?t:ys(t);r&&e.headers.append("Server-Timing",r);}function ms({build:e,mode:t,poweredByHeader:r=true,getLoadContext:o,collectTrackingInformation:n=true}){let a=reactRouter.createRequestHandler(e,t),s=r?c=>c.headers.append("powered-by","Shopify, Hydrogen"):void 0;return async c=>{let i=c.method;if((i==="GET"||i==="HEAD")&&c.body)return new Response(`${i} requests cannot have a body`,{status:400});let u=new URL(c.url);if(u.pathname.includes("//"))return new Response(null,{status:301,headers:{location:u.pathname.replace(/\/+/g,"/")}});let d=await o?.(c),y=d?.storefront||d?.get?.(He);if(!y)throw new Error("[h2:createRequestHandler] Storefront instance is required in the load context. Make sure to use createHydrogenContext() or provide a storefront instance via getLoadContext.");if(y.isStorefrontApiUrl(c)){let p=await y.forward(c);return s?.(p),p}if(y.isMcpUrl(c)){let p=await y.forwardMcp(c);return s?.(p),p}let C=await a(c,d);n&&y.setCollectedSubrequestHeaders(C);let m=c.headers.get("sec-fetch-dest");return (m&&m==="document"||c.headers.get("accept")?.includes("text/html"))&&Fo(C,{[oo]:"1"}),s?.(C),C}}var Ho=react.createContext(void 0),$o=Ho.Provider,pr=()=>react.useContext(Ho);function Ts(e){let t=ft(),r=Ss(t,e);return {nonce:t,header:r,NonceProvider:({children:n})=>react.createElement($o,{value:t},n)}}function Ss(e,t){let{shop:r,...o}=t??{},n=`'nonce-${e}'`,a=["'self'","'unsafe-inline'","https://cdn.shopify.com"],s=["'self'","https://cdn.shopify.com/","https://monorail-edge.shopifysvc.com"];r&&r.checkoutDomain&&s.push(`https://${r.checkoutDomain}`),r&&r.storeDomain&&s.push(`https://${r.storeDomain}`);let i={baseUri:["'self'"],defaultSrc:["'self'",n,"https://cdn.shopify.com","https://shopify.com"],frameAncestors:["'none'"],styleSrc:a,connectSrc:s},u=Object.assign({},i,o);for(let d in i){let y=o[d];d&&y&&(u[d]=Rs(y,i[d]));}return u.scriptSrc instanceof Array?u.scriptSrc=[...u.scriptSrc.filter(d=>!d.startsWith("'nonce")),n]:u.defaultSrc instanceof Array&&(u.defaultSrc=[...u.defaultSrc.filter(d=>!d.startsWith("'nonce")),n]),As__default.default({directives:u})}function Rs(e,t){let r=typeof t=="string"?[t]:t,o=Array.isArray(e)?e:[String(e)];return Array.isArray(r)?r.every(a=>a==="'none'")?o:[...o,...r]:r}var Is=react.forwardRef((e,t)=>{let{waitForHydration:r,src:o,...n}=e,a=pr();return r?jsxRuntime.jsx(Es,{src:o,options:n}):jsxRuntime.jsx("script",{suppressHydrationWarning:true,...n,src:o,nonce:a,ref:t})});function Es({src:e,options:t}){if(!e)throw new Error("`waitForHydration` with the Script component requires a `src` prop");return hydrogenReact.useLoadScript(e,{attributes:t}),null}async function ws(e){return e;}function Ds(e){let t=reactRouter.useFetchers(),r={};for(let{formData:o}of t)if(o?.get("optimistic-identifier")===e)try{if(o.has("optimistic-data")){let n=JSON.parse(String(o.get("optimistic-data")));Object.assign(r,n);}}catch{}return r}function Os({id:e,data:t}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("input",{type:"hidden",name:"optimistic-identifier",value:e}),jsxRuntime.jsx("input",{type:"hidden",name:"optimistic-data",value:JSON.stringify(t)})]})}function Vs({connection:e,children:t=()=>(console.warn("<Pagination> requires children to work properly"),null),namespace:r=""}){let [o,n]=react.useState(false),a=reactRouter.useNavigation(),s=reactRouter.useLocation();reactRouter.useNavigate();react.useEffect(()=>{a.state==="idle"&&n(false);},[a.state]);let{endCursor:i,hasNextPage:u,hasPreviousPage:d,nextPageUrl:y,nodes:C,previousPageUrl:m,startCursor:p}=Ns(e,r),l=react.useMemo(()=>({...s.state,pagination:{...s.state?.pagination||{},[r]:{pageInfo:{endCursor:i,hasPreviousPage:d,hasNextPage:u,startCursor:p},nodes:C}}}),[i,u,d,p,C,r,s.state]),h=react.useMemo(()=>react.forwardRef(function(R,S){return u?react.createElement(reactRouter.Link,{preventScrollReset:true,...R,to:y,state:l,replace:true,ref:S,onClick:()=>n(true)}):null}),[u,y,l]),f=react.useMemo(()=>react.forwardRef(function(R,S){return d?react.createElement(reactRouter.Link,{preventScrollReset:true,...R,to:m,state:l,replace:true,ref:S,onClick:()=>n(true)}):null}),[d,m,l]);return t({state:l,hasNextPage:u,hasPreviousPage:d,isLoading:o,nextPageUrl:y,nodes:C,previousPageUrl:m,NextLink:h,PreviousLink:f})}function Ct(e,t){let r=new URLSearchParams(e);return Object.keys(t?.pagination||{}).forEach(n=>{let a=n===""?"":`${n}_`,s=`${a}cursor`,c=`${a}direction`;r.delete(s),r.delete(c);}),r.toString()}function Qe(e){throw new Error(`The Pagination component requires ${"`"+e+"`"} to be a part of your query. See the guide on how to setup your query to include ${"`"+e+"`"}: https://shopify.dev/docs/custom-storefronts/hydrogen/data-fetching/pagination#setup-the-paginated-query`)}function Ns(e,t=""){e.pageInfo||Qe("pageInfo"),typeof e.pageInfo.startCursor>"u"&&Qe("pageInfo.startCursor"),typeof e.pageInfo.endCursor>"u"&&Qe("pageInfo.endCursor"),typeof e.pageInfo.hasNextPage>"u"&&Qe("pageInfo.hasNextPage"),typeof e.pageInfo.hasPreviousPage>"u"&&Qe("pageInfo.hasPreviousPage");let r=reactRouter.useNavigation(),o=reactRouter.useNavigate(),{state:n,search:a,pathname:s}=reactRouter.useLocation(),c=t?`${t}_cursor`:"cursor",i=t?`${t}_direction`:"direction",y=new URLSearchParams(a).get(i)==="previous",C=react.useMemo(()=>!globalThis?.window?.__hydrogenHydrated||!n?.pagination?.[t]?.nodes?hydrogenReact.flattenConnection(e):y?[...hydrogenReact.flattenConnection(e),...n.pagination[t].nodes||[]]:[...n.pagination[t].nodes||[],...hydrogenReact.flattenConnection(e)],[n,e,t]),m=react.useMemo(()=>{let f=globalThis?.window?.__hydrogenHydrated,v=n?.pagination?.[t]?.pageInfo,R=!f||v?.startCursor===void 0?e.pageInfo.startCursor:v.startCursor,S=!f||v?.endCursor===void 0?e.pageInfo.endCursor:v.endCursor,A=!f||v?.hasPreviousPage===void 0?e.pageInfo.hasPreviousPage:v.hasPreviousPage,T=!f||v?.hasNextPage===void 0?e.pageInfo.hasNextPage:v.hasNextPage;return n?.pagination?.[t]?.nodes&&(y?(R=e.pageInfo.startCursor,A=e.pageInfo.hasPreviousPage):(S=e.pageInfo.endCursor,T=e.pageInfo.hasNextPage)),{startCursor:R,endCursor:S,hasPreviousPage:A,hasNextPage:T}},[y,n,t,e.pageInfo.hasNextPage,e.pageInfo.hasPreviousPage,e.pageInfo.startCursor,e.pageInfo.endCursor]),p=react.useRef({params:Ct(a,n),pathname:s});react.useEffect(()=>{window.__hydrogenHydrated=true;},[]),react.useEffect(()=>{let f=Ct(a,n),v=p.current.params;(s!==p.current.pathname||f!==v)&&!(r.state==="idle"&&!r.location)&&(p.current={pathname:s,params:Ct(a,n)},o(`${s}?${Ct(a,n)}`,{replace:true,preventScrollReset:true,state:{nodes:void 0,pageInfo:void 0}}));},[s,a,n]);let l=react.useMemo(()=>{let f=new URLSearchParams(a);return f.set(i,"previous"),m.startCursor&&f.set(c,m.startCursor),`?${f.toString()}`},[a,m.startCursor]),h=react.useMemo(()=>{let f=new URLSearchParams(a);return f.set(i,"next"),m.endCursor&&f.set(c,m.endCursor),`?${f.toString()}`},[a,m.endCursor]);return {...m,previousPageUrl:l,nextPageUrl:h,nodes:C}}function Ms(e,t={pageBy:20}){if(typeof e?.url>"u")throw new Error("getPaginationVariables must be called with the Request object passed to your loader function");let{pageBy:r,namespace:o=""}=t,n=new URLSearchParams(new URL(e.url).search),a=o?`${o}_cursor`:"cursor",s=o?`${o}_direction`:"direction",c=n.get(a)??void 0;return (n.get(s)==="previous"?"previous":"next")==="previous"?{last:r,startCursor:c??null}:{first:r,endCursor:c??null}}function qs(e,t){let r=reactRouter.useNavigation(),[o,n]=react.useState([]);if(react.useEffect(()=>{Promise.resolve(t).then(a=>{a&&n(a instanceof Array?a:a.product?.variants?.nodes||[]);}).catch(a=>{reportError(new Error("[h2:error:useOptimisticVariant] An error occurred while resolving the variants for the optimistic product hook.",{cause:a}));});},[JSON.stringify(t)]),r.state==="loading"){let a=new URLSearchParams(r.location.search),s=false,c=o.find(i=>i.selectedOptions?i.selectedOptions.every(u=>a.get(u.name)===u.value):(s||(s=true,reportError(new Error("[h2:error:useOptimisticVariant] The optimistic product hook requires your product query to include variants with the selectedOptions field."))),false));if(c)return {...c,isOptimistic:true}}return e}function Ks({handle:e,options:t=[],variants:r=[],productPath:o="products",waitForNavigation:n=false,selectedVariant:a,children:s}){let c=t;c[0]?.values&&(J("[h2:warn:VariantSelector] product.options.values is deprecated. Use product.options.optionValues instead."),c[0]&&!c[0].optionValues&&(c=t.map(p=>({...p,optionValues:p.values?.map(l=>({name:l}))||[]}))));let i=r instanceof Array?r:hydrogenReact.flattenConnection(r),{searchParams:u,path:d,alreadyOnProductPage:y}=Js(e,o,n),C=c.filter(p=>p?.optionValues?.length===1),m=a?a?.selectedOptions?.reduce((p,l)=>(p[l.name]=l.value,p),{}):{};return react.createElement(react.Fragment,null,...react.useMemo(()=>c.map(p=>{let l,h=[];for(let f of p.optionValues){let v=new URLSearchParams(y?u:void 0);v.set(p.name,f.name),C.forEach(P=>{P.optionValues[0].name&&v.set(P.name,P.optionValues[0].name);});let R=i.find(P=>P?.selectedOptions?.every(U=>(v.get(U?.name)||m?.[U?.name])===U?.value)),S=u.get(p.name);!S&&a&&(S=m?.[p.name]||null);let A=S?S===f.name:false;A&&(l=f.name);let T="?"+v.toString();h.push({value:f.name,optionValue:f,isAvailable:R?R.availableForSale:true,to:d+T,search:T,isActive:A,variant:R});}return s({option:{name:p.name,value:l,values:h}})}),[c,i,s]))}var Ys=e=>{if(typeof e?.url>"u")throw new TypeError(`Expected a Request instance, got ${typeof e}`);let t=new URL(e.url).searchParams,r=[];return t.forEach((o,n)=>{r.push({name:n,value:o});}),r};function Js(e,t,r){let{pathname:o,search:n}=reactRouter.useLocation(),a=reactRouter.useNavigation();return react.useMemo(()=>{let s=/(\/[a-zA-Z]{2}-[a-zA-Z]{2}\/)/g.exec(o),c=s&&s.length>0;t=t.startsWith("/")?t.substring(1):t;let i=c?`${s[0]}${t}/${e}`:`/${t}/${e}`;return {searchParams:new URLSearchParams(r||a.state!=="loading"?n:a.location.search),alreadyOnProductPage:i===o,path:i}},[o,n,r,e,t,a])}function zs(){return {name:"hydrogen-2025.7.0",reactRouterConfig:()=>({appDirectory:"app",buildDirectory:"dist",ssr:true,future:{v8_middleware:true,v8_splitRouteModules:true,v8_viteEnvironmentApi:false,unstable_optimizeDeps:true},subResourceIntegrity:false}),reactRouterConfigResolved:({reactRouterConfig:e})=>{if(e.basename&&e.basename!=="/")throw new Error(`[Hydrogen Preset] basename is not supported in Hydrogen 2025.7.0.
|
|
542
|
+
`;function or(e){let{getCartId:t,setCartId:r,storefront:o,customerAccount:n,cartQueryFragment:a,cartMutateFragment:s,buyerIdentity:c}=e,i=t(),u=()=>i||t(),d={storefront:o,getCartId:u,cartFragment:s,customerAccount:n},y=Gt(d),C=async function(...p){p[0].buyerIdentity={...c,...p[0].buyerIdentity};let l=await y(...p);if(l?.cart&&(typeof l.cart!="object"||!("id"in l.cart)||typeof l.cart.id!="string"))throw new Error("[h2:error:createCartHandler] Cart created but response is missing a valid `id` field. Ensure your cart query fragment includes the `id` field.");return i=l?.cart&&typeof l.cart=="object"&&"id"in l.cart&&typeof l.cart.id=="string"?l.cart.id:void 0,l},m={get:qt({storefront:o,customerAccount:n,getCartId:u,cartFragment:a}),getCartId:u,setCartId:r,create:C,addLines:async(p,l)=>{let T=p.map(f=>({attributes:f.attributes,quantity:f.quantity,merchandiseId:f.merchandiseId,sellingPlanId:f.sellingPlanId,parent:f.parent}));return i||l?.cartId?await Bt(d)(T,l):await C({lines:T,buyerIdentity:c},l)},updateLines:Qt(d),removeLines:Wt(d),updateDiscountCodes:async(p,l)=>i||l?.cartId?await jt(d)(p,l):await C({discountCodes:p},l),updateGiftCardCodes:async(p,l)=>i||l?.cartId?await er(d)(p,l):await C({giftCardCodes:p},l),addGiftCardCodes:tr(d),removeGiftCardCodes:rr(d),updateBuyerIdentity:async(p,l)=>i||l?.cartId?await Kt(d)(p,l):await C({buyerIdentity:p},l),updateNote:async(p,l)=>i||l?.cartId?await Yt(d)(p,l):await C({note:p},l),updateSelectedDeliveryOption:Jt(d),updateAttributes:async(p,l)=>i||l?.cartId?await zt(d)(p,l):await C({attributes:p},l),setMetafields:async(p,l)=>i||l?.cartId?await Xt(d)(p,l):await C({metafields:p},l),deleteMetafield:Zt(d),addDeliveryAddresses:Po(d),removeDeliveryAddresses:vo(d),updateDeliveryAddresses:Io(d),replaceDeliveryAddresses:Eo(d)};return "customMethods"in e?{...m,...e.customMethods??{}}:m}function es(e){let t=reactRouter.useFetchers();if(!t||!t.length)return e;let r=e?.lines?structuredClone(e):{lines:{nodes:[]}},o=r.lines.nodes,n=false;for(let{formData:a}of t){if(!a)continue;let s=re.getFormInput(a);if(s.action===re.ACTIONS.LinesAdd)for(let c of s.inputs.lines){if(!c.selectedVariant){console.error("[h2:error:useOptimisticCart] No selected variant was passed in the cart action. Make sure to pass the selected variant if you want to use an optimistic cart");continue}let i=o.find(u=>u.merchandise.id===c.selectedVariant?.id);n=true,i?(i.quantity=(i.quantity||1)+(c.quantity||1),i.isOptimistic=true):o.unshift({id:Ro(c.selectedVariant.id),merchandise:c.selectedVariant,isOptimistic:true,quantity:c.quantity||1});}else if(s.action===re.ACTIONS.LinesRemove)for(let c of s.inputs.lineIds){let i=o.findIndex(u=>u.id===c);if(i!==-1){if(pt(o[i].id)){console.error("[h2:error:useOptimisticCart] Tried to remove an optimistic line that has not been added to the cart yet");continue}o.splice(i,1),n=true;}else console.warn(`[h2:warn:useOptimisticCart] Tried to remove line '${c}' but it doesn't exist in the cart`);}else if(s.action===re.ACTIONS.LinesUpdate)for(let c of s.inputs.lines){let i=o.findIndex(u=>c.id===u.id);if(i>-1){if(pt(o[i].id)){console.error("[h2:error:useOptimisticCart] Tried to update an optimistic line that has not been added to the cart yet");continue}o[i].quantity=c.quantity,o[i].quantity===0&&o.splice(i,1),n=true;}else console.warn(`[h2:warn:useOptimisticCart] Tried to update line '${c.id}' but it doesn't exist in the cart`);}}return n&&(r.isOptimistic=n),r.totalQuantity=o.reduce((a,s)=>a+s.quantity,0),r}var ts="https://raw.githubusercontent.com/Shopify/hydrogen/main/docs/changelog.json";async function rs({request:e,changelogUrl:t}){new URL(e.url).searchParams;return fetch(t||ts)}var He=reactRouter.createContext(),nr=reactRouter.createContext(),ar=reactRouter.createContext(),sr=reactRouter.createContext(),ir=reactRouter.createContext(),cr=reactRouter.createContext(),os={storefront:He,cart:nr,customerAccount:ar,env:sr,session:ir,waitUntil:cr};var yt="2026-04",ve=`Shopify Hydrogen ${Me}`,bo="30243aa5-17c1-465a-8493-944bcc4e88aa",F="customerAccount",Ie="buyer";var Q=class extends Response{constructor(t,r,o){super(`Bad request: ${t}`,{status:400,headers:o});}};function be(e,t={}){let r=t.headers?new Headers(t.headers):new Headers({});return r.set("location",e),new Response(null,{status:t.status||302,headers:r})}async function ns({session:e,customerAccountId:t,customerAccountTokenExchangeUrl:r,httpsOrigin:o,debugInfo:n}){let a=new URLSearchParams,s=e.get(F),c=s?.refreshToken,i=s?.idToken;if(!c)throw Ee(e),new Q("Unauthorized","No refreshToken found in the session. Make sure your session is configured correctly and passed to `createCustomerAccountClient`.");a.append("grant_type","refresh_token"),a.append("refresh_token",c),a.append("client_id",t);let u={"content-type":"application/x-www-form-urlencoded","User-Agent":ve,Origin:o};new Date().getTime();let y=r,C=await fetch(y,{method:"POST",headers:u,body:a});if(!C.ok){let f=await C.text();throw as(f)==="invalid_grant"&&Ee(e),new Response(f,{status:C.status,headers:{"Content-Type":"text/html; charset=utf-8"}})}let{access_token:m,expires_in:p,refresh_token:l,error:T}=await C.json();if(!m||m.length===0)throw T==="invalid_grant"&&Ee(e),new Q("Unauthorized","Invalid access token received.");e.set(F,{accessToken:m,expiresAt:new Date(new Date().getTime()+(p-120)*1e3).getTime()+"",refreshToken:l,idToken:i});}function Ee(e){e.unset(F),e.unset(Ie);}async function wo({locks:e,expiresAt:t,session:r,customerAccountId:o,customerAccountTokenExchangeUrl:n,httpsOrigin:a,debugInfo:s}){if(parseInt(t,10)-1e3<new Date().getTime())try{e.refresh||(e.refresh=ns({session:r,customerAccountId:o,customerAccountTokenExchangeUrl:n,httpsOrigin:a,debugInfo:s})),await e.refresh,delete e.refresh;}catch(c){throw c&&c.status!==401?c:new Q("Unauthorized","Login before querying the Customer Account API.")}}function as(e){try{let t=JSON.parse(e);return typeof t?.error=="string"?t.error:void 0}catch{return}}function xo(){let e=Oo();return ur(e)}async function Do(e){let t=await crypto.subtle.digest({name:"SHA-256"},new TextEncoder().encode(e)),r=ss(t);return ur(r)}function Oo(){let e=new Uint8Array(32);return crypto.getRandomValues(e),String.fromCharCode.apply(null,Array.from(e))}function ur(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ss(e){let t=new Uint8Array(e),r=Array.from(t);return String.fromCharCode(...r)}function _o(){return ur(Oo())}async function Uo(e,t,r,o,n){let a=t;if(!e)throw new Q("Unauthorized","oAuth access token was not provided during token exchange.");let s=new URLSearchParams;s.append("grant_type","urn:ietf:params:oauth:grant-type:token-exchange"),s.append("client_id",a),s.append("audience",bo),s.append("subject_token",e),s.append("subject_token_type","urn:ietf:params:oauth:token-type:access_token"),s.append("scopes","https://api.customers.com/auth/customer.graphql");let c={"content-type":"application/x-www-form-urlencoded","User-Agent":ve,Origin:o};new Date().getTime();let u=r,d=await fetch(u,{method:"POST",headers:c,body:s});let y=await d.json();if(y.error)throw new Q(y.error_description);return y.access_token}function Lo(e){return is(e).payload.nonce}function is(e){let[t,r,o]=e.split("."),n=JSON.parse(atob(t)),a=JSON.parse(atob(r));return {header:n,payload:a,signature:o}}function ft(){return us(cs())}function cs(){try{return crypto.getRandomValues(new Uint8Array(16))}catch{return new Uint8Array(16).map(()=>Math.random()*255|0)}}function us(e){return Array.from(e,function(t){return ("0"+(t&255).toString(16)).slice(-2)}).join("")}function mt(e){if(!e)return;let{pathname:t,search:r}=new URL(e),o=t+r,n=new URLSearchParams(r),a=n.get("return_to")||n.get("redirect");if(a){if(Vo(e,a))return a;console.warn(`Cross-domain redirects are not supported. Tried to redirect from ${o} to ${a}`);}}function Vo(e,t){try{return new URL(e).origin===new URL(t,e).origin}catch{return false}}function dr({requestUrl:e,defaultUrl:t,redirectUrl:r}){let o=e,n=ko(e,t),a=r?ko(e,r):n;return Vo(e,a.toString())?a.toString():(console.warn(`Cross-domain redirects are not supported. Tried to redirect from ${o} to ${a}. Default url ${n} is used instead.`),n.toString())}function ko(e,t){return ds(t)?new URL(t):new URL(t,new URL(e).origin)}function ds(e){try{return new URL(e),!0}catch{return false}}function No(e,t){let r=`https://shopify.com/${t}`,o=`https://shopify.com/authentication/${t}`;return function(a){switch(a){case "CA_BASE_URL":return r;case "CA_BASE_AUTH_URL":return o;case "GRAPHQL":return `${r}/account/customer/api/${e}/graphql`;case "AUTH":return `${o}/oauth/authorize`;case "LOGIN_SCOPE":return t?"openid email customer-account-api:full":"openid email https://api.customers.com/auth/customer.graphql";case "TOKEN_EXCHANGE":return `${o}/oauth/token`;case "LOGOUT":return `${o}/logout`}}}var Mo="oauth_recovery",Fo="oauth-recovery.";function ps(e,t){if(!e.url)return t;let{pathname:r}=new URL(e.url),o=r.replace(/\.data$/,"").replace(/\/_root$/,"/").replace(/(.+)\/$/,"$1"),n=t+`?${new URLSearchParams({return_to:o}).toString()}`;return be(n)}function lr({session:e,customerAccountId:t,shopId:r,customerApiVersion:o=yt,request:n,waitUntil:a,authUrl:s,customAuthStatusHandler:c,logErrors:i=true,loginPath:u="/account/login",authorizePath:d="/account/authorize",defaultRedirectPath:y="/account",language:C,useCustomAuthDomain:m}){if(o!==yt&&console.warn(`[h2:warn:createCustomerAccountClient] You are using Customer Account API version ${o} when this version of Hydrogen was built for ${yt}.`),e||console.warn("[h2:warn:createCustomerAccountClient] session is required to use Customer Account API. Ensure the session object passed in exist."),!n?.url)throw new Error("[h2:error:createCustomerAccountClient] The request object does not contain a URL.");let p=new URL(n.url),l=p.protocol==="http:"?p.origin.replace("http","https"):p.origin,T=dr({requestUrl:l,defaultUrl:d,redirectUrl:s}),f=g=>void 0,v=c||(()=>(f(p.hostname),ps(n,u))),h=No(o,r),S=ls(h,t),A=h("GRAPHQL"),R={};async function P({query:g,type:E,variables:L={}}){let V=await j();if(!V)throw v();new Date().getTime();let $=await fetch(A,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":ve,Origin:l,Authorization:V},body:JSON.stringify({query:g,variables:L})});let q=await $.text(),ae={url:A,response:$,type:E,query:g,queryVariables:L,errors:void 0,client:"customer"};if(!$.ok){if($.status===401)throw Ee(e),v();let W;try{W=te(q);}catch{W=[{message:q}];}Fe({...ae,errors:W});}try{let W=te(q),{errors:k}=W,Ce=k?.map(({message:G,...Y})=>new fe(G,{...Y,clientOperation:`customerAccount.${ae.type}`,requestId:$.headers.get("x-request-id"),queryVariables:L,query:g}));return {...W,...k&&{errors:Ce}}}catch{Fe({...ae,errors:[{message:q}]});}}async function U(){if(!r)return false;let g=e.get(F),E=g?.accessToken,L=g?.expiresAt;if(!E||!L)return false;let V=X?.();try{await wo({locks:R,expiresAt:L,session:e,customerAccountId:t,customerAccountTokenExchangeUrl:h("TOKEN_EXCHANGE"),httpsOrigin:l,debugInfo:{waitUntil:a,stackInfo:V,...ie(n)}});}catch{return false}return true}async function M(){if(!await U())throw v()}async function j(){if(await U())return e.get(F)?.accessToken}async function de(g,E){return f(p.hostname),S(),g=Re(g),dt(g,"customer.mutate"),Te(P({query:g,type:"mutation",...E}),{logErrors:i})}async function ht(g,E){return f(p.hostname),S(),g=Re(g),ut(g,"customer.query"),Te(P({query:g,type:"query",...E}),{logErrors:i})}function je(g){e.set(Ie,{...e.get(Ie),...g});}async function K(){let g=await j();if(g)return {...e.get(Ie),customerAccessToken:g}}return {i18n:{language:C??"EN"},login:async g=>{f(p.hostname),S();let E=new URL(h("AUTH")),V=`${p.searchParams.get(Mo)==="true"?Fo:""}${_o()}`,N=ft();E.searchParams.set("client_id",t),E.searchParams.set("scope","openid email"),E.searchParams.append("response_type","code"),E.searchParams.append("redirect_uri",T),E.searchParams.set("scope",h("LOGIN_SCOPE")),E.searchParams.append("state",V),E.searchParams.append("nonce",N);let Z=ys({contextLanguage:C??null,localeOverride:g?.locale??null,uiLocalesOverride:g?.uiLocales??null});Z!=null&&E.searchParams.append("locale",Z),g?.countryCode&&E.searchParams.append("region_country",g.countryCode),g?.acrValues&&E.searchParams.append("acr_values",g.acrValues),g?.loginHint&&(E.searchParams.append("login_hint",g.loginHint),g?.loginHintMode&&E.searchParams.append("login_hint_mode",g.loginHintMode));let $=xo(),q=await Do($);return e.set(F,{...e.get(F),codeVerifier:$,state:V,nonce:N,redirectPath:mt(n.url)||z(n,"Referer")||y}),E.searchParams.append("code_challenge",q),E.searchParams.append("code_challenge_method","S256"),be(E.toString())},logout:async g=>{f(p.hostname),S();let E=e.get(F)?.idToken,L=dr({requestUrl:l,defaultUrl:l,redirectUrl:g?.postLogoutRedirectUri}),V=E?new URL(`${h("LOGOUT")}?${new URLSearchParams([["id_token_hint",E],["post_logout_redirect_uri",L]]).toString()}`).toString():L;Ee(e);let N=g?.headers instanceof Headers?g?.headers:new Headers(g?.headers);return g?.keepSession||(e.destroy?N.set("Set-Cookie",await e.destroy()):console.warn("[h2:warn:customerAccount] session.destroy is not available on your session implementation. All session data might not be cleared on logout."),e.isPending=false),be(V,{headers:N})},isLoggedIn:U,handleAuthStatus:M,getAccessToken:j,getApiUrl:()=>A,mutate:de,query:ht,authorize:async()=>{f(p.hostname),S();let g=p.searchParams.get("code"),E=p.searchParams.get("state");if(!g||!E)throw new Q("Unauthorized","No code or state parameter found in the redirect URL.");let L=e.get(F);if(L?.state!==E){if(E.startsWith(Fo))throw new Q("Unable to complete sign in. Please try again.","The session state does not match the state parameter. Make sure that the session is configured correctly and passed to `createCustomerAccountClient`.");J("[h2:warn:customerAccount] OAuth callback state mismatch. Restarting customer login once.");let Ke=new URL(u,n.url);return Ke.searchParams.set("return_to",L?.redirectPath??y),Ke.searchParams.set(Mo,"true"),be(`${Ke.pathname}${Ke.search}`)}let V=t,N=new URLSearchParams;N.append("grant_type","authorization_code"),N.append("client_id",V),N.append("redirect_uri",T),N.append("code",g);let Z=e.get(F)?.codeVerifier;if(!Z)throw new Q("Unauthorized","No code verifier found in the session. Make sure that the session is configured correctly and passed to `createCustomerAccountClient`.");N.append("code_verifier",Z);let $={"content-type":"application/x-www-form-urlencoded","User-Agent":ve,Origin:l};new Date().getTime();let W=h("TOKEN_EXCHANGE"),k=await fetch(W,{method:"POST",headers:$,body:N});if(!k.ok)throw new Response(await k.text(),{status:k.status,headers:{"Content-Type":"text/html; charset=utf-8"}});let{access_token:Ce,expires_in:G,id_token:Y,refresh_token:Pr}=await k.json(),vr=e.get(F)?.nonce,Ir=await Lo(Y);if(vr!==Ir)throw new Q("Unauthorized",`Returned nonce does not match: ${vr} !== ${Ir}`);let Er=Ce;r||(Er=await Uo(Ce,t,h("TOKEN_EXCHANGE"),l,{...ie(n)}));let mn=e.get(F)?.redirectPath;return e.set(F,{accessToken:Er,expiresAt:new Date(new Date().getTime()+(G-120)*1e3).getTime()+"",refreshToken:Pr,idToken:Y}),be(mn||y)},setBuyer:je,getBuyer:K,UNSTABLE_setBuyer:g=>{J("[h2:warn:customerAccount] `customerAccount.UNSTABLE_setBuyer` is deprecated. Please use `customerAccount.setBuyer`."),je(g);},UNSTABLE_getBuyer:()=>(J("[h2:warn:customerAccount] `customerAccount.UNSTABLE_getBuyer` is deprecated. Please use `customerAccount.getBuyer`."),K())}}function ls(e,t){return function(){try{if(!t)throw Error();new URL(e("CA_BASE_URL")),new URL(e("CA_BASE_AUTH_URL"));}catch{console.error(new Error("[h2:error:customerAccount] You do not have the valid credential to use Customer Account API.\nRun `h2 env pull` to link your store credentials."));let o="Internal Server Error";throw new Response(o,{status:500})}}}function ys(e){return e.localeOverride!=null?pr(e.localeOverride):e.uiLocalesOverride!=null?pr(e.uiLocalesOverride):e.contextLanguage!=null?pr(e.contextLanguage):null}function pr(e){let r=e.toLowerCase().replaceAll("_","-").split("-"),o=r[0],n=r[1];return n?`${o}-${n.toUpperCase()}`:o}function ms(e,t){let{env:r,request:o,cache:n,waitUntil:a,i18n:s,session:c,logErrors:i,storefront:u={},customerAccount:d,cart:y={},buyerIdentity:C}=e;c||console.warn("[h2:warn:createHydrogenContext] A session object is required to create hydrogen context."),d?.unstableB2b&&J("[h2:warn:createHydrogenContext] `customerAccount.unstableB2b` is now stable. Please remove the `unstableB2b` option.");let{storefront:m}=To({cache:n,waitUntil:a,i18n:s,logErrors:i,storefrontHeaders:u.headers||so(o),storefrontApiVersion:u.apiVersion,storefrontId:r.PUBLIC_STOREFRONT_ID,storeDomain:r.PUBLIC_STORE_DOMAIN,privateStorefrontToken:r.PRIVATE_STOREFRONT_API_TOKEN,publicStorefrontToken:r.PUBLIC_STOREFRONT_API_TOKEN}),p=lr({session:c,request:o,waitUntil:a,logErrors:i,customerApiVersion:d?.apiVersion,authUrl:d?.authUrl,customAuthStatusHandler:d?.customAuthStatusHandler,useCustomAuthDomain:d?.useCustomAuthDomain,language:s?.language,customerAccountId:r.PUBLIC_CUSTOMER_ACCOUNT_API_CLIENT_ID,shopId:r.SHOP_ID}),l=or({getCartId:y.getId||Ft(o.headers),setCartId:y.setId||Ht(),cartQueryFragment:y.queryFragment,cartMutateFragment:y.mutateFragment,...y.customMethods&&{customMethods:y.customMethods},buyerIdentity:C,storefront:m,customerAccount:p}),T=new reactRouter.RouterContextProvider;T.set(He,m),T.set(nr,l),T.set(ar,p),T.set(sr,r),T.set(ir,c),a&&T.set(cr,a);let f={storefront:m,cart:l,customerAccount:p,env:r,session:c,waitUntil:a,...t||{}};return new Proxy(T,{get(h,S,A){if(S in h){let R=h[S];return typeof R=="function"?R.bind(h):R}return S in f?f[S]:Reflect.get(h,S,A)},has(h,S){return S in h||S in f},ownKeys(h){return [...Reflect.ownKeys(h),...Object.keys(f)]},getOwnPropertyDescriptor(h,S){if(S in h)return Reflect.getOwnPropertyDescriptor(h,S);if(S in f)return {enumerable:true,configurable:true,writable:false,value:f[S]}}})}function Cs(e){return Object.entries(e).map(([t,r])=>r?`${t};desc=${r}`:void 0).filter(Boolean).join(", ")}function Ho(e,t){let r=typeof t=="string"?t:Cs(t);r&&e.headers.append("Server-Timing",r);}function hs({build:e,mode:t,poweredByHeader:r=true,getLoadContext:o,collectTrackingInformation:n=true}){let a=reactRouter.createRequestHandler(e,t),s=r?c=>c.headers.append("powered-by","Shopify, Hydrogen"):void 0;return async c=>{let i=c.method;if((i==="GET"||i==="HEAD")&&c.body)return new Response(`${i} requests cannot have a body`,{status:400});let u=new URL(c.url);if(u.pathname.includes("//"))return new Response(null,{status:301,headers:{location:u.pathname.replace(/\/+/g,"/")}});let d=await o?.(c),y=d?.storefront||d?.get?.(He);if(!y)throw new Error("[h2:createRequestHandler] Storefront instance is required in the load context. Make sure to use createHydrogenContext() or provide a storefront instance via getLoadContext.");if(y.isStorefrontApiUrl(c)){let p=await y.forward(c);return s?.(p),p}if(y.isMcpUrl(c)){let p=await y.forwardMcp(c);return s?.(p),p}let C=await a(c,d);n&&y.setCollectedSubrequestHeaders(C);let m=c.headers.get("sec-fetch-dest");return (m&&m==="document"||c.headers.get("accept")?.includes("text/html"))&&Ho(C,{[no]:"1"}),s?.(C),C}}var $o=react.createContext(void 0),qo=$o.Provider,yr=()=>react.useContext($o);function Ps(e){let t=ft(),r=vs(t,e);return {nonce:t,header:r,NonceProvider:({children:n})=>react.createElement(qo,{value:t},n)}}function vs(e,t){let{shop:r,...o}=t??{},n=`'nonce-${e}'`,a=["'self'","'unsafe-inline'","https://cdn.shopify.com"],s=["'self'","https://cdn.shopify.com/","https://monorail-edge.shopifysvc.com"];r&&r.checkoutDomain&&s.push(`https://${r.checkoutDomain}`),r&&r.storeDomain&&s.push(`https://${r.storeDomain}`);let i={baseUri:["'self'"],defaultSrc:["'self'",n,"https://cdn.shopify.com","https://shopify.com"],frameAncestors:["'none'"],styleSrc:a,connectSrc:s},u=Object.assign({},i,o);for(let d in i){let y=o[d];d&&y&&(u[d]=Is(y,i[d]));}return u.scriptSrc instanceof Array?u.scriptSrc=[...u.scriptSrc.filter(d=>!d.startsWith("'nonce")),n]:u.defaultSrc instanceof Array&&(u.defaultSrc=[...u.defaultSrc.filter(d=>!d.startsWith("'nonce")),n]),Rs__default.default({directives:u})}function Is(e,t){let r=typeof t=="string"?[t]:t,o=Array.isArray(e)?e:[String(e)];return Array.isArray(r)?r.every(a=>a==="'none'")?o:[...o,...r]:r}var ws=react.forwardRef((e,t)=>{let{waitForHydration:r,src:o,...n}=e,a=yr();return r?jsxRuntime.jsx(xs,{src:o,options:n}):jsxRuntime.jsx("script",{suppressHydrationWarning:true,...n,src:o,nonce:a,ref:t})});function xs({src:e,options:t}){if(!e)throw new Error("`waitForHydration` with the Script component requires a `src` prop");return hydrogenReact.useLoadScript(e,{attributes:t}),null}async function Os(e){return e;}function Us(e){let t=reactRouter.useFetchers(),r={};for(let{formData:o}of t)if(o?.get("optimistic-identifier")===e)try{if(o.has("optimistic-data")){let n=JSON.parse(String(o.get("optimistic-data")));Object.assign(r,n);}}catch{}return r}function Ls({id:e,data:t}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("input",{type:"hidden",name:"optimistic-identifier",value:e}),jsxRuntime.jsx("input",{type:"hidden",name:"optimistic-data",value:JSON.stringify(t)})]})}function Fs({connection:e,children:t=()=>(console.warn("<Pagination> requires children to work properly"),null),namespace:r=""}){let [o,n]=react.useState(false),a=reactRouter.useNavigation(),s=reactRouter.useLocation();reactRouter.useNavigate();react.useEffect(()=>{a.state==="idle"&&n(false);},[a.state]);let{endCursor:i,hasNextPage:u,hasPreviousPage:d,nextPageUrl:y,nodes:C,previousPageUrl:m,startCursor:p}=Hs(e,r),l=react.useMemo(()=>({...s.state,pagination:{...s.state?.pagination||{},[r]:{pageInfo:{endCursor:i,hasPreviousPage:d,hasNextPage:u,startCursor:p},nodes:C}}}),[i,u,d,p,C,r,s.state]),T=react.useMemo(()=>react.forwardRef(function(h,S){return u?react.createElement(reactRouter.Link,{preventScrollReset:true,...h,to:y,state:l,replace:true,ref:S,onClick:()=>n(true)}):null}),[u,y,l]),f=react.useMemo(()=>react.forwardRef(function(h,S){return d?react.createElement(reactRouter.Link,{preventScrollReset:true,...h,to:m,state:l,replace:true,ref:S,onClick:()=>n(true)}):null}),[d,m,l]);return t({state:l,hasNextPage:u,hasPreviousPage:d,isLoading:o,nextPageUrl:y,nodes:C,previousPageUrl:m,NextLink:T,PreviousLink:f})}function Ct(e,t){let r=new URLSearchParams(e);return Object.keys(t?.pagination||{}).forEach(n=>{let a=n===""?"":`${n}_`,s=`${a}cursor`,c=`${a}direction`;r.delete(s),r.delete(c);}),r.toString()}function Qe(e){throw new Error(`The Pagination component requires ${"`"+e+"`"} to be a part of your query. See the guide on how to setup your query to include ${"`"+e+"`"}: https://shopify.dev/docs/custom-storefronts/hydrogen/data-fetching/pagination#setup-the-paginated-query`)}function Hs(e,t=""){e.pageInfo||Qe("pageInfo"),typeof e.pageInfo.startCursor>"u"&&Qe("pageInfo.startCursor"),typeof e.pageInfo.endCursor>"u"&&Qe("pageInfo.endCursor"),typeof e.pageInfo.hasNextPage>"u"&&Qe("pageInfo.hasNextPage"),typeof e.pageInfo.hasPreviousPage>"u"&&Qe("pageInfo.hasPreviousPage");let r=reactRouter.useNavigation(),o=reactRouter.useNavigate(),{state:n,search:a,pathname:s}=reactRouter.useLocation(),c=t?`${t}_cursor`:"cursor",i=t?`${t}_direction`:"direction",y=new URLSearchParams(a).get(i)==="previous",C=react.useMemo(()=>!globalThis?.window?.__hydrogenHydrated||!n?.pagination?.[t]?.nodes?hydrogenReact.flattenConnection(e):y?[...hydrogenReact.flattenConnection(e),...n.pagination[t].nodes||[]]:[...n.pagination[t].nodes||[],...hydrogenReact.flattenConnection(e)],[n,e,t]),m=react.useMemo(()=>{let f=globalThis?.window?.__hydrogenHydrated,v=n?.pagination?.[t]?.pageInfo,h=!f||v?.startCursor===void 0?e.pageInfo.startCursor:v.startCursor,S=!f||v?.endCursor===void 0?e.pageInfo.endCursor:v.endCursor,A=!f||v?.hasPreviousPage===void 0?e.pageInfo.hasPreviousPage:v.hasPreviousPage,R=!f||v?.hasNextPage===void 0?e.pageInfo.hasNextPage:v.hasNextPage;return n?.pagination?.[t]?.nodes&&(y?(h=e.pageInfo.startCursor,A=e.pageInfo.hasPreviousPage):(S=e.pageInfo.endCursor,R=e.pageInfo.hasNextPage)),{startCursor:h,endCursor:S,hasPreviousPage:A,hasNextPage:R}},[y,n,t,e.pageInfo.hasNextPage,e.pageInfo.hasPreviousPage,e.pageInfo.startCursor,e.pageInfo.endCursor]),p=react.useRef({params:Ct(a,n),pathname:s});react.useEffect(()=>{window.__hydrogenHydrated=true;},[]),react.useEffect(()=>{let f=Ct(a,n),v=p.current.params;(s!==p.current.pathname||f!==v)&&!(r.state==="idle"&&!r.location)&&(p.current={pathname:s,params:Ct(a,n)},o(`${s}?${Ct(a,n)}`,{replace:true,preventScrollReset:true,state:{nodes:void 0,pageInfo:void 0}}));},[s,a,n]);let l=react.useMemo(()=>{let f=new URLSearchParams(a);return f.set(i,"previous"),m.startCursor&&f.set(c,m.startCursor),`?${f.toString()}`},[a,m.startCursor]),T=react.useMemo(()=>{let f=new URLSearchParams(a);return f.set(i,"next"),m.endCursor&&f.set(c,m.endCursor),`?${f.toString()}`},[a,m.endCursor]);return {...m,previousPageUrl:l,nextPageUrl:T,nodes:C}}function $s(e,t={pageBy:20}){if(typeof e?.url>"u")throw new Error("getPaginationVariables must be called with the Request object passed to your loader function");let{pageBy:r,namespace:o=""}=t,n=new URLSearchParams(new URL(e.url).search),a=o?`${o}_cursor`:"cursor",s=o?`${o}_direction`:"direction",c=n.get(a)??void 0;return (n.get(s)==="previous"?"previous":"next")==="previous"?{last:r,startCursor:c??null}:{first:r,endCursor:c??null}}function Qs(e,t){let r=reactRouter.useNavigation(),[o,n]=react.useState([]);if(react.useEffect(()=>{Promise.resolve(t).then(a=>{a&&n(a instanceof Array?a:a.product?.variants?.nodes||[]);}).catch(a=>{reportError(new Error("[h2:error:useOptimisticVariant] An error occurred while resolving the variants for the optimistic product hook.",{cause:a}));});},[JSON.stringify(t)]),r.state==="loading"){let a=new URLSearchParams(r.location.search),s=false,c=o.find(i=>i.selectedOptions?i.selectedOptions.every(u=>a.get(u.name)===u.value):(s||(s=true,reportError(new Error("[h2:error:useOptimisticVariant] The optimistic product hook requires your product query to include variants with the selectedOptions field."))),false));if(c)return {...c,isOptimistic:true}}return e}function zs({handle:e,options:t=[],variants:r=[],productPath:o="products",waitForNavigation:n=false,selectedVariant:a,children:s}){let c=t;c[0]?.values&&(J("[h2:warn:VariantSelector] product.options.values is deprecated. Use product.options.optionValues instead."),c[0]&&!c[0].optionValues&&(c=t.map(p=>({...p,optionValues:p.values?.map(l=>({name:l}))||[]}))));let i=r instanceof Array?r:hydrogenReact.flattenConnection(r),{searchParams:u,path:d,alreadyOnProductPage:y}=Zs(e,o,n),C=c.filter(p=>p?.optionValues?.length===1),m=a?a?.selectedOptions?.reduce((p,l)=>(p[l.name]=l.value,p),{}):{};return react.createElement(react.Fragment,null,...react.useMemo(()=>c.map(p=>{let l,T=[];for(let f of p.optionValues){let v=new URLSearchParams(y?u:void 0);v.set(p.name,f.name),C.forEach(P=>{P.optionValues[0].name&&v.set(P.name,P.optionValues[0].name);});let h=i.find(P=>P?.selectedOptions?.every(U=>(v.get(U?.name)||m?.[U?.name])===U?.value)),S=u.get(p.name);!S&&a&&(S=m?.[p.name]||null);let A=S?S===f.name:false;A&&(l=f.name);let R="?"+v.toString();T.push({value:f.name,optionValue:f,isAvailable:h?h.availableForSale:true,to:d+R,search:R,isActive:A,variant:h});}return s({option:{name:p.name,value:l,values:T}})}),[c,i,s]))}var Xs=e=>{if(typeof e?.url>"u")throw new TypeError(`Expected a Request instance, got ${typeof e}`);let t=new URL(e.url).searchParams,r=[];return t.forEach((o,n)=>{r.push({name:n,value:o});}),r};function Zs(e,t,r){let{pathname:o,search:n}=reactRouter.useLocation(),a=reactRouter.useNavigation();return react.useMemo(()=>{let s=/(\/[a-zA-Z]{2}-[a-zA-Z]{2}\/)/g.exec(o),c=s&&s.length>0;t=t.startsWith("/")?t.substring(1):t;let i=c?`${s[0]}${t}/${e}`:`/${t}/${e}`;return {searchParams:new URLSearchParams(r||a.state!=="loading"?n:a.location.search),alreadyOnProductPage:i===o,path:i}},[o,n,r,e,t,a])}function ei(){return {name:"hydrogen-2025.7.0",reactRouterConfig:()=>({appDirectory:"app",buildDirectory:"dist",ssr:true,future:{v8_middleware:true,v8_splitRouteModules:true,v8_viteEnvironmentApi:false,unstable_optimizeDeps:true},subResourceIntegrity:false}),reactRouterConfigResolved:({reactRouterConfig:e})=>{if(e.basename&&e.basename!=="/")throw new Error(`[Hydrogen Preset] basename is not supported in Hydrogen 2025.7.0.
|
|
543
543
|
Reason: Requires major CLI infrastructure modernization.
|
|
544
544
|
Workaround: Use reverse proxy or CDN path rewriting for subdirectory hosting.`);if(e.prerender)throw new Error(`[Hydrogen Preset] prerender is not supported in Hydrogen 2025.7.0.
|
|
545
545
|
Reason: React Router plugin incompatibility with Hydrogen CLI build pipeline.
|
|
@@ -549,7 +549,7 @@ Alternative: Route-level code splitting via v8_splitRouteModules is enabled.`);i
|
|
|
549
549
|
Reason: Hydrogen CLI bypasses React Router buildEnd hook execution.
|
|
550
550
|
Workaround: Use external build scripts or package.json post-build hooks.`);if(e.subResourceIntegrity===true)throw new Error(`[Hydrogen Preset] subResourceIntegrity cannot be enabled.
|
|
551
551
|
Reason: Conflicts with Hydrogen CSP nonce-based authentication.
|
|
552
|
-
Impact: Would break Content Security Policy and cause script execution failures.`)}}}var
|
|
552
|
+
Impact: Would break Content Security Policy and cause script execution failures.`)}}}var oi=function(e){return jsxRuntime.jsx(hydrogenReact.RichText,{...e,components:{link:({node:t})=>jsxRuntime.jsx(reactRouter.Link,{to:t.url,title:t.title,target:t.target,prefetch:"intent",children:t.children}),...e.components}})};var ni=async function({request:t,context:r}){let o=r.storefront,n=r.customerAccount,a=new URL(t.url);if(!o)throw new Error("GraphiQL: Hydrogen's storefront client must be injected in the loader context.");let s={};if(o){let u="X-Shopify-Storefront-Access-Token";s.storefront={name:"Storefront API",authHeader:u,accessToken:o.getPublicTokenHeaders()[u],apiUrl:o.getApiUrl(),icon:"SF"};}if(n){let u=await(await fetch(a.origin+"/graphiql/customer-account.schema.json")).json(),d=await n.getAccessToken();u&&(s["customer-account"]={name:"Customer Account API",value:u,authHeader:"Authorization",accessToken:d,apiUrl:n.getApiUrl(),icon:"CA"});}let c="https://avatars.githubusercontent.com/u/12972006?s=48&v=4",i=String.raw;return new Response(i`
|
|
553
553
|
<!DOCTYPE html>
|
|
554
554
|
<html lang="en">
|
|
555
555
|
<head>
|
|
@@ -868,7 +868,7 @@ Impact: Would break Content Security Policy and cause script execution failures.
|
|
|
868
868
|
</div>
|
|
869
869
|
</body>
|
|
870
870
|
</html>
|
|
871
|
-
`,{status:200,headers:{"content-type":"text/html"}})};var
|
|
871
|
+
`,{status:200,headers:{"content-type":"text/html"}})};var on=".data",Cr="_root.data",nn="_.data";async function ai(e){let{storefront:t,request:r,noAdminRedirect:o,matchQueryParams:n,response:a=new Response("Not Found",{status:404})}=e,s=new URL(r.url),{searchParams:c}=s,{pathname:i,isSoftNavigation:u}=si(s.pathname);c.delete("redirect"),c.delete("return_to"),c.delete("_routes");let d=(n?`${i}${s.search}`:i).toLowerCase();if(i==="/admin"&&!o)return hr(`${t.getShopifyDomain()}/admin`,u,c,n);try{let{urlRedirects:y}=await t.query(ii,{variables:{query:"path:"+d.replace(/\/+$/,"")}}),C=y?.edges?.[0]?.node?.target;if(C)return hr(C,u,c,n);let m=mt(r.url);if(m)return hr(m,u,c,n)}catch(y){console.error(`Failed to fetch redirects from Storefront API for route ${d}`,y);}return a}var gr="https://example.com";function hr(e,t,r,o){let n=new URL(e,gr);if(!o)for(let[a,s]of r)n.searchParams.append(a,s);return t?new Response(null,{status:204,headers:{"X-Remix-Redirect":n.toString().replace(gr,""),"X-Remix-Status":"301"}}):new Response(null,{status:301,headers:{location:n.toString().replace(gr,"")}})}function si(e){return e.endsWith(on)?e.endsWith("/"+nn)?{pathname:e.slice(0,-nn.length),isSoftNavigation:true}:e==="/"+Cr||e.endsWith("/"+Cr)?{pathname:e.slice(0,-Cr.length)||"/",isSoftNavigation:true}:{pathname:e.slice(0,-on.length),isSoftNavigation:true}:{pathname:e,isSoftNavigation:false}}var ii=`#graphql
|
|
872
872
|
query redirects($query: String) {
|
|
873
873
|
urlRedirects(first: 1, query: $query) {
|
|
874
874
|
edges {
|
|
@@ -878,24 +878,24 @@ Impact: Would break Content Security Policy and cause script execution failures.
|
|
|
878
878
|
}
|
|
879
879
|
}
|
|
880
880
|
}
|
|
881
|
-
`;var
|
|
881
|
+
`;var ci={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},ui=/[&><\u2028\u2029]/g;function an(e){return e.replace(ui,t=>ci[t])}var ce="Error in SEO input: ",oe={title:{validate:e=>{if(typeof e!="string")throw new Error(ce.concat("`title` should be a string"));if(typeof e=="string"&&e.length>70)throw new Error(ce.concat("`title` should not be longer than 70 characters"));return e}},description:{validate:e=>{if(typeof e!="string")throw new Error(ce.concat("`description` should be a string"));if(typeof e=="string"&&e.length>155)throw new Error(ce.concat("`description` should not be longer than 160 characters"));return e}},url:{validate:e=>{if(typeof e!="string")throw new Error(ce.concat("`url` should be a string"));if(typeof e=="string"&&!e.startsWith("http"))throw new Error(ce.concat("`url` should be a valid URL"));return e}},handle:{validate:e=>{if(typeof e!="string")throw new Error(ce.concat("`handle` should be a string"));if(typeof e=="string"&&!e.startsWith("@"))throw new Error(ce.concat("`handle` should start with `@`"));return e}}};function sn(e){let t=[];for(let r of Object.keys(e))switch(r){case "title":{let o=ne(oe.title,e.title),n=Tr(e?.titleTemplate,o);if(!n)break;t.push(H("title",{title:n}),H("meta",{property:"og:title",content:n}),H("meta",{name:"twitter:title",content:n}));break}case "description":{let o=ne(oe.description,e.description);if(!o)break;t.push(H("meta",{name:"description",content:o}),H("meta",{property:"og:description",content:o}),H("meta",{name:"twitter:description",content:o}));break}case "url":{let o=ne(oe.url,e.url);if(!o)break;let a=o.split("?")[0].replace(/\/$/,"");t.push(H("link",{rel:"canonical",href:a}),H("meta",{property:"og:url",content:a}));break}case "handle":{let o=ne(oe.handle,e.handle);if(!o)break;t.push(H("meta",{name:"twitter:site",content:o}),H("meta",{name:"twitter:creator",content:o}));break}case "media":{let o,n=ue(e.media);for(let a of n)if(typeof a=="string"&&t.push(H("meta",{name:"og:image",content:a})),a&&typeof a=="object"){let s=a.type||"image",c=a?{url:a?.url,secure_url:a?.url,type:Sr(a.url),width:a?.width,height:a?.height,alt:a?.altText}:{};for(let i of Object.keys(c))c[i]&&(o=c[i],t.push(H("meta",{property:`og:${s}:${i}`,content:o},c.url)));}break}case "jsonLd":{let o=ue(e.jsonLd),n=0;for(let a of o){if(typeof a!="object")continue;let s=H("script",{type:"application/ld+json",children:JSON.stringify(a,(c,i)=>typeof i=="string"?an(i):i)},`json-ld-${a?.["@type"]||a?.name||n++}`);t.push(s);}break}case "alternates":{let o=ue(e.alternates);for(let n of o){if(!n)continue;let{language:a,url:s,default:c}=n,i=a?`${a}${c?"-default":""}`:void 0;t.push(H("link",{rel:"alternate",hrefLang:i,href:s}));}break}case "robots":{if(!e.robots)break;let{maxImagePreview:o,maxSnippet:n,maxVideoPreview:a,noArchive:s,noFollow:c,noImageIndex:i,noIndex:u,noSnippet:d,noTranslate:y,unavailableAfter:C}=e.robots,m=[s&&"noarchive",i&&"noimageindex",d&&"nosnippet",y&&"notranslate",o&&`max-image-preview:${o}`,n&&`max-snippet:${n}`,a&&`max-video-preview:${a}`,C&&`unavailable_after:${C}`],p=(u?"noindex":"index")+","+(c?"nofollow":"follow");for(let l of m)l&&(p+=`,${l}`);t.push(H("meta",{name:"robots",content:p}));break}}return t.flat().sort((r,o)=>r.key.localeCompare(o.key))}function H(e,t,r){let o={tag:e,props:{},key:""};return e==="title"?(o.children=t.title,o.key=Ar(o),o):e==="script"?(o.children=typeof t.children=="string"?t.children:"",o.key=Ar(o,r),delete t.children,o.props=t,o):(o.props=t,Object.keys(o.props).forEach(n=>!o.props[n]&&delete o.props[n]),o.key=Ar(o,r),o)}function Ar(e,t){let{tag:r,props:o}=e;if(r==="title")return "0-title";if(r==="meta"){let n=o.content===t&&typeof o.property=="string"&&!o.property.endsWith("secure_url")&&"0";return [r,...[t,n],o.property||o.name].filter(s=>s).join("-")}return r==="link"?[r,o.rel,o.hrefLang||o.media].filter(a=>a).join("-").replace(/\s+/g,"-"):r==="script"?`${r}-${t}`:`${r}-${o.type}`}function Tr(e,t){if(t)return e?typeof e=="function"?e(t):e.replace("%s",t??""):t}function Sr(e){switch(e&&e.split(/[?#]/)[0].split(".").pop()?.toLowerCase()){case "svg":return "image/svg+xml";case "png":return "image/png";case "gif":return "image/gif";case "swf":return "application/x-shockwave-flash";case "mp3":return "audio/mpeg";default:return "image/jpeg"}}function ue(e){return Array.isArray(e)?e:[e]}function ne(e,t){try{return e.validate(t)}catch(r){return console.warn(r.message),t}}function di(...e){let t=[],r=e.reduce((o,n)=>{if(!n)return o;Object.keys(n).forEach(s=>!n[s]&&delete n[s]);let{jsonLd:a}=n;return a?o?.jsonLd?{...o,...n,jsonLd:ue(o.jsonLd).concat(a)}:{...o,...n,jsonLd:[a]}:{...o,...n}},{})||{};for(let o of Object.keys(r))switch(o){case "title":{let n=ne(oe.title,r.title),a=Tr(r?.titleTemplate,n);if(!a)break;t.push({title:a},{property:"og:title",content:a},{property:"twitter:title",content:a});break}case "description":{let n=ne(oe.description,r.description);if(!n)break;t.push({name:"description",content:n},{property:"og:description",content:n},{property:"twitter:description",content:n});break}case "url":{let n=ne(oe.url,r.url);if(!n)break;let s=n.split("?")[0].replace(/\/$/,"");t.push({tagName:"link",rel:"canonical",href:s},{property:"og:url",content:s});break}case "handle":{let n=ne(oe.handle,r.handle);if(!n)break;t.push({property:"twitter:site",content:n},{property:"twitter:creator",content:n});break}case "media":{let n,a=ue(r.media);for(let s of a)if(typeof s=="string"&&t.push({property:"og:image",content:s}),s&&typeof s=="object"){let c=s.type||"image",i=s?{url:s?.url,secure_url:s?.url,type:Sr(s.url),width:s?.width,height:s?.height,alt:s?.altText}:{};for(let u of Object.keys(i))i[u]&&(n=i[u],t.push({property:`og:${c}:${u}`,content:n}));}break}case "jsonLd":{let n=ue(r.jsonLd);for(let s of n)typeof s!="object"||Object.keys(s).length===0||t.push({"script:ld+json":s});break}case "alternates":{let n=ue(r.alternates);for(let a of n){if(!a)continue;let{language:s,url:c,default:i}=a,u=s?`${s}${i?"-default":""}`:void 0;t.push({tagName:"link",rel:"alternate",hrefLang:u,href:c});}break}case "robots":{if(!r.robots)break;let{maxImagePreview:n,maxSnippet:a,maxVideoPreview:s,noArchive:c,noFollow:i,noImageIndex:u,noIndex:d,noSnippet:y,noTranslate:C,unavailableAfter:m}=r.robots,p=[c&&"noarchive",u&&"noimageindex",y&&"nosnippet",C&&"notranslate",n&&`max-image-preview:${n}`,a&&`max-snippet:${a}`,s&&`max-video-preview:${s}`,m&&`unavailable_after:${m}`],l=(d?"noindex":"index")+","+(i?"nofollow":"follow");for(let T of p)T&&(l+=`,${T}`);t.push({name:"robots",content:l});break}}return t}var Ai=react.lazy(()=>Promise.resolve().then(()=>(pn(),dn)));function Ti({debug:e}){let t=reactRouter.useMatches(),r=reactRouter.useLocation();console.warn("[h2:warn:Seo] The `<Seo/>` component is deprecated. Use `getSeoMeta` instead.\nSee: https://shopify.dev/docs/api/hydrogen/utilities/getseometa");let o=react.useMemo(()=>t.flatMap(s=>{let{handle:c,...i}=s,u={...i,...r},d=c?.seo,y=i?.data?.seo;return !d&&!y?[]:d?gt(d,u):[y]}).reduce((s,c)=>{Object.keys(c).forEach(u=>!c[u]&&delete c[u]);let{jsonLd:i}=c;return i?s?.jsonLd?Array.isArray(i)?{...s,...c,jsonLd:[...s.jsonLd,...i]}:{...s,...c,jsonLd:[...s.jsonLd,i]}:{...s,...c,jsonLd:[i]}:{...s,...c}},{}),[t,r]),{html:n,loggerMarkup:a}=react.useMemo(()=>{let s=sn(o),c=s.map(u=>u.tag==="script"?react.createElement(u.tag,{...u.props,key:u.key,dangerouslySetInnerHTML:{__html:u.children}}):react.createElement(u.tag,{...u.props,key:u.key},u.children)),i=react.createElement(react.Suspense,{fallback:null},react.createElement(Ai,{headTags:s}));return {html:c,loggerMarkup:i}},[o]);return react.createElement(react.Fragment,null,n,e&&a)}function gt(e,...t){if(e instanceof Function)return gt(e(...t),...t);let r={};return Array.isArray(e)?(r=e.reduce((o,n)=>[...o,gt(n)],[]),r):e instanceof Object?(Object.entries(e).forEach(([n,a])=>{r[n]=gt(a,...t);}),r):e}function Ri(e){return jsxRuntime.jsx(hydrogenReact.ShopPayButton,{channel:"hydrogen",...e})}var vi=`<?xml version="1.0" encoding="UTF-8"?>
|
|
882
882
|
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
883
|
-
`,
|
|
884
|
-
</sitemapindex>`,
|
|
885
|
-
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">`,
|
|
883
|
+
`,Ii=`
|
|
884
|
+
</sitemapindex>`,yn=`<?xml version="1.0" encoding="UTF-8"?>
|
|
885
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">`,fn="</urlset>";async function Ei(e){let{storefront:t,request:r,types:o=["products","pages","collections","metaObjects","articles","blogs"],customChildSitemaps:n=[]}=e;if(!r||!r.url)throw new Error("A request object is required to generate a sitemap index");if(!t||!t.query)throw new Error("A storefront client is required to generate a sitemap index");let a=await t.query(Ni);if(!a)throw console.warn("[h2:sitemap:warning] Sitemap index is available in API version 2024-10 and later"),new Response("Sitemap index not found.",{status:404});let s=new URL(r.url).origin,c=vi+o.map(i=>{if(!a[i])throw new Error(`[h2:sitemap:error] No data found for type ${i}. Check types passed to \`getSitemapIndex\``);return wi(i,a[i].pagesCount.count,s)}).join(`
|
|
886
886
|
`)+n.map(i=>" <sitemap><loc>"+(s+(i.startsWith("/")?i:"/"+i))+"</loc></sitemap>").join(`
|
|
887
|
-
`)+
|
|
888
|
-
`)+
|
|
887
|
+
`)+Ii;return new Response(c,{headers:{"Content-Type":"application/xml","Cache-Control":`max-age=${3600*24}`}})}async function bi(e){let{storefront:t,request:r,params:o,getLink:n,locales:a=[],getChangeFreq:s,noItemsFallback:c="/"}=e;if(!o)throw new Error("[h2:sitemap:error] Remix params object is required to generate a sitemap");if(!r||!r.url)throw new Error("A request object is required to generate a sitemap");if(!t||!t.query)throw new Error("A storefront client is required to generate a index");if(!n)throw new Error("A `getLink` function to generate each resource is required to build a sitemap");if(!o.type||!o.page)throw new Response("No data found",{status:404});let i=o.type,u=Mi[i];if(!u)throw new Response("Not found",{status:404});let d=await t.query(u,{variables:{page:parseInt(o.page,10)}});if(!d)throw console.warn("[h2:sitemap:warning] Sitemap is available in API version 2024-10 and later"),new Response("Sitemap not found.",{status:404});let y=new URL(r.url).origin,C="";return d?.sitemap?.resources?.items?.length?C=yn+d.sitemap.resources.items.map(m=>xi({getChangeFreq:s,url:n({type:m.type??i,baseUrl:y,handle:m.handle}),type:i,getLink:n,updatedAt:m.updatedAt,handle:m.handle,metaobjectType:m.type,locales:a,baseUrl:y})).join(`
|
|
888
|
+
`)+fn:C=yn+`
|
|
889
889
|
<url><loc>${y+c}</loc></url>
|
|
890
|
-
`+
|
|
891
|
-
`;return o}function
|
|
890
|
+
`+fn,new Response(C,{headers:{"Content-Type":"application/xml","Cache-Control":`max-age=${3600*24}`}})}function wi(e,t,r){let o="";for(let n=1;n<=t;n++)o+=` <sitemap><loc>${r}/sitemap/${e}/${n}.xml</loc></sitemap>
|
|
891
|
+
`;return o}function xi({url:e,updatedAt:t,locales:r,type:o,getLink:n,baseUrl:a,handle:s,getChangeFreq:c,metaobjectType:i}){return `<url>
|
|
892
892
|
<loc>${e}</loc>
|
|
893
893
|
<lastmod>${t}</lastmod>
|
|
894
894
|
<changefreq>${c?c({type:i??o,handle:s}):"weekly"}</changefreq>
|
|
895
|
-
${r.map(u=>
|
|
895
|
+
${r.map(u=>Di(n({type:i??o,baseUrl:a,handle:s,locale:u}),u)).join(`
|
|
896
896
|
`)}
|
|
897
897
|
</url>
|
|
898
|
-
`.trim()}function
|
|
898
|
+
`.trim()}function Di(e,t){return ` <xhtml:link rel="alternate" hreflang="${t}" href="${e}" />`}var Oi=`#graphql
|
|
899
899
|
query SitemapProducts($page: Int!) {
|
|
900
900
|
sitemap(type: PRODUCT) {
|
|
901
901
|
resources(page: $page) {
|
|
@@ -906,7 +906,7 @@ ${r.map(u=>bi(n({type:i??o,baseUrl:a,handle:s,locale:u}),u)).join(`
|
|
|
906
906
|
}
|
|
907
907
|
}
|
|
908
908
|
}
|
|
909
|
-
`,
|
|
909
|
+
`,_i=`#graphql
|
|
910
910
|
query SitemapCollections($page: Int!) {
|
|
911
911
|
sitemap(type: COLLECTION) {
|
|
912
912
|
resources(page: $page) {
|
|
@@ -917,7 +917,7 @@ ${r.map(u=>bi(n({type:i??o,baseUrl:a,handle:s,locale:u}),u)).join(`
|
|
|
917
917
|
}
|
|
918
918
|
}
|
|
919
919
|
}
|
|
920
|
-
`,
|
|
920
|
+
`,Ui=`#graphql
|
|
921
921
|
query SitemapArticles($page: Int!) {
|
|
922
922
|
sitemap(type: ARTICLE) {
|
|
923
923
|
resources(page: $page) {
|
|
@@ -928,7 +928,7 @@ ${r.map(u=>bi(n({type:i??o,baseUrl:a,handle:s,locale:u}),u)).join(`
|
|
|
928
928
|
}
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
|
-
`,
|
|
931
|
+
`,Li=`#graphql
|
|
932
932
|
query SitemapPages($page: Int!) {
|
|
933
933
|
sitemap(type: PAGE) {
|
|
934
934
|
resources(page: $page) {
|
|
@@ -939,7 +939,7 @@ ${r.map(u=>bi(n({type:i??o,baseUrl:a,handle:s,locale:u}),u)).join(`
|
|
|
939
939
|
}
|
|
940
940
|
}
|
|
941
941
|
}
|
|
942
|
-
`,
|
|
942
|
+
`,ki=`#graphql
|
|
943
943
|
query SitemapBlogs($page: Int!) {
|
|
944
944
|
sitemap(type: BLOG) {
|
|
945
945
|
resources(page: $page) {
|
|
@@ -950,7 +950,7 @@ ${r.map(u=>bi(n({type:i??o,baseUrl:a,handle:s,locale:u}),u)).join(`
|
|
|
950
950
|
}
|
|
951
951
|
}
|
|
952
952
|
}
|
|
953
|
-
`,
|
|
953
|
+
`,Vi=`#graphql
|
|
954
954
|
query SitemapMetaobjects($page: Int!) {
|
|
955
955
|
sitemap(type: METAOBJECT) {
|
|
956
956
|
resources(page: $page) {
|
|
@@ -964,7 +964,7 @@ ${r.map(u=>bi(n({type:i??o,baseUrl:a,handle:s,locale:u}),u)).join(`
|
|
|
964
964
|
}
|
|
965
965
|
}
|
|
966
966
|
}
|
|
967
|
-
`,
|
|
967
|
+
`,Ni=`#graphql
|
|
968
968
|
query SitemapIndex {
|
|
969
969
|
products: sitemap(type: PRODUCT) {
|
|
970
970
|
pagesCount {
|
|
@@ -997,7 +997,7 @@ query SitemapIndex {
|
|
|
997
997
|
}
|
|
998
998
|
}
|
|
999
999
|
}
|
|
1000
|
-
`,
|
|
1000
|
+
`,Mi={products:Oi,articles:Ui,collections:_i,pages:Li,blogs:ki,metaObjects:Vi};//! @see https://shopify.dev/docs/api/storefront/latest/queries/cart
|
|
1001
1001
|
//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartCreate
|
|
1002
1002
|
//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartLinesAdd
|
|
1003
1003
|
//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartLinesUpdate
|
|
@@ -1015,5 +1015,5 @@ query SitemapIndex {
|
|
|
1015
1015
|
//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartDeliveryAddressesRemove
|
|
1016
1016
|
//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartDeliveryAddressesUpdate
|
|
1017
1017
|
//! @see: https://shopify.dev/docs/api/storefront/2026-04/mutations/cartDeliveryAddressesReplace
|
|
1018
|
-
Object.defineProperty(exports,"AnalyticsEventName",{enumerable:true,get:function(){return hydrogenReact.AnalyticsEventName}});Object.defineProperty(exports,"AnalyticsPageType",{enumerable:true,get:function(){return hydrogenReact.AnalyticsPageType}});Object.defineProperty(exports,"ExternalVideo",{enumerable:true,get:function(){return hydrogenReact.ExternalVideo}});Object.defineProperty(exports,"IMAGE_FRAGMENT",{enumerable:true,get:function(){return hydrogenReact.IMAGE_FRAGMENT}});Object.defineProperty(exports,"Image",{enumerable:true,get:function(){return hydrogenReact.Image}});Object.defineProperty(exports,"MediaFile",{enumerable:true,get:function(){return hydrogenReact.MediaFile}});Object.defineProperty(exports,"ModelViewer",{enumerable:true,get:function(){return hydrogenReact.ModelViewer}});Object.defineProperty(exports,"Money",{enumerable:true,get:function(){return hydrogenReact.Money}});Object.defineProperty(exports,"ShopifySalesChannel",{enumerable:true,get:function(){return hydrogenReact.ShopifySalesChannel}});Object.defineProperty(exports,"Video",{enumerable:true,get:function(){return hydrogenReact.Video}});Object.defineProperty(exports,"customerAccountApiCustomScalars",{enumerable:true,get:function(){return hydrogenReact.customerAccountApiCustomScalars}});Object.defineProperty(exports,"decodeEncodedVariant",{enumerable:true,get:function(){return hydrogenReact.decodeEncodedVariant}});Object.defineProperty(exports,"flattenConnection",{enumerable:true,get:function(){return hydrogenReact.flattenConnection}});Object.defineProperty(exports,"getAdjacentAndFirstAvailableVariants",{enumerable:true,get:function(){return hydrogenReact.getAdjacentAndFirstAvailableVariants}});Object.defineProperty(exports,"getClientBrowserParameters",{enumerable:true,get:function(){return hydrogenReact.getClientBrowserParameters}});Object.defineProperty(exports,"getProductOptions",{enumerable:true,get:function(){return hydrogenReact.getProductOptions}});Object.defineProperty(exports,"getShopifyCookies",{enumerable:true,get:function(){return hydrogenReact.getShopifyCookies}});Object.defineProperty(exports,"getTrackingValues",{enumerable:true,get:function(){return hydrogenReact.getTrackingValues}});Object.defineProperty(exports,"isOptionValueCombinationInEncodedVariant",{enumerable:true,get:function(){return hydrogenReact.isOptionValueCombinationInEncodedVariant}});Object.defineProperty(exports,"mapSelectedProductOptionToObject",{enumerable:true,get:function(){return hydrogenReact.mapSelectedProductOptionToObject}});Object.defineProperty(exports,"parseGid",{enumerable:true,get:function(){return hydrogenReact.parseGid}});Object.defineProperty(exports,"parseMetafield",{enumerable:true,get:function(){return hydrogenReact.parseMetafield}});Object.defineProperty(exports,"sendShopifyAnalytics",{enumerable:true,get:function(){return hydrogenReact.sendShopifyAnalytics}});Object.defineProperty(exports,"storefrontApiCustomScalars",{enumerable:true,get:function(){return hydrogenReact.storefrontApiCustomScalars}});Object.defineProperty(exports,"useLoadScript",{enumerable:true,get:function(){return hydrogenReact.useLoadScript}});Object.defineProperty(exports,"useMoney",{enumerable:true,get:function(){return hydrogenReact.useMoney}});Object.defineProperty(exports,"useSelectedOptionInUrlParam",{enumerable:true,get:function(){return hydrogenReact.useSelectedOptionInUrlParam}});Object.defineProperty(exports,"useShopifyCookies",{enumerable:true,get:function(){return hydrogenReact.useShopifyCookies}});exports.Analytics=
|
|
1018
|
+
Object.defineProperty(exports,"AnalyticsEventName",{enumerable:true,get:function(){return hydrogenReact.AnalyticsEventName}});Object.defineProperty(exports,"AnalyticsPageType",{enumerable:true,get:function(){return hydrogenReact.AnalyticsPageType}});Object.defineProperty(exports,"ExternalVideo",{enumerable:true,get:function(){return hydrogenReact.ExternalVideo}});Object.defineProperty(exports,"IMAGE_FRAGMENT",{enumerable:true,get:function(){return hydrogenReact.IMAGE_FRAGMENT}});Object.defineProperty(exports,"Image",{enumerable:true,get:function(){return hydrogenReact.Image}});Object.defineProperty(exports,"MediaFile",{enumerable:true,get:function(){return hydrogenReact.MediaFile}});Object.defineProperty(exports,"ModelViewer",{enumerable:true,get:function(){return hydrogenReact.ModelViewer}});Object.defineProperty(exports,"Money",{enumerable:true,get:function(){return hydrogenReact.Money}});Object.defineProperty(exports,"ShopifySalesChannel",{enumerable:true,get:function(){return hydrogenReact.ShopifySalesChannel}});Object.defineProperty(exports,"Video",{enumerable:true,get:function(){return hydrogenReact.Video}});Object.defineProperty(exports,"customerAccountApiCustomScalars",{enumerable:true,get:function(){return hydrogenReact.customerAccountApiCustomScalars}});Object.defineProperty(exports,"decodeEncodedVariant",{enumerable:true,get:function(){return hydrogenReact.decodeEncodedVariant}});Object.defineProperty(exports,"flattenConnection",{enumerable:true,get:function(){return hydrogenReact.flattenConnection}});Object.defineProperty(exports,"getAdjacentAndFirstAvailableVariants",{enumerable:true,get:function(){return hydrogenReact.getAdjacentAndFirstAvailableVariants}});Object.defineProperty(exports,"getClientBrowserParameters",{enumerable:true,get:function(){return hydrogenReact.getClientBrowserParameters}});Object.defineProperty(exports,"getProductOptions",{enumerable:true,get:function(){return hydrogenReact.getProductOptions}});Object.defineProperty(exports,"getShopifyCookies",{enumerable:true,get:function(){return hydrogenReact.getShopifyCookies}});Object.defineProperty(exports,"getTrackingValues",{enumerable:true,get:function(){return hydrogenReact.getTrackingValues}});Object.defineProperty(exports,"isOptionValueCombinationInEncodedVariant",{enumerable:true,get:function(){return hydrogenReact.isOptionValueCombinationInEncodedVariant}});Object.defineProperty(exports,"mapSelectedProductOptionToObject",{enumerable:true,get:function(){return hydrogenReact.mapSelectedProductOptionToObject}});Object.defineProperty(exports,"parseGid",{enumerable:true,get:function(){return hydrogenReact.parseGid}});Object.defineProperty(exports,"parseMetafield",{enumerable:true,get:function(){return hydrogenReact.parseMetafield}});Object.defineProperty(exports,"sendShopifyAnalytics",{enumerable:true,get:function(){return hydrogenReact.sendShopifyAnalytics}});Object.defineProperty(exports,"storefrontApiCustomScalars",{enumerable:true,get:function(){return hydrogenReact.storefrontApiCustomScalars}});Object.defineProperty(exports,"useLoadScript",{enumerable:true,get:function(){return hydrogenReact.useLoadScript}});Object.defineProperty(exports,"useMoney",{enumerable:true,get:function(){return hydrogenReact.useMoney}});Object.defineProperty(exports,"useSelectedOptionInUrlParam",{enumerable:true,get:function(){return hydrogenReact.useSelectedOptionInUrlParam}});Object.defineProperty(exports,"useShopifyCookies",{enumerable:true,get:function(){return hydrogenReact.useShopifyCookies}});exports.Analytics=ca;exports.AnalyticsEvent=B;exports.CacheCustom=kt;exports.CacheLong=Lt;exports.CacheNone=_t;exports.CacheShort=ye;exports.CartForm=re;exports.InMemoryCache=Mt;exports.NonceProvider=qo;exports.OptimisticInput=Ls;exports.Pagination=Fs;exports.RichText=oi;exports.Script=ws;exports.Seo=Ti;exports.ShopPayButton=Ri;exports.VariantSelector=zs;exports.cartAttributesUpdateDefault=zt;exports.cartBuyerIdentityUpdateDefault=Kt;exports.cartCreateDefault=Gt;exports.cartDiscountCodesUpdateDefault=jt;exports.cartGetDefault=qt;exports.cartGetIdDefault=Ft;exports.cartGiftCardCodesAddDefault=tr;exports.cartGiftCardCodesRemoveDefault=rr;exports.cartGiftCardCodesUpdateDefault=er;exports.cartLinesAddDefault=Bt;exports.cartLinesRemoveDefault=Wt;exports.cartLinesUpdateDefault=Qt;exports.cartMetafieldDeleteDefault=Zt;exports.cartMetafieldsSetDefault=Xt;exports.cartNoteUpdateDefault=Yt;exports.cartSelectedDeliveryOptionsUpdateDefault=Jt;exports.cartSetIdDefault=Ht;exports.changelogHandler=rs;exports.createCartHandler=or;exports.createContentSecurityPolicy=Ps;exports.createCustomerAccountClient=lr;exports.createHydrogenContext=ms;exports.createRequestHandler=hs;exports.createStorefrontClient=To;exports.createWithCache=Ta;exports.formatAPIResult=I;exports.generateCacheControlHeader=Ve;exports.getPaginationVariables=$s;exports.getSelectedProductOptions=Xs;exports.getSeoMeta=di;exports.getShopAnalytics=sa;exports.getSitemap=bi;exports.getSitemapIndex=Ei;exports.graphiqlLoader=ni;exports.hydrogenContext=os;exports.hydrogenPreset=ei;exports.hydrogenRoutes=Os;exports.storefrontRedirect=ai;exports.useAnalytics=ee;exports.useCustomerPrivacy=Tt;exports.useNonce=yr;exports.useOptimisticCart=es;exports.useOptimisticData=Us;exports.useOptimisticVariant=Qs;//# sourceMappingURL=index.cjs.map
|
|
1019
1019
|
//# sourceMappingURL=index.cjs.map
|