@sonic-equipment/ui 185.0.0 → 187.0.0
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/dist/address-info-display/address-info-display.d.ts +2 -2
- package/dist/address-info-display/address-info-display.js +1 -1
- package/dist/algolia/algolia-multi-select-filter-section.js +1 -1
- package/dist/algolia/algolia-sort-by.js +1 -1
- package/dist/buttons/add-to-cart-button/add-to-cart-button.js +1 -1
- package/dist/collapsables/accordion/accordion-item.js +2 -1
- package/dist/collapsables/accordion/accordion.module.css.js +1 -1
- package/dist/country-select/country-select.js +1 -1
- package/dist/country-select/hooks/use-countries.js +1 -0
- package/dist/country-selector/country-selector-dialog/country-selector-dialog.js +1 -1
- package/dist/exports.d.ts +24 -22
- package/dist/filters/pagination/pagination.js +1 -1
- package/dist/footer/connected-footer.d.ts +2 -1
- package/dist/footer/connected-footer.js +2 -2
- package/dist/footer/footer.d.ts +2 -1
- package/dist/footer/footer.js +6 -5
- package/dist/footer/footer.module.css.js +1 -1
- package/dist/forms/elements/checkbox/checkbox.module.css.js +3 -0
- package/dist/forms/{field-error → elements/field-error}/field-error.js +1 -1
- package/dist/forms/elements/field-error/field-error.module.css.js +3 -0
- package/dist/forms/elements/input/input.module.css.js +3 -0
- package/dist/forms/elements/label/label.module.css.js +3 -0
- package/dist/forms/{select → elements/select}/select.js +3 -3
- package/dist/forms/elements/select/select.module.css.js +3 -0
- package/dist/forms/elements/switch/switch.module.css.js +3 -0
- package/dist/forms/elements/textarea/textarea.module.css.js +3 -0
- package/dist/forms/{checkbox-field → fields/checkbox-field}/checkbox-field.d.ts +2 -2
- package/dist/forms/{checkbox-field → fields/checkbox-field}/checkbox-field.js +4 -4
- package/dist/forms/fields/checkbox-field/checkbox-field.module.css.js +3 -0
- package/dist/forms/{number-field → fields/number-field}/number-field.d.ts +1 -1
- package/dist/forms/{number-field → fields/number-field}/number-field.js +8 -8
- package/dist/forms/fields/number-field/number-field.module.css.js +3 -0
- package/dist/forms/{search-field → fields/search-field}/search-field.js +3 -3
- package/dist/forms/{select-field → fields/select-field}/select-field.d.ts +1 -1
- package/dist/forms/{select-field → fields/select-field}/select-field.js +7 -7
- package/dist/forms/fields/select-field/select-field.module.css.js +3 -0
- package/dist/forms/{switch-field → fields/switch-field}/switch-field.d.ts +2 -2
- package/dist/forms/{switch-field → fields/switch-field}/switch-field.js +4 -4
- package/dist/forms/fields/switch-field/switch-field.module.css.js +3 -0
- package/dist/forms/{text-field → fields/text-field}/password-reveal-toggle/password-reveal-toggle.js +3 -3
- package/dist/forms/{text-field → fields/text-field}/password-reveal-toggle/password-reveal-toggle.module.css.js +1 -1
- package/dist/forms/{text-field → fields/text-field}/text-field.d.ts +1 -1
- package/dist/forms/{text-field → fields/text-field}/text-field.js +6 -6
- package/dist/forms/fields/text-field/text-field.module.css.js +3 -0
- package/dist/forms/layout/form/form-field-layout.module.css.js +3 -0
- package/dist/forms/layout/form/form-segment-group.module.css.js +3 -0
- package/dist/forms/layout/form/form-segment.module.css.js +3 -0
- package/dist/forms/{form → layout/form}/form.js +3 -3
- package/dist/forms/layout/form/form.module.css.js +3 -0
- package/dist/forms/partials/edit-address-form/edit-address-form.d.ts +8 -0
- package/dist/forms/partials/edit-address-form/edit-address-form.js +35 -0
- package/dist/forms/partials/edit-address-form/edit-address-form.module.css.js +3 -0
- package/dist/forms/{password-validation → partials/password-validation}/password-validation.js +4 -4
- package/dist/index.js +24 -22
- package/dist/intl/formatted-message.js +5 -1
- package/dist/intl/translation-id.d.ts +1 -1
- package/dist/intl/types.d.ts +6 -1
- package/dist/modals/dialog/dialog.d.ts +1 -1
- package/dist/modals/dialog/dialog.js +1 -1
- package/dist/modals/favorite/add-to-favorite-dialog.js +2 -2
- package/dist/modals/recover-password/recover-password-dialog.js +1 -1
- package/dist/pages/account/components/create-account-form/create-account-form.js +7 -7
- package/dist/pages/account/components/sign-in-form/sign-in-form.js +6 -6
- package/dist/pages/checkout/components/billing-and-invoice-information.d.ts +3 -3
- package/dist/pages/checkout/components/billing-and-invoice-information.js +1 -1
- package/dist/pages/checkout/order-confirmation-page/order-confirmation-page-content.js +26 -20
- package/dist/pages/checkout/payment-page/components/adyen-payment.js +8 -2
- package/dist/pages/checkout/payment-page/components/payment.d.ts +1 -2
- package/dist/pages/checkout/payment-page/components/payment.js +31 -98
- package/dist/pages/checkout/payment-page/payment-page-content.d.ts +1 -3
- package/dist/pages/checkout/payment-page/payment-page-content.js +3 -3
- package/dist/pages/checkout/payment-page/payment-page.js +1 -2
- package/dist/pages/checkout/shipping-page/components/{edit-address-form.d.ts → edit-checkout-bill-to-address-form.d.ts} +3 -17
- package/dist/pages/checkout/shipping-page/components/edit-checkout-bill-to-address-form.js +49 -0
- package/dist/pages/checkout/shipping-page/components/edit-checkout-bill-to-address-form.module.css.js +3 -0
- package/dist/pages/checkout/shipping-page/components/readonly-address.js +7 -5
- package/dist/pages/checkout/shipping-page/shipping-page-content.js +2 -2
- package/dist/pages/checkout/shipping-page/shipping-page.js +2 -2
- package/dist/pages/my-sonic/actions/change-customer/change-customer.js +2 -2
- package/dist/pages/my-sonic/actions/change-password/change-password-dialog.js +1 -1
- package/dist/pages/my-sonic/actions/change-password/change-password.js +3 -3
- package/dist/pages/my-sonic/actions/edit-bill-to-address/edit-bill-to-address.d.ts +1 -0
- package/dist/pages/my-sonic/actions/edit-bill-to-address/edit-bill-to-address.js +8 -0
- package/dist/pages/my-sonic/actions/edit-user-info/edit-user-info-dialog.d.ts +1 -1
- package/dist/pages/my-sonic/actions/edit-user-info/edit-user-info.js +1 -1
- package/dist/pages/my-sonic/navigation/my-sonic-mobile-navigation.js +1 -1
- package/dist/pages/product/product-details-page/components/product-details-panel/product-details-panel.js +1 -1
- package/dist/pages/product/product-details-page/components/product-details-panel/product-details-panel.module.css.js +1 -1
- package/dist/shared/data/countries-languages.data.js +4 -0
- package/dist/shared/model/address.d.ts +27 -12
- package/dist/shared/model/countries-languages.d.ts +1 -0
- package/dist/shared/utils/price.d.ts +1 -1
- package/dist/styles.css +1409 -1330
- package/package.json +1 -1
- package/dist/forms/checkbox/checkbox.module.css.js +0 -3
- package/dist/forms/checkbox-field/checkbox-field.module.css.js +0 -3
- package/dist/forms/field-error/field-error.module.css.js +0 -3
- package/dist/forms/form/form-field-layout.module.css.js +0 -3
- package/dist/forms/form/form-segment-group.module.css.js +0 -3
- package/dist/forms/form/form-segment.module.css.js +0 -3
- package/dist/forms/form/form.module.css.js +0 -3
- package/dist/forms/input/input.module.css.js +0 -3
- package/dist/forms/label/label.module.css.js +0 -3
- package/dist/forms/number-field/number-field.module.css.js +0 -3
- package/dist/forms/select/select.module.css.js +0 -3
- package/dist/forms/select-field/select-field.module.css.js +0 -3
- package/dist/forms/switch/switch.module.css.js +0 -3
- package/dist/forms/switch-field/switch-field.module.css.js +0 -3
- package/dist/forms/text-field/text-field.module.css.js +0 -3
- package/dist/forms/textarea/textarea.module.css.js +0 -3
- package/dist/pages/checkout/shipping-page/components/edit-address-form.js +0 -68
- package/dist/pages/checkout/shipping-page/components/edit-address-form.module.css.js +0 -3
- /package/dist/forms/{checkbox → elements/checkbox}/checkbox.d.ts +0 -0
- /package/dist/forms/{checkbox → elements/checkbox}/checkbox.js +0 -0
- /package/dist/forms/{color-checkbox → elements/color-checkbox}/color-checkbox.d.ts +0 -0
- /package/dist/forms/{color-checkbox → elements/color-checkbox}/color-checkbox.js +0 -0
- /package/dist/forms/{field-error → elements/field-error}/field-error.d.ts +0 -0
- /package/dist/forms/{input → elements/input}/input.d.ts +0 -0
- /package/dist/forms/{input → elements/input}/input.js +0 -0
- /package/dist/forms/{label → elements/label}/label.d.ts +0 -0
- /package/dist/forms/{label → elements/label}/label.js +0 -0
- /package/dist/forms/{select → elements/select}/select.d.ts +0 -0
- /package/dist/forms/{switch → elements/switch}/switch.d.ts +0 -0
- /package/dist/forms/{switch → elements/switch}/switch.js +0 -0
- /package/dist/forms/{textarea → elements/textarea}/textarea.d.ts +0 -0
- /package/dist/forms/{textarea → elements/textarea}/textarea.js +0 -0
- /package/dist/forms/{password-field → fields/password-field}/password-field.d.ts +0 -0
- /package/dist/forms/{password-field → fields/password-field}/password-field.js +0 -0
- /package/dist/forms/{search-field → fields/search-field}/search-field.d.ts +0 -0
- /package/dist/forms/{text-field → fields/text-field}/password-reveal-toggle/password-reveal-toggle.d.ts +0 -0
- /package/dist/forms/{form → layout/form}/form-field-layout.d.ts +0 -0
- /package/dist/forms/{form → layout/form}/form-field-layout.js +0 -0
- /package/dist/forms/{form → layout/form}/form-segment-group.d.ts +0 -0
- /package/dist/forms/{form → layout/form}/form-segment-group.js +0 -0
- /package/dist/forms/{form → layout/form}/form-segment.d.ts +0 -0
- /package/dist/forms/{form → layout/form}/form-segment.js +0 -0
- /package/dist/forms/{form → layout/form}/form.d.ts +0 -0
- /package/dist/forms/{password-validation → partials/password-validation}/password-validation.d.ts +0 -0
|
@@ -6,9 +6,9 @@ import { useAlgoliaInsights } from '../../../../algolia/use-algolia-insights.js'
|
|
|
6
6
|
import { Accordion } from '../../../../collapsables/accordion/accordion.js';
|
|
7
7
|
import { AccordionItem } from '../../../../collapsables/accordion/accordion-item.js';
|
|
8
8
|
import { InfoDisplay } from '../../../../display/info-display/info-display.js';
|
|
9
|
-
import { Checkbox } from '../../../../forms/checkbox/checkbox.js';
|
|
10
|
-
import { Select } from '../../../../forms/select/select.js';
|
|
11
|
-
import { TextField } from '../../../../forms/text-field/text-field.js';
|
|
9
|
+
import { Checkbox } from '../../../../forms/elements/checkbox/checkbox.js';
|
|
10
|
+
import { Select } from '../../../../forms/elements/select/select.js';
|
|
11
|
+
import { TextField } from '../../../../forms/fields/text-field/text-field.js';
|
|
12
12
|
import { InfoIconTooltip } from '../../../../info-icon-tooltip/info-icon-tooltip.js';
|
|
13
13
|
import { FormattedMessage } from '../../../../intl/formatted-message.js';
|
|
14
14
|
import { isCountryCode } from '../../../../intl/types.js';
|
|
@@ -18,7 +18,6 @@ import { useInvalidateCurrentCart } from '../../../../shared/api/storefront/hook
|
|
|
18
18
|
import { usePatchCart } from '../../../../shared/api/storefront/hooks/cart/use-patch-cart.js';
|
|
19
19
|
import { usePlaceOrder } from '../../../../shared/api/storefront/hooks/cart/use-place-order.js';
|
|
20
20
|
import { useInvalidateAdyen } from '../../../../shared/api/storefront/hooks/payment/use-invalidate-adyen.js';
|
|
21
|
-
import { validateVATNumber } from '../../../../shared/api/storefront/services/finance-service.js';
|
|
22
21
|
import { useDataLayer } from '../../../../shared/ga/use-data-layer.js';
|
|
23
22
|
import { getCurrencyCodeBySymbol } from '../../../../shared/model/currency.js';
|
|
24
23
|
import { environment } from '../../../../shared/utils/environment.js';
|
|
@@ -27,7 +26,7 @@ import { useHasReturnedFromAdyen } from '../hooks/use-has-returned-from-adyen.js
|
|
|
27
26
|
import { AdyenPayment } from './adyen-payment.js';
|
|
28
27
|
import styles from './payment.module.css.js';
|
|
29
28
|
|
|
30
|
-
function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPaymentComplete, onProcessing,
|
|
29
|
+
function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPaymentComplete, onProcessing, }) {
|
|
31
30
|
const { createEcommerceEvent, dataLayer } = useDataLayer();
|
|
32
31
|
const { mutate: patchCart } = usePatchCart();
|
|
33
32
|
const { mutate: placeOrder } = usePlaceOrder();
|
|
@@ -49,7 +48,6 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
|
|
|
49
48
|
throw new Error(`Country code not found for cart with country abbreviation: ${_cart.billTo?.country?.abbreviation}`);
|
|
50
49
|
const countryCode = _cart.billTo.country.abbreviation;
|
|
51
50
|
const currencyCode = getCurrencyCodeBySymbol(cart.currencySymbol);
|
|
52
|
-
const lastVATNumber = useRef(cart.customerVatNumber);
|
|
53
51
|
if (!currencyCode)
|
|
54
52
|
throw new Error(`Currency code not found for cart with currency symbol: ${cart.currencySymbol}`);
|
|
55
53
|
const isAdyenPayment = selectedPaymentMethod === 'ADY' &&
|
|
@@ -66,7 +64,6 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
|
|
|
66
64
|
cartRef.current = _cart;
|
|
67
65
|
}, [_cart]);
|
|
68
66
|
const [validationErrors, setValidationErrors] = useState({});
|
|
69
|
-
const [customerVatNumber, setCustomerVatNumber] = useState(cart.customerVatNumber);
|
|
70
67
|
const atpSelectOptions = atp
|
|
71
68
|
.filter(atp => Boolean(atp.date))
|
|
72
69
|
.reduce((acc, atp) => ({
|
|
@@ -77,72 +74,6 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
|
|
|
77
74
|
acc[method.name] = t(`paymentMethod.${method.description}`);
|
|
78
75
|
return acc;
|
|
79
76
|
}, {});
|
|
80
|
-
const validateVAT = useCallback(async (value) => {
|
|
81
|
-
if (!value) {
|
|
82
|
-
setValidationErrors(errors => {
|
|
83
|
-
const result = { ...errors };
|
|
84
|
-
delete result.customerVatNumber;
|
|
85
|
-
return result;
|
|
86
|
-
});
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
if (value.length < 8) {
|
|
90
|
-
setValidationErrors({
|
|
91
|
-
...validationErrors,
|
|
92
|
-
customerVatNumber: t('validation.tooShort'),
|
|
93
|
-
});
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
try {
|
|
97
|
-
if (lastVATNumber.current === value)
|
|
98
|
-
return true;
|
|
99
|
-
onValidatingVAT(true);
|
|
100
|
-
const response = await validateVATNumber({ vatNumber: value });
|
|
101
|
-
lastVATNumber.current = value;
|
|
102
|
-
if (response.isValid) {
|
|
103
|
-
setValidationErrors(validationErrors => {
|
|
104
|
-
const result = { ...validationErrors };
|
|
105
|
-
delete result.customerVatNumber;
|
|
106
|
-
return result;
|
|
107
|
-
});
|
|
108
|
-
return true;
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
setValidationErrors(validationErrors => ({
|
|
112
|
-
...validationErrors,
|
|
113
|
-
customerVatNumber: t('validation.invalid'),
|
|
114
|
-
}));
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
catch {
|
|
119
|
-
// When an error occurs, we don't want to show the error message
|
|
120
|
-
// because it might be a temporary issue with the service.
|
|
121
|
-
// The customer can not do anything about it, so we just remove the error message.
|
|
122
|
-
setValidationErrors(validationErrors => {
|
|
123
|
-
const result = { ...validationErrors };
|
|
124
|
-
delete result.customerVatNumber;
|
|
125
|
-
return result;
|
|
126
|
-
});
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
finally {
|
|
130
|
-
onValidatingVAT(false);
|
|
131
|
-
}
|
|
132
|
-
}, [onValidatingVAT, t, validationErrors]);
|
|
133
|
-
useEffect(() => {
|
|
134
|
-
/* When a customer has an existing VAT that is
|
|
135
|
-
* not valid (e.g. invalid, undetermined, or failure),
|
|
136
|
-
* then trigger a client side validation. */
|
|
137
|
-
if (!cart.customerVatNumber)
|
|
138
|
-
return;
|
|
139
|
-
if (cart.properties.customerVatNumberStatus === 'valid')
|
|
140
|
-
return;
|
|
141
|
-
onValidatingVAT(true);
|
|
142
|
-
lastVATNumber.current = '';
|
|
143
|
-
validateVAT(cart.customerVatNumber);
|
|
144
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
145
|
-
}, []);
|
|
146
77
|
const onPlaceOrderCompleted = useCallback(({ cart, payment_type }) => {
|
|
147
78
|
dataLayer.push(createEcommerceEvent({
|
|
148
79
|
cart,
|
|
@@ -189,10 +120,6 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
|
|
|
189
120
|
};
|
|
190
121
|
cart.requestedDeliveryDate = formData.get('deliveryDate')?.toString();
|
|
191
122
|
cart.requestedDeliveryDateDisplay = undefined;
|
|
192
|
-
if (cart.customerVatNumber &&
|
|
193
|
-
lastVATNumber.current !== cart.customerVatNumber &&
|
|
194
|
-
!(await validateVAT(cart.customerVatNumber)))
|
|
195
|
-
return;
|
|
196
123
|
if (Object.keys(validationErrors).length > 0)
|
|
197
124
|
return;
|
|
198
125
|
if (isAdyenPayment) {
|
|
@@ -317,30 +244,36 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
|
|
|
317
244
|
MA: t('industry.MA'),
|
|
318
245
|
OT: t('industry.OT'),
|
|
319
246
|
/* eslint-enable sort-keys-fix/sort-keys-fix */
|
|
320
|
-
}, placeholder: t('Select an industry'), variant: "solid" }), jsx(TextField, { showLabel: true, isDisabled: isDisabled, label: t('VAT Number'),
|
|
247
|
+
}, placeholder: t('Select an industry'), variant: "solid" }), jsx(TextField, { showLabel: true, isDisabled: isDisabled, label: t('VAT Number'), minLength: 8, name: "customerVatNumber" }, `vat${Boolean(validationErrors.customerVatNumber)}`), jsx(TextField, { showLabel: true, defaultValue: cart.poNumber, isDisabled: isDisabled, isRequired: cart.requiresPoNumber, label: t('PO Number'), name: "poNumber" }), paymentMethodOptions && Object.keys(paymentMethodOptions).length > 1 && (jsx(Select, { "data-test-selector": "paymentMethodSelect", defaultSelectedOption: cart.paymentOptions?.paymentMethods?.[0]?.name || 'ADY', isDisabled: isDisabled, label: t('Payment method'), name: "paymentMethod", onChange: setSelectedPaymentMethod, options: paymentMethodOptions, selectedOption: selectedPaymentMethod, variant: "solid" })), isAdyenPayment && cart.billTo && (jsx(AdyenPayment, { amount: cart.orderGrandTotal, cartId: cart.trackId, countryCode: countryCode, currencyCode: currencyCode, customerId: cart.billTo.id, dropinRef: dropinRef, environment: environment === 'production' ? 'live' : 'test', isDisabled: isDisabled, onComplete: onComplete, onError: onError, orderAmount: cart.orderGrandTotal, returnUrl:
|
|
321
248
|
/* eslint-disable ssr-friendly/no-dom-globals-in-react-fc */
|
|
322
249
|
typeof window === 'undefined'
|
|
323
250
|
? ''
|
|
324
|
-
: `${window.location.pathname}${window.location.search}` })), Boolean(paymentError) && (jsx("div", { className: styles['error-message'], children: jsx(FormattedMessage, { id: "An error occurred while processing your payment. Please try again." }) })), jsx(InfoDisplay, { id: "shipping-and-invoice-information", label: t('Billing and shipping address'), value: jsx(Accordion, { variant: "select", children: jsx(AccordionItem, { "data-test-selector": "billingAndShippingInformation", id: "invoice-and-shipping", isDisabled: isDisabled, title: t('Billing and shipping information'), children: jsx(BillingAndInvoiceInformation, { billToAddress: {
|
|
325
|
-
address1: cart.billTo
|
|
326
|
-
address2: cart.billTo
|
|
327
|
-
address3: cart.billTo
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
251
|
+
: `${window.location.pathname}${window.location.search}` })), Boolean(paymentError) && (jsx("div", { className: styles['error-message'], children: jsx(FormattedMessage, { id: "An error occurred while processing your payment. Please try again." }) })), jsx(InfoDisplay, { id: "shipping-and-invoice-information", label: t('Billing and shipping address'), value: jsx(Accordion, { variant: "select", children: jsx(AccordionItem, { "data-test-selector": "billingAndShippingInformation", id: "invoice-and-shipping", isDisabled: isDisabled, title: t('Billing and shipping information'), children: jsx(BillingAndInvoiceInformation, { billToAddress: cart.billTo && {
|
|
252
|
+
address1: cart.billTo.address1,
|
|
253
|
+
address2: cart.billTo.address2,
|
|
254
|
+
address3: cart.billTo.address3,
|
|
255
|
+
attention: '',
|
|
256
|
+
city: cart.billTo.city,
|
|
257
|
+
companyName: cart.billTo.companyName,
|
|
258
|
+
country: cart.billTo.country,
|
|
259
|
+
email: cart.billTo.email,
|
|
260
|
+
firstName: '',
|
|
261
|
+
lastName: '',
|
|
262
|
+
phone: cart.billTo.phone,
|
|
263
|
+
postalCode: cart.billTo.postalCode,
|
|
264
|
+
}, shipToAddress: cart.shipTo && {
|
|
265
|
+
address1: cart.shipTo.address1,
|
|
266
|
+
address2: cart.shipTo.address2,
|
|
267
|
+
address3: cart.shipTo.address3,
|
|
268
|
+
attention: '',
|
|
269
|
+
city: cart.shipTo.city,
|
|
270
|
+
companyName: cart.shipTo.companyName,
|
|
271
|
+
country: cart.shipTo.country,
|
|
272
|
+
email: cart.shipTo.email,
|
|
273
|
+
firstName: '',
|
|
274
|
+
lastName: '',
|
|
275
|
+
phone: cart.shipTo.phone,
|
|
276
|
+
postalCode: cart.shipTo.postalCode,
|
|
344
277
|
} }) }) }) })] }));
|
|
345
278
|
}
|
|
346
279
|
|
|
@@ -5,11 +5,9 @@ export interface PaymentContentProps {
|
|
|
5
5
|
formId: string;
|
|
6
6
|
hasAtp: boolean;
|
|
7
7
|
isProcessing: boolean;
|
|
8
|
-
isValidatingVAT: boolean;
|
|
9
8
|
onPaymentComplete: ({ cartId }: {
|
|
10
9
|
cartId: string;
|
|
11
10
|
}) => void;
|
|
12
11
|
setIsProcessing: (isProcessing: boolean) => void;
|
|
13
|
-
setIsValidatingVAT: (isValidating: boolean) => void;
|
|
14
12
|
}
|
|
15
|
-
export declare function PaymentPageContent({ atp, cart, formId, hasAtp, isProcessing,
|
|
13
|
+
export declare function PaymentPageContent({ atp, cart, formId, hasAtp, isProcessing, onPaymentComplete, setIsProcessing, }: PaymentContentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -16,7 +16,7 @@ import { CheckoutPageSection } from '../layouts/checkout-page-layout/components/
|
|
|
16
16
|
import { CheckoutPageSectionContent } from '../layouts/checkout-page-layout/components/checkout-page-section-content.js';
|
|
17
17
|
import { Payment } from './components/payment.js';
|
|
18
18
|
|
|
19
|
-
function PaymentPageContent({ atp, cart, formId, hasAtp, isProcessing,
|
|
19
|
+
function PaymentPageContent({ atp, cart, formId, hasAtp, isProcessing, onPaymentComplete, setIsProcessing, }) {
|
|
20
20
|
const t = useFormattedMessage();
|
|
21
21
|
const currencyCode = getCurrencyCodeBySymbol(cart.currencySymbol);
|
|
22
22
|
if (!currencyCode)
|
|
@@ -28,9 +28,9 @@ function PaymentPageContent({ atp, cart, formId, hasAtp, isProcessing, isValidat
|
|
|
28
28
|
label: t('Review and payment'),
|
|
29
29
|
},
|
|
30
30
|
], "data-test-selector": "paymentPage", title: t('Review and payment'), children: jsxs(CheckoutPageLayout, { actions: {
|
|
31
|
-
primary: (jsx(Button, { withArrow: true, "data-test-selector": "checkoutReviewAndSubmit_placeOrder", form: formId, isDisabled: isProcessing, isLoading: isProcessing ?
|
|
31
|
+
primary: (jsx(Button, { withArrow: true, "data-test-selector": "checkoutReviewAndSubmit_placeOrder", form: formId, isDisabled: isProcessing, isLoading: isProcessing ? jsx(FormattedMessage, { id: "Processing" }) : false, type: "submit", children: cart.paymentMethod?.name === 'PBI' ? (jsx(FormattedMessage, { id: "Finalize order" })) : (jsx(FormattedMessage, { id: "Finalize payment" })) })),
|
|
32
32
|
}, mobileSummary: jsx(CartTotalsSummary, { currencyCode: currencyCode, totalAmount: cart.orderGrandTotal }), overview: jsx(CartTotals, { currencyCode: currencyCode, deliveryDate: hasAtp ? undefined : cart.requestedDeliveryDate, fulfillmentMethod: cart.fulfillmentMethod, isPayByInvoice: (cart.paymentOptions?.paymentMethods?.length || 1) <= 1 &&
|
|
33
|
-
cart.paymentMethod?.name === 'PBI', shippingCost: cart.shippingAndHandling, subtotal: cart.orderSubTotal, tax: cart.totalTax, total: cart.orderGrandTotal, vatPercentage: cart.cartLines?.[0]?.pricing?.vatRate || 0 }), children: [jsx(CheckoutPageSection, { hasBorder: false, title: jsx(FormattedMessage, { id: "Payment" }), children: jsx(CheckoutPageSectionContent, { children: jsx(Payment, { atp: atp, cart: cart, form: formId, isProcessing: isProcessing, onPaymentComplete: onPaymentComplete, onProcessing: setIsProcessing
|
|
33
|
+
cart.paymentMethod?.name === 'PBI', shippingCost: cart.shippingAndHandling, subtotal: cart.orderSubTotal, tax: cart.totalTax, total: cart.orderGrandTotal, vatPercentage: cart.cartLines?.[0]?.pricing?.vatRate || 0 }), children: [jsx(CheckoutPageSection, { hasBorder: false, title: jsx(FormattedMessage, { id: "Payment" }), children: jsx(CheckoutPageSectionContent, { children: jsx(Payment, { atp: atp, cart: cart, form: formId, isProcessing: isProcessing, onPaymentComplete: onPaymentComplete, onProcessing: setIsProcessing }) }) }), jsx(CheckoutPageSection, { hasBorder: false, title: jsx(FormattedMessage, { id: "Order" }), children: jsx(CheckoutPageSectionContent, { stretch: true, children: jsx(OrderLineList, { children: cart.cartLines?.map(cartLine => (jsx(OrderLineCard, { deliveryDate: cartLine.atp?.date ?? null, href: cartLine.productUri, image: {
|
|
34
34
|
fit: 'contain',
|
|
35
35
|
image: {
|
|
36
36
|
'1': cartLine.smallImagePath,
|
|
@@ -23,7 +23,6 @@ function PaymentPage() {
|
|
|
23
23
|
const hasAtp = atp !== undefined && atp.length > 1;
|
|
24
24
|
const isLoading = isLoadingCart || isAtpLoading;
|
|
25
25
|
const [isProcessing, setIsProcessing] = useState(false);
|
|
26
|
-
const [isValidating, setIsValidating] = useState(false);
|
|
27
26
|
const { isNavigating, navigate } = useNavigate();
|
|
28
27
|
const onPaymentComplete = useCallback(({ cartId }) => {
|
|
29
28
|
navigate(`${PATHS.ORDER_CONFIRMATION}?cartId=${cartId}`);
|
|
@@ -58,7 +57,7 @@ function PaymentPage() {
|
|
|
58
57
|
return null;
|
|
59
58
|
if (!atp)
|
|
60
59
|
throw new Error('Unexpected condition: ATP is undefined');
|
|
61
|
-
return (jsx(PaymentPageContent, { atp: atp, cart: cart, formId: PAYMENT_FORM_ID, hasAtp: hasAtp, isProcessing: isProcessing,
|
|
60
|
+
return (jsx(PaymentPageContent, { atp: atp, cart: cart, formId: PAYMENT_FORM_ID, hasAtp: hasAtp, isProcessing: isProcessing, onPaymentComplete: onPaymentComplete, setIsProcessing: setIsProcessing }));
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
export { PaymentPage };
|
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
import { BillToModel } from '../../../../shared/api/storefront/model/storefront.model';
|
|
2
|
+
import { ValidAddress } from '../../../../shared/model/address';
|
|
2
3
|
import { Country } from '../../../../shared/model/countries-languages';
|
|
3
4
|
export declare const EDIT_ADDRESS_FORM_ID = "billToForm";
|
|
4
|
-
export interface Address {
|
|
5
|
-
address1: string;
|
|
6
|
-
address2: string;
|
|
7
|
-
address3: string;
|
|
8
|
-
attention: string;
|
|
9
|
-
city: string;
|
|
10
|
-
companyName: string;
|
|
11
|
-
country: Country;
|
|
12
|
-
email: string;
|
|
13
|
-
firstName: string;
|
|
14
|
-
lastName: string;
|
|
15
|
-
phone: string;
|
|
16
|
-
postalCode: string;
|
|
17
|
-
}
|
|
18
5
|
export interface EditAddressesFormData {
|
|
19
|
-
address:
|
|
6
|
+
address: ValidAddress;
|
|
20
7
|
notes: string | undefined;
|
|
21
8
|
}
|
|
22
|
-
export declare function
|
|
9
|
+
export declare function EditCheckoutBillToAddressForm({ billTo, countries, isLoading, isPickup, onSubmit, }: {
|
|
23
10
|
billTo: BillToModel | undefined | null;
|
|
24
11
|
countries: Country[];
|
|
25
|
-
currentCountry: Country | undefined;
|
|
26
12
|
isLoading: boolean;
|
|
27
13
|
isPickup: boolean;
|
|
28
14
|
onSubmit: (event: EditAddressesFormData) => void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Form } from 'react-aria-components';
|
|
4
|
+
import { Checkbox } from '../../../../forms/elements/checkbox/checkbox.js';
|
|
5
|
+
import { TextField } from '../../../../forms/fields/text-field/text-field.js';
|
|
6
|
+
import { EditAddressForm } from '../../../../forms/partials/edit-address-form/edit-address-form.js';
|
|
7
|
+
import { InfoIconTooltip } from '../../../../info-icon-tooltip/info-icon-tooltip.js';
|
|
8
|
+
import { FormattedMessage } from '../../../../intl/formatted-message.js';
|
|
9
|
+
import { useFormattedMessage } from '../../../../intl/use-formatted-message.js';
|
|
10
|
+
import { useFetchCurrentCart } from '../../../../shared/api/storefront/hooks/cart/use-fetch-current-cart.js';
|
|
11
|
+
import { CheckoutPageSection } from '../../layouts/checkout-page-layout/components/checkout-page-section.js';
|
|
12
|
+
import { CheckoutPageSectionContent } from '../../layouts/checkout-page-layout/components/checkout-page-section-content.js';
|
|
13
|
+
import { SonicAddress } from './sonic-address.js';
|
|
14
|
+
import styles from './edit-checkout-bill-to-address-form.module.css.js';
|
|
15
|
+
|
|
16
|
+
const EDIT_ADDRESS_FORM_ID = 'billToForm';
|
|
17
|
+
function EditCheckoutBillToAddressForm({ billTo, countries, isLoading, isPickup, onSubmit, }) {
|
|
18
|
+
const t = useFormattedMessage();
|
|
19
|
+
const { data: cart } = useFetchCurrentCart();
|
|
20
|
+
return (jsxs(Fragment, { children: [jsx(CheckoutPageSection, { title: jsx(FormattedMessage, { id: "Billing address" }), children: jsx(CheckoutPageSectionContent, { children: jsxs(Form, { className: styles.form, "data-test-selector": "billToAddressForm", id: EDIT_ADDRESS_FORM_ID, onSubmit: e => {
|
|
21
|
+
e.preventDefault();
|
|
22
|
+
const formData = new FormData(e.currentTarget);
|
|
23
|
+
const countryFormValue = formData.get('countrySelect')?.toString();
|
|
24
|
+
const country = countries.find(country => country.id === countryFormValue);
|
|
25
|
+
if (!country)
|
|
26
|
+
throw new Error(`Country not found ${formData.get('country')}`);
|
|
27
|
+
onSubmit({
|
|
28
|
+
address: {
|
|
29
|
+
address1: formData.get('address1')?.toString() || '',
|
|
30
|
+
address2: formData.get('address2')?.toString() || '',
|
|
31
|
+
address3: formData.get('address3')?.toString() || '',
|
|
32
|
+
attention: formData.get('attention')?.toString() || '',
|
|
33
|
+
city: formData.get('city')?.toString() || '',
|
|
34
|
+
companyName: formData.get('companyName')?.toString() || '',
|
|
35
|
+
country,
|
|
36
|
+
email: formData.get('email')?.toString() || '',
|
|
37
|
+
firstName: formData.get('firstName')?.toString() || '',
|
|
38
|
+
lastName: formData.get('lastName')?.toString() || '',
|
|
39
|
+
phone: formData.get('phone')?.toString() || '',
|
|
40
|
+
postalCode: formData.get('postalCode')?.toString() || '',
|
|
41
|
+
},
|
|
42
|
+
notes: cart?.notes === formData.get('notes')
|
|
43
|
+
? undefined
|
|
44
|
+
: formData.get('notes')?.toString() || '',
|
|
45
|
+
});
|
|
46
|
+
}, children: [jsx(EditAddressForm, { address: billTo, countries: countries, isLoading: isLoading }), jsx("div", { className: styles['span-2'], children: jsx(TextField, { defaultValue: cart?.notes, isDisabled: isLoading, isMultiline: true, label: t('Add order notes'), name: "notes", rows: 3, showLabel: true }) })] }) }) }), jsx(CheckoutPageSection, { title: jsx(FormattedMessage, { id: isPickup ? 'Pickup address' : 'Shipping address' }), children: jsx(CheckoutPageSectionContent, { children: jsx(Fragment, { children: isPickup ? (jsx(SonicAddress, {})) : (jsxs("div", { className: styles['use-invoice-checkbox'], children: [jsx(Checkbox, { "data-test-selector": "checkboxUseBillingAddress", isDisabled: true, isSelected: true, children: jsx(FormattedMessage, { id: "Use billing address" }) }), jsx(InfoIconTooltip, { variant: "stroke", children: t('Changing your address is currently not possible. Please contact customer support to change your address.') })] })) }) }) })] }));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { EDIT_ADDRESS_FORM_ID, EditCheckoutBillToAddressForm };
|
|
@@ -3,15 +3,15 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
|
3
3
|
import { Form } from 'react-aria-components';
|
|
4
4
|
import { AddressInfoDisplay } from '../../../../address-info-display/address-info-display.js';
|
|
5
5
|
import { Link } from '../../../../buttons/link/link.js';
|
|
6
|
-
import { Checkbox } from '../../../../forms/checkbox/checkbox.js';
|
|
7
|
-
import { TextField } from '../../../../forms/text-field/text-field.js';
|
|
6
|
+
import { Checkbox } from '../../../../forms/elements/checkbox/checkbox.js';
|
|
7
|
+
import { TextField } from '../../../../forms/fields/text-field/text-field.js';
|
|
8
8
|
import { FormattedMessage } from '../../../../intl/formatted-message.js';
|
|
9
9
|
import { useFormattedMessage } from '../../../../intl/use-formatted-message.js';
|
|
10
10
|
import { PATHS } from '../../../paths.js';
|
|
11
11
|
import { CheckoutPageSection } from '../../layouts/checkout-page-layout/components/checkout-page-section.js';
|
|
12
12
|
import { CheckoutPageSectionContent } from '../../layouts/checkout-page-layout/components/checkout-page-section-content.js';
|
|
13
13
|
import { CheckoutPageSectionLink } from '../../layouts/checkout-page-layout/components/checkout-page-section-link.js';
|
|
14
|
-
import { EDIT_ADDRESS_FORM_ID } from './edit-address-form.js';
|
|
14
|
+
import { EDIT_ADDRESS_FORM_ID } from './edit-checkout-bill-to-address-form.js';
|
|
15
15
|
import { SonicAddress } from './sonic-address.js';
|
|
16
16
|
import styles from './readonly-address.module.css.js';
|
|
17
17
|
|
|
@@ -29,9 +29,10 @@ function ReadOnlyAddresses({ billTo, isLoading, isPickup, notes, onSubmit, shipT
|
|
|
29
29
|
address1: billTo.address1,
|
|
30
30
|
address2: billTo.address2,
|
|
31
31
|
address3: billTo.address3,
|
|
32
|
+
attention: billTo.attention,
|
|
32
33
|
city: billTo.city,
|
|
33
34
|
companyName: billTo.companyName,
|
|
34
|
-
country: billTo.country
|
|
35
|
+
country: billTo.country,
|
|
35
36
|
email: billTo.email,
|
|
36
37
|
firstName: billTo.firstName,
|
|
37
38
|
lastName: billTo.lastName,
|
|
@@ -41,9 +42,10 @@ function ReadOnlyAddresses({ billTo, isLoading, isPickup, notes, onSubmit, shipT
|
|
|
41
42
|
address1: shipTo.address1,
|
|
42
43
|
address2: shipTo.address2,
|
|
43
44
|
address3: shipTo.address3,
|
|
45
|
+
attention: shipTo.attention,
|
|
44
46
|
city: shipTo.city,
|
|
45
47
|
companyName: shipTo.companyName,
|
|
46
|
-
country: shipTo.country
|
|
48
|
+
country: shipTo.country,
|
|
47
49
|
email: shipTo.email,
|
|
48
50
|
firstName: shipTo.firstName,
|
|
49
51
|
lastName: shipTo.lastName,
|
|
@@ -3,7 +3,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
3
3
|
import { Button } from '../../../buttons/button/button.js';
|
|
4
4
|
import { CartTotals } from '../../../cart-totals/cart-totals.js';
|
|
5
5
|
import { CartTotalsSummary } from '../../../cart-totals/cart-totals-summary.js';
|
|
6
|
-
import { Select } from '../../../forms/select/select.js';
|
|
6
|
+
import { Select } from '../../../forms/elements/select/select.js';
|
|
7
7
|
import { FormattedMessage } from '../../../intl/formatted-message.js';
|
|
8
8
|
import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
|
|
9
9
|
import { getCurrencyCodeBySymbol } from '../../../shared/model/currency.js';
|
|
@@ -12,7 +12,7 @@ import { PATHS } from '../../paths.js';
|
|
|
12
12
|
import { CheckoutPageLayout } from '../layouts/checkout-page-layout/checkout-page-layout.js';
|
|
13
13
|
import { CheckoutPageSection } from '../layouts/checkout-page-layout/components/checkout-page-section.js';
|
|
14
14
|
import { CheckoutPageSectionContent } from '../layouts/checkout-page-layout/components/checkout-page-section-content.js';
|
|
15
|
-
import { EDIT_ADDRESS_FORM_ID } from './components/edit-address-form.js';
|
|
15
|
+
import { EDIT_ADDRESS_FORM_ID } from './components/edit-checkout-bill-to-address-form.js';
|
|
16
16
|
import styles from './shipping-page.module.css.js';
|
|
17
17
|
|
|
18
18
|
function ShippingPageContent({ cart, editAddress, errorPatchBillingAddress, fulfillmentMethods, isGuest, isLoadingFulfillmentMethods, isPatching, isPatchingSession, onChangeFulfillmentMethod, readOnlyAddress, }) {
|
|
@@ -14,7 +14,7 @@ import { ErrorPage } from '../../error-page/error-page.js';
|
|
|
14
14
|
import { LoadingPage } from '../../loading-page/loading-page.js';
|
|
15
15
|
import { PATHS } from '../../paths.js';
|
|
16
16
|
import { CurrencyChangeDialog } from './components/currency-change-dialog.js';
|
|
17
|
-
import {
|
|
17
|
+
import { EditCheckoutBillToAddressForm } from './components/edit-checkout-bill-to-address-form.js';
|
|
18
18
|
import { ReadOnlyAddresses } from './components/readonly-address.js';
|
|
19
19
|
import { usePatchShippingDetails } from './hooks/use-patch-shipping-details.js';
|
|
20
20
|
import { ShippingPageContent } from './shipping-page-content.js';
|
|
@@ -123,7 +123,7 @@ function ShippingPage() {
|
|
|
123
123
|
return (jsx(ShippingPageContent, { cart: cart,
|
|
124
124
|
// TODO: Combine editAddress and readOnlyAddress into one section in order
|
|
125
125
|
// for typescript to correctly infer which properties are set in what case
|
|
126
|
-
editAddress: jsxs(Fragment, { children: [jsx(
|
|
126
|
+
editAddress: jsxs(Fragment, { children: [jsx(EditCheckoutBillToAddressForm, { billTo: cart.billTo, countries: countries || [], isLoading: isPatching, isPickup: isPickup, onSubmit: async ({ address, notes }) => {
|
|
127
127
|
if (!cart.billTo)
|
|
128
128
|
return;
|
|
129
129
|
formData.current = { address, notes };
|
|
@@ -3,8 +3,8 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { useRef, useState, useCallback, useMemo } from 'react';
|
|
4
4
|
import { ListBox, ListBoxItem, Text } from 'react-aria-components';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import { Checkbox } from '../../../../forms/checkbox/checkbox.js';
|
|
7
|
-
import { SearchField } from '../../../../forms/search-field/search-field.js';
|
|
6
|
+
import { Checkbox } from '../../../../forms/elements/checkbox/checkbox.js';
|
|
7
|
+
import { SearchField } from '../../../../forms/fields/search-field/search-field.js';
|
|
8
8
|
import { SolidRatingIcon } from '../../../../icons/solid/solid-rating-icon.js';
|
|
9
9
|
import { FormattedMessage } from '../../../../intl/formatted-message.js';
|
|
10
10
|
import { useFormattedMessage } from '../../../../intl/use-formatted-message.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { FormSegmentGroup } from '../../../../forms/form/form-segment-group.js';
|
|
2
|
+
import { FormSegmentGroup } from '../../../../forms/layout/form/form-segment-group.js';
|
|
3
3
|
import { useFormattedMessage } from '../../../../intl/use-formatted-message.js';
|
|
4
4
|
import { Dialog } from '../../../../modals/dialog/dialog.js';
|
|
5
5
|
import { UnauthorizedRequestError } from '../../../../shared/fetch/request.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { PasswordValidation } from '../../../../forms/password-validation/password-validation.js';
|
|
2
|
+
import { PasswordField } from '../../../../forms/fields/password-field/password-field.js';
|
|
3
|
+
import { FormSegment } from '../../../../forms/layout/form/form-segment.js';
|
|
4
|
+
import { PasswordValidation } from '../../../../forms/partials/password-validation/password-validation.js';
|
|
5
5
|
import { useFormattedMessage } from '../../../../intl/use-formatted-message.js';
|
|
6
6
|
import { ProgressCircle } from '../../../../loading/progress-circle.js';
|
|
7
7
|
import { Message } from '../../../../message/message.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function EditBillToAddress(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { EditAddressForm } from '../../../../forms/partials/edit-address-form/edit-address-form.js';
|
|
3
|
+
|
|
4
|
+
function EditBillToAddress() {
|
|
5
|
+
return (jsx(EditAddressForm, { address: undefined, countries: [], isLoading: false }));
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export { EditBillToAddress };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OnSubmitHandler, ValidationErrors } from '../../../../forms/form/form';
|
|
1
|
+
import { OnSubmitHandler, ValidationErrors } from '../../../../forms/layout/form/form';
|
|
2
2
|
import { EditUserInfoProps } from './edit-user-info';
|
|
3
3
|
export interface EditUserInfoDialogProps extends EditUserInfoProps {
|
|
4
4
|
isOpen: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import { TextField } from '../../../../forms/text-field/text-field.js';
|
|
3
|
+
import { TextField } from '../../../../forms/fields/text-field/text-field.js';
|
|
4
4
|
import { useFormattedMessage } from '../../../../intl/use-formatted-message.js';
|
|
5
5
|
import { ProgressCircle } from '../../../../loading/progress-circle.js';
|
|
6
6
|
import { Message } from '../../../../message/message.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { Select } from '../../../forms/select/select.js';
|
|
3
|
+
import { Select } from '../../../forms/elements/select/select.js';
|
|
4
4
|
import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
|
|
5
5
|
import { useNavigate } from '../../../shared/routing/use-navigate.js';
|
|
6
6
|
import { mySonicNavigationItems } from './my-sonic-navigation-items.js';
|
|
@@ -16,7 +16,7 @@ import styles from './product-details-panel.module.css.js';
|
|
|
16
16
|
|
|
17
17
|
function ProductDetailsPanel({ priceComponent, product, }) {
|
|
18
18
|
const { sendAddToCartFromProductDetailsPageEvent, sendAddToWishListFromProductDetailsPageEvent, } = useAlgoliaInsights();
|
|
19
|
-
return (jsxs("div", { className: styles['product-details-panel'], children: [jsxs("div", { className: styles.heading, children: [jsx(Heading, { italic: true, size: "xs", tag: "h1", children: product.productTitle }), jsx(ProductSku, { sku: product.productNumber })] }), jsxs("div", { className: styles['price-action-container'], children: [priceComponent || (jsx(Price, { className: styles.price, currencyCode: product.currencyCode, "data-test": "productPrice_unitNetPrice", isVatIncluded: product.isVatIncluded, originalPrice: product.originalPrice, price: product.price, variant: "sonic" })), jsxs("div", { className: styles['action-container'], children: [product.canAddToCart && (jsx(ConnectedAddToCartButton, { onAddToCart: ({ cartLine }) => {
|
|
19
|
+
return (jsxs("div", { className: styles['product-details-panel'], children: [jsxs("div", { className: styles.heading, children: [jsx(Heading, { italic: true, size: "xs", tag: "h1", children: product.productTitle }), jsx(ProductSku, { className: styles.sku, sku: product.productNumber })] }), jsxs("div", { className: styles['price-action-container'], children: [priceComponent || (jsx(Price, { className: styles.price, currencyCode: product.currencyCode, "data-test": "productPrice_unitNetPrice", isVatIncluded: product.isVatIncluded, originalPrice: product.originalPrice, price: product.price, variant: "sonic" })), jsxs("div", { className: styles['action-container'], children: [product.canAddToCart && (jsx(ConnectedAddToCartButton, { onAddToCart: ({ cartLine }) => {
|
|
20
20
|
sendAddToCartFromProductDetailsPageEvent({
|
|
21
21
|
cartLine,
|
|
22
22
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var styles = {"product-details-panel":"product-details-panel-module-MXfPm","heading":"product-details-panel-module-rtZYR","price-action-container":"product-details-panel-module-wHZCr","price":"product-details-panel-module-dI2JL","action-container":"product-details-panel-module-QLafW","description":"product-details-panel-module-9L-Nm","feature-list":"product-details-panel-module-NC2nx"};
|
|
1
|
+
var styles = {"product-details-panel":"product-details-panel-module-MXfPm","heading":"product-details-panel-module-rtZYR","sku":"product-details-panel-module-IbS9-","price-action-container":"product-details-panel-module-wHZCr","price":"product-details-panel-module-dI2JL","action-container":"product-details-panel-module-QLafW","description":"product-details-panel-module-9L-Nm","feature-list":"product-details-panel-module-NC2nx"};
|
|
2
2
|
|
|
3
3
|
export { styles as default };
|
|
@@ -28,6 +28,7 @@ const netherlands = {
|
|
|
28
28
|
id: '423f6a9b-0b7b-4b3b-8b3b-3b7b0b9a6f43',
|
|
29
29
|
languages: [dutch, english],
|
|
30
30
|
name: 'Netherlands',
|
|
31
|
+
states: null,
|
|
31
32
|
};
|
|
32
33
|
const unitedKingdom = {
|
|
33
34
|
abbreviation: 'UK',
|
|
@@ -35,6 +36,7 @@ const unitedKingdom = {
|
|
|
35
36
|
id: '423f6a9b-0b7b-4b3b-8b3b-3b7b0b9a6f42',
|
|
36
37
|
languages: [english],
|
|
37
38
|
name: 'United Kingdom',
|
|
39
|
+
states: null,
|
|
38
40
|
};
|
|
39
41
|
const germany = {
|
|
40
42
|
abbreviation: 'DE',
|
|
@@ -42,6 +44,7 @@ const germany = {
|
|
|
42
44
|
id: '423f6a9b-0b7b-4b3b-8b3b-3b7b0b9a6f45',
|
|
43
45
|
languages: [german, english],
|
|
44
46
|
name: 'Germany',
|
|
47
|
+
states: null,
|
|
45
48
|
};
|
|
46
49
|
const france = {
|
|
47
50
|
abbreviation: 'FR',
|
|
@@ -49,6 +52,7 @@ const france = {
|
|
|
49
52
|
id: '423f6a9b-0b7b-4b3b-8b3b-3b7b0b9a6f44',
|
|
50
53
|
languages: [french, english],
|
|
51
54
|
name: 'France',
|
|
55
|
+
states: null,
|
|
52
56
|
};
|
|
53
57
|
const countries = [
|
|
54
58
|
netherlands,
|
|
@@ -1,15 +1,30 @@
|
|
|
1
|
+
import { Country } from './countries-languages';
|
|
1
2
|
export declare const validatePhone: (value: string) => boolean;
|
|
2
3
|
export declare const validateEmail: (value: string) => boolean;
|
|
3
|
-
export interface
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
export interface AddressCountry {
|
|
5
|
+
abbreviation: string;
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
states: {
|
|
9
|
+
abbreviation: string;
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
}[] | null;
|
|
13
|
+
}
|
|
14
|
+
export interface Address {
|
|
15
|
+
address1: string;
|
|
16
|
+
address2: string;
|
|
17
|
+
address3: string;
|
|
18
|
+
attention: string;
|
|
19
|
+
city: string;
|
|
20
|
+
companyName: string;
|
|
21
|
+
country: AddressCountry | null | undefined;
|
|
22
|
+
email: string;
|
|
23
|
+
firstName: string;
|
|
24
|
+
lastName: string;
|
|
25
|
+
phone: string;
|
|
26
|
+
postalCode: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ValidAddress extends Omit<Address, 'country'> {
|
|
29
|
+
country: Country;
|
|
15
30
|
}
|
|
@@ -11,6 +11,7 @@ export interface Country {
|
|
|
11
11
|
id: string;
|
|
12
12
|
languages: Language[];
|
|
13
13
|
name: string;
|
|
14
|
+
states: null;
|
|
14
15
|
}
|
|
15
16
|
export declare function isLanguage(language: unknown): language is Language;
|
|
16
17
|
export declare function isCountry(country: unknown): country is Country;
|