Skip to content

Commit

Permalink
updated 2
Browse files Browse the repository at this point in the history
  • Loading branch information
KostiantynFandeliuk committed Sep 18, 2024
1 parent 8e72fc7 commit 07c3254
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions scripts/__dropins__/storefront-order/api.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import{Initializer as u}from"@dropins/tools/lib.js";import{events as s}from"@dropins/tools/event-bus.js";import{f as n,h as m,a as o}from"./chunks/fetch-graphql.js";import{g as $,r as w,s as A,b as C,c as N}from"./chunks/fetch-graphql.js";import{O as _,a as c,A as l,t as h,b as O}from"./chunks/getCustomer.js";import{c as F,g as M}from"./chunks/getCustomer.js";import{g as x}from"./chunks/getAttributesForm.js";import"@dropins/tools/fetch-graphql.js";const y=`
import{Initializer as u}from"@dropins/tools/lib.js";import{events as s}from"@dropins/tools/event-bus.js";import{f as n,h as o,a as m}from"./chunks/fetch-graphql.js";import{g as $,r as w,s as A,b as C,c as N}from"./chunks/fetch-graphql.js";import{O as l,a as _,A as c,t as h,b as O}from"./chunks/getCustomer.js";import{c as F,g as M}from"./chunks/getCustomer.js";import{g as x}from"./chunks/getAttributesForm.js";import"@dropins/tools/fetch-graphql.js";const R=`
query ORDER_BY_NUMBER($orderNumber: String!) {
customer {
orders(
Expand Down Expand Up @@ -77,10 +77,10 @@ query ORDER_BY_NUMBER($orderNumber: String!) {
}
}
}
${l}
${_}
${c}
${l}
`,f=async(e,r)=>await n(y,{method:"GET",cache:"force-cache",variables:{orderNumber:e}}).then(t=>{var a;return(a=t.errors)!=null&&a.length?m(t.errors):h(r??"orderData",t)}).catch(o),g=`
`,y=async(e,r)=>await n(R,{method:"GET",cache:"force-cache",variables:{orderNumber:e}}).then(t=>{var a;return(a=t.errors)!=null&&a.length?o(t.errors):h(r??"orderData",t)}).catch(m),f=`
query ORDER_BY_TOKEN($token: String!) {
guestOrderByToken(input: { token: $token }) {
email
Expand Down Expand Up @@ -159,7 +159,7 @@ query ORDER_BY_TOKEN($token: String!) {
}
}
}
${l}
${_}
${c}
${l}
`,R=async e=>await n(g,{method:"GET",cache:"no-cache",variables:{token:e}}).then(r=>{var t;return(t=r.errors)!=null&&t.length?m(r.errors):O(r)}).catch(o),b=async e=>{var d;let r=null;const t=(e==null?void 0:e.orderRef)??"",a=t&&typeof(e==null?void 0:e.orderRef)=="string"&&((d=e==null?void 0:e.orderRef)==null?void 0:d.length)>20,i=(e==null?void 0:e.orderData)??null;if(i){s.emit("order/data",i);return}if(!t){console.error("Order Token or number not received.");return}a||(r=await f(t)),a&&(r=await R(t)),r?s.emit("order/data",r):s.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},p=new u({init:async e=>{const r={};p.config.setConfig({...r,...e}),b(e).catch(console.error)},listeners:()=>[]}),T=p.config;export{T as config,n as fetchGraphQl,x as getAttributesForm,$ as getConfig,F as getCustomer,M as getGuestOrder,f as getOrderDetailsById,R as guestOrderByToken,p as initialize,w as removeFetchGraphQlHeader,A as setEndpoint,C as setFetchGraphQlHeader,N as setFetchGraphQlHeaders};
`,g=async e=>await n(f,{method:"GET",cache:"no-cache",variables:{token:e}}).then(r=>{var t;return(t=r.errors)!=null&&t.length?o(r.errors):O(r)}).catch(m),b=async e=>{var d;let r=null;const t=(e==null?void 0:e.orderRef)??"";console.log("orderRef",t),console.log("config?.orderRef",e==null?void 0:e.orderRef);const a=t&&typeof(e==null?void 0:e.orderRef)=="string"&&((d=e==null?void 0:e.orderRef)==null?void 0:d.length)>20,i=(e==null?void 0:e.orderData)??null;if(i){s.emit("order/data",i);return}if(!t){console.error("Order Token or number not received.");return}a||(r=await y(t)),a&&(r=await g(t)),console.log("responseOrderData",r),r?s.emit("order/data",r):s.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},p=new u({init:async e=>{const r={};p.config.setConfig({...r,...e}),b(e).catch(console.error)},listeners:()=>[]}),T=p.config;export{T as config,n as fetchGraphQl,x as getAttributesForm,$ as getConfig,F as getCustomer,M as getGuestOrder,y as getOrderDetailsById,g as guestOrderByToken,p as initialize,w as removeFetchGraphQlHeader,A as setEndpoint,C as setFetchGraphQlHeader,N as setFetchGraphQlHeaders};

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 07c3254

Please sign in to comment.