hydrogen-sfdgspsdmq-test1 0.0.1-security → 2024.1.14
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.
Potentially problematic release.
This version of hydrogen-sfdgspsdmq-test1 might be problematic. Click here for more details.
- package/LICENSE.md +7 -0
- package/README.md +20 -3
- package/dist/customer-account-api-types.d.ts +9675 -0
- package/dist/customer-account.schema.json +1 -0
- package/dist/development/build.js +223 -0
- package/dist/development/index.cjs +3708 -0
- package/dist/development/index.cjs.map +1 -0
- package/dist/development/index.js +3491 -0
- package/dist/development/index.js.map +1 -0
- package/dist/development/log-seo-tags-IG37ONQ2.js +74 -0
- package/dist/development/log-seo-tags-IG37ONQ2.js.map +1 -0
- package/dist/index.cjs +1 -0
- package/dist/production/index.cjs +754 -0
- package/dist/production/index.cjs.map +1 -0
- package/dist/production/index.d.cts +1515 -0
- package/dist/production/index.d.ts +1515 -0
- package/dist/production/index.js +626 -0
- package/dist/production/index.js.map +1 -0
- package/dist/production/log-seo-tags-TY72EQWZ.js +5 -0
- package/dist/production/log-seo-tags-TY72EQWZ.js.map +1 -0
- package/dist/storefront-api-types.d.ts +7986 -0
- package/dist/storefront.schema.json +1 -0
- package/package.json +77 -3
@@ -0,0 +1,754 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var hydrogenReact = require('@shopify/hydrogen-react');
|
4
|
+
var react = require('react');
|
5
|
+
var react$1 = require('@remix-run/react');
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
7
|
+
var An = require('content-security-policy-builder');
|
8
|
+
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
10
|
+
|
11
|
+
var An__default = /*#__PURE__*/_interopDefault(An);
|
12
|
+
|
13
|
+
var Gt=Object.defineProperty;var Vt=(e,t)=>()=>(e&&(t=e(e=0)),t);var Bt=(e,t)=>{for(var r in t)Gt(e,r,{get:t[r],enumerable:!0});};var Tt={};Bt(Tt,{default:()=>St,logSeoTags:()=>It});function St({headTags:e}){return It(e),null}function It(e){console.log(" "),console.log("%cSEO Meta Tags",`${yr}`),console.log(" "),e.forEach(t=>{if(t.tag==="script"){if(console.log("%c\u2022 JSON LD ",Qe),t.children)try{console.table(JSON.parse(t.children),["name","content"]);}catch{console.log(t.children);}}else {if(console.log(`%c\u2022 ${t.tag} `,Qe),t.children)if(typeof t.children=="string")console.log(`\u21B3 ${t.children}`);else try{Object.entries(JSON.parse(t.children)).map(([r,n])=>console.log(`\u21B3 ${n}`));}catch{console.log(t.children);}if(t.props.property==="og:image:url"){let r=t.props.content;hr(r).then(n=>{let o=`font-size: 400px; padding: 10px; background: white url(${n}) no-repeat center; background-size: contain;`;console.log("%c\u2022 Share image preview",Qe),console.log("%c ",o),console.log(`\u21B3 ${r}`);}).catch(n=>{console.error(n);});}Object.entries(t.props).map(([r,n])=>{console.log(`\u21B3 ${r} \u2192 ${n}`);});}console.log(" ");});}async function hr(e){let n=await(await(await fetch(e)).blob()).arrayBuffer();return `data:image/png;base64,${Cr(n)}`}function Cr(e){let t="",r=new Uint8Array(e),n=r.byteLength;for(let o=0;o<n;o++)t+=String.fromCharCode(r[o]);return btoa(t)}var Qe,yr,Rt=Vt(()=>{Qe="text-transform: uppercase;",yr="text-transform: uppercase; font-weight: bold; text-transform: uppercase;font-weight: bold";});function at(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 ie="public",jt="private",Ae="no-store",st={maxAge:"max-age",staleWhileRevalidate:"stale-while-revalidate",sMaxAge:"s-maxage",staleIfError:"stale-if-error"};function Z(e){let t=[];return Object.keys(e).forEach(r=>{r==="mode"?t.push(e[r]):st[r]&&t.push(`${st[r]}=${e[r]}`);}),t.join(", ")}function xe(){return {mode:Ae}}function Ee(e){if(e?.mode&&e?.mode!==ie&&e?.mode!==jt)throw Error("'mode' must be either 'public' or 'private'")}function G(e){return Ee(e),{mode:ie,maxAge:1,staleWhileRevalidate:9,...e}}function be(e){return Ee(e),{mode:ie,maxAge:3600,staleWhileRevalidate:82800,...e}}function V(e){return Ee(e),{mode:ie,maxAge:1,staleWhileRevalidate:86399,...e}}function Oe(e){return e}function $(e){return String(e).includes("__proto__")?JSON.parse(e,Wt):JSON.parse(e)}function Wt(e,t){if(e!=="__proto__")return t}function ce(e,t){return e&&t?{...e,...t}:e||V()}function Pe(e){return Z(ce(e))}async function Kt(e,t){if(!e)return;let r=await e.match(t);if(!r){return}return r}async function Jt(e,t,r,n){if(!e)return;let o=ce(n),a=Pe(ce(o,{maxAge:(o.maxAge||0)+(o.staleWhileRevalidate||0)})),s=Pe(ce(o));r.headers.set("cache-control",a),r.headers.set("real-cache-control",s),r.headers.set("cache-put-date",new Date().toUTCString()),await e.put(t,r);}async function zt(e,t){e&&await e.delete(t);}function Yt(e,t){let r=e.headers.get("real-cache-control"),n=0;if(r){let a=r.match(/max-age=(\d*)/);a&&a.length>1&&(n=parseFloat(a[1]));}return [(new Date().valueOf()-new Date(t).valueOf())/1e3,n]}function Xt(e,t){let r=t.headers.get("cache-put-date");if(!r)return !1;let[n,o]=Yt(t,r),a=n>o;return a}var ue={get:Kt,set:Jt,delete:zt,generateDefaultCacheControlHeader:Pe,isStale:Xt};function we(e){return `https://shopify.dev/?${e}`}function Zt(e){return e||V()}async function it(e,t){if(!e)return;let r=we(t),n=new Request(r),o=await ue.get(e,n);if(!o)return;let a=await o.text();try{return [$(a),o]}catch{return [a,o]}}async function De(e,t,r,n){if(!e)return;let o=we(t),a=new Request(o),s=new Response(JSON.stringify(r));await ue.set(e,a,s,Zt(n));}function ct(e,t){return ue.isStale(new Request(we(e)),t)}function ut(e,t){return [e,{status:t.status,statusText:t.statusText,headers:Array.from(t.headers.entries())}]}function pt([e,t]){return [e,new Response(e,t)]}var dt=(e,t)=>!e?.errors&&t.status<400,Ue=new Set;async function Le(e,t,{strategy:r=G(),cacheInstance:n,shouldCacheResult:o=()=>!0,waitUntil:a,debugInfo:s}){let c=at([...typeof e=="string"?[e]:e]),l=m=>{({displayName:m.displayName,url:m.response?.url,responseInit:{status:m.response?.status||0,statusText:m.response?.statusText||"",headers:Array.from(m.response?.headers.entries()||[])}});},p=void 0;if(!n||!r||r.mode===Ae){let m=await t({addDebugData:l});return m}let f=await it(n,c);if(f){let[m,C]=f,S=ct(c,C)?"STALE":"HIT";if(!Ue.has(c)&&S==="STALE"){Ue.add(c);let g=Promise.resolve().then(async()=>{let b=Date.now();try{let d=await t({addDebugData:l});o(d)&&(await De(n,c,d,r),p?.({result:d,cacheStatus:"PUT",overrideStartTime:b}));}catch(d){d.message&&(d.message="SWR in sub-request failed: "+d.message),console.error(d);}finally{Ue.delete(c);}});a?.(g);}return m}let y=await t({addDebugData:l});if(o(y)){let m=Promise.resolve().then(async()=>{await De(n,c,y,r);});a?.(m);}return y}async function lt(e,t,{cacheInstance:r,cache:n,cacheKey:o=[e,t],shouldCacheResponse:a=()=>!0,waitUntil:s,returnType:i="json",debugInfo:c}={}){return !n&&(!t.method||t.method==="GET")&&(n=G()),Le(o,async()=>{let u=await fetch(e,t),l;try{l=await u[i]();}catch{try{l=await u.text();}catch{return ut("",u)}}return ut(l,u)},{cacheInstance:r,waitUntil:s,strategy:n??null,debugInfo:c,shouldCacheResult:u=>a(...pt(u))}).then(pt)}var ve="Custom-Storefront-Request-Group-ID",ke="X-Shopify-Storefront-Access-Token",Ne="X-SDK-Variant",_e="X-SDK-Variant-Source",Me="X-SDK-Version";function ft(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`weak-${Math.random().toString(16).substring(2)}`}var ee="2024.1.6";function B(e){return e.replace(/\s*#.*$/gm,"").replace(/\s+/gm," ").trim()}var er=/(^|}\s)query[\s({]/im,tr=/(^|}\s)mutation[\s({]/im;function pe(e,t){if(!er.test(e))throw new Error(`[h2:error:${t}] Can only execute queries`)}function de(e,t){if(!tr.test(e))throw new Error(`[h2:error:${t}] Can only execute mutations`)}var q=class extends Error{locations;path;extensions;constructor(t,r={}){let o=(r.clientOperation?`[h2:error:${r.clientOperation}] `:"")+t+(r.requestId?` - Request ID: ${r.requestId}`:"");super(o),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+=`
|
14
|
+
`,this.stack&&(t+=`${this.stack.slice(this.stack.indexOf(`
|
15
|
+
`)+1)}
|
16
|
+
`),t}toJSON(){return {name:"Error",message:""}}};function te({url:e,response:t,errors:r,type:n,query:o,queryVariables:a,ErrorConstructor:s=Error,client:i="storefront"}){let c=(typeof r=="string"?r:r?.map?.(l=>l.message).join(`
|
17
|
+
`))||`URL: ${e}
|
18
|
+
API response error: ${t.status}`,u=new q(c,{query:o,queryVariables:a,cause:{errors:r},clientOperation:`${i}.${n}`,requestId:t.headers.get("x-request-id")});throw new s(u.message,{cause:u.cause})}function j(e,t={}){let r=new Error,n=(o,a="Error")=>{let s=(r.stack??"").split(`
|
19
|
+
`).slice(3+(t.stackOffset??0)).join(`
|
20
|
+
`).replace(/ at loader(\d+) \(/,(i,c)=>i.replace(c,""));return `${a}: ${o}
|
21
|
+
`+s};return e.then(o=>{if(o?.errors&&Array.isArray(o.errors)){let a=typeof t.logErrors=="function"?t.logErrors:()=>t.logErrors??!1;o.errors.forEach(s=>{s&&(s.stack=n(s.message,s.name),a(s)&&console.error(s));});}return o}).catch(o=>{throw o&&(o.stack=n(o.message,o.name)),o})}var k=void 0;var ir={language:"EN",country:"US"};function ho(e){let {storefrontHeaders:t,cache:r,waitUntil:n,i18n:o,storefrontId:a,logErrors:s=!0,...i}=e,{getPublicTokenHeaders:u,getPrivateTokenHeaders:l,getStorefrontApiUrl:p,getShopifyDomain:f}=hydrogenReact.createStorefrontClient(i),m=(i.privateStorefrontToken?l:u)({contentType:"json",buyerIp:t?.buyerIp||""});if(m[ve]=t?.requestGroupId||ft(),a&&(m[hydrogenReact.SHOPIFY_STOREFRONT_ID_HEADER]=a),(m["user-agent"]=`Hydrogen ${ee}`),t&&t.cookie){let g=hydrogenReact.getShopifyCookies(t.cookie??"");g[hydrogenReact.SHOPIFY_Y]&&(m[hydrogenReact.SHOPIFY_STOREFRONT_Y_HEADER]=g[hydrogenReact.SHOPIFY_Y]),g[hydrogenReact.SHOPIFY_S]&&(m[hydrogenReact.SHOPIFY_STOREFRONT_S_HEADER]=g[hydrogenReact.SHOPIFY_S]);}let C=JSON.stringify({"content-type":m["content-type"],"user-agent":m["user-agent"],[Ne]:m[Ne],[_e]:m[_e],[Me]:m[Me],[ke]:m[ke]});async function S({query:g,mutation:b,variables:d,cache:I,headers:T=[],storefrontApiVersion:x,displayName:N,stackInfo:J}){let L=T instanceof Headers?Object.fromEntries(T.entries()):Array.isArray(T)?Object.fromEntries(T):T;g=g??b;let D={...d};o&&(!d?.country&&/\$country/.test(g)&&(D.country=o.country),!d?.language&&/\$language/.test(g)&&(D.language=o.language));let v=p({storefrontApiVersion:x}),E=JSON.stringify({query:g,variables:D}),w={method:"POST",headers:{...m,...L},body:E},z=[v,w.method,C,w.body],[_,F]=await lt(v,w,{cacheInstance:b?void 0:r,cache:I||V(),cacheKey:z,shouldCacheResponse:dt,waitUntil:n,debugInfo:{url:v,graphql:E,requestId:w.headers[ve],purpose:t?.purpose,stackInfo:J,displayName:N}}),Y={url:v,response:F,type:b?"mutation":"query",query:g,queryVariables:D,errors:void 0};if(!F.ok){let X;try{X=$(_);}catch{X=[{message:_}];}te({...Y,errors:X});}let{data:se,errors:Te}=_,Re=Te?.map(({message:X,...ot})=>new q(X,{...ot,clientOperation:`storefront.${Y.type}`,requestId:F.headers.get("x-request-id"),queryVariables:D,query:g}));return h(se,Re)}return {storefront:{query(g,b){g=B(g),pe(g,"storefront.query");let d=yt?.(g);return j(S({...b,query:g,stackInfo:k?.(d)}),{stackOffset:d,logErrors:s})},mutate(g,b){g=B(g),de(g,"storefront.mutate");let d=yt?.(g);return j(S({...b,mutation:g,stackInfo:k?.(d)}),{stackOffset:d,logErrors:s})},cache:r,CacheNone:xe,CacheLong:be,CacheShort:G,CacheCustom:Oe,generateCacheControlHeader:Z,getPublicTokenHeaders:u,getPrivateTokenHeaders:l,getShopifyDomain:f,getApiUrl:p,isApiError:g=>!1,i18n:o??ir}}}var yt=void 0;function h(e,t){return {...e,...t&&{errors:t}}}function le(e,t){let r=e.headers?.get?.(t)??e.headers?.[t];return typeof r=="string"?r:null}function H(e){return {requestId:e?le(e,"request-id"):void 0,purpose:e?le(e,"purpose"):void 0}}function Ao({cache:e,waitUntil:t,request:r}){return function(o,a,s){return Le(o,s,{strategy:a,cacheInstance:e,waitUntil:t,debugInfo:{...H(r),stackInfo:k?.()}})}}var Fe=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:o,...a}=r,s=new Headers(a.headers),i=s.get("cache-control")||s.get("real-cache-control")||"",c=parseInt(i.match(/max-age=(\d+)/)?.[1]||"0",10),u=parseInt(i.match(/stale-while-revalidate=(\d+)/)?.[1]||"0",10),l=(Date.now()-o)/1e3;if(l>c+u){this.#e.delete(t.url);return}let f=l>c;return s.set("cache",f?"STALE":"HIT"),s.set("date",new Date(o).toUTCString()),new Response(n,{status:a.status??200,headers:s})}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)}};function fe(e){if(!e)return;let{pathname:t,search:r}=new URL(e),n=t+r,o=new URLSearchParams(r),a=o.get("return_to")||o.get("redirect");if(a){if(cr(e,a))return a;console.warn(`Cross-domain redirects are not supported. Tried to redirect from ${n} to ${a}`);}}function cr(e,t){try{return new URL(e).origin===new URL(t,e).origin}catch{return !1}}async function ur(e){let{storefront:t,request:r,noAdminRedirect:n,response:o=new Response("Not Found",{status:404})}=e,a=new URL(r.url),s=a.searchParams.has("_data");a.searchParams.delete("_data");let i=a.toString().replace(a.origin,"");if(a.pathname==="/admin"&&!n)return $e(`${t.getShopifyDomain()}/admin`,s);try{let{urlRedirects:c}=await t.query(pr,{variables:{query:"path:"+i}}),u=c?.edges?.[0]?.node?.target;if(u)return $e(u,s);let l=fe(r.url);if(l)return $e(l,s)}catch(c){console.error(`Failed to fetch redirects from Storefront API for route ${i}`,c);}return o}function $e(e,t){return t?new Response(null,{status:200,headers:{"X-Remix-Redirect":e,"X-Remix-Status":"302"}}):new Response(null,{status:302,headers:{location:e}})}var pr=`#graphql
|
22
|
+
query redirects($query: String) {
|
23
|
+
urlRedirects(first: 1, query: $query) {
|
24
|
+
edges {
|
25
|
+
node {
|
26
|
+
target
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
`;var dr=async function({request:t,context:r}){let n=r.storefront,o=r.customerAccount,a=new URL(t.url);if(!n)throw new Error("GraphiQL: Hydrogen's storefront client must be injected in the loader context.");let s={};if(n){let u="X-Shopify-Storefront-Access-Token";s.storefront={name:"Storefront API",authHeader:u,accessToken:n.getPublicTokenHeaders()[u],apiUrl:n.getApiUrl(),icon:"SF"};}if(o){let u=await(await fetch(a.origin+"/graphiql/customer-account.schema.json")).json(),l=await o.getAccessToken();u&&(s["customer-account"]={name:"Customer Account API",value:u,authHeader:"Authorization",accessToken:l,apiUrl:o.getApiUrl(),icon:"CA"});}let i="https://avatars.githubusercontent.com/u/12972006?s=48&v=4",c=String.raw;return new Response(c`
|
32
|
+
<!DOCTYPE html>
|
33
|
+
<html lang="en">
|
34
|
+
<head>
|
35
|
+
<title>GraphiQL</title>
|
36
|
+
<link rel="icon" type="image/x-icon" href="${i}" />
|
37
|
+
<style>
|
38
|
+
body {
|
39
|
+
height: 100%;
|
40
|
+
margin: 0;
|
41
|
+
width: 100%;
|
42
|
+
overflow: hidden;
|
43
|
+
background-color: hsl(219, 29%, 18%);
|
44
|
+
}
|
45
|
+
|
46
|
+
#graphiql {
|
47
|
+
height: 100vh;
|
48
|
+
}
|
49
|
+
|
50
|
+
#graphiql > .placeholder {
|
51
|
+
color: slategray;
|
52
|
+
width: fit-content;
|
53
|
+
margin: 40px auto;
|
54
|
+
font-family: Arial;
|
55
|
+
}
|
56
|
+
|
57
|
+
.graphiql-api-toolbar-label {
|
58
|
+
position: absolute;
|
59
|
+
bottom: -6px;
|
60
|
+
right: -4px;
|
61
|
+
font-size: 8px;
|
62
|
+
}
|
63
|
+
</style>
|
64
|
+
|
65
|
+
<script
|
66
|
+
crossorigin
|
67
|
+
src="https://unpkg.com/react@18/umd/react.development.js"
|
68
|
+
></script>
|
69
|
+
<script
|
70
|
+
crossorigin
|
71
|
+
src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"
|
72
|
+
></script>
|
73
|
+
<link
|
74
|
+
rel="stylesheet"
|
75
|
+
href="https://unpkg.com/graphiql@3/graphiql.min.css"
|
76
|
+
/>
|
77
|
+
<link
|
78
|
+
rel="stylesheet"
|
79
|
+
href="https://unpkg.com/@graphiql/plugin-explorer/dist/style.css"
|
80
|
+
/>
|
81
|
+
</head>
|
82
|
+
|
83
|
+
<body>
|
84
|
+
<div id="graphiql">
|
85
|
+
<div class="placeholder">Loading GraphiQL...</div>
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<script
|
89
|
+
src="https://unpkg.com/graphiql@3/graphiql.min.js"
|
90
|
+
type="application/javascript"
|
91
|
+
crossorigin="anonymous"
|
92
|
+
></script>
|
93
|
+
<script
|
94
|
+
src="https://unpkg.com/@graphiql/plugin-explorer/dist/index.umd.js"
|
95
|
+
type="application/javascript"
|
96
|
+
crossorigin="anonymous"
|
97
|
+
></script>
|
98
|
+
|
99
|
+
<script>
|
100
|
+
const windowUrl = new URL(document.URL);
|
101
|
+
const startingSchemaKey =
|
102
|
+
windowUrl.searchParams.get('schema') || 'storefront';
|
103
|
+
|
104
|
+
let query = '{ shop { name } }';
|
105
|
+
if (windowUrl.searchParams.has('query')) {
|
106
|
+
query = decodeURIComponent(
|
107
|
+
windowUrl.searchParams.get('query') ?? query,
|
108
|
+
);
|
109
|
+
}
|
110
|
+
|
111
|
+
// Prettify query
|
112
|
+
query = GraphiQL.GraphQL.print(GraphiQL.GraphQL.parse(query));
|
113
|
+
|
114
|
+
let variables;
|
115
|
+
if (windowUrl.searchParams.has('variables')) {
|
116
|
+
variables = decodeURIComponent(
|
117
|
+
windowUrl.searchParams.get('variables') ?? '',
|
118
|
+
);
|
119
|
+
}
|
120
|
+
|
121
|
+
// Prettify variables
|
122
|
+
if (variables) {
|
123
|
+
variables = JSON.stringify(JSON.parse(variables), null, 2);
|
124
|
+
}
|
125
|
+
|
126
|
+
const schemas = ${JSON.stringify(s)};
|
127
|
+
let lastActiveTabIndex = -1;
|
128
|
+
let lastTabAmount = -1;
|
129
|
+
|
130
|
+
const root = ReactDOM.createRoot(
|
131
|
+
document.getElementById('graphiql'),
|
132
|
+
);
|
133
|
+
|
134
|
+
root.render(React.createElement(RootWrapper));
|
135
|
+
|
136
|
+
const TAB_STATE_KEY = 'graphiql:tabState';
|
137
|
+
const storage = {
|
138
|
+
getTabState: () =>
|
139
|
+
JSON.parse(localStorage.getItem(TAB_STATE_KEY)),
|
140
|
+
setTabState: (state) =>
|
141
|
+
localStorage.setItem(TAB_STATE_KEY, JSON.stringify(state)),
|
142
|
+
};
|
143
|
+
|
144
|
+
let nextSchemaKey;
|
145
|
+
|
146
|
+
function RootWrapper() {
|
147
|
+
const [activeSchema, setActiveSchema] =
|
148
|
+
React.useState(startingSchemaKey);
|
149
|
+
|
150
|
+
const schema = schemas[activeSchema];
|
151
|
+
if (!schema) {
|
152
|
+
throw new Error('No schema found for ' + activeSchema);
|
153
|
+
}
|
154
|
+
|
155
|
+
const keys = Object.keys(schemas);
|
156
|
+
|
157
|
+
return React.createElement(
|
158
|
+
GraphiQL,
|
159
|
+
{
|
160
|
+
fetcher: GraphiQL.createFetcher({
|
161
|
+
url: schema.apiUrl,
|
162
|
+
headers: {[schema.authHeader]: schema.accessToken},
|
163
|
+
}),
|
164
|
+
defaultEditorToolsVisibility: true,
|
165
|
+
query,
|
166
|
+
variables,
|
167
|
+
schema: schema.value,
|
168
|
+
plugins: [GraphiQLPluginExplorer.explorerPlugin()],
|
169
|
+
onTabChange: (state) => {
|
170
|
+
const {activeTabIndex, tabs} = state;
|
171
|
+
const activeTab = tabs[activeTabIndex];
|
172
|
+
|
173
|
+
if (
|
174
|
+
activeTabIndex === lastActiveTabIndex &&
|
175
|
+
lastTabAmount === tabs.length
|
176
|
+
) {
|
177
|
+
if (
|
178
|
+
nextSchemaKey &&
|
179
|
+
activeTab &&
|
180
|
+
activeTab.schemaKey !== nextSchemaKey
|
181
|
+
) {
|
182
|
+
activeTab.schemaKey = nextSchemaKey;
|
183
|
+
nextSchemaKey = undefined;
|
184
|
+
|
185
|
+
// Sync state to localStorage. GraphiQL resets the state
|
186
|
+
// asynchronously, so we need to do it in a timeout.
|
187
|
+
storage.setTabState(state);
|
188
|
+
setTimeout(() => storage.setTabState(state), 500);
|
189
|
+
}
|
190
|
+
|
191
|
+
// React rerrendering, skip
|
192
|
+
return;
|
193
|
+
}
|
194
|
+
|
195
|
+
if (activeTab) {
|
196
|
+
if (!activeTab.schemaKey) {
|
197
|
+
// Creating a new tab
|
198
|
+
if (lastTabAmount < tabs.length) {
|
199
|
+
activeTab.schemaKey = activeSchema;
|
200
|
+
storage.setTabState(state);
|
201
|
+
}
|
202
|
+
}
|
203
|
+
|
204
|
+
const nextSchema = activeTab.schemaKey || 'storefront';
|
205
|
+
|
206
|
+
if (nextSchema !== activeSchema) {
|
207
|
+
setActiveSchema(nextSchema);
|
208
|
+
}
|
209
|
+
}
|
210
|
+
|
211
|
+
lastActiveTabIndex = activeTabIndex;
|
212
|
+
lastTabAmount = tabs.length;
|
213
|
+
},
|
214
|
+
toolbar: {
|
215
|
+
additionalComponent: function () {
|
216
|
+
const schema = schemas[activeSchema];
|
217
|
+
|
218
|
+
return React.createElement(
|
219
|
+
GraphiQL.React.ToolbarButton,
|
220
|
+
{
|
221
|
+
onClick: () => {
|
222
|
+
const activeKeyIndex = keys.indexOf(activeSchema);
|
223
|
+
nextSchemaKey =
|
224
|
+
keys[(activeKeyIndex + 1) % keys.length];
|
225
|
+
|
226
|
+
// This triggers onTabChange
|
227
|
+
if (nextSchemaKey) setActiveSchema(nextSchemaKey);
|
228
|
+
},
|
229
|
+
label: 'Toggle between different API schemas',
|
230
|
+
},
|
231
|
+
React.createElement(
|
232
|
+
'div',
|
233
|
+
{
|
234
|
+
key: 'api-wrapper',
|
235
|
+
className: 'graphiql-toolbar-icon',
|
236
|
+
style: {position: 'relative', fontWeight: 'bolder'},
|
237
|
+
},
|
238
|
+
[
|
239
|
+
React.createElement(
|
240
|
+
'div',
|
241
|
+
{key: 'icon', style: {textAlign: 'center'}},
|
242
|
+
[
|
243
|
+
schema.icon,
|
244
|
+
React.createElement(
|
245
|
+
'div',
|
246
|
+
{
|
247
|
+
key: 'icon-label',
|
248
|
+
className: 'graphiql-api-toolbar-label',
|
249
|
+
},
|
250
|
+
'API',
|
251
|
+
),
|
252
|
+
],
|
253
|
+
),
|
254
|
+
],
|
255
|
+
),
|
256
|
+
);
|
257
|
+
},
|
258
|
+
},
|
259
|
+
},
|
260
|
+
[
|
261
|
+
React.createElement(
|
262
|
+
GraphiQL.Logo,
|
263
|
+
{
|
264
|
+
key: 'Logo replacement',
|
265
|
+
},
|
266
|
+
[
|
267
|
+
React.createElement(
|
268
|
+
'div',
|
269
|
+
{
|
270
|
+
key: 'Logo wrapper',
|
271
|
+
style: {display: 'flex', alignItems: 'center'},
|
272
|
+
},
|
273
|
+
[
|
274
|
+
React.createElement(
|
275
|
+
'div',
|
276
|
+
{
|
277
|
+
key: 'api',
|
278
|
+
className: 'graphiql-logo',
|
279
|
+
style: {
|
280
|
+
paddingRight: 0,
|
281
|
+
whiteSpace: 'nowrap',
|
282
|
+
},
|
283
|
+
},
|
284
|
+
[schema.name],
|
285
|
+
),
|
286
|
+
React.createElement(GraphiQL.Logo, {key: 'logo'}),
|
287
|
+
],
|
288
|
+
),
|
289
|
+
],
|
290
|
+
),
|
291
|
+
],
|
292
|
+
);
|
293
|
+
}
|
294
|
+
</script>
|
295
|
+
</body>
|
296
|
+
</html>
|
297
|
+
`,{status:200,headers:{"content-type":"text/html"}})};var lr={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},fr=/[&><\u2028\u2029]/g;function ht(e){return e.replace(fr,t=>lr[t])}var M="Error in SEO input: ",me={title:{validate:e=>{if(typeof e!="string")throw new Error(M.concat("`title` should be a string"));if(typeof e=="string"&&e.length>120)throw new Error(M.concat("`title` should not be longer than 120 characters"));return e}},description:{validate:e=>{if(typeof e!="string")throw new Error(M.concat("`description` should be a string"));if(typeof e=="string"&&e.length>155)throw new Error(M.concat("`description` should not be longer than 155 characters"));return e}},url:{validate:e=>{if(typeof e!="string")throw new Error(M.concat("`url` should be a string"));if(typeof e=="string"&&!e.startsWith("http"))throw new Error(M.concat("`url` should be a valid URL"));return e}},handle:{validate:e=>{if(typeof e!="string")throw new Error(M.concat("`handle` should be a string"));if(typeof e=="string"&&!e.startsWith("@"))throw new Error(M.concat("`handle` should start with `@`"));return e}}};function Ct(e){let t=[];for(let r of Object.keys(e))switch(r){case"title":{let n=ge(me.title,e.title),o=mr(e?.titleTemplate,n);if(!o)break;t.push(O("title",{title:o}),O("meta",{property:"og:title",content:o}),O("meta",{name:"twitter:title",content:o}));break}case"description":{let n=ge(me.description,e.description);if(!n)break;t.push(O("meta",{name:"description",content:n}),O("meta",{property:"og:description",content:n}),O("meta",{name:"twitter:description",content:n}));break}case"url":{let n=ge(me.url,e.url);if(!n)break;let a=n.split("?")[0].replace(/\/$/,"");t.push(O("link",{rel:"canonical",href:a}),O("meta",{property:"og:url",content:a}));break}case"handle":{let n=ge(me.handle,e.handle);if(!n)break;t.push(O("meta",{name:"twitter:site",content:n}),O("meta",{name:"twitter:creator",content:n}));break}case"media":{let n,o=He(e.media);for(let a of o)if(typeof a=="string"&&t.push(O("meta",{name:"og:image",content:a})),a&&typeof a=="object"){let s=a.type||"image",i=a?{url:a?.url,secure_url:a?.url,type:gr(a.url),width:a?.width,height:a?.height,alt:a?.altText}:{};for(let c of Object.keys(i))i[c]&&(n=i[c],t.push(O("meta",{property:`og:${s}:${c}`,content:n},i.url)));}break}case"jsonLd":{let n=He(e.jsonLd),o=0;for(let a of n){if(typeof a!="object")continue;let s=O("script",{type:"application/ld+json",children:JSON.stringify(a,(i,c)=>typeof c=="string"?ht(c):c)},`json-ld-${a?.["@type"]||a?.name||o++}`);t.push(s);}break}case"alternates":{let n=He(e.alternates);for(let o of n){if(!o)continue;let{language:a,url:s,default:i}=o,c=a?`${a}${i?"-default":""}`:void 0;t.push(O("link",{rel:"alternate",hrefLang:c,href:s}));}break}case"robots":{if(!e.robots)break;let{maxImagePreview:n,maxSnippet:o,maxVideoPreview:a,noArchive:s,noFollow:i,noImageIndex:c,noIndex:u,noSnippet:l,noTranslate:p,unavailableAfter:f}=e.robots,y=[s&&"noarchive",c&&"noimageindex",l&&"nosnippet",p&&"notranslate",n&&`max-image-preview:${n}`,o&&`max-snippet:${o}`,a&&`max-video-preview:${a}`,f&&`unavailable_after:${f}`],m=(u?"noindex":"index")+","+(i?"nofollow":"follow");for(let C of y)C&&(m+=`,${C}`);t.push(O("meta",{name:"robots",content:m}));break}}return t.flat().sort((r,n)=>r.key.localeCompare(n.key))}function O(e,t,r){let n={tag:e,props:{},key:""};return e==="title"?(n.children=t.title,n.key=qe(n),n):e==="script"?(n.children=typeof t.children=="string"?t.children:"",n.key=qe(n,r),delete t.children,n.props=t,n):(n.props=t,Object.keys(n.props).forEach(o=>!n.props[o]&&delete n.props[o]),n.key=qe(n,r),n)}function qe(e,t){let{tag:r,props:n}=e;if(r==="title")return "0-title";if(r==="meta"){let o=n.content===t&&typeof n.property=="string"&&!n.property.endsWith("secure_url")&&"0";return [r,...[t,o],n.property||n.name].filter(s=>s).join("-")}return r==="link"?[r,n.rel,n.hrefLang||n.media].filter(a=>a).join("-").replace(/\s+/g,"-"):r==="script"?`${r}-${t}`:`${r}-${n.type}`}function mr(e,t){if(t)return e?typeof e=="function"?e(t):e.replace("%s",t??""):t}function gr(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 He(e){return Array.isArray(e)?e:[e]}function ge(e,t){try{return e.validate(t)}catch(r){return console.warn(r.message),t}}var xr=react.lazy(()=>Promise.resolve().then(()=>(Rt(),Tt)));function Er({debug:e}){let t=react$1.useMatches(),r=react$1.useLocation(),n=react.useMemo(()=>t.flatMap(s=>{let{handle:i,...c}=s,u={...c,...r},l=i?.seo,p=c?.data?.seo;return !l&&!p?[]:l?ye(l,u):[p]}).reduce((s,i)=>{Object.keys(i).forEach(u=>!i[u]&&delete i[u]);let{jsonLd:c}=i;return c?s?.jsonLd?Array.isArray(c)?{...s,...i,jsonLd:[...s.jsonLd,...c]}:{...s,...i,jsonLd:[...s.jsonLd,c]}:{...s,...i,jsonLd:[c]}:{...s,...i}},{}),[t,r]),{html:o,loggerMarkup:a}=react.useMemo(()=>{let s=Ct(n),i=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)),c=react.createElement(react.Suspense,{fallback:null},react.createElement(xr,{headTags:s}));return {html:i,loggerMarkup:c}},[n]);return react.createElement(react.Fragment,null,o,e&&a)}function ye(e,...t){if(e instanceof Function)return ye(e(...t),...t);let r={};return Array.isArray(e)?(r=e.reduce((n,o)=>[...n,ye(o)],[]),r):e instanceof Object?(Object.entries(e).forEach(([o,a])=>{r[o]=ye(a,...t);}),r):e}function Dr({connection:e,children:t=()=>(console.warn("<Pagination> requires children to work properly"),null)}){let n=react$1.useNavigation().state==="loading",{endCursor:o,hasNextPage:a,hasPreviousPage:s,nextPageUrl:i,nodes:c,previousPageUrl:u,startCursor:l}=Ur(e),p=react.useMemo(()=>({pageInfo:{endCursor:o,hasPreviousPage:s,hasNextPage:a,startCursor:l},nodes:c}),[o,a,s,l,c]),f=react.useMemo(()=>react.forwardRef(function(C,S){return a?react.createElement(react$1.Link,{preventScrollReset:!0,...C,to:i,state:p,replace:!0,ref:S}):null}),[a,i,p]),y=react.useMemo(()=>react.forwardRef(function(C,S){return s?react.createElement(react$1.Link,{preventScrollReset:!0,...C,to:u,state:p,replace:!0,ref:S}):null}),[s,u,p]);return t({state:p,hasNextPage:a,hasPreviousPage:s,isLoading:n,nextPageUrl:i,nodes:c,previousPageUrl:u,NextLink:f,PreviousLink:y})}function he(e){let t=new URLSearchParams(e);return t.delete("cursor"),t.delete("direction"),t.toString()}function ne(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 Ur(e){e.pageInfo||ne("pageInfo"),typeof e.pageInfo.startCursor>"u"&&ne("pageInfo.startCursor"),typeof e.pageInfo.endCursor>"u"&&ne("pageInfo.endCursor"),typeof e.pageInfo.hasNextPage>"u"&&ne("pageInfo.hasNextPage"),typeof e.pageInfo.hasPreviousPage>"u"&&ne("pageInfo.hasPreviousPage");let t=react$1.useNavigate(),{state:r,search:n,pathname:o}=react$1.useLocation(),i=new URLSearchParams(n).get("direction")==="previous",c=react.useMemo(()=>!globalThis?.window?.__hydrogenHydrated||!r||!r?.nodes?hydrogenReact.flattenConnection(e):i?[...hydrogenReact.flattenConnection(e),...r.nodes]:[...r.nodes,...hydrogenReact.flattenConnection(e)],[r,e]),u=react.useMemo(()=>{let y=globalThis?.window?.__hydrogenHydrated,m=!y||r?.pageInfo?.startCursor===void 0?e.pageInfo.startCursor:r.pageInfo.startCursor,C=!y||r?.pageInfo?.endCursor===void 0?e.pageInfo.endCursor:r.pageInfo.endCursor,S=!y||r?.pageInfo?.hasPreviousPage===void 0?e.pageInfo.hasPreviousPage:r.pageInfo.hasPreviousPage,g=!y||r?.pageInfo?.hasNextPage===void 0?e.pageInfo.hasNextPage:r.pageInfo.hasNextPage;return r?.nodes&&(i?(m=e.pageInfo.startCursor,S=e.pageInfo.hasPreviousPage):(C=e.pageInfo.endCursor,g=e.pageInfo.hasNextPage)),{startCursor:m,endCursor:C,hasPreviousPage:S,hasNextPage:g}},[i,r,e.pageInfo.hasNextPage,e.pageInfo.hasPreviousPage,e.pageInfo.startCursor,e.pageInfo.endCursor]),l=react.useRef({params:he(n),pathname:o});react.useEffect(()=>{window.__hydrogenHydrated=!0;},[]),react.useEffect(()=>{(he(n)!==l.current.params||o!==l.current.pathname)&&(l.current={pathname:o,params:he(n)},t(`${o}?${he(n)}`,{replace:!0,preventScrollReset:!0,state:{nodes:void 0,pageInfo:void 0}}));},[o,n]);let p=react.useMemo(()=>{let y=new URLSearchParams(n);return y.set("direction","previous"),u.startCursor&&y.set("cursor",u.startCursor),`?${y.toString()}`},[n,u.startCursor]),f=react.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:p,nextPageUrl:f,nodes:c}}function Lr(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),o=n.get("cursor")??void 0;return (n.get("direction")==="previous"?"previous":"next")==="previous"?{last:r,startCursor:o??null}:{first:r,endCursor:o??null}}var Ce="2024-01",W=`Shopify Hydrogen ${ee}`,Pt="30243aa5-17c1-465a-8493-944bcc4e88aa",P="customerAccount";var U=class extends Response{constructor(t,r,n){super(`Bad request: ${t}`,{status:400,headers:n});}};function ae(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 vr({session:e,customerAccountId:t,customerAccountUrl:r,origin:n,debugInfo:o}){let a=new URLSearchParams,i=e.get(P)?.refreshToken;if(!i)throw new U("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",i),a.append("client_id",t);let c={"content-type":"application/x-www-form-urlencoded","User-Agent":W,Origin:n};new Date().getTime();let l=`${r}/auth/oauth/token`,p=await fetch(l,{method:"POST",headers:c,body:a});if(!p.ok){let g=await p.text();throw new Response(g,{status:p.status,headers:{"Content-Type":"text/html; charset=utf-8"}})}let{access_token:f,expires_in:y,id_token:m,refresh_token:C}=await p.json(),S=await Ve(f,t,r,n);e.set(P,{accessToken:S,expiresAt:new Date(new Date().getTime()+(y-120)*1e3).getTime()+"",refreshToken:C,idToken:m});}function K(e){e.unset(P);}async function wt({locks:e,expiresAt:t,session:r,customerAccountId:n,customerAccountUrl:o,origin:a,debugInfo:s}){if(parseInt(t,10)-1e3<new Date().getTime())try{e.refresh||(e.refresh=vr({session:r,customerAccountId:n,customerAccountUrl:o,origin:a,debugInfo:s})),await e.refresh,delete e.refresh;}catch(i){throw K(r),i&&i.status!==401?i:new U("Unauthorized","Login before querying the Customer Account API.",{"Set-Cookie":await r.commit()})}}async function Dt(){let e=kr();return Lt(e)}async function Ut(e){let t=await crypto.subtle.digest({name:"SHA-256"},new TextEncoder().encode(e)),r=Nr(t);return Lt(r)}function kr(){let e=new Uint8Array(32);return crypto.getRandomValues(e),String.fromCharCode.apply(null,Array.from(e))}function Lt(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Nr(e){let t=new Uint8Array(e),r=Array.from(t);return String.fromCharCode(...r)}async function vt(){let e=Date.now().toString(),t=Math.random().toString(36).substring(2);return e+t}async function Ve(e,t,r,n,o){let a=t;if(!e)throw new U("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",Pt),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 i={"content-type":"application/x-www-form-urlencoded","User-Agent":W,Origin:n};new Date().getTime();let u=`${r}/auth/oauth/token`,l=await fetch(u,{method:"POST",headers:i,body:s});let p=await l.json();if(p.error)throw new U(p.error_description);return p.access_token}function kt(e){return _r(e).payload.nonce}function _r(e){let[t,r,n]=e.split("."),o=JSON.parse(atob(t)),a=JSON.parse(atob(r));return {header:o,payload:a,signature:n}}function Se(){return Fr(Mr())}function Mr(){try{return crypto.getRandomValues(new Uint8Array(16))}catch{return new Uint8Array(16).map(()=>Math.random()*255|0)}}function Fr(e){return Array.from(e,function(t){return ("0"+(t&255).toString(16)).slice(-2)}).join("")}var Nt="/account/login",$r="/account/authorize",_t="/account";function qr(e){if(!e.url)return Nt;let{pathname:t}=new URL(e.url),r=Nt+`?${new URLSearchParams({return_to:t}).toString()}`;return ae(r)}function Hr({session:e,customerAccountId:t,customerAccountUrl:r,customerApiVersion:n=Ce,request:o,waitUntil:a,authUrl:s=$r,customAuthStatusHandler:i,logErrors:c=!0}){if(n!==Ce&&console.warn(`[h2:warn:createCustomerAccountClient] You are using Customer Account API version ${n} when this version of Hydrogen was built for ${Ce}.`),(!t||!r)&&console.warn("[h2:warn:createCustomerAccountClient] `customerAccountId` and `customerAccountUrl` need to be provided to use Customer Account API. Mock.shop doesn't automatically supply these variables.\nUse `npx shopify hydrogen env pull` to link your store credentials."),!o?.url)throw new Error("[h2:error:createCustomerAccountClient] The request object does not contain a URL.");let u=i||(()=>qr(o)),l=new URL(o.url),p=l.protocol==="http:"?l.origin.replace("http","https"):l.origin,f=s.startsWith("/")?p+s:s,y=`${r}/account/customer/api/${n}/graphql`,m={};async function C({query:d,type:I,variables:T={}}){let x=await b();if(!x)throw u();new Date().getTime();let L=await fetch(y,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":W,Origin:p,Authorization:x},body:JSON.stringify({query:d,variables:T})});let D=await L.text(),v={url:y,response:L,type:I,query:d,queryVariables:T,errors:void 0,client:"customer"};if(!L.ok){if(L.status===401){K(e);let w=u();throw w instanceof Response&&w.headers.set("Set-Cookie",await e.commit()),w}let E;try{E=$(D);}catch{E=[{message:D}];}te({...v,errors:E});}try{let E=$(D),{errors:w}=E,z=w?.map(({message:_,...F})=>new q(_,{...F,clientOperation:`customerAccount.${v.type}`,requestId:L.headers.get("x-request-id"),queryVariables:T,query:d}));return {...E,...w&&{errors:z}}}catch{te({...v,errors:[{message:D}]});}}async function S(){let d=e.get(P),I=d?.accessToken,T=d?.expiresAt;if(!I||!T)return !1;let x=k?.();try{await wt({locks:m,expiresAt:T,session:e,customerAccountId:t,customerAccountUrl:r,origin:p,debugInfo:{waitUntil:a,stackInfo:x,...H(o)}});}catch{return !1}return !0}async function g(){if(!await S())throw u()}async function b(){if(await S())return e.get(P)?.accessToken}return {login:async()=>{let d=new URL(r+"/auth/oauth/authorize"),I=await vt(),T=await Se();d.searchParams.set("client_id",t),d.searchParams.set("scope","openid email"),d.searchParams.append("response_type","code"),d.searchParams.append("redirect_uri",f),d.searchParams.set("scope","openid email https://api.customers.com/auth/customer.graphql"),d.searchParams.append("state",I),d.searchParams.append("nonce",T);let x=await Dt(),N=await Ut(x);return e.set(P,{...e.get(P),codeVerifier:x,state:I,nonce:T,redirectPath:fe(o.url)||le(o,"Referer")||_t}),d.searchParams.append("code_challenge",N),d.searchParams.append("code_challenge_method","S256"),ae(d.toString(),{headers:{"Set-Cookie":await e.commit()}})},logout:async()=>{let d=e.get(P)?.idToken;return K(e),ae(`${r}/auth/logout?id_token_hint=${d}`,{status:302,headers:{"Set-Cookie":await e.commit()}})},isLoggedIn:S,handleAuthStatus:g,getAccessToken:b,getApiUrl:()=>y,mutate(d,I){return d=B(d),de(d,"customer.mutate"),j(C({query:d,type:"mutation",...I}),{logErrors:c})},query(d,I){return d=B(d),pe(d,"customer.query"),j(C({query:d,type:"query",...I}),{logErrors:c})},authorize:async()=>{let d=l.searchParams.get("code"),I=l.searchParams.get("state");if(!d||!I)throw K(e),new U("Unauthorized","No code or state parameter found in the redirect URL.",{"Set-Cookie":await e.commit()});if(e.get(P)?.state!==I)throw K(e),new U("Unauthorized","The session state does not match the state parameter. Make sure that the session is configured correctly and passed to `createCustomerAccountClient`.",{"Set-Cookie":await e.commit()});let T=t,x=new URLSearchParams;x.append("grant_type","authorization_code"),x.append("client_id",T),x.append("redirect_uri",f),x.append("code",d);let N=e.get(P)?.codeVerifier;if(!N)throw new U("Unauthorized","No code verifier found in the session. Make sure that the session is configured correctly and passed to `createCustomerAccountClient`.");x.append("code_verifier",N);let J={"content-type":"application/x-www-form-urlencoded","User-Agent":W,Origin:p},L=k?.();new Date().getTime();let v=`${r}/auth/oauth/token`,E=await fetch(v,{method:"POST",headers:J,body:x});if(!E.ok)throw new Response(await E.text(),{status:E.status,headers:{"Content-Type":"text/html; charset=utf-8"}});let{access_token:w,expires_in:z,id_token:_,refresh_token:F}=await E.json(),Y=e.get(P)?.nonce,se=await kt(_);if(Y!==se)throw new U("Unauthorized",`Returned nonce does not match: ${Y} !== ${se}`);let Te=await Ve(w,t,r,p,{waitUntil:a,stackInfo:L,...H(o)}),Re=e.get(P)?.redirectPath;return e.set(P,{accessToken:Te,expiresAt:new Date(new Date().getTime()+(z-120)*1e3).getTime()+"",refreshToken:F,idToken:_,redirectPath:void 0}),ae(Re||_t,{headers:{"Set-Cookie":await e.commit()}})}}}var Qr="https://raw.githubusercontent.com/Shopify/hydrogen/main/docs/changelog.json";async function Gr({request:e,changelogUrl:t}){new URL(e.url).searchParams;return fetch(t||Qr)}var Mt="cartFormInput";function Ie({children:e,action:t,inputs:r,route:n,fetcherKey:o}){let a=react$1.useFetcher({key:o});return jsxRuntime.jsxs(a.Form,{action:n||"",method:"post",children:[(t||r)&&jsxRuntime.jsx("input",{type:"hidden",name:Mt,value:JSON.stringify({action:t,inputs:r})}),typeof e=="function"?e(a):e]})}Ie.INPUT_NAME=Mt;Ie.ACTIONS={AttributesUpdateInput:"AttributesUpdateInput",BuyerIdentityUpdate:"BuyerIdentityUpdate",Create:"Create",DiscountCodesUpdate:"DiscountCodesUpdate",LinesAdd:"LinesAdd",LinesRemove:"LinesRemove",LinesUpdate:"LinesUpdate",NoteUpdate:"NoteUpdate",SelectedDeliveryOptionsUpdate:"SelectedDeliveryOptionsUpdate",MetafieldsSet:"MetafieldsSet",MetafieldDelete:"MetafieldDelete"};function Br(e){let t={};for(let s of e.entries()){let i=s[0],c=e.getAll(i);t[i]=c.length>1?c:s[1];}let{cartFormInput:r,...n}=t,{action:o,inputs:a}=r?JSON.parse(String(r)):{};return {action:o,inputs:{...a,...n}}}Ie.getFormInput=Br;var R=`#graphql
|
298
|
+
fragment CartApiError on CartUserError {
|
299
|
+
message
|
300
|
+
field
|
301
|
+
code
|
302
|
+
}
|
303
|
+
`,A=`#graphql
|
304
|
+
fragment CartApiMutation on Cart {
|
305
|
+
id
|
306
|
+
totalQuantity
|
307
|
+
}
|
308
|
+
`;function Be(e){return async(t,r)=>{let{cartId:n,...o}=r||{},{cartCreate:a,errors:s}=await e.storefront.mutate(Kr(e.cartFragment),{variables:{input:t,...o}});return h(a,s)}}var Kr=(e=A)=>`#graphql
|
309
|
+
mutation cartCreate(
|
310
|
+
$input: CartInput!
|
311
|
+
$country: CountryCode = ZZ
|
312
|
+
$language: LanguageCode
|
313
|
+
) @inContext(country: $country, language: $language) {
|
314
|
+
cartCreate(input: $input) {
|
315
|
+
cart {
|
316
|
+
...CartApiMutation
|
317
|
+
checkoutUrl
|
318
|
+
}
|
319
|
+
userErrors {
|
320
|
+
...CartApiError
|
321
|
+
}
|
322
|
+
}
|
323
|
+
}
|
324
|
+
${e}
|
325
|
+
${R}
|
326
|
+
`;function je({storefront:e,customerAccount:t,getCartId:r,cartFragment:n}){return async o=>{let a=r();if(!a)return null;let[s,{cart:i,errors:c}]=await Promise.all([t?t.isLoggedIn():!1,e.query(zr(n),{variables:{cartId:a,...o},cache:e.CacheNone()})]);return h(Jr(s,i),c)}}function Jr(e,t){if(e&&t&&t.checkoutUrl){let r=new URL(t.checkoutUrl);r.searchParams.set("logged_in","true"),t.checkoutUrl=r.toString();}return t}var zr=(e=Yr)=>`#graphql
|
327
|
+
query CartQuery(
|
328
|
+
$cartId: ID!
|
329
|
+
$numCartLines: Int = 100
|
330
|
+
$country: CountryCode = ZZ
|
331
|
+
$language: LanguageCode
|
332
|
+
) @inContext(country: $country, language: $language) {
|
333
|
+
cart(id: $cartId) {
|
334
|
+
...CartApiQuery
|
335
|
+
}
|
336
|
+
}
|
337
|
+
|
338
|
+
${e}
|
339
|
+
`,Yr=`#graphql
|
340
|
+
fragment CartApiQuery on Cart {
|
341
|
+
id
|
342
|
+
checkoutUrl
|
343
|
+
totalQuantity
|
344
|
+
buyerIdentity {
|
345
|
+
countryCode
|
346
|
+
customer {
|
347
|
+
id
|
348
|
+
email
|
349
|
+
firstName
|
350
|
+
lastName
|
351
|
+
displayName
|
352
|
+
}
|
353
|
+
email
|
354
|
+
phone
|
355
|
+
}
|
356
|
+
lines(first: $numCartLines) {
|
357
|
+
edges {
|
358
|
+
node {
|
359
|
+
id
|
360
|
+
quantity
|
361
|
+
attributes {
|
362
|
+
key
|
363
|
+
value
|
364
|
+
}
|
365
|
+
cost {
|
366
|
+
totalAmount {
|
367
|
+
amount
|
368
|
+
currencyCode
|
369
|
+
}
|
370
|
+
amountPerQuantity {
|
371
|
+
amount
|
372
|
+
currencyCode
|
373
|
+
}
|
374
|
+
compareAtAmountPerQuantity {
|
375
|
+
amount
|
376
|
+
currencyCode
|
377
|
+
}
|
378
|
+
}
|
379
|
+
merchandise {
|
380
|
+
... on ProductVariant {
|
381
|
+
id
|
382
|
+
availableForSale
|
383
|
+
compareAtPrice {
|
384
|
+
...CartApiMoney
|
385
|
+
}
|
386
|
+
price {
|
387
|
+
...CartApiMoney
|
388
|
+
}
|
389
|
+
requiresShipping
|
390
|
+
title
|
391
|
+
image {
|
392
|
+
...CartApiImage
|
393
|
+
}
|
394
|
+
product {
|
395
|
+
handle
|
396
|
+
title
|
397
|
+
id
|
398
|
+
}
|
399
|
+
selectedOptions {
|
400
|
+
name
|
401
|
+
value
|
402
|
+
}
|
403
|
+
}
|
404
|
+
}
|
405
|
+
}
|
406
|
+
}
|
407
|
+
}
|
408
|
+
cost {
|
409
|
+
subtotalAmount {
|
410
|
+
...CartApiMoney
|
411
|
+
}
|
412
|
+
totalAmount {
|
413
|
+
...CartApiMoney
|
414
|
+
}
|
415
|
+
totalDutyAmount {
|
416
|
+
...CartApiMoney
|
417
|
+
}
|
418
|
+
totalTaxAmount {
|
419
|
+
...CartApiMoney
|
420
|
+
}
|
421
|
+
}
|
422
|
+
note
|
423
|
+
attributes {
|
424
|
+
key
|
425
|
+
value
|
426
|
+
}
|
427
|
+
discountCodes {
|
428
|
+
applicable
|
429
|
+
code
|
430
|
+
}
|
431
|
+
}
|
432
|
+
|
433
|
+
fragment CartApiMoney on MoneyV2 {
|
434
|
+
currencyCode
|
435
|
+
amount
|
436
|
+
}
|
437
|
+
|
438
|
+
fragment CartApiImage on Image {
|
439
|
+
id
|
440
|
+
url
|
441
|
+
altText
|
442
|
+
width
|
443
|
+
height
|
444
|
+
}
|
445
|
+
`;function We(e){return async(t,r)=>{let{cartLinesAdd:n,errors:o}=await e.storefront.mutate(Xr(e.cartFragment),{variables:{cartId:e.getCartId(),lines:t,...r}});return h(n,o)}}var Xr=(e=A)=>`#graphql
|
446
|
+
mutation cartLinesAdd(
|
447
|
+
$cartId: ID!
|
448
|
+
$lines: [CartLineInput!]!
|
449
|
+
$country: CountryCode = ZZ
|
450
|
+
$language: LanguageCode
|
451
|
+
) @inContext(country: $country, language: $language) {
|
452
|
+
cartLinesAdd(cartId: $cartId, lines: $lines) {
|
453
|
+
cart {
|
454
|
+
...CartApiMutation
|
455
|
+
}
|
456
|
+
userErrors {
|
457
|
+
...CartApiError
|
458
|
+
}
|
459
|
+
}
|
460
|
+
}
|
461
|
+
|
462
|
+
${e}
|
463
|
+
${R}
|
464
|
+
`;function Ke(e){return async(t,r)=>{let{cartLinesUpdate:n,errors:o}=await e.storefront.mutate(Zr(e.cartFragment),{variables:{cartId:e.getCartId(),lines:t,...r}});return h(n,o)}}var Zr=(e=A)=>`#graphql
|
465
|
+
mutation cartLinesUpdate(
|
466
|
+
$cartId: ID!
|
467
|
+
$lines: [CartLineUpdateInput!]!
|
468
|
+
$language: LanguageCode
|
469
|
+
$country: CountryCode
|
470
|
+
) @inContext(country: $country, language: $language) {
|
471
|
+
cartLinesUpdate(cartId: $cartId, lines: $lines) {
|
472
|
+
cart {
|
473
|
+
...CartApiMutation
|
474
|
+
}
|
475
|
+
userErrors {
|
476
|
+
...CartApiError
|
477
|
+
}
|
478
|
+
}
|
479
|
+
}
|
480
|
+
|
481
|
+
${e}
|
482
|
+
${R}
|
483
|
+
`;function Je(e){return async(t,r)=>{let{cartLinesRemove:n,errors:o}=await e.storefront.mutate(en(e.cartFragment),{variables:{cartId:e.getCartId(),lineIds:t,...r}});return h(n,o)}}var en=(e=A)=>`#graphql
|
484
|
+
mutation cartLinesRemove(
|
485
|
+
$cartId: ID!
|
486
|
+
$lineIds: [ID!]!
|
487
|
+
$language: LanguageCode
|
488
|
+
$country: CountryCode
|
489
|
+
) @inContext(country: $country, language: $language) {
|
490
|
+
cartLinesRemove(cartId: $cartId, lineIds: $lineIds) {
|
491
|
+
cart {
|
492
|
+
...CartApiMutation
|
493
|
+
}
|
494
|
+
userErrors {
|
495
|
+
...CartApiError
|
496
|
+
}
|
497
|
+
}
|
498
|
+
}
|
499
|
+
|
500
|
+
${e}
|
501
|
+
${R}
|
502
|
+
`;function ze(e){return async(t,r)=>{let n=t.filter((s,i,c)=>c.indexOf(s)===i),{cartDiscountCodesUpdate:o,errors:a}=await e.storefront.mutate(tn(e.cartFragment),{variables:{cartId:e.getCartId(),discountCodes:n,...r}});return h(o,a)}}var tn=(e=A)=>`#graphql
|
503
|
+
mutation cartDiscountCodesUpdate(
|
504
|
+
$cartId: ID!
|
505
|
+
$discountCodes: [String!]
|
506
|
+
$language: LanguageCode
|
507
|
+
$country: CountryCode
|
508
|
+
) @inContext(country: $country, language: $language) {
|
509
|
+
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
510
|
+
cart {
|
511
|
+
...CartApiMutation
|
512
|
+
}
|
513
|
+
userErrors {
|
514
|
+
...CartApiError
|
515
|
+
}
|
516
|
+
}
|
517
|
+
}
|
518
|
+
${e}
|
519
|
+
${R}
|
520
|
+
`;function Ye(e){return async(t,r)=>{let{cartBuyerIdentityUpdate:n,errors:o}=await e.storefront.mutate(rn(e.cartFragment),{variables:{cartId:e.getCartId(),buyerIdentity:t,...r}});return h(n,o)}}var rn=(e=A)=>`#graphql
|
521
|
+
mutation cartBuyerIdentityUpdate(
|
522
|
+
$cartId: ID!
|
523
|
+
$buyerIdentity: CartBuyerIdentityInput!
|
524
|
+
$language: LanguageCode
|
525
|
+
$country: CountryCode
|
526
|
+
) @inContext(country: $country, language: $language) {
|
527
|
+
cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {
|
528
|
+
cart {
|
529
|
+
...CartApiMutation
|
530
|
+
}
|
531
|
+
userErrors {
|
532
|
+
...CartApiError
|
533
|
+
}
|
534
|
+
}
|
535
|
+
}
|
536
|
+
${e}
|
537
|
+
${R}
|
538
|
+
`;function Xe(e){return async(t,r)=>{let{cartNoteUpdate:n,errors:o}=await e.storefront.mutate(nn(e.cartFragment),{variables:{cartId:e.getCartId(),note:t,...r}});return h(n,o)}}var nn=(e=A)=>`#graphql
|
539
|
+
mutation cartNoteUpdate(
|
540
|
+
$cartId: ID!
|
541
|
+
$note: String
|
542
|
+
$language: LanguageCode
|
543
|
+
$country: CountryCode
|
544
|
+
) @inContext(country: $country, language: $language) {
|
545
|
+
cartNoteUpdate(cartId: $cartId, note: $note) {
|
546
|
+
cart {
|
547
|
+
...CartApiMutation
|
548
|
+
}
|
549
|
+
userErrors {
|
550
|
+
...CartApiError
|
551
|
+
}
|
552
|
+
}
|
553
|
+
}
|
554
|
+
${e}
|
555
|
+
${R}
|
556
|
+
`;function Ze(e){return async(t,r)=>{let{cartSelectedDeliveryOptionsUpdate:n,errors:o}=await e.storefront.mutate(on(e.cartFragment),{variables:{cartId:e.getCartId(),selectedDeliveryOptions:t,...r}});return h(n,o)}}var on=(e=A)=>`#graphql
|
557
|
+
mutation cartSelectedDeliveryOptionsUpdate(
|
558
|
+
$cartId: ID!
|
559
|
+
$selectedDeliveryOptions: [CartSelectedDeliveryOptionInput!]!
|
560
|
+
$language: LanguageCode
|
561
|
+
$country: CountryCode
|
562
|
+
) @inContext(country: $country, language: $language) {
|
563
|
+
cartSelectedDeliveryOptionsUpdate(cartId: $cartId, selectedDeliveryOptions: $selectedDeliveryOptions) {
|
564
|
+
cart {
|
565
|
+
...CartApiMutation
|
566
|
+
}
|
567
|
+
userErrors {
|
568
|
+
...CartApiError
|
569
|
+
}
|
570
|
+
}
|
571
|
+
}
|
572
|
+
${e}
|
573
|
+
${R}
|
574
|
+
`;function et(e){return async(t,r)=>{let{cartAttributesUpdate:n,errors:o}=await e.storefront.mutate(an(e.cartFragment),{variables:{cartId:r?.cartId||e.getCartId(),attributes:t}});return h(n,o)}}var an=(e=A)=>`#graphql
|
575
|
+
mutation cartAttributesUpdate(
|
576
|
+
$cartId: ID!
|
577
|
+
$attributes: [AttributeInput!]!
|
578
|
+
) {
|
579
|
+
cartAttributesUpdate(cartId: $cartId, attributes: $attributes) {
|
580
|
+
cart {
|
581
|
+
...CartApiMutation
|
582
|
+
}
|
583
|
+
userErrors {
|
584
|
+
...CartApiError
|
585
|
+
}
|
586
|
+
}
|
587
|
+
}
|
588
|
+
${e}
|
589
|
+
${R}
|
590
|
+
`;function tt(e){return async(t,r)=>{let n=r?.cartId||e.getCartId(),o=t.map(i=>({...i,ownerId:n})),{cartMetafieldsSet:a,errors:s}=await e.storefront.mutate(sn(),{variables:{metafields:o}});return h({cart:{id:n},...a},s)}}var sn=()=>`#graphql
|
591
|
+
mutation cartMetafieldsSet(
|
592
|
+
$metafields: [CartMetafieldsSetInput!]!
|
593
|
+
$language: LanguageCode
|
594
|
+
$country: CountryCode
|
595
|
+
) @inContext(country: $country, language: $language) {
|
596
|
+
cartMetafieldsSet(metafields: $metafields) {
|
597
|
+
userErrors {
|
598
|
+
code
|
599
|
+
elementIndex
|
600
|
+
field
|
601
|
+
message
|
602
|
+
}
|
603
|
+
}
|
604
|
+
}
|
605
|
+
`;function rt(e){return async(t,r)=>{let n=r?.cartId||e.getCartId(),{cartMetafieldDelete:o,errors:a}=await e.storefront.mutate(cn(),{variables:{input:{ownerId:n,key:t}}});return h({cart:{id:n},...o},a)}}var cn=()=>`#graphql
|
606
|
+
mutation cartMetafieldDelete(
|
607
|
+
$input: CartMetafieldDeleteInput!
|
608
|
+
) {
|
609
|
+
cartMetafieldDelete(input: $input) {
|
610
|
+
userErrors {
|
611
|
+
code
|
612
|
+
field
|
613
|
+
message
|
614
|
+
}
|
615
|
+
}
|
616
|
+
}
|
617
|
+
`;var un=new Set(["domain","path","max-age","expires","samesite","secure","httponly"]);function Ft(e){let t={},r,n,o=0,a=e.split(/;\s*/g),s,i;for(;o<a.length;o++)if(n=a[o],r=n.indexOf("="),~r){if(s=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{}un.has(n=s.toLowerCase())?n==="expires"?t.expires=new Date(i):n==="max-age"?t.maxage=+i:t[n]=i:t[s]=i;}else (s=n.trim().toLowerCase())&&(s==="httponly"||s==="secure")&&(t[s]=!0);return t}function $t(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 pn=e=>{let t=Ft(e.get("Cookie")||"");return ()=>t.cart?`gid://shopify/Cart/${t.cart}`:void 0};var dn=e=>t=>{let r=new Headers;return r.append("Set-Cookie",$t("cart",t.split("/").pop()||"",{path:"/",...e})),r};function ln(e){let{getCartId:t,setCartId:r,storefront:n,customerAccount:o,cartQueryFragment:a,cartMutateFragment:s}=e,i={storefront:n,getCartId:t,cartFragment:s},c=t(),u=Be(i),l={get:je({storefront:n,customerAccount:o,getCartId:t,cartFragment:a}),getCartId:t,setCartId:r,create:u,addLines:async(p,f)=>c||f?.cartId?await We(i)(p,f):await u({lines:p},f),updateLines:Ke(i),removeLines:Je(i),updateDiscountCodes:async(p,f)=>c||f?.cartId?await ze(i)(p,f):await u({discountCodes:p},f),updateBuyerIdentity:async(p,f)=>c||f?.cartId?await Ye(i)(p,f):await u({buyerIdentity:p},f),updateNote:async(p,f)=>c||f?.cartId?await Xe(i)(p,f):await u({note:p},f),updateSelectedDeliveryOption:Ze(i),updateAttributes:async(p,f)=>c||f?.cartId?await et(i)(p,f):await u({attributes:p},f),setMetafields:async(p,f)=>c||f?.cartId?await tt(i)(p,f):await u({metafields:p},f),deleteMetafield:rt(i)};return "customMethods"in e?{...l,...e.customMethods??{}}:l}function hn({handle:e,options:t=[],variants:r=[],productPath:n="products",children:o}){let a=r instanceof Array?r:hydrogenReact.flattenConnection(r),{searchParams:s,path:i,alreadyOnProductPage:c}=Sn(e,n),u=t.filter(l=>l?.values?.length===1);return react.createElement(react.Fragment,null,...react.useMemo(()=>t.filter(l=>l?.values?.length>1).map(l=>{let p,f=[];for(let y of l.values){let m=new URLSearchParams(c?s:void 0);m.set(l.name,y),u.forEach(d=>{m.set(d.name,d.values[0]);});let C=a.find(d=>d?.selectedOptions?.every(I=>m.get(I?.name)===I?.value)),S=s.get(l.name),g=S?S===y:!1;g&&(p=y);let b="?"+m.toString();f.push({value:y,isAvailable:C?C.availableForSale:!0,to:i+b,search:b,isActive:g});}return o({option:{name:l.name,value:p,values:f}})}),[t,a,o]))}var Cn=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,o)=>{r.push({name:o,value:n});}),r};function Sn(e,t){let{pathname:r,search:n}=react$1.useLocation();return react.useMemo(()=>{let o=/(\/[a-zA-Z]{2}-[a-zA-Z]{2}\/)/g.exec(r),a=o&&o.length>0;t=t.startsWith("/")?t.substring(1):t;let s=a?`${o[0]}${t}/${e}`:`/${t}/${e}`;return {searchParams:new URLSearchParams(n),alreadyOnProductPage:s===r,path:s}},[r,n,e,t])}var Ht=react.createContext(void 0),xn=Ht.Provider,nt=()=>react.useContext(Ht);function En(e={}){let t=Se(),r=bn(t,e);return {nonce:t,header:r,NonceProvider:({children:o})=>react.createElement(xn,{value:t},o)}}function bn(e,t={}){let r=`'nonce-${e}'`,s={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"]},i=Object.assign({},s,t);for(let c in s)t[c]&&(i[c]=On(t[c],s[c]));return i.scriptSrc instanceof Array&&!i.scriptSrc.includes(r)?i.scriptSrc.push(r):i.defaultSrc instanceof Array&&!i.defaultSrc.includes(r)&&i.defaultSrc.push(r),An__default.default({directives:i})}function On(e,t){let r=typeof t=="string"?[t]:t,n=Array.isArray(e)?e:[String(e)];return Array.isArray(r)?[...n,...r]:r}var wn=react.forwardRef((e,t)=>{let r=nt();return jsxRuntime.jsx("script",{suppressHydrationWarning:!0,...e,nonce:r,ref:t})});function Ln(e){let t=react$1.useFetchers(),r={};for(let{formData:n}of t)if(n?.get("optimistic-identifier")===e)try{if(n.has("optimistic-data")){let o=JSON.parse(String(n.get("optimistic-data")));Object.assign(r,o);}}catch{}return r}function vn({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 Mn(e){return jsxRuntime.jsx(hydrogenReact.ShopPayButton,{channel:"hydrogen",...e})}//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartCreate
|
618
|
+
//! @see https://shopify.dev/docs/api/storefront/latest/queries/cart
|
619
|
+
//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartLinesAdd
|
620
|
+
//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartLinesUpdate
|
621
|
+
//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartLinesRemove
|
622
|
+
//! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartDiscountCodesUpdate
|
623
|
+
//! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartBuyerIdentityUpdate
|
624
|
+
//! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartNoteUpdate
|
625
|
+
//! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartSelectedDeliveryOptionsUpdate
|
626
|
+
//! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartMetafieldsSet
|
627
|
+
//! @see https://shopify.dev/docs/api/storefront/2024-01/mutations/cartMetafieldDelete
|
628
|
+
|
629
|
+
Object.defineProperty(exports, 'AnalyticsEventName', {
|
630
|
+
enumerable: true,
|
631
|
+
get: function () { return hydrogenReact.AnalyticsEventName; }
|
632
|
+
});
|
633
|
+
Object.defineProperty(exports, 'AnalyticsPageType', {
|
634
|
+
enumerable: true,
|
635
|
+
get: function () { return hydrogenReact.AnalyticsPageType; }
|
636
|
+
});
|
637
|
+
Object.defineProperty(exports, 'ExternalVideo', {
|
638
|
+
enumerable: true,
|
639
|
+
get: function () { return hydrogenReact.ExternalVideo; }
|
640
|
+
});
|
641
|
+
Object.defineProperty(exports, 'IMAGE_FRAGMENT', {
|
642
|
+
enumerable: true,
|
643
|
+
get: function () { return hydrogenReact.IMAGE_FRAGMENT; }
|
644
|
+
});
|
645
|
+
Object.defineProperty(exports, 'Image', {
|
646
|
+
enumerable: true,
|
647
|
+
get: function () { return hydrogenReact.Image; }
|
648
|
+
});
|
649
|
+
Object.defineProperty(exports, 'MediaFile', {
|
650
|
+
enumerable: true,
|
651
|
+
get: function () { return hydrogenReact.MediaFile; }
|
652
|
+
});
|
653
|
+
Object.defineProperty(exports, 'ModelViewer', {
|
654
|
+
enumerable: true,
|
655
|
+
get: function () { return hydrogenReact.ModelViewer; }
|
656
|
+
});
|
657
|
+
Object.defineProperty(exports, 'Money', {
|
658
|
+
enumerable: true,
|
659
|
+
get: function () { return hydrogenReact.Money; }
|
660
|
+
});
|
661
|
+
Object.defineProperty(exports, 'ShopifySalesChannel', {
|
662
|
+
enumerable: true,
|
663
|
+
get: function () { return hydrogenReact.ShopifySalesChannel; }
|
664
|
+
});
|
665
|
+
Object.defineProperty(exports, 'Video', {
|
666
|
+
enumerable: true,
|
667
|
+
get: function () { return hydrogenReact.Video; }
|
668
|
+
});
|
669
|
+
Object.defineProperty(exports, 'customerAccountApiCustomScalars', {
|
670
|
+
enumerable: true,
|
671
|
+
get: function () { return hydrogenReact.customerAccountApiCustomScalars; }
|
672
|
+
});
|
673
|
+
Object.defineProperty(exports, 'flattenConnection', {
|
674
|
+
enumerable: true,
|
675
|
+
get: function () { return hydrogenReact.flattenConnection; }
|
676
|
+
});
|
677
|
+
Object.defineProperty(exports, 'getClientBrowserParameters', {
|
678
|
+
enumerable: true,
|
679
|
+
get: function () { return hydrogenReact.getClientBrowserParameters; }
|
680
|
+
});
|
681
|
+
Object.defineProperty(exports, 'getShopifyCookies', {
|
682
|
+
enumerable: true,
|
683
|
+
get: function () { return hydrogenReact.getShopifyCookies; }
|
684
|
+
});
|
685
|
+
Object.defineProperty(exports, 'parseGid', {
|
686
|
+
enumerable: true,
|
687
|
+
get: function () { return hydrogenReact.parseGid; }
|
688
|
+
});
|
689
|
+
Object.defineProperty(exports, 'parseMetafield', {
|
690
|
+
enumerable: true,
|
691
|
+
get: function () { return hydrogenReact.parseMetafield; }
|
692
|
+
});
|
693
|
+
Object.defineProperty(exports, 'sendShopifyAnalytics', {
|
694
|
+
enumerable: true,
|
695
|
+
get: function () { return hydrogenReact.sendShopifyAnalytics; }
|
696
|
+
});
|
697
|
+
Object.defineProperty(exports, 'storefrontApiCustomScalars', {
|
698
|
+
enumerable: true,
|
699
|
+
get: function () { return hydrogenReact.storefrontApiCustomScalars; }
|
700
|
+
});
|
701
|
+
Object.defineProperty(exports, 'useLoadScript', {
|
702
|
+
enumerable: true,
|
703
|
+
get: function () { return hydrogenReact.useLoadScript; }
|
704
|
+
});
|
705
|
+
Object.defineProperty(exports, 'useMoney', {
|
706
|
+
enumerable: true,
|
707
|
+
get: function () { return hydrogenReact.useMoney; }
|
708
|
+
});
|
709
|
+
Object.defineProperty(exports, 'useShopifyCookies', {
|
710
|
+
enumerable: true,
|
711
|
+
get: function () { return hydrogenReact.useShopifyCookies; }
|
712
|
+
});
|
713
|
+
exports.CacheCustom = Oe;
|
714
|
+
exports.CacheLong = be;
|
715
|
+
exports.CacheNone = xe;
|
716
|
+
exports.CacheShort = G;
|
717
|
+
exports.CartForm = Ie;
|
718
|
+
exports.InMemoryCache = Fe;
|
719
|
+
exports.OptimisticInput = vn;
|
720
|
+
exports.Pagination = Dr;
|
721
|
+
exports.Script = wn;
|
722
|
+
exports.Seo = Er;
|
723
|
+
exports.ShopPayButton = Mn;
|
724
|
+
exports.VariantSelector = hn;
|
725
|
+
exports.cartAttributesUpdateDefault = et;
|
726
|
+
exports.cartBuyerIdentityUpdateDefault = Ye;
|
727
|
+
exports.cartCreateDefault = Be;
|
728
|
+
exports.cartDiscountCodesUpdateDefault = ze;
|
729
|
+
exports.cartGetDefault = je;
|
730
|
+
exports.cartGetIdDefault = pn;
|
731
|
+
exports.cartLinesAddDefault = We;
|
732
|
+
exports.cartLinesRemoveDefault = Je;
|
733
|
+
exports.cartLinesUpdateDefault = Ke;
|
734
|
+
exports.cartMetafieldDeleteDefault = rt;
|
735
|
+
exports.cartMetafieldsSetDefault = tt;
|
736
|
+
exports.cartNoteUpdateDefault = Xe;
|
737
|
+
exports.cartSelectedDeliveryOptionsUpdateDefault = Ze;
|
738
|
+
exports.cartSetIdDefault = dn;
|
739
|
+
exports.changelogHandler = Gr;
|
740
|
+
exports.createCartHandler = ln;
|
741
|
+
exports.createContentSecurityPolicy = En;
|
742
|
+
exports.createCustomerAccountClient = Hr;
|
743
|
+
exports.createStorefrontClient = ho;
|
744
|
+
exports.createWithCache = Ao;
|
745
|
+
exports.formatAPIResult = h;
|
746
|
+
exports.generateCacheControlHeader = Z;
|
747
|
+
exports.getPaginationVariables = Lr;
|
748
|
+
exports.getSelectedProductOptions = Cn;
|
749
|
+
exports.graphiqlLoader = dr;
|
750
|
+
exports.storefrontRedirect = ur;
|
751
|
+
exports.useNonce = nt;
|
752
|
+
exports.useOptimisticData = Ln;
|
753
|
+
//# sourceMappingURL=out.js.map
|
754
|
+
//# sourceMappingURL=index.cjs.map
|