@dropins/storefront-order 0.1.0-alpha10

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 (125) hide show
  1. package/api/cancelOrder/cancelOrder.d.ts +2 -0
  2. package/api/cancelOrder/graphql/cancelOrderMutation.d.ts +2 -0
  3. package/api/cancelOrder/index.d.ts +2 -0
  4. package/api/fetch-graphql/fetch-graphql.d.ts +8 -0
  5. package/api/fetch-graphql/index.d.ts +2 -0
  6. package/api/getAttributesForm/getAttributesForm.d.ts +4 -0
  7. package/api/getAttributesForm/graphql/getAttributesForm.graphql.d.ts +3 -0
  8. package/api/getAttributesForm/index.d.ts +2 -0
  9. package/api/getCustomer/getCustomer.d.ts +4 -0
  10. package/api/getCustomer/graphql/getCustomer.graphql.d.ts +2 -0
  11. package/api/getCustomer/index.d.ts +2 -0
  12. package/api/getGuestOrder/getGuestOrder.d.ts +8 -0
  13. package/api/getGuestOrder/graphql/getGuestOrder.graphql.d.ts +3 -0
  14. package/api/getGuestOrder/index.d.ts +2 -0
  15. package/api/getOrderDetailsById/getOrderDetailsById.d.ts +4 -0
  16. package/api/getOrderDetailsById/graphql/customerAddressFragment.graphql.d.ts +2 -0
  17. package/api/getOrderDetailsById/graphql/index.d.ts +5 -0
  18. package/api/getOrderDetailsById/graphql/orderByNumber.graphql.d.ts +2 -0
  19. package/api/getOrderDetailsById/graphql/orderItemsFragment.graphql.d.ts +2 -0
  20. package/api/getOrderDetailsById/graphql/orderSummaryFragment.graphql.d.ts +2 -0
  21. package/api/getOrderDetailsById/index.d.ts +2 -0
  22. package/api/getStoreConfig/getStoreConfig.d.ts +4 -0
  23. package/api/getStoreConfig/graphql/StoreConfigQuery.d.ts +2 -0
  24. package/api/getStoreConfig/index.d.ts +2 -0
  25. package/api/guestOrderByToken/graphql/guestOrderByToken.graphql.d.ts +2 -0
  26. package/api/guestOrderByToken/guestOrderByToken.d.ts +4 -0
  27. package/api/guestOrderByToken/index.d.ts +2 -0
  28. package/api/helpers/initializeOrderDetails.d.ts +4 -0
  29. package/api/index.d.ts +9 -0
  30. package/api/initialize/index.d.ts +2 -0
  31. package/api/initialize/initialize.d.ts +10 -0
  32. package/api.d.ts +1 -0
  33. package/api.js +167 -0
  34. package/chunks/CustomerDetailsContent.js +1 -0
  35. package/chunks/OrderLoaders.js +1 -0
  36. package/chunks/fetch-graphql.js +1 -0
  37. package/chunks/getAttributesForm.js +47 -0
  38. package/chunks/getCustomer.js +97 -0
  39. package/chunks/getStoreConfig.js +10 -0
  40. package/chunks/network-error.js +1 -0
  41. package/chunks/transform-order-details.js +90 -0
  42. package/components/CustomerDetailsContent/CustomerDetailsContent.d.ts +5 -0
  43. package/components/CustomerDetailsContent/index.d.ts +3 -0
  44. package/components/Form/Form.d.ts +5 -0
  45. package/components/Form/FormInputs/FormInputs.d.ts +5 -0
  46. package/components/Form/FormInputs/index.d.ts +3 -0
  47. package/components/Form/index.d.ts +3 -0
  48. package/components/OrderActions/OrderActions.d.ts +5 -0
  49. package/components/OrderActions/index.d.ts +3 -0
  50. package/components/OrderCancel/OrderCancel.d.ts +5 -0
  51. package/components/OrderCancel/index.d.ts +3 -0
  52. package/components/OrderLoaders/OrderLoaders.d.ts +7 -0
  53. package/components/OrderLoaders/index.d.ts +3 -0
  54. package/components/OrderSearchForm/OrderSearchForm.d.ts +5 -0
  55. package/components/OrderSearchForm/index.d.ts +3 -0
  56. package/components/OrderStatusContent/OrderStatusContent.d.ts +5 -0
  57. package/components/OrderStatusContent/index.d.ts +3 -0
  58. package/components/ShippingStatusCard/ShippingStatusCard.d.ts +5 -0
  59. package/components/ShippingStatusCard/index.d.ts +3 -0
  60. package/components/index.d.ts +9 -0
  61. package/configs/defaultAttributePreset.config.d.ts +2 -0
  62. package/configs/mock.config.d.ts +924 -0
  63. package/containers/CustomerDetails/CustomerDetails.d.ts +5 -0
  64. package/containers/CustomerDetails/index.d.ts +3 -0
  65. package/containers/CustomerDetails.d.ts +3 -0
  66. package/containers/CustomerDetails.js +1 -0
  67. package/containers/OrderSearch/OrderSearch.d.ts +5 -0
  68. package/containers/OrderSearch/index.d.ts +3 -0
  69. package/containers/OrderSearch.d.ts +3 -0
  70. package/containers/OrderSearch.js +1 -0
  71. package/containers/OrderStatus/OrderStatus.d.ts +5 -0
  72. package/containers/OrderStatus/index.d.ts +3 -0
  73. package/containers/OrderStatus.d.ts +3 -0
  74. package/containers/OrderStatus.js +80 -0
  75. package/containers/ShippingStatus/ShippingStatus.d.ts +5 -0
  76. package/containers/ShippingStatus/index.d.ts +3 -0
  77. package/containers/ShippingStatus.d.ts +3 -0
  78. package/containers/ShippingStatus.js +1 -0
  79. package/containers/index.d.ts +5 -0
  80. package/data/models/attributes-form.d.ts +46 -0
  81. package/data/models/customer.d.ts +6 -0
  82. package/data/models/index.d.ts +5 -0
  83. package/data/models/order-details.d.ts +117 -0
  84. package/data/models/store-config.d.ts +8 -0
  85. package/data/transforms/index.d.ts +6 -0
  86. package/data/transforms/transform-attributes-form.d.ts +6 -0
  87. package/data/transforms/transform-customer.d.ts +5 -0
  88. package/data/transforms/transform-guest-order.d.ts +6 -0
  89. package/data/transforms/transform-order-details.d.ts +7 -0
  90. package/data/transforms/transform-store-config.d.ts +4 -0
  91. package/hooks/api/useGetStoreConfig.d.ts +4 -0
  92. package/hooks/components/useForm.d.ts +11 -0
  93. package/hooks/containers/useCustomerDetails.d.ts +12 -0
  94. package/hooks/containers/useOrderSearch.d.ts +22 -0
  95. package/hooks/containers/useOrderStatus.d.ts +8 -0
  96. package/hooks/containers/useShippingStatus.d.ts +7 -0
  97. package/hooks/index.d.ts +5 -0
  98. package/i18n/en_US.json.d.ts +113 -0
  99. package/lib/checkIsFunction.d.ts +2 -0
  100. package/lib/convertCase.d.ts +4 -0
  101. package/lib/convertToInputDateFormat.d.ts +3 -0
  102. package/lib/fetch-error.d.ts +5 -0
  103. package/lib/formatAddressFields.d.ts +6 -0
  104. package/lib/getFormValues.d.ts +2 -0
  105. package/lib/getQueryParam.d.ts +2 -0
  106. package/lib/network-error.d.ts +6 -0
  107. package/lib/redirectTo.d.ts +3 -0
  108. package/package.json +1 -0
  109. package/render/Provider.d.ts +8 -0
  110. package/render/index.d.ts +2 -0
  111. package/render/render.d.ts +4 -0
  112. package/render.d.ts +1 -0
  113. package/render.js +2 -0
  114. package/types/api/getAttributesForm.types.d.ts +31 -0
  115. package/types/api/getCustomer.types.d.ts +13 -0
  116. package/types/api/getGuestOrder.types.d.ts +13 -0
  117. package/types/api/getOrderDetails.types.d.ts +213 -0
  118. package/types/api/guestOrderByToken.types.d.ts +13 -0
  119. package/types/customerDetails.types.d.ts +52 -0
  120. package/types/form.types.d.ts +60 -0
  121. package/types/index.d.ts +12 -0
  122. package/types/orderCancel.types.d.ts +10 -0
  123. package/types/orderSearch.types.d.ts +36 -0
  124. package/types/orderStatus.types.d.ts +41 -0
  125. package/types/shippingStatus.types.d.ts +18 -0
