@dropins/storefront-order 0.1.0-alpha10 → 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.
Files changed (80) hide show
  1. package/api/getCustomerOrdersReturn/getCustomerOrdersReturn.d.ts +4 -0
  2. package/api/getCustomerOrdersReturn/graphql/getCustomerOrdersReturn.graphql.d.ts +2 -0
  3. package/api/getCustomerOrdersReturn/index.d.ts +2 -0
  4. package/api/getOrderDetailsById/graphql/orderItemsFragment.graphql.d.ts +5 -1
  5. package/api/getOrderDetailsById/graphql/orderSummaryFragment.graphql.d.ts +1 -1
  6. package/api/getStoreConfig/graphql/StoreConfigQuery.d.ts +1 -1
  7. package/api/index.d.ts +1 -0
  8. package/api.js +70 -56
  9. package/chunks/OrderLoaders.js +1 -1
  10. package/chunks/convertCase.js +1 -0
  11. package/chunks/customerAddressFragment.graphql.js +55 -0
  12. package/chunks/fetch-graphql.js +1 -1
  13. package/chunks/getAttributesForm.js +3 -3
  14. package/chunks/getCustomer.js +34 -27
  15. package/chunks/getCustomerOrdersReturn.js +52 -0
  16. package/chunks/getStoreConfig.js +9 -2
  17. package/chunks/setTaxStatus.js +1 -0
  18. package/chunks/transform-order-details.js +77 -72
  19. package/components/EmptyList/EmptyList.d.ts +5 -0
  20. package/components/EmptyList/index.d.ts +3 -0
  21. package/components/OrderCancelReasonsForm/OrderCancelReasonsForm.d.ts +5 -0
  22. package/components/OrderCancelReasonsForm/index.d.ts +3 -0
  23. package/components/OrderCostSummaryContent/Blocks.d.ts +38 -0
  24. package/components/OrderCostSummaryContent/OrderCostSummaryContent.d.ts +5 -0
  25. package/components/OrderCostSummaryContent/index.d.ts +3 -0
  26. package/components/OrderLoaders/OrderLoaders.d.ts +2 -0
  27. package/components/OrderProductListContent/CartSummaryItem.d.ts +5 -0
  28. package/components/OrderProductListContent/OrderProductListContent.d.ts +5 -0
  29. package/components/OrderProductListContent/index.d.ts +4 -0
  30. package/components/ReturnsListContent/ReturnsListContent.d.ts +5 -0
  31. package/components/ReturnsListContent/index.d.ts +3 -0
  32. package/components/index.d.ts +5 -1
  33. package/configs/mock.config.d.ts +786 -0
  34. package/containers/CustomerDetails.js +1 -1
  35. package/containers/OrderCancel/OrderCancel.d.ts +5 -0
  36. package/containers/OrderCancel.d.ts +3 -0
  37. package/containers/OrderCancel.js +87 -0
  38. package/containers/OrderCostSummary/OrderCostSummary.d.ts +5 -0
  39. package/containers/OrderCostSummary/index.d.ts +3 -0
  40. package/containers/OrderCostSummary.d.ts +3 -0
  41. package/containers/OrderCostSummary.js +1 -0
  42. package/containers/OrderProductList/OrderProductList.d.ts +5 -0
  43. package/containers/OrderProductList/index.d.ts +3 -0
  44. package/containers/OrderProductList.d.ts +3 -0
  45. package/containers/OrderProductList.js +1 -0
  46. package/containers/OrderSearch.js +1 -1
  47. package/containers/OrderStatus.js +1 -80
  48. package/containers/ReturnsList/ReturnsList.d.ts +5 -0
  49. package/containers/ReturnsList/index.d.ts +3 -0
  50. package/containers/ReturnsList.d.ts +3 -0
  51. package/containers/ReturnsList.js +1 -0
  52. package/containers/ShippingStatus.js +1 -1
  53. package/containers/index.d.ts +4 -0
  54. package/data/models/customer-orders-return.d.ts +36 -0
  55. package/data/models/index.d.ts +2 -0
  56. package/data/models/order-details.d.ts +44 -8
  57. package/data/models/store-config.d.ts +7 -0
  58. package/data/transforms/index.d.ts +2 -0
  59. package/data/transforms/transform-customer-orders-return.d.ts +5 -0
  60. package/data/transforms/transform-order-details.d.ts +11 -1
  61. package/hooks/containers/useOrderCostSummary.d.ts +9 -0
  62. package/hooks/containers/useOrderProductList.d.ts +9 -0
  63. package/hooks/containers/useReturnsList.d.ts +14 -0
  64. package/hooks/index.d.ts +4 -0
  65. package/hooks/useIsMobile.d.ts +2 -0
  66. package/i18n/en_US.json.d.ts +67 -4
  67. package/lib/setTaxStatus.d.ts +4 -0
  68. package/package.json +1 -1
  69. package/render.js +2 -2
  70. package/types/api/getCustomerOrdersReturn.types.d.ts +46 -0
  71. package/types/api/getOrderDetails.types.d.ts +24 -5
  72. package/types/emptyList.types.d.ts +7 -0
  73. package/types/index.d.ts +5 -0
  74. package/types/orderCancel.types.d.ts +8 -4
  75. package/types/orderCostSummary.types.d.ts +28 -0
  76. package/types/orderProductList.types.d.ts +30 -0
  77. package/types/returnsList.types.d.ts +42 -0
  78. package/components/OrderCancel/OrderCancel.d.ts +0 -5
  79. /package/chunks/{CustomerDetailsContent.js → OrderCancelReasonsForm.js} +0 -0
  80. /package/{components → containers}/OrderCancel/index.d.ts +0 -0
