@dropins/storefront-order 0.1.0-alpha10 → 0.1.0-alpha11
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/getOrderDetailsById/graphql/orderItemsFragment.graphql.d.ts +5 -1
- package/api/getStoreConfig/graphql/StoreConfigQuery.d.ts +1 -1
- package/api.js +21 -51
- package/chunks/OrderLoaders.js +1 -1
- package/chunks/convertCase.js +1 -0
- package/chunks/fetch-graphql.js +1 -1
- package/chunks/getAttributesForm.js +3 -3
- package/chunks/getCustomer.js +12 -28
- package/chunks/getStoreConfig.js +5 -2
- package/chunks/transform-order-details.js +81 -5
- package/components/OrderCancelReasonsForm/OrderCancelReasonsForm.d.ts +5 -0
- package/components/OrderCancelReasonsForm/index.d.ts +3 -0
- package/components/OrderLoaders/OrderLoaders.d.ts +1 -0
- package/components/OrderProductListContent/CartSummaryItem.d.ts +5 -0
- package/components/OrderProductListContent/OrderProductListContent.d.ts +5 -0
- package/components/OrderProductListContent/index.d.ts +4 -0
- package/components/index.d.ts +2 -1
- package/configs/mock.config.d.ts +468 -0
- package/containers/CustomerDetails.js +1 -1
- package/containers/OrderCancel/OrderCancel.d.ts +5 -0
- package/containers/OrderCancel.d.ts +3 -0
- package/containers/OrderCancel.js +79 -0
- package/containers/OrderProductList/OrderProductList.d.ts +5 -0
- package/containers/OrderProductList/index.d.ts +3 -0
- package/containers/OrderProductList.d.ts +3 -0
- package/containers/OrderProductList.js +1 -0
- package/containers/OrderSearch.js +1 -1
- package/containers/OrderStatus.js +1 -80
- package/containers/ShippingStatus.js +1 -1
- package/containers/index.d.ts +2 -0
- package/data/models/order-details.d.ts +25 -0
- package/data/models/store-config.d.ts +1 -0
- package/data/transforms/transform-order-details.d.ts +9 -0
- package/hooks/containers/useOrderProductList.d.ts +9 -0
- package/hooks/index.d.ts +1 -0
- package/i18n/en_US.json.d.ts +17 -2
- package/lib/setTaxStatus.d.ts +4 -0
- package/package.json +1 -1
- package/render.js +2 -2
- package/types/api/getOrderDetails.types.d.ts +23 -5
- package/types/index.d.ts +1 -0
- package/types/orderCancel.types.d.ts +8 -4
- package/types/orderProductList.types.d.ts +30 -0
- package/components/OrderCancel/OrderCancel.d.ts +0 -5
- /package/chunks/{CustomerDetailsContent.js → OrderCancelReasonsForm.js} +0 -0
- /package/{components → containers}/OrderCancel/index.d.ts +0 -0
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const PRODUCT = "\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 __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 ORDER_ITEM_INTERFACE: string;
|
|
3
|
+
export declare const DOWNLOADABLE_ORDER_ITEM = "\n... on DownloadableOrderItem {\n product_name\n downloadable_links {\n sort_order\n title\n }\n}\n";
|
|
4
|
+
export declare const BUNDLE_ORDER_ITEM: string;
|
|
5
|
+
export declare const GIFT_CARD_ORDER_ITEM: string;
|
|
2
6
|
//# sourceMappingURL=orderItemsFragment.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 }\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 }\n}\n";
|
|
2
2
|
//# sourceMappingURL=StoreConfigQuery.d.ts.map
|
package/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Initializer as
|
|
1
|
+
import{Initializer as O}from"@dropins/tools/lib.js";import{events as i}from"@dropins/tools/event-bus.js";import{f as m,h as _}from"./chunks/fetch-graphql.js";import{g as F,r as L,s as x,a as U,b as Y}from"./chunks/fetch-graphql.js";import{h as c}from"./chunks/network-error.js";import{P as s,G as o,B as u,a as p,D as l,O as h,A as R,b as D}from"./chunks/transform-order-details.js";import{t as $}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 W}from"./chunks/getStoreConfig.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/convertCase.js";const y=`
|
|
2
2
|
query ORDER_BY_NUMBER($orderNumber: String!) {
|
|
3
3
|
customer {
|
|
4
4
|
orders(
|
|
@@ -35,16 +35,8 @@ query ORDER_BY_NUMBER($orderNumber: String!) {
|
|
|
35
35
|
product_sku
|
|
36
36
|
product_name
|
|
37
37
|
order_item {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
gift_card {
|
|
41
|
-
recipient_name
|
|
42
|
-
recipient_email
|
|
43
|
-
sender_name
|
|
44
|
-
sender_email
|
|
45
|
-
message
|
|
46
|
-
}
|
|
47
|
-
}
|
|
38
|
+
${s}
|
|
39
|
+
${o}
|
|
48
40
|
}
|
|
49
41
|
}
|
|
50
42
|
}
|
|
@@ -59,17 +51,11 @@ query ORDER_BY_NUMBER($orderNumber: String!) {
|
|
|
59
51
|
...AddressesList
|
|
60
52
|
}
|
|
61
53
|
items {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
recipient_email
|
|
68
|
-
sender_name
|
|
69
|
-
sender_email
|
|
70
|
-
message
|
|
71
|
-
}
|
|
72
|
-
}
|
|
54
|
+
${s}
|
|
55
|
+
${u}
|
|
56
|
+
${o}
|
|
57
|
+
${p}
|
|
58
|
+
${l}
|
|
73
59
|
}
|
|
74
60
|
total {
|
|
75
61
|
...OrderSummary
|
|
@@ -78,10 +64,9 @@ query ORDER_BY_NUMBER($orderNumber: String!) {
|
|
|
78
64
|
}
|
|
79
65
|
}
|
|
80
66
|
}
|
|
81
|
-
${
|
|
82
|
-
${
|
|
83
|
-
|
|
84
|
-
`,f=async(e,r)=>await n(g,{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),y=`
|
|
67
|
+
${h}
|
|
68
|
+
${R}
|
|
69
|
+
`,b=async(e,r)=>await m(y,{method:"GET",cache:"force-cache",variables:{orderNumber:e}}).then(t=>{var a;return(a=t.errors)!=null&&a.length?_(t.errors):D(r??"orderData",t)}).catch(c),g=`
|
|
85
70
|
query ORDER_BY_TOKEN($token: String!) {
|
|
86
71
|
guestOrderByToken(input: { token: $token }) {
|
|
87
72
|
email
|
|
@@ -120,16 +105,8 @@ query ORDER_BY_TOKEN($token: String!) {
|
|
|
120
105
|
product_sku
|
|
121
106
|
product_name
|
|
122
107
|
order_item {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
gift_card {
|
|
126
|
-
recipient_name
|
|
127
|
-
recipient_email
|
|
128
|
-
sender_name
|
|
129
|
-
sender_email
|
|
130
|
-
message
|
|
131
|
-
}
|
|
132
|
-
}
|
|
108
|
+
${s}
|
|
109
|
+
${o}
|
|
133
110
|
}
|
|
134
111
|
}
|
|
135
112
|
}
|
|
@@ -144,24 +121,17 @@ query ORDER_BY_TOKEN($token: String!) {
|
|
|
144
121
|
...AddressesList
|
|
145
122
|
}
|
|
146
123
|
items {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
recipient_email
|
|
153
|
-
sender_name
|
|
154
|
-
sender_email
|
|
155
|
-
message
|
|
156
|
-
}
|
|
157
|
-
}
|
|
124
|
+
${s}
|
|
125
|
+
${u}
|
|
126
|
+
${o}
|
|
127
|
+
${p}
|
|
128
|
+
${l}
|
|
158
129
|
}
|
|
159
130
|
total {
|
|
160
131
|
...OrderSummary
|
|
161
132
|
}
|
|
162
133
|
}
|
|
163
134
|
}
|
|
164
|
-
${
|
|
165
|
-
${
|
|
166
|
-
|
|
167
|
-
`,R=async e=>await n(y,{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;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 i=t?await R(r):await f(r);i?s.emit("order/data",i):s.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},l=new u({init:async e=>{const r={};l.config.setConfig({...r,...e}),b(e).catch(console.error)},listeners:()=>[]}),B=l.config;export{B as config,n as fetchGraphQl,Q as getAttributesForm,S as getConfig,M as getCustomer,Y as getGuestOrder,f as getOrderDetailsById,z as getStoreConfig,R as guestOrderByToken,l as initialize,w as removeFetchGraphQlHeader,A as setEndpoint,N as setFetchGraphQlHeader,x as setFetchGraphQlHeaders};
|
|
135
|
+
${h}
|
|
136
|
+
${R}
|
|
137
|
+
`,T=async e=>await m(g,{method:"GET",cache:"no-cache",variables:{token:e}}).then(r=>{var t;return(t=r.errors)!=null&&t.length?_(r.errors):$(r)}).catch(c),f=async e=>{var n;const r=(e==null?void 0:e.orderRef)??"",t=r&&typeof(e==null?void 0:e.orderRef)=="string"&&((n=e==null?void 0:e.orderRef)==null?void 0:n.length)>20,a=(e==null?void 0:e.orderData)??null;if(a){i.emit("order/data",a);return}if(!r){console.error("Order Token or number not received.");return}const d=t?await T(r):await b(r);d?i.emit("order/data",d):i.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},E=new O({init:async e=>{const r={};E.config.setConfig({...r,...e}),f(e).catch(console.error)},listeners:()=>[]}),I=E.config;export{I as config,m as fetchGraphQl,K as getAttributesForm,F as getConfig,q as getCustomer,z as getGuestOrder,b as getOrderDetailsById,W as getStoreConfig,T as guestOrderByToken,E as initialize,L 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 i}from"@dropins/tools/preact-jsx-runtime.js";import{Card as s,Skeleton as d,SkeletonRow as r,CartItemSkeleton as t}from"@dropins/tools/components.js";import"./OrderCancelReasonsForm.js";import{classes as o}from"@dropins/tools/lib.js";const g=({testId:a,withCard:n=!0})=>{const l=i(d,{"data-testid":a??"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 n?l:e(s,{variant:"secondary",className:o(["order-order-loaders","order-order-loaders--card-loader"]),children:l})},f=a=>e(s,{variant:"secondary",...a,children:i(d,{"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"})]})}),z=()=>i(d,{"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,{})]});export{g as C,f as D,z as O};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const b=s=>s.replace(/_([a-z])/g,(o,e)=>e.toUpperCase()),c=(s,o,e)=>{const u=["string","boolean","number"],p=b;return Array.isArray(s)?s.map(r=>u.includes(typeof r)||r===null?r:typeof r=="object"?c(r,o,e):r):s!==null&&typeof s=="object"?Object.entries(s).reduce((r,[t,n])=>{const f=e&&e[t]?e[t]:p(t);return r[f]=u.includes(typeof n)||n===null?n:c(n,o,e),r},{}):s};export{c as a,b as c};
|
package/chunks/fetch-graphql.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FetchGraphQL as
|
|
1
|
+
import{FetchGraphQL as s}from"@dropins/tools/fetch-graphql.js";const h=e=>{const r=e.map(a=>a.message).join(" ");throw Error(r)},{setEndpoint:o,setFetchGraphQlHeader:c,removeFetchGraphQlHeader:n,setFetchGraphQlHeaders:p,fetchGraphQl:d,getConfig:g}=new s().getMethods();export{c as a,p as b,d as f,g,h,n as r,o as s};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as l}from"./network-error.js";import{
|
|
1
|
+
import{h as l}from"./network-error.js";import{f as m,h as _}from"./fetch-graphql.js";import{c as f,a as T}from"./convertCase.js";const b=o=>{let e=[];for(const t of o)if(!(t.frontend_input!=="MULTILINE"||t.multiline_count<2))for(let i=2;i<=t.multiline_count;i++){const a={...t,name:`${t.code}_${i}`,code:`${t.code}_${i}`,id:`${t.code}_${i}`};e.push(a)}return e},h=o=>{var u,c,d;const e=((c=(u=o==null?void 0:o.data)==null?void 0:u.attributesForm)==null?void 0:c.items)||[];if(!e.length)return[];const t=(d=e.filter(r=>{var n;return!((n=r.frontend_input)!=null&&n.includes("HIDDEN"))}))==null?void 0:d.map(({code:r,...n})=>{const s=r!=="country_id"?r:"country_code";return{...n,name:s,id:s,code:s}}),i=b(t);return t.concat(i).map(r=>{const n=f(r.code);return T({...r,customUpperCode:n},"camelCase",{frontend_input:"fieldType",frontend_class:"className",is_required:"required",sort_order:"orderNumber"})}).sort((r,n)=>r.orderNumber-n.orderNumber)},E=`
|
|
2
2
|
query GET_ATTRIBUTES_FORM($formCode: String!) {
|
|
3
3
|
attributesForm(formCode: $formCode) {
|
|
4
4
|
items {
|
|
@@ -30,7 +30,7 @@ import{h as l}from"./network-error.js";import{c as m,d as _,f,h as T}from"./fetc
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
`,
|
|
33
|
+
`,p=`
|
|
34
34
|
query GET_ATTRIBUTES_FORM_SHORT {
|
|
35
35
|
attributesForm(formCode: customer_register_address) {
|
|
36
36
|
items {
|
|
@@ -44,4 +44,4 @@ import{h as l}from"./network-error.js";import{c as m,d as _,f,h as T}from"./fetc
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
`,
|
|
47
|
+
`,R=async o=>await m(o!=="shortRequest"?E:p,{method:"GET",cache:"force-cache",variables:{formCode:o}}).then(e=>{var t;return(t=e.errors)!=null&&t.length?_(e.errors):h(e)}).catch(l);export{R as g};
|
package/chunks/getCustomer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as n}from"./network-error.js";import{f as
|
|
1
|
+
import{h as n}from"./network-error.js";import{f as _,h as E}from"./fetch-graphql.js";import{t as l,P as u,G as c,B as O,a as h,O as o,A as g}from"./transform-order-details.js";const R=t=>{var r,e;if(!((r=t==null?void 0:t.data)!=null&&r.guestOrder))return null;const a=(e=t==null?void 0:t.data)==null?void 0:e.guestOrder;return l(a)},S=t=>{var r,e;if(!((r=t==null?void 0:t.data)!=null&&r.guestOrderByToken))return null;const a=(e=t==null?void 0:t.data)==null?void 0:e.guestOrderByToken;return l(a)},T=t=>{var a,r,e,d,i,m;return{email:((r=(a=t==null?void 0:t.data)==null?void 0:a.customer)==null?void 0:r.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)||""}},f=`
|
|
2
2
|
fragment guestOrderData on CustomerOrder {
|
|
3
3
|
email
|
|
4
4
|
id
|
|
@@ -36,16 +36,8 @@ import{h as n}from"./network-error.js";import{f as c,h as u}from"./fetch-graphql
|
|
|
36
36
|
product_sku
|
|
37
37
|
product_name
|
|
38
38
|
order_item {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
gift_card {
|
|
42
|
-
recipient_name
|
|
43
|
-
recipient_email
|
|
44
|
-
sender_name
|
|
45
|
-
sender_email
|
|
46
|
-
message
|
|
47
|
-
}
|
|
48
|
-
}
|
|
39
|
+
${u}
|
|
40
|
+
${c}
|
|
49
41
|
}
|
|
50
42
|
}
|
|
51
43
|
}
|
|
@@ -60,33 +52,25 @@ import{h as n}from"./network-error.js";import{f as c,h as u}from"./fetch-graphql
|
|
|
60
52
|
...AddressesList
|
|
61
53
|
}
|
|
62
54
|
items {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
recipient_name
|
|
68
|
-
recipient_email
|
|
69
|
-
sender_name
|
|
70
|
-
sender_email
|
|
71
|
-
message
|
|
72
|
-
}
|
|
73
|
-
}
|
|
55
|
+
${u}
|
|
56
|
+
${O}
|
|
57
|
+
${c}
|
|
58
|
+
${h}
|
|
74
59
|
}
|
|
75
60
|
total {
|
|
76
61
|
...OrderSummary
|
|
77
62
|
}
|
|
78
63
|
}
|
|
79
|
-
${l}
|
|
80
|
-
${O}
|
|
81
64
|
${o}
|
|
82
|
-
|
|
65
|
+
${g}
|
|
66
|
+
`,s=`
|
|
83
67
|
query GET_GUEST_ORDER($input: OrderInformationInput!) {
|
|
84
68
|
guestOrder(input:$input) {
|
|
85
69
|
...guestOrderData
|
|
86
70
|
}
|
|
87
71
|
}
|
|
88
|
-
${
|
|
89
|
-
`,
|
|
72
|
+
${f}
|
|
73
|
+
`,k=async t=>await _(s,{method:"GET",cache:"no-cache",variables:{input:t}}).then(a=>{var r;return(r=a.errors)!=null&&r.length?E(a.errors):R(a)}).catch(n),G=`
|
|
90
74
|
query GET_CUSTOMER {
|
|
91
75
|
customer {
|
|
92
76
|
firstname
|
|
@@ -94,4 +78,4 @@ ${s}
|
|
|
94
78
|
email
|
|
95
79
|
}
|
|
96
80
|
}
|
|
97
|
-
`,
|
|
81
|
+
`,A=async()=>await _(G,{method:"GET",cache:"force-cache"}).then(t=>{var a;return(a=t.errors)!=null&&a.length?E(t.errors):T(t)}).catch(n);export{k as a,A as g,S as t};
|
package/chunks/getStoreConfig.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import{f as
|
|
1
|
+
import{f as n,h as o}from"./fetch-graphql.js";function a(r){return r?{orderCancellationEnabled:r.order_cancellation_enabled,orderCancellationReasons:r.order_cancellation_reasons,shoppingCartDisplayPrice:r.shopping_cart_display_price}:null}const i=`
|
|
2
2
|
query STORE_CONFIG_QUERY {
|
|
3
3
|
storeConfig {
|
|
4
4
|
order_cancellation_enabled
|
|
5
5
|
order_cancellation_reasons {
|
|
6
6
|
description
|
|
7
7
|
}
|
|
8
|
+
shopping_cart_display_price
|
|
9
|
+
shopping_cart_display_shipping
|
|
10
|
+
shopping_cart_display_subtotal
|
|
8
11
|
}
|
|
9
12
|
}
|
|
10
|
-
`,
|
|
13
|
+
`,c=async()=>n(i,{method:"GET",cache:"force-cache"}).then(({errors:r,data:e})=>r?o(r):a(e.storeConfig));export{c as g};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as G}from"./convertCase.js";const z=`
|
|
2
2
|
fragment OrderSummary on OrderTotal {
|
|
3
3
|
grand_total {
|
|
4
4
|
value
|
|
@@ -31,7 +31,7 @@ fragment OrderSummary on OrderTotal {
|
|
|
31
31
|
}
|
|
32
32
|
label
|
|
33
33
|
}
|
|
34
|
-
}`,
|
|
34
|
+
}`,H=`
|
|
35
35
|
fragment AddressesList on OrderAddress {
|
|
36
36
|
city
|
|
37
37
|
company
|
|
@@ -48,8 +48,26 @@ fragment AddressesList on OrderAddress {
|
|
|
48
48
|
suffix
|
|
49
49
|
telephone
|
|
50
50
|
vat_id
|
|
51
|
-
}`,
|
|
52
|
-
|
|
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=`
|
|
53
71
|
__typename
|
|
54
72
|
status
|
|
55
73
|
product_name
|
|
@@ -74,6 +92,8 @@ fragment OrderItems on OrderItem {
|
|
|
74
92
|
uid
|
|
75
93
|
name
|
|
76
94
|
sku
|
|
95
|
+
only_x_left_in_stock
|
|
96
|
+
stock_status
|
|
77
97
|
thumbnail {
|
|
78
98
|
label
|
|
79
99
|
url
|
|
@@ -87,4 +107,60 @@ fragment OrderItems on OrderItem {
|
|
|
87
107
|
}
|
|
88
108
|
}
|
|
89
109
|
}
|
|
90
|
-
|
|
110
|
+
`,J=`
|
|
111
|
+
... on OrderItemInterface {
|
|
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}
|
|
137
|
+
prices {
|
|
138
|
+
price_including_tax {
|
|
139
|
+
value
|
|
140
|
+
currency
|
|
141
|
+
}
|
|
142
|
+
original_price {
|
|
143
|
+
value
|
|
144
|
+
currency
|
|
145
|
+
}
|
|
146
|
+
original_price_including_tax {
|
|
147
|
+
value
|
|
148
|
+
currency
|
|
149
|
+
}
|
|
150
|
+
price {
|
|
151
|
+
value
|
|
152
|
+
currency
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
gift_message {
|
|
156
|
+
message
|
|
157
|
+
}
|
|
158
|
+
gift_card {
|
|
159
|
+
recipient_name
|
|
160
|
+
recipient_email
|
|
161
|
+
sender_name
|
|
162
|
+
sender_email
|
|
163
|
+
message
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
`,U=n=>n||0,j=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)||""}}},F=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},$=n=>(n==null?void 0:n.length)>0?{count:n.length,result:n.map(a=>a.title).join(", ")}:null,K=n=>n==null?void 0:n.filter(a=>a.__typename).map(a=>{var l,i,c,u,_,s,t,y,p,g,f,v,e,b,O,h,q,x,E,R,C,D,N,T,A,S,B,L,M,w;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:((t=a==null?void 0:a.product_sale_price)==null?void 0:t.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:(p=a==null?void 0:a.product_sale_price)==null?void 0:p.currency},price:{value:((g=a==null?void 0:a.product_sale_price)==null?void 0:g.value)||0,currency:(f=a==null?void 0:a.product_sale_price)==null?void 0:f.currency},priceInclTax:{value:((v=a==null?void 0:a.product_sale_price)==null?void 0:v.value)||0,currency:(e=a==null?void 0:a.product_sale_price)==null?void 0:e.currency},totalQuantity:U(a==null?void 0:a.quantity_ordered),regularPrice:{value:(q=(h=(O=(b=a==null?void 0:a.product)==null?void 0:b.price_range)==null?void 0:O.maximum_price)==null?void 0:h.regular_price)==null?void 0:q.value,currency:(C=(R=(E=(x=a==null?void 0:a.product)==null?void 0:x.price_range)==null?void 0:E.maximum_price)==null?void 0:R.regular_price)==null?void 0:C.currency},product:j(a==null?void 0:a.product),thumbnail:{label:((N=(D=a==null?void 0:a.product)==null?void 0:D.thumbnail)==null?void 0:N.label)||"",url:((A=(T=a==null?void 0:a.product)==null?void 0:T.thumbnail)==null?void 0:A.url)||""},giftCard:(a==null?void 0:a.__typename)==="GiftCardOrderItem"?{senderName:((S=a.gift_card)==null?void 0:S.sender_name)||"",senderEmail:((B=a.gift_card)==null?void 0:B.sender_email)||"",recipientEmail:((L=a.gift_card)==null?void 0:L.recipient_email)||"",recipientName:((M=a.gift_card)==null?void 0:M.recipient_name)||"",message:((w=a.gift_card)==null?void 0:w.message)||""}:void 0,configurableOptions:F(a),bundleOptions:a.__typename==="BundleOrderItem"?Q(a.bundle_options):null,itemPrices:a.prices,downloadableLinks:a.__typename==="DownloadableOrderItem"?$(a==null?void 0:a.downloadable_links):null}}),W=n=>{var y,p,g,f,v;const a=K(n.items),{total:l,...i}=G({...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=(p=i==null?void 0:i.items)==null?void 0:p.reduce((e,b)=>e+b.totalQuantity,0);return{...l,...i,totalQuantity:s,shipping:{amount:((g=i==null?void 0:i.total)==null?void 0:g.totalShipping.value)??0,currency:((v=(f=i.total)==null?void 0:f.totalShipping)==null?void 0:v.currency)||"",code:i.shippingMethod??""},payments:[{code:u,name:_}]}},o=(n,a)=>{var l,i,c,u,_,s,t;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=(t=(s=(_=a==null?void 0:a.data)==null?void 0:_.customer)==null?void 0:s.orders)==null?void 0:t.items[0];return W(y)}return null};export{H as A,X as B,V as D,Z as G,z as O,P,J as a,o as b,W as t};
|
|
@@ -4,4 +4,5 @@ export declare const CardLoader: ({ testId, withCard, }: {
|
|
|
4
4
|
withCard?: boolean | undefined;
|
|
5
5
|
}) => import("preact").JSX.Element;
|
|
6
6
|
export declare const DetailsSkeleton: (props: any) => import("preact").JSX.Element;
|
|
7
|
+
export declare const OrderProductListSkeleton: () => import("preact").JSX.Element;
|
|
7
8
|
//# sourceMappingURL=OrderLoaders.d.ts.map
|
package/components/index.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ export * from './ShippingStatusCard';
|
|
|
5
5
|
export * from './OrderLoaders';
|
|
6
6
|
export * from './OrderActions';
|
|
7
7
|
export * from './CustomerDetailsContent';
|
|
8
|
-
export * from './
|
|
8
|
+
export * from './OrderProductListContent';
|
|
9
|
+
export * from './OrderCancelReasonsForm';
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|