@shopify/hydrogen 2.0.0-alpha.2 → 2.0.0-alpha.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/chunk-5MQMAYYE.js +69 -0
- package/dist/development/chunk-5MQMAYYE.js.map +1 -0
- package/dist/development/index.cjs +2322 -35
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +2168 -35
- package/dist/development/index.js.map +1 -1
- package/dist/development/log-seo-tags-7SUOHHPI.js +3 -0
- package/dist/development/log-seo-tags-7SUOHHPI.js.map +1 -0
- package/dist/production/chunk-2226DACX.js +5 -0
- package/dist/production/chunk-2226DACX.js.map +1 -0
- package/dist/production/index.cjs +148 -43
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.d.ts +206 -4
- package/dist/production/index.js +68 -34
- package/dist/production/index.js.map +1 -1
- package/dist/production/log-seo-tags-3MQL2PTY.js +3 -0
- package/dist/production/log-seo-tags-3MQL2PTY.js.map +1 -0
- package/dist/storefront-api-types.d.ts +6742 -0
- package/dist/storefront.schema.json +1 -0
- package/package.json +21 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/storefront.ts","../../src/utils/hash.ts","../../src/cache/strategies.ts","../../src/cache/api.ts","../../src/cache/sub-request.ts","../../src/cache/fetch.ts","../../src/constants.ts","../../src/utils/uuid.ts","../../src/utils/parse-json.ts","../../src/utils/warning.ts","../../src/cache/in-memory.ts","../../src/routing/redirect.ts","../../src/routing/graphiql.ts"],"names":["createStorefrontUtilities","hashKey","queryKey","rawKeys","hash","key","PUBLIC","PRIVATE","NO_STORE","optionMapping","generateCacheControlHeader","cacheOptions","cacheControl","CacheNone","guardExpirableModeType","overrideOptions","CacheShort","CacheLong","CacheCustom","getCacheControlSetting","userCacheOptions","options","generateDefaultCacheControlHeader","getItem","cache","request","response","setItem","cacheControlString","deleteItem","isStale","responseDate","responseMaxAge","maxAgeMatch","result","CacheAPI","getKeyUrl","getCacheOption","getItemFromCache","url","setItemInCache","value","serializeResponse","body","checkGraphQLErrors","swrLock","fetchWithServerCache","requestInit","cacheInstance","cacheKey","shouldCacheResponse","waitUntil","returnType","doFetch","data","cachedItem","cachedValue","cacheInfo","revalidatingPromise","error","init","setItemInCachePromise","STOREFRONT_REQUEST_GROUP_ID_HEADER","STOREFRONT_API_BUYER_IP_HEADER","generateUUID","parseJSON","json","noproto","k","v","warnings","warnOnce","string","StorefrontApiError","isStorefrontApiError","isQueryRE","isMutationRE","minifyQuery","createStorefrontClient","buyerIp","i18n","requestGroupId","clientOptions","getPublicTokenHeaders","getPrivateTokenHeaders","getStorefrontApiUrl","getShopifyDomain","defaultHeaders","fetchStorefrontApi","query","mutation","variables","headers","storefrontApiVersion","userHeaders","queryVariables","errors","throwError","payload","ErrorConstructor","reqId","reqIdMessage","errorMessages","InMemoryCache","#store","requests","match","timestamp","metadata","maxAge","swr","age","cacheKeys","redirect","storefrontRedirect","storefront","pathname","search","redirectFrom","urlRedirects","REDIRECT_QUERY","location","searchParams","redirectTo","isLocalPath","graphiqlLoader","context","accessToken"],"mappings":"AAAA,OACE,0BAA0BA,OAErB,0BCDA,SAASC,EAAQC,EAA4B,CAClD,IAAMC,EAAU,MAAM,QAAQD,CAAQ,EAAIA,EAAW,CAACA,CAAQ,EAC1DE,EAAO,GAMX,QAAWC,KAAOF,EACZE,GAAO,OACL,OAAOA,GAAQ,SAGb,CAAC,CAACA,EAAI,MAAQ,OAAOA,EAAI,MAAS,SACpCD,GAAQC,EAAI,KAEZD,GAAQ,KAAK,UAAUC,CAAG,EAG5BD,GAAQC,GAKd,OAAOD,CACT,CCbA,IAAME,EAAS,SACTC,GAAU,UACHC,GAAW,WAElBC,EAEF,CACF,OAAQ,UACR,qBAAsB,yBACtB,QAAS,WACT,aAAc,gBAChB,EAEO,SAASC,EACdC,EACQ,CACR,IAAMC,EAAyB,CAAC,EAChC,cAAO,KAAKD,CAAY,EAAE,QAASN,GAAgB,CAC7CA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ACnCC,EACJD,EAAQ,WAAW,sBAAsB,EACvC,qCAGJ,OAAO,IAAI,SACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAeevF;AAAA;AAAA;AAAA;AAAA;AAAA,kDAK+BwF;AAAA;AAAA;AAAA;AAAA,qBAI7BxF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQjB,CAAC,OAAQ,IAAK,QAAS,CAAC,eAAgB,WAAW,CAAC,CACtD,CACF","sourcesContent":["import {\n createStorefrontClient as createStorefrontUtilities,\n type StorefrontApiResponseOk,\n} from '@shopify/hydrogen-react';\nimport type {ExecutionArgs} from 'graphql';\nimport {fetchWithServerCache, checkGraphQLErrors} from './cache/fetch';\nimport {\n STOREFRONT_API_BUYER_IP_HEADER,\n STOREFRONT_REQUEST_GROUP_ID_HEADER,\n} from './constants';\nimport {\n CacheNone,\n CacheLong,\n CacheShort,\n CacheCustom,\n generateCacheControlHeader,\n type CachingStrategy,\n} from './cache/strategies';\nimport {generateUUID} from './utils/uuid';\nimport {parseJSON} from './utils/parse-json';\nimport {\n CountryCode,\n LanguageCode,\n} from '@shopify/hydrogen-react/storefront-api-types';\nimport {warnOnce} from './utils/warning';\n\ntype StorefrontApiResponse<T> = StorefrontApiResponseOk<T>;\n\nexport type StorefrontClient = ReturnType<typeof createStorefrontClient>;\nexport type Storefront = StorefrontClient['storefront'];\n\nexport type CreateStorefrontClientOptions = Parameters<\n typeof createStorefrontUtilities\n>[0] & {\n cache?: Cache;\n buyerIp?: string;\n requestGroupId?: string;\n waitUntil?: ExecutionContext['waitUntil'];\n i18n?: {\n language: LanguageCode;\n country: CountryCode;\n pathPrefix?: string;\n };\n};\n\ntype StorefrontCommonOptions = {\n variables?: ExecutionArgs['variableValues'] & {\n country?: CountryCode;\n language?: LanguageCode;\n };\n headers?: HeadersInit;\n storefrontApiVersion?: string;\n};\n\nexport type StorefrontQueryOptions = StorefrontCommonOptions & {\n query: string;\n mutation?: never;\n cache?: CachingStrategy;\n};\n\nexport type StorefrontMutationOptions = StorefrontCommonOptions & {\n query?: never;\n mutation: string;\n cache?: never;\n};\n\nconst StorefrontApiError = class extends Error {} as ErrorConstructor;\nexport const isStorefrontApiError = (error: any) =>\n error instanceof StorefrontApiError;\n\nconst isQueryRE = /(^|}\\s)query[\\s({]/im;\nconst isMutationRE = /(^|}\\s)mutation[\\s({]/im;\n\nfunction minifyQuery(string: string) {\n return string\n .replace(/\\s*#.*$/gm, '') // Remove GQL comments\n .replace(/\\s+/gm, ' ') // Minify spaces\n .trim();\n}\n\nexport function createStorefrontClient({\n cache,\n waitUntil,\n buyerIp,\n i18n = {language: 'EN', country: 'US'},\n requestGroupId = generateUUID(),\n ...clientOptions\n}: CreateStorefrontClientOptions) {\n if (!cache) {\n // TODO: should only warn in development\n warnOnce(\n 'Storefront API client created without a cache instance. This may slow down your sub-requests.',\n );\n }\n\n clientOptions.storeDomain = clientOptions.storeDomain.replace(\n '.myshopify.com',\n '',\n );\n\n const {\n getPublicTokenHeaders,\n getPrivateTokenHeaders,\n getStorefrontApiUrl,\n getShopifyDomain,\n } = createStorefrontUtilities(clientOptions);\n\n const getHeaders = clientOptions.privateStorefrontToken\n ? getPrivateTokenHeaders\n : getPublicTokenHeaders;\n\n const defaultHeaders = getHeaders({contentType: 'json'});\n\n defaultHeaders[STOREFRONT_REQUEST_GROUP_ID_HEADER] = requestGroupId;\n if (buyerIp) defaultHeaders[STOREFRONT_API_BUYER_IP_HEADER] = buyerIp;\n\n async function fetchStorefrontApi<T>({\n query,\n mutation,\n variables,\n cache: cacheOptions,\n headers = [],\n storefrontApiVersion,\n }: StorefrontQueryOptions | StorefrontMutationOptions): Promise<T> {\n const userHeaders =\n headers instanceof Headers\n ? Object.fromEntries(headers.entries())\n : Array.isArray(headers)\n ? Object.fromEntries(headers)\n : headers;\n\n query = query ?? mutation;\n\n const queryVariables = {...variables};\n\n if (i18n) {\n if (!variables?.country && /\\$country/.test(query)) {\n queryVariables.country = i18n.country;\n }\n\n if (!variables?.language && /\\$language/.test(query)) {\n queryVariables.language = i18n.language;\n }\n }\n\n const url = getStorefrontApiUrl({storefrontApiVersion});\n const requestInit = {\n method: 'POST',\n headers: {...defaultHeaders, ...userHeaders},\n body: JSON.stringify({\n query,\n variables: queryVariables,\n }),\n };\n\n const [body, response] = await fetchWithServerCache(url, requestInit, {\n cacheInstance: mutation ? undefined : cache,\n cache: cacheOptions || CacheShort(),\n shouldCacheResponse: checkGraphQLErrors,\n waitUntil,\n });\n\n if (!response.ok) {\n /**\n * The Storefront API might return a string error, or a JSON-formatted {error: string}.\n * We try both and conform them to a single {errors} format.\n */\n let errors;\n try {\n errors = parseJSON(body);\n } catch (_e) {\n errors = [{message: body}];\n }\n\n throwError(response, errors);\n }\n\n const {data, errors} = body as StorefrontApiResponse<T>;\n\n if (errors?.length) throwError(response, errors, StorefrontApiError);\n\n return data as T;\n }\n\n return {\n storefront: {\n /**\n * Sends a GraphQL query to the Storefront API.\n *\n * Example:\n *\n * ```js\n * async function loader ({context: {storefront}}) {\n * const data = await storefront.query('query { ... }', {\n * variables: {},\n * cache: storefront.CacheLong()\n * });\n * }\n * ```\n */\n query: <T>(\n query: string,\n payload?: StorefrontCommonOptions & {cache?: CachingStrategy},\n ) => {\n query = minifyQuery(query);\n if (isMutationRE.test(query))\n throw new Error('storefront.query cannot execute mutations');\n\n return fetchStorefrontApi<T>({...payload, query});\n },\n /**\n * Sends a GraphQL mutation to the Storefront API.\n *\n * Example:\n *\n * ```js\n * async function loader ({context: {storefront}}) {\n * await storefront.mutate('mutation { ... }', {\n * variables: {},\n * });\n * }\n * ```\n */\n mutate: <T>(mutation: string, payload?: StorefrontCommonOptions) => {\n mutation = minifyQuery(mutation);\n if (isQueryRE.test(mutation))\n throw new Error('storefront.mutate cannot execute queries');\n\n return fetchStorefrontApi<T>({...payload, mutation});\n },\n cache,\n CacheNone,\n CacheLong,\n CacheShort,\n CacheCustom,\n generateCacheControlHeader,\n getPublicTokenHeaders,\n getPrivateTokenHeaders,\n getShopifyDomain,\n getApiUrl: getStorefrontApiUrl,\n /**\n * Wether it's a GraphQL error returned in the Storefront API response.\n *\n * Example:\n *\n * ```js\n * async function loader ({context: {storefront}}) {\n * try {\n * await storefront.query(...);\n * } catch(error) {\n * if (storefront.isApiError(error)) {\n * // ...\n * }\n *\n * throw error;\n * }\n * }\n * ```\n */\n isApiError: isStorefrontApiError,\n // Add default value for pathPefix.\n i18n: {pathPrefix: '', ...i18n},\n },\n };\n}\n\nfunction throwError<T>(\n response: Response,\n errors: StorefrontApiResponse<T>['errors'],\n ErrorConstructor = Error,\n) {\n const reqId = response.headers.get('x-request-id');\n const reqIdMessage = reqId ? ` - Request ID: ${reqId}` : '';\n\n if (errors) {\n const errorMessages =\n typeof errors === 'string'\n ? errors\n : errors.map((error) => error.message).join('\\n');\n\n throw new ErrorConstructor(errorMessages + reqIdMessage);\n }\n\n throw new ErrorConstructor(\n `API response error: ${response.status}` + reqIdMessage,\n );\n}\n","type QueryKey = string | readonly unknown[];\n\nexport function hashKey(queryKey: QueryKey): string {\n const rawKeys = Array.isArray(queryKey) ? queryKey : [queryKey];\n let hash = '';\n\n // Keys from `storefront.query` are in the following shape:\n // ['prefix', 'api-endpoint', {body:'query',headers:{}}]\n // Since the API endpoint already contains the shop domain and api version,\n // we can ignore the headers and only use the `body` from the payload.\n for (const key of rawKeys) {\n if (key != null) {\n if (typeof key === 'object') {\n // Queries from useQuery might not have a `body`. In that case,\n // fallback to a safer (but slower) stringify.\n if (!!key.body && typeof key.body === 'string') {\n hash += key.body;\n } else {\n hash += JSON.stringify(key);\n }\n } else {\n hash += key;\n }\n }\n }\n\n return hash;\n}\n","export interface AllCacheOptions {\n mode?: string;\n maxAge?: number;\n staleWhileRevalidate?: number;\n sMaxAge?: number;\n staleIfError?: number;\n}\n\nexport type CachingStrategy = AllCacheOptions;\n\nexport type NoStoreStrategy = {\n mode: string;\n};\n\nconst PUBLIC = 'public';\nconst PRIVATE = 'private';\nexport const NO_STORE = 'no-store';\n\nconst optionMapping: {\n [key: string]: string;\n} = {\n maxAge: 'max-age',\n staleWhileRevalidate: 'stale-while-revalidate',\n sMaxAge: 's-maxage',\n staleIfError: 'stale-if-error',\n};\n\nexport function generateCacheControlHeader(\n cacheOptions: CachingStrategy,\n): string {\n const cacheControl: string[] = [];\n Object.keys(cacheOptions).forEach((key: string) => {\n if (key === 'mode') {\n cacheControl.push(cacheOptions[key] as string);\n } else if (optionMapping[key]) {\n cacheControl.push(\n `${optionMapping[key]}=${cacheOptions[key as keyof CachingStrategy]}`,\n );\n }\n });\n return cacheControl.join(', ');\n}\n\n/**\n *\n * @public\n */\nexport function CacheNone(): NoStoreStrategy {\n return {\n mode: NO_STORE,\n };\n}\n\nfunction guardExpirableModeType(overrideOptions?: CachingStrategy) {\n if (\n overrideOptions?.mode &&\n overrideOptions?.mode !== PUBLIC &&\n overrideOptions?.mode !== PRIVATE\n ) {\n throw Error(\"'mode' must be either 'public' or 'private'\");\n }\n}\n\n/**\n *\n * @public\n */\nexport function CacheShort(overrideOptions?: CachingStrategy): AllCacheOptions {\n guardExpirableModeType(overrideOptions);\n return {\n mode: PUBLIC,\n maxAge: 1,\n staleWhileRevalidate: 9,\n ...overrideOptions,\n };\n}\n\n/**\n *\n * @public\n */\nexport function CacheLong(overrideOptions?: CachingStrategy): AllCacheOptions {\n guardExpirableModeType(overrideOptions);\n return {\n mode: PUBLIC,\n maxAge: 3600, // 1 hour\n staleWhileRevalidate: 82800, // 23 Hours\n ...overrideOptions,\n };\n}\n\n/**\n *\n * @public\n */\nexport function CacheCustom(overrideOptions: CachingStrategy): AllCacheOptions {\n return overrideOptions as AllCacheOptions;\n}\n","import type {CachingStrategy} from './strategies';\nimport {CacheShort, generateCacheControlHeader} from './strategies';\n\nfunction logCacheApiStatus(status: string | null, url: string) {\n // // eslint-disable-next-line no-console\n // console.log('\\n' + status, url);\n}\n\nfunction getCacheControlSetting(\n userCacheOptions?: CachingStrategy,\n options?: CachingStrategy,\n): CachingStrategy {\n if (userCacheOptions && options) {\n return {\n ...userCacheOptions,\n ...options,\n };\n } else {\n return userCacheOptions || CacheShort();\n }\n}\n\nfunction generateDefaultCacheControlHeader(\n userCacheOptions?: CachingStrategy,\n): string {\n return generateCacheControlHeader(getCacheControlSetting(userCacheOptions));\n}\n\n/**\n * Get an item from the cache. If a match is found, returns a tuple\n * containing the `JSON.parse` version of the response as well\n * as the response itself so it can be checked for staleness.\n */\nasync function getItem(\n cache: Cache,\n request: Request,\n): Promise<Response | undefined> {\n if (!cache) return;\n\n const response = await cache.match(request);\n if (!response) {\n logCacheApiStatus('MISS', request.url);\n return;\n }\n\n logCacheApiStatus('HIT', request.url);\n\n return response;\n}\n\n/**\n * Put an item into the cache.\n */\nasync function setItem(\n cache: Cache,\n request: Request,\n response: Response,\n userCacheOptions: CachingStrategy,\n) {\n if (!cache) return;\n\n /**\n * We are manually managing staled request by adding this workaround.\n * Why? cache control header support is dependent on hosting platform\n *\n * For example:\n *\n * Cloudflare's Cache API does not support `stale-while-revalidate`.\n * Cloudflare cache control header has a very odd behaviour.\n * Say we have the following cache control header on a request:\n *\n * public, max-age=15, stale-while-revalidate=30\n *\n * When there is a cache.match HIT, the cache control header would become\n *\n * public, max-age=14400, stale-while-revalidate=30\n *\n * == `stale-while-revalidate` workaround ==\n * Update response max-age so that:\n *\n * max-age = max-age + stale-while-revalidate\n *\n * For example:\n *\n * public, max-age=1, stale-while-revalidate=9\n * |\n * V\n * public, max-age=10, stale-while-revalidate=9\n *\n * Store the following information in the response header:\n *\n * cache-put-date - UTC time string of when this request is PUT into cache\n *\n * Note on `cache-put-date`: The `response.headers.get('date')` isn't static. I am\n * not positive what date this is returning but it is never over 500 ms\n * after subtracting from the current timestamp.\n *\n * `isStale` function will use the above information to test for stale-ness of a cached response\n */\n\n const cacheControl = getCacheControlSetting(userCacheOptions);\n\n // The padded cache-control to mimic stale-while-revalidate\n request.headers.set(\n 'cache-control',\n generateDefaultCacheControlHeader(\n getCacheControlSetting(cacheControl, {\n maxAge:\n (cacheControl.maxAge || 0) + (cacheControl.staleWhileRevalidate || 0),\n }),\n ),\n );\n // The cache-control we want to set on response\n const cacheControlString = generateDefaultCacheControlHeader(\n getCacheControlSetting(cacheControl),\n );\n\n // CF will override cache-control, so we need to keep a non-modified real-cache-control\n // cache-control is still necessary for mini-oxygen\n response.headers.set('cache-control', cacheControlString);\n response.headers.set('real-cache-control', cacheControlString);\n response.headers.set('cache-put-date', new Date().toUTCString());\n\n logCacheApiStatus('PUT', request.url);\n await cache.put(request, response);\n}\n\nasync function deleteItem(cache: Cache, request: Request) {\n if (!cache) return;\n\n logCacheApiStatus('DELETE', request.url);\n await cache.delete(request);\n}\n\n/**\n * Manually check the response to see if it's stale.\n */\nfunction isStale(request: Request, response: Response) {\n const responseDate = response.headers.get('cache-put-date');\n const cacheControl = response.headers.get('real-cache-control');\n let responseMaxAge = 0;\n\n if (cacheControl) {\n const maxAgeMatch = cacheControl.match(/max-age=(\\d*)/);\n if (maxAgeMatch && maxAgeMatch.length > 1) {\n responseMaxAge = parseFloat(maxAgeMatch[1]);\n }\n }\n\n if (!responseDate) {\n return false;\n }\n\n const ageInMs =\n new Date().valueOf() - new Date(responseDate as string).valueOf();\n const age = ageInMs / 1000;\n\n const result = age > responseMaxAge;\n\n if (result) {\n logCacheApiStatus('STALE', request.url);\n }\n\n return result;\n}\n\n/**\n *\n * @private\n */\nexport const CacheAPI = {\n get: getItem,\n set: setItem,\n delete: deleteItem,\n generateDefaultCacheControlHeader,\n isStale,\n};\n","import {CacheAPI} from './api';\nimport {\n CacheShort,\n type CachingStrategy,\n type AllCacheOptions,\n} from './strategies.js';\n\n/**\n * Wrapper Cache functions for sub queries\n */\n\n/**\n * Cache API is weird. We just need a full URL, so we make one up.\n */\nfunction getKeyUrl(key: string) {\n return `https://shopify.dev/?${key}`;\n}\n\nfunction getCacheOption(userCacheOptions?: CachingStrategy): AllCacheOptions {\n return userCacheOptions || CacheShort();\n}\n\nexport function generateSubRequestCacheControlHeader(\n userCacheOptions?: CachingStrategy,\n): string {\n return CacheAPI.generateDefaultCacheControlHeader(\n getCacheOption(userCacheOptions),\n );\n}\n\n/**\n * Get an item from the cache. If a match is found, returns a tuple\n * containing the `JSON.parse` version of the response as well\n * as the response itself so it can be checked for staleness.\n * @private\n */\nexport async function getItemFromCache(\n cache: Cache,\n key: string,\n): Promise<undefined | [any, Response]> {\n if (!cache) return;\n const url = getKeyUrl(key);\n const request = new Request(url);\n\n const response = await CacheAPI.get(cache, request);\n\n if (!response) {\n return;\n }\n\n return [await response.json(), response];\n}\n\n/**\n * Put an item into the cache.\n * @private\n */\nexport async function setItemInCache(\n cache: Cache,\n key: string,\n value: any,\n userCacheOptions?: CachingStrategy,\n) {\n if (!cache) return;\n\n const url = getKeyUrl(key);\n const request = new Request(url);\n const response = new Response(JSON.stringify(value));\n\n await CacheAPI.set(\n cache,\n request,\n response,\n getCacheOption(userCacheOptions),\n );\n}\n\n/**\n *\n * @private\n */\nexport async function deleteItemFromCache(cache: Cache, key: string) {\n if (!cache) return;\n\n const url = getKeyUrl(key);\n const request = new Request(url);\n\n await CacheAPI.delete(cache, request);\n}\n\n/**\n * Manually check the response to see if it's stale.\n * @private\n */\nexport function isStale(key: string, response: Response) {\n return CacheAPI.isStale(new Request(getKeyUrl(key)), response);\n}\n","import {hashKey} from '../utils/hash.js';\nimport {CacheShort, CachingStrategy} from './strategies';\nimport {getItemFromCache, setItemInCache, isStale} from './sub-request';\n\nexport type FetchCacheOptions = {\n cache?: CachingStrategy;\n cacheInstance?: Cache;\n cacheKey?: string | readonly unknown[];\n shouldCacheResponse?: (body: any, response: Response) => boolean;\n waitUntil?: ExecutionContext['waitUntil'];\n returnType?: 'json' | 'text' | 'arrayBuffer' | 'blob';\n};\n\nfunction serializeResponse(body: any, response: Response) {\n return [\n body,\n {\n status: response.status,\n statusText: response.statusText,\n headers: Array.from(response.headers.entries()),\n },\n ];\n}\n\n// Check if the response body has GraphQL errors\n// https://spec.graphql.org/June2018/#sec-Response-Format\nexport const checkGraphQLErrors = (body: any) => !body?.errors;\n\n// Lock to prevent revalidating the same sub-request\n// in the same isolate. Note that different isolates\n// in the same colo could duplicate the revalidation\n// since this is only an in-memory lock.\n// https://github.com/Shopify/oxygen-platform/issues/625\nconst swrLock = new Set<string>();\n\n/**\n * `fetch` equivalent that stores responses in cache.\n * Useful for calling third-party APIs that need to be cached.\n * @private\n */\nexport async function fetchWithServerCache(\n url: string,\n requestInit: Request | RequestInit,\n {\n cacheInstance,\n cache: cacheOptions,\n cacheKey = [url, requestInit],\n shouldCacheResponse = () => true,\n waitUntil,\n returnType = 'json',\n }: FetchCacheOptions = {},\n): Promise<readonly [any, Response]> {\n if (!cacheOptions && (!requestInit.method || requestInit.method === 'GET')) {\n cacheOptions = CacheShort();\n }\n\n const doFetch = async () => {\n const response = await fetch(url, requestInit);\n let data;\n\n try {\n data = await response[returnType]();\n } catch {\n data = await response.text();\n }\n\n return [data, response] as const;\n };\n\n if (!cacheInstance || !cacheKey || !cacheOptions) return doFetch();\n\n const key = hashKey([\n // '__HYDROGEN_CACHE_ID__', // TODO purgeQueryCacheOnBuild\n ...(typeof cacheKey === 'string' ? [cacheKey] : cacheKey),\n ]);\n\n const cachedItem = await getItemFromCache(cacheInstance, key);\n // console.log('--- Cache', cachedItem ? 'HIT' : 'MISS');\n\n if (cachedItem) {\n const [cachedValue, cacheInfo] = cachedItem;\n\n if (!swrLock.has(key) && isStale(key, cacheInfo)) {\n swrLock.add(key);\n\n // Important: Run revalidation asynchronously.\n const revalidatingPromise = Promise.resolve().then(async () => {\n try {\n const [body, response] = await doFetch();\n\n if (shouldCacheResponse(body, response)) {\n await setItemInCache(\n cacheInstance,\n key,\n serializeResponse(body, response),\n cacheOptions,\n );\n }\n } catch (error: any) {\n if (error.message) {\n error.message = 'SWR in sub-request failed: ' + error.message;\n }\n\n console.error(error);\n } finally {\n swrLock.delete(key);\n }\n });\n\n // Asynchronously wait for it in workers\n waitUntil?.(revalidatingPromise);\n }\n\n const [body, init] = cachedValue;\n return [body, new Response(body, init)];\n }\n\n const [body, response] = await doFetch();\n\n /**\n * Important: Do this async\n */\n if (shouldCacheResponse(body, response)) {\n const setItemInCachePromise = setItemInCache(\n cacheInstance,\n key,\n serializeResponse(body, response),\n cacheOptions,\n );\n\n waitUntil?.(setItemInCachePromise);\n }\n\n return [body, response];\n}\n","export const STOREFRONT_REQUEST_GROUP_ID_HEADER =\n 'Custom-Storefront-Request-Group-ID';\nexport const STOREFRONT_API_BUYER_IP_HEADER = 'Shopify-Storefront-Buyer-IP';\n","/*\n * Generate a UUID using crypto and fallback to Math.random if crypto is not available.\n */\nexport function generateUUID() {\n if (typeof crypto !== 'undefined' && !!crypto.randomUUID) {\n return crypto.randomUUID();\n } else {\n return `weak-${Math.random().toString(16).substring(2)}`;\n }\n}\n","export function parseJSON(json: any) {\n if (String(json).includes('__proto__')) return JSON.parse(json, noproto);\n return JSON.parse(json);\n}\nfunction noproto(k: string, v: string) {\n if (k !== '__proto__') return v;\n}\n","const warnings = new Set<string>();\nexport const warnOnce = (string: string) => {\n if (!warnings.has(string)) {\n console.warn(string);\n warnings.add(string);\n }\n};\n","type CacheMatch = {\n body: Uint8Array;\n timestamp: number;\n status: number;\n headers: [string, string][];\n};\n\n/**\n * This is a limited implementation of an in-memory cache.\n * It only supports the `cache-control` header.\n * It does NOT support `age` or `expires` headers.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Cache\n */\nexport class InMemoryCache implements Cache {\n #store: Map<string, CacheMatch>;\n\n constructor() {\n this.#store = new Map();\n }\n\n add(request: RequestInfo): Promise<void> {\n throw new Error('Method not implemented. Use `put` instead.');\n }\n\n addAll(requests: RequestInfo[]): Promise<void> {\n throw new Error('Method not implemented. Use `put` instead.');\n }\n\n matchAll(\n request?: RequestInfo,\n options?: CacheQueryOptions,\n ): Promise<readonly Response[]> {\n throw new Error('Method not implemented. Use `match` instead.');\n }\n\n async put(request: Request, response: Response) {\n if (request.method !== 'GET') {\n throw new TypeError('Cannot cache response to non-GET request.');\n }\n\n if (response.status === 206) {\n throw new TypeError(\n 'Cannot cache response to a range request (206 Partial Content).',\n );\n }\n\n if (response.headers.get('vary')?.includes('*')) {\n throw new TypeError(\"Cannot cache response with 'Vary: *' header.\");\n }\n\n this.#store.set(request.url, {\n body: new Uint8Array(await response.arrayBuffer()),\n status: response.status,\n headers: [...response.headers],\n timestamp: Date.now(),\n });\n }\n\n async match(request: Request) {\n if (request.method !== 'GET') return;\n\n const match = this.#store.get(request.url);\n\n if (!match) {\n return;\n }\n\n const {body, timestamp, ...metadata} = match;\n\n const headers = new Headers(metadata.headers);\n const cacheControl =\n headers.get('cache-control') || headers.get('real-cache-control') || '';\n const maxAge = parseInt(\n cacheControl.match(/max-age=(\\d+)/)?.[1] || '0',\n 10,\n );\n const swr = parseInt(\n cacheControl.match(/stale-while-revalidate=(\\d+)/)?.[1] || '0',\n 10,\n );\n const age = (Date.now() - timestamp) / 1000;\n\n const isMiss = age > maxAge + swr;\n\n if (isMiss) {\n this.#store.delete(request.url);\n return;\n }\n\n const isStale = age > maxAge;\n\n headers.set('cache', isStale ? 'STALE' : 'HIT');\n headers.set('date', new Date(timestamp).toUTCString());\n\n return new Response(body, {\n status: metadata.status ?? 200,\n headers,\n });\n }\n\n async delete(request: Request) {\n if (this.#store.has(request.url)) {\n this.#store.delete(request.url);\n return true;\n }\n return false;\n }\n\n keys(request?: Request) {\n const cacheKeys = [] as Request[];\n\n for (const url of this.#store.keys()) {\n if (!request || request.url === url) {\n cacheKeys.push(new Request(url));\n }\n }\n\n return Promise.resolve(cacheKeys);\n }\n}\n","import {redirect} from '@remix-run/server-runtime';\nimport type {UrlRedirectConnection} from '@shopify/hydrogen-react/storefront-api-types';\nimport type {Storefront} from '../storefront';\n\ntype StorefrontRedirect = {\n storefront: Storefront;\n request: Request;\n response?: Response;\n};\n\n/**\n * Queries the Storefront API to see if there is any redirect\n * created for the current route and performs it. Otherwise,\n * it returns the response passed in the parameters. Useful for\n * conditionally redirecting after a 404 response.\n *\n * @see {@link https://help.shopify.com/en/manual/online-store/menus-and-links/url-redirect Creating URL redirects in Shopify}\n */\nexport async function storefrontRedirect({\n storefront,\n request,\n response = new Response('Not Found', {status: 404}),\n}: StorefrontRedirect): Promise<Response> {\n const {pathname, search} = new URL(request.url);\n const redirectFrom = pathname + search;\n\n try {\n const {urlRedirects} = await storefront.query<{\n urlRedirects: UrlRedirectConnection;\n }>(REDIRECT_QUERY, {\n variables: {query: 'path:' + redirectFrom},\n storefrontApiVersion: '2023-01',\n });\n\n const location = urlRedirects?.edges?.[0]?.node?.target;\n\n if (location) {\n return new Response(null, {status: 302, headers: {location}});\n }\n\n const searchParams = new URLSearchParams(search);\n const redirectTo =\n searchParams.get('return_to') || searchParams.get('redirect');\n\n if (redirectTo) {\n if (isLocalPath(redirectTo)) {\n return redirect(redirectTo);\n } else {\n console.warn(\n `Cross-domain redirects are not supported. Tried to redirect from ${redirectFrom} to ${redirectTo}`,\n );\n }\n }\n } catch (error) {\n console.error(\n `Failed to fetch redirects from Storefront API for route ${redirectFrom}`,\n error,\n );\n }\n\n return response;\n}\n\nfunction isLocalPath(url: string) {\n try {\n // We don't want to redirect cross domain,\n // doing so could create fishing vulnerability\n // If `new URL()` succeeds, it's a fully qualified\n // url which is cross domain. If it fails, it's just\n // a path, which will be the current domain.\n new URL(url);\n } catch (e) {\n return true;\n }\n\n return false;\n}\n\nconst REDIRECT_QUERY = `#graphql\n query redirects($query: String) {\n urlRedirects(first: 1, query: $query) {\n edges {\n node {\n target\n }\n }\n }\n }\n`;\n","import type {LoaderArgs} from '@remix-run/server-runtime';\nimport type {StorefrontClient} from '../storefront';\n\nexport function graphiqlLoader(\n {context} = {} as LoaderArgs & {\n context: LoaderArgs['context'] & StorefrontClient;\n },\n) {\n if (!context?.storefront) {\n throw new Error(\n `GraphiQL: Hydrogen's storefront client must be injected in the loader context.`,\n );\n }\n\n const url = context.storefront.getApiUrl();\n const accessToken =\n context.storefront.getPublicTokenHeaders()[\n 'X-Shopify-Storefront-Access-Token'\n ];\n\n return new Response(\n `\n<!DOCTYPE html>\n<html>\n<head>\n <meta charset=utf-8/>\n <meta name=\"viewport\" content=\"user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, minimal-ui\">\n <title>Shopify Storefront API</title>\n <link rel=\"stylesheet\" href=\"//cdn.jsdelivr.net/npm/graphql-playground-react/build/static/css/index.css\" />\n <link rel=\"shortcut icon\" href=\"//cdn.jsdelivr.net/npm/graphql-playground-react/build/favicon.png\" />\n <script src=\"//cdn.jsdelivr.net/npm/graphql-playground-react/build/static/js/middleware.js\"></script>\n</head>\n<body>\n <div id=\"root\"></div>\n <script>window.addEventListener('load', function (event) {\n GraphQLPlayground.init(document.getElementById('root'), {\n endpoint: '${url}',\n settings:{\n 'request.globalHeaders': {\n Accept: 'application/json',\n 'Content-Type': 'application/graphql',\n 'X-Shopify-Storefront-Access-Token': '${accessToken}'\n }\n },\n tabs: [{\n endpoint: '${url}',\n query: '{ shop { name } }'\n }]\n })\n })</script>\n</body>\n</html>\n `,\n {status: 200, headers: {'content-type': 'text/html'}},\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../../node_modules/react/cjs/react.production.min.js","../../../../node_modules/react/index.js","../../src/seo/log-seo-tags.ts","../../src/storefront.ts","../../src/utils/hash.ts","../../src/cache/strategies.ts","../../src/cache/api.ts","../../src/cache/sub-request.ts","../../src/cache/fetch.ts","../../src/constants.ts","../../src/utils/uuid.ts","../../src/utils/parse-json.ts","../../src/utils/warning.ts","../../src/cache/in-memory.ts","../../src/routing/redirect.ts","../../src/routing/graphiql.ts","../../src/seo/seo.ts","../../src/seo/generate-seo-tags.ts","../../src/index.ts"],"names":["require_react_production_min","__commonJSMin","exports","l","n","p","q","r","t","u","v","w","x","y","z","A","a","B","C","D","b","e","F","G","H","I","J","K","L","M","d","c","k","h","g","f","m","N","O","escape","P","Q","R","S","T","U","V","W","require_react","module","log_seo_tags_exports","__export","Logger","logSeoTags","headTags","style","style2","tag","key","val","init_log_seo_tags","__esmMin","createStorefrontUtilities","hashKey","queryKey","rawKeys","hash","PUBLIC","PRIVATE","NO_STORE","optionMapping","generateCacheControlHeader","cacheOptions","cacheControl","CacheNone","guardExpirableModeType","overrideOptions","CacheShort","CacheLong","CacheCustom","getCacheControlSetting","userCacheOptions","options","generateDefaultCacheControlHeader","getItem","cache","request","response","setItem","cacheControlString","deleteItem","isStale","responseDate","responseMaxAge","maxAgeMatch","result","CacheAPI","getKeyUrl","getCacheOption","getItemFromCache","url","setItemInCache","value","serializeResponse","body","checkGraphQLErrors","swrLock","fetchWithServerCache","requestInit","cacheInstance","cacheKey","shouldCacheResponse","waitUntil","returnType","doFetch","data","cachedItem","cachedValue","cacheInfo","revalidatingPromise","error","init","setItemInCachePromise","STOREFRONT_REQUEST_GROUP_ID_HEADER","STOREFRONT_API_BUYER_IP_HEADER","generateUUID","parseJSON","json","noproto","warnings","warnOnce","string","StorefrontApiError","isStorefrontApiError","isQueryRE","isMutationRE","minifyQuery","createStorefrontClient","buyerIp","i18n","requestGroupId","clientOptions","getPublicTokenHeaders","getPrivateTokenHeaders","getStorefrontApiUrl","getShopifyDomain","defaultHeaders","fetchStorefrontApi","query","mutation","variables","headers","storefrontApiVersion","userHeaders","queryVariables","errors","throwError","payload","ErrorConstructor","reqId","reqIdMessage","errorMessages","InMemoryCache","#store","requests","match","timestamp","metadata","maxAge","swr","age","cacheKeys","redirect","storefrontRedirect","storefront","pathname","search","redirectFrom","urlRedirects","REDIRECT_QUERY","location","searchParams","redirectTo","isLocalPath","graphiqlLoader","context","accessToken","import_react","useMatches","useLocation","generateSeoTags","input","output","ldJson","entries","tagResults","title","renderTitle","generateTag","inferSchemaType","values","media","type","normalizedMedia","inferMimeType","alternates","alternate","language","defaultLang","hreflang","additionalTags","tagName","group","generateKey","props","priority","template","ext","defaultType","typeMatches","route","pattern","SeoLogger","React","Seo","debug","matches","seoConfig","handle","routeMatch","routeInfo","recursivelyInvokeOrReturn","acc","current","html","loggerMarkup","rest","item","AnalyticsEventName","AnalyticsPageType","ExternalVideo","flattenConnection","getClientBrowserParameters","getShopifyCookies","Image","MediaFile","ModelViewer","Money","parseMetafield","sendShopifyAnalytics","ShopifyAppSource","ShopPayButton","storefrontApiCustomScalars","useShopifyCookies","useMoney","Video"],"mappings":"knBAAA,IAAAA,GAAAC,GAAAC,GAAA,cASa,IAAIC,EAAE,OAAO,IAAI,eAAe,EAAEC,GAAE,OAAO,IAAI,cAAc,EAAEC,GAAE,OAAO,IAAI,gBAAgB,EAAEC,GAAE,OAAO,IAAI,mBAAmB,EAAEC,GAAE,OAAO,IAAI,gBAAgB,EAAEC,GAAE,OAAO,IAAI,gBAAgB,EAAEC,GAAE,OAAO,IAAI,eAAe,EAAEC,GAAE,OAAO,IAAI,mBAAmB,EAAEC,GAAE,OAAO,IAAI,gBAAgB,EAAEC,GAAE,OAAO,IAAI,YAAY,EAAEC,GAAE,OAAO,IAAI,YAAY,EAAEC,GAAE,OAAO,SAAS,SAASC,GAAEC,EAAE,CAAC,OAAUA,IAAP,MAAqB,OAAOA,GAAlB,SAA2B,MAAKA,EAAEF,IAAGE,EAAEF,KAAIE,EAAE,cAAiC,OAAOA,GAApB,WAAsBA,EAAE,KAAI,CAC1e,IAAIC,GAAE,CAAC,UAAU,UAAU,CAAC,MAAM,EAAE,EAAE,mBAAmB,UAAU,CAAC,EAAE,oBAAoB,UAAU,CAAC,EAAE,gBAAgB,UAAU,CAAC,CAAC,EAAEC,GAAE,OAAO,OAAOC,GAAE,CAAC,EAAE,SAAS,EAAEH,EAAEI,EAAEC,EAAE,CAAC,KAAK,MAAML,EAAE,KAAK,QAAQI,EAAE,KAAK,KAAKD,GAAE,KAAK,QAAQE,GAAGJ,EAAC,CAAC,EAAE,UAAU,iBAAiB,CAAC,EACpQ,EAAE,UAAU,SAAS,SAASD,EAAEI,EAAE,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A,EAAI,IACT,wBAAyB,CAAC,OAAQA,EAAI,QAAQ,CAChD,CAAC,EAGI,EAAAsK,QAAM,cACXtK,EAAI,IACJ,CAAC,GAAGA,EAAI,MAAO,IAAKA,EAAI,GAAG,EAC3BA,EAAI,QACN,CACD,EAEKkL,EAAe,EAAAZ,QAAM,cACzB,EAAAA,QAAM,SACN,CAAC,SAAU,IAAI,EACf,EAAAA,QAAM,cAAcD,GAAW,CAAC,SAAAxK,CAAQ,CAAC,CAC3C,EAEA,OAAO,EAAAyK,QAAM,cAAc,EAAAA,QAAM,SAAU,KAAMW,EAAMT,GAASU,CAAY,CAC9E,CAEO,SAASJ,EACdjI,KACGsI,EACoB,CACvB,GAAItI,aAAiB,SACnB,OAAOiI,EAAgCjI,EAAM,GAAGsI,CAAI,EAAG,GAAGA,CAAI,EAGhE,IAAI7I,EAA4B,CAAC,EAEjC,OAAI,MAAM,QAAQO,CAAK,GACrBP,EAASO,EAAM,OAAO,CAACkI,EAAKK,IACnB,CAAC,GAAGL,EAAKD,EAA0BM,CAAI,CAAC,EAC9C,CAAC,CAAC,EAEE9I,GAGLO,aAAiB,QACH,OAAO,QAAQA,CAAK,EAE5B,QAAQ,CAAC,CAAC5C,EAAKC,CAAG,IAAM,CAE9BoC,EAAOrC,GAAO6K,EAAgC5K,EAAK,GAAGiL,CAAI,CAC5D,CAAC,EAEM7I,GAGFO,CACT,CEvGA,OACE,sBAAAwI,GACA,qBAAAC,GACA,iBAAAC,GACA,qBAAAC,GACA,8BAAAC,GACA,qBAAAC,GACA,SAAAC,GACA,aAAAC,GACA,eAAAC,GACA,SAAAC,GACA,kBAAAC,GACA,wBAAAC,GACA,oBAAAC,GACA,iBAAAC,GACA,8BAAAC,GACA,qBAAAC,GACA,YAAAC,GACA,SAAAC,OACK","sourcesContent":["/**\n * @license React\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var l=Symbol.for(\"react.element\"),n=Symbol.for(\"react.portal\"),p=Symbol.for(\"react.fragment\"),q=Symbol.for(\"react.strict_mode\"),r=Symbol.for(\"react.profiler\"),t=Symbol.for(\"react.provider\"),u=Symbol.for(\"react.context\"),v=Symbol.for(\"react.forward_ref\"),w=Symbol.for(\"react.suspense\"),x=Symbol.for(\"react.memo\"),y=Symbol.for(\"react.lazy\"),z=Symbol.iterator;function A(a){if(null===a||\"object\"!==typeof a)return null;a=z&&a[z]||a[\"@@iterator\"];return\"function\"===typeof a?a:null}\nvar B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}E.prototype.isReactComponent={};\nE.prototype.setState=function(a,b){if(\"object\"!==typeof a&&\"function\"!==typeof a&&null!=a)throw Error(\"setState(...): takes an object of state variables to update or a function which returns an object of state variables.\");this.updater.enqueueSetState(this,a,b,\"setState\")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,\"forceUpdate\")};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}var H=G.prototype=new F;\nH.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};\nfunction M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=\"\"+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1<g){for(var f=Array(g),m=0;m<g;m++)f[m]=arguments[m+2];c.children=f}if(a&&a.defaultProps)for(d in g=a.defaultProps,g)void 0===c[d]&&(c[d]=g[d]);return{$$typeof:l,type:a,key:k,ref:h,props:c,_owner:K.current}}\nfunction N(a,b){return{$$typeof:l,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function O(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===l}function escape(a){var b={\"=\":\"=0\",\":\":\"=2\"};return\"$\"+a.replace(/[=:]/g,function(a){return b[a]})}var P=/\\/+/g;function Q(a,b){return\"object\"===typeof a&&null!==a&&null!=a.key?escape(\"\"+a.key):b.toString(36)}\nfunction R(a,b,e,d,c){var k=typeof a;if(\"undefined\"===k||\"boolean\"===k)a=null;var h=!1;if(null===a)h=!0;else switch(k){case \"string\":case \"number\":h=!0;break;case \"object\":switch(a.$$typeof){case l:case n:h=!0}}if(h)return h=a,c=c(h),a=\"\"===d?\".\"+Q(h,0):d,I(c)?(e=\"\",null!=a&&(e=a.replace(P,\"$&/\")+\"/\"),R(c,b,e,\"\",function(a){return a})):null!=c&&(O(c)&&(c=N(c,e+(!c.key||h&&h.key===c.key?\"\":(\"\"+c.key).replace(P,\"$&/\")+\"/\")+a)),b.push(c)),1;h=0;d=\"\"===d?\".\":d+\":\";if(I(a))for(var g=0;g<a.length;g++){k=\na[g];var f=d+Q(k,g);h+=R(k,b,e,f,c)}else if(f=A(a),\"function\"===typeof f)for(a=f.call(a),g=0;!(k=a.next()).done;)k=k.value,f=d+Q(k,g++),h+=R(k,b,e,f,c);else if(\"object\"===k)throw b=String(a),Error(\"Objects are not valid as a React child (found: \"+(\"[object Object]\"===b?\"object with keys {\"+Object.keys(a).join(\", \")+\"}\":b)+\"). If you meant to render a collection of children, use an array instead.\");return h}\nfunction S(a,b,e){if(null==a)return a;var d=[],c=0;R(a,d,\"\",\"\",function(a){return b.call(e,a,c++)});return d}function T(a){if(-1===a._status){var b=a._result;b=b();b.then(function(b){if(0===a._status||-1===a._status)a._status=1,a._result=b},function(b){if(0===a._status||-1===a._status)a._status=2,a._result=b});-1===a._status&&(a._status=0,a._result=b)}if(1===a._status)return a._result.default;throw a._result;}\nvar U={current:null},V={transition:null},W={ReactCurrentDispatcher:U,ReactCurrentBatchConfig:V,ReactCurrentOwner:K};exports.Children={map:S,forEach:function(a,b,e){S(a,function(){b.apply(this,arguments)},e)},count:function(a){var b=0;S(a,function(){b++});return b},toArray:function(a){return S(a,function(a){return a})||[]},only:function(a){if(!O(a))throw Error(\"React.Children.only expected to receive a single React element child.\");return a}};exports.Component=E;exports.Fragment=p;\nexports.Profiler=r;exports.PureComponent=G;exports.StrictMode=q;exports.Suspense=w;exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W;\nexports.cloneElement=function(a,b,e){if(null===a||void 0===a)throw Error(\"React.cloneElement(...): The argument must be a React element, but you passed \"+a+\".\");var d=C({},a.props),c=a.key,k=a.ref,h=a._owner;if(null!=b){void 0!==b.ref&&(k=b.ref,h=K.current);void 0!==b.key&&(c=\"\"+b.key);if(a.type&&a.type.defaultProps)var g=a.type.defaultProps;for(f in b)J.call(b,f)&&!L.hasOwnProperty(f)&&(d[f]=void 0===b[f]&&void 0!==g?g[f]:b[f])}var f=arguments.length-2;if(1===f)d.children=e;else if(1<f){g=Array(f);\nfor(var m=0;m<f;m++)g[m]=arguments[m+2];d.children=g}return{$$typeof:l,type:a.type,key:c,ref:k,props:d,_owner:h}};exports.createContext=function(a){a={$$typeof:u,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};a.Provider={$$typeof:t,_context:a};return a.Consumer=a};exports.createElement=M;exports.createFactory=function(a){var b=M.bind(null,a);b.type=a;return b};exports.createRef=function(){return{current:null}};\nexports.forwardRef=function(a){return{$$typeof:v,render:a}};exports.isValidElement=O;exports.lazy=function(a){return{$$typeof:y,_payload:{_status:-1,_result:a},_init:T}};exports.memo=function(a,b){return{$$typeof:x,type:a,compare:void 0===b?null:b}};exports.startTransition=function(a){var b=V.transition;V.transition={};try{a()}finally{V.transition=b}};exports.unstable_act=function(){throw Error(\"act(...) is not supported in production builds of React.\");};\nexports.useCallback=function(a,b){return U.current.useCallback(a,b)};exports.useContext=function(a){return U.current.useContext(a)};exports.useDebugValue=function(){};exports.useDeferredValue=function(a){return U.current.useDeferredValue(a)};exports.useEffect=function(a,b){return U.current.useEffect(a,b)};exports.useId=function(){return U.current.useId()};exports.useImperativeHandle=function(a,b,e){return U.current.useImperativeHandle(a,b,e)};\nexports.useInsertionEffect=function(a,b){return U.current.useInsertionEffect(a,b)};exports.useLayoutEffect=function(a,b){return U.current.useLayoutEffect(a,b)};exports.useMemo=function(a,b){return U.current.useMemo(a,b)};exports.useReducer=function(a,b,e){return U.current.useReducer(a,b,e)};exports.useRef=function(a){return U.current.useRef(a)};exports.useState=function(a){return U.current.useState(a)};exports.useSyncExternalStore=function(a,b,e){return U.current.useSyncExternalStore(a,b,e)};\nexports.useTransition=function(){return U.current.useTransition()};exports.version=\"18.2.0\";\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react.production.min.js');\n} else {\n module.exports = require('./cjs/react.development.js');\n}\n","import {HeadTag} from './generate-seo-tags';\n\nexport default function Logger({headTags}: {headTags: HeadTag[]}) {\n logSeoTags(headTags);\n\n return null;\n}\n\nexport function logSeoTags(headTags: HeadTag[]) {\n const style = 'text-transform: uppercase;';\n const style2 =\n 'text-transform: uppercase; font-weight: bold; text-transform: uppercase;font-weight: bold';\n\n console.log(' ');\n console.log('%cSEO Meta Tags', `${style2}`);\n console.log(' ');\n\n headTags.forEach((tag) => {\n if (tag.tag === 'script') {\n console.log(`%c• JSON LD `, style);\n\n if (tag.children) {\n try {\n console.table(JSON.parse(tag.children), ['name', 'content']);\n } catch {\n console.log(tag.children);\n }\n }\n } else {\n console.log(`%c• ${tag.tag} `, style);\n\n if (tag.children) {\n if (typeof tag.children === 'string') {\n console.log(`↳ ${tag.children}`);\n } else {\n try {\n Object.entries(JSON.parse(tag.children)).map(([key, val]) =>\n console.log(`↳ ${val}`),\n );\n } catch {\n console.log(tag.children);\n }\n }\n }\n\n Object.entries(tag.props).map(([key, val]) =>\n console.log(`↳ ${key} → ${val}`),\n );\n }\n console.log(' ');\n });\n}\n","import {\n createStorefrontClient as createStorefrontUtilities,\n type StorefrontApiResponseOk,\n} from '@shopify/storefront-kit-react';\nimport type {ExecutionArgs} from 'graphql';\nimport {fetchWithServerCache, checkGraphQLErrors} from './cache/fetch';\nimport {\n STOREFRONT_API_BUYER_IP_HEADER,\n STOREFRONT_REQUEST_GROUP_ID_HEADER,\n} from './constants';\nimport {\n CacheNone,\n CacheLong,\n CacheShort,\n CacheCustom,\n generateCacheControlHeader,\n type CachingStrategy,\n} from './cache/strategies';\nimport {generateUUID} from './utils/uuid';\nimport {parseJSON} from './utils/parse-json';\nimport {\n CountryCode,\n LanguageCode,\n} from '@shopify/storefront-kit-react/storefront-api-types';\nimport {warnOnce} from './utils/warning';\n\ntype StorefrontApiResponse<T> = StorefrontApiResponseOk<T>;\n\nexport type StorefrontClient = ReturnType<typeof createStorefrontClient>;\nexport type Storefront = StorefrontClient['storefront'];\n\nexport type CreateStorefrontClientOptions = Parameters<\n typeof createStorefrontUtilities\n>[0] & {\n cache?: Cache;\n buyerIp?: string;\n requestGroupId?: string;\n waitUntil?: ExecutionContext['waitUntil'];\n i18n?: {\n language: LanguageCode;\n country: CountryCode;\n pathPrefix?: string;\n };\n};\n\ntype StorefrontCommonOptions = {\n variables?: ExecutionArgs['variableValues'] & {\n country?: CountryCode;\n language?: LanguageCode;\n };\n headers?: HeadersInit;\n storefrontApiVersion?: string;\n};\n\nexport type StorefrontQueryOptions = StorefrontCommonOptions & {\n query: string;\n mutation?: never;\n cache?: CachingStrategy;\n};\n\nexport type StorefrontMutationOptions = StorefrontCommonOptions & {\n query?: never;\n mutation: string;\n cache?: never;\n};\n\nconst StorefrontApiError = class extends Error {} as ErrorConstructor;\nexport const isStorefrontApiError = (error: any) =>\n error instanceof StorefrontApiError;\n\nconst isQueryRE = /(^|}\\s)query[\\s({]/im;\nconst isMutationRE = /(^|}\\s)mutation[\\s({]/im;\n\nfunction minifyQuery(string: string) {\n return string\n .replace(/\\s*#.*$/gm, '') // Remove GQL comments\n .replace(/\\s+/gm, ' ') // Minify spaces\n .trim();\n}\n\nexport function createStorefrontClient({\n cache,\n waitUntil,\n buyerIp,\n i18n = {language: 'EN', country: 'US'},\n requestGroupId = generateUUID(),\n ...clientOptions\n}: CreateStorefrontClientOptions) {\n if (!cache) {\n // TODO: should only warn in development\n warnOnce(\n 'Storefront API client created without a cache instance. This may slow down your sub-requests.',\n );\n }\n\n const {\n getPublicTokenHeaders,\n getPrivateTokenHeaders,\n getStorefrontApiUrl,\n getShopifyDomain,\n } = createStorefrontUtilities(clientOptions);\n\n const getHeaders = clientOptions.privateStorefrontToken\n ? getPrivateTokenHeaders\n : getPublicTokenHeaders;\n\n const defaultHeaders = getHeaders({contentType: 'json'});\n\n defaultHeaders[STOREFRONT_REQUEST_GROUP_ID_HEADER] = requestGroupId;\n if (buyerIp) defaultHeaders[STOREFRONT_API_BUYER_IP_HEADER] = buyerIp;\n\n async function fetchStorefrontApi<T>({\n query,\n mutation,\n variables,\n cache: cacheOptions,\n headers = [],\n storefrontApiVersion,\n }: StorefrontQueryOptions | StorefrontMutationOptions): Promise<T> {\n const userHeaders =\n headers instanceof Headers\n ? Object.fromEntries(headers.entries())\n : Array.isArray(headers)\n ? Object.fromEntries(headers)\n : headers;\n\n query = query ?? mutation;\n\n const queryVariables = {...variables};\n\n if (i18n) {\n if (!variables?.country && /\\$country/.test(query)) {\n queryVariables.country = i18n.country;\n }\n\n if (!variables?.language && /\\$language/.test(query)) {\n queryVariables.language = i18n.language;\n }\n }\n\n const url = getStorefrontApiUrl({storefrontApiVersion});\n const requestInit = {\n method: 'POST',\n headers: {...defaultHeaders, ...userHeaders},\n body: JSON.stringify({\n query,\n variables: queryVariables,\n }),\n };\n\n const [body, response] = await fetchWithServerCache(url, requestInit, {\n cacheInstance: mutation ? undefined : cache,\n cache: cacheOptions || CacheShort(),\n shouldCacheResponse: checkGraphQLErrors,\n waitUntil,\n });\n\n if (!response.ok) {\n /**\n * The Storefront API might return a string error, or a JSON-formatted {error: string}.\n * We try both and conform them to a single {errors} format.\n */\n let errors;\n try {\n errors = parseJSON(body);\n } catch (_e) {\n errors = [{message: body}];\n }\n\n throwError(response, errors);\n }\n\n const {data, errors} = body as StorefrontApiResponse<T>;\n\n if (errors?.length) throwError(response, errors, StorefrontApiError);\n\n return data as T;\n }\n\n return {\n storefront: {\n /**\n * Sends a GraphQL query to the Storefront API.\n *\n * Example:\n *\n * ```js\n * async function loader ({context: {storefront}}) {\n * const data = await storefront.query('query { ... }', {\n * variables: {},\n * cache: storefront.CacheLong()\n * });\n * }\n * ```\n */\n query: <T>(\n query: string,\n payload?: StorefrontCommonOptions & {cache?: CachingStrategy},\n ) => {\n query = minifyQuery(query);\n if (isMutationRE.test(query))\n throw new Error('storefront.query cannot execute mutations');\n\n return fetchStorefrontApi<T>({...payload, query});\n },\n /**\n * Sends a GraphQL mutation to the Storefront API.\n *\n * Example:\n *\n * ```js\n * async function loader ({context: {storefront}}) {\n * await storefront.mutate('mutation { ... }', {\n * variables: {},\n * });\n * }\n * ```\n */\n mutate: <T>(mutation: string, payload?: StorefrontCommonOptions) => {\n mutation = minifyQuery(mutation);\n if (isQueryRE.test(mutation))\n throw new Error('storefront.mutate cannot execute queries');\n\n return fetchStorefrontApi<T>({...payload, mutation});\n },\n cache,\n CacheNone,\n CacheLong,\n CacheShort,\n CacheCustom,\n generateCacheControlHeader,\n getPublicTokenHeaders,\n getPrivateTokenHeaders,\n getShopifyDomain,\n getApiUrl: getStorefrontApiUrl,\n /**\n * Wether it's a GraphQL error returned in the Storefront API response.\n *\n * Example:\n *\n * ```js\n * async function loader ({context: {storefront}}) {\n * try {\n * await storefront.query(...);\n * } catch(error) {\n * if (storefront.isApiError(error)) {\n * // ...\n * }\n *\n * throw error;\n * }\n * }\n * ```\n */\n isApiError: isStorefrontApiError,\n // Add default value for pathPefix.\n i18n: {pathPrefix: '', ...i18n},\n },\n };\n}\n\nfunction throwError<T>(\n response: Response,\n errors: StorefrontApiResponse<T>['errors'],\n ErrorConstructor = Error,\n) {\n const reqId = response.headers.get('x-request-id');\n const reqIdMessage = reqId ? ` - Request ID: ${reqId}` : '';\n\n if (errors) {\n const errorMessages =\n typeof errors === 'string'\n ? errors\n : errors.map((error) => error.message).join('\\n');\n\n throw new ErrorConstructor(errorMessages + reqIdMessage);\n }\n\n throw new ErrorConstructor(\n `API response error: ${response.status}` + reqIdMessage,\n );\n}\n","type QueryKey = string | readonly unknown[];\n\nexport function hashKey(queryKey: QueryKey): string {\n const rawKeys = Array.isArray(queryKey) ? queryKey : [queryKey];\n let hash = '';\n\n // Keys from `storefront.query` are in the following shape:\n // ['prefix', 'api-endpoint', {body:'query',headers:{}}]\n // Since the API endpoint already contains the shop domain and api version,\n // we can ignore the headers and only use the `body` from the payload.\n for (const key of rawKeys) {\n if (key != null) {\n if (typeof key === 'object') {\n // Queries from useQuery might not have a `body`. In that case,\n // fallback to a safer (but slower) stringify.\n if (!!key.body && typeof key.body === 'string') {\n hash += key.body;\n } else {\n hash += JSON.stringify(key);\n }\n } else {\n hash += key;\n }\n }\n }\n\n return hash;\n}\n","export interface AllCacheOptions {\n mode?: string;\n maxAge?: number;\n staleWhileRevalidate?: number;\n sMaxAge?: number;\n staleIfError?: number;\n}\n\nexport type CachingStrategy = AllCacheOptions;\n\nexport type NoStoreStrategy = {\n mode: string;\n};\n\nconst PUBLIC = 'public';\nconst PRIVATE = 'private';\nexport const NO_STORE = 'no-store';\n\nconst optionMapping: {\n [key: string]: string;\n} = {\n maxAge: 'max-age',\n staleWhileRevalidate: 'stale-while-revalidate',\n sMaxAge: 's-maxage',\n staleIfError: 'stale-if-error',\n};\n\nexport function generateCacheControlHeader(\n cacheOptions: CachingStrategy,\n): string {\n const cacheControl: string[] = [];\n Object.keys(cacheOptions).forEach((key: string) => {\n if (key === 'mode') {\n cacheControl.push(cacheOptions[key] as string);\n } else if (optionMapping[key]) {\n cacheControl.push(\n `${optionMapping[key]}=${cacheOptions[key as keyof CachingStrategy]}`,\n );\n }\n });\n return cacheControl.join(', ');\n}\n\n/**\n *\n * @public\n */\nexport function CacheNone(): NoStoreStrategy {\n return {\n mode: NO_STORE,\n };\n}\n\nfunction guardExpirableModeType(overrideOptions?: CachingStrategy) {\n if (\n overrideOptions?.mode &&\n overrideOptions?.mode !== PUBLIC &&\n overrideOptions?.mode !== PRIVATE\n ) {\n throw Error(\"'mode' must be either 'public' or 'private'\");\n }\n}\n\n/**\n *\n * @public\n */\nexport function CacheShort(overrideOptions?: CachingStrategy): AllCacheOptions {\n guardExpirableModeType(overrideOptions);\n return {\n mode: PUBLIC,\n maxAge: 1,\n staleWhileRevalidate: 9,\n ...overrideOptions,\n };\n}\n\n/**\n *\n * @public\n */\nexport function CacheLong(overrideOptions?: CachingStrategy): AllCacheOptions {\n guardExpirableModeType(overrideOptions);\n return {\n mode: PUBLIC,\n maxAge: 3600, // 1 hour\n staleWhileRevalidate: 82800, // 23 Hours\n ...overrideOptions,\n };\n}\n\n/**\n *\n * @public\n */\nexport function CacheCustom(overrideOptions: CachingStrategy): AllCacheOptions {\n return overrideOptions as AllCacheOptions;\n}\n","import type {CachingStrategy} from './strategies';\nimport {CacheShort, generateCacheControlHeader} from './strategies';\n\nfunction logCacheApiStatus(status: string | null, url: string) {\n // // eslint-disable-next-line no-console\n // console.log('\\n' + status, url);\n}\n\nfunction getCacheControlSetting(\n userCacheOptions?: CachingStrategy,\n options?: CachingStrategy,\n): CachingStrategy {\n if (userCacheOptions && options) {\n return {\n ...userCacheOptions,\n ...options,\n };\n } else {\n return userCacheOptions || CacheShort();\n }\n}\n\nfunction generateDefaultCacheControlHeader(\n userCacheOptions?: CachingStrategy,\n): string {\n return generateCacheControlHeader(getCacheControlSetting(userCacheOptions));\n}\n\n/**\n * Get an item from the cache. If a match is found, returns a tuple\n * containing the `JSON.parse` version of the response as well\n * as the response itself so it can be checked for staleness.\n */\nasync function getItem(\n cache: Cache,\n request: Request,\n): Promise<Response | undefined> {\n if (!cache) return;\n\n const response = await cache.match(request);\n if (!response) {\n logCacheApiStatus('MISS', request.url);\n return;\n }\n\n logCacheApiStatus('HIT', request.url);\n\n return response;\n}\n\n/**\n * Put an item into the cache.\n */\nasync function setItem(\n cache: Cache,\n request: Request,\n response: Response,\n userCacheOptions: CachingStrategy,\n) {\n if (!cache) return;\n\n /**\n * We are manually managing staled request by adding this workaround.\n * Why? cache control header support is dependent on hosting platform\n *\n * For example:\n *\n * Cloudflare's Cache API does not support `stale-while-revalidate`.\n * Cloudflare cache control header has a very odd behaviour.\n * Say we have the following cache control header on a request:\n *\n * public, max-age=15, stale-while-revalidate=30\n *\n * When there is a cache.match HIT, the cache control header would become\n *\n * public, max-age=14400, stale-while-revalidate=30\n *\n * == `stale-while-revalidate` workaround ==\n * Update response max-age so that:\n *\n * max-age = max-age + stale-while-revalidate\n *\n * For example:\n *\n * public, max-age=1, stale-while-revalidate=9\n * |\n * V\n * public, max-age=10, stale-while-revalidate=9\n *\n * Store the following information in the response header:\n *\n * cache-put-date - UTC time string of when this request is PUT into cache\n *\n * Note on `cache-put-date`: The `response.headers.get('date')` isn't static. I am\n * not positive what date this is returning but it is never over 500 ms\n * after subtracting from the current timestamp.\n *\n * `isStale` function will use the above information to test for stale-ness of a cached response\n */\n\n const cacheControl = getCacheControlSetting(userCacheOptions);\n\n // The padded cache-control to mimic stale-while-revalidate\n request.headers.set(\n 'cache-control',\n generateDefaultCacheControlHeader(\n getCacheControlSetting(cacheControl, {\n maxAge:\n (cacheControl.maxAge || 0) + (cacheControl.staleWhileRevalidate || 0),\n }),\n ),\n );\n // The cache-control we want to set on response\n const cacheControlString = generateDefaultCacheControlHeader(\n getCacheControlSetting(cacheControl),\n );\n\n // CF will override cache-control, so we need to keep a non-modified real-cache-control\n // cache-control is still necessary for mini-oxygen\n response.headers.set('cache-control', cacheControlString);\n response.headers.set('real-cache-control', cacheControlString);\n response.headers.set('cache-put-date', new Date().toUTCString());\n\n logCacheApiStatus('PUT', request.url);\n await cache.put(request, response);\n}\n\nasync function deleteItem(cache: Cache, request: Request) {\n if (!cache) return;\n\n logCacheApiStatus('DELETE', request.url);\n await cache.delete(request);\n}\n\n/**\n * Manually check the response to see if it's stale.\n */\nfunction isStale(request: Request, response: Response) {\n const responseDate = response.headers.get('cache-put-date');\n const cacheControl = response.headers.get('real-cache-control');\n let responseMaxAge = 0;\n\n if (cacheControl) {\n const maxAgeMatch = cacheControl.match(/max-age=(\\d*)/);\n if (maxAgeMatch && maxAgeMatch.length > 1) {\n responseMaxAge = parseFloat(maxAgeMatch[1]);\n }\n }\n\n if (!responseDate) {\n return false;\n }\n\n const ageInMs =\n new Date().valueOf() - new Date(responseDate as string).valueOf();\n const age = ageInMs / 1000;\n\n const result = age > responseMaxAge;\n\n if (result) {\n logCacheApiStatus('STALE', request.url);\n }\n\n return result;\n}\n\n/**\n *\n * @private\n */\nexport const CacheAPI = {\n get: getItem,\n set: setItem,\n delete: deleteItem,\n generateDefaultCacheControlHeader,\n isStale,\n};\n","import {CacheAPI} from './api';\nimport {\n CacheShort,\n type CachingStrategy,\n type AllCacheOptions,\n} from './strategies.js';\n\n/**\n * Wrapper Cache functions for sub queries\n */\n\n/**\n * Cache API is weird. We just need a full URL, so we make one up.\n */\nfunction getKeyUrl(key: string) {\n return `https://shopify.dev/?${key}`;\n}\n\nfunction getCacheOption(userCacheOptions?: CachingStrategy): AllCacheOptions {\n return userCacheOptions || CacheShort();\n}\n\nexport function generateSubRequestCacheControlHeader(\n userCacheOptions?: CachingStrategy,\n): string {\n return CacheAPI.generateDefaultCacheControlHeader(\n getCacheOption(userCacheOptions),\n );\n}\n\n/**\n * Get an item from the cache. If a match is found, returns a tuple\n * containing the `JSON.parse` version of the response as well\n * as the response itself so it can be checked for staleness.\n * @private\n */\nexport async function getItemFromCache(\n cache: Cache,\n key: string,\n): Promise<undefined | [any, Response]> {\n if (!cache) return;\n const url = getKeyUrl(key);\n const request = new Request(url);\n\n const response = await CacheAPI.get(cache, request);\n\n if (!response) {\n return;\n }\n\n return [await response.json(), response];\n}\n\n/**\n * Put an item into the cache.\n * @private\n */\nexport async function setItemInCache(\n cache: Cache,\n key: string,\n value: any,\n userCacheOptions?: CachingStrategy,\n) {\n if (!cache) return;\n\n const url = getKeyUrl(key);\n const request = new Request(url);\n const response = new Response(JSON.stringify(value));\n\n await CacheAPI.set(\n cache,\n request,\n response,\n getCacheOption(userCacheOptions),\n );\n}\n\n/**\n *\n * @private\n */\nexport async function deleteItemFromCache(cache: Cache, key: string) {\n if (!cache) return;\n\n const url = getKeyUrl(key);\n const request = new Request(url);\n\n await CacheAPI.delete(cache, request);\n}\n\n/**\n * Manually check the response to see if it's stale.\n * @private\n */\nexport function isStale(key: string, response: Response) {\n return CacheAPI.isStale(new Request(getKeyUrl(key)), response);\n}\n","import {hashKey} from '../utils/hash.js';\nimport {CacheShort, CachingStrategy} from './strategies';\nimport {getItemFromCache, setItemInCache, isStale} from './sub-request';\n\nexport type FetchCacheOptions = {\n cache?: CachingStrategy;\n cacheInstance?: Cache;\n cacheKey?: string | readonly unknown[];\n shouldCacheResponse?: (body: any, response: Response) => boolean;\n waitUntil?: ExecutionContext['waitUntil'];\n returnType?: 'json' | 'text' | 'arrayBuffer' | 'blob';\n};\n\nfunction serializeResponse(body: any, response: Response) {\n return [\n body,\n {\n status: response.status,\n statusText: response.statusText,\n headers: Array.from(response.headers.entries()),\n },\n ];\n}\n\n// Check if the response body has GraphQL errors\n// https://spec.graphql.org/June2018/#sec-Response-Format\nexport const checkGraphQLErrors = (body: any) => !body?.errors;\n\n// Lock to prevent revalidating the same sub-request\n// in the same isolate. Note that different isolates\n// in the same colo could duplicate the revalidation\n// since this is only an in-memory lock.\n// https://github.com/Shopify/oxygen-platform/issues/625\nconst swrLock = new Set<string>();\n\n/**\n * `fetch` equivalent that stores responses in cache.\n * Useful for calling third-party APIs that need to be cached.\n * @private\n */\nexport async function fetchWithServerCache(\n url: string,\n requestInit: Request | RequestInit,\n {\n cacheInstance,\n cache: cacheOptions,\n cacheKey = [url, requestInit],\n shouldCacheResponse = () => true,\n waitUntil,\n returnType = 'json',\n }: FetchCacheOptions = {},\n): Promise<readonly [any, Response]> {\n if (!cacheOptions && (!requestInit.method || requestInit.method === 'GET')) {\n cacheOptions = CacheShort();\n }\n\n const doFetch = async () => {\n const response = await fetch(url, requestInit);\n let data;\n\n try {\n data = await response[returnType]();\n } catch {\n data = await response.text();\n }\n\n return [data, response] as const;\n };\n\n if (!cacheInstance || !cacheKey || !cacheOptions) return doFetch();\n\n const key = hashKey([\n // '__HYDROGEN_CACHE_ID__', // TODO purgeQueryCacheOnBuild\n ...(typeof cacheKey === 'string' ? [cacheKey] : cacheKey),\n ]);\n\n const cachedItem = await getItemFromCache(cacheInstance, key);\n // console.log('--- Cache', cachedItem ? 'HIT' : 'MISS');\n\n if (cachedItem) {\n const [cachedValue, cacheInfo] = cachedItem;\n\n if (!swrLock.has(key) && isStale(key, cacheInfo)) {\n swrLock.add(key);\n\n // Important: Run revalidation asynchronously.\n const revalidatingPromise = Promise.resolve().then(async () => {\n try {\n const [body, response] = await doFetch();\n\n if (shouldCacheResponse(body, response)) {\n await setItemInCache(\n cacheInstance,\n key,\n serializeResponse(body, response),\n cacheOptions,\n );\n }\n } catch (error: any) {\n if (error.message) {\n error.message = 'SWR in sub-request failed: ' + error.message;\n }\n\n console.error(error);\n } finally {\n swrLock.delete(key);\n }\n });\n\n // Asynchronously wait for it in workers\n waitUntil?.(revalidatingPromise);\n }\n\n const [body, init] = cachedValue;\n return [body, new Response(body, init)];\n }\n\n const [body, response] = await doFetch();\n\n /**\n * Important: Do this async\n */\n if (shouldCacheResponse(body, response)) {\n const setItemInCachePromise = setItemInCache(\n cacheInstance,\n key,\n serializeResponse(body, response),\n cacheOptions,\n );\n\n waitUntil?.(setItemInCachePromise);\n }\n\n return [body, response];\n}\n","export const STOREFRONT_REQUEST_GROUP_ID_HEADER =\n 'Custom-Storefront-Request-Group-ID';\nexport const STOREFRONT_API_BUYER_IP_HEADER = 'Shopify-Storefront-Buyer-IP';\n","/*\n * Generate a UUID using crypto and fallback to Math.random if crypto is not available.\n */\nexport function generateUUID() {\n if (typeof crypto !== 'undefined' && !!crypto.randomUUID) {\n return crypto.randomUUID();\n } else {\n return `weak-${Math.random().toString(16).substring(2)}`;\n }\n}\n","export function parseJSON(json: any) {\n if (String(json).includes('__proto__')) return JSON.parse(json, noproto);\n return JSON.parse(json);\n}\nfunction noproto(k: string, v: string) {\n if (k !== '__proto__') return v;\n}\n","const warnings = new Set<string>();\nexport const warnOnce = (string: string) => {\n if (!warnings.has(string)) {\n console.warn(string);\n warnings.add(string);\n }\n};\n","type CacheMatch = {\n body: Uint8Array;\n timestamp: number;\n status: number;\n headers: [string, string][];\n};\n\n/**\n * This is a limited implementation of an in-memory cache.\n * It only supports the `cache-control` header.\n * It does NOT support `age` or `expires` headers.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Cache\n */\nexport class InMemoryCache implements Cache {\n #store: Map<string, CacheMatch>;\n\n constructor() {\n this.#store = new Map();\n }\n\n add(request: RequestInfo): Promise<void> {\n throw new Error('Method not implemented. Use `put` instead.');\n }\n\n addAll(requests: RequestInfo[]): Promise<void> {\n throw new Error('Method not implemented. Use `put` instead.');\n }\n\n matchAll(\n request?: RequestInfo,\n options?: CacheQueryOptions,\n ): Promise<readonly Response[]> {\n throw new Error('Method not implemented. Use `match` instead.');\n }\n\n async put(request: Request, response: Response) {\n if (request.method !== 'GET') {\n throw new TypeError('Cannot cache response to non-GET request.');\n }\n\n if (response.status === 206) {\n throw new TypeError(\n 'Cannot cache response to a range request (206 Partial Content).',\n );\n }\n\n if (response.headers.get('vary')?.includes('*')) {\n throw new TypeError(\"Cannot cache response with 'Vary: *' header.\");\n }\n\n this.#store.set(request.url, {\n body: new Uint8Array(await response.arrayBuffer()),\n status: response.status,\n headers: [...response.headers],\n timestamp: Date.now(),\n });\n }\n\n async match(request: Request) {\n if (request.method !== 'GET') return;\n\n const match = this.#store.get(request.url);\n\n if (!match) {\n return;\n }\n\n const {body, timestamp, ...metadata} = match;\n\n const headers = new Headers(metadata.headers);\n const cacheControl =\n headers.get('cache-control') || headers.get('real-cache-control') || '';\n const maxAge = parseInt(\n cacheControl.match(/max-age=(\\d+)/)?.[1] || '0',\n 10,\n );\n const swr = parseInt(\n cacheControl.match(/stale-while-revalidate=(\\d+)/)?.[1] || '0',\n 10,\n );\n const age = (Date.now() - timestamp) / 1000;\n\n const isMiss = age > maxAge + swr;\n\n if (isMiss) {\n this.#store.delete(request.url);\n return;\n }\n\n const isStale = age > maxAge;\n\n headers.set('cache', isStale ? 'STALE' : 'HIT');\n headers.set('date', new Date(timestamp).toUTCString());\n\n return new Response(body, {\n status: metadata.status ?? 200,\n headers,\n });\n }\n\n async delete(request: Request) {\n if (this.#store.has(request.url)) {\n this.#store.delete(request.url);\n return true;\n }\n return false;\n }\n\n keys(request?: Request) {\n const cacheKeys = [] as Request[];\n\n for (const url of this.#store.keys()) {\n if (!request || request.url === url) {\n cacheKeys.push(new Request(url));\n }\n }\n\n return Promise.resolve(cacheKeys);\n }\n}\n","import {redirect} from '@remix-run/server-runtime';\nimport type {UrlRedirectConnection} from '@shopify/storefront-kit-react/storefront-api-types';\nimport type {Storefront} from '../storefront';\n\ntype StorefrontRedirect = {\n storefront: Storefront;\n request: Request;\n response?: Response;\n};\n\n/**\n * Queries the Storefront API to see if there is any redirect\n * created for the current route and performs it. Otherwise,\n * it returns the response passed in the parameters. Useful for\n * conditionally redirecting after a 404 response.\n *\n * @see {@link https://help.shopify.com/en/manual/online-store/menus-and-links/url-redirect Creating URL redirects in Shopify}\n */\nexport async function storefrontRedirect({\n storefront,\n request,\n response = new Response('Not Found', {status: 404}),\n}: StorefrontRedirect): Promise<Response> {\n const {pathname, search} = new URL(request.url);\n const redirectFrom = pathname + search;\n\n try {\n const {urlRedirects} = await storefront.query<{\n urlRedirects: UrlRedirectConnection;\n }>(REDIRECT_QUERY, {\n variables: {query: 'path:' + redirectFrom},\n storefrontApiVersion: '2023-01',\n });\n\n const location = urlRedirects?.edges?.[0]?.node?.target;\n\n if (location) {\n return new Response(null, {status: 302, headers: {location}});\n }\n\n const searchParams = new URLSearchParams(search);\n const redirectTo =\n searchParams.get('return_to') || searchParams.get('redirect');\n\n if (redirectTo) {\n if (isLocalPath(redirectTo)) {\n return redirect(redirectTo);\n } else {\n console.warn(\n `Cross-domain redirects are not supported. Tried to redirect from ${redirectFrom} to ${redirectTo}`,\n );\n }\n }\n } catch (error) {\n console.error(\n `Failed to fetch redirects from Storefront API for route ${redirectFrom}`,\n error,\n );\n }\n\n return response;\n}\n\nfunction isLocalPath(url: string) {\n try {\n // We don't want to redirect cross domain,\n // doing so could create fishing vulnerability\n // If `new URL()` succeeds, it's a fully qualified\n // url which is cross domain. If it fails, it's just\n // a path, which will be the current domain.\n new URL(url);\n } catch (e) {\n return true;\n }\n\n return false;\n}\n\nconst REDIRECT_QUERY = `#graphql\n query redirects($query: String) {\n urlRedirects(first: 1, query: $query) {\n edges {\n node {\n target\n }\n }\n }\n }\n`;\n","import type {LoaderArgs} from '@remix-run/server-runtime';\nimport type {StorefrontClient} from '../storefront';\n\nexport function graphiqlLoader(\n {context} = {} as LoaderArgs & {\n context: LoaderArgs['context'] & StorefrontClient;\n },\n) {\n if (!context?.storefront) {\n throw new Error(\n `GraphiQL: Hydrogen's storefront client must be injected in the loader context.`,\n );\n }\n\n const url = context.storefront.getApiUrl();\n const accessToken =\n context.storefront.getPublicTokenHeaders()[\n 'X-Shopify-Storefront-Access-Token'\n ];\n\n return new Response(\n `\n<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <title>GraphiQL</title>\n <style>\n body {\n height: 100%;\n margin: 0;\n width: 100%;\n overflow: hidden;\n }\n\n #graphiql {\n height: 100vh;\n }\n </style>\n\n <script\n src=\"https://unpkg.com/react@17/umd/react.development.js\"\n integrity=\"sha512-Vf2xGDzpqUOEIKO+X2rgTLWPY+65++WPwCHkX2nFMu9IcstumPsf/uKKRd5prX3wOu8Q0GBylRpsDB26R6ExOg==\"\n crossorigin=\"anonymous\"\n ></script>\n <script\n src=\"https://unpkg.com/react-dom@17/umd/react-dom.development.js\"\n integrity=\"sha512-Wr9OKCTtq1anK0hq5bY3X/AvDI5EflDSAh0mE9gma+4hl+kXdTJPKZ3TwLMBcrgUeoY0s3dq9JjhCQc7vddtFg==\"\n crossorigin=\"anonymous\"\n ></script>\n <link rel=\"stylesheet\" href=\"https://unpkg.com/graphiql/graphiql.min.css\" />\n </head>\n\n <body>\n <div id=\"graphiql\">Loading...</div>\n <script\n src=\"https://unpkg.com/graphiql/graphiql.min.js\"\n type=\"application/javascript\"\n ></script>\n <script>\n ReactDOM.render(\n React.createElement(GraphiQL, {\n fetcher: GraphiQL.createFetcher({\n url: '${url}',\n headers: {\n 'X-Shopify-Storefront-Access-Token': '${accessToken}',\n }\n }),\n defaultEditorToolsVisibility: true,\n initialTabs: [{query: '{\\\\n shop {\\\\n name\\\\n }\\\\n}'}]\n }),\n document.getElementById('graphiql'),\n );\n </script>\n </body>\n</html>\n `,\n {status: 200, headers: {'content-type': 'text/html'}},\n );\n}\n","import React from 'react';\nimport {\n useMatches,\n useLocation,\n type Params,\n type Location,\n} from '@remix-run/react';\nimport {generateSeoTags, type Seo as SeoType} from './generate-seo-tags';\nimport {logSeoTags} from './log-seo-tags';\n\nimport type {\n LoaderFunction,\n SerializeFrom,\n AppData,\n} from '@remix-run/server-runtime';\n\nconst SeoLogger = React.lazy(() => import('./log-seo-tags'));\n\nexport interface SeoHandleFunction<\n Loader extends LoaderFunction | unknown = unknown,\n> {\n (args: {\n data: Loader extends LoaderFunction ? SerializeFrom<Loader> : AppData;\n id: string;\n params: Params;\n pathname: Location['pathname'];\n search: Location['search'];\n hash: Location['hash'];\n key: string;\n }): Partial<SeoType>;\n}\n\ninterface SeoProps {\n debug?: boolean;\n}\n\nexport function Seo({debug}: SeoProps) {\n const matches = useMatches();\n const location = useLocation();\n\n const seoConfig = matches\n .flatMap((match) => {\n const {handle, ...routeMatch} = match;\n const routeInfo = {...routeMatch, ...location};\n\n if (handle === undefined || handle.seo === undefined) {\n return [];\n }\n\n return recursivelyInvokeOrReturn(handle.seo, routeInfo);\n })\n .reduce((acc, current) => {\n Object.keys(current).forEach(\n (key) => !current[key] && delete current[key],\n );\n\n return {...acc, ...current};\n }, {});\n\n const headTags = generateSeoTags(seoConfig);\n\n if (debug) logSeoTags(headTags);\n\n const html = headTags.map((tag) => {\n if (tag.tag === 'script') {\n return React.createElement(tag.tag, {\n ...tag.props,\n key: tag.key,\n dangerouslySetInnerHTML: {__html: tag.children},\n });\n }\n\n return React.createElement(\n tag.tag,\n {...tag.props, key: tag.key},\n tag.children,\n );\n });\n\n const loggerMarkup = React.createElement(\n React.Suspense,\n {fallback: null},\n React.createElement(SeoLogger, {headTags}),\n );\n\n return React.createElement(React.Fragment, null, html, debug && loggerMarkup);\n}\n\nexport function recursivelyInvokeOrReturn<T, R extends any[]>(\n value: T | ((...rest: R) => T),\n ...rest: R\n): T | Record<string, T> {\n if (value instanceof Function) {\n return recursivelyInvokeOrReturn<T, R>(value(...rest), ...rest);\n }\n\n let result: Record<string, T> = {};\n\n if (Array.isArray(value)) {\n result = value.reduce((acc, item) => {\n return [...acc, recursivelyInvokeOrReturn(item)];\n }, []);\n\n return result;\n }\n\n if (value instanceof Object) {\n const entries = Object.entries(value);\n\n entries.forEach(([key, val]) => {\n // @ts-expect-error\n result[key] = recursivelyInvokeOrReturn<T, R>(val, ...rest);\n });\n\n return result;\n }\n\n return value;\n}\n","// TODO more this whole file to a storefront-react package\nimport type {Maybe} from '@shopify/storefront-kit-react/storefront-api-types';\nimport type {WithContext} from 'schema-dts';\n\nexport interface BaseSeo {\n description?: any;\n media?: any;\n title?: any;\n titleTemplate?: any;\n url?: any;\n handle?: any;\n ldJson?: any;\n alternates?: any[];\n}\n\nexport interface Seo {\n /**\n * The <title> HTML element defines the document's title that is shown in a\n * browser's title bar or a page's tab. It only contains text; tags within the\n * element are ignored.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title\n */\n title: Maybe<string> | undefined;\n /**\n * Generate the title from a template that includes a `%s` placeholder for the\n * title.\n *\n * @example\n * ```js\n * {\n * title: 'My Page',\n * titleTemplate: 'My Site - %s',\n * }\n * ```\n */\n titleTemplate: Maybe<string> | undefined | null;\n /**\n * The media associated with the given page (images, videos, etc). If you pass\n * a string, it will be used as the `og:image` meta tag. If you pass an object\n * or an array of objects, that will be used to generate `og:<type of media>`\n * meta tags. The `url` property should be the URL of the media. The `height`\n * and `width` properties are optional and should be the height and width of\n * the media. The `alt` property is optional and should be a description of\n * the media.\n *\n * @example\n * ```js\n * {\n * media: [\n * {\n * url: 'https://example.com/image.jpg',\n * type: 'image',\n * height: '400',\n * width: '400',\n * alt: 'A custom snowboard with an alpine color pallet.',\n * }\n * ]\n * }\n * ```\n *\n */\n media: Maybe<string> | undefined | SeoMedia | SeoMedia[];\n /**\n * The description of the page. This is used in the `name=\"description\"` meta\n * tag as well as the `og:description` meta tag.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta\n */\n description: Maybe<string> | undefined;\n /**\n * The canonical URL of the page. This is used to tell search engines which\n * URL is the canonical version of a page. This is useful when you have\n * multiple URLs that point to the same page. The value here will be used in\n * the `rel=\"canonical\"` link tag as well as the `og:url` meta tag.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link\n */\n url: Maybe<string> | undefined;\n /**\n * The handle is used to generate the `twitter:site` and `twitter:creator`\n * meta tags. Include the `@` symbol in the handle.\n *\n * @example\n * ```js\n * {\n * handle: '@shopify'\n * }\n * ```\n */\n handle: Maybe<string> | undefined;\n /**\n * The `ldJson` property is used to generate the `application/ld+json` script\n * tag. This is used to provide structured data to search engines. The value\n * should be an object that conforms to the schema.org spec. The `type`\n * property should be the type of schema you are using. The `type` property is\n * required and should be one of the following:\n *\n * - `Product`\n * - `ItemList`\n * - `Organization`\n * - `WebSite`\n * - `WebPage`\n * - `BlogPosting`\n * - `Thing`\n *\n * @example\n * ```js\n * {\n * ldJson: {\n * '@context': 'https://schema.org',\n * '@type': 'Product',\n * name: 'My Product',\n * image: 'https://example.com/image.jpg',\n * description: 'A product that is great',\n * sku: '12345',\n * mpn: '12345',\n * brand: {\n * '@type': 'Thing',\n * name: 'My Brand',\n * },\n * aggregateRating: {\n * '@type': 'AggregateRating',\n * ratingValue: '4.5',\n * reviewCount: '100',\n * },\n * offers: {\n * '@type': 'Offer',\n * priceCurrency: 'USD',\n * price: '100',\n * priceValidUntil: '2020-11-05',\n * itemCondition: 'https://schema.org/NewCondition',\n * availability: 'https://schema.org/InStock',\n * seller: {\n * '@type': 'Organization',\n * name: 'My Brand',\n * },\n * },\n * }\n * }\n * ```\n *\n * @see https://schema.org/docs/schemas.html\n * @see https://developers.google.com/search/docs/guides/intro-structured-data\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script\n *\n */\n ldJson: <T extends SchemaType>(type: T) => WithContext<T>;\n /**\n * The `alternates` property is used to specify the language and geographical targeting when you have multiple\n * versions of the same page in different languages. The `url` property tells search engines about these variations\n * and helps them to serve the correct version to their users.\n *\n * @example\n * ```js\n * {\n * alternates: [\n * {\n * language: 'en-US',\n * url: 'https://hydrogen.shop/en-us',\n * default: true,\n * },\n * {\n * media: 'only screen and (max-width: 640px)',\n * url: 'https://m.hydrogen.shop/en-ca',\n * },\n * {\n * language: 'fr-CA',\n * url: 'https://hydrogen.shop/fr-ca',\n * },\n * ]\n * }\n * ```\n * @see https://support.google.com/webmasters/answer/189077?hl=en\n */\n alternates: (LanguageAlternate | MobileAlternate)[];\n}\n\nexport interface LanguageAlternate {\n // Language code for the alternate page. This is used to generate the hreflang meta tag property.\n language: string;\n // Whether or not the alternate page is the default page. This will add the `x-default`\n // attribution to the language code.\n default?: boolean;\n // The url of the alternate page. This is used to generate the hreflang meta tag property.\n url: string;\n}\n\nexport interface MobileAlternate {\n // The media attribute specifies what media/device the target url is optimized for.\n media: string;\n // The url of the alternate page. This is used to generate the hreflang meta tag property.\n url: string;\n}\n\nexport type SeoMedia = {\n // Used to generate og:<type of media> meta tag\n type: 'image' | 'video' | 'audio';\n // The url value populates both url and secure_url and is used to infer the\n // og:<type of media>:type meta tag.\n url: Maybe<string> | undefined;\n // The height in pixels of the media. This is used to generate the og:<type of\n // media>:height meta tag.\n height: Maybe<number> | undefined;\n // The width in pixels of the media. This is used to generate the og:<type of\n // media>:width meta tag/\n width: Maybe<number> | undefined;\n // The alt text for the media. This is used to generate the og:<type of\n // media>:alt meta tag.\n altText: Maybe<string> | undefined;\n};\n\nexport type TagKey = 'title' | 'base' | 'meta' | 'link' | 'script';\n\nexport interface HeadTag {\n tag: TagKey;\n props: Record<string, any>;\n children?: string;\n key: string;\n}\n\nexport type SchemaType =\n | 'Product'\n | 'ItemList'\n | 'Organization'\n | 'WebSite'\n | 'WebPage'\n | 'BlogPosting'\n | 'Thing';\n\nexport function generateSeoTags<T extends BaseSeo = Seo>(input: T) {\n const output: HeadTag[] = [];\n let ldJson: WithContext<any> = {\n '@context': 'https://schema.org',\n '@type': 'Thing',\n };\n\n for (const tag of Object.keys(input)) {\n const values = Array.isArray(input[tag as keyof T])\n ? (input[tag as keyof T] as [keyof T][])\n : [input[tag as keyof T]];\n\n const tags = values.map((value) => {\n const tagResults: any[] = [];\n\n if (!value) {\n return tagResults;\n }\n\n switch (tag) {\n case 'title':\n const title = renderTitle(input.titleTemplate, value as string);\n\n tagResults.push(\n generateTag('title', title),\n generateTag('meta', {property: 'og:title', content: title}),\n generateTag('meta', {name: 'twitter:title', content: title}),\n );\n\n ldJson.name = title;\n\n break;\n\n case 'description':\n tagResults.push(\n generateTag('meta', {name: 'description', content: value}),\n generateTag('meta', {property: 'og:description', content: value}),\n generateTag('meta', {name: 'twitter:description', content: value}),\n );\n\n ldJson.description = value;\n\n break;\n\n case 'url':\n tagResults.push(\n generateTag('meta', {property: 'og:url', content: value}),\n generateTag('link', {rel: 'canonical', href: value}),\n );\n\n ldJson.url = value;\n ldJson['@type'] = inferSchemaType(value as string);\n\n break;\n\n case 'handle':\n tagResults.push(\n generateTag('meta', {name: 'twitter:site', content: value}),\n generateTag('meta', {name: 'twitter:creator', content: value}),\n );\n\n break;\n\n case 'ldJson':\n ldJson = {...ldJson, ...value};\n break;\n\n case 'media':\n const values: any = Array.isArray(value) ? value : [value];\n\n for (const media of values) {\n if (typeof media === 'string') {\n tagResults.push(\n generateTag('meta', {name: 'og:image', content: value}),\n );\n\n ldJson.image = value;\n }\n\n if (media && typeof media === 'object') {\n const type = media.type || 'image';\n\n // Order matters here when adding multiple media tags\n // @see https://ogp.me/#array\n const normalizedMedia = media\n ? {\n url: media?.url,\n secure_url: media?.url,\n type: inferMimeType(media?.url),\n width: media?.width,\n height: media?.height,\n alt: media?.altText,\n }\n : {};\n\n for (const key of Object.keys(normalizedMedia)) {\n if (normalizedMedia[key as keyof typeof normalizedMedia]) {\n tagResults.push(\n generateTag(\n 'meta',\n {\n property: `og:${type}:${key}`,\n content:\n normalizedMedia[key as keyof typeof normalizedMedia],\n },\n normalizedMedia.url,\n ),\n );\n }\n }\n }\n }\n break;\n\n case 'alternates':\n const alternates = Array.isArray(value) ? value : [value];\n\n for (const alternate of alternates) {\n const {\n // @ts-expect-error untyped\n language,\n // @ts-expect-error untyped\n media,\n url,\n // @ts-expect-error untyped\n default: defaultLang,\n } = alternate as Seo['alternates'][0];\n\n const hreflang = language\n ? `${language}${defaultLang ? '-default' : ''}`\n : undefined;\n\n tagResults.push(\n generateTag('link', {\n rel: 'alternate',\n hreflang,\n media,\n href: url,\n }),\n );\n }\n\n break;\n }\n\n return tagResults;\n });\n\n const entries = tags.flat();\n\n output.push(\n // @ts-expect-error untyped\n entries.filter((value) => !!value),\n );\n }\n\n const additionalTags = [\n generateTag('meta', {property: 'og:type', content: 'website'}),\n generateTag('meta', {\n name: 'twitter:card',\n content: 'summary_large_image',\n }),\n ];\n\n return [...output, ...additionalTags]\n .flat()\n .sort((a, b) => a.key.localeCompare(b.key))\n .concat(\n // move ld+json to the end\n generateTag('script', {\n type: 'application/ld+json',\n children: JSON.stringify(ldJson),\n }),\n )\n .flat();\n}\n\nfunction generateTag<T extends HeadTag>(\n tagName: T['tag'],\n input: any,\n group?: string,\n): T | T[] {\n const tag = {tag: tagName, props: {}} as T;\n\n // title tags don't have props so move to children\n if (tagName === 'title') {\n tag.children = input;\n tag.key = generateKey(tag);\n\n return tag;\n }\n\n // also move the input children to children and delete it\n if (tagName === 'script') {\n tag.children = input.children;\n\n delete input.children;\n }\n\n // the rest goes on props\n tag.props = input;\n\n // remove empty props\n Object.keys(tag.props).forEach(\n (key) => !tag.props[key] && delete tag.props[key],\n );\n\n tag.key = generateKey(tag, group);\n\n return tag;\n}\n\nfunction generateKey(tag: HeadTag, group?: string) {\n const {tag: tagName, props} = tag;\n\n if (tagName === 'title') {\n // leading 0 moves title to the top when sorting\n return '0-title';\n }\n\n if (tagName === 'meta') {\n // leading 0 moves meta to the top when sorting\n // exclude secure_url from the logic because the content is the same as url\n const priority =\n props.content === group && !props.property.endsWith('secure_url') && '0';\n const groupName = [group, priority];\n\n return [tagName, ...groupName, props.property || props.name]\n .filter((x) => x)\n .join('-');\n }\n\n if (tagName === 'link') {\n const key = [tagName, props.rel, props.hreflang || props.media]\n .filter((x) => x)\n .join('-');\n\n // replace spaces with dashes, needed for media prop\n return key.replace(/\\s+/g, '-');\n }\n\n return `${tagName}-${props.type}`;\n}\n\nfunction renderTitle<T extends HeadTag['children']>(\n template?: string | ((title?: string) => string | undefined),\n title?: T,\n): string | undefined {\n if (!template) {\n return title;\n }\n\n if (typeof template === 'function') {\n return template(title);\n }\n\n return template.replace('%s', title ?? '');\n}\n\nfunction inferMimeType(url: string) {\n const ext = url.split('.').pop();\n\n if (ext === 'svg') {\n return 'image/svg+xml';\n }\n\n if (ext === 'png') {\n return 'image/png';\n }\n\n if (ext === 'jpg' || ext === 'jpeg') {\n return 'image/jpeg';\n }\n\n if (ext === 'gif') {\n return 'image/gif';\n }\n\n if (ext === 'swf') {\n return 'application/x-shockwave-flash';\n }\n\n if (ext === 'mp3') {\n return 'audio/mpeg';\n }\n\n return 'image/jpeg';\n}\n\nfunction inferSchemaType(url: string): SchemaType {\n const defaultType = 'Thing';\n const routes: {type: SchemaType; pattern: RegExp | string}[] = [\n {\n type: 'WebSite',\n pattern: '^/$',\n },\n\n {\n type: 'Product',\n pattern: '/products/.*',\n },\n {\n type: 'ItemList',\n pattern: /\\/collections$/,\n },\n {\n type: 'ItemList',\n pattern: /\\/collections\\/([^\\/]+)/,\n },\n {\n type: 'WebPage',\n pattern: /\\/pages\\/([^\\/]+)/,\n },\n {\n type: 'WebSite',\n pattern: /\\/blogs\\/([^\\/]+)/,\n },\n {\n type: 'BlogPosting',\n pattern: /\\/blogs\\/([^\\/]+)\\/([^\\/]+)/,\n },\n {\n type: 'Organization',\n pattern: '/policies',\n },\n {\n type: 'Organization',\n pattern: /\\/policies\\/([^\\/]+)/,\n },\n ];\n\n const typeMatches = routes.filter((route) => {\n const {pattern} = route;\n\n const regex = new RegExp(pattern);\n return regex.test(url);\n });\n\n return typeMatches.length > 0\n ? typeMatches[typeMatches.length - 1].type\n : defaultType;\n}\n","export * from './storefront';\nexport {\n CacheNone,\n CacheShort,\n CacheLong,\n CacheCustom,\n generateCacheControlHeader,\n} from './cache/strategies';\nexport {InMemoryCache} from './cache/in-memory';\n\nexport {storefrontRedirect} from './routing/redirect';\nexport {graphiqlLoader} from './routing/graphiql';\nexport {Seo} from './seo/seo';\nexport type {SeoHandleFunction} from './seo/seo';\n\nexport {\n AnalyticsEventName,\n AnalyticsPageType,\n ExternalVideo,\n flattenConnection,\n getClientBrowserParameters,\n getShopifyCookies,\n Image,\n MediaFile,\n ModelViewer,\n Money,\n parseMetafield,\n sendShopifyAnalytics,\n ShopifyAppSource,\n ShopPayButton,\n storefrontApiCustomScalars,\n useShopifyCookies,\n useMoney,\n Video,\n} from '@shopify/storefront-kit-react';\n\nexport type {\n ClientBrowserParameters,\n ParsedMetafields,\n ShopifyAddToCart,\n ShopifyAddToCartPayload,\n ShopifyAnalytics,\n ShopifyAnalyticsPayload,\n ShopifyAnalyticsProduct,\n ShopifyCookies,\n ShopifyPageView,\n ShopifyPageViewPayload,\n StorefrontApiResponse,\n StorefrontApiResponseError,\n StorefrontApiResponseOk,\n StorefrontApiResponseOkPartial,\n StorefrontApiResponsePartial,\n} from '@shopify/storefront-kit-react';\n"]}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { createStorefrontClient as createStorefrontClient$1 } from '@shopify/
|
|
1
|
+
import { createStorefrontClient as createStorefrontClient$1 } from '@shopify/storefront-kit-react';
|
|
2
|
+
export { AnalyticsEventName, AnalyticsPageType, ClientBrowserParameters, ExternalVideo, Image, MediaFile, ModelViewer, Money, ParsedMetafields, ShopPayButton, ShopifyAddToCart, ShopifyAddToCartPayload, ShopifyAnalytics, ShopifyAnalyticsPayload, ShopifyAnalyticsProduct, ShopifyAppSource, ShopifyCookies, ShopifyPageView, ShopifyPageViewPayload, StorefrontApiResponse, StorefrontApiResponseError, StorefrontApiResponseOk, StorefrontApiResponseOkPartial, StorefrontApiResponsePartial, Video, flattenConnection, getClientBrowserParameters, getShopifyCookies, parseMetafield, sendShopifyAnalytics, storefrontApiCustomScalars, useMoney, useShopifyCookies } from '@shopify/storefront-kit-react';
|
|
2
3
|
import { ExecutionArgs } from 'graphql';
|
|
3
|
-
import { LanguageCode, CountryCode } from '@shopify/
|
|
4
|
+
import { LanguageCode, CountryCode, Maybe } from '@shopify/storefront-kit-react/storefront-api-types';
|
|
4
5
|
import * as _remix_run_server_runtime from '@remix-run/server-runtime';
|
|
5
|
-
import { LoaderArgs } from '@remix-run/server-runtime';
|
|
6
|
+
import { LoaderArgs, LoaderFunction, SerializeFrom, AppData } from '@remix-run/server-runtime';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { Params, Location } from '@remix-run/react';
|
|
9
|
+
import { WithContext } from 'schema-dts';
|
|
6
10
|
|
|
7
11
|
interface AllCacheOptions {
|
|
8
12
|
mode?: string;
|
|
@@ -215,4 +219,202 @@ declare function graphiqlLoader({ context }?: _remix_run_server_runtime.DataFunc
|
|
|
215
219
|
context: LoaderArgs['context'] & StorefrontClient;
|
|
216
220
|
}): Response;
|
|
217
221
|
|
|
218
|
-
|
|
222
|
+
interface Seo$1 {
|
|
223
|
+
/**
|
|
224
|
+
* The <title> HTML element defines the document's title that is shown in a
|
|
225
|
+
* browser's title bar or a page's tab. It only contains text; tags within the
|
|
226
|
+
* element are ignored.
|
|
227
|
+
*
|
|
228
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title
|
|
229
|
+
*/
|
|
230
|
+
title: Maybe<string> | undefined;
|
|
231
|
+
/**
|
|
232
|
+
* Generate the title from a template that includes a `%s` placeholder for the
|
|
233
|
+
* title.
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```js
|
|
237
|
+
* {
|
|
238
|
+
* title: 'My Page',
|
|
239
|
+
* titleTemplate: 'My Site - %s',
|
|
240
|
+
* }
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
titleTemplate: Maybe<string> | undefined | null;
|
|
244
|
+
/**
|
|
245
|
+
* The media associated with the given page (images, videos, etc). If you pass
|
|
246
|
+
* a string, it will be used as the `og:image` meta tag. If you pass an object
|
|
247
|
+
* or an array of objects, that will be used to generate `og:<type of media>`
|
|
248
|
+
* meta tags. The `url` property should be the URL of the media. The `height`
|
|
249
|
+
* and `width` properties are optional and should be the height and width of
|
|
250
|
+
* the media. The `alt` property is optional and should be a description of
|
|
251
|
+
* the media.
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```js
|
|
255
|
+
* {
|
|
256
|
+
* media: [
|
|
257
|
+
* {
|
|
258
|
+
* url: 'https://example.com/image.jpg',
|
|
259
|
+
* type: 'image',
|
|
260
|
+
* height: '400',
|
|
261
|
+
* width: '400',
|
|
262
|
+
* alt: 'A custom snowboard with an alpine color pallet.',
|
|
263
|
+
* }
|
|
264
|
+
* ]
|
|
265
|
+
* }
|
|
266
|
+
* ```
|
|
267
|
+
*
|
|
268
|
+
*/
|
|
269
|
+
media: Maybe<string> | undefined | SeoMedia | SeoMedia[];
|
|
270
|
+
/**
|
|
271
|
+
* The description of the page. This is used in the `name="description"` meta
|
|
272
|
+
* tag as well as the `og:description` meta tag.
|
|
273
|
+
*
|
|
274
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
|
|
275
|
+
*/
|
|
276
|
+
description: Maybe<string> | undefined;
|
|
277
|
+
/**
|
|
278
|
+
* The canonical URL of the page. This is used to tell search engines which
|
|
279
|
+
* URL is the canonical version of a page. This is useful when you have
|
|
280
|
+
* multiple URLs that point to the same page. The value here will be used in
|
|
281
|
+
* the `rel="canonical"` link tag as well as the `og:url` meta tag.
|
|
282
|
+
*
|
|
283
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link
|
|
284
|
+
*/
|
|
285
|
+
url: Maybe<string> | undefined;
|
|
286
|
+
/**
|
|
287
|
+
* The handle is used to generate the `twitter:site` and `twitter:creator`
|
|
288
|
+
* meta tags. Include the `@` symbol in the handle.
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* ```js
|
|
292
|
+
* {
|
|
293
|
+
* handle: '@shopify'
|
|
294
|
+
* }
|
|
295
|
+
* ```
|
|
296
|
+
*/
|
|
297
|
+
handle: Maybe<string> | undefined;
|
|
298
|
+
/**
|
|
299
|
+
* The `ldJson` property is used to generate the `application/ld+json` script
|
|
300
|
+
* tag. This is used to provide structured data to search engines. The value
|
|
301
|
+
* should be an object that conforms to the schema.org spec. The `type`
|
|
302
|
+
* property should be the type of schema you are using. The `type` property is
|
|
303
|
+
* required and should be one of the following:
|
|
304
|
+
*
|
|
305
|
+
* - `Product`
|
|
306
|
+
* - `ItemList`
|
|
307
|
+
* - `Organization`
|
|
308
|
+
* - `WebSite`
|
|
309
|
+
* - `WebPage`
|
|
310
|
+
* - `BlogPosting`
|
|
311
|
+
* - `Thing`
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* ```js
|
|
315
|
+
* {
|
|
316
|
+
* ldJson: {
|
|
317
|
+
* '@context': 'https://schema.org',
|
|
318
|
+
* '@type': 'Product',
|
|
319
|
+
* name: 'My Product',
|
|
320
|
+
* image: 'https://example.com/image.jpg',
|
|
321
|
+
* description: 'A product that is great',
|
|
322
|
+
* sku: '12345',
|
|
323
|
+
* mpn: '12345',
|
|
324
|
+
* brand: {
|
|
325
|
+
* '@type': 'Thing',
|
|
326
|
+
* name: 'My Brand',
|
|
327
|
+
* },
|
|
328
|
+
* aggregateRating: {
|
|
329
|
+
* '@type': 'AggregateRating',
|
|
330
|
+
* ratingValue: '4.5',
|
|
331
|
+
* reviewCount: '100',
|
|
332
|
+
* },
|
|
333
|
+
* offers: {
|
|
334
|
+
* '@type': 'Offer',
|
|
335
|
+
* priceCurrency: 'USD',
|
|
336
|
+
* price: '100',
|
|
337
|
+
* priceValidUntil: '2020-11-05',
|
|
338
|
+
* itemCondition: 'https://schema.org/NewCondition',
|
|
339
|
+
* availability: 'https://schema.org/InStock',
|
|
340
|
+
* seller: {
|
|
341
|
+
* '@type': 'Organization',
|
|
342
|
+
* name: 'My Brand',
|
|
343
|
+
* },
|
|
344
|
+
* },
|
|
345
|
+
* }
|
|
346
|
+
* }
|
|
347
|
+
* ```
|
|
348
|
+
*
|
|
349
|
+
* @see https://schema.org/docs/schemas.html
|
|
350
|
+
* @see https://developers.google.com/search/docs/guides/intro-structured-data
|
|
351
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
|
|
352
|
+
*
|
|
353
|
+
*/
|
|
354
|
+
ldJson: <T extends SchemaType>(type: T) => WithContext<T>;
|
|
355
|
+
/**
|
|
356
|
+
* The `alternates` property is used to specify the language and geographical targeting when you have multiple
|
|
357
|
+
* versions of the same page in different languages. The `url` property tells search engines about these variations
|
|
358
|
+
* and helps them to serve the correct version to their users.
|
|
359
|
+
*
|
|
360
|
+
* @example
|
|
361
|
+
* ```js
|
|
362
|
+
* {
|
|
363
|
+
* alternates: [
|
|
364
|
+
* {
|
|
365
|
+
* language: 'en-US',
|
|
366
|
+
* url: 'https://hydrogen.shop/en-us',
|
|
367
|
+
* default: true,
|
|
368
|
+
* },
|
|
369
|
+
* {
|
|
370
|
+
* media: 'only screen and (max-width: 640px)',
|
|
371
|
+
* url: 'https://m.hydrogen.shop/en-ca',
|
|
372
|
+
* },
|
|
373
|
+
* {
|
|
374
|
+
* language: 'fr-CA',
|
|
375
|
+
* url: 'https://hydrogen.shop/fr-ca',
|
|
376
|
+
* },
|
|
377
|
+
* ]
|
|
378
|
+
* }
|
|
379
|
+
* ```
|
|
380
|
+
* @see https://support.google.com/webmasters/answer/189077?hl=en
|
|
381
|
+
*/
|
|
382
|
+
alternates: (LanguageAlternate | MobileAlternate)[];
|
|
383
|
+
}
|
|
384
|
+
interface LanguageAlternate {
|
|
385
|
+
language: string;
|
|
386
|
+
default?: boolean;
|
|
387
|
+
url: string;
|
|
388
|
+
}
|
|
389
|
+
interface MobileAlternate {
|
|
390
|
+
media: string;
|
|
391
|
+
url: string;
|
|
392
|
+
}
|
|
393
|
+
type SeoMedia = {
|
|
394
|
+
type: 'image' | 'video' | 'audio';
|
|
395
|
+
url: Maybe<string> | undefined;
|
|
396
|
+
height: Maybe<number> | undefined;
|
|
397
|
+
width: Maybe<number> | undefined;
|
|
398
|
+
altText: Maybe<string> | undefined;
|
|
399
|
+
};
|
|
400
|
+
type SchemaType = 'Product' | 'ItemList' | 'Organization' | 'WebSite' | 'WebPage' | 'BlogPosting' | 'Thing';
|
|
401
|
+
|
|
402
|
+
interface SeoHandleFunction<Loader extends LoaderFunction | unknown = unknown> {
|
|
403
|
+
(args: {
|
|
404
|
+
data: Loader extends LoaderFunction ? SerializeFrom<Loader> : AppData;
|
|
405
|
+
id: string;
|
|
406
|
+
params: Params;
|
|
407
|
+
pathname: Location['pathname'];
|
|
408
|
+
search: Location['search'];
|
|
409
|
+
hash: Location['hash'];
|
|
410
|
+
key: string;
|
|
411
|
+
}): Partial<Seo$1>;
|
|
412
|
+
}
|
|
413
|
+
interface SeoProps {
|
|
414
|
+
debug?: boolean;
|
|
415
|
+
}
|
|
416
|
+
declare function Seo({ debug }: SeoProps): React.FunctionComponentElement<{
|
|
417
|
+
children?: React.ReactNode;
|
|
418
|
+
}>;
|
|
419
|
+
|
|
420
|
+
export { CacheCustom, CacheLong, CacheNone, CacheShort, CreateStorefrontClientOptions, InMemoryCache, Seo, SeoHandleFunction, Storefront, StorefrontClient, StorefrontMutationOptions, StorefrontQueryOptions, createStorefrontClient, generateCacheControlHeader, graphiqlLoader, isStorefrontApiError, storefrontRedirect };
|