@@ -0,0 +1,4 @@
1
+ import { CustomerOrdersReturnModel } from '../../data/models';
2
+
3
+ export declare const getCustomerOrdersReturn: () => Promise<CustomerOrdersReturnModel | null>;
4
+ //# sourceMappingURL=getCustomerOrdersReturn.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const GET_CUSTOMER_ORDERS_RETURN: string;
2
+ //# sourceMappingURL=getCustomerOrdersReturn.graphql.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from './getCustomerOrdersReturn';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,6 @@
1
- export declare const ORDER_ITEMS = "\nfragment OrderItems on OrderItem {\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 thumbnail {\n label\n url\n }\n price_range {\n maximum_price {\n regular_price {\n currency\n value\n }\n }\n }\n }\n}";
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";
2
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 }\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
@@ -6,4 +6,5 @@ export * from './guestOrderByToken';
6
6
  export * from './getAttributesForm';
7
7
  export * from './getCustomer';
8
8
  export * from './getStoreConfig';
9
+ export * from './getCustomerOrdersReturn';
9
10
  //# sourceMappingURL=index.d.ts.map
package/api.js CHANGED
@@ -1,8 +1,8 @@
1
- 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}from"./chunks/fetch-graphql.js";import{g as S,r as w,s as A,a as N,b as x}from"./chunks/fetch-graphql.js";import{h as o}from"./chunks/network-error.js";import{O as _,a as c,A as p,b as h}from"./chunks/transform-order-details.js";import{t as O}from"./chunks/getCustomer.js";import{g as M,a as Y}from"./chunks/getCustomer.js";import{g as Q}from"./chunks/getAttributesForm.js";import{g as z}from"./chunks/getStoreConfig.js";import"@dropins/tools/fetch-graphql.js";const g=`
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
- customer {
3
+ customer {
4
4
  orders(
5
- filter: {number: {eq: $orderNumber}},
5
+ filter: { number: { eq: $orderNumber } }
6
6
  ) {
7
7
  items {
8
8
  email
@@ -19,69 +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
- product_sku
36
- product_name
37
- order_item {
38
- ...OrderItems
39
- ... on GiftCardOrderItem {
40
- gift_card {
41
- recipient_name
42
- recipient_email
43
- sender_name
44
- sender_email
45
- message
23
+ number
24
+ tracking {
25
+ title
26
+ number
27
+ carrier
28
+ }
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
+ }
46
44
  }
47
45
  }
48
46
  }
49
- }
50
- }
47
+ }
51
48
  payment_methods {
52
49
  name
53
50
  type
54
51
  }
55
52
  shipping_address {
56
- ...AddressesList
53
+ ...AddressesList
57
54
  }
58
55
  billing_address {
59
- ...AddressesList
56
+ ...AddressesList
60
57
  }
61
58
  items {
62
- ...OrderItems
59
+ ...OrderItemDetails
60
+ ... on BundleOrderItem {
61
+ ...BundleOrderItemDetails
62
+ }
63
63
  ... on GiftCardOrderItem {
64
- __typename
65
- gift_card {
66
- recipient_name
67
- recipient_email
68
- sender_name
69
- sender_email
70
- message
64
+ ...GiftCardDetails
65
+ product {
66
+ ...ProductDetails
67
+ }
68
+ }
69
+ ... on DownloadableOrderItem {
70
+ product_name
71
+ downloadable_links {
72
+ sort_order
73
+ title
71
74
  }
72
75
  }
73
76
  }
74
77
  total {
75
- ...OrderSummary
78
+ ...OrderSummary
76
79
  }
77
80
  }
78
81
  }
79
82
  }
80
83
  }
84
+ ${l}
85
+ ${u}
81
86
  ${_}
82
87
  ${c}
83
88
  ${p}
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=`
89
+ ${h}
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=`
85
92
  query ORDER_BY_TOKEN($token: String!) {
86
93
  guestOrderByToken(input: { token: $token }) {
87
94
  email
@@ -120,14 +127,11 @@ query ORDER_BY_TOKEN($token: String!) {
120
127
  product_sku
121
128
  product_name
122
129
  order_item {
123
- ...OrderItems
130
+ ...OrderItemDetails
124
131
  ... on GiftCardOrderItem {
125
- gift_card {
126
- recipient_name
127
- recipient_email
128
- sender_name
129
- sender_email
130
- message
132
+ ...GiftCardDetails
133
+ product {
134
+ ...ProductDetails
131
135
  }
132
136
  }
133
137
  }
@@ -144,15 +148,21 @@ query ORDER_BY_TOKEN($token: String!) {
144
148
  ...AddressesList
145
149
  }
146
150
  items {
147
- ...OrderItems
151
+ ...OrderItemDetails
152
+ ... on BundleOrderItem {
153
+ ...BundleOrderItemDetails
154
+ }
148
155
  ... on GiftCardOrderItem {
149
- __typename
150
- gift_card {
151
- recipient_name
152
- recipient_email
153
- sender_name
154
- sender_email
155
- message
156
+ ...GiftCardDetails
157
+ product {
158
+ ...ProductDetails
159
+ }
160
+ }
161
+ ... on DownloadableOrderItem {
162
+ product_name
163
+ downloadable_links {
164
+ sort_order
165
+ title
156
166
  }
157
167
  }
158
168
  }
@@ -161,7 +171,11 @@ query ORDER_BY_TOKEN($token: String!) {
161
171
  }
162
172
  }
163
173
  }
174
+ ${l}
175
+ ${u}
164
176
  ${_}
165
177
  ${c}
166
178
  ${p}
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};
179
+ ${h}
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};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"@dropins/tools/preact-jsx-runtime.js";import{Card as l,Skeleton as s,SkeletonRow as r}from"@dropins/tools/components.js";import"./CustomerDetailsContent.js";import{classes as n}from"@dropins/tools/lib.js";const h=({testId:a,withCard:d=!0})=>{const i=t(s,{"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 d?i:e(l,{variant:"secondary",className:n(["order-order-loaders","order-order-loaders--card-loader"]),children:i})},g=a=>e(l,{variant:"secondary",...a,children:t(s,{"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"})]})});export{h as C,g as D};
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 @@
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};
@@ -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};
@@ -1 +1 @@
1
- import{FetchGraphQL as f}from"@dropins/tools/fetch-graphql.js";const g=r=>{const t=r.map(e=>e.message).join(" ");throw Error(t)},u=r=>r.replace(/_([a-z])/g,(t,e)=>e.toUpperCase()),p=(r,t,e)=>{const c=["string","boolean","number"],a=u;return Array.isArray(r)?r.map(s=>c.includes(typeof s)||s===null?s:typeof s=="object"?p(s,t,e):s):r!==null&&typeof r=="object"?Object.entries(r).reduce((s,[n,o])=>{const h=e&&e[n]?e[n]:a(n);return s[h]=c.includes(typeof o)||o===null?o:p(o,t,e),s},{}):r},{setEndpoint:b,setFetchGraphQlHeader:i,removeFetchGraphQlHeader:C,setFetchGraphQlHeaders:F,fetchGraphQl:G,getConfig:Q}=new f().getMethods();export{i as a,F as b,u as c,p as d,G as f,Q as g,g as h,C as r,b as s};
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{c as m,d as _,f,h as T}from"./fetch-graphql.js";const b=o=>{let e=[];for(const t of o)if(!(t.frontend_input!=="MULTILINE"||t.multiline_count<2))for(let s=2;s<=t.multiline_count;s++){const a={...t,name:`${t.code}_${s}`,code:`${t.code}_${s}`,id:`${t.code}_${s}`};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 i=r!=="country_id"?r:"country_code";return{...n,name:i,id:i,code:i}}),s=b(t);return t.concat(s).map(r=>{const n=m(r.code);return _({...r,customUpperCode:n},"camelCase",{frontend_input:"fieldType",frontend_class:"className",is_required:"required",sort_order:"orderNumber"})}).sort((r,n)=>r.orderNumber-n.orderNumber)},E=`
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
- `,C=`
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
- `,I=async o=>await f(o!=="shortRequest"?E:C,{method:"GET",cache:"force-cache",variables:{formCode:o}}).then(e=>{var t;return(t=e.errors)!=null&&t.length?T(e.errors):h(e)}).catch(l);export{I as g};
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};
@@ -1,4 +1,4 @@
1
- import{h as n}from"./network-error.js";import{f as c,h as u}from"./fetch-graphql.js";import{t as _,O as l,A as O,a as o}from"./transform-order-details.js";const g=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)},y=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)},h=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)||""}},s=`
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,19 +31,16 @@ import{h as n}from"./network-error.js";import{f as c,h as u}from"./fetch-graphql
31
31
  message
