@clicktap/state 0.13.14 → 0.13.15
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/index.js +1 -1
- package/index.mjs +2 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -48,4 +48,4 @@ spurious results.`)}}return!1};class dn{constructor(t,n="GraphQL request",s={lin
|
|
|
48
48
|
`)),`
|
|
49
49
|
}`)}function I(e,t,n=""){return t!=null&&t!==""?e+t+n:""}function Ee(e){return I(" ",e.replace(/\n/g,`
|
|
50
50
|
`))}function Ct(e){var t;return(t=e==null?void 0:e.some(n=>n.includes(`
|
|
51
|
-
`)))!==null&&t!==void 0?t:!1}const Dt=e=>{var s,r;let t;const n=e.definitions.filter(i=>i.kind==="OperationDefinition");return n.length===1&&(t=(r=(s=n[0])==null?void 0:s.name)==null?void 0:r.value),t},Le=e=>{if(typeof e=="string"){let n;try{const s=Er(e);n=Dt(s)}catch{}return{query:e,operationName:n}}const t=Dt(e);return{query:hn(e),operationName:t}};class ae extends Error{constructor(t,n){const s=`${ae.extractMessage(t)}: ${JSON.stringify({response:t,request:n})}`;super(s),Object.setPrototypeOf(this,ae.prototype),this.response=t,this.request=n,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ae)}static extractMessage(t){var n,s;return((s=(n=t.errors)==null?void 0:n[0])==null?void 0:s.message)??`GraphQL Error (Code: ${t.status})`}}var Nr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function kr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ze={exports:{}};(function(e,t){var n=typeof self<"u"?self:Nr,s=function(){function i(){this.fetch=!1,this.DOMException=n.DOMException}return i.prototype=n,new i}();(function(i){(function(o){var a={searchParams:"URLSearchParams"in i,iterable:"Symbol"in i&&"iterator"in Symbol,blob:"FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in i,arrayBuffer:"ArrayBuffer"in i};function c(l){return l&&DataView.prototype.isPrototypeOf(l)}if(a.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(l){return l&&u.indexOf(Object.prototype.toString.call(l))>-1};function d(l){if(typeof l!="string"&&(l=String(l)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(l))throw new TypeError("Invalid character in header field name");return l.toLowerCase()}function f(l){return typeof l!="string"&&(l=String(l)),l}function m(l){var g={next:function(){var _=l.shift();return{done:_===void 0,value:_}}};return a.iterable&&(g[Symbol.iterator]=function(){return g}),g}function y(l){this.map={},l instanceof y?l.forEach(function(g,_){this.append(_,g)},this):Array.isArray(l)?l.forEach(function(g){this.append(g[0],g[1])},this):l&&Object.getOwnPropertyNames(l).forEach(function(g){this.append(g,l[g])},this)}y.prototype.append=function(l,g){l=d(l),g=f(g);var _=this.map[l];this.map[l]=_?_+", "+g:g},y.prototype.delete=function(l){delete this.map[d(l)]},y.prototype.get=function(l){return l=d(l),this.has(l)?this.map[l]:null},y.prototype.has=function(l){return this.map.hasOwnProperty(d(l))},y.prototype.set=function(l,g){this.map[d(l)]=f(g)},y.prototype.forEach=function(l,g){for(var _ in this.map)this.map.hasOwnProperty(_)&&l.call(g,this.map[_],_,this)},y.prototype.keys=function(){var l=[];return this.forEach(function(g,_){l.push(_)}),m(l)},y.prototype.values=function(){var l=[];return this.forEach(function(g){l.push(g)}),m(l)},y.prototype.entries=function(){var l=[];return this.forEach(function(g,_){l.push([_,g])}),m(l)},a.iterable&&(y.prototype[Symbol.iterator]=y.prototype.entries);function v(l){if(l.bodyUsed)return Promise.reject(new TypeError("Already read"));l.bodyUsed=!0}function S(l){return new Promise(function(g,_){l.onload=function(){g(l.result)},l.onerror=function(){_(l.error)}})}function A(l){var g=new FileReader,_=S(g);return g.readAsArrayBuffer(l),_}function R(l){var g=new FileReader,_=S(g);return g.readAsText(l),_}function D(l){for(var g=new Uint8Array(l),_=new Array(g.length),N=0;N<g.length;N++)_[N]=String.fromCharCode(g[N]);return _.join("")}function L(l){if(l.slice)return l.slice(0);var g=new Uint8Array(l.byteLength);return g.set(new Uint8Array(l)),g.buffer}function J(){return this.bodyUsed=!1,this._initBody=function(l){this._bodyInit=l,l?typeof l=="string"?this._bodyText=l:a.blob&&Blob.prototype.isPrototypeOf(l)?this._bodyBlob=l:a.formData&&FormData.prototype.isPrototypeOf(l)?this._bodyFormData=l:a.searchParams&&URLSearchParams.prototype.isPrototypeOf(l)?this._bodyText=l.toString():a.arrayBuffer&&a.blob&&c(l)?(this._bodyArrayBuffer=L(l.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(l)||h(l))?this._bodyArrayBuffer=L(l):this._bodyText=l=Object.prototype.toString.call(l):this._bodyText="",this.headers.get("content-type")||(typeof l=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a.searchParams&&URLSearchParams.prototype.isPrototypeOf(l)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a.blob&&(this.blob=function(){var l=v(this);if(l)return l;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?v(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(A)}),this.text=function(){var l=v(this);if(l)return l;if(this._bodyBlob)return R(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(D(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a.formData&&(this.formData=function(){return this.text().then(yn)}),this.json=function(){return this.text().then(JSON.parse)},this}var le=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function he(l){var g=l.toUpperCase();return le.indexOf(g)>-1?g:l}function $(l,g){g=g||{};var _=g.body;if(l instanceof $){if(l.bodyUsed)throw new TypeError("Already read");this.url=l.url,this.credentials=l.credentials,g.headers||(this.headers=new y(l.headers)),this.method=l.method,this.mode=l.mode,this.signal=l.signal,!_&&l._bodyInit!=null&&(_=l._bodyInit,l.bodyUsed=!0)}else this.url=String(l);if(this.credentials=g.credentials||this.credentials||"same-origin",(g.headers||!this.headers)&&(this.headers=new y(g.headers)),this.method=he(g.method||this.method||"GET"),this.mode=g.mode||this.mode||null,this.signal=g.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&_)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(_)}$.prototype.clone=function(){return new $(this,{body:this._bodyInit})};function yn(l){var g=new FormData;return l.trim().split("&").forEach(function(_){if(_){var N=_.split("="),O=N.shift().replace(/\+/g," "),x=N.join("=").replace(/\+/g," ");g.append(decodeURIComponent(O),decodeURIComponent(x))}}),g}function mn(l){var g=new y,_=l.replace(/\r?\n[\t ]+/g," ");return _.split(/\r?\n/).forEach(function(N){var O=N.split(":"),x=O.shift().trim();if(x){var fe=O.join(":").trim();g.append(x,fe)}}),g}J.call($.prototype);function q(l,g){g||(g={}),this.type="default",this.status=g.status===void 0?200:g.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in g?g.statusText:"OK",this.headers=new y(g.headers),this.url=g.url||"",this._initBody(l)}J.call(q.prototype),q.prototype.clone=function(){return new q(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new y(this.headers),url:this.url})},q.error=function(){var l=new q(null,{status:0,statusText:""});return l.type="error",l};var gn=[301,302,303,307,308];q.redirect=function(l,g){if(gn.indexOf(g)===-1)throw new RangeError("Invalid status code");return new q(null,{status:g,headers:{location:l}})},o.DOMException=i.DOMException;try{new o.DOMException}catch{o.DOMException=function(g,_){this.message=g,this.name=_;var N=Error(g);this.stack=N.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function Oe(l,g){return new Promise(function(_,N){var O=new $(l,g);if(O.signal&&O.signal.aborted)return N(new o.DOMException("Aborted","AbortError"));var x=new XMLHttpRequest;function fe(){x.abort()}x.onload=function(){var re={status:x.status,statusText:x.statusText,headers:mn(x.getAllResponseHeaders()||"")};re.url="responseURL"in x?x.responseURL:re.headers.get("X-Request-URL");var Ne="response"in x?x.response:x.responseText;_(new q(Ne,re))},x.onerror=function(){N(new TypeError("Network request failed"))},x.ontimeout=function(){N(new TypeError("Network request failed"))},x.onabort=function(){N(new o.DOMException("Aborted","AbortError"))},x.open(O.method,O.url,!0),O.credentials==="include"?x.withCredentials=!0:O.credentials==="omit"&&(x.withCredentials=!1),"responseType"in x&&a.blob&&(x.responseType="blob"),O.headers.forEach(function(re,Ne){x.setRequestHeader(Ne,re)}),O.signal&&(O.signal.addEventListener("abort",fe),x.onreadystatechange=function(){x.readyState===4&&O.signal.removeEventListener("abort",fe)}),x.send(typeof O._bodyInit>"u"?null:O._bodyInit)})}return Oe.polyfill=!0,i.fetch||(i.fetch=Oe,i.Headers=y,i.Request=$,i.Response=q),o.Headers=y,o.Request=$,o.Response=q,o.fetch=Oe,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(s),s.fetch.ponyfill=!0,delete s.fetch.polyfill;var r=s;t=r.fetch,t.default=r.fetch,t.fetch=r.fetch,t.Headers=r.Headers,t.Request=r.Request,t.Response=r.Response,e.exports=t})(ze,ze.exports);var Se=ze.exports;const ve=kr(Se),Cr=En({__proto__:null,default:ve},[Se]),Q=e=>{let t={};return e&&(typeof Headers<"u"&&e instanceof Headers||Cr&&Se.Headers&&e instanceof Se.Headers?t=qs(e):Array.isArray(e)?e.forEach(([n,s])=>{n&&s!==void 0&&(t[n]=s)}):t=e),t},Rt=e=>e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),Dr=e=>{if(!Array.isArray(e.query)){const s=e,r=[`query=${encodeURIComponent(Rt(s.query))}`];return e.variables&&r.push(`variables=${encodeURIComponent(s.jsonSerializer.stringify(s.variables))}`),s.operationName&&r.push(`operationName=${encodeURIComponent(s.operationName)}`),r.join("&")}if(typeof e.variables<"u"&&!Array.isArray(e.variables))throw new Error("Cannot create query with given variable type, array expected");const t=e,n=e.query.reduce((s,r,i)=>(s.push({query:Rt(r),variables:t.variables?t.jsonSerializer.stringify(t.variables[i]):void 0}),s),[]);return`query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`},Rr=e=>async t=>{const{url:n,query:s,variables:r,operationName:i,fetch:o,fetchOptions:a,middleware:c}=t,u={...t.headers};let h="",d;e==="POST"?(d=Lr(s,r,i,a.jsonSerializer),typeof d=="string"&&(u["Content-Type"]="application/json")):h=Dr({query:s,variables:r,operationName:i,jsonSerializer:a.jsonSerializer??at});const f={method:e,headers:u,body:d,...a};let m=n,y=f;if(c){const v=await Promise.resolve(c({...f,url:n,operationName:i,variables:r})),{url:S,...A}=v;m=S,y=A}return h&&(m=`${m}?${h}`),await o(m,y)};class fn{constructor(t,n={}){this.url=t,this.requestConfig=n,this.rawRequest=async(...s)=>{const[r,i,o]=s,a=Us(r,i,o),{headers:c,fetch:u=ve,method:h="POST",requestMiddleware:d,responseMiddleware:f,...m}=this.requestConfig,{url:y}=this;a.signal!==void 0&&(m.signal=a.signal);const{operationName:v}=Le(a.query);return Me({url:y,query:a.query,variables:a.variables,headers:{...Q(Pe(c)),...Q(a.requestHeaders)},operationName:v,fetch:u,method:h,fetchOptions:m,middleware:d}).then(S=>(f&&f(S),S)).catch(S=>{throw f&&f(S),S})}}async request(t,...n){const[s,r]=n,i=Fs(t,s,r),{headers:o,fetch:a=ve,method:c="POST",requestMiddleware:u,responseMiddleware:h,...d}=this.requestConfig,{url:f}=this;i.signal!==void 0&&(d.signal=i.signal);const{query:m,operationName:y}=Le(i.document);return Me({url:f,query:m,variables:i.variables,headers:{...Q(Pe(o)),...Q(i.requestHeaders)},operationName:y,fetch:a,method:c,fetchOptions:d,middleware:u}).then(v=>(h&&h(v),v.data)).catch(v=>{throw h&&h(v),v})}batchRequests(t,n){const s=Bs(t,n),{headers:r,...i}=this.requestConfig;s.signal!==void 0&&(i.signal=s.signal);const o=s.documents.map(({document:c})=>Le(c).query),a=s.documents.map(({variables:c})=>c);return Me({url:this.url,query:o,variables:a,headers:{...Q(Pe(r)),...Q(s.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??ve,method:this.requestConfig.method||"POST",fetchOptions:i,middleware:this.requestConfig.requestMiddleware}).then(c=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(c),c.data)).catch(c=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(c),c})}setHeaders(t){return this.requestConfig.headers=t,this}setHeader(t,n){const{headers:s}=this.requestConfig;return s?s[t]=n:this.requestConfig.headers={[t]:n},this}setEndpoint(t){return this.url=t,this}}const Me=async e=>{const{query:t,variables:n,fetchOptions:s}=e,r=Rr(Ps(e.method??"post")),i=Array.isArray(e.query),o=await r(e),a=await Mr(o,s.jsonSerializer??at),c=Array.isArray(a)?!a.some(({data:h})=>!h):!!a.data,u=Array.isArray(a)||!a.errors||Array.isArray(a.errors)&&!a.errors.length||s.errorPolicy==="all"||s.errorPolicy==="ignore";if(o.ok&&u&&c){const{errors:h,...d}=(Array.isArray(a),a),f=s.errorPolicy==="ignore"?d:a;return{...i?{data:f}:f,headers:o.headers,status:o.status}}else{const h=typeof a=="string"?{error:a}:a;throw new ae({...h,status:o.status,headers:o.headers},{query:t,variables:n})}};async function pn(e,t,...n){const s=js(e,t,...n);return new fn(s.url).request({...s})}const Lr=(e,t,n,s)=>{const r=s??at;if(!Array.isArray(e))return r.stringify({query:e,variables:t,operationName:n});if(typeof t<"u"&&!Array.isArray(t))throw new Error("Cannot create request body with given variable type, array expected");const i=e.reduce((o,a,c)=>(o.push({query:a,variables:t?t[c]:void 0}),o),[]);return r.stringify(i)},Mr=async(e,t)=>{let n;return e.headers.forEach((s,r)=>{r.toLowerCase()==="content-type"&&(n=s)}),n&&(n.toLowerCase().startsWith("application/json")||n.toLowerCase().startsWith("application/graphql+json")||n.toLowerCase().startsWith("application/graphql-response+json"))?t.parse(await e.text()):e.text()},Pe=e=>typeof e=="function"?e():e,Pr=Z(async({input:e})=>{var t;if(!e.endpoint||e.endpoint==="")throw new Error("No endpoint provided.");if(e.items.length<1)throw new Error("No items provided.");if(!e.document)throw new Error("No request document provided.");if(!e.requestHeaders)throw new Error("No request headers provided.");try{const n=await pn(e.endpoint,e.document,{items:e.items},e.requestHeaders);if(!((t=n.quoteAddItem)!=null&&t.quote))throw new Error("Could not add items to quote.");return{type:"ADD_ITEMS_SUCCESS",quote:n.quoteAddItem.quote}}catch{throw new Error("Request to add item(s) failed.")}}),qr=Z(async({input:e})=>{var t;if(!e.endpoint||e.endpoint==="")throw new Error("No endpoint provided.");if(e.items.length<1)throw new Error("No items provided.");try{const n=await pn(e.endpoint,"");if(!((t=n.quoteRemoveItem)!=null&&t.quote))throw new Error("Could not remove items from quote.");return{type:"REMOVE_ITEMS_SUCCESS",quote:n.quoteRemoveItem.quote}}catch{throw new Error("Request to remove item(s) failed.")}}),qe=typeof window>"u",Fr=Z(async({input:e})=>{var n,s,r,i;if(!e.endpoint)throw console.log("no endpoint"),new Error("No endpoint provided.");if(!e.endpointSsr)throw console.log("no endpoint ssr"),new Error("No SSR endpoint provided.");if(!e.locale)throw console.log("no locale"),new Error("No locale provided.");if(!e.document)throw console.log("no request document"),new Error("No request document provided.");if(!e.requestHeaders)throw console.log("no headers"),new Error("No request headers provided.");const t=new fn(qe?e.endpointSsr:e.endpoint,qe?{fetch,method:"POST"}:{credentials:"include",method:"POST",mode:"cors"});try{const{data:o,headers:a,status:c,errors:u,extensions:h}=await t.rawRequest(hn(e.document),{},qe?{...e.requestHeaders,Cookie:`quote_${e.locale}=${e.quoteId??""}`}:e.requestHeaders),d=o;if(!((n=d.refreshQuote)!=null&&n.quote))throw console.log("userError: ",(s=d.refreshQuote)==null?void 0:s.userErrors[0].code,(r=d.refreshQuote)==null?void 0:r.userErrors[0].field,(i=d.refreshQuote)==null?void 0:i.userErrors[0].message),new Error("Could not add items to quote.");return{type:"REFRESH_SUCCESS",quote:d.refreshQuote.quote}}catch(o){throw console.log("refresh error",o),new Error("Request to add item(s) failed.")}}),Ur=({context:e})=>typeof window>"u"&&e.quote.id!==""||typeof window<"u",Br=({context:e})=>!!e.quote.items&&e.quote.items.length>0,Je=Ae({types:{context:{},events:{},input:{}},actions:{addItems:C(Rs),removeItems:C(Ls),refresh:C(Ms)},actors:{addItems:Pr,removeItems:qr,refresh:Fr},guards:{canRefresh:Ur,hasItems:Br}}).createMachine({id:"quote",initial:"initializing",context:({input:e})=>{var t,n,s,r,i,o,a,c,u,h,d,f,m,y;return{quote:{id:"",locale:"",baseCurrency:"USD",currencyConversionRate:1,dateCreated:null,dateLastUpdated:null,currency:"USD",items:[],promotions:[],shippingAddresses:{available:[],selected:null},totals:{discount:0,tax:0,shipping:0,shippingTax:0,subtotal:0,grandTotal:0},appliedPriceRules:[],appliedPromotions:[],shippingMethods:[],paymentMethods:[],storeCredit:[],rewards:[],giftCards:[],...(t=e==null?void 0:e.initialContext)==null?void 0:t.quote},endpoints:{client:"",server:"",...(n=e==null?void 0:e.initialContext)==null?void 0:n.endpoints},graphql:{refresh:{document:((i=(r=(s=e==null?void 0:e.initialContext)==null?void 0:s.graphql)==null?void 0:r.refresh)==null?void 0:i.document)??"",requestHeaders:((c=(a=(o=e==null?void 0:e.initialContext)==null?void 0:o.graphql)==null?void 0:a.refresh)==null?void 0:c.requestHeaders)??void 0},addItems:{document:((d=(h=(u=e==null?void 0:e.initialContext)==null?void 0:u.graphql)==null?void 0:h.addItems)==null?void 0:d.document)??"",requestHeaders:((y=(m=(f=e==null?void 0:e.initialContext)==null?void 0:f.graphql)==null?void 0:m.addItems)==null?void 0:y.requestHeaders)??void 0}},errors:[]}},states:{uninitialized:{on:{REFRESH:"refreshing"}},empty:{on:{ADD_ITEMS:"addingItems"}},active:{on:{ADD_ITEMS:"addingItems",REMOVE_ITEMS:"removingItems",REFRESH:"refreshing"}},initializing:{always:[{target:"refreshing",guard:"canRefresh"},{target:"uninitialized"}]},refreshing:{invoke:{input:({context:e})=>({endpoint:e.endpoints.client,endpointSsr:e.endpoints.server,quoteId:e.quote.id,locale:e.quote.locale,document:e.graphql.refresh.document,requestHeaders:e.graphql.refresh.requestHeaders}),src:"refresh",onDone:[{actions:["refresh"],target:"checkingItems"}],onError:{target:"empty"}}},checkingItems:{always:[{guard:"hasItems",target:"active"},{target:"empty"}]},addingItems:{invoke:{input:({context:e,event:t})=>{var n,s;return{endpoint:e.endpoints.client,items:t.type==="ADD_ITEMS"?t.items:[],document:(n=e.graphql.addItems)==null?void 0:n.document,requestHeaders:(s=e.graphql.addItems)==null?void 0:s.requestHeaders}},src:"addItems",onDone:[{actions:["addItems"],target:"active"}],onError:[{guard:"hasItems",target:"active"},{target:"empty"}]}},removingItems:{}}}),dt=P.createContext({}),jr=()=>{var c;const e=P.useContext(dt);if(!e||!e.getSnapshot)throw new Error("quoteActor is not properly initialized");const[t,n]=P.useState(()=>e.getSnapshot());P.useEffect(()=>{if(!e||!e.getSnapshot){console.error("quoteActor is not properly initialized");return}(()=>{n(e.getSnapshot())})();const h=e.subscribe(d=>{n(d)});return()=>{h.unsubscribe()}},[e]);const s=t.context.quote.items??[],r=((c=t.context.quote.items)==null?void 0:c.length)??0,i=t.matches("addingItems"),o=t.matches("removingItems"),a=t.matches("addingItems")||t.matches("removingItems");return{quoteActor:e,items:s,itemsCount:r,isAddingItems:i,isRemovingItems:o,isUpdatingItems:a}},$r=async(e={inspect:void 0,quote:{id:"",locale:""},endpoints:{client:"",server:""},graphql:{}})=>typeof window<"u"?(console.warn("App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."),B(Je,{inspect:e.inspect,input:{initialContext:{endpoints:e.endpoints}}}).start()):B(Je,{input:{initialContext:{endpoints:e.endpoints,graphql:e.graphql,quote:{id:e.quote.id??"",locale:e.quote.locale??""}}},inspect:e.inspect}).start();function Vr({actor:e,children:t}){return Ye.jsx(dt.Provider,{value:e,children:t})}exports.AuthContext=it;exports.AuthProvider=Os;exports.QuoteContext=dt;exports.QuoteProvider=Vr;exports.ToastContext=ot;exports.ToastProvider=Ds;exports.authMachine=$e;exports.getAuth=bs;exports.getQuote=$r;exports.quoteMachine=Je;exports.timerMachine=en;exports.toastMachine=ks;exports.useAuth=ws;exports.useQuote=jr;exports.useToast=Cs;
|
|
51
|
+
`)))!==null&&t!==void 0?t:!1}const Dt=e=>{var s,r;let t;const n=e.definitions.filter(i=>i.kind==="OperationDefinition");return n.length===1&&(t=(r=(s=n[0])==null?void 0:s.name)==null?void 0:r.value),t},Le=e=>{if(typeof e=="string"){let n;try{const s=Er(e);n=Dt(s)}catch{}return{query:e,operationName:n}}const t=Dt(e);return{query:hn(e),operationName:t}};class ae extends Error{constructor(t,n){const s=`${ae.extractMessage(t)}: ${JSON.stringify({response:t,request:n})}`;super(s),Object.setPrototypeOf(this,ae.prototype),this.response=t,this.request=n,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ae)}static extractMessage(t){var n,s;return((s=(n=t.errors)==null?void 0:n[0])==null?void 0:s.message)??`GraphQL Error (Code: ${t.status})`}}var Nr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function kr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ze={exports:{}};(function(e,t){var n=typeof self<"u"?self:Nr,s=function(){function i(){this.fetch=!1,this.DOMException=n.DOMException}return i.prototype=n,new i}();(function(i){(function(o){var a={searchParams:"URLSearchParams"in i,iterable:"Symbol"in i&&"iterator"in Symbol,blob:"FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in i,arrayBuffer:"ArrayBuffer"in i};function c(l){return l&&DataView.prototype.isPrototypeOf(l)}if(a.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(l){return l&&u.indexOf(Object.prototype.toString.call(l))>-1};function d(l){if(typeof l!="string"&&(l=String(l)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(l))throw new TypeError("Invalid character in header field name");return l.toLowerCase()}function f(l){return typeof l!="string"&&(l=String(l)),l}function m(l){var g={next:function(){var _=l.shift();return{done:_===void 0,value:_}}};return a.iterable&&(g[Symbol.iterator]=function(){return g}),g}function y(l){this.map={},l instanceof y?l.forEach(function(g,_){this.append(_,g)},this):Array.isArray(l)?l.forEach(function(g){this.append(g[0],g[1])},this):l&&Object.getOwnPropertyNames(l).forEach(function(g){this.append(g,l[g])},this)}y.prototype.append=function(l,g){l=d(l),g=f(g);var _=this.map[l];this.map[l]=_?_+", "+g:g},y.prototype.delete=function(l){delete this.map[d(l)]},y.prototype.get=function(l){return l=d(l),this.has(l)?this.map[l]:null},y.prototype.has=function(l){return this.map.hasOwnProperty(d(l))},y.prototype.set=function(l,g){this.map[d(l)]=f(g)},y.prototype.forEach=function(l,g){for(var _ in this.map)this.map.hasOwnProperty(_)&&l.call(g,this.map[_],_,this)},y.prototype.keys=function(){var l=[];return this.forEach(function(g,_){l.push(_)}),m(l)},y.prototype.values=function(){var l=[];return this.forEach(function(g){l.push(g)}),m(l)},y.prototype.entries=function(){var l=[];return this.forEach(function(g,_){l.push([_,g])}),m(l)},a.iterable&&(y.prototype[Symbol.iterator]=y.prototype.entries);function v(l){if(l.bodyUsed)return Promise.reject(new TypeError("Already read"));l.bodyUsed=!0}function S(l){return new Promise(function(g,_){l.onload=function(){g(l.result)},l.onerror=function(){_(l.error)}})}function A(l){var g=new FileReader,_=S(g);return g.readAsArrayBuffer(l),_}function R(l){var g=new FileReader,_=S(g);return g.readAsText(l),_}function D(l){for(var g=new Uint8Array(l),_=new Array(g.length),N=0;N<g.length;N++)_[N]=String.fromCharCode(g[N]);return _.join("")}function L(l){if(l.slice)return l.slice(0);var g=new Uint8Array(l.byteLength);return g.set(new Uint8Array(l)),g.buffer}function J(){return this.bodyUsed=!1,this._initBody=function(l){this._bodyInit=l,l?typeof l=="string"?this._bodyText=l:a.blob&&Blob.prototype.isPrototypeOf(l)?this._bodyBlob=l:a.formData&&FormData.prototype.isPrototypeOf(l)?this._bodyFormData=l:a.searchParams&&URLSearchParams.prototype.isPrototypeOf(l)?this._bodyText=l.toString():a.arrayBuffer&&a.blob&&c(l)?(this._bodyArrayBuffer=L(l.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(l)||h(l))?this._bodyArrayBuffer=L(l):this._bodyText=l=Object.prototype.toString.call(l):this._bodyText="",this.headers.get("content-type")||(typeof l=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a.searchParams&&URLSearchParams.prototype.isPrototypeOf(l)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a.blob&&(this.blob=function(){var l=v(this);if(l)return l;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?v(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(A)}),this.text=function(){var l=v(this);if(l)return l;if(this._bodyBlob)return R(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(D(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a.formData&&(this.formData=function(){return this.text().then(yn)}),this.json=function(){return this.text().then(JSON.parse)},this}var le=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function he(l){var g=l.toUpperCase();return le.indexOf(g)>-1?g:l}function $(l,g){g=g||{};var _=g.body;if(l instanceof $){if(l.bodyUsed)throw new TypeError("Already read");this.url=l.url,this.credentials=l.credentials,g.headers||(this.headers=new y(l.headers)),this.method=l.method,this.mode=l.mode,this.signal=l.signal,!_&&l._bodyInit!=null&&(_=l._bodyInit,l.bodyUsed=!0)}else this.url=String(l);if(this.credentials=g.credentials||this.credentials||"same-origin",(g.headers||!this.headers)&&(this.headers=new y(g.headers)),this.method=he(g.method||this.method||"GET"),this.mode=g.mode||this.mode||null,this.signal=g.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&_)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(_)}$.prototype.clone=function(){return new $(this,{body:this._bodyInit})};function yn(l){var g=new FormData;return l.trim().split("&").forEach(function(_){if(_){var N=_.split("="),O=N.shift().replace(/\+/g," "),x=N.join("=").replace(/\+/g," ");g.append(decodeURIComponent(O),decodeURIComponent(x))}}),g}function mn(l){var g=new y,_=l.replace(/\r?\n[\t ]+/g," ");return _.split(/\r?\n/).forEach(function(N){var O=N.split(":"),x=O.shift().trim();if(x){var fe=O.join(":").trim();g.append(x,fe)}}),g}J.call($.prototype);function q(l,g){g||(g={}),this.type="default",this.status=g.status===void 0?200:g.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in g?g.statusText:"OK",this.headers=new y(g.headers),this.url=g.url||"",this._initBody(l)}J.call(q.prototype),q.prototype.clone=function(){return new q(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new y(this.headers),url:this.url})},q.error=function(){var l=new q(null,{status:0,statusText:""});return l.type="error",l};var gn=[301,302,303,307,308];q.redirect=function(l,g){if(gn.indexOf(g)===-1)throw new RangeError("Invalid status code");return new q(null,{status:g,headers:{location:l}})},o.DOMException=i.DOMException;try{new o.DOMException}catch{o.DOMException=function(g,_){this.message=g,this.name=_;var N=Error(g);this.stack=N.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function Oe(l,g){return new Promise(function(_,N){var O=new $(l,g);if(O.signal&&O.signal.aborted)return N(new o.DOMException("Aborted","AbortError"));var x=new XMLHttpRequest;function fe(){x.abort()}x.onload=function(){var re={status:x.status,statusText:x.statusText,headers:mn(x.getAllResponseHeaders()||"")};re.url="responseURL"in x?x.responseURL:re.headers.get("X-Request-URL");var Ne="response"in x?x.response:x.responseText;_(new q(Ne,re))},x.onerror=function(){N(new TypeError("Network request failed"))},x.ontimeout=function(){N(new TypeError("Network request failed"))},x.onabort=function(){N(new o.DOMException("Aborted","AbortError"))},x.open(O.method,O.url,!0),O.credentials==="include"?x.withCredentials=!0:O.credentials==="omit"&&(x.withCredentials=!1),"responseType"in x&&a.blob&&(x.responseType="blob"),O.headers.forEach(function(re,Ne){x.setRequestHeader(Ne,re)}),O.signal&&(O.signal.addEventListener("abort",fe),x.onreadystatechange=function(){x.readyState===4&&O.signal.removeEventListener("abort",fe)}),x.send(typeof O._bodyInit>"u"?null:O._bodyInit)})}return Oe.polyfill=!0,i.fetch||(i.fetch=Oe,i.Headers=y,i.Request=$,i.Response=q),o.Headers=y,o.Request=$,o.Response=q,o.fetch=Oe,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(s),s.fetch.ponyfill=!0,delete s.fetch.polyfill;var r=s;t=r.fetch,t.default=r.fetch,t.fetch=r.fetch,t.Headers=r.Headers,t.Request=r.Request,t.Response=r.Response,e.exports=t})(ze,ze.exports);var Se=ze.exports;const ve=kr(Se),Cr=En({__proto__:null,default:ve},[Se]),Q=e=>{let t={};return e&&(typeof Headers<"u"&&e instanceof Headers||Cr&&Se.Headers&&e instanceof Se.Headers?t=qs(e):Array.isArray(e)?e.forEach(([n,s])=>{n&&s!==void 0&&(t[n]=s)}):t=e),t},Rt=e=>e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),Dr=e=>{if(!Array.isArray(e.query)){const s=e,r=[`query=${encodeURIComponent(Rt(s.query))}`];return e.variables&&r.push(`variables=${encodeURIComponent(s.jsonSerializer.stringify(s.variables))}`),s.operationName&&r.push(`operationName=${encodeURIComponent(s.operationName)}`),r.join("&")}if(typeof e.variables<"u"&&!Array.isArray(e.variables))throw new Error("Cannot create query with given variable type, array expected");const t=e,n=e.query.reduce((s,r,i)=>(s.push({query:Rt(r),variables:t.variables?t.jsonSerializer.stringify(t.variables[i]):void 0}),s),[]);return`query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`},Rr=e=>async t=>{const{url:n,query:s,variables:r,operationName:i,fetch:o,fetchOptions:a,middleware:c}=t,u={...t.headers};let h="",d;e==="POST"?(d=Lr(s,r,i,a.jsonSerializer),typeof d=="string"&&(u["Content-Type"]="application/json")):h=Dr({query:s,variables:r,operationName:i,jsonSerializer:a.jsonSerializer??at});const f={method:e,headers:u,body:d,...a};let m=n,y=f;if(c){const v=await Promise.resolve(c({...f,url:n,operationName:i,variables:r})),{url:S,...A}=v;m=S,y=A}return h&&(m=`${m}?${h}`),await o(m,y)};class fn{constructor(t,n={}){this.url=t,this.requestConfig=n,this.rawRequest=async(...s)=>{const[r,i,o]=s,a=Us(r,i,o),{headers:c,fetch:u=ve,method:h="POST",requestMiddleware:d,responseMiddleware:f,...m}=this.requestConfig,{url:y}=this;a.signal!==void 0&&(m.signal=a.signal);const{operationName:v}=Le(a.query);return Me({url:y,query:a.query,variables:a.variables,headers:{...Q(Pe(c)),...Q(a.requestHeaders)},operationName:v,fetch:u,method:h,fetchOptions:m,middleware:d}).then(S=>(f&&f(S),S)).catch(S=>{throw f&&f(S),S})}}async request(t,...n){const[s,r]=n,i=Fs(t,s,r),{headers:o,fetch:a=ve,method:c="POST",requestMiddleware:u,responseMiddleware:h,...d}=this.requestConfig,{url:f}=this;i.signal!==void 0&&(d.signal=i.signal);const{query:m,operationName:y}=Le(i.document);return Me({url:f,query:m,variables:i.variables,headers:{...Q(Pe(o)),...Q(i.requestHeaders)},operationName:y,fetch:a,method:c,fetchOptions:d,middleware:u}).then(v=>(h&&h(v),v.data)).catch(v=>{throw h&&h(v),v})}batchRequests(t,n){const s=Bs(t,n),{headers:r,...i}=this.requestConfig;s.signal!==void 0&&(i.signal=s.signal);const o=s.documents.map(({document:c})=>Le(c).query),a=s.documents.map(({variables:c})=>c);return Me({url:this.url,query:o,variables:a,headers:{...Q(Pe(r)),...Q(s.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??ve,method:this.requestConfig.method||"POST",fetchOptions:i,middleware:this.requestConfig.requestMiddleware}).then(c=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(c),c.data)).catch(c=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(c),c})}setHeaders(t){return this.requestConfig.headers=t,this}setHeader(t,n){const{headers:s}=this.requestConfig;return s?s[t]=n:this.requestConfig.headers={[t]:n},this}setEndpoint(t){return this.url=t,this}}const Me=async e=>{const{query:t,variables:n,fetchOptions:s}=e,r=Rr(Ps(e.method??"post")),i=Array.isArray(e.query),o=await r(e),a=await Mr(o,s.jsonSerializer??at),c=Array.isArray(a)?!a.some(({data:h})=>!h):!!a.data,u=Array.isArray(a)||!a.errors||Array.isArray(a.errors)&&!a.errors.length||s.errorPolicy==="all"||s.errorPolicy==="ignore";if(o.ok&&u&&c){const{errors:h,...d}=(Array.isArray(a),a),f=s.errorPolicy==="ignore"?d:a;return{...i?{data:f}:f,headers:o.headers,status:o.status}}else{const h=typeof a=="string"?{error:a}:a;throw new ae({...h,status:o.status,headers:o.headers},{query:t,variables:n})}};async function pn(e,t,...n){const s=js(e,t,...n);return new fn(s.url).request({...s})}const Lr=(e,t,n,s)=>{const r=s??at;if(!Array.isArray(e))return r.stringify({query:e,variables:t,operationName:n});if(typeof t<"u"&&!Array.isArray(t))throw new Error("Cannot create request body with given variable type, array expected");const i=e.reduce((o,a,c)=>(o.push({query:a,variables:t?t[c]:void 0}),o),[]);return r.stringify(i)},Mr=async(e,t)=>{let n;return e.headers.forEach((s,r)=>{r.toLowerCase()==="content-type"&&(n=s)}),n&&(n.toLowerCase().startsWith("application/json")||n.toLowerCase().startsWith("application/graphql+json")||n.toLowerCase().startsWith("application/graphql-response+json"))?t.parse(await e.text()):e.text()},Pe=e=>typeof e=="function"?e():e,Pr=Z(async({input:e})=>{var t;if(!e.endpoint||e.endpoint==="")throw new Error("No endpoint provided.");if(e.items.length<1)throw new Error("No items provided.");if(!e.document)throw new Error("No request document provided.");if(!e.requestHeaders)throw new Error("No request headers provided.");try{const n=await pn(e.endpoint,e.document,{items:e.items},e.requestHeaders);if(!((t=n.quoteAddItem)!=null&&t.quote))throw new Error("Could not add items to quote.");return{type:"ADD_ITEMS_SUCCESS",quote:n.quoteAddItem.quote}}catch{throw new Error("Request to add item(s) failed.")}}),qr=Z(async({input:e})=>{var t;if(!e.endpoint||e.endpoint==="")throw new Error("No endpoint provided.");if(e.items.length<1)throw new Error("No items provided.");try{const n=await pn(e.endpoint,"");if(!((t=n.quoteRemoveItem)!=null&&t.quote))throw new Error("Could not remove items from quote.");return{type:"REMOVE_ITEMS_SUCCESS",quote:n.quoteRemoveItem.quote}}catch{throw new Error("Request to remove item(s) failed.")}}),qe=typeof window>"u",Fr=Z(async({input:e})=>{var n,s,r,i;if(!e.endpoint)throw console.log("no endpoint"),new Error("No endpoint provided.");if(!e.endpointSsr)throw console.log("no endpoint ssr"),new Error("No SSR endpoint provided.");if(!e.locale)throw console.log("no locale"),new Error("No locale provided.");if(!e.document)throw console.log("no request document"),new Error("No request document provided.");if(!e.requestHeaders)throw console.log("no headers"),new Error("No request headers provided.");const t=new fn(qe?e.endpointSsr:e.endpoint,qe?{fetch,method:"POST"}:{credentials:"include",method:"POST",mode:"cors"});try{const{data:o,headers:a,status:c,errors:u,extensions:h}=await t.rawRequest(hn(e.document),{},qe?{...e.requestHeaders,Cookie:`quote_${e.locale}=${e.quoteId??""}`}:e.requestHeaders),d=o;if(!((n=d.refreshQuote)!=null&&n.quote))throw console.log("userError: ",(s=d.refreshQuote)==null?void 0:s.userErrors[0].code,(r=d.refreshQuote)==null?void 0:r.userErrors[0].field,(i=d.refreshQuote)==null?void 0:i.userErrors[0].message),new Error("Could not add items to quote.");return{type:"REFRESH_SUCCESS",quote:d.refreshQuote.quote}}catch(o){throw console.log("refresh error",o),new Error("Request to add item(s) failed.")}}),Ur=({context:e})=>typeof window>"u"&&e.quote.id!==""||typeof window<"u",Br=({context:e})=>!!e.quote.items&&e.quote.items.length>0,Je=Ae({types:{context:{},events:{},input:{}},actions:{addItems:C(Rs),removeItems:C(Ls),refresh:C(Ms)},actors:{addItems:Pr,removeItems:qr,refresh:Fr},guards:{canRefresh:Ur,hasItems:Br}}).createMachine({id:"quote",initial:"initializing",context:({input:e})=>{var t,n,s,r,i,o,a,c,u,h,d,f,m,y;return{quote:{id:"",locale:"",baseCurrency:"USD",currencyConversionRate:1,dateCreated:null,dateLastUpdated:null,currency:"USD",items:[],promotions:[],shippingAddresses:{available:[],selected:null},totals:{discount:0,tax:0,shipping:0,shippingTax:0,subtotal:0,grandTotal:0},appliedPriceRules:[],appliedPromotions:[],shippingMethods:[],paymentMethods:[],storeCredit:[],rewards:[],giftCards:[],...(t=e==null?void 0:e.initialContext)==null?void 0:t.quote},errors:[],endpoints:{client:"",server:"",...(n=e==null?void 0:e.initialContext)==null?void 0:n.endpoints},graphql:{refresh:{document:((i=(r=(s=e==null?void 0:e.initialContext)==null?void 0:s.graphql)==null?void 0:r.refresh)==null?void 0:i.document)??"",requestHeaders:((c=(a=(o=e==null?void 0:e.initialContext)==null?void 0:o.graphql)==null?void 0:a.refresh)==null?void 0:c.requestHeaders)??void 0},addItems:{document:((d=(h=(u=e==null?void 0:e.initialContext)==null?void 0:u.graphql)==null?void 0:h.addItems)==null?void 0:d.document)??"",requestHeaders:((y=(m=(f=e==null?void 0:e.initialContext)==null?void 0:f.graphql)==null?void 0:m.addItems)==null?void 0:y.requestHeaders)??void 0}}}},states:{uninitialized:{on:{REFRESH:"refreshing"}},empty:{on:{ADD_ITEMS:"addingItems"}},active:{on:{ADD_ITEMS:"addingItems",REMOVE_ITEMS:"removingItems",REFRESH:"refreshing"}},initializing:{always:[{target:"refreshing",guard:"canRefresh"},{target:"uninitialized"}]},refreshing:{invoke:{input:({context:e})=>({endpoint:e.endpoints.client,endpointSsr:e.endpoints.server,quoteId:e.quote.id,locale:e.quote.locale,document:e.graphql.refresh.document,requestHeaders:e.graphql.refresh.requestHeaders}),src:"refresh",onDone:[{actions:["refresh"],target:"checkingItems"}],onError:{target:"empty"}}},checkingItems:{always:[{guard:"hasItems",target:"active"},{target:"empty"}]},addingItems:{invoke:{input:({context:e,event:t})=>{var n,s;return{endpoint:e.endpoints.client,items:t.type==="ADD_ITEMS"?t.items:[],document:(n=e.graphql.addItems)==null?void 0:n.document,requestHeaders:(s=e.graphql.addItems)==null?void 0:s.requestHeaders}},src:"addItems",onDone:[{actions:["addItems"],target:"active"}],onError:[{guard:"hasItems",target:"active"},{target:"empty"}]}},removingItems:{}}}),dt=P.createContext({}),jr=()=>{var c;const e=P.useContext(dt);if(!e||!e.getSnapshot)throw new Error("quoteActor is not properly initialized");const[t,n]=P.useState(()=>e.getSnapshot());P.useEffect(()=>{if(!e||!e.getSnapshot){console.error("quoteActor is not properly initialized");return}(()=>{n(e.getSnapshot())})();const h=e.subscribe(d=>{n(d)});return()=>{h.unsubscribe()}},[e]);const s=t.context.quote.items??[],r=((c=t.context.quote.items)==null?void 0:c.length)??0,i=t.matches("addingItems"),o=t.matches("removingItems"),a=t.matches("addingItems")||t.matches("removingItems");return{quoteActor:e,items:s,itemsCount:r,isAddingItems:i,isRemovingItems:o,isUpdatingItems:a}},$r=async(e={inspect:void 0,quote:{id:"",locale:""},endpoints:{client:"",server:""},graphql:{}})=>typeof window<"u"?(console.warn("App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."),B(Je,{inspect:e.inspect,input:{initialContext:{endpoints:e.endpoints}}}).start()):B(Je,{input:{initialContext:{endpoints:e.endpoints,graphql:e.graphql,quote:{id:e.quote.id??"",locale:e.quote.locale??""}}},inspect:e.inspect}).start();function Vr({actor:e,children:t}){return Ye.jsx(dt.Provider,{value:e,children:t})}exports.AuthContext=it;exports.AuthProvider=Os;exports.QuoteContext=dt;exports.QuoteProvider=Vr;exports.ToastContext=ot;exports.ToastProvider=Ds;exports.authMachine=$e;exports.getAuth=bs;exports.getQuote=$r;exports.quoteMachine=Je;exports.timerMachine=en;exports.toastMachine=ks;exports.useAuth=ws;exports.useQuote=jr;exports.useToast=Cs;
|
package/index.mjs
CHANGED
|
@@ -6007,6 +6007,7 @@ const Dr = (e, t, n, s) => {
|
|
|
6007
6007
|
// settings: [],
|
|
6008
6008
|
...(t = e == null ? void 0 : e.initialContext) == null ? void 0 : t.quote
|
|
6009
6009
|
},
|
|
6010
|
+
errors: [],
|
|
6010
6011
|
endpoints: {
|
|
6011
6012
|
client: "",
|
|
6012
6013
|
server: "",
|
|
@@ -6043,8 +6044,7 @@ const Dr = (e, t, n, s) => {
|
|
|
6043
6044
|
// input.initialContext.graphql?.removeItems?.requestHeaders ??
|
|
6044
6045
|
// undefined,
|
|
6045
6046
|
// },
|
|
6046
|
-
}
|
|
6047
|
-
errors: []
|
|
6047
|
+
}
|
|
6048
6048
|
};
|
|
6049
6049
|
},
|
|
6050
6050
|
states: {
|