@@ -0,0 +1,2 @@
1
+ export declare const cancelOrder: (orderId: string, reason: string, onSuccess: Function, onError: Function) => Promise<void | null | undefined>;
2
+ //# sourceMappingURL=cancelOrder.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const CANCEL_ORDER_MUTATION: string;
2
+ //# sourceMappingURL=cancelOrderMutation.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from './cancelOrder';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,8 @@
1
+ export declare const setEndpoint: (endpoint: string) => void, setFetchGraphQlHeader: (key: string, value: string | null) => void, removeFetchGraphQlHeader: (key: string) => void, setFetchGraphQlHeaders: (header: import('@adobe/fetch-graphql').Header) => void, fetchGraphQl: <T = any>(query: string, options?: import('@adobe/fetch-graphql').FetchOptions | undefined) => Promise<{
2
+ errors?: import('@adobe/fetch-graphql').FetchQueryError | undefined;
3
+ data: T;
4
+ }>, getConfig: () => {
5
+ endpoint: string | undefined;
6
+ fetchGraphQlHeaders: import('@adobe/fetch-graphql').Header | undefined;
7
+ };
8
+ //# sourceMappingURL=fetch-graphql.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from './fetch-graphql';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { AttributesFormModel } from '../../data/models';
2
+
3
+ export declare const getAttributesForm: (formCode: string) => Promise<AttributesFormModel[]>;
4
+ //# sourceMappingURL=getAttributesForm.d.ts.map
@@ -0,0 +1,3 @@
1
+ export declare const GET_ATTRIBUTES_FORM = "\n query GET_ATTRIBUTES_FORM($formCode: String!) {\n attributesForm(formCode: $formCode) {\n items {\n code\n default_value\n entity_type\n frontend_class\n frontend_input\n is_required\n is_unique\n label\n options {\n is_default\n label\n value\n }\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n validate_rules {\n name\n value\n }\n }\n }\n errors {\n type\n message\n }\n }\n }\n";
2
+ export declare const GET_ATTRIBUTES_FORM_SHORT = "\n query GET_ATTRIBUTES_FORM_SHORT {\n attributesForm(formCode: customer_register_address) {\n items {\n frontend_input\n label\n code\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n }\n }\n }\n }\n";
3
+ //# sourceMappingURL=getAttributesForm.graphql.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from './getAttributesForm';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { CustomerDataModelShort } from '../../data/models';
2
+
3
+ export declare const getCustomer: () => Promise<CustomerDataModelShort>;
4
+ //# sourceMappingURL=getCustomer.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const GET_CUSTOMER = "\n query GET_CUSTOMER {\n customer {\n firstname\n lastname\n email\n }\n }\n";
2
+ //# sourceMappingURL=getCustomer.graphql.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from './getCustomer';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { OrderDataModel } from '../../data/models';
2
+
3
+ export declare const getGuestOrder: (form: {
4
+ number: string;
5
+ email: string;
6
+ postcode: string;
7
+ }) => Promise<OrderDataModel | null>;
8
+ //# sourceMappingURL=getGuestOrder.d.ts.map
@@ -0,0 +1,3 @@
1
+ export declare const GUEST_ORDER_FRAGMENT: string;
2
+ export declare const GET_GUEST_ORDER: string;
3
+ //# sourceMappingURL=getGuestOrder.graphql.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from './getGuestOrder';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { TransformedData } from '../../data/models';
2
+
3
+ export declare const getOrderDetailsById: <T extends "orderData">(orderId?: string, queryType?: T | undefined) => Promise<TransformedData<T>>;
4
+ //# sourceMappingURL=getOrderDetailsById.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const ADDRESS = "\nfragment AddressesList on OrderAddress {\n city\n company\n country_code\n fax\n firstname\n lastname\n middlename\n postcode\n prefix\n region\n region_id\n street\n suffix\n telephone\n vat_id\n}";
2
+ //# sourceMappingURL=customerAddressFragment.graphql.d.ts.map
@@ -0,0 +1,5 @@
1
+ export * from './orderSummaryFragment.graphql';
2
+ export * from './orderByNumber.graphql';
3
+ export * from './customerAddressFragment.graphql';
4
+ export * from './orderItemsFragment.graphql';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const ORDER_BY_NUMBER: string;
2
+ //# sourceMappingURL=orderByNumber.graphql.d.ts.map
@@ -0,0 +1,2 @@
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}";
2
+ //# sourceMappingURL=orderItemsFragment.graphql.d.ts.map
@@ -0,0 +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}";
2
+ //# sourceMappingURL=orderSummaryFragment.graphql.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from './getOrderDetailsById';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { StoreConfigModel } from '../../data/models';
2
+
3
+ export declare const getStoreConfig: () => Promise<StoreConfigModel | null>;
4
+ //# sourceMappingURL=getStoreConfig.d.ts.map
@@ -0,0 +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";
2
+ //# sourceMappingURL=StoreConfigQuery.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from './getStoreConfig';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const ORDER_BY_TOKEN: string;
2
+ //# sourceMappingURL=guestOrderByToken.graphql.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { OrderDataModel } from '../../data/models';
2
+
3
+ export declare const guestOrderByToken: (token?: string) => Promise<OrderDataModel | null>;
4
+ //# sourceMappingURL=guestOrderByToken.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from './guestOrderByToken';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { OrderDataModel } from '../../data/models';
2
+
3
+ export declare const initializeOrderDetails: (config: Record<string, string | OrderDataModel | null> | undefined) => Promise<void>;
4
+ //# sourceMappingURL=initializeOrderDetails.d.ts.map
package/api/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ export * from './initialize';
2
+ export * from './fetch-graphql';
3
+ export * from './getOrderDetailsById';
4
+ export * from './getGuestOrder';
5
+ export * from './guestOrderByToken';
6
+ export * from './getAttributesForm';
7
+ export * from './getCustomer';
8
+ export * from './getStoreConfig';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from './initialize';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { Initializer } from '@dropins/tools/types/elsie/src/lib';
2
+ import { Lang } from '@dropins/tools/types/elsie/src/i18n';
3
+
4
+ type ConfigProps = {
5
+ langDefinitions?: Lang;
6
+ };
7
+ export declare const initialize: Initializer<ConfigProps>;
8
+ export declare const config: import('@dropins/tools/types/elsie/src/lib').Config<ConfigProps>;
9
+ export {};
10
+ //# sourceMappingURL=initialize.d.ts.map
package/api.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './api/index'
package/api.js ADDED
@@ -0,0 +1,167 @@
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=`
2
+ query ORDER_BY_NUMBER($orderNumber: String!) {
3
+ customer {
4
+ orders(
5
+ filter: {number: {eq: $orderNumber}},
6
+ ) {
7
+ items {
8
+ email
9
+ available_actions
10
+ status
11
+ number
12
+ id
13
+ order_date
14
+ order_status_change_date
15
+ carrier
16
+ shipping_method
17
+ is_virtual
18
+ applied_coupons {
19
+ code
20
+ }
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
+ 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
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
51
+ payment_methods {
52
+ name
53
+ type
54
+ }
55
+ shipping_address {
56
+ ...AddressesList
57
+ }
58
+ billing_address {
59
+ ...AddressesList
60
+ }
61
+ items {
62
+ ...OrderItems
63
+ ... on GiftCardOrderItem {
64
+ __typename
65
+ gift_card {
66
+ recipient_name
67
+ recipient_email
68
+ sender_name
69
+ sender_email
70
+ message
71
+ }
72
+ }
73
+ }
74
+ total {
75
+ ...OrderSummary
76
+ }
77
+ }
78
+ }
79
+ }
80
+ }
81
+ ${_}
82
+ ${c}
83
+ ${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=`
85
+ query ORDER_BY_TOKEN($token: String!) {
86
+ guestOrderByToken(input: { token: $token }) {
87
+ email
88
+ id
89
+ number
90
+ order_date
91
+ order_status_change_date
92
+ status
93
+ token
94
+ carrier
95
+ shipping_method
96
+ printed_card_included
97
+ gift_receipt_included
98
+ available_actions
99
+ is_virtual
100
+ payment_methods {
101
+ name
102
+ type
103
+ }
104
+ applied_coupons {
105
+ code
106
+ }
107
+ shipments {
108
+ id
109
+ tracking {
110
+ title
111
+ number
112
+ carrier
113
+ }
114
+ comments {
115
+ message
116
+ timestamp
117
+ }
118
+ items {
119
+ id
120
+ product_sku
121
+ product_name
122
+ order_item {
123
+ ...OrderItems
124
+ ... on GiftCardOrderItem {
125
+ gift_card {
126
+ recipient_name
127
+ recipient_email
128
+ sender_name
129
+ sender_email
130
+ message
131
+ }
132
+ }
133
+ }
134
+ }
135
+ }
136
+ payment_methods {
137
+ name
138
+ type
139
+ }
140
+ shipping_address {
141
+ ...AddressesList
142
+ }
143
+ billing_address {
144
+ ...AddressesList
145
+ }
146
+ items {
147
+ ...OrderItems
148
+ ... on GiftCardOrderItem {
149
+ __typename
150
+ gift_card {
151
+ recipient_name
152
+ recipient_email
153
+ sender_name
154
+ sender_email
155
+ message
156
+ }
157
+ }
158
+ }
159
+ total {
160
+ ...OrderSummary
161
+ }
162
+ }
163
+ }
164
+ ${_}
165
+ ${c}
166
+ ${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};
@@ -0,0 +1 @@
1
+ import{jsx as h,Fragment as v,jsxs as M}from"@dropins/tools/preact-jsx-runtime.js";import{useRef as _,useState as D,useEffect as w,useCallback as T}from"@dropins/tools/preact-hooks.js";import{useText as y}from"@dropins/tools/i18n.js";import*as C from"@dropins/tools/preact-compat.js";import{memo as V,useCallback as L}from"@dropins/tools/preact-compat.js";import{classes as k}from"@dropins/tools/lib.js";import{Field as q,Picker as A,Input as I,InputDate as R,Checkbox as O,TextArea as N}from"@dropins/tools/components.js";const j=l=>C.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...l},C.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.8052 14.4968C10.8552 14.4968 9.9752 14.0268 9.4452 13.2368L9.4152 13.1868L9.3852 13.1268C8.1352 11.2268 7.5352 8.96681 7.6852 6.68681C7.7552 4.42681 9.6052 2.61681 11.8652 2.60681H12.0052C14.2752 2.47681 16.2152 4.21681 16.3452 6.47681C16.3452 6.55681 16.3452 6.62681 16.3452 6.70681C16.4852 8.94681 15.9052 11.1768 14.6852 13.0568L14.6052 13.1768C14.0552 13.9868 13.1352 14.4668 12.1652 14.4768H12.0052C11.9352 14.4768 11.8652 14.4868 11.7952 14.4868L11.8052 14.4968Z",stroke:"currentColor"}),C.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M4.3252 21.5469C4.3552 20.4169 4.4752 19.2869 4.6752 18.1769C4.8952 17.1669 6.4752 16.0269 8.9052 15.1569C9.2352 15.0369 9.4852 14.7869 9.5952 14.4569L9.8052 14.0269",stroke:"currentColor"}),C.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M14.425 14.4069L14.165 14.1569C14.375 14.5969 14.725 14.9569 15.155 15.1869C16.945 15.7969 19.125 16.9569 19.375 18.2069C19.585 19.3069 19.685 20.4269 19.675 21.5369",stroke:"currentColor"})),H=l=>l.reduce((u,{code:i,required:$,defaultValue:c})=>($&&(u[i]=c),u),{}),S=({fieldsConfig:l,onSubmit:u})=>{const{requiredFieldError:i}=y({requiredFieldError:"Order.Form.notifications.requiredFieldError"}),$=_(null),[c,n]=D({}),[o,t]=D({});w(()=>{if(n({}),!l||!l.length)return;const s=H(l);n(s)},[l==null?void 0:l.length]),w(()=>()=>{var s;n({}),(s=$.current)==null||s.reset()},[]);const p=T((s,e)=>{const r=l.find(d=>d.code===s);return r!=null&&r.required&&!e?i:""},[l,i]),b=T(s=>{const{name:e,value:r,type:a,checked:d}=s==null?void 0:s.target,f=a==="checkbox"?d:r;n(E=>({...E,[e]:f}))},[]),x=T(s=>{const{name:e,value:r,type:a,checked:d}=s==null?void 0:s.target,f=a==="checkbox"?d:r;t(E=>({...E,[e]:p(e,f)}))},[p]),F=T(s=>{s.preventDefault();let e=!0,r={},a=null;for(const[d,f]of Object.entries(c)){const E=p(d,f);E&&(r[d]=E,e=!1,a||(a=d))}if(t(r),a&&$.current){const d=$.current.elements.namedItem(a);d==null||d.focus()}u==null||u(s,e)},[c,p,u]);return{formData:c,errors:o,formRef:$,handleChange:b,handleBlur:x,handleSubmit:F}},U=V(({loading:l,values:u,fields:i=[],errors:$,className:c="",onChange:n,onBlur:o})=>{const t=`${c}__item`,p=L((e,r,a)=>{const d=e.options.map(f=>({text:f.label,value:f.value}));return h(q,{error:a,className:k([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:l,children:h(A,{name:e.id,floatingLabel:`${e.label} ${e.required?"*":""}`,placeholder:e.label,"aria-label":e.label,options:d,onBlur:o,handleSelect:n,value:r||e.defaultValue})},e.id)},[c,l,t,o,n]),b=L((e,r,a)=>{const d=e.id==="email",f=d?h(j,{}):void 0,E=d?"username":"";return h(q,{error:a,className:k([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e==null?void 0:e.is_hidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:l,children:h(I,{"aria-label":e.label,"aria-required":e.required,autoComplete:E,icon:f,type:"text",name:e.id,value:r||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:o,onChange:n})},e.id)},[c,l,t,o,n]),x=L((e,r,a)=>h(q,{error:a,className:k([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:l,children:h(R,{type:"text",name:e.id,value:r||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:o,onChange:n})},e.id),[c,l,t,o,n]),F=L((e,r,a)=>h(q,{error:a,className:k([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:l,children:h(O,{name:e.id,checked:r||e.defaultValue,placeholder:e.label,label:`${e.label} ${e.required?"*":""}`,onBlur:o,onChange:n})},e.id),[c,l,t,o,n]),s=L((e,r,a)=>h(q,{error:a,className:k([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:l,children:h(N,{type:"text",name:e.id,value:r===void 0?e.defaultValue:r,label:`${e.label} ${e.required?"*":""}`,onBlur:o,onChange:n})},e.id),[c,l,t,o,n]);return i.length?h(v,{children:i.map(e=>{var d;const r=($==null?void 0:$[e.id])??"",a=(u==null?void 0:u[e.id])??"";switch(e.fieldType){case"TEXT":return(d=e==null?void 0:e.options)!=null&&d.length?p(e,a,r):b(e,a,r);case"MULTILINE":return b(e,a,r);case"SELECT":return p(e,a,r);case"DATE":return x(e,a,r);case"BOOLEAN":return F(e,a,r);case"TEXTAREA":return s(e,a,r);default:return null}})}):null}),K=V(({name:l,loading:u,children:i,className:$="defaultForm",fieldsConfig:c,onSubmit:n})=>{const{formData:o,errors:t,formRef:p,handleChange:b,handleBlur:x,handleSubmit:F}=S({fieldsConfig:c,onSubmit:n});return M("form",{className:k(["order-form",$]),onSubmit:F,name:l,ref:p,children:[h(U,{className:$,loading:u,fields:c,onChange:b,onBlur:x,errors:t,values:o}),i]})});export{K as F};
@@ -0,0 +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};
@@ -0,0 +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};
@@ -0,0 +1,47 @@
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=`
2
+ query GET_ATTRIBUTES_FORM($formCode: String!) {
3
+ attributesForm(formCode: $formCode) {
4
+ items {
5
+ code
6
+ default_value
7
+ entity_type
8
+ frontend_class
9
+ frontend_input
10
+ is_required
11
+ is_unique
12
+ label
13
+ options {
14
+ is_default
15
+ label
16
+ value
17
+ }
18
+ ... on CustomerAttributeMetadata {
19
+ multiline_count
20
+ sort_order
21
+ validate_rules {
22
+ name
23
+ value
24
+ }
25
+ }
26
+ }
27
+ errors {
28
+ type
29
+ message
30
+ }
31
+ }
32
+ }
33
+ `,C=`
34
+ query GET_ATTRIBUTES_FORM_SHORT {
35
+ attributesForm(formCode: customer_register_address) {
36
+ items {
37
+ frontend_input
38
+ label
39
+ code
40
+ ... on CustomerAttributeMetadata {
41
+ multiline_count
42
+ sort_order
43
+ }
44
+ }
45
+ }
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};
@@ -0,0 +1,97 @@
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=`
2
+ fragment guestOrderData on CustomerOrder {
3
+ email
4
+ id
5
+ number
6
+ order_date
7
+ order_status_change_date
8
+ status
9
+ token
10
+ carrier
11
+ shipping_method
12
+ printed_card_included
13
+ gift_receipt_included
14
+ available_actions
15
+ is_virtual
16
+ payment_methods {
17
+ name
18
+ type
19
+ }
20
+ applied_coupons {
21
+ code
22
+ }
23
+ shipments {
24
+ id
25
+ tracking {
26
+ title
27
+ number
28
+ carrier
29
+ }
30
+ comments {
31
+ message
32
+ timestamp
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
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+ payment_methods {
53
+ name
54
+ type
55
+ }
56
+ shipping_address {
57
+ ...AddressesList
58
+ }
59
+ billing_address {
60
+ ...AddressesList
61
+ }
62
+ items {
63
+ ...OrderItems
64
+ ... on GiftCardOrderItem {
65
+ __typename
66
+ gift_card {
67
+ recipient_name
68
+ recipient_email
69
+ sender_name
70
+ sender_email
71
+ message
72
+ }
73
+ }
74
+ }
75
+ total {
76
+ ...OrderSummary
77
+ }
78
+ }
79
+ ${l}
80
+ ${O}
81
+ ${o}
82
+ `,f=`
83
+ query GET_GUEST_ORDER($input: OrderInformationInput!) {
84
+ guestOrder(input:$input) {
85
+ ...guestOrderData
86
+ }
87
+ }
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=`
90
+ query GET_CUSTOMER {
91
+ customer {
92
+ firstname
93
+ lastname
94
+ email
95
+ }
96
+ }
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};
@@ -0,0 +1,10 @@
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=`
2
+ query STORE_CONFIG_QUERY {
3
+ storeConfig {
4
+ order_cancellation_enabled
5
+ order_cancellation_reasons {
6
+ description
7
+ }
8
+ }
9
+ }
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};
@@ -0,0 +1 @@
1
+ import{events as o}from"@dropins/tools/event-bus.js";const s=r=>{throw r instanceof DOMException&&r.name==="AbortError"||o.emit("order/error",{source:"auth",type:"network",error:r.message}),r};export{s as h};
@@ -0,0 +1,90 @@
1
+ import{d as G}from"./fetch-graphql.js";const z=`
2
+ fragment OrderSummary on OrderTotal {
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
+ }`,B=`
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
+ }`,F=`
52
+ fragment OrderItems on OrderItem {
53
+ __typename
54
+ status
55
+ product_name
56
+ id
57
+ quantity_ordered
58
+ quantity_shipped
59
+ quantity_canceled
60
+ quantity_invoiced
61
+ quantity_refunded
62
+ quantity_returned
63
+ product_sale_price {
64
+ value
65
+ currency
66
+ }
67
+ selected_options {
68
+ label
69
+ value
70
+ }
71
+ product {
72
+ __typename
73
+ canonical_url
74
+ uid
75
+ name
76
+ sku
77
+ thumbnail {
78
+ label
79
+ url
80
+ }
81
+ price_range {
82
+ maximum_price {
83
+ regular_price {
84
+ currency
85
+ value
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }`,K=n=>n||0,L=n=>{var a,u,i;return{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:((u=n==null?void 0:n.thumbnail)==null?void 0:u.label)||"",url:((i=n==null?void 0:n.thumbnail)==null?void 0:i.url)||""}}},P=n=>{if(!n||!("selected_options"in n))return;const a={};for(const u of n.selected_options)a[u.label]=u.value;return a},Y=n=>n==null?void 0:n.map(a=>{var u,i,l,c,_,s,p,y,t,f,g,v,q,b,h,O,x,C,N,R,S,E,A,T,k,M,Q,U,D;return{type:a==null?void 0:a.__typename,productName:a.product_name,quantityCanceled:a==null?void 0:a.quantity_canceled,quantityInvoiced:a==null?void 0:a.quantity_invoiced,quantityOrdered:a==null?void 0:a.quantity_ordered,quantityRefunded:a==null?void 0:a.quantity_refunded,quantityReturned:a==null?void 0:a.quantity_returned,quantityShipped:a==null?void 0:a.quantity_shipped,id:a==null?void 0:a.id,discounted:((c=(l=(i=(u=a==null?void 0:a.product)==null?void 0:u.price_range)==null?void 0:i.maximum_price)==null?void 0:l.regular_price)==null?void 0:c.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),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),currency:(t=a==null?void 0:a.product_sale_price)==null?void 0:t.currency},price:{value:(f=a==null?void 0:a.product_sale_price)==null?void 0:f.value,currency:(g=a==null?void 0:a.product_sale_price)==null?void 0:g.currency},priceInclTax:{value:(v=a==null?void 0:a.product_sale_price)==null?void 0:v.value,currency:(q=a==null?void 0:a.product_sale_price)==null?void 0:q.currency},totalQuantity:K(a==null?void 0:a.quantity_ordered),regularPrice:{value:(x=(O=(h=(b=a==null?void 0:a.product)==null?void 0:b.price_range)==null?void 0:h.maximum_price)==null?void 0:O.regular_price)==null?void 0:x.value,currency:(S=(R=(N=(C=a==null?void 0:a.product)==null?void 0:C.price_range)==null?void 0:N.maximum_price)==null?void 0:R.regular_price)==null?void 0:S.currency},product:L(a==null?void 0:a.product),thumbnail:{label:((A=(E=a==null?void 0:a.product)==null?void 0:E.thumbnail)==null?void 0:A.label)||"",url:((k=(T=a==null?void 0:a.product)==null?void 0:T.thumbnail)==null?void 0:k.url)||""},giftCard:(a==null?void 0:a.__typename)==="GiftCardOrderItem"?{senderName:((M=a.gift_card)==null?void 0:M.sender_name)||"",senderEmail:((Q=a.gift_card)==null?void 0:Q.sender_email)||"",recipientEmail:((U=a.gift_card)==null?void 0:U.recipient_email)||"",recipientName:((D=a.gift_card)==null?void 0:D.recipient_name)||""}:void 0,configurableOptions:P(a)}}),j=n=>{var y,t,f,g,v;const a=Y(n.items),{total:u,...i}=G({...n,items:a},"camelCase",{applied_coupons:"coupons",__typename:"__typename",firstname:"firstName",middlename:"middleName",lastname:"lastName",postcode:"postCode",payment_methods:"payments"}),l=(y=n==null?void 0:n.payment_methods)==null?void 0:y[0],c=(l==null?void 0:l.type)||"",_=(l==null?void 0:l.name)||"",s=(t=i==null?void 0:i.items)==null?void 0:t.reduce((q,b)=>q+b.totalQuantity,0);return{...u,...i,totalQuantity:s,shipping:{amount:((f=i==null?void 0:i.total)==null?void 0:f.totalShipping.value)??0,currency:((v=(g=i.total)==null?void 0:g.totalShipping)==null?void 0:v.currency)||"",code:i.shippingMethod??""},payments:[{code:c,name:_}]}},H=(n,a)=>{var u,i,l,c,_,s,p;if((c=(l=(i=(u=a==null?void 0:a.data)==null?void 0:u.customer)==null?void 0:i.orders)==null?void 0:l.items)!=null&&c.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 j(y)}return null};export{B as A,z as O,F as a,H as b,j as t};
@@ -0,0 +1,5 @@
1
+ import { FunctionComponent } from 'preact';
2
+ import { CustomerDetailsContentProps } from '../../types';
3
+
4
+ export declare const CustomerDetailsContent: FunctionComponent<CustomerDetailsContentProps>;
5
+ //# sourceMappingURL=CustomerDetailsContent.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './CustomerDetailsContent';
2
+ export { CustomerDetailsContent as default } from './CustomerDetailsContent';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { FunctionComponent } from 'preact';
2
+ import { FormProps } from '../../types';
3
+
4
+ export declare const Form: FunctionComponent<FormProps>;
5
+ //# sourceMappingURL=Form.d.ts.map