@dropins/storefront-account 0.1.0-alpha2 → 0.1.0-alpha21
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/createCustomerAddress/createCustomerAddress.d.ts +4 -0
- package/api/createCustomerAddress/graphql/createCustomerAddress.graphql.d.ts +2 -0
- package/api/createCustomerAddress/index.d.ts +2 -0
- package/api/fetch-graphql/fetch-graphql.d.ts +8 -0
- package/api/fetch-graphql/index.d.ts +2 -0
- package/api/fragments/CustomerFragment.graphql.d.ts +2 -0
- package/api/getAttributesForm/getAttributesForm.d.ts +4 -0
- package/api/getAttributesForm/graphql/getAttributesForm.graphql.d.ts +3 -0
- package/api/getAttributesForm/index.d.ts +2 -0
- package/api/getCountries/getCountries.d.ts +9 -0
- package/api/getCountries/graphql/getCountries.graphql.d.ts +2 -0
- package/api/getCountries/index.d.ts +2 -0
- package/api/getCustomer/getCustomer.d.ts +4 -0
- package/api/getCustomer/graphql/getCustomer.graphql.d.ts +2 -0
- package/api/getCustomer/index.d.ts +2 -0
- package/api/getCustomerAddress/getCustomerAddress.d.ts +4 -0
- package/api/getCustomerAddress/graphql/getCustomerAddress.graphql.d.ts +2 -0
- package/api/getCustomerAddress/index.d.ts +2 -0
- package/api/getOrderHistoryList/getOrderHistoryList.d.ts +4 -0
- package/api/getOrderHistoryList/graphql/customerAddressFragment.graphql.d.ts +2 -0
- package/api/getOrderHistoryList/graphql/getOrderHistoryList.graphql.d.ts +2 -0
- package/api/getOrderHistoryList/graphql/orderSummaryFragment.graphql.d.ts +2 -0
- package/api/getOrderHistoryList/index.d.ts +2 -0
- package/api/getRegions/getRegions.d.ts +5 -0
- package/api/getRegions/graphql/getRegions.graphql.d.ts +2 -0
- package/api/getRegions/index.d.ts +2 -0
- package/api/getStoreConfig/getStoreConfig.d.ts +4 -0
- package/api/getStoreConfig/graphql/getStoreConfig.graphql.d.ts +2 -0
- package/api/getStoreConfig/index.d.ts +2 -0
- package/api/index.d.ts +16 -0
- package/api/initialize/index.d.ts +2 -0
- package/api/initialize/initialize.d.ts +14 -0
- package/api/removeCustomerAddress/graphql/removeCustomerAddress.graphql.d.ts +2 -0
- package/api/removeCustomerAddress/index.d.ts +2 -0
- package/api/removeCustomerAddress/removeCustomerAddress.d.ts +2 -0
- package/api/updateCustomer/graphql/updateCustomer.graphql.d.ts +2 -0
- package/api/updateCustomer/index.d.ts +2 -0
- package/api/updateCustomer/updateCustomer.d.ts +2 -0
- package/api/updateCustomerAddress/graphql/updateCustomerAddress.graphql.d.ts +2 -0
- package/api/updateCustomerAddress/index.d.ts +2 -0
- package/api/updateCustomerAddress/updateCustomerAddress.d.ts +8 -0
- package/api/updateCustomerEmail/graphql/updateCustomerEmail.graphql.d.ts +2 -0
- package/api/updateCustomerEmail/index.d.ts +2 -0
- package/api/updateCustomerEmail/updateCustomerEmail.d.ts +5 -0
- package/api/updateCustomerPassword/graphql/updateCustomerPassword.graphql.d.ts +2 -0
- package/api/updateCustomerPassword/index.d.ts +2 -0
- package/api/updateCustomerPassword/updateCustomerPassword.d.ts +4 -0
- package/api.d.ts +1 -0
- package/api.js +1 -2
- package/chunks/CustomerInformationCard.js +1 -0
- package/chunks/getOrderHistoryList.js +124 -0
- package/chunks/removeCustomerAddress.js +120 -0
- package/chunks/updateCustomer.js +57 -0
- package/components/AccountLoaders/AccountLoaders.d.ts +8 -0
- package/components/AccountLoaders/index.d.ts +3 -0
- package/components/AddressActions/AddressActions.d.ts +5 -0
- package/components/AddressActions/index.d.ts +3 -0
- package/components/AddressCard/AddressCard.d.ts +5 -0
- package/components/AddressCard/index.d.ts +3 -0
- package/components/AddressFormWrapper/AddressFormWrapper.d.ts +5 -0
- package/components/AddressFormWrapper/index.d.ts +3 -0
- package/components/AddressModal/AddressModal.d.ts +5 -0
- package/components/AddressModal/index.d.ts +3 -0
- package/components/AddressesWrapper/AddressesWrapper.d.ts +5 -0
- package/components/AddressesWrapper/index.d.ts +3 -0
- package/components/ChangePassword/ChangePassword.d.ts +5 -0
- package/components/ChangePassword/index.d.ts +3 -0
- package/components/CustomerInformationCard/CustomerInformationCard.d.ts +5 -0
- package/components/CustomerInformationCard/index.d.ts +3 -0
- package/components/EditCustomerInformation/EditCustomerInformation.d.ts +5 -0
- package/components/EditCustomerInformation/index.d.ts +3 -0
- package/components/EmptyList/EmptyList.d.ts +5 -0
- package/components/EmptyList/index.d.ts +3 -0
- package/components/Form/Form.d.ts +6 -0
- package/components/Form/FormInputs/FormInputs.d.ts +5 -0
- package/components/Form/FormInputs/index.d.ts +3 -0
- package/components/Form/index.d.ts +3 -0
- package/components/OrdersListAction/OrdersListAction.d.ts +5 -0
- package/components/OrdersListAction/index.d.ts +3 -0
- package/components/OrdersListCard/OrdersListCard.d.ts +5 -0
- package/components/OrdersListCard/index.d.ts +3 -0
- package/components/OrdersListWrapper/OrdersListWrapper.d.ts +5 -0
- package/components/OrdersListWrapper/index.d.ts +3 -0
- package/components/index.d.ts +16 -0
- package/configs/addressField.config.d.ts +39 -0
- package/configs/defaultAttributePreset.config.d.ts +3 -0
- package/configs/mockDefaultAddress.config.d.ts +153 -0
- package/configs/mockOrdersList.config.d.ts +205 -0
- package/containers/AddressForm/AddressForm.d.ts +5 -0
- package/containers/AddressForm/index.d.ts +3 -0
- package/containers/AddressForm.d.ts +3 -0
- package/containers/AddressForm.js +1 -0
- package/containers/Addresses/Addresses.d.ts +5 -0
- package/containers/Addresses/index.d.ts +3 -0
- package/containers/Addresses.d.ts +3 -0
- package/containers/Addresses.js +1 -0
- package/containers/CustomerInformation/CustomerInformation.d.ts +5 -0
- package/containers/CustomerInformation/index.d.ts +3 -0
- package/containers/CustomerInformation.d.ts +3 -0
- package/containers/CustomerInformation.js +1 -0
- package/containers/OrdersList/OrdersList.d.ts +5 -0
- package/containers/OrdersList/index.d.ts +3 -0
- package/containers/OrdersList.d.ts +3 -0
- package/containers/OrdersList.js +1 -0
- package/containers/index.d.ts +5 -0
- package/data/models/attributes-form.d.ts +46 -0
- package/data/models/country.d.ts +5 -0
- package/data/models/customer-address.d.ts +21 -0
- package/data/models/customer.d.ts +14 -0
- package/data/models/index.d.ts +7 -0
- package/data/models/order-history-list.d.ts +80 -0
- package/data/models/region.d.ts +11 -0
- package/data/models/store-config.d.ts +5 -0
- package/data/transforms/index.d.ts +8 -0
- package/data/transforms/transform-attributes-form.d.ts +6 -0
- package/data/transforms/transform-countries.d.ts +10 -0
- package/data/transforms/transform-customer-address.d.ts +7 -0
- package/data/transforms/transform-customer.d.ts +5 -0
- package/data/transforms/transform-order-history-list.d.ts +5 -0
- package/data/transforms/transform-regions.d.ts +6 -0
- package/data/transforms/transform-store-config.d.ts +5 -0
- package/hooks/components/useChangePassword.d.ts +26 -0
- package/hooks/components/useForm.d.ts +14 -0
- package/hooks/components/usePasswordValidationMessage.d.ts +16 -0
- package/hooks/containers/useAddressForm.d.ts +31 -0
- package/hooks/containers/useAddresses.d.ts +24 -0
- package/hooks/containers/useCustomerInformation.d.ts +50 -0
- package/hooks/containers/useGetStoreConfigs.d.ts +7 -0
- package/hooks/containers/useOrderSelectList.d.ts +12 -0
- package/hooks/containers/useOrdersList.d.ts +13 -0
- package/hooks/useDebounce.d.ts +3 -0
- package/hooks/useInLineAlert.d.ts +7 -0
- package/hooks/useIsMobile.d.ts +2 -0
- package/i18n/en_US.json.d.ts +170 -0
- package/lib/areRequiredFieldsValid.d.ts +6 -0
- package/lib/checkIsFunction.d.ts +2 -0
- package/lib/convertCase.d.ts +4 -0
- package/lib/convertToBoolean.d.ts +2 -0
- package/lib/convertToInputDateFormat.d.ts +2 -0
- package/lib/fetch-error.d.ts +5 -0
- package/lib/formatDateToLocale.d.ts +31 -0
- package/lib/getDateRange.d.ts +10 -0
- package/lib/getFieldsConfig.d.ts +4 -0
- package/lib/getFormValues.d.ts +2 -0
- package/lib/getFormValuesFromRef.d.ts +5 -0
- package/lib/initializeFormDataAndErrors.d.ts +10 -0
- package/lib/manageAddressDeletion.d.ts +9 -0
- package/lib/network-error.d.ts +6 -0
- package/lib/normalizeAttributes.d.ts +2 -0
- package/lib/normalizeGetAddressData.d.ts +6 -0
- package/lib/prepareNormalizedData.d.ts +21 -0
- package/lib/serializeAddressForm.d.ts +4 -0
- package/lib/sortingAddressesList.d.ts +5 -0
- package/lib/transformDefaultValuesAddresses.d.ts +11 -0
- package/lib/transformSessionData.d.ts +6 -0
- package/lib/validationChangePassword.d.ts +17 -0
- package/lib/validationFields.d.ts +33 -0
- package/lib/validationUniqueSymbolsPassword.d.ts +2 -0
- package/package.json +1 -1
- package/render/Provider.d.ts +8 -0
- package/render/index.d.ts +2 -0
- package/render/render.d.ts +4 -0
- package/render.d.ts +1 -0
- package/render.js +3 -2
- package/types/addressForm.types.d.ts +46 -0
- package/types/addresses.types.d.ts +90 -0
- package/types/api/createCustomerAddress.types.d.ts +47 -0
- package/types/api/getAttributesForm.types.d.ts +31 -0
- package/types/api/getCountries.types.d.ts +19 -0
- package/types/api/getCustomer.types.d.ts +24 -0
- package/types/api/getCustomerAddress.type.d.ts +40 -0
- package/types/api/getOrderHistoryList.types.d.ts +91 -0
- package/types/api/getRegions.types.d.ts +16 -0
- package/types/api/removeCustomerAddress.types.d.ts +9 -0
- package/types/api/storeConfig.types.d.ts +13 -0
- package/types/api/updateCustomerAddress.types.d.ts +11 -0
- package/types/api/updateCustomerPassword.types.d.ts +15 -0
- package/types/customerInformation.types.d.ts +61 -0
- package/types/emptyList.types.d.ts +8 -0
- package/types/form.types.d.ts +56 -0
- package/types/index.d.ts +19 -0
- package/types/notification.types.d.ts +19 -0
- package/types/ordersList.types.d.ts +64 -0
- package/api.js.map +0 -1
- package/render.js.map +0 -1
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
export declare const mockOrdersListResponse: {
|
|
2
|
+
customer: {
|
|
3
|
+
orders: {
|
|
4
|
+
page_info: {
|
|
5
|
+
page_size: number;
|
|
6
|
+
total_pages: number;
|
|
7
|
+
current_page: number;
|
|
8
|
+
};
|
|
9
|
+
total_count: number;
|
|
10
|
+
date_of_first_order: string;
|
|
11
|
+
items: ({
|
|
12
|
+
token: string;
|
|
13
|
+
email: string;
|
|
14
|
+
shipping_method: string;
|
|
15
|
+
shipping_address: {
|
|
16
|
+
firstname: string;
|
|
17
|
+
lastname: string;
|
|
18
|
+
city: string;
|
|
19
|
+
company: string;
|
|
20
|
+
country_code: string;
|
|
21
|
+
region: {
|
|
22
|
+
region: string;
|
|
23
|
+
region_code: string;
|
|
24
|
+
region_id: string;
|
|
25
|
+
};
|
|
26
|
+
shipments: never[];
|
|
27
|
+
telephone: string;
|
|
28
|
+
id: string;
|
|
29
|
+
vat_id: string;
|
|
30
|
+
postcode: string;
|
|
31
|
+
street: string[];
|
|
32
|
+
default_shipping: boolean;
|
|
33
|
+
default_billing: boolean;
|
|
34
|
+
custom_attributesV2: never[];
|
|
35
|
+
};
|
|
36
|
+
billing_address: {
|
|
37
|
+
firstname: string;
|
|
38
|
+
lastname: string;
|
|
39
|
+
city: string;
|
|
40
|
+
company: string;
|
|
41
|
+
country_code: string;
|
|
42
|
+
region: {
|
|
43
|
+
region: string;
|
|
44
|
+
region_code: string;
|
|
45
|
+
region_id: string;
|
|
46
|
+
};
|
|
47
|
+
telephone: string;
|
|
48
|
+
id: string;
|
|
49
|
+
vat_id: string;
|
|
50
|
+
postcode: string;
|
|
51
|
+
street: string[];
|
|
52
|
+
default_shipping: boolean;
|
|
53
|
+
default_billing: boolean;
|
|
54
|
+
custom_attributesV2: never[];
|
|
55
|
+
};
|
|
56
|
+
payment_methods: {
|
|
57
|
+
name: string;
|
|
58
|
+
}[];
|
|
59
|
+
number: string;
|
|
60
|
+
id: string;
|
|
61
|
+
order_date: string;
|
|
62
|
+
carrier: string;
|
|
63
|
+
status: string;
|
|
64
|
+
items: {
|
|
65
|
+
status: string;
|
|
66
|
+
product_name: string;
|
|
67
|
+
id: string;
|
|
68
|
+
product: {
|
|
69
|
+
small_image: {
|
|
70
|
+
url: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
}[];
|
|
74
|
+
total: {
|
|
75
|
+
grand_total: {
|
|
76
|
+
value: number;
|
|
77
|
+
currency: string;
|
|
78
|
+
};
|
|
79
|
+
subtotal: {
|
|
80
|
+
currency: string;
|
|
81
|
+
value: number;
|
|
82
|
+
};
|
|
83
|
+
taxes: never[];
|
|
84
|
+
total_tax: {
|
|
85
|
+
currency: string;
|
|
86
|
+
value: number;
|
|
87
|
+
};
|
|
88
|
+
total_shipping: {
|
|
89
|
+
currency: string;
|
|
90
|
+
value: number;
|
|
91
|
+
};
|
|
92
|
+
discounts: never[];
|
|
93
|
+
};
|
|
94
|
+
shipments?: undefined;
|
|
95
|
+
quantityInvoiced?: undefined;
|
|
96
|
+
} | {
|
|
97
|
+
token: string;
|
|
98
|
+
email: string;
|
|
99
|
+
shipping_method: string;
|
|
100
|
+
shipments: {
|
|
101
|
+
id: string;
|
|
102
|
+
tracking: {
|
|
103
|
+
title: string;
|
|
104
|
+
number: string;
|
|
105
|
+
carrier: string;
|
|
106
|
+
}[];
|
|
107
|
+
}[];
|
|
108
|
+
shipping_address: {
|
|
109
|
+
firstname: string;
|
|
110
|
+
lastname: string;
|
|
111
|
+
city: string;
|
|
112
|
+
company: string;
|
|
113
|
+
country_code: string;
|
|
114
|
+
region: {
|
|
115
|
+
region: string;
|
|
116
|
+
region_code: string;
|
|
117
|
+
region_id: string;
|
|
118
|
+
};
|
|
119
|
+
telephone: string;
|
|
120
|
+
id: string;
|
|
121
|
+
vat_id: string;
|
|
122
|
+
postcode: string;
|
|
123
|
+
street: string[];
|
|
124
|
+
default_shipping: boolean;
|
|
125
|
+
default_billing: boolean;
|
|
126
|
+
custom_attributesV2: never[];
|
|
127
|
+
shipments?: undefined;
|
|
128
|
+
};
|
|
129
|
+
billing_address: {
|
|
130
|
+
firstname: string;
|
|
131
|
+
lastname: string;
|
|
132
|
+
city: string;
|
|
133
|
+
company: string;
|
|
134
|
+
country_code: string;
|
|
135
|
+
region: {
|
|
136
|
+
region: string;
|
|
137
|
+
region_code: string;
|
|
138
|
+
region_id: string;
|
|
139
|
+
};
|
|
140
|
+
telephone: string;
|
|
141
|
+
id: string;
|
|
142
|
+
vat_id: string;
|
|
143
|
+
postcode: string;
|
|
144
|
+
street: string[];
|
|
145
|
+
default_shipping: boolean;
|
|
146
|
+
default_billing: boolean;
|
|
147
|
+
custom_attributesV2: never[];
|
|
148
|
+
};
|
|
149
|
+
payment_methods: {
|
|
150
|
+
name: string;
|
|
151
|
+
}[];
|
|
152
|
+
number: string;
|
|
153
|
+
quantityInvoiced: number;
|
|
154
|
+
id: string;
|
|
155
|
+
order_date: string;
|
|
156
|
+
carrier: string;
|
|
157
|
+
status: string;
|
|
158
|
+
items: ({
|
|
159
|
+
status: string;
|
|
160
|
+
quantityOrdered: number;
|
|
161
|
+
product_name: string;
|
|
162
|
+
id: string;
|
|
163
|
+
product: {
|
|
164
|
+
small_image: {
|
|
165
|
+
url: string;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
quantityInvoiced?: undefined;
|
|
169
|
+
} | {
|
|
170
|
+
status: string;
|
|
171
|
+
quantityOrdered: number;
|
|
172
|
+
quantityInvoiced: number;
|
|
173
|
+
product_name: string;
|
|
174
|
+
id: string;
|
|
175
|
+
product: {
|
|
176
|
+
small_image: {
|
|
177
|
+
url: string;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
})[];
|
|
181
|
+
total: {
|
|
182
|
+
grand_total: {
|
|
183
|
+
value: number;
|
|
184
|
+
currency: string;
|
|
185
|
+
};
|
|
186
|
+
subtotal: {
|
|
187
|
+
currency: string;
|
|
188
|
+
value: number;
|
|
189
|
+
};
|
|
190
|
+
taxes: never[];
|
|
191
|
+
total_tax: {
|
|
192
|
+
currency: string;
|
|
193
|
+
value: number;
|
|
194
|
+
};
|
|
195
|
+
total_shipping: {
|
|
196
|
+
currency: string;
|
|
197
|
+
value: number;
|
|
198
|
+
};
|
|
199
|
+
discounts: never[];
|
|
200
|
+
};
|
|
201
|
+
})[];
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
//# sourceMappingURL=mockOrdersList.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as l,A as u}from"../chunks/CustomerInformationCard.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";import"@dropins/tools/preact-hooks.js";import"../chunks/removeCustomerAddress.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";export{l as AddressForm,u as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{classes as B}from"@dropins/tools/lib.js";import{a as C}from"../chunks/CustomerInformationCard.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import"../chunks/removeCustomerAddress.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact.js";const O=({hideActionFormButtons:t,formName:o,slots:e,title:i,addressFormTitle:d,defaultSelectAddressId:m,showFormLoader:p,forwardFormRef:a,showSaveCheckBox:c,saveCheckBoxValue:f,selectShipping:n,selectBilling:l,selectable:u,className:r,withHeader:x,minifiedView:A,withActionsInMinifiedView:h,withActionsInFullSizeView:j,inputsDefaultValueSet:v,showShippingCheckBox:W,showBillingCheckBox:b,shippingCheckBoxValue:g,billingCheckBoxValue:k,onAddressData:q,routeAddressesPage:w,onSuccess:y,onError:z})=>s("div",{className:B(["account-addresses",r]),"data-testid":"addressesid",children:s(C,{hideActionFormButtons:t,formName:o,slots:e,title:i,addressFormTitle:d,defaultSelectAddressId:m,showFormLoader:p,onAddressData:q,forwardFormRef:a,selectShipping:n,selectBilling:l,showSaveCheckBox:c,saveCheckBoxValue:f,selectable:u,className:r,withHeader:x,minifiedView:A,withActionsInMinifiedView:h,withActionsInFullSizeView:j,inputsDefaultValueSet:v,billingCheckBoxValue:k,shippingCheckBoxValue:g,showBillingCheckBox:b,showShippingCheckBox:W,routeAddressesPage:w,onSuccess:y,onError:z})});export{O as Addresses,O as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as F,jsx as d,Fragment as ue}from"@dropins/tools/preact-jsx-runtime.js";import{classes as re,Slot as me}from"@dropins/tools/lib.js";import{F as fe,d as he,g as ge,n as D,C as we}from"../chunks/CustomerInformationCard.js";import*as E from"@dropins/tools/preact-compat.js";import{Card as Q,Header as X,InLineAlert as te,InputPassword as R,Button as H}from"@dropins/tools/components.js";import{useState as m,useEffect as B,useCallback as C,useMemo as G}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{a as Ce,u as Pe,g as pe,c as ee,b as be}from"../chunks/updateCustomer.js";import{useText as x}from"@dropins/tools/i18n.js";import{c as Ve}from"../chunks/removeCustomerAddress.js";import"@dropins/tools/preact.js";import"@dropins/tools/fetch-graphql.js";const Ee=e=>E.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},E.createElement("g",{clipPath:"url(#clip0_841_1324)"},E.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),E.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),E.createElement("defs",null,E.createElement("clipPath",{id:"clip0_841_1324"},E.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),ye=e=>E.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},E.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),E.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),Ie=e=>E.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},E.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),E.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),Le=()=>{const[e,t]=m(null);return B(()=>{const a=sessionStorage.getItem("accountStoreConfig"),r=a?JSON.parse(a):null;if(r){const{minLength:n,requiredCharacterClasses:s}=r;t({minLength:n,requiredCharacterClasses:s})}else Ce().then(n=>{if(n){const{minLength:s,requiredCharacterClasses:P}=n;sessionStorage.setItem("accountStoreConfig",JSON.stringify(n)),t({minLength:s,requiredCharacterClasses:P})}})},[]),{passwordConfigs:e}},ve=({currentPassword:e,newPassword:t,confirmPassword:a,translations:r})=>{let n={...K};const s=!e.length&&!t.length&&!a.length,P=e.length&&t!==a;return s?(n={...n,currentPassword:r.requiredFieldError,newPassword:r.requiredFieldError,confirmPassword:r.requiredFieldError},{isValid:!1,errors:n}):e.length?t.length?a.length?P?(n={...n,currentPassword:"",newPassword:"",confirmPassword:r.passwordMismatch},{isValid:!1,errors:n}):{isValid:!0,errors:n}:(n={...n,confirmPassword:r.requiredFieldError},{isValid:!1,errors:n}):(n={...n,newPassword:r.requiredFieldError},{isValid:!1,errors:n}):(n={...n,currentPassword:r.requiredFieldError},{isValid:!1,errors:n})},ne=(e,t)=>{if(t<=1)return!0;const a=/[0-9]/.test(e)?1:0,r=/[a-z]/.test(e)?1:0,n=/[A-Z]/.test(e)?1:0,s=/[^a-zA-Z0-9\s]/.test(e)?1:0;return a+r+n+s>=t},K={currentPassword:"",newPassword:"",confirmPassword:""},Fe=({passwordConfigs:e,handleSetInLineAlert:t,handleHideChangePassword:a})=>{const r=x({requiredFieldError:"Account.FormText.requiredFieldError",passwordMismatch:"Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.passwordMismatch",incorrectCurrentPassword:"Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.incorrectCurrentPassword",passwordUpdateMessage:"Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.passwordUpdateMessage"}),[n,s]=m(!1),[P,l]=m(!1),[c,p]=m(""),[h,u]=m(""),[A,y]=m(""),[I,b]=m({currentPassword:"",newPassword:"",confirmPassword:""}),i=C(()=>{a(()=>{t({}),b(K)})},[a,t]),_=C(f=>{p(f),b(V=>({...V,currentPassword:f?"":r.requiredFieldError}))},[r]),w=C(f=>{u(f),b(V=>({...V,newPassword:f?"":r.requiredFieldError}))},[r]),U=C(f=>{y(f),b(V=>({...V,confirmPassword:f?"":r.requiredFieldError}))},[r]),M=C(f=>{const{name:V,value:Z}=f==null?void 0:f.target;b(L=>({...L,[V]:Z?"":r.requiredFieldError}))},[r]),T=C(()=>{const{isValid:f,errors:V}=ve({currentPassword:c,newPassword:h,confirmPassword:A,translations:r});return b(V),f},[c,h,A,r]),O=C(f=>{f.preventDefault(),l(!0);const V=(e==null?void 0:e.requiredCharacterClasses)??0,Z=(e==null?void 0:e.minLength)??1;if(!T()){s(!0),l(!1);return}if(!ne(h,V)||Z>(h==null?void 0:h.length)){s(!0),l(!1);return}Pe({currentPassword:c,newPassword:h}).then(L=>{if(!(L!=null&&L.length)){l(!1);return}p(""),u(""),y(""),b(K),s(!1),t({type:"success",text:r.passwordUpdateMessage})}).catch(L=>{L.message==="Invalid login or password."&&t({type:"error",text:r.incorrectCurrentPassword}),L.message==="The account is locked."&&t({type:"error",text:L.message})}),l(!1)},[e,T,h,c,t,r]);return{hideChangePassword:i,handleOnBlurPassword:M,handleConfirmPasswordChange:U,handleNewPasswordChange:w,handleCurrentPasswordChange:_,mutationChangePassword:O,currentPassword:c,newPassword:h,confirmPassword:A,passwordErrors:I,submitLoading:P,isClickSubmit:n}},_e=({passwordConfigs:e,isClickSubmit:t,password:a})=>{const r=x({messageLengthPassword:"Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.messageLengthPassword"}),[n,s]=m("pending");B(()=>{if(!e)return;const l=ne(a,e.requiredCharacterClasses);t&&a.length>0?s(l?"success":"error"):t&&a.length===0?s("pending"):s(l?"success":"pending")},[t,e,a]);const P=G(()=>{var c;if(!e)return;const l={status:"pending",icon:"pending",message:(c=r.messageLengthPassword)==null?void 0:c.replace("{minLength}",`${e.minLength}`)};return a.length&&a.length>=e.minLength?{...l,icon:"success",status:"success"}:a.length&&a.length<e.minLength?t?{...l,icon:"error",status:"error"}:{...l,icon:"pending",status:"pending"}:l},[e,r.messageLengthPassword,a==null?void 0:a.length,t]);return{isValidUniqueSymbols:n,defaultLengthMessage:P}},Ae=({handleHideChangePassword:e,handleSetInLineAlert:t,inLineAlertProps:a})=>{const{passwordConfigs:r}=Le(),{hideChangePassword:n,handleOnBlurPassword:s,handleConfirmPasswordChange:P,handleNewPasswordChange:l,handleCurrentPasswordChange:c,mutationChangePassword:p,currentPassword:h,newPassword:u,confirmPassword:A,passwordErrors:y,submitLoading:I,isClickSubmit:b}=Fe({passwordConfigs:r,handleSetInLineAlert:t,handleHideChangePassword:e}),{isValidUniqueSymbols:i,defaultLengthMessage:_}=_e({password:u,isClickSubmit:b,passwordConfigs:r}),w=x({containerTitle:"Account.minifiedView.CustomerInformation.changePassword.containerTitle",currentPasswordPlaceholder:"Account.minifiedView.CustomerInformation.changePassword.currentPassword.placeholder",currentPasswordFloatingLabel:"Account.minifiedView.CustomerInformation.changePassword.currentPassword.floatingLabel",newPasswordPlaceholder:"Account.minifiedView.CustomerInformation.changePassword.newPassword.placeholder",newPasswordFloatingLabel:"Account.minifiedView.CustomerInformation.changePassword.newPassword.floatingLabel",confirmPasswordPlaceholder:"Account.minifiedView.CustomerInformation.changePassword.confirmPassword.placeholder",confirmPasswordFloatingLabel:"Account.minifiedView.CustomerInformation.changePassword.confirmPassword.floatingLabel",buttonSecondary:"Account.minifiedView.CustomerInformation.changePassword.buttonSecondary",buttonPrimary:"Account.minifiedView.CustomerInformation.changePassword.buttonPrimary"});return F(Q,{className:"account-change-password",variant:"secondary",children:[d(X,{title:w.containerTitle,divider:!1,className:"account-change-password__title"}),a.text?d(te,{className:"account-change-password__notification",type:a.type,variant:"secondary",heading:a.text,icon:a.icon,"data-testid":"changePasswordInLineAlert"}):null,F("div",{className:"account-change-password__fields",children:[d(R,{className:"account-change-password__fields-item",autoComplete:"currentPassword",name:"currentPassword",placeholder:w.currentPasswordPlaceholder,floatingLabel:w.currentPasswordFloatingLabel,errorMessage:y.currentPassword,defaultValue:h,onValue:c,onBlur:s}),d(R,{className:"account-change-password__fields-item",autoComplete:"newPassword",name:"newPassword",placeholder:w.newPasswordPlaceholder,floatingLabel:w.newPasswordFloatingLabel,minLength:r==null?void 0:r.minLength,validateLengthConfig:_,uniqueSymbolsStatus:i,requiredCharacterClasses:r==null?void 0:r.requiredCharacterClasses,errorMessage:i==="error"||(_==null?void 0:_.status)==="error"||b&&u.length<=0?y.newPassword:void 0,defaultValue:u,onValue:l,onBlur:s}),d(R,{className:"account-change-password__fields-item",autoComplete:"confirmPassword",name:"confirmPassword",placeholder:w.confirmPasswordPlaceholder,floatingLabel:w.confirmPasswordFloatingLabel,errorMessage:y.confirmPassword,defaultValue:A,onValue:P,onBlur:s})]}),F("div",{className:"account-change-password__actions",children:[d(H,{type:"button",disabled:I,onClick:n,variant:"secondary",children:w.buttonSecondary}),d(H,{variant:"primary",type:"button",disabled:I,onClick:p,children:w.buttonPrimary})]})]})},Me=({inLineAlertProps:e,errorPasswordEmpty:t,passwordValue:a,showPasswordOnEmailChange:r,submitLoading:n,formFieldsList:s,handleHideEditForm:P,handleUpdateCustomerInformation:l,handleInputChange:c,handleSetPassword:p,handleOnBlurPassword:h})=>{const u=x({buttonSecondary:"Account.minifiedView.CustomerInformation.editCustomerInformation.buttonSecondary",buttonPrimary:"Account.minifiedView.CustomerInformation.editCustomerInformation.buttonPrimary",placeholder:"Account.minifiedView.CustomerInformation.editCustomerInformation.passwordField.placeholder",floatingLabel:"Account.minifiedView.CustomerInformation.editCustomerInformation.passwordField.floatingLabel",containerTitle:"Account.minifiedView.CustomerInformation.editCustomerInformation.containerTitle",requiredFieldError:"Account.FormText.requiredFieldError"});return F(Q,{variant:"secondary",className:"account-edit-customer-information",children:[d(X,{title:u.containerTitle,divider:!1,className:"account-edit-customer-information__title"}),e.text?d(te,{className:"account-edit-customer-information__notification",type:e.type,variant:"secondary",heading:e.text,icon:e.icon,"data-testid":"editCustomerInLineAlert"}):null,F(fe,{loading:n,fieldsConfig:s||[],name:"editCustomerInformation",className:"account-edit-customer-information-form",onSubmit:l,setInputChange:c,children:[r?d("div",{className:"account-edit-customer-information__password",children:d(R,{autoComplete:"password",name:"password",placeholder:u.placeholder,floatingLabel:u.floatingLabel,errorMessage:t?u.requiredFieldError:void 0,defaultValue:a,onValue:p,onBlur:h})}):null,F("div",{className:"account-edit-customer-information__actions",children:[d(H,{disabled:n,type:"button",variant:"secondary",onClick:()=>P(),children:u.buttonSecondary}),d(H,{disabled:n,type:"submit",variant:"primary",children:u.buttonPrimary})]})]})]})},Se=({createdAt:e,slots:t,orderedCustomerData:a,showEditForm:r,showChangePassword:n,handleShowChangePassword:s,handleShowEditForm:P})=>{const l=x({buttonSecondary:"Account.minifiedView.CustomerInformation.customerInformationCard.buttonSecondary",buttonPrimary:"Account.minifiedView.CustomerInformation.customerInformationCard.buttonPrimary",accountCreation:"Account.minifiedView.CustomerInformation.customerInformationCard.accountCreation"});return d(Q,{variant:"secondary",className:re(["account-customer-information-card",["account-customer-information-card-short",n||r]]),children:F("div",{className:"account-customer-information-card__wrapper",children:[d("div",{className:"account-customer-information-card__content",children:t!=null&&t.CustomerData?d(me,{name:"CustomerData",slot:t==null?void 0:t.CustomerData,context:{customerData:a}}):F(ue,{children:[a==null?void 0:a.map((c,p)=>{const h=c!=null&&c.label?`${c.label}: ${c==null?void 0:c.value}`:c==null?void 0:c.value;return d("p",{"data-testid":`${c.name}_${p}`,children:h},`${c.name}_${p}`)}),F("p",{children:[l.accountCreation,": ",e]})]})}),F("div",{className:"account-customer-information-card__actions",children:[d(H,{type:"button",variant:"tertiary",onClick:s,children:l.buttonSecondary}),d(H,{type:"button",variant:"tertiary",onClick:P,children:l.buttonPrimary})]})]})})},Ne=({handleSetInLineAlert:e})=>{const t=x({accountSuccess:"Account.minifiedView.CustomerInformation.editCustomerInformation.accountSuccess",accountError:"Account.minifiedView.CustomerInformation.editCustomerInformation.accountError",genderMale:"Account.minifiedView.CustomerInformation.genderMale",genderFemale:"Account.minifiedView.CustomerInformation.genderFemale"}),[a,r]=m(!0),[n,s]=m(!1),[P,l]=m(!1),[c,p]=m(!1),[h,u]=m(!1),[A,y]=m(!1),[I,b]=m([]),[i,_]=m(null),[w,U]=m([]),[M,T]=m({}),[O,f]=m(""),[V,Z]=m(""),L=C(o=>{const{value:g}=o==null?void 0:o.target;g.length&&u(!1),g.length||u(!0)},[]),S=C(o=>{f(o)},[]),oe=C(o=>{T(o)},[]),ae=C(()=>{l(!0),p(!1),e(),S("")},[e,S]),se=C(o=>{o==null||o(),l(!1)},[]),ie=C(()=>{p(!0),l(!1),e(),S("")},[e,S]),ce=C(o=>{o==null||o(),p(!1)},[]),N=C((o,g)=>{o==="success"?e({type:"success",text:g??t.accountSuccess}):o==="error"?e({type:"error",text:g??t.accountError}):e(),s(!1)},[e,t]),W=C(()=>{pe().then(o=>{var v;const g=(v=o==null?void 0:o.createdAt)==null?void 0:v.split(" ")[0],z={...o,gender:o.gender===1?t.genderMale:t.genderFemale};_(z),Z(g)})},[t.genderFemale,t.genderMale]);B(()=>{W()},[]),B(()=>{Ve("customer_account_edit").then(o=>{U(o);const g=o.map(({name:z,customUpperCode:v,orderNumber:q,label:j})=>({name:v,orderNumber:q,label:he.includes(z)?null:j}));b(g)})},[]),B(()=>{M.email&&M.email!==(i==null?void 0:i.email)?y(!0):M.email&&M.email===(i==null?void 0:i.email)&&y(!1)},[i==null?void 0:i.email,M]);const $=G(()=>!I||!i?[]:I.filter(({name:g})=>g!==void 0&&i[g]).map(g=>({name:g.name,orderNumber:g.orderNumber,value:i[g.name],label:g.label})),[i,I]);B(()=>{$!=null&&$.length&&r(!1)},[$]);const de=G(()=>w==null?void 0:w.map(o=>({...o,defaultValue:o!=null&&o.customUpperCode&&i?i[o==null?void 0:o.customUpperCode]??"":""})).map(o=>o.customUpperCode==="gender"?{...o,defaultValue:o.defaultValue==="Male"?1:2}:o),[w,i]),le=C(async(o,g)=>{const z=ge(o.target),{email:v,password:q,...j}=z,Y=v!==(i==null?void 0:i.email)&&q.length===0;if(!g){Y&&u(!0);return}if(u(!1),s(!0),v===(i==null?void 0:i.email)){S(""),ee(D(j,"account")).then(k=>{k&&(W(),N("success"))}).catch(k=>{N("error",k.message)});return}if(Y){u(!0),s(!1);return}v!=null&&v.length&&(q!=null&&q.length)&&be({email:v,password:q}).then(k=>{k&&ee(D(j,"account")).then(J=>{J&&(W(),N("success"))}).catch(J=>{N("error",J.message)})}).catch(k=>{N("error",k.message)})},[i==null?void 0:i.email,S,W,N]);return{createdAt:V,errorPasswordEmpty:h,passwordValue:O,showPasswordOnEmailChange:A,orderedCustomerData:$,loading:a,normalizeFieldsConfig:de,submitLoading:n,showEditForm:c,showChangePassword:P,handleShowChangePassword:ae,handleHideChangePassword:se,handleShowEditForm:ie,handleHideEditForm:ce,handleUpdateCustomerInformation:le,handleInputChange:oe,handleSetPassword:S,handleOnBlurPassword:L,renderAlertMessage:N}},qe={success:d(ye,{}),warning:d(Ee,{}),error:d(Ie,{})},ke=()=>{const[e,t]=m({}),a=C(r=>{if(!(r!=null&&r.type)){t({});return}const n=qe[r.type];t({...r,icon:n})},[]);return{inLineAlertProps:e,handleSetInLineAlert:a}},Re=({className:e,withHeader:t=!0,slots:a})=>{const r=x({containerTitle:"Account.minifiedView.CustomerInformation.containerTitle"}),{inLineAlertProps:n,handleSetInLineAlert:s}=ke(),{createdAt:P,errorPasswordEmpty:l,passwordValue:c,showPasswordOnEmailChange:p,orderedCustomerData:h,loading:u,normalizeFieldsConfig:A,submitLoading:y,showEditForm:I,showChangePassword:b,handleShowChangePassword:i,handleHideChangePassword:_,handleShowEditForm:w,handleHideEditForm:U,handleUpdateCustomerInformation:M,handleInputChange:T,handleSetPassword:O,handleOnBlurPassword:f}=Ne({handleSetInLineAlert:s});return u?d("div",{"data-testid":"customerInformationLoader",children:d(we,{withCard:!0})}):F("div",{className:re(["account-customer-information",e]),children:[t?d(X,{title:r.containerTitle,divider:!1,className:"customer-information__title"}):null,d(Se,{createdAt:P,slots:a,orderedCustomerData:h,showEditForm:I,showChangePassword:b,handleShowChangePassword:i,handleShowEditForm:w}),b?d(Ae,{inLineAlertProps:n,handleSetInLineAlert:s,handleHideChangePassword:_}):null,I?d(Me,{inLineAlertProps:n,submitLoading:y,formFieldsList:A,errorPasswordEmpty:l,passwordValue:c,showPasswordOnEmailChange:p,handleSetPassword:O,handleOnBlurPassword:f,handleUpdateCustomerInformation:M,handleHideEditForm:U,handleInputChange:T}):null]})};export{Re as CustomerInformation,Re as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as t,jsxs as L,Fragment as N}from"@dropins/tools/preact-jsx-runtime.js";import{classes as C,Slot as F}from"@dropins/tools/lib.js";import{S as Y,c as J,E as V,C as W}from"../chunks/CustomerInformationCard.js";import"@dropins/tools/preact-compat.js";import{Card as K,Icon as D,ContentGrid as j,Image as E,Header as G,Picker as U,Pagination as m}from"@dropins/tools/components.js";import{useText as I}from"@dropins/tools/i18n.js";import{useState as v,useEffect as z,useMemo as Q,useCallback as H}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{g as R}from"../chunks/getOrderHistoryList.js";import"../chunks/removeCustomerAddress.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/preact.js";const q={size:"32",stroke:"2"},B=({minifiedView:n,orderNumber:r,orderToken:e,routeOrdersList:a,routeOrderDetails:d})=>{const i=n?"minifiedView":"fullSizeView",h=I({viewAllOrdersButton:`Account.${i}.OrdersList.viewAllOrdersButton`,ariaLabelLink:`Account.${i}.OrdersList.ariaLabelLink`});return a?t("a",{className:C(["account-orders-list-action",["account-orders-list-action--minifiedView",n]]),"data-testid":"ordersListActionButtonMinifiedView",href:a(),children:t(K,{"data-testid":"ordersListActionMinifiedView",variant:"secondary",children:L("div",{className:"account-orders-list-action__card-wrapper",children:[t("p",{children:h.viewAllOrdersButton}),t(D,{source:Y,...q})]})})}):t("a",{"aria-label":`${h.ariaLabelLink} ${r??e}`,href:J(d)?d(r,e):"#",className:"account-orders-list-action","data-testid":"ordersListActionButton",children:t(D,{source:Y,...q})})},X=()=>{const[n,r]=v(window.innerWidth<768);return z(()=>{const e=()=>{r(window.innerWidth<768)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n},Z=({minifiedView:n,item:r,withThumbnails:e,children:a,slots:d,routeTracking:i,routeOrderProduct:h,routeReturnDetails:O,...A})=>{var S,y,$,_,k,w,x,M,g;const p=n?"minifiedView":"fullSizeView",o=I({orderNumber:`Account.${p}.OrdersList.OrdersListCard.orderNumber`,itemsAmount:`Account.${p}.OrdersList.OrdersListCard.itemsAmount`,carrier:`Account.${p}.OrdersList.OrdersListCard.carrier`,returnsText:`Account.${p}.OrdersList.OrdersListCard.returns`,deliveryDateText:`Account.${p}.OrdersList.OrdersListCard.orderDate`}),f=X(),c=J(h);return L(K,{variant:"secondary",...A,className:C(["account-orders-list-card",["account-orders-list-card--full",((S=r==null?void 0:r.items)==null?void 0:S.length)>6]]),children:[t("div",{className:"account-orders-list-card__content",children:d!=null&&d.OrdersListCard?t(F,{"data-testid":`ordersListCard${r.id}`,name:"OrdersListCard",slot:d==null?void 0:d.OrdersListCard,context:{orderHistoryListItem:r}}):L(N,{children:[t("div",{children:r==null?void 0:r.status}),L("p",{children:[o.deliveryDateText," ",r==null?void 0:r.orderDate]}),L("p",{children:[o.orderNumber," ",r.number]}),(y=r==null?void 0:r.shipments)==null?void 0:y.map(s=>{var l;return(l=s==null?void 0:s.tracking)==null?void 0:l.map(u=>{const b=i==null?void 0:i(u);return L("p",{"data-testid":u.number,children:[t("span",{children:`${o.carrier} ${u.carrier.toLocaleUpperCase()} `}),b?t("a",{href:b,target:"_blank",className:"account-orders-list-card__content--track_number",rel:"noreferrer",children:u.number}):t("span",{className:"account-orders-list-card__content--track_number",children:u.number})]},s.id)})}),r!=null&&r.returns&&(($=r.returns)!=null&&$.length)?L("p",{"data-testid":r.number,children:[L("span",{children:[o.returnsText," "]}),(_=r==null?void 0:r.returns)==null?void 0:_.map(s=>t("span",{"data-testid":s.number,children:L("a",{href:(O==null?void 0:O({orderNumber:r.number,orderToken:r.token,returnNumber:s.number}))??"#",className:"account-orders-list-card__content--return_number",children:[s.number," "]})},s.uid))]},r.id):null,L("p",{children:["$",(k=r==null?void 0:r.total)==null?void 0:k.grandTotal.value]}),L("p",{"data-testid":"itemsAmount",children:[(w=r==null?void 0:r.items)!=null&&w.length?(x=r==null?void 0:r.items)==null?void 0:x.reduce((s,l)=>{const u=(l==null?void 0:l.quantityOrdered)||0;return s+u},0):0," ",o.itemsAmount]}),(M=r==null?void 0:r.items)==null?void 0:M.map((s,l)=>{if(l>=0&&l<10)return L("p",{className:"account-orders-list-card__content--product-name",children:[L("span",{className:"account-orders-list-card__content--quantity",children:[(s==null?void 0:s.quantityOrdered)>1?s==null?void 0:s.quantityOrdered:null," "]}),s==null?void 0:s.productName.replaceAll("-"," ")]},`${l}_${s.id}`);if(l===11)return t("p",{children:"..."},"ellipsis")})]})}),e&&((g=r==null?void 0:r.items)!=null&&g.length)?t(j,{maxColumns:f?3:9,emptyGridContent:t(N,{}),className:C(["account-orders-list-card__images",["account-orders-list-card__images-3",f]]),"data-testid":"ordersListCardImages",children:r.items.map((s,l)=>{var T;const u=(T=s==null?void 0:s.product)==null?void 0:T.smallImage.url,b=s==null?void 0:s.productName;return c?t("a",{href:h==null?void 0:h(s),target:"_blank",rel:"noreferrer",children:t(E,{src:u,width:65,height:65,alt:b})},s.id+l):t(E,{src:u,width:65,height:65,alt:b},s.id+l)})}):null,t("div",{className:"account-orders-list-card__actions",children:a})]})},rr=({ordersInMinifiedView:n,minifiedView:r,pageSize:e,selectedDate:a,selectedPage:d,handleSetFirstOrderDate:i})=>{const[h,O]=v([]),[A,p]=v({totalPages:1,currentPage:1,pageSize:1}),[o,f]=v(!1);return z(()=>{f(!0),R(r?n:e,a,d).then(c=>{!c||!c.items||(p(c.pageInfo),O(c.items),i==null||i(c.dateOfFirstOrder))}).finally(()=>{f(!1)})},[i,r,n,e,a,d]),{loading:o,orderHistoryListItems:h,pageInfo:A}},P=(n,r=1)=>{const e=new Date,a=new Date(e);switch(n){case"sixMonthsAgo":{a.setMonth(a.getMonth()-r);break}case"oneYearAgo":{a.setFullYear(a.getFullYear()-r);break}default:return""}return{from:a==null?void 0:a.toISOString().split("T")[0],to:`${e==null?void 0:e.toISOString().split("T")[0]} 23:59:59`}},tr=n=>{const r=[],e=new Date().getFullYear();for(let a=n;a<=e-1;a++)r.push({value:`{"from":"${a}-01-01","to":"${a+1}-01-01 23:59:59"}`,text:a.toString()});return r},sr=()=>{const n=I({pastSixMonths:"Account.fullSizeView.OrdersList.OrdersListSelectDate.pastSixMonths",currentYear:"Account.fullSizeView.OrdersList.OrdersListSelectDate.currentYear",viewAll:"Account.fullSizeView.OrdersList.OrdersListSelectDate.viewAll"}),[r,e]=v(),[a,d]=v(JSON.stringify(P("sixMonthsAgo",6))),[i,h]=v(1);z(()=>{window==null||window.scrollTo({top:100,behavior:"smooth"})},[i]);const O=Q(()=>{const o=[{value:JSON.stringify(P("sixMonthsAgo",6)),text:n.pastSixMonths},{value:JSON.stringify(P("oneYearAgo",1)),text:n.currentYear},{value:"viewAll",text:n.viewAll}];if(r){const c=new Date(r).getFullYear();o==null||o.splice(2,0,...tr(c))}return o},[n,r]),A=H(o=>{e(o)},[]),p=H(o=>{const c=o.target.value;d(c),h(1)},[]);return{selectableDateList:O,selectedDate:a,selectedPage:i,handleSelectDate:p,setSelectedPage:h,handleSetFirstOrderDate:A}},er=({className:n,withHeader:r=!0,minifiedView:e=!1,withThumbnails:a=!0,withFilter:d=!0,ordersInMinifiedView:i=1,pageSize:h=10,routeOrdersList:O,routeOrderDetails:A,routeReturnDetails:p,routeTracking:o,routeOrderProduct:f,slots:c})=>{const S=e?"minifiedView":"fullSizeView",y=I({containerTitle:`Account.${S}.OrdersList.containerTitle`,dateOrderPlaced:`Account.${S}.OrdersList.dateOrderPlaced`}),{selectableDateList:$,selectedDate:_,handleSelectDate:k,selectedPage:w,setSelectedPage:x,handleSetFirstOrderDate:M}=sr(),{pageInfo:g,loading:s,orderHistoryListItems:l}=rr({minifiedView:e,pageSize:h,ordersInMinifiedView:i,selectedDate:_,selectedPage:w,handleSetFirstOrderDate:M});return L("div",{children:[r?t(G,{"aria-label":y.containerTitle,role:"region",title:y.containerTitle,divider:!e,className:e?"account-orders-list-header":""}):null,L("div",{className:C(["account-orders-list",n]),children:[!e&&d?L("div",{className:"account-orders-list__date-select",children:[t("span",{children:y.dateOrderPlaced}),t(U,{value:_,name:"orderDatePicker",options:$,handleSelect:k})]}):null,s?t(N,{children:Array.from(Array(g==null?void 0:g.pageSize).keys()).map(u=>t(W,{testId:"orderSkeletonLoader",withCard:!1},u))}):t(N,{children:l.length?t(N,{children:l.map((u,b)=>t(Z,{routeTracking:o,routeOrderProduct:f,routeReturnDetails:p,minifiedView:e,item:u,withThumbnails:a,slots:c,children:c!=null&&c.OrdersListAction?t(F,{"data-testid":`ordersListActionSlot_${b}`,name:"OrdersListAction",slot:c==null?void 0:c.OrdersListAction,context:{orderHistoryListItem:u}}):t(B,{minifiedView:e,orderNumber:u.number,orderToken:u.token,routeOrderDetails:A})},b))}):t(V,{isEmpty:!l.length,typeList:"orders",minifiedView:e})}),!e&&(g==null?void 0:g.totalPages)>1?t(m,{totalPages:g==null?void 0:g.totalPages,currentPage:w,onChange:x}):null,e?t(B,{minifiedView:e,routeOrdersList:O}):null]})]})},Or=({className:n,withHeader:r,minifiedView:e,withThumbnails:a,withFilter:d,ordersInMinifiedView:i,pageSize:h,routeOrdersList:O,routeOrderDetails:A,routeReturnDetails:p,routeTracking:o,routeOrderProduct:f,slots:c})=>t("div",{className:C(["account-orders-list",n]),"data-testid":"ordersListId",children:t(er,{className:n,withHeader:r,minifiedView:e,withThumbnails:a,withFilter:d,ordersInMinifiedView:i,pageSize:h,routeOrdersList:O,routeOrderDetails:A,routeReturnDetails:p,routeTracking:o,routeOrderProduct:f,slots:c})});export{Or as OrdersList,Or as default};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare enum FieldEnumList {
|
|
2
|
+
BOOLEAN = "BOOLEAN",
|
|
3
|
+
DATE = "DATE",
|
|
4
|
+
DATETIME = "DATETIME",
|
|
5
|
+
DROPDOWN = "DROPDOWN",
|
|
6
|
+
FILE = "FILE",
|
|
7
|
+
GALLERY = "GALLERY",
|
|
8
|
+
HIDDEN = "HIDDEN",
|
|
9
|
+
IMAGE = "IMAGE",
|
|
10
|
+
MEDIA_IMAGE = "MEDIA_IMAGE",
|
|
11
|
+
MULTILINE = "MULTILINE",
|
|
12
|
+
MULTISELECT = "MULTISELECT",
|
|
13
|
+
PRICE = "PRICE",
|
|
14
|
+
SELECT = "SELECT",
|
|
15
|
+
TEXT = "TEXT",
|
|
16
|
+
TEXTAREA = "TEXTAREA",
|
|
17
|
+
UNDEFINED = "UNDEFINED",
|
|
18
|
+
VISUAL = "VISUAL",
|
|
19
|
+
WEIGHT = "WEIGHT",
|
|
20
|
+
EMPTY = ""
|
|
21
|
+
}
|
|
22
|
+
export interface AttributesFormItemsProps {
|
|
23
|
+
code?: string;
|
|
24
|
+
name?: string;
|
|
25
|
+
id?: string;
|
|
26
|
+
required?: boolean;
|
|
27
|
+
label?: string;
|
|
28
|
+
options?: {
|
|
29
|
+
is_default: boolean;
|
|
30
|
+
label: string;
|
|
31
|
+
value: string;
|
|
32
|
+
}[];
|
|
33
|
+
entityType?: string;
|
|
34
|
+
className?: string;
|
|
35
|
+
defaultValue?: string | boolean | number;
|
|
36
|
+
fieldType?: FieldEnumList;
|
|
37
|
+
multilineCount?: number;
|
|
38
|
+
isUnique?: boolean;
|
|
39
|
+
orderNumber: number;
|
|
40
|
+
isHidden?: boolean;
|
|
41
|
+
customUpperCode: string;
|
|
42
|
+
validateRules: Record<string, string>[];
|
|
43
|
+
}
|
|
44
|
+
export interface AttributesFormModel extends AttributesFormItemsProps {
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=attributes-form.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface CustomerAddressesModel {
|
|
2
|
+
firstName?: string;
|
|
3
|
+
lastName?: string;
|
|
4
|
+
city?: string;
|
|
5
|
+
company?: string;
|
|
6
|
+
countryCode?: string;
|
|
7
|
+
region?: {
|
|
8
|
+
region: string;
|
|
9
|
+
regionCode: string;
|
|
10
|
+
regionId: string | number;
|
|
11
|
+
};
|
|
12
|
+
telephone?: string;
|
|
13
|
+
id?: string;
|
|
14
|
+
vatId?: string;
|
|
15
|
+
postcode?: string;
|
|
16
|
+
street?: string;
|
|
17
|
+
streetMultiline_2?: string;
|
|
18
|
+
defaultShipping?: boolean;
|
|
19
|
+
defaultBilling?: boolean;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=customer-address.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface CustomerDataModelShort {
|
|
2
|
+
firstName: string;
|
|
3
|
+
lastName: string;
|
|
4
|
+
middleName: string;
|
|
5
|
+
dateOfBirth: string;
|
|
6
|
+
dob: string;
|
|
7
|
+
prefix: string;
|
|
8
|
+
gender: 1 | 2 | string;
|
|
9
|
+
suffix: string;
|
|
10
|
+
email: string;
|
|
11
|
+
createdAt: string;
|
|
12
|
+
[key: string]: string | boolean | number;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=customer.d.ts.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { CustomerAddressesModel } from './customer-address';
|
|
2
|
+
import { ReturnProps } from '../../types';
|
|
3
|
+
|
|
4
|
+
export type ProductImage = {
|
|
5
|
+
url: string;
|
|
6
|
+
};
|
|
7
|
+
export type Product = {
|
|
8
|
+
smallImage: ProductImage;
|
|
9
|
+
};
|
|
10
|
+
export type OrderItem = {
|
|
11
|
+
quantityOrdered?: number;
|
|
12
|
+
quantityShipped?: number;
|
|
13
|
+
quantityInvoiced?: number;
|
|
14
|
+
status: string;
|
|
15
|
+
productName: string;
|
|
16
|
+
id: string;
|
|
17
|
+
product: Product;
|
|
18
|
+
};
|
|
19
|
+
export type PaymentMethod = {
|
|
20
|
+
name: string;
|
|
21
|
+
};
|
|
22
|
+
export type MoneyAmount = {
|
|
23
|
+
value: number;
|
|
24
|
+
currency: string;
|
|
25
|
+
};
|
|
26
|
+
export type Discount = {
|
|
27
|
+
amount: MoneyAmount;
|
|
28
|
+
label: string;
|
|
29
|
+
};
|
|
30
|
+
export type Tax = {
|
|
31
|
+
amount: MoneyAmount;
|
|
32
|
+
rate: number;
|
|
33
|
+
title: string;
|
|
34
|
+
};
|
|
35
|
+
export type OrderTotals = {
|
|
36
|
+
discounts: Discount[];
|
|
37
|
+
grandTotal: MoneyAmount;
|
|
38
|
+
subtotal: MoneyAmount;
|
|
39
|
+
taxes: Tax[];
|
|
40
|
+
totalTax: MoneyAmount;
|
|
41
|
+
totalShipping: MoneyAmount;
|
|
42
|
+
};
|
|
43
|
+
export type ShipmentsTracingModel = {
|
|
44
|
+
carrier: string;
|
|
45
|
+
number: string;
|
|
46
|
+
title: string;
|
|
47
|
+
};
|
|
48
|
+
export type ShipmentsModel = {
|
|
49
|
+
id: string;
|
|
50
|
+
number: string;
|
|
51
|
+
tracking: ShipmentsTracingModel[];
|
|
52
|
+
};
|
|
53
|
+
export type OrderDetails = {
|
|
54
|
+
status: string;
|
|
55
|
+
token: string;
|
|
56
|
+
carrier: string;
|
|
57
|
+
email: string;
|
|
58
|
+
id: string;
|
|
59
|
+
number: string;
|
|
60
|
+
orderDate: string;
|
|
61
|
+
items: OrderItem[];
|
|
62
|
+
returns: ReturnProps[];
|
|
63
|
+
shipments: ShipmentsModel[];
|
|
64
|
+
paymentMethods: PaymentMethod[];
|
|
65
|
+
shippingAddress: CustomerAddressesModel;
|
|
66
|
+
billingAddress: CustomerAddressesModel;
|
|
67
|
+
total: OrderTotals;
|
|
68
|
+
};
|
|
69
|
+
export type PaginationInfo = {
|
|
70
|
+
currentPage: number;
|
|
71
|
+
pageSize: number;
|
|
72
|
+
totalPages: number;
|
|
73
|
+
};
|
|
74
|
+
export interface OrderHistory {
|
|
75
|
+
items: OrderDetails[];
|
|
76
|
+
pageInfo: PaginationInfo;
|
|
77
|
+
totalCount: number;
|
|
78
|
+
dateOfFirstOrder: string;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=order-history-list.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './transform-attributes-form';
|
|
2
|
+
export * from './transform-customer-address';
|
|
3
|
+
export * from './transform-customer';
|
|
4
|
+
export * from './transform-countries';
|
|
5
|
+
export * from './transform-regions';
|
|
6
|
+
export * from './transform-order-history-list';
|
|
7
|
+
export * from './transform-store-config';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { GetAttributesFormResponse, ResponseAttributesFormItemsProps } from '../../types';
|
|
2
|
+
import { AttributesFormModel } from '../models';
|
|
3
|
+
|
|
4
|
+
export declare const cloneArrayIfExists: (fields: ResponseAttributesFormItemsProps[]) => any;
|
|
5
|
+
export declare const transformAttributesForm: (response: GetAttributesFormResponse) => AttributesFormModel[];
|
|
6
|
+
//# sourceMappingURL=transform-attributes-form.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CountriesFormResponse } from '../../types';
|
|
2
|
+
import { Country } from '../models';
|
|
3
|
+
|
|
4
|
+
export declare const transformCountries: (response: CountriesFormResponse) => {
|
|
5
|
+
availableCountries: Country[] | [
|
|
6
|
+
];
|
|
7
|
+
countriesWithRequiredRegion: string[];
|
|
8
|
+
optionalZipCountries: string[];
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=transform-countries.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CustomerAddressesModel } from '../models';
|
|
2
|
+
import { AddressResponse, UserAddressesProps } from '../../types';
|
|
3
|
+
|
|
4
|
+
export declare const transformSingleAddress: (addressData: UserAddressesProps) => CustomerAddressesModel;
|
|
5
|
+
export declare const transformMultipleAddresses: (response: AddressResponse) => CustomerAddressesModel[] | [
|
|
6
|
+
];
|
|
7
|
+
//# sourceMappingURL=transform-customer-address.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { getCustomerShortResponse } from '../../types';
|
|
2
|
+
import { CustomerDataModelShort } from '../models/customer';
|
|
3
|
+
|
|
4
|
+
export declare const transformCustomer: (response: getCustomerShortResponse) => CustomerDataModelShort;
|
|
5
|
+
//# sourceMappingURL=transform-customer.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { OrderHistoryListResponse } from '../../types';
|
|
2
|
+
import { OrderHistory } from '../models';
|
|
3
|
+
|
|
4
|
+
export declare const transformOrderHistoryList: (response: OrderHistoryListResponse) => OrderHistory | null;
|
|
5
|
+
//# sourceMappingURL=transform-order-history-list.d.ts.map
|