@shopify/hydrogen 2023.1.2 → 2023.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/development/index.cjs +4 -0
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +4 -0
- package/dist/development/index.js.map +1 -1
- package/dist/production/index.cjs +10 -10
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.d.ts +1 -1
- package/dist/production/index.js +5 -5
- package/dist/production/index.js.map +1 -1
- package/package.json +3 -1
package/dist/production/index.js
CHANGED
|
@@ -4,8 +4,8 @@ export { AnalyticsEventName, AnalyticsPageType, ExternalVideo, Image, MediaFile,
|
|
|
4
4
|
import { redirect } from '@remix-run/server-runtime';
|
|
5
5
|
import { useMatches, useLocation } from '@remix-run/react';
|
|
6
6
|
|
|
7
|
-
var Me=a(p=>{var E=Symbol.for("react.element"),it=Symbol.for("react.portal"),ct=Symbol.for("react.fragment"),ut=Symbol.for("react.strict_mode"),pt=Symbol.for("react.profiler"),ft=Symbol.for("react.provider"),lt=Symbol.for("react.context"),ht=Symbol.for("react.forward_ref"),gt=Symbol.for("react.suspense"),dt=Symbol.for("react.memo"),yt=Symbol.for("react.lazy"),xe=Symbol.iterator;function mt(e){return e===null||typeof e!="object"?null:(e=xe&&e[xe]||e["@@iterator"],typeof e=="function"?e:null)}var ke={isMounted:function(){return !1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ae=Object.assign,Pe={};function x(e,t,r){this.props=e,this.context=t,this.refs=Pe,this.updater=r||ke;}x.prototype.isReactComponent={};x.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)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,e,t,"setState");};x.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate");};function Oe(){}Oe.prototype=x.prototype;function X(e,t,r){this.props=e,this.context=t,this.refs=Pe,this.updater=r||ke;}var Y=X.prototype=new Oe;Y.constructor=X;Ae(Y,x.prototype);Y.isPureReactComponent=!0;var be=Array.isArray,Ie=Object.prototype.hasOwnProperty,Z={current:null},_e={key:!0,ref:!0,__self:!0,__source:!0};function ve(e,t,r){var n,o={},s=null,a=null;if(t!=null)for(n in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(s=""+t.key),t)Ie.call(t,n)&&!_e.hasOwnProperty(n)&&(o[n]=t[n]);var i=arguments.length-2;if(i===1)o.children=r;else if(1<i){for(var c=Array(i),u=0;u<i;u++)c[u]=arguments[u+2];o.children=c;}if(e&&e.defaultProps)for(n in i=e.defaultProps,i)o[n]===void 0&&(o[n]=i[n]);return {$$typeof:E,type:e,key:s,ref:a,props:o,_owner:Z.current}}function St(e,t){return {$$typeof:E,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function ee(e){return typeof e=="object"&&e!==null&&e.$$typeof===E}function Ct(e){var t={"=":"=0",":":"=2"};return "$"+e.replace(/[=:]/g,function(r){return t[r]})}var Ee=/\/+/g;function J(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Ct(""+e.key):t.toString(36)}function I(e,t,r,n,o){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(s){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case E:case it:a=!0;}}if(a)return a=e,o=o(a),e=n===""?"."+J(a,0):n,be(o)?(r="",e!=null&&(r=e.replace(Ee,"$&/")+"/"),I(o,t,r,"",function(u){return u})):o!=null&&(ee(o)&&(o=St(o,r+(!o.key||a&&a.key===o.key?"":(""+o.key).replace(Ee,"$&/")+"/")+e)),t.push(o)),1;if(a=0,n=n===""?".":n+":",be(e))for(var i=0;i<e.length;i++){s=e[i];var c=n+J(s,i);a+=I(s,t,r,c,o);}else if(c=mt(e),typeof c=="function")for(e=c.call(e),i=0;!(s=e.next()).done;)s=s.value,c=n+J(s,i++),a+=I(s,t,r,c,o);else if(s==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function O(e,t,r){if(e==null)return e;var n=[],o=0;return I(e,n,"","",function(s){return t.call(r,s,o++)}),n}function Tt(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r);},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r);}),e._status===-1&&(e._status=0,e._result=t);}if(e._status===1)return e._result.default;throw e._result}var m={current:null},_={transition:null},Rt={ReactCurrentDispatcher:m,ReactCurrentBatchConfig:_,ReactCurrentOwner:Z};p.Children={map:O,forEach:function(e,t,r){O(e,function(){t.apply(this,arguments);},r);},count:function(e){var t=0;return O(e,function(){t++;}),t},toArray:function(e){return O(e,function(t){return t})||[]},only:function(e){if(!ee(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};p.Component=x;p.Fragment=ct;p.Profiler=pt;p.PureComponent=X;p.StrictMode=ut;p.Suspense=gt;p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Rt;p.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=Ae({},e.props),o=e.key,s=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,a=Z.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var i=e.type.defaultProps;for(c in t)Ie.call(t,c)&&!_e.hasOwnProperty(c)&&(n[c]=t[c]===void 0&&i!==void 0?i[c]:t[c]);}var c=arguments.length-2;if(c===1)n.children=r;else if(1<c){i=Array(c);for(var u=0;u<c;u++)i[u]=arguments[u+2];n.children=i;}return {$$typeof:E,type:e.type,key:o,ref:s,props:n,_owner:a}};p.createContext=function(e){return e={$$typeof:lt,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:ft,_context:e},e.Consumer=e};p.createElement=ve;p.createFactory=function(e){var t=ve.bind(null,e);return t.type=e,t};p.createRef=function(){return {current:null}};p.forwardRef=function(e){return {$$typeof:ht,render:e}};p.isValidElement=ee;p.lazy=function(e){return {$$typeof:yt,_payload:{_status:-1,_result:e},_init:Tt}};p.memo=function(e,t){return {$$typeof:dt,type:e,compare:t===void 0?null:t}};p.startTransition=function(e){var t=_.transition;_.transition={};try{e();}finally{_.transition=t;}};p.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};p.useCallback=function(e,t){return m.current.useCallback(e,t)};p.useContext=function(e){return m.current.useContext(e)};p.useDebugValue=function(){};p.useDeferredValue=function(e){return m.current.useDeferredValue(e)};p.useEffect=function(e,t){return m.current.useEffect(e,t)};p.useId=function(){return m.current.useId()};p.useImperativeHandle=function(e,t,r){return m.current.useImperativeHandle(e,t,r)};p.useInsertionEffect=function(e,t){return m.current.useInsertionEffect(e,t)};p.useLayoutEffect=function(e,t){return m.current.useLayoutEffect(e,t)};p.useMemo=function(e,t){return m.current.useMemo(e,t)};p.useReducer=function(e,t,r){return m.current.useReducer(e,t,r)};p.useRef=function(e){return m.current.useRef(e)};p.useState=function(e){return m.current.useState(e)};p.useSyncExternalStore=function(e,t,r){return m.current.useSyncExternalStore(e,t,r)};p.useTransition=function(){return m.current.useTransition()};p.version="18.2.0";});var je=a((ir,Le)=>{Le.exports=Me();});function ae(e){let t=Array.isArray(e)?e:[e],r="";for(let n of t)n!=null&&(typeof n=="object"?!!n.body&&typeof n.body=="string"?r+=n.body:r+=JSON.stringify(n):r+=n);return r}var N="public",We="private",Be="no-store",se={maxAge:"max-age",staleWhileRevalidate:"stale-while-revalidate",sMaxAge:"s-maxage",staleIfError:"stale-if-error"};function b(e){let t=[];return Object.keys(e).forEach(r=>{r==="mode"?t.push(e[r]):se[r]&&t.push(`${se[r]}=${e[r]}`);}),t.join(", ")}function F(){return {mode:Be}}function ie(e){if(e?.mode&&e?.mode!==N&&e?.mode!==We)throw Error("'mode' must be either 'public' or 'private'")}function T(e){return ie(e),{mode:N,maxAge:1,staleWhileRevalidate:9,...e}}function W(e){return ie(e),{mode:N,maxAge:3600,staleWhileRevalidate:82800,...e}}function B(e){return e}function A(e,t){return e&&t?{...e,...t}:e||T()}function V(e){return b(A(e))}async function Ve(e,t){if(!e)return;let r=await e.match(t);if(!r){t.url;return}return t.url,r}async function Qe(e,t,r,n){if(!e)return;let o=A(n);t.headers.set("cache-control",V(A(o,{maxAge:(o.maxAge||0)+(o.staleWhileRevalidate||0)})));let s=V(A(o));r.headers.set("cache-control",s),r.headers.set("real-cache-control",s),r.headers.set("cache-put-date",new Date().toUTCString()),t.url,await e.put(t,r);}async function Ge(e,t){!e||(t.url,await e.delete(t));}function Ke(e,t){let r=t.headers.get("cache-put-date"),n=t.headers.get("real-cache-control"),o=0;if(n){let c=n.match(/max-age=(\d*)/);c&&c.length>1&&(o=parseFloat(c[1]));}if(!r)return !1;let i=(new Date().valueOf()-new Date(r).valueOf())/1e3>o;return i&&(e.url,void 0),i}var P={get:Ve,set:Qe,delete:Ge,generateDefaultCacheControlHeader:V,isStale:Ke};function Q(e){return `https://shopify.dev/?${e}`}function ze(e){return e||T()}async function ce(e,t){if(!e)return;let r=Q(t),n=new Request(r),o=await P.get(e,n);if(!!o)return [await o.json(),o]}async function G(e,t,r,n){if(!e)return;let o=Q(t),s=new Request(o),a=new Response(JSON.stringify(r));await P.set(e,s,a,ze(n));}function ue(e,t){return P.isStale(new Request(Q(e)),t)}function pe(e,t){return [e,{status:t.status,statusText:t.statusText,headers:Array.from(t.headers.entries())}]}var fe=e=>!e?.errors,K=new Set;async function le(e,t,{cacheInstance:r,cache:n,cacheKey:o=[e,t],shouldCacheResponse:s=()=>!0,waitUntil:a,returnType:i="json"}={}){!n&&(!t.method||t.method==="GET")&&(n=T());let c=async()=>{let d=await fetch(e,t),f;try{f=await d[i]();}catch{f=await d.text();}return [f,d]};if(!r||!o||!n)return c();let u=ae([...typeof o=="string"?[o]:o]),h=await ce(r,u);if(h){let[d,f]=h;if(!K.has(u)&&ue(u,f)){K.add(u);let q=Promise.resolve().then(async()=>{try{let[C,k]=await c();s(C,k)&&await G(r,u,pe(C,k),n);}catch(C){C.message&&(C.message="SWR in sub-request failed: "+C.message),console.error(C);}finally{K.delete(u);}});a?.(q);}let[y,w]=d;return [y,new Response(y,w)]}let[S,l]=await c();if(s(S,l)){let d=G(r,u,pe(S,l),n);a?.(d);}return [S,l]}var he="Custom-Storefront-Request-Group-ID",ge="Shopify-Storefront-Buyer-IP",de="Shopify-Storefront-Id";function ye(){return typeof crypto<"u"&&!!crypto.randomUUID?crypto.randomUUID():`weak-${Math.random().toString(16).substring(2)}`}function me(e){return String(e).includes("__proto__")?JSON.parse(e,Je):JSON.parse(e)}function Je(e,t){if(e!=="__proto__")return t}var Se=new Set,Ce=e=>{Se.has(e)||(console.warn(e),Se.add(e));};var we=class extends Error{},Ye=e=>e instanceof we,Ze=/(^|}\s)query[\s({]/im,et=/(^|}\s)mutation[\s({]/im;function Te(e){return e.replace(/\s*#.*$/gm,"").replace(/\s+/gm," ").trim()}var tt={language:"EN",country:"US"};function Zt({cache:e,waitUntil:t,buyerIp:r,i18n:n,requestGroupId:o,storefrontId:s,...a}){e||Ce("Storefront API client created without a cache instance. This may slow down your sub-requests.");let{getPublicTokenHeaders:i,getPrivateTokenHeaders:c,getStorefrontApiUrl:u,getShopifyDomain:h}=createStorefrontClient(a),l=(a.privateStorefrontToken?c:i)({contentType:"json"});l[he]=o||ye(),r&&(l[ge]=r),s&&(l[de]=s);async function d({query:f,mutation:y,variables:w,cache:q,headers:C=[],storefrontApiVersion:k}){let He=C instanceof Headers?Object.fromEntries(C.entries()):Array.isArray(C)?Object.fromEntries(C):C;f=f??y;let U={...w};n&&(!w?.country&&/\$country/.test(f)&&(U.country=n.country),!w?.language&&/\$language/.test(f)&&(U.language=n.language));let De=u({storefrontApiVersion:k}),$e={method:"POST",headers:{...l,...He},body:JSON.stringify({query:f,variables:U})},[H,D]=await le(De,$e,{cacheInstance:y?void 0:e,cache:q||T(),shouldCacheResponse:fe,waitUntil:t});if(!D.ok){let $;try{$=me(H);}catch{$=[{message:H}];}Re(D,$);}let{data:Ne,errors:re}=H;return re?.length&&Re(D,re,we),Ne}return {storefront:{query:(f,y)=>{if(f=Te(f),et.test(f))throw new Error("storefront.query cannot execute mutations");return d({...y,query:f})},mutate:(f,y)=>{if(f=Te(f),Ze.test(f))throw new Error("storefront.mutate cannot execute queries");return d({...y,mutation:f})},cache:e,CacheNone:F,CacheLong:W,CacheShort:T,CacheCustom:B,generateCacheControlHeader:b,getPublicTokenHeaders:i,getPrivateTokenHeaders:c,getShopifyDomain:h,getApiUrl:u,isApiError:Ye,i18n:n??tt}}}function Re(e,t,r=Error){let n=e.headers.get("x-request-id"),o=n?` - Request ID: ${n}`:"";if(t){let s=typeof t=="string"?t:t.map(a=>a.message).join(`
|
|
8
|
-
`);throw new r(s+o)}throw new r(`API response error: ${e.status}`+o)}var
|
|
7
|
+
var Le=a(p=>{var E=Symbol.for("react.element"),ct=Symbol.for("react.portal"),ut=Symbol.for("react.fragment"),pt=Symbol.for("react.strict_mode"),ft=Symbol.for("react.profiler"),lt=Symbol.for("react.provider"),ht=Symbol.for("react.context"),gt=Symbol.for("react.forward_ref"),dt=Symbol.for("react.suspense"),yt=Symbol.for("react.memo"),mt=Symbol.for("react.lazy"),be=Symbol.iterator;function St(e){return e===null||typeof e!="object"?null:(e=be&&e[be]||e["@@iterator"],typeof e=="function"?e:null)}var Ae={isMounted:function(){return !1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Pe=Object.assign,Ie={};function x(e,t,r){this.props=e,this.context=t,this.refs=Ie,this.updater=r||Ae;}x.prototype.isReactComponent={};x.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)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,e,t,"setState");};x.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate");};function Oe(){}Oe.prototype=x.prototype;function Y(e,t,r){this.props=e,this.context=t,this.refs=Ie,this.updater=r||Ae;}var Z=Y.prototype=new Oe;Z.constructor=Y;Pe(Z,x.prototype);Z.isPureReactComponent=!0;var Ee=Array.isArray,_e=Object.prototype.hasOwnProperty,ee={current:null},ve={key:!0,ref:!0,__self:!0,__source:!0};function Me(e,t,r){var n,o={},s=null,a=null;if(t!=null)for(n in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(s=""+t.key),t)_e.call(t,n)&&!ve.hasOwnProperty(n)&&(o[n]=t[n]);var i=arguments.length-2;if(i===1)o.children=r;else if(1<i){for(var c=Array(i),u=0;u<i;u++)c[u]=arguments[u+2];o.children=c;}if(e&&e.defaultProps)for(n in i=e.defaultProps,i)o[n]===void 0&&(o[n]=i[n]);return {$$typeof:E,type:e,key:s,ref:a,props:o,_owner:ee.current}}function Ct(e,t){return {$$typeof:E,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function te(e){return typeof e=="object"&&e!==null&&e.$$typeof===E}function Tt(e){var t={"=":"=0",":":"=2"};return "$"+e.replace(/[=:]/g,function(r){return t[r]})}var ke=/\/+/g;function X(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Tt(""+e.key):t.toString(36)}function O(e,t,r,n,o){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(s){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case E:case ct:a=!0;}}if(a)return a=e,o=o(a),e=n===""?"."+X(a,0):n,Ee(o)?(r="",e!=null&&(r=e.replace(ke,"$&/")+"/"),O(o,t,r,"",function(u){return u})):o!=null&&(te(o)&&(o=Ct(o,r+(!o.key||a&&a.key===o.key?"":(""+o.key).replace(ke,"$&/")+"/")+e)),t.push(o)),1;if(a=0,n=n===""?".":n+":",Ee(e))for(var i=0;i<e.length;i++){s=e[i];var c=n+X(s,i);a+=O(s,t,r,c,o);}else if(c=St(e),typeof c=="function")for(e=c.call(e),i=0;!(s=e.next()).done;)s=s.value,c=n+X(s,i++),a+=O(s,t,r,c,o);else if(s==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function I(e,t,r){if(e==null)return e;var n=[],o=0;return O(e,n,"","",function(s){return t.call(r,s,o++)}),n}function Rt(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r);},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r);}),e._status===-1&&(e._status=0,e._result=t);}if(e._status===1)return e._result.default;throw e._result}var m={current:null},_={transition:null},wt={ReactCurrentDispatcher:m,ReactCurrentBatchConfig:_,ReactCurrentOwner:ee};p.Children={map:I,forEach:function(e,t,r){I(e,function(){t.apply(this,arguments);},r);},count:function(e){var t=0;return I(e,function(){t++;}),t},toArray:function(e){return I(e,function(t){return t})||[]},only:function(e){if(!te(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};p.Component=x;p.Fragment=ut;p.Profiler=ft;p.PureComponent=Y;p.StrictMode=pt;p.Suspense=dt;p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=wt;p.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=Pe({},e.props),o=e.key,s=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,a=ee.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var i=e.type.defaultProps;for(c in t)_e.call(t,c)&&!ve.hasOwnProperty(c)&&(n[c]=t[c]===void 0&&i!==void 0?i[c]:t[c]);}var c=arguments.length-2;if(c===1)n.children=r;else if(1<c){i=Array(c);for(var u=0;u<c;u++)i[u]=arguments[u+2];n.children=i;}return {$$typeof:E,type:e.type,key:o,ref:s,props:n,_owner:a}};p.createContext=function(e){return e={$$typeof:ht,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:lt,_context:e},e.Consumer=e};p.createElement=Me;p.createFactory=function(e){var t=Me.bind(null,e);return t.type=e,t};p.createRef=function(){return {current:null}};p.forwardRef=function(e){return {$$typeof:gt,render:e}};p.isValidElement=te;p.lazy=function(e){return {$$typeof:mt,_payload:{_status:-1,_result:e},_init:Rt}};p.memo=function(e,t){return {$$typeof:yt,type:e,compare:t===void 0?null:t}};p.startTransition=function(e){var t=_.transition;_.transition={};try{e();}finally{_.transition=t;}};p.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};p.useCallback=function(e,t){return m.current.useCallback(e,t)};p.useContext=function(e){return m.current.useContext(e)};p.useDebugValue=function(){};p.useDeferredValue=function(e){return m.current.useDeferredValue(e)};p.useEffect=function(e,t){return m.current.useEffect(e,t)};p.useId=function(){return m.current.useId()};p.useImperativeHandle=function(e,t,r){return m.current.useImperativeHandle(e,t,r)};p.useInsertionEffect=function(e,t){return m.current.useInsertionEffect(e,t)};p.useLayoutEffect=function(e,t){return m.current.useLayoutEffect(e,t)};p.useMemo=function(e,t){return m.current.useMemo(e,t)};p.useReducer=function(e,t,r){return m.current.useReducer(e,t,r)};p.useRef=function(e){return m.current.useRef(e)};p.useState=function(e){return m.current.useState(e)};p.useSyncExternalStore=function(e,t,r){return m.current.useSyncExternalStore(e,t,r)};p.useTransition=function(){return m.current.useTransition()};p.version="18.2.0";});var qe=a((pr,je)=>{je.exports=Le();});function se(e){let t=Array.isArray(e)?e:[e],r="";for(let n of t)n!=null&&(typeof n=="object"?!!n.body&&typeof n.body=="string"?r+=n.body:r+=JSON.stringify(n):r+=n);return r}var N="public",Be="private",Ve="no-store",ie={maxAge:"max-age",staleWhileRevalidate:"stale-while-revalidate",sMaxAge:"s-maxage",staleIfError:"stale-if-error"};function b(e){let t=[];return Object.keys(e).forEach(r=>{r==="mode"?t.push(e[r]):ie[r]&&t.push(`${ie[r]}=${e[r]}`);}),t.join(", ")}function F(){return {mode:Ve}}function ce(e){if(e?.mode&&e?.mode!==N&&e?.mode!==Be)throw Error("'mode' must be either 'public' or 'private'")}function T(e){return ce(e),{mode:N,maxAge:1,staleWhileRevalidate:9,...e}}function W(e){return ce(e),{mode:N,maxAge:3600,staleWhileRevalidate:82800,...e}}function B(e){return e}function A(e,t){return e&&t?{...e,...t}:e||T()}function V(e){return b(A(e))}async function Qe(e,t){if(!e)return;let r=await e.match(t);if(!r){t.url;return}return t.url,r}async function Ge(e,t,r,n){if(!e)return;let o=A(n);t.headers.set("cache-control",V(A(o,{maxAge:(o.maxAge||0)+(o.staleWhileRevalidate||0)})));let s=V(A(o));r.headers.set("cache-control",s),r.headers.set("real-cache-control",s),r.headers.set("cache-put-date",new Date().toUTCString()),t.url,await e.put(t,r);}async function Ke(e,t){!e||(t.url,await e.delete(t));}function ze(e,t){let r=t.headers.get("cache-put-date"),n=t.headers.get("real-cache-control"),o=0;if(n){let c=n.match(/max-age=(\d*)/);c&&c.length>1&&(o=parseFloat(c[1]));}if(!r)return !1;let i=(new Date().valueOf()-new Date(r).valueOf())/1e3>o;return i&&(e.url,void 0),i}var P={get:Qe,set:Ge,delete:Ke,generateDefaultCacheControlHeader:V,isStale:ze};function Q(e){return `https://shopify.dev/?${e}`}function Je(e){return e||T()}async function ue(e,t){if(!e)return;let r=Q(t),n=new Request(r),o=await P.get(e,n);if(!!o)return [await o.json(),o]}async function G(e,t,r,n){if(!e)return;let o=Q(t),s=new Request(o),a=new Response(JSON.stringify(r));await P.set(e,s,a,Je(n));}function pe(e,t){return P.isStale(new Request(Q(e)),t)}function fe(e,t){return [e,{status:t.status,statusText:t.statusText,headers:Array.from(t.headers.entries())}]}var le=e=>!e?.errors,K=new Set;async function he(e,t,{cacheInstance:r,cache:n,cacheKey:o=[e,t],shouldCacheResponse:s=()=>!0,waitUntil:a,returnType:i="json"}={}){!n&&(!t.method||t.method==="GET")&&(n=T());let c=async()=>{let d=await fetch(e,t),l;try{l=await d[i]();}catch{l=await d.text();}return [l,d]};if(!r||!o||!n)return c();let u=se([...typeof o=="string"?[o]:o]),h=await ue(r,u);if(h){let[d,l]=h;if(!K.has(u)&&pe(u,l)){K.add(u);let q=Promise.resolve().then(async()=>{try{let[C,k]=await c();s(C,k)&&await G(r,u,fe(C,k),n);}catch(C){C.message&&(C.message="SWR in sub-request failed: "+C.message),console.error(C);}finally{K.delete(u);}});a?.(q);}let[y,w]=d;return [y,new Response(y,w)]}let[S,f]=await c();if(s(S,f)){let d=G(r,u,fe(S,f),n);a?.(d);}return [S,f]}var ge="Custom-Storefront-Request-Group-ID",de="Shopify-Storefront-Buyer-IP",ye="Shopify-Storefront-Id";function me(){return typeof crypto<"u"&&!!crypto.randomUUID?crypto.randomUUID():`weak-${Math.random().toString(16).substring(2)}`}function Se(e){return String(e).includes("__proto__")?JSON.parse(e,Xe):JSON.parse(e)}function Xe(e,t){if(e!=="__proto__")return t}var Ce=new Set,Te=e=>{Ce.has(e)||(console.warn(e),Ce.add(e));};var z="2023.1.3";var xe=class extends Error{},Ze=e=>e instanceof xe,et=/(^|}\s)query[\s({]/im,tt=/(^|}\s)mutation[\s({]/im;function Re(e){return e.replace(/\s*#.*$/gm,"").replace(/\s+/gm," ").trim()}var rt={language:"EN",country:"US"};function rr({cache:e,waitUntil:t,buyerIp:r,i18n:n,requestGroupId:o,storefrontId:s,...a}){e||Te("Storefront API client created without a cache instance. This may slow down your sub-requests.");let{getPublicTokenHeaders:i,getPrivateTokenHeaders:c,getStorefrontApiUrl:u,getShopifyDomain:h}=createStorefrontClient(a),f=(a.privateStorefrontToken?c:i)({contentType:"json"});f[ge]=o||me(),r&&(f[de]=r),s&&(f[ye]=s),(f["user-agent"]=`Hydrogen ${z}`);async function d({query:l,mutation:y,variables:w,cache:q,headers:C=[],storefrontApiVersion:k}){let De=C instanceof Headers?Object.fromEntries(C.entries()):Array.isArray(C)?Object.fromEntries(C):C;l=l??y;let U={...w};n&&(!w?.country&&/\$country/.test(l)&&(U.country=n.country),!w?.language&&/\$language/.test(l)&&(U.language=n.language));let $e=u({storefrontApiVersion:k}),Ne={method:"POST",headers:{...f,...De},body:JSON.stringify({query:l,variables:U})},[H,D]=await he($e,Ne,{cacheInstance:y?void 0:e,cache:q||T(),shouldCacheResponse:le,waitUntil:t});if(!D.ok){let $;try{$=Se(H);}catch{$=[{message:H}];}we(D,$);}let{data:Fe,errors:ne}=H;return ne?.length&&we(D,ne,xe),Fe}return {storefront:{query:(l,y)=>{if(l=Re(l),tt.test(l))throw new Error("storefront.query cannot execute mutations");return d({...y,query:l})},mutate:(l,y)=>{if(l=Re(l),et.test(l))throw new Error("storefront.mutate cannot execute queries");return d({...y,mutation:l})},cache:e,CacheNone:F,CacheLong:W,CacheShort:T,CacheCustom:B,generateCacheControlHeader:b,getPublicTokenHeaders:i,getPrivateTokenHeaders:c,getShopifyDomain:h,getApiUrl:u,isApiError:Ze,i18n:n??rt}}}function we(e,t,r=Error){let n=e.headers.get("x-request-id"),o=n?` - Request ID: ${n}`:"";if(t){let s=typeof t=="string"?t:t.map(a=>a.message).join(`
|
|
8
|
+
`);throw new r(s+o)}throw new r(`API response error: ${e.status}`+o)}var J=class{#e;constructor(){this.#e=new Map;}add(t){throw new Error("Method not implemented. Use `put` instead.")}addAll(t){throw new Error("Method not implemented. Use `put` instead.")}matchAll(t,r){throw new Error("Method not implemented. Use `match` instead.")}async put(t,r){if(t.method!=="GET")throw new TypeError("Cannot cache response to non-GET request.");if(r.status===206)throw new TypeError("Cannot cache response to a range request (206 Partial Content).");if(r.headers.get("vary")?.includes("*"))throw new TypeError("Cannot cache response with 'Vary: *' header.");this.#e.set(t.url,{body:new Uint8Array(await r.arrayBuffer()),status:r.status,headers:[...r.headers],timestamp:Date.now()});}async match(t){if(t.method!=="GET")return;let r=this.#e.get(t.url);if(!r)return;let{body:n,timestamp:o,...s}=r,a=new Headers(s.headers),i=a.get("cache-control")||a.get("real-cache-control")||"",c=parseInt(i.match(/max-age=(\d+)/)?.[1]||"0",10),u=parseInt(i.match(/stale-while-revalidate=(\d+)/)?.[1]||"0",10),h=(Date.now()-o)/1e3;if(h>c+u){this.#e.delete(t.url);return}let f=h>c;return a.set("cache",f?"STALE":"HIT"),a.set("date",new Date(o).toUTCString()),new Response(n,{status:s.status??200,headers:a})}async delete(t){return this.#e.has(t.url)?(this.#e.delete(t.url),!0):!1}keys(t){let r=[];for(let n of this.#e.keys())(!t||t.url===n)&&r.push(new Request(n));return Promise.resolve(r)}};async function ot({storefront:e,request:t,response:r=new Response("Not Found",{status:404})}){let{pathname:n,search:o}=new URL(t.url),s=n+o;try{let{urlRedirects:a}=await e.query(st,{variables:{query:"path:"+s},storefrontApiVersion:"2023-01"}),i=a?.edges?.[0]?.node?.target;if(i)return new Response(null,{status:302,headers:{location:i}});let c=new URLSearchParams(o),u=c.get("return_to")||c.get("redirect");if(u){if(at(u))return redirect(u);console.warn(`Cross-domain redirects are not supported. Tried to redirect from ${s} to ${u}`);}}catch(a){console.error(`Failed to fetch redirects from Storefront API for route ${s}`,a);}return r}function at(e){try{new URL(e);}catch{return !0}return !1}var st=`#graphql
|
|
9
9
|
query redirects($query: String) {
|
|
10
10
|
urlRedirects(first: 1, query: $query) {
|
|
11
11
|
edges {
|
|
@@ -15,7 +15,7 @@ var Me=a(p=>{var E=Symbol.for("react.element"),it=Symbol.for("react.portal"),ct=
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
`;function
|
|
18
|
+
`;function it({context:e}={}){if(!e?.storefront)throw new Error("GraphiQL: Hydrogen's storefront client must be injected in the loader context.");let t=e.storefront.getApiUrl(),r=e.storefront.getPublicTokenHeaders()["X-Shopify-Storefront-Access-Token"];return new Response(`
|
|
19
19
|
<!DOCTYPE html>
|
|
20
20
|
<html lang="en">
|
|
21
21
|
<head>
|
|
@@ -69,7 +69,7 @@ var Me=a(p=>{var E=Symbol.for("react.element"),it=Symbol.for("react.portal"),ct=
|
|
|
69
69
|
<\/script>
|
|
70
70
|
</body>
|
|
71
71
|
</html>
|
|
72
|
-
`,{status:200,headers:{"content-type":"text/html"}})}var R=b$1(
|
|
72
|
+
`,{status:200,headers:{"content-type":"text/html"}})}var R=b$1(qe(),1);var v="Error in SEO input: ",M={title:{validate:e=>{if(typeof e=="string"&&e.length>120)throw new Error(v.concat("`title` should not be longer than 120 characters"));return e}},description:{validate:e=>{if(typeof e=="string"&&e.length>155)throw new Error(v.concat("`description` should not be longer than 155 characters"));return e}},url:{validate:e=>{if(typeof e=="string"&&!e.startsWith("http"))throw new Error(v.concat("`url` should be a valid URL"));return e}},handle:{validate:e=>{if(typeof e=="string"&&!e.startsWith("@"))throw new Error(v.concat("`handle` should start with `@`"));return e}}};function He(e){let t=[],r={"@context":"https://schema.org","@type":"Thing"};for(let o of Object.keys(e)){let s=re(e[o]),a;if(!s)return [];let c=s.map(u=>{let h=[];if(!u)return h;switch(o){case"title":{a=L(M.title,u);let S=xt(e?.titleTemplate,a);h.push(g("title",{title:S}),g("meta",{property:"og:title",content:S}),g("meta",{name:"twitter:title",content:S})),r.name=a;break}case"description":a=L(M.description,u),h.push(g("meta",{name:"description",content:a}),g("meta",{property:"og:description",content:a}),g("meta",{name:"twitter:description",content:a})),r.description=a;break;case"url":a=L(M.url,u),h.push(g("meta",{property:"og:url",content:a}),g("link",{rel:"canonical",href:a})),r.url=a,r["@type"]=Et(a);break;case"handle":a=L(M.handle,u),h.push(g("meta",{name:"twitter:site",content:a}),g("meta",{name:"twitter:creator",content:a}));break;case"jsonLd":r={...r,...u};break;case"media":{let S=re(u);for(let f of S)if(typeof f=="string"&&(h.push(g("meta",{name:"og:image",content:f})),r.image=f),f&&typeof f=="object"){let d=f.type||"image",l=f?{url:f?.url,secure_url:f?.url,type:bt(f.url),width:f?.width,height:f?.height,alt:f?.altText}:{};for(let y of Object.keys(l))l[y]&&(a=l[y],h.push(g("meta",{property:`og:${d}:${y}`,content:a},l.url)));}break}case"alternates":{let S=re(u);for(let f of S){if(!f)continue;let{language:d,url:l,default:y}=f,w=d?`${d}${y?"-default":""}`:void 0;h.push(g("link",{rel:"alternate",hrefLang:w,href:l}));}break}}return h}).flat();t.push(c.filter(u=>!!u));}let n=[g("meta",{property:"og:type",content:"website"}),g("meta",{name:"twitter:card",content:"summary_large_image"})];return [...t,...n].flat().sort((o,s)=>o.key.localeCompare(s.key)).concat(g("script",{type:"application/ld+json",children:r})).flat()}function g(e,t,r){let n={tag:e,props:{},key:""};return e==="title"?(n.children=t.title,n.key=Ue(n),n):(e==="script"&&(n.children=JSON.stringify(t.children),delete t.children),n.props=t,Object.keys(n.props).forEach(o=>!n.props[o]&&delete n.props[o]),n.key=Ue(n,r),n)}function Ue(e,t){let{tag:r,props:n}=e;if(r==="title")return "0-title";if(r==="meta"){let o=n.content===t&&typeof n.property=="string"&&!n.property.endsWith("secure_url")&&"0";return [r,...[t,o],n.property||n.name].filter(a=>a).join("-")}return r==="link"?[r,n.rel,n.hrefLang||n.media].filter(s=>s).join("-").replace(/\s+/g,"-"):`${r}-${n.type}`}function xt(e,t){return e?typeof e=="function"?e(t):e.replace("%s",t??""):t}function bt(e){let t=e&&e.split(".").pop();return t==="svg"?"image/svg+xml":t==="png"?"image/png":t==="jpg"||t==="jpeg"?"image/jpeg":t==="gif"?"image/gif":t==="swf"?"application/x-shockwave-flash":t==="mp3"?"audio/mpeg":"image/jpeg"}function Et(e){let t="Thing";if(!e)return t;let n=[{type:"WebSite",pattern:"^/$"},{type:"Product",pattern:"/products/.*"},{type:"ItemList",pattern:/\/collections$/},{type:"ItemList",pattern:/\/collections\/([^/]+)/},{type:"WebPage",pattern:/\/pages\/([^/]+)/},{type:"WebSite",pattern:/\/blogs\/([^/]+)/},{type:"BlogPosting",pattern:/\/blogs\/([^/]+)\/([^/]+)/},{type:"Organization",pattern:"/policies"},{type:"Organization",pattern:/\/policies\/([^/]+)/}].filter(o=>{let{pattern:s}=o;return new RegExp(s).test(e)});return n.length>0?n[n.length-1].type:t}function re(e){return Array.isArray(e)?e:[e]}function L(e,t){try{return e.validate(t)}catch(r){let n=r.message;return console.warn(n),t}}var Pt=R.default.lazy(()=>import('./log-seo-tags-GYSQ3BE2.js'));function It({debug:e}){let t=useMatches(),r=useLocation(),n=t.flatMap(i=>{let{handle:c,...u}=i,h={...u,...r};return c===void 0||c.seo===void 0?[]:j(c.seo,h)}).reduce((i,c)=>(Object.keys(c).forEach(u=>!c[u]&&delete c[u]),{...i,...c}),{}),o=He(n);e&&d(o);let s=o.map(i=>i.tag==="script"?R.default.createElement(i.tag,{...i.props,key:i.key,dangerouslySetInnerHTML:{__html:i.children}}):R.default.createElement(i.tag,{...i.props,key:i.key},i.children)),a=R.default.createElement(R.default.Suspense,{fallback:null},R.default.createElement(Pt,{headTags:o}));return R.default.createElement(R.default.Fragment,null,s,e&&a)}function j(e,...t){if(e instanceof Function)return j(e(...t),...t);let r={};return Array.isArray(e)?(r=e.reduce((n,o)=>[...n,j(o)],[]),r):e instanceof Object?(Object.entries(e).forEach(([o,s])=>{r[o]=j(s,...t);}),r):e}/**
|
|
73
73
|
* @license React
|
|
74
74
|
* react.production.min.js
|
|
75
75
|
*
|
|
@@ -79,6 +79,6 @@ var Me=a(p=>{var E=Symbol.for("react.element"),it=Symbol.for("react.portal"),ct=
|
|
|
79
79
|
* LICENSE file in the root directory of this source tree.
|
|
80
80
|
*/
|
|
81
81
|
|
|
82
|
-
export { B as CacheCustom, W as CacheLong, F as CacheNone, T as CacheShort,
|
|
82
|
+
export { B as CacheCustom, W as CacheLong, F as CacheNone, T as CacheShort, J as InMemoryCache, It as Seo, rr as createStorefrontClient, b as generateCacheControlHeader, it as graphiqlLoader, Ze as isStorefrontApiError, ot as storefrontRedirect };
|
|
83
83
|
//# sourceMappingURL=out.js.map
|
|
84
84
|
//# sourceMappingURL=index.js.map
|