32
32
  timestamp
33
33
  }
34
- items {
35
- id
36
- product_sku
37
- product_name
38
- order_item {
39
- ...OrderItems
40
- ... on GiftCardOrderItem {
41
- gift_card {
42
- recipient_name
43
- recipient_email
44
- sender_name
45
- sender_email
46
- message
34
+ items {
35
+ id
36
+ product_sku
37
+ product_name
38
+ order_item {
39
+ ...OrderItemDetails
40
+ ... on GiftCardOrderItem {
41
+ ...GiftCardDetails
42
+ product {
43
+ ...ProductDetails
47
44
  }
48
45
  }
49
46
  }
@@ -60,15 +57,21 @@ import{h as n}from"./network-error.js";import{f as c,h as u}from"./fetch-graphql
60
57
  ...AddressesList
61
58
  }
62
59
  items {
63
- ...OrderItems
60
+ ...OrderItemDetails
61
+ ... on BundleOrderItem {
62
+ ...BundleOrderItemDetails
63
+ }
64
64
  ... on GiftCardOrderItem {
65
- __typename
66
- gift_card {
67
- recipient_name
68
- recipient_email
69
- sender_name
70
- sender_email
71
- message
65
+ ...GiftCardDetails
66
+ product {
67
+ ...ProductDetails
68
+ }
69
+ }
70
+ ... on DownloadableOrderItem {
71
+ product_name
72
+ downloadable_links {
73
+ sort_order
74
+ title
72
75
  }
73
76
  }
74
77
  }
@@ -77,16 +80,20 @@ import{h as n}from"./network-error.js";import{f as c,h as u}from"./fetch-graphql
77
80
  }
78
81
  }
79
82
  ${l}
80
- ${O}
81
83
  ${o}
82
- `,f=`
84
+ ${E}
85
+ ${O}
86
+ ${T}
87
+ ${s}
88
+ ${D}
89
+ `,R=`
83
90
  query GET_GUEST_ORDER($input: OrderInformationInput!) {
84
91
  guestOrder(input:$input) {
85
92
  ...guestOrderData
86
93
  }
87
94
  }
88
- ${s}
89
- `,D=async t=>await c(f,{method:"GET",cache:"no-cache",variables:{input:t}}).then(r=>{var a;return(a=r.errors)!=null&&a.length?u(r.errors):g(r)}).catch(n),E=`
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=`
90
97
  query GET_CUSTOMER {
91
98
  customer {
92
99
  firstname
@@ -94,4 +101,4 @@ ${s}
94
101
  email
95
102
  }
96
103
  }
97
- `,S=async()=>await c(E,{method:"GET",cache:"force-cache"}).then(t=>{var r;return(r=t.errors)!=null&&r.length?u(t.errors):h(t)}).catch(n);export{D as a,S as g,y as t};
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};
@@ -1,10 +1,17 @@
1
- import{f as r,h as o}from"./fetch-graphql.js";function t(e){return e?{orderCancellationEnabled:e.order_cancellation_enabled,orderCancellationReasons:e.order_cancellation_reasons}:null}const a=`
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
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
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
8
15
  }
9
16
  }
10
- `,l=async()=>r(a,{method:"GET",cache:"force-cache"}).then(({errors:e,data:n})=>e?o(e):t(n.storeConfig));export{l as g};
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};