@shopify/hydrogen 2023.7.13 → 2023.10.1
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 +639 -165
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +639 -166
- package/dist/development/index.js.map +1 -1
- package/dist/production/index.cjs +169 -130
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.d.cts +63 -26
- package/dist/production/index.d.ts +63 -26
- package/dist/production/index.js +130 -92
- package/dist/production/index.js.map +1 -1
- package/dist/storefront-api-types.d.ts +1046 -979
- package/dist/storefront.schema.json +1 -1
- package/package.json +6 -5
package/dist/production/index.js
CHANGED
|
@@ -4,10 +4,10 @@ import { redirect } from '@remix-run/server-runtime';
|
|
|
4
4
|
import { lazy, createContext, forwardRef, useMemo, createElement, Suspense, Fragment, useState, useRef, useEffect, useContext } from 'react';
|
|
5
5
|
import { useMatches, useLocation, useNavigation, Link, useNavigate, useFetcher, useFetchers } from '@remix-run/react';
|
|
6
6
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
7
|
-
import
|
|
7
|
+
import Vr from 'content-security-policy-builder';
|
|
8
8
|
|
|
9
|
-
function
|
|
10
|
-
`))||`API response error: ${e.status}`;throw new
|
|
9
|
+
function Qe(e){let t=Array.isArray(e)?e:[e],r="";for(let n of t)n!=null&&(typeof n=="object"?r+=JSON.stringify(n):r+=n.toString());return encodeURIComponent(r)}var G="public",It="private",oe="no-store",He={maxAge:"max-age",staleWhileRevalidate:"stale-while-revalidate",sMaxAge:"s-maxage",staleIfError:"stale-if-error"};function L(e){let t=[];return Object.keys(e).forEach(r=>{r==="mode"?t.push(e[r]):He[r]&&t.push(`${He[r]}=${e[r]}`);}),t.join(", ")}function se(){return {mode:oe}}function ie(e){if(e?.mode&&e?.mode!==G&&e?.mode!==It)throw Error("'mode' must be either 'public' or 'private'")}function b(e){return ie(e),{mode:G,maxAge:1,staleWhileRevalidate:9,...e}}function ce(e){return ie(e),{mode:G,maxAge:3600,staleWhileRevalidate:82800,...e}}function D(e){return ie(e),{mode:G,maxAge:1,staleWhileRevalidate:86399,...e}}function pe(e){return e}function P(e){return String(e).includes("__proto__")?JSON.parse(e,Rt):JSON.parse(e)}function Rt(e,t){if(e!=="__proto__")return t}function V(e,t){return e&&t?{...e,...t}:e||D()}function ue(e){return L(V(e))}async function Tt(e,t){if(!e)return;let r=await e.match(t);if(!r){return}return r}async function xt(e,t,r,n){if(!e)return;let a=V(n),s=ue(V(a,{maxAge:(a.maxAge||0)+(a.staleWhileRevalidate||0)})),o=ue(V(a));r.headers.set("cache-control",s),r.headers.set("real-cache-control",o),r.headers.set("cache-put-date",new Date().toUTCString()),await e.put(t,r);}async function At(e,t){e&&await e.delete(t);}function wt(e,t){let r=e.headers.get("real-cache-control"),n=0;if(r){let s=r.match(/max-age=(\d*)/);s&&s.length>1&&(n=parseFloat(s[1]));}return [(new Date().valueOf()-new Date(t).valueOf())/1e3,n]}function Ot(e,t){let r=t.headers.get("cache-put-date");if(!r)return !1;let[n,a]=wt(t,r),s=n>a;return s}var B={get:Tt,set:xt,delete:At,generateDefaultCacheControlHeader:ue,isStale:Ot};function de(e){return `https://shopify.dev/?${e}`}function Pt(e){return e||D()}async function Ge(e,t){if(!e)return;let r=de(t),n=new Request(r),a=await B.get(e,n);if(!a)return;let s=await a.text();try{return [P(s),a]}catch{return [s,a]}}async function le(e,t,r,n){if(!e)return;let a=de(t),s=new Request(a),o=new Response(JSON.stringify(r));await B.set(e,s,o,Pt(n));}function Ve(e,t){return B.isStale(new Request(de(e)),t)}function bt(e,t){return [e,{status:t.status,statusText:t.statusText,headers:Array.from(t.headers.entries())}]}function Be([e,t]){return [e,new Response(e,t)]}var je=e=>!e?.errors,fe=new Set;async function ge(e,t,{strategy:r=b(),cacheInstance:n,shouldCacheResult:a=()=>!0,waitUntil:s,debugInfo:o}){let p=Qe([...typeof e=="string"?[e]:e]),d=void 0;if(!n||!r||r.mode===oe){let f=await t();return f}let u=await Ge(n,p);if(u){let[f,l]=u,C=Ve(p,l)?"STALE":"HIT";if(!fe.has(p)&&C==="STALE"){fe.add(p);let y=Promise.resolve().then(async()=>{let g=Date.now();try{let m=await t();a(m)&&(await le(n,p,m,r),d?.("PUT",g));}catch(m){m.message&&(m.message="SWR in sub-request failed: "+m.message),console.error(m);}finally{fe.delete(p);}});s?.(y);}return f}let c=await t();if(a(c)){let f=Promise.resolve().then(async()=>{await le(n,p,c,r);});s?.(f);}return c}async function We(e,t,{cacheInstance:r,cache:n,cacheKey:a=[e,t],shouldCacheResponse:s=()=>!0,waitUntil:o,returnType:i="json",debugInfo:p}={}){return !n&&(!t.method||t.method==="GET")&&(n=b()),ge(a,async()=>{let d=await fetch(e,t),u;try{u=await d[i]();}catch{try{u=await d.text();}catch{throw new Error(`Storefront API response code: ${d.status} (Request Id: ${d.headers.get("x-request-id")})`)}}return bt(u,d)},{cacheInstance:r,waitUntil:o,strategy:n??null,debugInfo:p,shouldCacheResult:d=>s(...Be(d))}).then(Be)}var ye="Custom-Storefront-Request-Group-ID",me="X-Shopify-Storefront-Access-Token",he="X-SDK-Variant",Ce="X-SDK-Variant-Source",Se="X-SDK-Version";function Ke(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`weak-${Math.random().toString(16).substring(2)}`}var _="2023.10.1";function E(e){return e.replace(/\s*#.*$/gm,"").replace(/\s+/gm," ").trim()}var Dt=/(^|}\s)query[\s({]/im,Et=/(^|}\s)mutation[\s({]/im;function j(e,t){if(!Dt.test(e))throw new Error(`[h2:error:${t}] Can only execute queries`)}function W(e,t){if(!Et.test(e))throw new Error(`[h2:error:${t}] Can only execute mutations`)}function U({response:e,errors:t,type:r,query:n,queryVariables:a,ErrorConstructor:s=Error,client:o="storefront"}){let i=e.headers.get("x-request-id"),p=(typeof t=="string"?t:t?.map?.(d=>d.message).join(`
|
|
10
|
+
`))||`API response error: ${e.status}`;throw new s(`[h2:error:${o}.${r}] `+p+(i?` - Request ID: ${i}`:""),{cause:JSON.stringify({errors:t,requestId:i})})}var Ye=class extends Error{},Nt=e=>e instanceof Ye,kt={language:"EN",country:"US"};function Un(e){let {storefrontHeaders:t,cache:r,waitUntil:n,i18n:a,storefrontId:s,...o}=e,{getPublicTokenHeaders:p,getPrivateTokenHeaders:d,getStorefrontApiUrl:u,getShopifyDomain:c}=createStorefrontClient(o),l=(o.privateStorefrontToken?d:p)({contentType:"json",buyerIp:t?.buyerIp||""});if(l[ye]=t?.requestGroupId||Ke(),s&&(l[SHOPIFY_STOREFRONT_ID_HEADER]=s),(l["user-agent"]=`Hydrogen ${_}`),t&&t.cookie){let g=getShopifyCookies(t.cookie??"");g[SHOPIFY_Y]&&(l[SHOPIFY_STOREFRONT_Y_HEADER]=g[SHOPIFY_Y]),g[SHOPIFY_S]&&(l[SHOPIFY_STOREFRONT_S_HEADER]=g[SHOPIFY_S]);}let C=JSON.stringify({"content-type":l["content-type"],"user-agent":l["user-agent"],[he]:l[he],[Ce]:l[Ce],[Se]:l[Se],[me]:l[me]});async function y({query:g,mutation:m,variables:h,cache:A,headers:R=[],storefrontApiVersion:M}){let re=R instanceof Headers?Object.fromEntries(R.entries()):Array.isArray(R)?Object.fromEntries(R):R;g=g??m;let O={...h};a&&(!h?.country&&/\$country/.test(g)&&(O.country=a.country),!h?.language&&/\$language/.test(g)&&(O.language=a.language));let v=u({storefrontApiVersion:M}),Q=JSON.stringify({query:g,variables:O}),H={method:"POST",headers:{...l,...re},body:Q},Ct=[v,H.method,C,H.body],[ne,qe]=await We(v,H,{cacheInstance:m?void 0:r,cache:A||D(),cacheKey:Ct,shouldCacheResponse:je,waitUntil:n,debugInfo:{graphql:Q,requestId:H.headers[ye],purpose:t?.purpose}}),Fe={response:qe,type:m?"mutation":"query",query:g,queryVariables:O,errors:void 0};if(!qe.ok){let ae;try{ae=P(ne);}catch{ae=[{message:ne}];}U({...Fe,errors:ae});}let{data:St,errors:$e}=ne;return $e?.length&&U({...Fe,errors:$e,ErrorConstructor:Ye}),St}return {storefront:{query:(g,m)=>{g=E(g),j(g,"storefront.query");let h=y({...m,query:g});return h.catch(()=>{}),h},mutate:(g,m)=>{g=E(g),W(g,"storefront.mutate");let h=y({...m,mutation:g});return h.catch(()=>{}),h},cache:r,CacheNone:se,CacheLong:ce,CacheShort:b,CacheCustom:pe,generateCacheControlHeader:L,getPublicTokenHeaders:p,getPrivateTokenHeaders:d,getShopifyDomain:c,getApiUrl:u,isApiError:Nt,i18n:a??kt}}}function Xe(e,t){let r=e.headers?.get?.(t)??e.headers?.[t];return typeof r=="string"?r:null}function Ze(e){return e?{requestId:Xe(e,"request-id"),purpose:Xe(e,"purpose")}:{}}function kn({cache:e,waitUntil:t,request:r}){return function(a,s,o){return ge(a,o,{strategy:s,cacheInstance:e,waitUntil:t,debugInfo:Ze(r)})}}var Ie=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:n,timestamp:a,...s}=r,o=new Headers(s.headers),i=o.get("cache-control")||o.get("real-cache-control")||"",p=parseInt(i.match(/max-age=(\d+)/)?.[1]||"0",10),d=parseInt(i.match(/stale-while-revalidate=(\d+)/)?.[1]||"0",10),u=(Date.now()-a)/1e3;if(u>p+d){this.#e.delete(t.url);return}let f=u>p;return o.set("cache",f?"STALE":"HIT"),o.set("date",new Date(a).toUTCString()),new Response(n,{status:s.status??200,headers:o})}async delete(t){return this.#e.has(t.url)?(this.#e.delete(t.url),!0):!1}keys(t){let r=[];for(let n of this.#e.keys())(!t||t.url===n)&&r.push(new Request(n));return Promise.resolve(r)}};async function qt(e){let{storefront:t,request:r,noAdminRedirect:n,response:a=new Response("Not Found",{status:404})}=e,{pathname:s,search:o}=new URL(r.url),i=s+o;if(s==="/admin"&&!n)return redirect(`${t.getShopifyDomain()}/admin`);try{let{urlRedirects:p}=await t.query($t,{variables:{query:"path:"+i}}),d=p?.edges?.[0]?.node?.target;if(d)return new Response(null,{status:301,headers:{location:d}});let u=new URLSearchParams(o),c=u.get("return_to")||u.get("redirect");if(c){if(Ft(c))return redirect(c);console.warn(`Cross-domain redirects are not supported. Tried to redirect from ${i} to ${c}`);}}catch(p){console.error(`Failed to fetch redirects from Storefront API for route ${i}`,p);}return a}function Ft(e){return !/^(([a-z+-]+:)?\/\/|[a-z+-]+:)/i.test(e.trim())}var $t=`#graphql
|
|
11
11
|
query redirects($query: String) {
|
|
12
12
|
urlRedirects(first: 1, query: $query) {
|
|
13
13
|
edges {
|
|
@@ -17,86 +17,124 @@ function De(e){let t=Array.isArray(e)?e:[e],r="";for(let a of t)a!=null&&(typeof
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
`;var
|
|
21
|
-
<!DOCTYPE html>
|
|
22
|
-
<html lang="en">
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
`;var Qt=async function({context:t}){let r=t?.storefront;if(!r)throw new Error("GraphiQL: Hydrogen's storefront client must be injected in the loader context.");let n=r.getApiUrl(),a=r.getPublicTokenHeaders()["X-Shopify-Storefront-Access-Token"],s="https://avatars.githubusercontent.com/u/12972006?s=48&v=4",o=String.raw;return new Response(o`
|
|
21
|
+
<!DOCTYPE html>
|
|
22
|
+
<html lang="en">
|
|
23
|
+
<head>
|
|
24
|
+
<title>GraphiQL</title>
|
|
25
|
+
<link rel="icon" type="image/x-icon" href="${s}" />
|
|
26
|
+
<style>
|
|
27
|
+
body {
|
|
28
|
+
height: 100%;
|
|
29
|
+
margin: 0;
|
|
30
|
+
width: 100%;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
background-color: hsl(219, 29%, 18%);
|
|
33
|
+
}
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
</style>
|
|
35
|
+
#graphiql {
|
|
36
|
+
height: 100vh;
|
|
37
|
+
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
></script>
|
|
47
|
-
<link rel="stylesheet" href="https://unpkg.com/graphiql@3/graphiql.min.css" />
|
|
48
|
-
</head>
|
|
39
|
+
#graphiql > .placeholder {
|
|
40
|
+
color: slategray;
|
|
41
|
+
width: fit-content;
|
|
42
|
+
margin: 40px auto;
|
|
43
|
+
font-family: Arial;
|
|
44
|
+
}
|
|
45
|
+
</style>
|
|
49
46
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
<script
|
|
48
|
+
crossorigin
|
|
49
|
+
src="https://unpkg.com/react@18/umd/react.development.js"
|
|
50
|
+
></script>
|
|
51
|
+
<script
|
|
52
|
+
crossorigin
|
|
53
|
+
src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"
|
|
54
|
+
></script>
|
|
55
|
+
<link
|
|
56
|
+
rel="stylesheet"
|
|
57
|
+
href="https://unpkg.com/graphiql@3/graphiql.min.css"
|
|
58
|
+
/>
|
|
59
|
+
<link
|
|
60
|
+
rel="stylesheet"
|
|
61
|
+
href="https://unpkg.com/@graphiql/plugin-explorer/dist/style.css"
|
|
62
|
+
/>
|
|
63
|
+
</head>
|
|
58
64
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (query) query = GraphiQL.GraphQL.print(GraphiQL.GraphQL.parse(query));
|
|
64
|
-
}
|
|
65
|
+
<body>
|
|
66
|
+
<div id="graphiql">
|
|
67
|
+
<div class="placeholder">Loading GraphiQL...</div>
|
|
68
|
+
</div>
|
|
65
69
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
<script
|
|
71
|
+
src="https://unpkg.com/graphiql@3/graphiql.min.js"
|
|
72
|
+
type="application/javascript"
|
|
73
|
+
crossorigin="anonymous"
|
|
74
|
+
></script>
|
|
75
|
+
<script
|
|
76
|
+
src="https://unpkg.com/@graphiql/plugin-explorer/dist/index.umd.js"
|
|
77
|
+
type="application/javascript"
|
|
78
|
+
crossorigin="anonymous"
|
|
79
|
+
></script>
|
|
80
|
+
|
|
81
|
+
<script>
|
|
82
|
+
const windowUrl = new URL(document.URL);
|
|
83
|
+
|
|
84
|
+
let query = '{ shop { name } }';
|
|
85
|
+
if (windowUrl.searchParams.has('query')) {
|
|
86
|
+
query = decodeURIComponent(
|
|
87
|
+
windowUrl.searchParams.get('query') ?? query,
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Prettify query
|
|
92
|
+
query = GraphiQL.GraphQL.print(GraphiQL.GraphQL.parse(query));
|
|
93
|
+
|
|
94
|
+
let variables;
|
|
95
|
+
if (windowUrl.searchParams.has('variables')) {
|
|
96
|
+
variables = decodeURIComponent(
|
|
97
|
+
windowUrl.searchParams.get('variables') ?? '',
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Prettify variables
|
|
102
|
+
if (variables) {
|
|
103
|
+
variables = JSON.stringify(JSON.parse(variables), null, 2);
|
|
104
|
+
}
|
|
72
105
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
106
|
+
const root = ReactDOM.createRoot(
|
|
107
|
+
document.getElementById('graphiql'),
|
|
108
|
+
);
|
|
109
|
+
root.render(
|
|
110
|
+
React.createElement(GraphiQL, {
|
|
111
|
+
fetcher: GraphiQL.createFetcher({
|
|
112
|
+
url: '${n}',
|
|
113
|
+
headers: {
|
|
114
|
+
'X-Shopify-Storefront-Access-Token': '${a}',
|
|
115
|
+
},
|
|
116
|
+
}),
|
|
117
|
+
defaultEditorToolsVisibility: true,
|
|
118
|
+
query,
|
|
119
|
+
variables,
|
|
120
|
+
plugins: [GraphiQLPluginExplorer.explorerPlugin()],
|
|
121
|
+
}),
|
|
122
|
+
);
|
|
123
|
+
</script>
|
|
124
|
+
</body>
|
|
125
|
+
</html>
|
|
126
|
+
`,{status:200,headers:{"content-type":"text/html"}})};var w="Error in SEO input: ",K={title:{validate:e=>{if(typeof e!="string")throw new Error(w.concat("`title` should be a string"));if(typeof e=="string"&&e.length>120)throw new Error(w.concat("`title` should not be longer than 120 characters"));return e}},description:{validate:e=>{if(typeof e!="string")throw new Error(w.concat("`description` should be a string"));if(typeof e=="string"&&e.length>155)throw new Error(w.concat("`description` should not be longer than 155 characters"));return e}},url:{validate:e=>{if(typeof e!="string")throw new Error(w.concat("`url` should be a string"));if(typeof e=="string"&&!e.startsWith("http"))throw new Error(w.concat("`url` should be a valid URL"));return e}},handle:{validate:e=>{if(typeof e!="string")throw new Error(w.concat("`handle` should be a string"));if(typeof e=="string"&&!e.startsWith("@"))throw new Error(w.concat("`handle` should start with `@`"));return e}}};function tt(e){let t=[];for(let r of Object.keys(e))switch(r){case"title":{let n=z(K.title,e.title),a=Ht(e?.titleTemplate,n);if(!a)break;t.push(T("title",{title:a}),T("meta",{property:"og:title",content:a}),T("meta",{name:"twitter:title",content:a}));break}case"description":{let n=z(K.description,e.description);if(!n)break;t.push(T("meta",{name:"description",content:n}),T("meta",{property:"og:description",content:n}),T("meta",{name:"twitter:description",content:n}));break}case"url":{let n=z(K.url,e.url);if(!n)break;let a=n.split("?")[0];t.push(T("link",{rel:"canonical",href:a}),T("meta",{property:"og:url",content:a}));break}case"handle":{let n=z(K.handle,e.handle);if(!n)break;t.push(T("meta",{name:"twitter:site",content:n}),T("meta",{name:"twitter:creator",content:n}));break}case"media":{let n,a=Te(e.media);for(let s of a)if(typeof s=="string"&&t.push(T("meta",{name:"og:image",content:s})),s&&typeof s=="object"){let o=s.type||"image",i=s?{url:s?.url,secure_url:s?.url,type:Gt(s.url),width:s?.width,height:s?.height,alt:s?.altText}:{};for(let p of Object.keys(i))i[p]&&(n=i[p],t.push(T("meta",{property:`og:${o}:${p}`,content:n},i.url)));}break}case"jsonLd":{let n=Te(e.jsonLd),a=0;for(let s of n){if(typeof s!="object")continue;let o=T("script",{type:"application/ld+json",children:JSON.stringify(s)},`json-ld-${s?.["@type"]||s?.name||a++}`);t.push(o);}break}case"alternates":{let n=Te(e.alternates);for(let a of n){if(!a)continue;let{language:s,url:o,default:i}=a,p=s?`${s}${i?"-default":""}`:void 0;t.push(T("link",{rel:"alternate",hrefLang:p,href:o}));}break}case"robots":{if(!e.robots)break;let{maxImagePreview:n,maxSnippet:a,maxVideoPreview:s,noArchive:o,noFollow:i,noImageIndex:p,noIndex:d,noSnippet:u,noTranslate:c,unavailableAfter:f}=e.robots,l=[o&&"noarchive",p&&"noimageindex",u&&"nosnippet",c&&"notranslate",n&&`max-image-preview:${n}`,a&&`max-snippet:${a}`,s&&`max-video-preview:${s}`,f&&`unavailable_after:${f}`],C=(d?"noindex":"index")+","+(i?"nofollow":"follow");for(let y of l)y&&(C+=`,${y}`);t.push(T("meta",{name:"robots",content:C}));break}}return t.flat().sort((r,n)=>r.key.localeCompare(n.key))}function T(e,t,r){let n={tag:e,props:{},key:""};return e==="title"?(n.children=t.title,n.key=Re(n),n):e==="script"?(n.children=typeof t.children=="string"?t.children:"",n.key=Re(n,r),delete t.children,n.props=t,n):(n.props=t,Object.keys(n.props).forEach(a=>!n.props[a]&&delete n.props[a]),n.key=Re(n,r),n)}function Re(e,t){let{tag:r,props:n}=e;if(r==="title")return "0-title";if(r==="meta"){let a=n.content===t&&typeof n.property=="string"&&!n.property.endsWith("secure_url")&&"0";return [r,...[t,a],n.property||n.name].filter(o=>o).join("-")}return r==="link"?[r,n.rel,n.hrefLang||n.media].filter(s=>s).join("-").replace(/\s+/g,"-"):r==="script"?`${r}-${t}`:`${r}-${n.type}`}function Ht(e,t){if(t)return e?typeof e=="function"?e(t):e.replace("%s",t??""):t}function Gt(e){switch(e&&e.split(".").pop()){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";case"jpg":case"jpeg":default:return "image/jpeg"}}function Te(e){return Array.isArray(e)?e:[e]}function z(e,t){try{return e.validate(t)}catch(r){return console.warn(r.message),t}}var zt=lazy(()=>import('./log-seo-tags-TY72EQWZ.js'));function Jt({debug:e}){let t=useMatches(),r=useLocation(),n=useMemo(()=>t.flatMap(o=>{let{handle:i,...p}=o,d={...p,...r},u=i?.seo,c=p?.data?.seo;return !u&&!c?[]:u?J(u,d):[c]}).reduce((o,i)=>{Object.keys(i).forEach(d=>!i[d]&&delete i[d]);let{jsonLd:p}=i;return p?o?.jsonLd?Array.isArray(p)?{...o,...i,jsonLd:[...o.jsonLd,...p]}:{...o,...i,jsonLd:[...o.jsonLd,p]}:{...o,...i,jsonLd:[p]}:{...o,...i}},{}),[t,r]),{html:a,loggerMarkup:s}=useMemo(()=>{let o=tt(n),i=o.map(d=>d.tag==="script"?createElement(d.tag,{...d.props,key:d.key,dangerouslySetInnerHTML:{__html:d.children}}):createElement(d.tag,{...d.props,key:d.key},d.children)),p=createElement(Suspense,{fallback:null},createElement(zt,{headTags:o}));return {html:i,loggerMarkup:p}},[n]);return createElement(Fragment,null,a,e&&s)}function J(e,...t){if(e instanceof Function)return J(e(...t),...t);let r={};return Array.isArray(e)?(r=e.reduce((n,a)=>[...n,J(a)],[]),r):e instanceof Object?(Object.entries(e).forEach(([a,s])=>{r[a]=J(s,...t);}),r):e}function rr({connection:e,children:t=()=>(console.warn("<Pagination> requires children to work properly"),null)}){let n=useNavigation().state==="loading",{endCursor:a,hasNextPage:s,hasPreviousPage:o,nextPageUrl:i,nodes:p,previousPageUrl:d,startCursor:u}=nr(e),c=useMemo(()=>({pageInfo:{endCursor:a,hasPreviousPage:o,startCursor:u},nodes:p}),[a,o,u,p]),f=useMemo(()=>forwardRef(function(y,g){return s?createElement(Link,{preventScrollReset:!0,...y,to:i,state:c,replace:!0,ref:g}):null}),[s,i,c]),l=useMemo(()=>forwardRef(function(y,g){return o?createElement(Link,{preventScrollReset:!0,...y,to:d,state:c,replace:!0,ref:g}):null}),[o,d,c]);return t({state:c,hasNextPage:s,hasPreviousPage:o,isLoading:n,nextPageUrl:i,nodes:p,previousPageUrl:d,NextLink:f,PreviousLink:l})}function X(e){let t=new URLSearchParams(e);return t.delete("cursor"),t.delete("direction"),t.toString()}function k(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 nr(e){e.pageInfo||k("pageInfo"),typeof e.pageInfo.startCursor>"u"&&k("pageInfo.startCursor"),typeof e.pageInfo.endCursor>"u"&&k("pageInfo.endCursor"),typeof e.pageInfo.hasNextPage>"u"&&k("pageInfo.hasNextPage"),typeof e.pageInfo.hasPreviousPage>"u"&&k("pageInfo.hasPreviousPage");let t=useNavigate(),{state:r,search:n,pathname:a}=useLocation(),i=new URLSearchParams(n).get("direction")==="previous",[p,d]=useState(flattenConnection(e)),[u,c]=useState({startCursor:e.pageInfo.startCursor,endCursor:e.pageInfo.endCursor,hasPreviousPage:e.pageInfo.hasPreviousPage,hasNextPage:e.pageInfo.hasNextPage}),f=useRef({params:X(n),pathname:a});useEffect(()=>{if(X(n)!==f.current.params||a!==f.current.pathname)f.current={pathname:a,params:X(n)},t(`${a}?${X(n)}`,{replace:!0,preventScrollReset:!0,state:{nodes:void 0,pageInfo:void 0}});else if(r?.nodes){if(d(i?[...flattenConnection(e),...r.nodes]:[...r.nodes,...flattenConnection(e)]),r?.pageInfo){let y=r?.pageInfo?.startCursor===void 0?e.pageInfo.startCursor:r.pageInfo.startCursor,g=r?.pageInfo?.endCursor===void 0?e.pageInfo.endCursor:r.pageInfo.endCursor,m=r?.pageInfo?.hasPreviousPage===void 0?e.pageInfo.hasPreviousPage:r.pageInfo.hasPreviousPage,h=r?.pageInfo?.hasNextPage===void 0?e.pageInfo.hasNextPage:r.pageInfo.hasNextPage;i?(y=e.pageInfo.startCursor,m=e.pageInfo.hasPreviousPage):(g=e.pageInfo.endCursor,h=e.pageInfo.hasNextPage),c({startCursor:y,endCursor:g,hasPreviousPage:m,hasNextPage:h});}}else d(flattenConnection(e)),c({startCursor:e.pageInfo.startCursor,endCursor:e.pageInfo.endCursor,hasPreviousPage:e.pageInfo.hasPreviousPage,hasNextPage:e.pageInfo.hasNextPage});},[r,e,i,n,t,a]);let l=useMemo(()=>{let y=new URLSearchParams(n);return y.set("direction","previous"),u.startCursor&&y.set("cursor",u.startCursor),`?${y.toString()}`},[n,u.startCursor]),C=useMemo(()=>{let y=new URLSearchParams(n);return y.set("direction","next"),u.endCursor&&y.set("cursor",u.endCursor),`?${y.toString()}`},[n,u.endCursor]);return {...u,previousPageUrl:l,nextPageUrl:C,nodes:p}}function ar(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}=t,n=new URLSearchParams(new URL(e.url).search),a=n.get("cursor")??void 0;return (n.get("direction")==="previous"?"previous":"next")==="previous"?{last:r,startCursor:a??null}:{first:r,endCursor:a??null}}var x=class extends Response{constructor(t,r){super(`Bad request: ${t}`,{status:400});}};var F=`Shopify Hydrogen ${_}`,or="30243aa5-17c1-465a-8493-944bcc4e88aa";function Z(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 sr({session:e,customerAccountId:t,customerAccountUrl:r,origin:n}){let a=new URLSearchParams,s=e.get("refresh_token");if(!s)throw new x("Unauthorized","No refresh_token in the session. Make sure your session is configured correctly and passed to `createCustomerClient`.");a.append("grant_type","refresh_token"),a.append("refresh_token",s),a.append("client_id",t);let o={"content-type":"application/x-www-form-urlencoded","User-Agent":F,Origin:n},i=await fetch(`${r}/auth/oauth/token`,{method:"POST",headers:o,body:a});if(!i.ok){let l=await i.text();throw new Response(l,{status:i.status,headers:{"Content-Type":"text/html; charset=utf-8"}})}let{access_token:p,expires_in:d,id_token:u,refresh_token:c}=await i.json();e.set("customer_authorization_code_token",p),e.set("expires_at",new Date(new Date().getTime()+(d-120)*1e3).getTime()+""),e.set("id_token",u),e.set("refresh_token",c);let f=await Ae(e,t,r,n);e.set("customer_access_token",f);}function $(e){e.unset("code-verifier"),e.unset("customer_authorization_code_token"),e.unset("expires_at"),e.unset("id_token"),e.unset("refresh_token"),e.unset("customer_access_token"),e.unset("state"),e.unset("nonce");}async function xe({locks:e,expiresAt:t,session:r,customerAccountId:n,customerAccountUrl:a,origin:s}){if(parseInt(t,10)-1e3<new Date().getTime())try{e.refresh||(e.refresh=sr({session:r,customerAccountId:n,customerAccountUrl:a,origin:s})),await e.refresh,delete e.refresh;}catch(o){throw $(r),o&&o.status!==401?o:new x("Unauthorized","Login before querying the Customer Account API.")}}async function it(){let e=ir();return pt(e)}async function ct(e){let t=await crypto.subtle.digest({name:"SHA-256"},new TextEncoder().encode(e)),r=cr(t);return pt(r)}function ir(){let e=new Uint8Array(32);return crypto.getRandomValues(e),String.fromCharCode.apply(null,Array.from(e))}function pt(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function cr(e){let t=new Uint8Array(e),r=Array.from(t);return String.fromCharCode(...r)}async function ut(){let e=Date.now().toString(),t=Math.random().toString(36).substring(2);return e+t}async function Ae(e,t,r,n){let a=t,s=e.get("customer_authorization_code_token");if(!s)throw new x("Unauthorized","No access token found in the session. Make sure your session is configured correctly and passed to `createCustomerClient`.");let o=new URLSearchParams;o.append("grant_type","urn:ietf:params:oauth:grant-type:token-exchange"),o.append("client_id",a),o.append("audience",or),o.append("subject_token",s),o.append("subject_token_type","urn:ietf:params:oauth:token-type:access_token"),o.append("scopes","https://api.customers.com/auth/customer.graphql");let i={"content-type":"application/x-www-form-urlencoded","User-Agent":F,Origin:n},d=await(await fetch(`${r}/auth/oauth/token`,{method:"POST",headers:i,body:o})).json();if(d.error)throw new x(d.error_description);return d.access_token}function dt(e){return pr(e).payload.nonce}function pr(e){let[t,r,n]=e.split("."),a=JSON.parse(atob(t)),s=JSON.parse(atob(r));return {header:a,payload:s,signature:n}}function ee(){return dr(ur())}function ur(){try{return crypto.getRandomValues(new Uint8Array(16))}catch{return new Uint8Array(16).map(()=>Math.random()*255|0)}}function dr(e){return Array.from(e,function(t){return ("0"+(t&255).toString(16)).slice(-2)}).join("")}function lr({session:e,customerAccountId:t,customerAccountUrl:r,customerApiVersion:n="2023-10",request:a,waitUntil:s}){if(!a?.url)throw new Error("[h2:error:createCustomerClient] The request object does not contain a URL.");let o=new URL(a.url),i=o.protocol==="http:"?o.origin.replace("http","https"):o.origin,p={},d=void 0;async function u({query:c,type:f,variables:l={}}){let C=e.get("customer_access_token"),y=e.get("expires_at");if(!C||!y)throw new x("Unauthorized","Login before querying the Customer Account API.");await xe({locks:p,expiresAt:y,session:e,customerAccountId:t,customerAccountUrl:r,origin:i});new Date().getTime();let m=await fetch(`${r}/account/customer/api/${n}/graphql`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":F,Origin:i,Authorization:C},body:JSON.stringify({operationName:"SomeQuery",query:c,variables:l})});let h=await m.text(),A={response:m,type:f,query:c,queryVariables:l,errors:void 0,client:"customer"};if(!m.ok){let R;try{R=P(h);}catch{R=[{message:h}];}U({...A,errors:R});}try{return P(h).data}catch{U({...A,errors:[{message:h}]});}}return {login:async()=>{let c=new URL(r+"/auth/oauth/authorize"),f=await ut(),l=await ee();c.searchParams.set("client_id",t),c.searchParams.set("scope","openid email"),c.searchParams.append("response_type","code"),c.searchParams.append("redirect_uri",i+"/authorize"),c.searchParams.set("scope","openid email https://api.customers.com/auth/customer.graphql"),c.searchParams.append("state",f),c.searchParams.append("nonce",l);let C=await it(),y=await ct(C);return e.set("code-verifier",C),e.set("state",f),e.set("nonce",l),c.searchParams.append("code_challenge",y),c.searchParams.append("code_challenge_method","S256"),Z(c.toString(),{headers:{"Set-Cookie":await e.commit()}})},logout:async()=>{let c=e.get("id_token");return $(e),Z(`${r}/auth/logout?id_token_hint=${c}`,{status:302,headers:{"Set-Cookie":await e.commit()}})},isLoggedIn:async()=>{let c=e.get("expires_at");if(!e.get("customer_access_token")||!c)return !1;let f=new Date().getTime();try{await xe({locks:p,expiresAt:c,session:e,customerAccountId:t,customerAccountUrl:r,origin:i}),d?.(" check expires",f);}catch{return !1}return !0},mutate(c,f){return c=E(c),W(c,"customer.mutate"),u({query:c,type:"mutation",...f})},query(c,f){return c=E(c),j(c,"customer.query"),u({query:c,type:"query",...f})},authorize:async(c="/")=>{let f=o.searchParams.get("code"),l=o.searchParams.get("state");if(!f||!l)throw $(e),new x("Unauthorized","No code or state parameter found in the redirect URL.");if(e.get("state")!==l)throw $(e),new x("Unauthorized","The session state does not match the state parameter. Make sure that the session is configured correctly and passed to `createCustomerClient`.");let C=t,y=new URLSearchParams;y.append("grant_type","authorization_code"),y.append("client_id",C),y.append("redirect_uri",i+"/authorize"),y.append("code",f);let g=e.get("code-verifier");if(!g)throw new x("Unauthorized","No code verifier found in the session. Make sure that the session is configured correctly and passed to `createCustomerClient`.");y.append("code_verifier",g);let m={"content-type":"application/x-www-form-urlencoded","User-Agent":F,Origin:i},h=await fetch(`${r}/auth/oauth/token`,{method:"POST",headers:m,body:y});if(!h.ok)throw new Response(await h.text(),{status:h.status,headers:{"Content-Type":"text/html; charset=utf-8"}});let{access_token:A,expires_in:R,id_token:M,refresh_token:re}=await h.json(),O=e.get("nonce"),v=await dt(M);if(O!==v)throw new x("Unauthorized",`Returned nonce does not match: ${O} !== ${v}`);e.set("customer_authorization_code_token",A),e.set("expires_at",new Date(new Date().getTime()+(R-120)*1e3).getTime()+""),e.set("id_token",M),e.set("refresh_token",re);let Q=await Ae(e,t,r,i);return e.set("customer_access_token",Q),Z(c,{headers:{"Set-Cookie":await e.commit()}})}}}var lt="cartFormInput";function te({children:e,action:t,inputs:r,route:n}){let a=useFetcher();return jsxs(a.Form,{action:n||"",method:"post",children:[(t||r)&&jsx("input",{type:"hidden",name:lt,value:JSON.stringify({action:t,inputs:r})}),typeof e=="function"?e(a):e]})}te.INPUT_NAME=lt;te.ACTIONS={AttributesUpdateInput:"AttributesUpdateInput",BuyerIdentityUpdate:"BuyerIdentityUpdate",Create:"Create",DiscountCodesUpdate:"DiscountCodesUpdate",LinesAdd:"LinesAdd",LinesRemove:"LinesRemove",LinesUpdate:"LinesUpdate",NoteUpdate:"NoteUpdate",SelectedDeliveryOptionsUpdate:"SelectedDeliveryOptionsUpdate",MetafieldsSet:"MetafieldsSet",MetafieldDelete:"MetafieldDelete"};function gr(e){let t={};for(let o of e.entries()){let i=o[0],p=e.getAll(i);t[i]=p.length>1?p:o[1];}let{cartFormInput:r,...n}=t,{action:a,inputs:s}=r?JSON.parse(String(r)):{};return {action:a,inputs:{...s,...n}}}te.getFormInput=gr;var S=`#graphql
|
|
89
127
|
fragment CartApiError on CartUserError {
|
|
90
128
|
message
|
|
91
129
|
field
|
|
92
130
|
code
|
|
93
131
|
}
|
|
94
|
-
`,
|
|
132
|
+
`,I=`#graphql
|
|
95
133
|
fragment CartApiMutation on Cart {
|
|
96
134
|
id
|
|
97
135
|
totalQuantity
|
|
98
136
|
}
|
|
99
|
-
`;function
|
|
137
|
+
`;function we(e){return async(t,r)=>{let{cartId:n,...a}=r||{},{cartCreate:s}=await e.storefront.mutate(hr(e.cartFragment),{variables:{input:t,...a}});return s}}var hr=(e=I)=>`#graphql
|
|
100
138
|
mutation cartCreate(
|
|
101
139
|
$input: CartInput!
|
|
102
140
|
$country: CountryCode = ZZ
|
|
@@ -113,8 +151,8 @@ function De(e){let t=Array.isArray(e)?e:[e],r="";for(let a of t)a!=null&&(typeof
|
|
|
113
151
|
}
|
|
114
152
|
}
|
|
115
153
|
${e}
|
|
116
|
-
${
|
|
117
|
-
`;function
|
|
154
|
+
${S}
|
|
155
|
+
`;function Oe(e){return async t=>{let r=e.getCartId();if(!r)return null;let{cart:n}=await e.storefront.query(Cr(e.cartFragment),{variables:{cartId:r,...t},cache:e.storefront.CacheNone()});return n}}var Cr=(e=Sr)=>`#graphql
|
|
118
156
|
query CartQuery(
|
|
119
157
|
$cartId: ID!
|
|
120
158
|
$numCartLines: Int = 100
|
|
@@ -127,7 +165,7 @@ function De(e){let t=Array.isArray(e)?e:[e],r="";for(let a of t)a!=null&&(typeof
|
|
|
127
165
|
}
|
|
128
166
|
|
|
129
167
|
${e}
|
|
130
|
-
`,
|
|
168
|
+
`,Sr=`#graphql
|
|
131
169
|
fragment CartApiQuery on Cart {
|
|
132
170
|
id
|
|
133
171
|
checkoutUrl
|
|
@@ -233,7 +271,7 @@ function De(e){let t=Array.isArray(e)?e:[e],r="";for(let a of t)a!=null&&(typeof
|
|
|
233
271
|
width
|
|
234
272
|
height
|
|
235
273
|
}
|
|
236
|
-
`;function
|
|
274
|
+
`;function Pe(e){return async(t,r)=>{let{cartLinesAdd:n}=await e.storefront.mutate(Ir(e.cartFragment),{variables:{cartId:e.getCartId(),lines:t,...r}});return n}}var Ir=(e=I)=>`#graphql
|
|
237
275
|
mutation cartLinesAdd(
|
|
238
276
|
$cartId: ID!
|
|
239
277
|
$lines: [CartLineInput!]!
|
|
@@ -251,8 +289,8 @@ function De(e){let t=Array.isArray(e)?e:[e],r="";for(let a of t)a!=null&&(typeof
|
|
|
251
289
|
}
|
|
252
290
|
|
|
253
291
|
${e}
|
|
254
|
-
${
|
|
255
|
-
`;function
|
|
292
|
+
${S}
|
|
293
|
+
`;function be(e){return async(t,r)=>{let{cartLinesUpdate:n}=await e.storefront.mutate(Rr(e.cartFragment),{variables:{cartId:e.getCartId(),lines:t,...r}});return n}}var Rr=(e=I)=>`#graphql
|
|
256
294
|
mutation cartLinesUpdate(
|
|
257
295
|
$cartId: ID!
|
|
258
296
|
$lines: [CartLineUpdateInput!]!
|
|
@@ -270,8 +308,8 @@ function De(e){let t=Array.isArray(e)?e:[e],r="";for(let a of t)a!=null&&(typeof
|
|
|
270
308
|
}
|
|
271
309
|
|
|
272
310
|
${e}
|
|
273
|
-
${
|
|
274
|
-
`;function
|
|
311
|
+
${S}
|
|
312
|
+
`;function De(e){return async(t,r)=>{let{cartLinesRemove:n}=await e.storefront.mutate(Tr(e.cartFragment),{variables:{cartId:e.getCartId(),lineIds:t,...r}});return n}}var Tr=(e=I)=>`#graphql
|
|
275
313
|
mutation cartLinesRemove(
|
|
276
314
|
$cartId: ID!
|
|
277
315
|
$lineIds: [ID!]!
|
|
@@ -289,8 +327,8 @@ function De(e){let t=Array.isArray(e)?e:[e],r="";for(let a of t)a!=null&&(typeof
|
|
|
289
327
|
}
|
|
290
328
|
|
|
291
329
|
${e}
|
|
292
|
-
${
|
|
293
|
-
`;function
|
|
330
|
+
${S}
|
|
331
|
+
`;function Ee(e){return async(t,r)=>{let n=t.filter((s,o,i)=>i.indexOf(s)===o),{cartDiscountCodesUpdate:a}=await e.storefront.mutate(xr(e.cartFragment),{variables:{cartId:e.getCartId(),discountCodes:n,...r}});return a}}var xr=(e=I)=>`#graphql
|
|
294
332
|
mutation cartDiscountCodesUpdate(
|
|
295
333
|
$cartId: ID!
|
|
296
334
|
$discountCodes: [String!]
|
|
@@ -307,8 +345,8 @@ function De(e){let t=Array.isArray(e)?e:[e],r="";for(let a of t)a!=null&&(typeof
|
|
|
307
345
|
}
|
|
308
346
|
}
|
|
309
347
|
${e}
|
|
310
|
-
${
|
|
311
|
-
`;function
|
|
348
|
+
${S}
|
|
349
|
+
`;function Ue(e){return async(t,r)=>{let{cartBuyerIdentityUpdate:n}=await e.storefront.mutate(Ar(e.cartFragment),{variables:{cartId:e.getCartId(),buyerIdentity:t,...r}});return n}}var Ar=(e=I)=>`#graphql
|
|
312
350
|
mutation cartBuyerIdentityUpdate(
|
|
313
351
|
$cartId: ID!
|
|
314
352
|
$buyerIdentity: CartBuyerIdentityInput!
|
|
@@ -325,8 +363,8 @@ function De(e){let t=Array.isArray(e)?e:[e],r="";for(let a of t)a!=null&&(typeof
|
|
|
325
363
|
}
|
|
326
364
|
}
|
|
327
365
|
${e}
|
|
328
|
-
${
|
|
329
|
-
`;function
|
|
366
|
+
${S}
|
|
367
|
+
`;function Me(e){return async(t,r)=>{let{cartNoteUpdate:n}=await e.storefront.mutate(wr(e.cartFragment),{variables:{cartId:e.getCartId(),note:t,...r}});return n}}var wr=(e=I)=>`#graphql
|
|
330
368
|
mutation cartNoteUpdate(
|
|
331
369
|
$cartId: ID!
|
|
332
370
|
$note: String
|
|
@@ -343,8 +381,8 @@ function De(e){let t=Array.isArray(e)?e:[e],r="";for(let a of t)a!=null&&(typeof
|
|
|
343
381
|
}
|
|
344
382
|
}
|
|
345
383
|
${e}
|
|
346
|
-
${
|
|
347
|
-
`;function
|
|
384
|
+
${S}
|
|
385
|
+
`;function ve(e){return async(t,r)=>{let{cartSelectedDeliveryOptionsUpdate:n}=await e.storefront.mutate(Or(e.cartFragment),{variables:{cartId:e.getCartId(),selectedDeliveryOptions:t,...r}});return n}}var Or=(e=I)=>`#graphql
|
|
348
386
|
mutation cartSelectedDeliveryOptionsUpdate(
|
|
349
387
|
$cartId: ID!
|
|
350
388
|
$selectedDeliveryOptions: [CartSelectedDeliveryOptionInput!]!
|
|
@@ -361,8 +399,8 @@ function De(e){let t=Array.isArray(e)?e:[e],r="";for(let a of t)a!=null&&(typeof
|
|
|
361
399
|
}
|
|
362
400
|
}
|
|
363
401
|
${e}
|
|
364
|
-
${
|
|
365
|
-
`;function
|
|
402
|
+
${S}
|
|
403
|
+
`;function Le(e){return async(t,r)=>{let{cartAttributesUpdate:n}=await e.storefront.mutate(Pr(e.cartFragment),{variables:{cartId:r?.cartId||e.getCartId(),attributes:t}});return n}}var Pr=(e=I)=>`#graphql
|
|
366
404
|
mutation cartAttributesUpdate(
|
|
367
405
|
$cartId: ID!
|
|
368
406
|
$attributes: [AttributeInput!]!
|
|
@@ -377,8 +415,8 @@ function De(e){let t=Array.isArray(e)?e:[e],r="";for(let a of t)a!=null&&(typeof
|
|
|
377
415
|
}
|
|
378
416
|
}
|
|
379
417
|
${e}
|
|
380
|
-
${
|
|
381
|
-
`;function
|
|
418
|
+
${S}
|
|
419
|
+
`;function _e(e){return async(t,r)=>{let n=r?.cartId||e.getCartId(),a=t.map(o=>({...o,ownerId:n})),{cartMetafieldsSet:s}=await e.storefront.mutate(br(),{variables:{metafields:a}});return {cart:{id:n},errors:s.errors}}}var br=()=>`#graphql
|
|
382
420
|
mutation cartMetafieldsSet(
|
|
383
421
|
$metafields: [CartMetafieldsSetInput!]!
|
|
384
422
|
$language: LanguageCode
|
|
@@ -393,7 +431,7 @@ function De(e){let t=Array.isArray(e)?e:[e],r="";for(let a of t)a!=null&&(typeof
|
|
|
393
431
|
}
|
|
394
432
|
}
|
|
395
433
|
}
|
|
396
|
-
`;function
|
|
434
|
+
`;function Ne(e){return async(t,r)=>{let n=r?.cartId||e.getCartId(),{cartMetafieldDelete:a}=await e.storefront.mutate(Dr(),{variables:{input:{ownerId:n,key:t}}});return {cart:{id:n},errors:a.errors}}}var Dr=()=>`#graphql
|
|
397
435
|
mutation cartMetafieldDelete(
|
|
398
436
|
$input: CartMetafieldDeleteInput!
|
|
399
437
|
) {
|
|
@@ -405,7 +443,7 @@ function De(e){let t=Array.isArray(e)?e:[e],r="";for(let a of t)a!=null&&(typeof
|
|
|
405
443
|
}
|
|
406
444
|
}
|
|
407
445
|
}
|
|
408
|
-
`;var
|
|
446
|
+
`;var Er=new Set(["domain","path","max-age","expires","samesite","secure","httponly"]);function ft(e){let t={},r,n,a=0,s=e.split(/;\s*/g),o,i;for(;a<s.length;a++)if(n=s[a],r=n.indexOf("="),~r){if(o=n.substring(0,r++).trim(),i=n.substring(r).trim(),i[0]==='"'&&(i=i.substring(1,i.length-1)),~i.indexOf("%"))try{i=decodeURIComponent(i);}catch{}Er.has(n=o.toLowerCase())?n==="expires"?t.expires=new Date(i):n==="max-age"?t.maxage=+i:t[n]=i:t[o]=i;}else (o=n.trim().toLowerCase())&&(o==="httponly"||o==="secure")&&(t[o]=!0);return t}function gt(e,t,r={}){let n=e+"="+encodeURIComponent(t);return r.expires&&(n+="; Expires="+new Date(r.expires).toUTCString()),r.maxage!=null&&r.maxage>=0&&(n+="; Max-Age="+(r.maxage|0)),r.domain&&(n+="; Domain="+r.domain),r.path&&(n+="; Path="+r.path),r.samesite&&(n+="; SameSite="+r.samesite),(r.secure||r.samesite==="None")&&(n+="; Secure"),r.httponly&&(n+="; HttpOnly"),n}var Ur=e=>{let t=ft(e.get("Cookie")||"");return ()=>t.cart?`gid://shopify/Cart/${t.cart}`:void 0};var Mr=e=>t=>{let r=new Headers;return r.append("Set-Cookie",gt("cart",t.split("/").pop()||"",{path:"/",...e})),r};function vr(e){let{getCartId:t,setCartId:r,storefront:n,cartQueryFragment:a,cartMutateFragment:s}=e,o={storefront:n,getCartId:t,cartFragment:s},i=t(),p=we(o),d={get:Oe({storefront:n,getCartId:t,cartFragment:a}),getCartId:t,setCartId:r,create:p,addLines:async(u,c)=>i||c?.cartId?await Pe(o)(u,c):await p({lines:u},c),updateLines:be(o),removeLines:De(o),updateDiscountCodes:async(u,c)=>i||c?.cartId?await Ee(o)(u,c):await p({discountCodes:u},c),updateBuyerIdentity:async(u,c)=>i||c?.cartId?await Ue(o)(u,c):await p({buyerIdentity:u},c),updateNote:async(u,c)=>i||c?.cartId?await Me(o)(u,c):await p({note:u},c),updateSelectedDeliveryOption:ve(o),updateAttributes:async(u,c)=>i||c?.cartId?await Le(o)(u,c):await p({attributes:u},c),setMetafields:async(u,c)=>i||c?.cartId?await _e(o)(u,c):await p({metafields:u},c),deleteMetafield:Ne(o)};return "customMethods"in e?{...d,...e.customMethods??{}}:d}function qr({handle:e,options:t=[],variants:r=[],productPath:n="products",children:a}){let s=r instanceof Array?r:flattenConnection(r),{searchParams:o,path:i,alreadyOnProductPage:p}=$r(e,n),d=t.filter(u=>u?.values?.length===1);return createElement(Fragment,null,...useMemo(()=>t.filter(u=>u?.values?.length>1).map(u=>{let c,f=[];for(let l of u.values){let C=new URLSearchParams(p?o:void 0);C.set(u.name,l),d.forEach(A=>{C.set(A.name,A.values[0]);});let y=s.find(A=>A?.selectedOptions?.every(R=>C.get(R?.name)===R?.value)),g=o.get(u.name),m=g?g===l:!1;m&&(c=l);let h="?"+C.toString();f.push({value:l,isAvailable:y?y.availableForSale:!0,to:i+h,search:h,isActive:m});}return a({option:{name:u.name,value:c,values:f}})}),[t,s,a]))}var Fr=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((n,a)=>{r.push({name:a,value:n});}),r};function $r(e,t){let{pathname:r,search:n}=useLocation();return useMemo(()=>{let a=/(\/[a-zA-Z]{2}-[a-zA-Z]{2}\/)/g.exec(r),s=a&&a.length>0;t=t.startsWith("/")?t.substring(1):t;let o=s?`${a[0]}${t}/${e}`:`/${t}/${e}`;return {searchParams:new URLSearchParams(n),alreadyOnProductPage:o===r,path:o}},[r,n,e,t])}var mt=createContext(void 0),Br=mt.Provider,ke=()=>useContext(mt);function jr(e={}){let t=ee(),r=Wr(t,e);return {nonce:t,header:r,NonceProvider:({children:a})=>createElement(Br,{value:t},a)}}function Wr(e,t={}){let r=`'nonce-${e}'`,a=Object.assign({},{baseUri:["'self'"],defaultSrc:["'self'",r,"https://cdn.shopify.com","https://shopify.com"],frameAncestors:["none"],styleSrc:["'self'","'unsafe-inline'","https://cdn.shopify.com"],connectSrc:["'self'","https://monorail-edge.shopifysvc.com"]},t);return a.scriptSrc instanceof Array&&!a.scriptSrc.includes(r)?a.scriptSrc.push(r):a.defaultSrc instanceof Array&&!a.defaultSrc.includes(r)&&a.defaultSrc.push(r),Vr({directives:a})}var zr=forwardRef((e,t)=>{let r=ke();return jsx("script",{suppressHydrationWarning:!0,...e,nonce:r,ref:t})});function Xr(e){let t=useFetchers(),r={};for(let{formData:n}of t)if(n?.get("optimistic-identifier")===e)try{if(n.has("optimistic-data")){let a=JSON.parse(String(n.get("optimistic-data")));Object.assign(r,a);}}catch{}return r}function Zr({id:e,data:t}){return jsxs(Fragment$1,{children:[jsx("input",{type:"hidden",name:"optimistic-identifier",value:e}),jsx("input",{type:"hidden",name:"optimistic-data",value:JSON.stringify(t)})]})}//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartCreate
|
|
409
447
|
//! @see https://shopify.dev/docs/api/storefront/latest/queries/cart
|
|
410
448
|
//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartLinesAdd
|
|
411
449
|
//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartLinesUpdate
|
|
@@ -415,8 +453,8 @@ function De(e){let t=Array.isArray(e)?e:[e],r="";for(let a of t)a!=null&&(typeof
|
|
|
415
453
|
//! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartNoteUpdate
|
|
416
454
|
//! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartSelectedDeliveryOptionsUpdate
|
|
417
455
|
//! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartMetafieldsSet
|
|
418
|
-
//! @see https://shopify.dev/docs/api/storefront/2023-
|
|
456
|
+
//! @see https://shopify.dev/docs/api/storefront/2023-10/mutations/cartMetafieldDelete
|
|
419
457
|
|
|
420
|
-
export {
|
|
458
|
+
export { pe as CacheCustom, ce as CacheLong, se as CacheNone, b as CacheShort, te as CartForm, Ie as InMemoryCache, Zr as OptimisticInput, rr as Pagination, zr as Script, Jt as Seo, Ye as StorefrontApiError, qr as VariantSelector, Le as cartAttributesUpdateDefault, Ue as cartBuyerIdentityUpdateDefault, we as cartCreateDefault, Ee as cartDiscountCodesUpdateDefault, Oe as cartGetDefault, Ur as cartGetIdDefault, Pe as cartLinesAddDefault, De as cartLinesRemoveDefault, be as cartLinesUpdateDefault, Ne as cartMetafieldDeleteDefault, _e as cartMetafieldsSetDefault, Me as cartNoteUpdateDefault, ve as cartSelectedDeliveryOptionsUpdateDefault, Mr as cartSetIdDefault, vr as createCartHandler, jr as createContentSecurityPolicy, lr as createCustomerClient__unstable, Un as createStorefrontClient, kn as createWithCache, L as generateCacheControlHeader, ar as getPaginationVariables, Fr as getSelectedProductOptions, Qt as graphiqlLoader, Nt as isStorefrontApiError, qt as storefrontRedirect, ke as useNonce, Xr as useOptimisticData };
|
|
421
459
|
//# sourceMappingURL=out.js.map
|
|
422
460
|
//# sourceMappingURL=index.js.map
|