@dropins/storefront-order 0.1.0-alpha11 → 0.1.0-alpha12
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/api/getCustomerOrdersReturn/getCustomerOrdersReturn.d.ts +4 -0
- package/api/getCustomerOrdersReturn/graphql/getCustomerOrdersReturn.graphql.d.ts +2 -0
- package/api/getCustomerOrdersReturn/index.d.ts +2 -0
- package/api/getOrderDetailsById/graphql/orderItemsFragment.graphql.d.ts +5 -5
- package/api/getOrderDetailsById/graphql/orderSummaryFragment.graphql.d.ts +1 -1
- package/api/getStoreConfig/graphql/StoreConfigQuery.d.ts +1 -1
- package/api/index.d.ts +1 -0
- package/api.js +85 -41
- package/chunks/OrderLoaders.js +1 -1
- package/chunks/customerAddressFragment.graphql.js +55 -0
- package/chunks/getCustomer.js +40 -17
- package/chunks/getCustomerOrdersReturn.js +52 -0
- package/chunks/getStoreConfig.js +6 -2
- package/chunks/setTaxStatus.js +1 -0
- package/chunks/transform-order-details.js +45 -116
- package/components/EmptyList/EmptyList.d.ts +5 -0
- package/components/EmptyList/index.d.ts +3 -0
- package/components/OrderCostSummaryContent/Blocks.d.ts +38 -0
- package/components/OrderCostSummaryContent/OrderCostSummaryContent.d.ts +5 -0
- package/components/OrderCostSummaryContent/index.d.ts +3 -0
- package/components/OrderLoaders/OrderLoaders.d.ts +1 -0
- package/components/ReturnsListContent/ReturnsListContent.d.ts +5 -0
- package/components/ReturnsListContent/index.d.ts +3 -0
- package/components/index.d.ts +3 -0
- package/configs/mock.config.d.ts +318 -0
- package/containers/CustomerDetails.js +1 -1
- package/containers/OrderCancel.js +26 -18
- package/containers/OrderCostSummary/OrderCostSummary.d.ts +5 -0
- package/containers/OrderCostSummary/index.d.ts +3 -0
- package/containers/OrderCostSummary.d.ts +3 -0
- package/containers/OrderCostSummary.js +1 -0
- package/containers/OrderProductList.js +1 -1
- package/containers/OrderSearch.js +1 -1
- package/containers/ReturnsList/ReturnsList.d.ts +5 -0
- package/containers/ReturnsList/index.d.ts +3 -0
- package/containers/ReturnsList.d.ts +3 -0
- package/containers/ReturnsList.js +1 -0
- package/containers/index.d.ts +2 -0
- package/data/models/customer-orders-return.d.ts +36 -0
- package/data/models/index.d.ts +2 -0
- package/data/models/order-details.d.ts +27 -16
- package/data/models/store-config.d.ts +6 -0
- package/data/transforms/index.d.ts +2 -0
- package/data/transforms/transform-customer-orders-return.d.ts +5 -0
- package/data/transforms/transform-order-details.d.ts +2 -1
- package/hooks/containers/useOrderCostSummary.d.ts +9 -0
- package/hooks/containers/useReturnsList.d.ts +14 -0
- package/hooks/index.d.ts +3 -0
- package/hooks/useIsMobile.d.ts +2 -0
- package/i18n/en_US.json.d.ts +56 -8
- package/package.json +1 -1
- package/render.js +2 -2
- package/types/api/getCustomerOrdersReturn.types.d.ts +46 -0
- package/types/api/getOrderDetails.types.d.ts +1 -0
- package/types/emptyList.types.d.ts +7 -0
- package/types/index.d.ts +4 -0
- package/types/orderCostSummary.types.d.ts +28 -0
- package/types/returnsList.types.d.ts +42 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
1
|
+
export declare const PRODUCT_DETAILS_FRAGMENT = "\n fragment ProductDetails on ProductInterface {\n __typename\n canonical_url\n uid\n name\n sku\n only_x_left_in_stock\n stock_status\n thumbnail {\n label\n url\n }\n price_range {\n maximum_price {\n regular_price {\n currency\n value\n }\n }\n }\n }\n";
|
|
2
|
+
export declare const PRICE_DETAILS_FRAGMENT = "\n fragment PriceDetails on OrderItemInterface {\n prices {\n price_including_tax {\n value\n currency\n }\n original_price {\n value\n currency\n }\n original_price_including_tax {\n value\n currency\n }\n price {\n value\n currency\n }\n }\n }\n";
|
|
3
|
+
export declare const GIFT_CARD_DETAILS_FRAGMENT = "\n fragment GiftCardDetails on GiftCardOrderItem {\n ...PriceDetails\n gift_message {\n message\n }\n gift_card {\n recipient_name\n recipient_email\n sender_name\n sender_email\n message\n }\n }\n";
|
|
4
|
+
export declare const ORDER_ITEM_DETAILS_FRAGMENT = "\n fragment OrderItemDetails on OrderItemInterface {\n __typename\n status\n product_name\n id\n quantity_ordered\n quantity_shipped\n quantity_canceled\n quantity_invoiced\n quantity_refunded\n quantity_returned\n product_sale_price {\n value\n currency\n }\n selected_options {\n label\n value\n }\n product {\n ...ProductDetails\n }\n ...PriceDetails\n }\n";
|
|
5
|
+
export declare const BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT = "\n fragment BundleOrderItemDetails on BundleOrderItem {\n ...PriceDetails\n bundle_options {\n uid\n label\n values {\n uid\n product_name\n }\n }\n }\n";
|
|
6
6
|
//# sourceMappingURL=orderItemsFragment.graphql.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const ORDER_SUMMARY = "\nfragment OrderSummary on OrderTotal {\n grand_total {\n value\n currency\n }\n subtotal {\n currency\n value\n }\n taxes {\n amount {\n currency\n value\n }\n rate\n title\n }\n total_tax {\n currency\n value\n }\n total_shipping {\n currency\n value\n }\n discounts {\n amount {\n currency\n value\n }\n label\n }\n}";
|
|
1
|
+
export declare const ORDER_SUMMARY = "\nfragment OrderSummary on OrderTotal {\n grand_total {\n value\n currency\n }\n total_giftcard {\n currency\n value\n }\n subtotal {\n currency\n value\n }\n taxes {\n amount {\n currency\n value\n }\n rate\n title\n }\n total_tax {\n currency\n value\n }\n total_shipping {\n currency\n value\n }\n discounts {\n amount {\n currency\n value\n }\n label\n }\n}";
|
|
2
2
|
//# sourceMappingURL=orderSummaryFragment.graphql.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const STORE_CONFIG_QUERY = "\nquery STORE_CONFIG_QUERY {\n storeConfig {\n order_cancellation_enabled\n order_cancellation_reasons {\n description\n }\n shopping_cart_display_price\n shopping_cart_display_shipping\n shopping_cart_display_subtotal\n }\n}\n";
|
|
1
|
+
export declare const STORE_CONFIG_QUERY = "\nquery STORE_CONFIG_QUERY {\n storeConfig {\n order_cancellation_enabled\n order_cancellation_reasons {\n description\n }\n shopping_cart_display_price\n shopping_cart_display_shipping\n shopping_cart_display_subtotal\n shopping_cart_display_grand_total\n shopping_cart_display_tax_gift_wrapping\n shopping_cart_display_full_summary\n shopping_cart_display_zero_tax\n }\n}\n";
|
|
2
2
|
//# sourceMappingURL=StoreConfigQuery.d.ts.map
|
package/api/index.d.ts
CHANGED
package/api.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{Initializer as
|
|
1
|
+
import{Initializer as E}from"@dropins/tools/lib.js";import{events as s}from"@dropins/tools/event-bus.js";import{f as i,h as n}from"./chunks/fetch-graphql.js";import{g as L,r as P,s as x,a as U,b as Y}from"./chunks/fetch-graphql.js";import{h as m}from"./chunks/network-error.js";import{P as l,a as u,G as _,O as c,B as p,b as R}from"./chunks/transform-order-details.js";import{O as h,A as D}from"./chunks/customerAddressFragment.graphql.js";import{t as f}from"./chunks/getCustomer.js";import{g as q,a as z}from"./chunks/getCustomer.js";import{g as K}from"./chunks/getAttributesForm.js";import{g as J}from"./chunks/getStoreConfig.js";import{g as W}from"./chunks/getCustomerOrdersReturn.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/convertCase.js";const I=`
|
|
2
2
|
query ORDER_BY_NUMBER($orderNumber: String!) {
|
|
3
|
-
|
|
3
|
+
customer {
|
|
4
4
|
orders(
|
|
5
|
-
|
|
5
|
+
filter: { number: { eq: $orderNumber } }
|
|
6
6
|
) {
|
|
7
7
|
items {
|
|
8
8
|
email
|
|
@@ -19,54 +19,76 @@ query ORDER_BY_NUMBER($orderNumber: String!) {
|
|
|
19
19
|
code
|
|
20
20
|
}
|
|
21
21
|
shipments {
|
|
22
|
-
id
|
|
23
|
-
number
|
|
24
|
-
tracking {
|
|
25
|
-
title
|
|
26
|
-
number
|
|
27
|
-
carrier
|
|
28
|
-
}
|
|
29
|
-
comments {
|
|
30
|
-
message
|
|
31
|
-
timestamp
|
|
32
|
-
}
|
|
33
|
-
items {
|
|
34
22
|
id
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
23
|
+
number
|
|
24
|
+
tracking {
|
|
25
|
+
title
|
|
26
|
+
number
|
|
27
|
+
carrier
|
|
40
28
|
}
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
comments {
|
|
30
|
+
message
|
|
31
|
+
timestamp
|
|
32
|
+
}
|
|
33
|
+
items {
|
|
34
|
+
id
|
|
35
|
+
product_sku
|
|
36
|
+
product_name
|
|
37
|
+
order_item {
|
|
38
|
+
...OrderItemDetails
|
|
39
|
+
... on GiftCardOrderItem {
|
|
40
|
+
...GiftCardDetails
|
|
41
|
+
product {
|
|
42
|
+
...ProductDetails
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
43
48
|
payment_methods {
|
|
44
49
|
name
|
|
45
50
|
type
|
|
46
51
|
}
|
|
47
52
|
shipping_address {
|
|
48
|
-
|
|
53
|
+
...AddressesList
|
|
49
54
|
}
|
|
50
55
|
billing_address {
|
|
51
|
-
|
|
56
|
+
...AddressesList
|
|
52
57
|
}
|
|
53
58
|
items {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
...OrderItemDetails
|
|
60
|
+
... on BundleOrderItem {
|
|
61
|
+
...BundleOrderItemDetails
|
|
62
|
+
}
|
|
63
|
+
... on GiftCardOrderItem {
|
|
64
|
+
...GiftCardDetails
|
|
65
|
+
product {
|
|
66
|
+
...ProductDetails
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
... on DownloadableOrderItem {
|
|
70
|
+
product_name
|
|
71
|
+
downloadable_links {
|
|
72
|
+
sort_order
|
|
73
|
+
title
|
|
74
|
+
}
|
|
75
|
+
}
|
|
59
76
|
}
|
|
60
77
|
total {
|
|
61
|
-
|
|
78
|
+
...OrderSummary
|
|
62
79
|
}
|
|
63
80
|
}
|
|
64
81
|
}
|
|
65
82
|
}
|
|
66
83
|
}
|
|
84
|
+
${l}
|
|
85
|
+
${u}
|
|
86
|
+
${_}
|
|
87
|
+
${c}
|
|
88
|
+
${p}
|
|
67
89
|
${h}
|
|
68
|
-
${
|
|
69
|
-
`,
|
|
90
|
+
${D}
|
|
91
|
+
`,T=async(e,r)=>await i(I,{method:"GET",cache:"force-cache",variables:{orderNumber:e}}).then(t=>{var a;return(a=t.errors)!=null&&a.length?n(t.errors):R(r??"orderData",t)}).catch(m),b=`
|
|
70
92
|
query ORDER_BY_TOKEN($token: String!) {
|
|
71
93
|
guestOrderByToken(input: { token: $token }) {
|
|
72
94
|
email
|
|
@@ -105,8 +127,13 @@ query ORDER_BY_TOKEN($token: String!) {
|
|
|
105
127
|
product_sku
|
|
106
128
|
product_name
|
|
107
129
|
order_item {
|
|
108
|
-
|
|
109
|
-
|
|
130
|
+
...OrderItemDetails
|
|
131
|
+
... on GiftCardOrderItem {
|
|
132
|
+
...GiftCardDetails
|
|
133
|
+
product {
|
|
134
|
+
...ProductDetails
|
|
135
|
+
}
|
|
136
|
+
}
|
|
110
137
|
}
|
|
111
138
|
}
|
|
112
139
|
}
|
|
@@ -121,17 +148,34 @@ query ORDER_BY_TOKEN($token: String!) {
|
|
|
121
148
|
...AddressesList
|
|
122
149
|
}
|
|
123
150
|
items {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
151
|
+
...OrderItemDetails
|
|
152
|
+
... on BundleOrderItem {
|
|
153
|
+
...BundleOrderItemDetails
|
|
154
|
+
}
|
|
155
|
+
... on GiftCardOrderItem {
|
|
156
|
+
...GiftCardDetails
|
|
157
|
+
product {
|
|
158
|
+
...ProductDetails
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
... on DownloadableOrderItem {
|
|
162
|
+
product_name
|
|
163
|
+
downloadable_links {
|
|
164
|
+
sort_order
|
|
165
|
+
title
|
|
166
|
+
}
|
|
167
|
+
}
|
|
129
168
|
}
|
|
130
169
|
total {
|
|
131
170
|
...OrderSummary
|
|
132
171
|
}
|
|
133
172
|
}
|
|
134
173
|
}
|
|
174
|
+
${l}
|
|
175
|
+
${u}
|
|
176
|
+
${_}
|
|
177
|
+
${c}
|
|
178
|
+
${p}
|
|
135
179
|
${h}
|
|
136
|
-
${
|
|
137
|
-
`,
|
|
180
|
+
${D}
|
|
181
|
+
`,G=async e=>await i(b,{method:"GET",cache:"no-cache",variables:{token:e}}).then(r=>{var t;return(t=r.errors)!=null&&t.length?n(r.errors):f(r)}).catch(m),g=async e=>{var d;const r=(e==null?void 0:e.orderRef)??"",t=r&&typeof(e==null?void 0:e.orderRef)=="string"&&((d=e==null?void 0:e.orderRef)==null?void 0:d.length)>20,a=(e==null?void 0:e.orderData)??null;if(a){s.emit("order/data",a);return}if(!r){console.error("Order Token or number not received.");return}const o=t?await G(r):await T(r);o?s.emit("order/data",o):s.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},O=new E({init:async e=>{const r={};O.config.setConfig({...r,...e}),g(e).catch(console.error)},listeners:()=>[]}),F=O.config;export{F as config,i as fetchGraphQl,K as getAttributesForm,L as getConfig,q as getCustomer,W as getCustomerOrdersReturn,z as getGuestOrder,T as getOrderDetailsById,J as getStoreConfig,G as guestOrderByToken,O as initialize,P as removeFetchGraphQlHeader,x as setEndpoint,U as setFetchGraphQlHeader,Y as setFetchGraphQlHeaders};
|
package/chunks/OrderLoaders.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as
|
|
1
|
+
import{jsx as e,jsxs as a}from"@dropins/tools/preact-jsx-runtime.js";import{Card as n,Skeleton as i,SkeletonRow as r,CartItemSkeleton as t}from"@dropins/tools/components.js";import"./OrderCancelReasonsForm.js";import{classes as o}from"@dropins/tools/lib.js";const z=({testId:s,withCard:d=!0})=>{const l=a(i,{"data-testid":s??"skeletonLoader",children:[e(r,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),e(r,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(r,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]});return d?l:e(n,{variant:"secondary",className:o(["order-order-loaders","order-order-loaders--card-loader"]),children:l})},g=s=>e(n,{variant:"secondary",...s,children:a(i,{"data-testid":"order-details-skeleton",children:[e(r,{variant:"heading",size:"medium",fullWidth:!0}),e(r,{size:"medium"}),e(r,{variant:"empty",size:"medium"}),e(r,{size:"xlarge"}),e(r,{size:"xlarge"}),e(r,{size:"xlarge"}),e(r,{size:"xlarge"})]})}),f=()=>a(i,{"data-testid":"order-product-list-skeleton",style:{gridTemplateColumns:"1fr"},children:[e(r,{variant:"heading",fullWidth:!0,size:"medium"}),e(t,{}),e(t,{}),e(t,{}),e(t,{}),e(t,{})]}),v=()=>a(i,{"data-testid":"order-cost-summary-content-skeleton",className:"order-cost-summary-content",children:[e(r,{variant:"heading",size:"small"}),e(r,{variant:"empty",size:"small"}),e(r,{variant:"empty",size:"small"}),e(r,{variant:"empty",size:"small"}),e(r,{variant:"heading",size:"small",fullWidth:!0,lines:3})]});export{z as C,g as D,f as O,v as a};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const e=`
|
|
2
|
+
fragment OrderSummary on OrderTotal {
|
|
3
|
+
grand_total {
|
|
4
|
+
value
|
|
5
|
+
currency
|
|
6
|
+
}
|
|
7
|
+
total_giftcard {
|
|
8
|
+
currency
|
|
9
|
+
value
|
|
10
|
+
}
|
|
11
|
+
subtotal {
|
|
12
|
+
currency
|
|
13
|
+
value
|
|
14
|
+
}
|
|
15
|
+
taxes {
|
|
16
|
+
amount {
|
|
17
|
+
currency
|
|
18
|
+
value
|
|
19
|
+
}
|
|
20
|
+
rate
|
|
21
|
+
title
|
|
22
|
+
}
|
|
23
|
+
total_tax {
|
|
24
|
+
currency
|
|
25
|
+
value
|
|
26
|
+
}
|
|
27
|
+
total_shipping {
|
|
28
|
+
currency
|
|
29
|
+
value
|
|
30
|
+
}
|
|
31
|
+
discounts {
|
|
32
|
+
amount {
|
|
33
|
+
currency
|
|
34
|
+
value
|
|
35
|
+
}
|
|
36
|
+
label
|
|
37
|
+
}
|
|
38
|
+
}`,r=`
|
|
39
|
+
fragment AddressesList on OrderAddress {
|
|
40
|
+
city
|
|
41
|
+
company
|
|
42
|
+
country_code
|
|
43
|
+
fax
|
|
44
|
+
firstname
|
|
45
|
+
lastname
|
|
46
|
+
middlename
|
|
47
|
+
postcode
|
|
48
|
+
prefix
|
|
49
|
+
region
|
|
50
|
+
region_id
|
|
51
|
+
street
|
|
52
|
+
suffix
|
|
53
|
+
telephone
|
|
54
|
+
vat_id
|
|
55
|
+
}`;export{r as A,e as O};
|
package/chunks/getCustomer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as
|
|
1
|
+
import{h as u}from"./network-error.js";import{f as c,h as n}from"./fetch-graphql.js";import{t as _,P as l,a as o,G as E,O,B as T}from"./transform-order-details.js";import{O as s,A as D}from"./customerAddressFragment.graphql.js";const h=t=>{var a,e;if(!((a=t==null?void 0:t.data)!=null&&a.guestOrder))return null;const r=(e=t==null?void 0:t.data)==null?void 0:e.guestOrder;return _(r)},C=t=>{var a,e;if(!((a=t==null?void 0:t.data)!=null&&a.guestOrderByToken))return null;const r=(e=t==null?void 0:t.data)==null?void 0:e.guestOrderByToken;return _(r)},f=t=>{var r,a,e,d,i,m;return{email:((a=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:a.email)||"",firstname:((d=(e=t==null?void 0:t.data)==null?void 0:e.customer)==null?void 0:d.firstname)||"",lastname:((m=(i=t==null?void 0:t.data)==null?void 0:i.customer)==null?void 0:m.lastname)||""}},G=`
|
|
2
2
|
fragment guestOrderData on CustomerOrder {
|
|
3
3
|
email
|
|
4
4
|
id
|
|
@@ -31,13 +31,18 @@ import{h as n}from"./network-error.js";import{f as _,h as E}from"./fetch-graphql
|
|
|
31
31
|
message
|
|
32
32
|
timestamp
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
items {
|
|
35
|
+
id
|
|
36
|
+
product_sku
|
|
37
|
+
product_name
|
|
38
|
+
order_item {
|
|
39
|
+
...OrderItemDetails
|
|
40
|
+
... on GiftCardOrderItem {
|
|
41
|
+
...GiftCardDetails
|
|
42
|
+
product {
|
|
43
|
+
...ProductDetails
|
|
44
|
+
}
|
|
45
|
+
}
|
|
41
46
|
}
|
|
42
47
|
}
|
|
43
48
|
}
|
|
@@ -52,25 +57,43 @@ import{h as n}from"./network-error.js";import{f as _,h as E}from"./fetch-graphql
|
|
|
52
57
|
...AddressesList
|
|
53
58
|
}
|
|
54
59
|
items {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
...OrderItemDetails
|
|
61
|
+
... on BundleOrderItem {
|
|
62
|
+
...BundleOrderItemDetails
|
|
63
|
+
}
|
|
64
|
+
... on GiftCardOrderItem {
|
|
65
|
+
...GiftCardDetails
|
|
66
|
+
product {
|
|
67
|
+
...ProductDetails
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
... on DownloadableOrderItem {
|
|
71
|
+
product_name
|
|
72
|
+
downloadable_links {
|
|
73
|
+
sort_order
|
|
74
|
+
title
|
|
75
|
+
}
|
|
76
|
+
}
|
|
59
77
|
}
|
|
60
78
|
total {
|
|
61
79
|
...OrderSummary
|
|
62
80
|
}
|
|
63
81
|
}
|
|
82
|
+
${l}
|
|
64
83
|
${o}
|
|
65
|
-
${
|
|
66
|
-
|
|
84
|
+
${E}
|
|
85
|
+
${O}
|
|
86
|
+
${T}
|
|
87
|
+
${s}
|
|
88
|
+
${D}
|
|
89
|
+
`,R=`
|
|
67
90
|
query GET_GUEST_ORDER($input: OrderInformationInput!) {
|
|
68
91
|
guestOrder(input:$input) {
|
|
69
92
|
...guestOrderData
|
|
70
93
|
}
|
|
71
94
|
}
|
|
72
|
-
${
|
|
73
|
-
`,
|
|
95
|
+
${G}
|
|
96
|
+
`,M=async t=>await c(R,{method:"GET",cache:"no-cache",variables:{input:t}}).then(r=>{var a;return(a=r.errors)!=null&&a.length?n(r.errors):h(r)}).catch(u),g=`
|
|
74
97
|
query GET_CUSTOMER {
|
|
75
98
|
customer {
|
|
76
99
|
firstname
|
|
@@ -78,4 +101,4 @@ ${f}
|
|
|
78
101
|
email
|
|
79
102
|
}
|
|
80
103
|
}
|
|
81
|
-
|
|
104
|
+
`,$=async()=>await c(g,{method:"GET",cache:"force-cache"}).then(t=>{var r;return(r=t.errors)!=null&&r.length?n(t.errors):f(t)}).catch(u);export{M as a,$ as g,C as t};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import{h as C}from"./network-error.js";import{f as N,h as S}from"./fetch-graphql.js";import{c as b,P as m,a as M,G as F,O as P}from"./transform-order-details.js";const L=t=>{var _,d,g,i,R,E,T,f,h,I;if(!((i=(g=(d=(_=t==null?void 0:t.data)==null?void 0:_.customer)==null?void 0:d.returns)==null?void 0:g.items)!=null&&i.length))return null;const n=(T=(E=(R=t==null?void 0:t.data)==null?void 0:R.customer)==null?void 0:E.returns)==null?void 0:T.items,c=(I=(h=(f=t==null?void 0:t.data)==null?void 0:f.customer)==null?void 0:h.returns)==null?void 0:I.page_info;return{ordersReturn:n.map(u=>{var D,G;const{order:a}=u,q=((G=(D=u==null?void 0:u.shipping)==null?void 0:D.tracking)==null?void 0:G.map(r=>{const{status:s,carrier:o,tracking_number:e}=r;return{status:s,carrier:o,trackingNumber:e}}))??[],k=u.items.map(r=>{var O;const s=r==null?void 0:r.quantity,o=r==null?void 0:r.status,e=r==null?void 0:r.request_quantity,y=r==null?void 0:r.uid,l=r==null?void 0:r.order_item,p=((O=b([l]))==null?void 0:O.reduce((z,A)=>A,{}))??{};return{uid:y,quantity:s,status:o,requestQuantity:e,orderItem:p}});return{token:a==null?void 0:a.token,orderNumber:a==null?void 0:a.number,items:k,tracking:q}}),pageInfo:{pageSize:c.page_size,totalPages:c.total_pages,currentPage:c.current_page}}},U=`
|
|
2
|
+
query GET_CUSTOMER_ORDERS_RETURN {
|
|
3
|
+
customer {
|
|
4
|
+
returns {
|
|
5
|
+
page_info {
|
|
6
|
+
page_size
|
|
7
|
+
total_pages
|
|
8
|
+
current_page
|
|
9
|
+
}
|
|
10
|
+
items {
|
|
11
|
+
number
|
|
12
|
+
shipping {
|
|
13
|
+
tracking {
|
|
14
|
+
status {
|
|
15
|
+
text
|
|
16
|
+
type
|
|
17
|
+
}
|
|
18
|
+
carrier {
|
|
19
|
+
uid
|
|
20
|
+
label
|
|
21
|
+
}
|
|
22
|
+
tracking_number
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
order {
|
|
26
|
+
number
|
|
27
|
+
token
|
|
28
|
+
}
|
|
29
|
+
items {
|
|
30
|
+
uid
|
|
31
|
+
quantity
|
|
32
|
+
status
|
|
33
|
+
request_quantity
|
|
34
|
+
order_item {
|
|
35
|
+
...OrderItemDetails
|
|
36
|
+
... on GiftCardOrderItem {
|
|
37
|
+
...GiftCardDetails
|
|
38
|
+
product {
|
|
39
|
+
...ProductDetails
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
${m}
|
|
49
|
+
${M}
|
|
50
|
+
${F}
|
|
51
|
+
${P}
|
|
52
|
+
`,j=async()=>await N(U,{method:"GET",cache:"force-cache"}).then(t=>{var n;return(n=t.errors)!=null&&n.length?S(t.errors):L(t)}).catch(C);export{j as g};
|
package/chunks/getStoreConfig.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as
|
|
1
|
+
import{f as i,h as s}from"./fetch-graphql.js";function n(p){return p?{orderCancellationEnabled:p.order_cancellation_enabled,orderCancellationReasons:p.order_cancellation_reasons,shoppingCartDisplayPrice:p.shopping_cart_display_price,shoppingOrdersDisplaySubtotal:p.shopping_cart_display_subtotal,shoppingOrdersDisplayShipping:p.shopping_cart_display_shipping,shoppingOrdersDisplayGrandTotal:p.shopping_cart_display_grand_total,shoppingOrdersDisplayTaxGiftWrapping:p.shopping_cart_display_tax_gift_wrapping,shoppingOrdersDisplayFullSummary:p.shopping_cart_display_full_summary,shoppingOrdersDisplayZeroTax:p.shopping_cart_display_zero_tax}:null}const a=`
|
|
2
2
|
query STORE_CONFIG_QUERY {
|
|
3
3
|
storeConfig {
|
|
4
4
|
order_cancellation_enabled
|
|
@@ -8,6 +8,10 @@ query STORE_CONFIG_QUERY {
|
|
|
8
8
|
shopping_cart_display_price
|
|
9
9
|
shopping_cart_display_shipping
|
|
10
10
|
shopping_cart_display_subtotal
|
|
11
|
+
shopping_cart_display_grand_total
|
|
12
|
+
shopping_cart_display_tax_gift_wrapping
|
|
13
|
+
shopping_cart_display_full_summary
|
|
14
|
+
shopping_cart_display_zero_tax
|
|
11
15
|
}
|
|
12
16
|
}
|
|
13
|
-
`,
|
|
17
|
+
`,o=async()=>i(a,{method:"GET",cache:"force-cache"}).then(({errors:p,data:r})=>p?s(p):n(r.storeConfig));export{o as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const s=t=>{let e=!1,a=!1;switch(t){case 1:a=!0;break;case 2:e=!0;break;case 3:e=!0,a=!0;break;default:e=!1,a=!1}return{taxIncluded:e,taxExcluded:a}};export{s};
|
|
@@ -1,92 +1,5 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
fragment
|
|
3
|
-
grand_total {
|
|
4
|
-
value
|
|
5
|
-
currency
|
|
6
|
-
}
|
|
7
|
-
subtotal {
|
|
8
|
-
currency
|
|
9
|
-
value
|
|
10
|
-
}
|
|
11
|
-
taxes {
|
|
12
|
-
amount {
|
|
13
|
-
currency
|
|
14
|
-
value
|
|
15
|
-
}
|
|
16
|
-
rate
|
|
17
|
-
title
|
|
18
|
-
}
|
|
19
|
-
total_tax {
|
|
20
|
-
currency
|
|
21
|
-
value
|
|
22
|
-
}
|
|
23
|
-
total_shipping {
|
|
24
|
-
currency
|
|
25
|
-
value
|
|
26
|
-
}
|
|
27
|
-
discounts {
|
|
28
|
-
amount {
|
|
29
|
-
currency
|
|
30
|
-
value
|
|
31
|
-
}
|
|
32
|
-
label
|
|
33
|
-
}
|
|
34
|
-
}`,H=`
|
|
35
|
-
fragment AddressesList on OrderAddress {
|
|
36
|
-
city
|
|
37
|
-
company
|
|
38
|
-
country_code
|
|
39
|
-
fax
|
|
40
|
-
firstname
|
|
41
|
-
lastname
|
|
42
|
-
middlename
|
|
43
|
-
postcode
|
|
44
|
-
prefix
|
|
45
|
-
region
|
|
46
|
-
region_id
|
|
47
|
-
street
|
|
48
|
-
suffix
|
|
49
|
-
telephone
|
|
50
|
-
vat_id
|
|
51
|
-
}`,k=`
|
|
52
|
-
prices {
|
|
53
|
-
price_including_tax {
|
|
54
|
-
value
|
|
55
|
-
currency
|
|
56
|
-
}
|
|
57
|
-
original_price {
|
|
58
|
-
value
|
|
59
|
-
currency
|
|
60
|
-
}
|
|
61
|
-
original_price_including_tax {
|
|
62
|
-
value
|
|
63
|
-
currency
|
|
64
|
-
}
|
|
65
|
-
price {
|
|
66
|
-
value
|
|
67
|
-
currency
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
`,P=`
|
|
71
|
-
__typename
|
|
72
|
-
status
|
|
73
|
-
product_name
|
|
74
|
-
id
|
|
75
|
-
quantity_ordered
|
|
76
|
-
quantity_shipped
|
|
77
|
-
quantity_canceled
|
|
78
|
-
quantity_invoiced
|
|
79
|
-
quantity_refunded
|
|
80
|
-
quantity_returned
|
|
81
|
-
product_sale_price {
|
|
82
|
-
value
|
|
83
|
-
currency
|
|
84
|
-
}
|
|
85
|
-
selected_options {
|
|
86
|
-
label
|
|
87
|
-
value
|
|
88
|
-
}
|
|
89
|
-
product {
|
|
1
|
+
import{a as F}from"./convertCase.js";const H=`
|
|
2
|
+
fragment ProductDetails on ProductInterface {
|
|
90
3
|
__typename
|
|
91
4
|
canonical_url
|
|
92
5
|
uid
|
|
@@ -108,32 +21,7 @@ fragment AddressesList on OrderAddress {
|
|
|
108
21
|
}
|
|
109
22
|
}
|
|
110
23
|
`,J=`
|
|
111
|
-
|
|
112
|
-
${k}
|
|
113
|
-
}
|
|
114
|
-
`,V=`
|
|
115
|
-
... on DownloadableOrderItem {
|
|
116
|
-
product_name
|
|
117
|
-
downloadable_links {
|
|
118
|
-
sort_order
|
|
119
|
-
title
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
`,X=`
|
|
123
|
-
... on BundleOrderItem {
|
|
124
|
-
${k}
|
|
125
|
-
bundle_options {
|
|
126
|
-
uid
|
|
127
|
-
label
|
|
128
|
-
values {
|
|
129
|
-
uid
|
|
130
|
-
product_name
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
`,Z=`
|
|
135
|
-
... on GiftCardOrderItem {
|
|
136
|
-
${P}
|
|
24
|
+
fragment PriceDetails on OrderItemInterface {
|
|
137
25
|
prices {
|
|
138
26
|
price_including_tax {
|
|
139
27
|
value
|
|
@@ -152,6 +40,10 @@ fragment AddressesList on OrderAddress {
|
|
|
152
40
|
currency
|
|
153
41
|
}
|
|
154
42
|
}
|
|
43
|
+
}
|
|
44
|
+
`,V=`
|
|
45
|
+
fragment GiftCardDetails on GiftCardOrderItem {
|
|
46
|
+
...PriceDetails
|
|
155
47
|
gift_message {
|
|
156
48
|
message
|
|
157
49
|
}
|
|
@@ -163,4 +55,41 @@ fragment AddressesList on OrderAddress {
|
|
|
163
55
|
message
|
|
164
56
|
}
|
|
165
57
|
}
|
|
166
|
-
`,
|
|
58
|
+
`,W=`
|
|
59
|
+
fragment OrderItemDetails on OrderItemInterface {
|
|
60
|
+
__typename
|
|
61
|
+
status
|
|
62
|
+
product_name
|
|
63
|
+
id
|
|
64
|
+
quantity_ordered
|
|
65
|
+
quantity_shipped
|
|
66
|
+
quantity_canceled
|
|
67
|
+
quantity_invoiced
|
|
68
|
+
quantity_refunded
|
|
69
|
+
quantity_returned
|
|
70
|
+
product_sale_price {
|
|
71
|
+
value
|
|
72
|
+
currency
|
|
73
|
+
}
|
|
74
|
+
selected_options {
|
|
75
|
+
label
|
|
76
|
+
value
|
|
77
|
+
}
|
|
78
|
+
product {
|
|
79
|
+
...ProductDetails
|
|
80
|
+
}
|
|
81
|
+
...PriceDetails
|
|
82
|
+
}
|
|
83
|
+
`,X=`
|
|
84
|
+
fragment BundleOrderItemDetails on BundleOrderItem {
|
|
85
|
+
...PriceDetails
|
|
86
|
+
bundle_options {
|
|
87
|
+
uid
|
|
88
|
+
label
|
|
89
|
+
values {
|
|
90
|
+
uid
|
|
91
|
+
product_name
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
`,j=n=>n||0,k=n=>{var a,l,i;return{...n,canonicalUrl:(n==null?void 0:n.canonical_url)||"",id:(n==null?void 0:n.uid)||"",name:(n==null?void 0:n.name)||"",sku:(n==null?void 0:n.sku)||"",image:((a=n==null?void 0:n.image)==null?void 0:a.url)||"",productType:(n==null?void 0:n.__typename)||"",thumbnail:{label:((l=n==null?void 0:n.thumbnail)==null?void 0:l.label)||"",url:((i=n==null?void 0:n.thumbnail)==null?void 0:i.url)||""}}},w=n=>{if(!n||!("selected_options"in n))return;const a={};for(const l of n.selected_options)a[l.label]=l.value;return a},Q=n=>{const a=n==null?void 0:n.map(i=>({uid:i.uid,label:i.label,values:i.values.map(c=>c.product_name).join(", ")})),l={};return a==null||a.forEach(i=>{l[i.label]=i.values}),Object.keys(l).length>0?l:null},U=n=>(n==null?void 0:n.length)>0?{count:n.length,result:n.map(a=>a.title).join(", ")}:null,e=n=>n==null?void 0:n.filter(a=>a.__typename).map(a=>{var l,i,c,u,_,s,p,y,g,f,b,v,O,t,q,h,E,D,T,N,R,C,P,A,x,G,L,S,M,B;return{type:a==null?void 0:a.__typename,productName:a.product_name,quantityCanceled:(a==null?void 0:a.quantity_canceled)||0,quantityInvoiced:(a==null?void 0:a.quantity_invoiced)||0,quantityOrdered:(a==null?void 0:a.quantity_ordered)||0,quantityRefunded:(a==null?void 0:a.quantity_refunded)||0,quantityReturned:(a==null?void 0:a.quantity_returned)||0,quantityShipped:(a==null?void 0:a.quantity_shipped)||0,id:a==null?void 0:a.id,discounted:((u=(c=(i=(l=a==null?void 0:a.product)==null?void 0:l.price_range)==null?void 0:i.maximum_price)==null?void 0:c.regular_price)==null?void 0:u.value)*(a==null?void 0:a.quantity_ordered)!==((_=a==null?void 0:a.product_sale_price)==null?void 0:_.value)*(a==null?void 0:a.quantity_ordered),total:{value:((s=a==null?void 0:a.product_sale_price)==null?void 0:s.value)*(a==null?void 0:a.quantity_ordered)||0,currency:((p=a==null?void 0:a.product_sale_price)==null?void 0:p.currency)||""},totalInclTax:{value:((y=a==null?void 0:a.product_sale_price)==null?void 0:y.value)*(a==null?void 0:a.quantity_ordered)||0,currency:(g=a==null?void 0:a.product_sale_price)==null?void 0:g.currency},price:{value:((f=a==null?void 0:a.product_sale_price)==null?void 0:f.value)||0,currency:(b=a==null?void 0:a.product_sale_price)==null?void 0:b.currency},priceInclTax:{value:((v=a==null?void 0:a.product_sale_price)==null?void 0:v.value)||0,currency:(O=a==null?void 0:a.product_sale_price)==null?void 0:O.currency},totalQuantity:j(a==null?void 0:a.quantity_ordered),regularPrice:{value:(E=(h=(q=(t=a==null?void 0:a.product)==null?void 0:t.price_range)==null?void 0:q.maximum_price)==null?void 0:h.regular_price)==null?void 0:E.value,currency:(R=(N=(T=(D=a==null?void 0:a.product)==null?void 0:D.price_range)==null?void 0:T.maximum_price)==null?void 0:N.regular_price)==null?void 0:R.currency},product:k(a==null?void 0:a.product),thumbnail:{label:((P=(C=a==null?void 0:a.product)==null?void 0:C.thumbnail)==null?void 0:P.label)||"",url:((x=(A=a==null?void 0:a.product)==null?void 0:A.thumbnail)==null?void 0:x.url)||""},giftCard:(a==null?void 0:a.__typename)==="GiftCardOrderItem"?{senderName:((G=a.gift_card)==null?void 0:G.sender_name)||"",senderEmail:((L=a.gift_card)==null?void 0:L.sender_email)||"",recipientEmail:((S=a.gift_card)==null?void 0:S.recipient_email)||"",recipientName:((M=a.gift_card)==null?void 0:M.recipient_name)||"",message:((B=a.gift_card)==null?void 0:B.message)||""}:void 0,configurableOptions:w(a),bundleOptions:a.__typename==="BundleOrderItem"?Q(a.bundle_options):null,itemPrices:a.prices,downloadableLinks:a.__typename==="DownloadableOrderItem"?U(a==null?void 0:a.downloadable_links):null}}),K=n=>{var y,g,f,b,v;const a=e(n.items),{total:l,...i}=F({...n,items:a},"camelCase",{applied_coupons:"coupons",__typename:"__typename",firstname:"firstName",middlename:"middleName",lastname:"lastName",postcode:"postCode",payment_methods:"payments"}),c=(y=n==null?void 0:n.payment_methods)==null?void 0:y[0],u=(c==null?void 0:c.type)||"",_=(c==null?void 0:c.name)||"",s=(g=i==null?void 0:i.items)==null?void 0:g.reduce((O,t)=>O+(t==null?void 0:t.totalQuantity),0);return{...l,...i,totalQuantity:s,shipping:{amount:((f=i==null?void 0:i.total)==null?void 0:f.totalShipping.value)??0,currency:((v=(b=i.total)==null?void 0:b.totalShipping)==null?void 0:v.currency)||"",code:i.shippingMethod??""},payments:[{code:u,name:_}]}},Y=(n,a)=>{var l,i,c,u,_,s,p;if((u=(c=(i=(l=a==null?void 0:a.data)==null?void 0:l.customer)==null?void 0:i.orders)==null?void 0:c.items)!=null&&u.length&&n==="orderData"){const y=(p=(s=(_=a==null?void 0:a.data)==null?void 0:_.customer)==null?void 0:s.orders)==null?void 0:p.items[0];return K(y)}return null};export{X as B,V as G,W as O,H as P,J as a,Y as b,e as c,K as t};
|