@shopify/hydrogen 2023.7.3 → 2023.7.4
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 +120 -40
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +116 -43
- package/dist/development/index.js.map +1 -1
- package/dist/production/index.cjs +68 -60
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.d.cts +22 -3
- package/dist/production/index.d.ts +22 -3
- package/dist/production/index.js +35 -34
- package/dist/production/index.js.map +1 -1
- package/dist/storefront-api-types.d.ts +18 -17
- package/dist/storefront.schema.json +1 -1
- package/package.json +4 -3
|
@@ -4,7 +4,7 @@ import { ExecutionArgs } from 'graphql';
|
|
|
4
4
|
import { LanguageCode, CountryCode, Maybe, PageInfo, CartMetafieldsSetInput, Cart, CartUserError, MetafieldsSetUserError, MetafieldDeleteUserError, Scalars, AttributeInput, CartBuyerIdentityInput, CartInput, CartLineInput, CartLineUpdateInput, CartSelectedDeliveryOptionInput, ProductOption, ProductVariantConnection, ProductVariant, SelectedOptionInput } from '@shopify/hydrogen-react/storefront-api-types';
|
|
5
5
|
import { LoaderArgs, LoaderFunction, SerializeFrom, AppData } from '@remix-run/server-runtime';
|
|
6
6
|
import * as react from 'react';
|
|
7
|
-
import react__default, { ReactNode } from 'react';
|
|
7
|
+
import react__default, { ReactNode, ComponentType } from 'react';
|
|
8
8
|
import { Params, Location, LinkProps, FetcherWithComponents } from '@remix-run/react';
|
|
9
9
|
import { Thing, WithContext } from 'schema-dts';
|
|
10
10
|
import { PartialDeep } from 'type-fest';
|
|
@@ -923,14 +923,33 @@ type VariantSelectorProps = {
|
|
|
923
923
|
options: Array<PartialDeep<ProductOption>> | undefined;
|
|
924
924
|
/** Product variants from the [Storefront API](/docs/api/storefront/2023-07/objects/ProductVariant). You only need to pass this prop if you want to show product availability. If a product option combination is not found within `variants`, it is assumed to be available. Make sure to include `availableForSale` and `selectedOptions.name` and `selectedOptions.value`. */
|
|
925
925
|
variants?: PartialDeep<ProductVariantConnection> | Array<PartialDeep<ProductVariant>>;
|
|
926
|
+
/** By default all products are under /products. Use this prop to provide a custom path. */
|
|
927
|
+
productPath?: string;
|
|
926
928
|
children: ({ option }: {
|
|
927
929
|
option: VariantOption;
|
|
928
930
|
}) => ReactNode;
|
|
929
931
|
};
|
|
930
|
-
declare function VariantSelector({ handle, options, variants: _variants, children, }: VariantSelectorProps): react.FunctionComponentElement<{
|
|
932
|
+
declare function VariantSelector({ handle, options, variants: _variants, productPath, children, }: VariantSelectorProps): react.FunctionComponentElement<{
|
|
931
933
|
children?: ReactNode;
|
|
932
934
|
}>;
|
|
933
935
|
type GetSelectedProductOptions = (request: Request) => SelectedOptionInput[];
|
|
934
936
|
declare const getSelectedProductOptions: GetSelectedProductOptions;
|
|
935
937
|
|
|
936
|
-
|
|
938
|
+
declare const useNonce: () => string | undefined;
|
|
939
|
+
type ContentSecurityPolicy = {
|
|
940
|
+
/** A randomly generated nonce string that should be passed to any custom `script` element */
|
|
941
|
+
nonce: string;
|
|
942
|
+
/** The content security policy header */
|
|
943
|
+
header: string;
|
|
944
|
+
NonceProvider: ComponentType<{
|
|
945
|
+
children: ReactNode;
|
|
946
|
+
}>;
|
|
947
|
+
};
|
|
948
|
+
/**
|
|
949
|
+
* @param directives - Pass custom [content security policy directives](https://content-security-policy.com/). This is important if you load content in your app from third-party domains.
|
|
950
|
+
*/
|
|
951
|
+
declare function createContentSecurityPolicy(directives?: Record<string, string[] | string | boolean>): ContentSecurityPolicy;
|
|
952
|
+
|
|
953
|
+
declare const Script: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.ScriptHTMLAttributes<HTMLScriptElement>, HTMLScriptElement>, "ref"> & react.RefAttributes<HTMLScriptElement>>;
|
|
954
|
+
|
|
955
|
+
export { CacheCustom, CacheLong, CacheNone, CacheShort, CartActionInput, CartForm, CartQueryData, CartQueryOptions, CartQueryReturn, CookieOptions, CreateStorefrontClientOptions, HydrogenCart, HydrogenCartCustom, I18nBase, InMemoryCache, MetafieldWithoutOwnerId, Pagination, Script, Seo, SeoConfig, SeoHandleFunction, Storefront, StorefrontClient, StorefrontMutations, StorefrontQueries, VariantOption, VariantOptionValue, VariantSelector, WithCache, cartAttributesUpdateDefault, cartBuyerIdentityUpdateDefault, cartCreateDefault, cartDiscountCodesUpdateDefault, cartGetDefault, cartGetIdDefault, cartLinesAddDefault, cartLinesRemoveDefault, cartLinesUpdateDefault, cartMetafieldDeleteDefault, cartMetafieldsSetDefault, cartNoteUpdateDefault, cartSelectedDeliveryOptionsUpdateDefault, cartSetIdDefault, createCartHandler, createContentSecurityPolicy, createStorefrontClient, createWithCache, generateCacheControlHeader, getPaginationVariables, getSelectedProductOptions, graphiqlLoader, isStorefrontApiError, storefrontRedirect, useNonce };
|
|
@@ -4,7 +4,7 @@ import { ExecutionArgs } from 'graphql';
|
|
|
4
4
|
import { LanguageCode, CountryCode, Maybe, PageInfo, CartMetafieldsSetInput, Cart, CartUserError, MetafieldsSetUserError, MetafieldDeleteUserError, Scalars, AttributeInput, CartBuyerIdentityInput, CartInput, CartLineInput, CartLineUpdateInput, CartSelectedDeliveryOptionInput, ProductOption, ProductVariantConnection, ProductVariant, SelectedOptionInput } from '@shopify/hydrogen-react/storefront-api-types';
|
|
5
5
|
import { LoaderArgs, LoaderFunction, SerializeFrom, AppData } from '@remix-run/server-runtime';
|
|
6
6
|
import * as react from 'react';
|
|
7
|
-
import react__default, { ReactNode } from 'react';
|
|
7
|
+
import react__default, { ReactNode, ComponentType } from 'react';
|
|
8
8
|
import { Params, Location, LinkProps, FetcherWithComponents } from '@remix-run/react';
|
|
9
9
|
import { Thing, WithContext } from 'schema-dts';
|
|
10
10
|
import { PartialDeep } from 'type-fest';
|
|
@@ -923,14 +923,33 @@ type VariantSelectorProps = {
|
|
|
923
923
|
options: Array<PartialDeep<ProductOption>> | undefined;
|
|
924
924
|
/** Product variants from the [Storefront API](/docs/api/storefront/2023-07/objects/ProductVariant). You only need to pass this prop if you want to show product availability. If a product option combination is not found within `variants`, it is assumed to be available. Make sure to include `availableForSale` and `selectedOptions.name` and `selectedOptions.value`. */
|
|
925
925
|
variants?: PartialDeep<ProductVariantConnection> | Array<PartialDeep<ProductVariant>>;
|
|
926
|
+
/** By default all products are under /products. Use this prop to provide a custom path. */
|
|
927
|
+
productPath?: string;
|
|
926
928
|
children: ({ option }: {
|
|
927
929
|
option: VariantOption;
|
|
928
930
|
}) => ReactNode;
|
|
929
931
|
};
|
|
930
|
-
declare function VariantSelector({ handle, options, variants: _variants, children, }: VariantSelectorProps): react.FunctionComponentElement<{
|
|
932
|
+
declare function VariantSelector({ handle, options, variants: _variants, productPath, children, }: VariantSelectorProps): react.FunctionComponentElement<{
|
|
931
933
|
children?: ReactNode;
|
|
932
934
|
}>;
|
|
933
935
|
type GetSelectedProductOptions = (request: Request) => SelectedOptionInput[];
|
|
934
936
|
declare const getSelectedProductOptions: GetSelectedProductOptions;
|
|
935
937
|
|
|
936
|
-
|
|
938
|
+
declare const useNonce: () => string | undefined;
|
|
939
|
+
type ContentSecurityPolicy = {
|
|
940
|
+
/** A randomly generated nonce string that should be passed to any custom `script` element */
|
|
941
|
+
nonce: string;
|
|
942
|
+
/** The content security policy header */
|
|
943
|
+
header: string;
|
|
944
|
+
NonceProvider: ComponentType<{
|
|
945
|
+
children: ReactNode;
|
|
946
|
+
}>;
|
|
947
|
+
};
|
|
948
|
+
/**
|
|
949
|
+
* @param directives - Pass custom [content security policy directives](https://content-security-policy.com/). This is important if you load content in your app from third-party domains.
|
|
950
|
+
*/
|
|
951
|
+
declare function createContentSecurityPolicy(directives?: Record<string, string[] | string | boolean>): ContentSecurityPolicy;
|
|
952
|
+
|
|
953
|
+
declare const Script: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.ScriptHTMLAttributes<HTMLScriptElement>, HTMLScriptElement>, "ref"> & react.RefAttributes<HTMLScriptElement>>;
|
|
954
|
+
|
|
955
|
+
export { CacheCustom, CacheLong, CacheNone, CacheShort, CartActionInput, CartForm, CartQueryData, CartQueryOptions, CartQueryReturn, CookieOptions, CreateStorefrontClientOptions, HydrogenCart, HydrogenCartCustom, I18nBase, InMemoryCache, MetafieldWithoutOwnerId, Pagination, Script, Seo, SeoConfig, SeoHandleFunction, Storefront, StorefrontClient, StorefrontMutations, StorefrontQueries, VariantOption, VariantOptionValue, VariantSelector, WithCache, cartAttributesUpdateDefault, cartBuyerIdentityUpdateDefault, cartCreateDefault, cartDiscountCodesUpdateDefault, cartGetDefault, cartGetIdDefault, cartLinesAddDefault, cartLinesRemoveDefault, cartLinesUpdateDefault, cartMetafieldDeleteDefault, cartMetafieldsSetDefault, cartNoteUpdateDefault, cartSelectedDeliveryOptionsUpdateDefault, cartSetIdDefault, createCartHandler, createContentSecurityPolicy, createStorefrontClient, createWithCache, generateCacheControlHeader, getPaginationVariables, getSelectedProductOptions, graphiqlLoader, isStorefrontApiError, storefrontRedirect, useNonce };
|
package/dist/production/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { createStorefrontClient, SHOPIFY_STOREFRONT_ID_HEADER, getShopifyCookies, SHOPIFY_Y, SHOPIFY_STOREFRONT_Y_HEADER, SHOPIFY_S, SHOPIFY_STOREFRONT_S_HEADER, flattenConnection } from '@shopify/hydrogen-react';
|
|
2
2
|
export { AnalyticsEventName, AnalyticsPageType, ExternalVideo, IMAGE_FRAGMENT, Image, MediaFile, ModelViewer, Money, ShopPayButton, ShopifySalesChannel, Video, flattenConnection, getClientBrowserParameters, getShopifyCookies, parseGid, parseMetafield, sendShopifyAnalytics, storefrontApiCustomScalars, useLoadScript, useMoney, useShopifyCookies } from '@shopify/hydrogen-react';
|
|
3
3
|
import { redirect } from '@remix-run/server-runtime';
|
|
4
|
-
import { lazy, useMemo, createElement, Suspense, Fragment } from 'react';
|
|
4
|
+
import { lazy, createContext, forwardRef, useMemo, createElement, Suspense, Fragment, useState, useEffect, useContext } from 'react';
|
|
5
5
|
import { useMatches, useLocation, useNavigation, Link, useFetcher } from '@remix-run/react';
|
|
6
|
-
import {
|
|
6
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
|
+
import dr from 'content-security-policy-builder';
|
|
7
8
|
|
|
8
|
-
function
|
|
9
|
-
`))||`API response error: ${e.status}`;throw new
|
|
9
|
+
function Ce(e){let t=Array.isArray(e)?e:[e],r="";for(let a of t)a!=null&&(typeof a=="object"?a.body&&typeof a.body=="string"?r+=a.body:r+=JSON.stringify(a):r+=a);return encodeURIComponent(r)}var _="public",Ke="private",Q="no-store",he={maxAge:"max-age",staleWhileRevalidate:"stale-while-revalidate",sMaxAge:"s-maxage",staleIfError:"stale-if-error"};function P(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 H(){return {mode:Q}}function Se(e){if(e?.mode&&e?.mode!==_&&e?.mode!==Ke)throw Error("'mode' must be either 'public' or 'private'")}function I(e){return Se(e),{mode:_,maxAge:1,staleWhileRevalidate:9,...e}}function G(e){return Se(e),{mode:_,maxAge:3600,staleWhileRevalidate:82800,...e}}function V(e){return e}function w(e){return String(e).includes("__proto__")?JSON.parse(e,Ye):JSON.parse(e)}function Ye(e,t){if(e!=="__proto__")return t}function E(e,t){return e&&t?{...e,...t}:e||I()}function B(e){return P(E(e))}async function ze(e,t){if(!e)return;let r=await e.match(t);if(!r){return}return r}async function Xe(e,t,r,a){if(!e)return;let n=E(a),i=B(E(n,{maxAge:(n.maxAge||0)+(n.staleWhileRevalidate||0)})),o=B(E(n));r.headers.set("cache-control",i),r.headers.set("real-cache-control",o),r.headers.set("cache-put-date",new Date().toUTCString()),await e.put(t,r);}async function Ze(e,t){e&&await e.delete(t);}function et(e,t){let r=e.headers.get("real-cache-control"),a=0;if(r){let i=r.match(/max-age=(\d*)/);i&&i.length>1&&(a=parseFloat(i[1]));}return [(new Date().valueOf()-new Date(t).valueOf())/1e3,a]}function tt(e,t){let r=t.headers.get("cache-put-date");if(!r)return !1;let[a,n]=et(t,r),i=a>n;return i}var v={get:ze,set:Xe,delete:Ze,generateDefaultCacheControlHeader:B,isStale:tt};function W(e){return `https://shopify.dev/?${e}`}function rt(e){return e||I()}async function Ie(e,t){if(!e)return;let r=W(t),a=new Request(r),n=await v.get(e,a);if(!n)return;let i=await n.text();try{return [w(i),n]}catch{return [i,n]}}async function j(e,t,r,a){if(!e)return;let n=W(t),i=new Request(n),o=new Response(JSON.stringify(r));await v.set(e,i,o,rt(a));}function Re(e,t){return v.isStale(new Request(W(e)),t)}function at(e,t){return [e,{status:t.status,statusText:t.statusText,headers:Array.from(t.headers.entries())}]}function Te([e,t]){return [e,new Response(e,t)]}var xe=e=>!e?.errors,J=new Set;async function K(e,t,{strategy:r=I(),cacheInstance:a,shouldCacheResult:n=()=>!0,waitUntil:i}){if(!a||!r||r.mode===Q)return t();let o=Ce([...typeof e=="string"?[e]:e]),s=await Ie(a,o);if(s){let[d,u]=s;if(!J.has(o)&&Re(o,u)){J.add(o);let c=Promise.resolve().then(async()=>{try{let l=await t();n(l)&&await j(a,o,l,r);}catch(l){l.message&&(l.message="SWR in sub-request failed: "+l.message),console.error(l);}finally{J.delete(o);}});i?.(c);}return d}let p=await t();if(n(p)){let d=j(a,o,p,r);i?.(d);}return p}async function Ae(e,t,{cacheInstance:r,cache:a,cacheKey:n=[e,t],shouldCacheResponse:i=()=>!0,waitUntil:o,returnType:s="json"}={}){return !a&&(!t.method||t.method==="GET")&&(a=I()),K(n,async()=>{let p=await fetch(e,t),d;try{d=await p[s]();}catch{try{d=await p.text();}catch{throw new Error(`Storefront API response code: ${p.status} (Request Id: ${p.headers.get("x-request-id")})`)}}return at(d,p)},{cacheInstance:r,waitUntil:o,strategy:a??null,shouldCacheResult:p=>i(...Te(p))}).then(Te)}var Oe="Custom-Storefront-Request-Group-ID";function Pe(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`weak-${Math.random().toString(16).substring(2)}`}var Y="2023.7.4";var we=class extends Error{},ct=e=>e instanceof we,ut=/(^|}\s)query[\s({]/im,dt=/(^|}\s)mutation[\s({]/im;function Me(e){return e.replace(/\s*#.*$/gm,"").replace(/\s+/gm," ").trim()}var lt={language:"EN",country:"US"};function Gr(e){let {storefrontHeaders:t,cache:r,waitUntil:a,buyerIp:n,i18n:i,requestGroupId:o,storefrontId:s,...p}=e,{getPublicTokenHeaders:u,getPrivateTokenHeaders:c,getStorefrontApiUrl:l,getShopifyDomain:h}=createStorefrontClient(p),f=(p.privateStorefrontToken?c:u)({contentType:"json",buyerIp:t?.buyerIp||n});if(f[Oe]=t?.requestGroupId||o||Pe(),s&&(f[SHOPIFY_STOREFRONT_ID_HEADER]=s),(f["user-agent"]=`Hydrogen ${Y}`),t&&t.cookie){let y=getShopifyCookies(t.cookie??"");y[SHOPIFY_Y]&&(f[SHOPIFY_STOREFRONT_Y_HEADER]=y[SHOPIFY_Y]),y[SHOPIFY_S]&&(f[SHOPIFY_STOREFRONT_S_HEADER]=y[SHOPIFY_S]);}async function A({query:y,mutation:R,variables:T,cache:M,headers:O=[],storefrontApiVersion:Ve}){let Be=O instanceof Headers?Object.fromEntries(O.entries()):Array.isArray(O)?Object.fromEntries(O):O;y=y??R;let U={...T};i&&(!T?.country&&/\$country/.test(y)&&(U.country=i.country),!T?.language&&/\$language/.test(y)&&(U.language=i.language));let We=l({storefrontApiVersion:Ve}),je={method:"POST",headers:{...f,...Be},body:JSON.stringify({query:y,variables:U})},[q,fe]=await Ae(We,je,{cacheInstance:R?void 0:r,cache:M||I(),shouldCacheResponse:xe,waitUntil:a}),ge={response:fe,type:R?"mutation":"query",query:y,queryVariables:U,errors:void 0};if(!fe.ok){let k;try{k=w(q);}catch{k=[{message:q}];}Ue({...ge,errors:k});}let{data:Je,errors:me}=q;return me?.length&&Ue({...ge,errors:me,ErrorConstructor:we}),Je}return {storefront:{query:(y,R)=>{if(y=Me(y),dt.test(y))throw new Error("[h2:error:storefront.query] Cannot execute mutations");return A({...R,query:y})},mutate:(y,R)=>{if(y=Me(y),ut.test(y))throw new Error("[h2:error:storefront.mutate] Cannot execute queries");return A({...R,mutation:y})},cache:r,CacheNone:H,CacheLong:G,CacheShort:I,CacheCustom:V,generateCacheControlHeader:P,getPublicTokenHeaders:u,getPrivateTokenHeaders:c,getShopifyDomain:h,getApiUrl:l,isApiError:ct,i18n:i??lt}}}function Ue({response:e,errors:t,type:r,query:a,queryVariables:n,ErrorConstructor:i=Error}){let o=e.headers.get("x-request-id"),s=(typeof t=="string"?t:t?.map?.(p=>p.message).join(`
|
|
10
|
+
`))||`API response error: ${e.status}`;throw new i(`[h2:error:storefront.${r}] `+s+(o?` - Request ID: ${o}`:""),{cause:{errors:t,requestId:o}})}function jr(e){let{cache:t,waitUntil:r}=e;return function(n,i,o){return K(n,o,{strategy:i,cacheInstance:t,waitUntil:r})}}var z=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:a,timestamp:n,...i}=r,o=new Headers(i.headers),s=o.get("cache-control")||o.get("real-cache-control")||"",p=parseInt(s.match(/max-age=(\d+)/)?.[1]||"0",10),d=parseInt(s.match(/stale-while-revalidate=(\d+)/)?.[1]||"0",10),u=(Date.now()-n)/1e3;if(u>p+d){this.#e.delete(t.url);return}let l=u>p;return o.set("cache",l?"STALE":"HIT"),o.set("date",new Date(n).toUTCString()),new Response(a,{status:i.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 a of this.#e.keys())(!t||t.url===a)&&r.push(new Request(a));return Promise.resolve(r)}};async function yt(e){let{storefront:t,request:r,noAdminRedirect:a,response:n=new Response("Not Found",{status:404})}=e,{pathname:i,search:o}=new URL(r.url),s=i+o;if(i==="/admin"&&!a)return redirect(`${t.getShopifyDomain()}/admin`);try{let{urlRedirects:p}=await t.query(gt,{variables:{query:"path:"+s}}),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 ${s} to ${c}`);}}catch(p){console.error(`Failed to fetch redirects from Storefront API for route ${s}`,p);}return n}function ft(e){try{new URL(e);}catch{return !0}return !1}var gt=`#graphql
|
|
10
11
|
query redirects($query: String) {
|
|
11
12
|
urlRedirects(first: 1, query: $query) {
|
|
12
13
|
edges {
|
|
@@ -16,12 +17,12 @@ function ge(e){let t=Array.isArray(e)?e:[e],a="";for(let r of t)r!=null&&(typeof
|
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
|
-
`;var
|
|
20
|
+
`;var mt=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 a=r.getApiUrl(),n=r.getPublicTokenHeaders()["X-Shopify-Storefront-Access-Token"],i="https://avatars.githubusercontent.com/u/12972006?s=48&v=4";return new Response(`
|
|
20
21
|
<!DOCTYPE html>
|
|
21
22
|
<html lang="en">
|
|
22
23
|
<head>
|
|
23
24
|
<title>GraphiQL</title>
|
|
24
|
-
<link rel="icon" type="image/x-icon" href="${
|
|
25
|
+
<link rel="icon" type="image/x-icon" href="${i}">
|
|
25
26
|
<style>
|
|
26
27
|
body {
|
|
27
28
|
height: 100%;
|
|
@@ -73,8 +74,8 @@ function ge(e){let t=Array.isArray(e)?e:[e],a="";for(let r of t)r!=null&&(typeof
|
|
|
73
74
|
root.render(
|
|
74
75
|
React.createElement(GraphiQL, {
|
|
75
76
|
fetcher: GraphiQL.createFetcher({
|
|
76
|
-
url: '${
|
|
77
|
-
headers: {'X-Shopify-Storefront-Access-Token': '${
|
|
77
|
+
url: '${a}',
|
|
78
|
+
headers: {'X-Shopify-Storefront-Access-Token': '${n}'}
|
|
78
79
|
}),
|
|
79
80
|
defaultEditorToolsVisibility: true,
|
|
80
81
|
query,
|
|
@@ -84,18 +85,18 @@ function ge(e){let t=Array.isArray(e)?e:[e],a="";for(let r of t)r!=null&&(typeof
|
|
|
84
85
|
</script>
|
|
85
86
|
</body>
|
|
86
87
|
</html>
|
|
87
|
-
`,{status:200,headers:{"content-type":"text/html"}})};var
|
|
88
|
+
`,{status:200,headers:{"content-type":"text/html"}})};var x="Error in SEO input: ",L={title:{validate:e=>{if(typeof e!="string")throw new Error(x.concat("`title` should be a string"));if(typeof e=="string"&&e.length>120)throw new Error(x.concat("`title` should not be longer than 120 characters"));return e}},description:{validate:e=>{if(typeof e!="string")throw new Error(x.concat("`description` should be a string"));if(typeof e=="string"&&e.length>155)throw new Error(x.concat("`description` should not be longer than 155 characters"));return e}},url:{validate:e=>{if(typeof e!="string")throw new Error(x.concat("`url` should be a string"));if(typeof e=="string"&&!e.startsWith("http"))throw new Error(x.concat("`url` should be a valid URL"));return e}},handle:{validate:e=>{if(typeof e!="string")throw new Error(x.concat("`handle` should be a string"));if(typeof e=="string"&&!e.startsWith("@"))throw new Error(x.concat("`handle` should start with `@`"));return e}}};function ve(e){let t=[];for(let r of Object.keys(e))switch(r){case"title":{let a=N(L.title,e.title),n=Ct(e?.titleTemplate,a);if(!n)break;t.push(C("title",{title:n}),C("meta",{property:"og:title",content:n}),C("meta",{name:"twitter:title",content:n}));break}case"description":{let a=N(L.description,e.description);if(!a)break;t.push(C("meta",{name:"description",content:a}),C("meta",{property:"og:description",content:a}),C("meta",{name:"twitter:description",content:a}));break}case"url":{let a=N(L.url,e.url);if(!a)break;t.push(C("link",{rel:"canonical",href:a}),C("meta",{property:"og:url",content:a}));break}case"handle":{let a=N(L.handle,e.handle);if(!a)break;t.push(C("meta",{name:"twitter:site",content:a}),C("meta",{name:"twitter:creator",content:a}));break}case"media":{let a,n=Z(e.media);for(let i of n)if(typeof i=="string"&&t.push(C("meta",{name:"og:image",content:i})),i&&typeof i=="object"){let o=i.type||"image",s=i?{url:i?.url,secure_url:i?.url,type:ht(i.url),width:i?.width,height:i?.height,alt:i?.altText}:{};for(let p of Object.keys(s))s[p]&&(a=s[p],t.push(C("meta",{property:`og:${o}:${p}`,content:a},s.url)));}break}case"jsonLd":{let a=Z(e.jsonLd),n=0;for(let i of a){if(typeof i!="object")continue;let o=C("script",{type:"application/ld+json",children:JSON.stringify(i)},`json-ld-${i?.["@type"]||i?.name||n++}`);t.push(o);}break}case"alternates":{let a=Z(e.alternates);for(let n of a){if(!n)continue;let{language:i,url:o,default:s}=n,p=i?`${i}${s?"-default":""}`:void 0;t.push(C("link",{rel:"alternate",hrefLang:p,href:o}));}break}case"robots":{if(!e.robots)break;let{maxImagePreview:a,maxSnippet:n,maxVideoPreview:i,noArchive:o,noFollow:s,noImageIndex:p,noIndex:d,noSnippet:u,noTranslate:c,unavailableAfter:l}=e.robots,h=[o&&"noarchive",p&&"noimageindex",u&&"nosnippet",c&&"notranslate",a&&`max-image-preview:${a}`,n&&`max-snippet:${n}`,i&&`max-video-preview:${i}`,l&&`unavailable_after:${l}`],S=(d?"noindex":"index")+","+(s?"nofollow":"follow");for(let f of h)f&&(S+=`,${f}`);t.push(C("meta",{name:"robots",content:S}));break}}return t.flat().sort((r,a)=>r.key.localeCompare(a.key))}function C(e,t,r){let a={tag:e,props:{},key:""};return e==="title"?(a.children=t.title,a.key=X(a),a):e==="script"?(a.children=typeof t.children=="string"?t.children:"",a.key=X(a,r),delete t.children,a.props=t,a):(a.props=t,Object.keys(a.props).forEach(n=>!a.props[n]&&delete a.props[n]),a.key=X(a,r),a)}function X(e,t){let{tag:r,props:a}=e;if(r==="title")return "0-title";if(r==="meta"){let n=a.content===t&&typeof a.property=="string"&&!a.property.endsWith("secure_url")&&"0";return [r,...[t,n],a.property||a.name].filter(o=>o).join("-")}return r==="link"?[r,a.rel,a.hrefLang||a.media].filter(i=>i).join("-").replace(/\s+/g,"-"):r==="script"?`${r}-${t}`:`${r}-${a.type}`}function Ct(e,t){if(t)return e?typeof e=="function"?e(t):e.replace("%s",t??""):t}function ht(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 Z(e){return Array.isArray(e)?e:[e]}function N(e,t){try{return e.validate(t)}catch(r){return console.warn(r.message),t}}var At=lazy(()=>import('./log-seo-tags-TY72EQWZ.js'));function Ot({debug:e}){let t=useMatches(),r=useLocation(),a=useMemo(()=>t.flatMap(o=>{let{handle:s,...p}=o,d={...p,...r},u=s?.seo,c=p?.data?.seo;return !u&&!c?[]:u?F(s.seo,d):[c]}).reduce((o,s)=>{Object.keys(s).forEach(d=>!s[d]&&delete s[d]);let{jsonLd:p}=s;return p?o?.jsonLd?Array.isArray(p)?{...o,...s,jsonLd:[...o.jsonLd,...p]}:{...o,...s,jsonLd:[...o.jsonLd,p]}:{...o,...s,jsonLd:[p]}:{...o,...s}},{}),[t,r]),{html:n,loggerMarkup:i}=useMemo(()=>{let o=ve(a),s=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(At,{headTags:o}));return {html:s,loggerMarkup:p}},[a]);return createElement(Fragment,null,n,e&&i)}function F(e,...t){if(e instanceof Function)return F(e(...t),...t);let r={};return Array.isArray(e)?(r=e.reduce((a,n)=>[...a,F(n)],[]),r):e instanceof Object?(Object.entries(e).forEach(([n,i])=>{r[n]=F(i,...t);}),r):e}function Mt({connection:e,children:t=()=>(console.warn("<Pagination> requires children to work properly"),null)}){let a=useNavigation().state==="loading",{endCursor:n,hasNextPage:i,hasPreviousPage:o,nextPageUrl:s,nodes:p,previousPageUrl:d,startCursor:u}=Ut(e),c=useMemo(()=>({pageInfo:{endCursor:n,hasPreviousPage:o,startCursor:u},nodes:p}),[n,o,u,p]),l=useMemo(()=>function(f){return i?createElement(Link,{preventScrollReset:!0,...f,to:s,state:c,replace:!0}):null},[i,s,c]),h=useMemo(()=>function(f){return o?createElement(Link,{preventScrollReset:!0,...f,to:d,state:c,replace:!0}):null},[o,d,c]);return t({state:c,hasNextPage:i,hasPreviousPage:o,isLoading:a,nextPageUrl:s,nodes:p,previousPageUrl:d,NextLink:l,PreviousLink:h})}function Ut(e){let{state:t,search:r}=useLocation(),i=new URLSearchParams(r).get("direction")==="previous",[o,s]=useState(flattenConnection(e)),[p,d]=useState({startCursor:e.pageInfo.startCursor,endCursor:e.pageInfo.endCursor,hasPreviousPage:e.pageInfo.hasPreviousPage,hasNextPage:e.pageInfo.hasNextPage});useEffect(()=>{if(t?.nodes&&s(i?[...flattenConnection(e),...t.nodes]:[...t.nodes,...flattenConnection(e)]),t?.pageInfo){let l=t?.pageInfo?.startCursor===void 0?e.pageInfo.startCursor:t.pageInfo.startCursor,h=t?.pageInfo?.endCursor===void 0?e.pageInfo.endCursor:t.pageInfo.endCursor,S=t?.pageInfo?.hasPreviousPage===void 0?e.pageInfo.hasPreviousPage:t.pageInfo.hasPreviousPage,f=t?.pageInfo?.hasNextPage===void 0?e.pageInfo.hasNextPage:t.pageInfo.hasNextPage;t?.nodes&&(i?(l=e.pageInfo.startCursor,S=e.pageInfo.hasPreviousPage):(h=e.pageInfo.endCursor,f=e.pageInfo.hasNextPage)),d({startCursor:l,endCursor:h,hasPreviousPage:S,hasNextPage:f});}},[t,e]);let u=useMemo(()=>{let l=new URLSearchParams(r);return l.set("direction","previous"),p.startCursor&&l.set("cursor",p.startCursor),`?${l.toString()}`},[r,p.startCursor]),c=useMemo(()=>{let l=new URLSearchParams(r);return l.set("direction","next"),p.endCursor&&l.set("cursor",p.endCursor),`?${l.toString()}`},[r,p.endCursor]);return {...p,previousPageUrl:u,nextPageUrl:c,nodes:o}}function wt(e,t={pageBy:20}){if(!(e instanceof Request))throw new Error("getPaginationVariables must be called with the Request object passed to your loader function");let{pageBy:r}=t,a=new URLSearchParams(new URL(e.url).search),n=a.get("cursor")??void 0;return (a.get("direction")==="previous"?"previous":"next")==="previous"?{last:r,startCursor:n??null}:{first:r,endCursor:n??null}}var qe="cartFormInput";function $({children:e,action:t,inputs:r,route:a}){let n=useFetcher();return jsxs(n.Form,{action:a||"",method:"post",children:[(t||r)&&jsx("input",{type:"hidden",name:qe,value:JSON.stringify({action:t,inputs:r})}),typeof e=="function"?e(n):e]})}$.INPUT_NAME=qe;$.ACTIONS={AttributesUpdateInput:"AttributesUpdateInput",BuyerIdentityUpdate:"BuyerIdentityUpdate",Create:"Create",DiscountCodesUpdate:"DiscountCodesUpdate",LinesAdd:"LinesAdd",LinesRemove:"LinesRemove",LinesUpdate:"LinesUpdate",NoteUpdate:"NoteUpdate",SelectedDeliveryOptionsUpdate:"SelectedDeliveryOptionsUpdate",MetafieldsSet:"MetafieldsSet",MetafieldDelete:"MetafieldDelete"};function vt(e){let t={};for(let o of e.entries()){let s=o[0],p=e.getAll(s);t[s]=p.length>1?p:o[1];}let{cartFormInput:r,...a}=t,{action:n,inputs:i}=r?JSON.parse(String(r)):{};return {action:n,inputs:{...i,...a}}}$.getFormInput=vt;var g=`#graphql
|
|
88
89
|
fragment CartApiError on CartUserError {
|
|
89
90
|
message
|
|
90
91
|
field
|
|
91
92
|
code
|
|
92
93
|
}
|
|
93
|
-
`,
|
|
94
|
+
`,m=`#graphql
|
|
94
95
|
fragment CartApiMutation on Cart {
|
|
95
96
|
id
|
|
96
97
|
totalQuantity
|
|
97
98
|
}
|
|
98
|
-
`;function
|
|
99
|
+
`;function te(e){return async(t,r)=>{let{cartId:a,...n}=r||{},{cartCreate:i}=await e.storefront.mutate(Ft(e.cartFragment),{variables:{input:t,...n}});return i}}var Ft=(e=m)=>`#graphql
|
|
99
100
|
mutation cartCreate(
|
|
100
101
|
$input: CartInput!
|
|
101
102
|
$country: CountryCode = ZZ
|
|
@@ -112,8 +113,8 @@ function ge(e){let t=Array.isArray(e)?e:[e],a="";for(let r of t)r!=null&&(typeof
|
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
${e}
|
|
115
|
-
${
|
|
116
|
-
`;function
|
|
116
|
+
${g}
|
|
117
|
+
`;function re(e){return async t=>{let r=e.getCartId();if(!r)return null;let{cart:a}=await e.storefront.query($t(e.cartFragment),{variables:{cartId:r,...t},cache:e.storefront.CacheNone()});return a}}var $t=(e=qt)=>`#graphql
|
|
117
118
|
query CartQuery(
|
|
118
119
|
$cartId: ID!
|
|
119
120
|
$numCartLines: Int = 100
|
|
@@ -126,7 +127,7 @@ function ge(e){let t=Array.isArray(e)?e:[e],a="";for(let r of t)r!=null&&(typeof
|
|
|
126
127
|
}
|
|
127
128
|
|
|
128
129
|
${e}
|
|
129
|
-
`,
|
|
130
|
+
`,qt=`#graphql
|
|
130
131
|
fragment CartApiQuery on Cart {
|
|
131
132
|
id
|
|
132
133
|
checkoutUrl
|
|
@@ -232,7 +233,7 @@ function ge(e){let t=Array.isArray(e)?e:[e],a="";for(let r of t)r!=null&&(typeof
|
|
|
232
233
|
width
|
|
233
234
|
height
|
|
234
235
|
}
|
|
235
|
-
`;function
|
|
236
|
+
`;function ae(e){return async(t,r)=>{let{cartLinesAdd:a}=await e.storefront.mutate(kt(e.cartFragment),{variables:{cartId:e.getCartId(),lines:t,...r}});return a}}var kt=(e=m)=>`#graphql
|
|
236
237
|
mutation cartLinesAdd(
|
|
237
238
|
$cartId: ID!
|
|
238
239
|
$lines: [CartLineInput!]!
|
|
@@ -250,8 +251,8 @@ function ge(e){let t=Array.isArray(e)?e:[e],a="";for(let r of t)r!=null&&(typeof
|
|
|
250
251
|
}
|
|
251
252
|
|
|
252
253
|
${e}
|
|
253
|
-
${
|
|
254
|
-
`;function
|
|
254
|
+
${g}
|
|
255
|
+
`;function ne(e){return async(t,r)=>{let{cartLinesUpdate:a}=await e.storefront.mutate(_t(e.cartFragment),{variables:{cartId:e.getCartId(),lines:t,...r}});return a}}var _t=(e=m)=>`#graphql
|
|
255
256
|
mutation cartLinesUpdate(
|
|
256
257
|
$cartId: ID!
|
|
257
258
|
$lines: [CartLineUpdateInput!]!
|
|
@@ -269,8 +270,8 @@ function ge(e){let t=Array.isArray(e)?e:[e],a="";for(let r of t)r!=null&&(typeof
|
|
|
269
270
|
}
|
|
270
271
|
|
|
271
272
|
${e}
|
|
272
|
-
${
|
|
273
|
-
`;function
|
|
273
|
+
${g}
|
|
274
|
+
`;function oe(e){return async(t,r)=>{let{cartLinesRemove:a}=await e.storefront.mutate(Qt(e.cartFragment),{variables:{cartId:e.getCartId(),lineIds:t,...r}});return a}}var Qt=(e=m)=>`#graphql
|
|
274
275
|
mutation cartLinesRemove(
|
|
275
276
|
$cartId: ID!
|
|
276
277
|
$lineIds: [ID!]!
|
|
@@ -288,8 +289,8 @@ function ge(e){let t=Array.isArray(e)?e:[e],a="";for(let r of t)r!=null&&(typeof
|
|
|
288
289
|
}
|
|
289
290
|
|
|
290
291
|
${e}
|
|
291
|
-
${
|
|
292
|
-
`;function
|
|
292
|
+
${g}
|
|
293
|
+
`;function ie(e){return async(t,r)=>{let a=t.filter((i,o,s)=>s.indexOf(i)===o),{cartDiscountCodesUpdate:n}=await e.storefront.mutate(Ht(e.cartFragment),{variables:{cartId:e.getCartId(),discountCodes:a,...r}});return n}}var Ht=(e=m)=>`#graphql
|
|
293
294
|
mutation cartDiscountCodesUpdate(
|
|
294
295
|
$cartId: ID!
|
|
295
296
|
$discountCodes: [String!]
|
|
@@ -306,8 +307,8 @@ function ge(e){let t=Array.isArray(e)?e:[e],a="";for(let r of t)r!=null&&(typeof
|
|
|
306
307
|
}
|
|
307
308
|
}
|
|
308
309
|
${e}
|
|
309
|
-
${
|
|
310
|
-
`;function
|
|
310
|
+
${g}
|
|
311
|
+
`;function se(e){return async(t,r)=>{let{cartBuyerIdentityUpdate:a}=await e.storefront.mutate(Gt(e.cartFragment),{variables:{cartId:e.getCartId(),buyerIdentity:t,...r}});return a}}var Gt=(e=m)=>`#graphql
|
|
311
312
|
mutation cartBuyerIdentityUpdate(
|
|
312
313
|
$cartId: ID!
|
|
313
314
|
$buyerIdentity: CartBuyerIdentityInput!
|
|
@@ -324,8 +325,8 @@ function ge(e){let t=Array.isArray(e)?e:[e],a="";for(let r of t)r!=null&&(typeof
|
|
|
324
325
|
}
|
|
325
326
|
}
|
|
326
327
|
${e}
|
|
327
|
-
${
|
|
328
|
-
`;function
|
|
328
|
+
${g}
|
|
329
|
+
`;function pe(e){return async(t,r)=>{let{cartNoteUpdate:a}=await e.storefront.mutate(Vt(e.cartFragment),{variables:{cartId:e.getCartId(),note:t,...r}});return a}}var Vt=(e=m)=>`#graphql
|
|
329
330
|
mutation cartNoteUpdate(
|
|
330
331
|
$cartId: ID!
|
|
331
332
|
$note: String
|
|
@@ -342,8 +343,8 @@ function ge(e){let t=Array.isArray(e)?e:[e],a="";for(let r of t)r!=null&&(typeof
|
|
|
342
343
|
}
|
|
343
344
|
}
|
|
344
345
|
${e}
|
|
345
|
-
${
|
|
346
|
-
`;function
|
|
346
|
+
${g}
|
|
347
|
+
`;function ce(e){return async(t,r)=>{let{cartSelectedDeliveryOptionsUpdate:a}=await e.storefront.mutate(Bt(e.cartFragment),{variables:{cartId:e.getCartId(),selectedDeliveryOptions:t,...r}});return a}}var Bt=(e=m)=>`#graphql
|
|
347
348
|
mutation cartSelectedDeliveryOptionsUpdate(
|
|
348
349
|
$cartId: ID!
|
|
349
350
|
$selectedDeliveryOptions: [CartSelectedDeliveryOptionInput!]!
|
|
@@ -360,8 +361,8 @@ function ge(e){let t=Array.isArray(e)?e:[e],a="";for(let r of t)r!=null&&(typeof
|
|
|
360
361
|
}
|
|
361
362
|
}
|
|
362
363
|
${e}
|
|
363
|
-
${
|
|
364
|
-
`;function
|
|
364
|
+
${g}
|
|
365
|
+
`;function ue(e){return async(t,r)=>{let{cartAttributesUpdate:a}=await e.storefront.mutate(Wt(e.cartFragment),{variables:{cartId:r?.cartId||e.getCartId(),attributes:t}});return a}}var Wt=(e=m)=>`#graphql
|
|
365
366
|
mutation cartAttributesUpdate(
|
|
366
367
|
$cartId: ID!
|
|
367
368
|
$attributes: [AttributeInput!]!
|
|
@@ -376,8 +377,8 @@ function ge(e){let t=Array.isArray(e)?e:[e],a="";for(let r of t)r!=null&&(typeof
|
|
|
376
377
|
}
|
|
377
378
|
}
|
|
378
379
|
${e}
|
|
379
|
-
${
|
|
380
|
-
`;function
|
|
380
|
+
${g}
|
|
381
|
+
`;function de(e){return async(t,r)=>{let a=r?.cartId||e.getCartId(),n=t.map(o=>({...o,ownerId:a})),{cartMetafieldsSet:i}=await e.storefront.mutate(jt(),{variables:{metafields:n}});return {cart:{id:a},errors:i.errors}}}var jt=()=>`#graphql
|
|
381
382
|
mutation cartMetafieldsSet(
|
|
382
383
|
$metafields: [CartMetafieldsSetInput!]!
|
|
383
384
|
$language: LanguageCode
|
|
@@ -392,7 +393,7 @@ function ge(e){let t=Array.isArray(e)?e:[e],a="";for(let r of t)r!=null&&(typeof
|
|
|
392
393
|
}
|
|
393
394
|
}
|
|
394
395
|
}
|
|
395
|
-
`;function
|
|
396
|
+
`;function le(e){return async(t,r)=>{let a=r?.cartId||e.getCartId(),{cartMetafieldDelete:n}=await e.storefront.mutate(Jt(),{variables:{input:{ownerId:a,key:t}}});return {cart:{id:a},errors:n.errors}}}var Jt=()=>`#graphql
|
|
396
397
|
mutation cartMetafieldDelete(
|
|
397
398
|
$input: CartMetafieldDeleteInput!
|
|
398
399
|
) {
|
|
@@ -404,7 +405,7 @@ function ge(e){let t=Array.isArray(e)?e:[e],a="";for(let r of t)r!=null&&(typeof
|
|
|
404
405
|
}
|
|
405
406
|
}
|
|
406
407
|
}
|
|
407
|
-
`;var
|
|
408
|
+
`;var Kt=new Set(["domain","path","max-age","expires","samesite","secure","httponly"]);function ke(e){let t={},r,a,n=0,i=e.split(/;\s*/g),o,s;for(;n<i.length;n++)if(a=i[n],r=a.indexOf("="),~r){if(o=a.substring(0,r++).trim(),s=a.substring(r).trim(),s[0]==='"'&&(s=s.substring(1,s.length-1)),~s.indexOf("%"))try{s=decodeURIComponent(s);}catch{}Kt.has(a=o.toLowerCase())?a==="expires"?t.expires=new Date(s):a==="max-age"?t.maxage=+s:t[a]=s:t[o]=s;}else (o=a.trim().toLowerCase())&&(o==="httponly"||o==="secure")&&(t[o]=!0);return t}function _e(e,t,r={}){let a=e+"="+encodeURIComponent(t);return r.expires&&(a+="; Expires="+new Date(r.expires).toUTCString()),r.maxage!=null&&r.maxage>=0&&(a+="; Max-Age="+(r.maxage|0)),r.domain&&(a+="; Domain="+r.domain),r.path&&(a+="; Path="+r.path),r.samesite&&(a+="; SameSite="+r.samesite),(r.secure||r.samesite==="None")&&(a+="; Secure"),r.httponly&&(a+="; HttpOnly"),a}var Yt=e=>{let t=ke(e.get("Cookie")||"");return ()=>t.cart?`gid://shopify/Cart/${t.cart}`:void 0};var zt=e=>t=>{let r=new Headers;return r.append("Set-Cookie",_e("cart",t.split("/").pop()||"",{path:"/",...e})),r};function Xt(e){let{getCartId:t,setCartId:r,storefront:a,cartQueryFragment:n,cartMutateFragment:i}=e,o={storefront:a,getCartId:t,cartFragment:i},s=t(),p=te(o),d={get:re({storefront:a,getCartId:t,cartFragment:n}),getCartId:t,setCartId:r,create:p,addLines:async(u,c)=>s||c?.cartId?await ae(o)(u,c):await p({lines:u},c),updateLines:ne(o),removeLines:oe(o),updateDiscountCodes:async(u,c)=>s||c?.cartId?await ie(o)(u,c):await p({discountCodes:u},c),updateBuyerIdentity:async(u,c)=>s||c?.cartId?await se(o)(u,c):await p({buyerIdentity:u},c),updateNote:async(u,c)=>s||c?.cartId?await pe(o)(u,c):await p({note:u},c),updateSelectedDeliveryOption:ce(o),updateAttributes:async(u,c)=>s||c?.cartId?await ue(o)(u,c):await p({attributes:u},c),setMetafields:async(u,c)=>s||c?.cartId?await de(o)(u,c):await p({metafields:u},c),deleteMetafield:le(o)};return "customMethods__unstable"in e?{...d,...e.customMethods__unstable??{}}:d}function ar({handle:e,options:t=[],variants:r=[],productPath:a="products",children:n}){let i=r instanceof Array?r:flattenConnection(r),{searchParams:o,path:s,alreadyOnProductPage:p}=or(e,a),d=t.filter(u=>u?.values?.length===1);return createElement(Fragment,null,...useMemo(()=>t.filter(u=>u?.values?.length>1).map(u=>{let c,l=[];for(let h of u.values){let S=new URLSearchParams(p?o:void 0);S.set(u.name,h),d.forEach(T=>{S.set(T.name,T.values[0]);});let f=i.find(T=>T?.selectedOptions?.every(M=>S.get(M?.name)===M?.value)),A=o.get(u.name),y=A?A===h:!1;y&&(c=h);let R="?"+S.toString();l.push({value:h,isAvailable:f?f.availableForSale:!0,to:s+R,search:R,isActive:y});}return n({option:{name:u.name,value:c,values:l}})}),[t,i,n]))}var nr=e=>{if(!(e instanceof Request))throw new TypeError(`Expected a Request instance, got ${typeof e}`);let t=new URL(e.url).searchParams,r=[];return t.forEach((a,n)=>{r.push({name:n,value:a});}),r};function or(e,t){let{pathname:r,search:a}=useLocation();return useMemo(()=>{let n=/(\/[a-zA-Z]{2}-[a-zA-Z]{2}\/)/g.exec(r),i=n&&n.length>0;t=t.startsWith("/")?t.substring(1):t;let o=i?`${n[0]}${t}/${e}`:`/${t}/${e}`;return {searchParams:new URLSearchParams(a),alreadyOnProductPage:o===r,path:o}},[r,a,e,t])}function He(){return sr(ir())}function ir(){try{return crypto.getRandomValues(new Uint8Array(16))}catch{return new Uint8Array(16).map(()=>Math.random()*255|0)}}function sr(e){return Array.from(e,function(t){return ("0"+(t&255).toString(16)).slice(-2)}).join("")}var Ge=createContext(void 0),lr=Ge.Provider,ye=()=>useContext(Ge);function yr(e={}){let t=He(),r=fr(t,e);return {nonce:t,header:r,NonceProvider:({children:n})=>createElement(lr,{value:t},n)}}function fr(e,t={}){let r=`'nonce-${e}'`,n=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 n.scriptSrc instanceof Array&&!n.scriptSrc.includes(r)?n.scriptSrc.push(r):n.defaultSrc instanceof Array&&!n.defaultSrc.includes(r)&&n.defaultSrc.push(r),dr({directives:n})}var mr=forwardRef((e,t)=>{let r=ye();return jsx("script",{...e,nonce:r,ref:t})});//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartCreate
|
|
408
409
|
//! @see https://shopify.dev/docs/api/storefront/latest/queries/cart
|
|
409
410
|
//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartLinesAdd
|
|
410
411
|
//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartLinesUpdate
|
|
@@ -416,6 +417,6 @@ function ge(e){let t=Array.isArray(e)?e:[e],a="";for(let r of t)r!=null&&(typeof
|
|
|
416
417
|
//! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartMetafieldsSet
|
|
417
418
|
//! @see https://shopify.dev/docs/api/storefront/2023-07/mutations/cartMetafieldDelete
|
|
418
419
|
|
|
419
|
-
export {
|
|
420
|
+
export { V as CacheCustom, G as CacheLong, H as CacheNone, I as CacheShort, $ as CartForm, z as InMemoryCache, Mt as Pagination, mr as Script, Ot as Seo, ar as VariantSelector, ue as cartAttributesUpdateDefault, se as cartBuyerIdentityUpdateDefault, te as cartCreateDefault, ie as cartDiscountCodesUpdateDefault, re as cartGetDefault, Yt as cartGetIdDefault, ae as cartLinesAddDefault, oe as cartLinesRemoveDefault, ne as cartLinesUpdateDefault, le as cartMetafieldDeleteDefault, de as cartMetafieldsSetDefault, pe as cartNoteUpdateDefault, ce as cartSelectedDeliveryOptionsUpdateDefault, zt as cartSetIdDefault, Xt as createCartHandler, yr as createContentSecurityPolicy, Gr as createStorefrontClient, jr as createWithCache, P as generateCacheControlHeader, wt as getPaginationVariables, nr as getSelectedProductOptions, mt as graphiqlLoader, ct as isStorefrontApiError, yt as storefrontRedirect, ye as useNonce };
|
|
420
421
|
//# sourceMappingURL=out.js.map
|
|
421
422
|
//# sourceMappingURL=index.js.map
|