Skip to content

Commit

Permalink
test bug? 9
Browse files Browse the repository at this point in the history
  • Loading branch information
KostiantynFandeliuk committed Nov 12, 2024
1 parent 8cdeb33 commit cc98b47
Show file tree
Hide file tree
Showing 17 changed files with 43 additions and 26 deletions.
14 changes: 7 additions & 7 deletions scripts/__dropins__/storefront-order/api.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import{Initializer as I}from"@dropins/tools/lib.js";import{events as d}from"@dropins/tools/event-bus.js";import{f as n,h as m}from"./chunks/fetch-graphql.js";import{g as U,r as q,s as z,a as Y,b as Q}from"./chunks/fetch-graphql.js";import{h as l}from"./chunks/network-error.js";import{P as u,a as _,G as p,O as c,B as O,R as D,c as b}from"./chunks/transform-order-details.js";import{O as h,A as R}from"./chunks/getGuestOrder.graphql.js";import{t as f}from"./chunks/getCustomer.js";import{g as K,a as j}from"./chunks/getCustomer.js";import{g as V}from"./chunks/getAttributesForm.js";import{g as X}from"./chunks/getStoreConfig.js";import{g as ee}from"./chunks/getCustomerOrdersReturn.js";import{g as te,r as ae}from"./chunks/requestReturn.js";import{c as de,r as oe}from"./chunks/requestGuestOrderCancel.js";import{r as ne}from"./chunks/reorderItems.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/convertCase.js";import"./chunks/transform-attributes-form.js";const G=`
query ORDER_BY_NUMBER($orderNumber: String!) {
import{Initializer as I}from"@dropins/tools/lib.js";import{events as o}from"@dropins/tools/event-bus.js";import{f as n,h as m}from"./chunks/fetch-graphql.js";import{g as U,r as Y,s as q,a as Q,b as H}from"./chunks/fetch-graphql.js";import{h as l}from"./chunks/network-error.js";import{P as u,a as _,G as p,O as c,B as O,R as D,c as b}from"./chunks/transform-order-details.js";import{O as R,A as h}from"./chunks/getGuestOrder.graphql.js";import{t as T}from"./chunks/getCustomer.js";import{g as j,a as J}from"./chunks/getCustomer.js";import{g as W}from"./chunks/getAttributesForm.js";import{g as Z}from"./chunks/getStoreConfig.js";import{g as re}from"./chunks/getCustomerOrdersReturn.js";import{g as ae,r as se}from"./chunks/requestReturn.js";import{c as oe,r as ie}from"./chunks/requestGuestOrderCancel.js";import{r as me}from"./chunks/reorderItems.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/convertCase.js";import"./chunks/transform-attributes-form.js";const G=`
query ORDER_BY_NUMBER($orderNumber: String!, $pageSize: Int) {
customer {
orders(
filter: { number: { eq: $orderNumber } }
Expand All @@ -15,7 +15,7 @@ query ORDER_BY_NUMBER($orderNumber: String!) {
carrier
shipping_method
is_virtual
returns(pageSize: 50) {
returns(pageSize: $pageSize) {
...OrderReturns
}
items_eligible_for_return {
Expand Down Expand Up @@ -108,10 +108,10 @@ ${_}
${p}
${c}
${O}
${h}
${R}
${h}
${D}
`,T=async(e,r,t)=>await n(G,{method:"GET",cache:"force-cache",variables:{orderNumber:e}}).then(a=>{var s;return(s=a.errors)!=null&&s.length?m(a.errors):b(t??"orderData",a,r)}).catch(l),g=`
`,y=async({orderId:e,returnRef:r,queryType:t,returnsPageSize:a=50})=>await n(G,{method:"GET",cache:"force-cache",variables:{orderNumber:e,pageSize:a}}).then(s=>{var d;return(d=s.errors)!=null&&d.length?m(s.errors):b(t??"orderData",s,r)}).catch(l),f=`
query ORDER_BY_TOKEN($token: String!) {
guestOrderByToken(input: { token: $token }) {
email
Expand Down Expand Up @@ -205,7 +205,7 @@ ${_}
${p}
${c}
${O}
${h}
${R}
${h}
${D}
`,A=async(e,r)=>await n(g,{method:"GET",cache:"no-cache",variables:{token:e}}).then(t=>{var a;return(a=t.errors)!=null&&a.length?m(t.errors):f(t,r)}).catch(l),y=async e=>{var i;const r=(e==null?void 0:e.orderRef)??"",t=(e==null?void 0:e.returnRef)??"",a=r&&typeof(e==null?void 0:e.orderRef)=="string"&&((i=e==null?void 0:e.orderRef)==null?void 0:i.length)>20,s=(e==null?void 0:e.orderData)??null;if(s){d.emit("order/data",{...s,returnNumber:t});return}if(!r){console.error("Order Token or number not received.");return}const o=a?await A(r,t):await T(r,t,"orderData");o?d.emit("order/data",{...o,returnNumber:t}):d.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},E=new I({init:async e=>{const r={};E.config.setConfig({...r,...e}),y(e).catch(console.error)},listeners:()=>[]}),v=E.config;export{de as cancelOrder,v as config,n as fetchGraphQl,V as getAttributesForm,te as getAttributesList,U as getConfig,K as getCustomer,ee as getCustomerOrdersReturn,j as getGuestOrder,T as getOrderDetailsById,X as getStoreConfig,A as guestOrderByToken,E as initialize,q as removeFetchGraphQlHeader,ne as reorderItems,oe as requestGuestOrderCancel,ae as requestReturn,z as setEndpoint,Y as setFetchGraphQlHeader,Q as setFetchGraphQlHeaders};
`,$=async(e,r)=>await n(f,{method:"GET",cache:"no-cache",variables:{token:e}}).then(t=>{var a;return(a=t.errors)!=null&&a.length?m(t.errors):T(t,r)}).catch(l),A="orderData",C=async e=>{var i;const r=typeof(e==null?void 0:e.orderRef)=="string"?e==null?void 0:e.orderRef:"",t=typeof(e==null?void 0:e.returnRef)=="string"?e==null?void 0:e.returnRef:"",a=r&&typeof(e==null?void 0:e.orderRef)=="string"&&((i=e==null?void 0:e.orderRef)==null?void 0:i.length)>20,s=(e==null?void 0:e.orderData)??null;if(s){o.emit("order/data",{...s,returnNumber:t});return}if(!r){console.error("Order Token or number not received.");return}const d=a?await $(r,t):await y({orderId:r,returnRef:t,queryType:A});d?o.emit("order/data",{...d,returnNumber:t}):o.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},E=new I({init:async e=>{const r={};E.config.setConfig({...r,...e}),C(e).catch(console.error)},listeners:()=>[]}),x=E.config;export{oe as cancelOrder,x as config,n as fetchGraphQl,W as getAttributesForm,ae as getAttributesList,U as getConfig,j as getCustomer,re as getCustomerOrdersReturn,J as getGuestOrder,y as getOrderDetailsById,Z as getStoreConfig,$ as guestOrderByToken,E as initialize,Y as removeFetchGraphQlHeader,me as reorderItems,ie as requestGuestOrderCancel,se as requestReturn,q as setEndpoint,Q as setFetchGraphQlHeader,H as setFetchGraphQlHeaders};
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { GetOrderDetailsByIdProps } from '../../types';
import { TransformedData } from '../../data/models';

export declare const getOrderDetailsById: <T extends "orderData">(orderId?: string, returnRef?: string, queryType?: T | undefined) => Promise<TransformedData<T>>;
export declare const getOrderDetailsById: <T extends "orderData">({ orderId, returnRef, queryType, returnsPageSize, }: GetOrderDetailsByIdProps) => Promise<TransformedData<T>>;
//# sourceMappingURL=getOrderDetailsById.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export declare const REQUEST_RETURN_ORDER_FRAGMENT = "\n fragment OrderReturn on Return {\n __typename\n uid\n status\n number\n created_at\n }\n";
//# sourceMappingURL=fragments.d.ts.map
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export declare const REQUEST_RETURN_ORDER = "\nmutation REQUEST_RETURN_ORDER($input: RequestReturnInput!) {\n requestReturn(input: $input) {\n return {\n uid\n status\n number\n created_at\n }\n }\n}\n";
export declare const REQUEST_RETURN_ORDER: string;
//# sourceMappingURL=requestReturn.graphql.d.ts.map

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

Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ import{h as i}from"./network-error.js";import{f as u,h as s}from"./fetch-graphql
}
}
}
`,T=async r=>await u(r!=="shortRequest"?n:_,{method:"GET",cache:"force-cache",variables:{formCode:r}}).then(t=>{var e,o,a;return(e=t.errors)!=null&&e.length?s(t.errors):m(((a=(o=t==null?void 0:t.data)==null?void 0:o.attributesForm)==null?void 0:a.items)??[])}).catch(i);export{T as g};
`,T=async r=>await u(r!=="shortRequest"?n:_,{method:"GET",cache:"force-cache",variables:{formCode:r}}).then(t=>{var e,o,a;return(e=t.errors)!=null&&e.length?s(t.errors):m((a=(o=t==null?void 0:t.data)==null?void 0:o.attributesForm)==null?void 0:a.items)}).catch(i);export{T as g};
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ fragment AddressesList on OrderAddress {
timestamp
}
items {
__typename
id
product_sku
product_name
Expand Down
19 changes: 12 additions & 7 deletions scripts/__dropins__/storefront-order/chunks/requestReturn.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import{h as i}from"./network-error.js";import{f as s,h as o}from"./fetch-graphql.js";import{t as c}from"./transform-attributes-form.js";import{a as m}from"./convertCase.js";const d=`
import{h as i}from"./network-error.js";import{f as s,h as o}from"./fetch-graphql.js";import{t as R}from"./transform-attributes-form.js";import{a as c}from"./convertCase.js";const m=`
query GET_ATTRIBUTES_LIST($entityType: AttributeEntityTypeEnum!) {
attributesList(entityType: $entityType) {
items {
Expand Down Expand Up @@ -31,15 +31,20 @@ import{h as i}from"./network-error.js";import{f as s,h as o}from"./fetch-graphql
}
}
}
`,E=async u=>await s(d,{method:"GET",cache:"force-cache",variables:{entityType:u}}).then(t=>{var e,r,a;return(e=t.errors)!=null&&e.length?o(t.errors):c(((a=(r=t==null?void 0:t.data)==null?void 0:r.attributesList)==null?void 0:a.items)??[])}).catch(i),l=`
`,f=async n=>await s(m,{method:"GET",cache:"force-cache",variables:{entityType:n}}).then(t=>{var e,r,a;return(e=t.errors)!=null&&e.length?o(t.errors):R((a=(r=t==null?void 0:t.data)==null?void 0:r.attributesList)==null?void 0:a.items)}).catch(i),_=`
fragment OrderReturn on Return {
__typename
uid
status
number
created_at
}
`,T=`
mutation REQUEST_RETURN_ORDER($input: RequestReturnInput!) {
requestReturn(input: $input) {
return {
uid
status
number
created_at
...OrderReturn
}
}
}
`,f=async u=>{const t=m(u,"snakeCase",{});return await s(l,{method:"POST",variables:{input:t}}).then(e=>{var n;if((n=e.errors)!=null&&n.length)return o(e.errors);const{created_at:r,...a}=e.data.requestReturn.return;return{...a,createdAt:r}}).catch(i)};export{E as g,f as r};
${_}`,y=async n=>{const t=c(n,"snakeCase",{});return await s(T,{method:"POST",variables:{input:t}}).then(e=>{var u;if((u=e.errors)!=null&&u.length)return o(e.errors);const{created_at:r,...a}=e.data.requestReturn.return;return{...a,createdAt:r}}).catch(i)};export{f as g,y as r};
Loading

0 comments on commit cc98b47

Please sign in to comment.