@sonic-equipment/ui 137.0.0 → 138.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/algolia/algolia-categories-filters.js +1 -1
- package/dist/algolia/algolia-query-string-routing.js +4 -2
- package/dist/buttons/add-to-cart-button/add-to-cart-button.js +1 -1
- package/dist/buttons/link/link.d.ts +1 -2
- package/dist/buttons/link/link.js +4 -6
- package/dist/collapsables/accordion/accordion-item.js +1 -1
- package/dist/collapsables/accordion/accordion.module.css.js +1 -1
- package/dist/exports.d.ts +4 -1
- package/dist/footer/footer.js +1 -1
- package/dist/forms/textarea/textarea.js +1 -1
- package/dist/index.js +4 -1
- package/dist/intl/translation-id.d.ts +1 -1
- package/dist/lists/orderline-list/orderline-list.js +1 -1
- package/dist/media/image/image.js +3 -3
- package/dist/message/message.d.ts +6 -0
- package/dist/message/message.js +19 -0
- package/dist/message/message.module.css.js +3 -0
- package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-layout.d.ts +8 -0
- package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-layout.js +12 -0
- package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-layout.module.css.js +3 -0
- package/dist/pages/account/sign-in-page/sign-in-page.d.ts +3 -0
- package/dist/pages/account/sign-in-page/sign-in-page.js +56 -0
- package/dist/pages/checkout/cart-page/cart-page.js +6 -6
- package/dist/pages/checkout/order-confirmation-page/order-confirmation-page-content.js +4 -4
- package/dist/pages/checkout/order-confirmation-page/order-confirmation-page.js +3 -3
- package/dist/pages/checkout/payment-page/components/adyen-payment.d.ts +2 -1
- package/dist/pages/checkout/payment-page/components/adyen-payment.js +2 -2
- package/dist/pages/checkout/payment-page/components/payment.d.ts +7 -3
- package/dist/pages/checkout/payment-page/components/payment.js +42 -41
- package/dist/pages/checkout/payment-page/payment-page-content.d.ts +3 -3
- package/dist/pages/checkout/payment-page/payment-page-content.js +7 -7
- package/dist/pages/checkout/payment-page/payment-page.js +7 -7
- package/dist/pages/checkout/shipping-page/components/readonly-address.js +3 -3
- package/dist/pages/checkout/shipping-page/shipping-page-content.js +4 -4
- package/dist/pages/checkout/shipping-page/shipping-page.js +5 -5
- package/dist/pages/components/page/page.d.ts +4 -2
- package/dist/pages/components/page/page.js +4 -6
- package/dist/pages/components/page-container/page-container.d.ts +5 -1
- package/dist/pages/components/page-container/page-container.js +3 -3
- package/dist/pages/components/page-container/page-container.module.css.js +1 -1
- package/dist/pages/error-page/error-page.js +4 -3
- package/dist/pages/{checkout/constants.d.ts → paths.d.ts} +4 -1
- package/dist/pages/{checkout/constants.js → paths.js} +5 -2
- package/dist/pages/product/product-details-page/product-details.js +1 -1
- package/dist/pages/product/product-listing-page/no-results/no-results.js +1 -1
- package/dist/pages/product/product-listing-page/product-listing.js +1 -1
- package/dist/pages/product/search-result-page/search-results-page.js +3 -1
- package/dist/shared/api/storefront/hooks/authentication/use-create-guest-account.d.ts +1 -3
- package/dist/shared/api/storefront/hooks/authentication/use-create-guest-account.js +26 -11
- package/dist/shared/api/storefront/hooks/authentication/use-fetch-session.js +1 -0
- package/dist/shared/api/storefront/hooks/authentication/use-sign-in.d.ts +1 -0
- package/dist/shared/api/storefront/hooks/authentication/use-sign-in.js +4 -4
- package/dist/shared/api/storefront/services/authentication-service.d.ts +6 -7
- package/dist/shared/api/storefront/services/authentication-service.js +5 -3
- package/dist/shared/api/storefront/services/translation-service.js +2 -1
- package/dist/shared/model/currency.d.ts +1 -28
- package/dist/shared/model/image.d.ts +3 -3
- package/dist/shared/routing/with-routing.js +1 -1
- package/dist/shared/utils/local-storage.d.ts +1 -1
- package/dist/shared/utils/local-storage.js +4 -5
- package/dist/shared/utils/price.d.ts +3 -37
- package/dist/sign-in-form/sign-in-form.d.ts +12 -6
- package/dist/sign-in-form/sign-in-form.js +9 -6
- package/dist/styles.css +399 -158
- package/package.json +1 -1
- package/dist/pages/components/page/page.module.css.js +0 -3
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useRef, useState,
|
|
2
|
+
import { useRef, useState, useEffect, useCallback } from 'react';
|
|
3
3
|
import { Form } from 'react-aria-components';
|
|
4
4
|
import { useAlgoliaInsights } from '../../../../algolia/use-algolia-insights.js';
|
|
5
5
|
import { Accordion } from '../../../../collapsables/accordion/accordion.js';
|
|
6
6
|
import { AccordionItem } from '../../../../collapsables/accordion/accordion-item.js';
|
|
7
|
-
import { config } from '../../../../config.js';
|
|
8
7
|
import { InfoDisplay } from '../../../../display/info-display/info-display.js';
|
|
9
8
|
import { Checkbox } from '../../../../forms/checkbox/checkbox.js';
|
|
10
9
|
import { Select } from '../../../../forms/select/select.js';
|
|
@@ -13,7 +12,6 @@ import { InfoIconTooltip } from '../../../../info-icon-tooltip/info-icon-tooltip
|
|
|
13
12
|
import { FormattedMessage } from '../../../../intl/formatted-message.js';
|
|
14
13
|
import { useFormattedMessage } from '../../../../intl/use-formatted-message.js';
|
|
15
14
|
import { logger } from '../../../../logging/logger.js';
|
|
16
|
-
import { usePatchSession } from '../../../../shared/api/storefront/hooks/authentication/use-patch-session.js';
|
|
17
15
|
import { useInvalidateCurrentCart } from '../../../../shared/api/storefront/hooks/cart/use-invalidate-current-cart.js';
|
|
18
16
|
import { usePatchCart } from '../../../../shared/api/storefront/hooks/cart/use-patch-cart.js';
|
|
19
17
|
import { usePlaceOrder } from '../../../../shared/api/storefront/hooks/cart/use-place-order.js';
|
|
@@ -22,23 +20,22 @@ import { validateVATNumber } from '../../../../shared/api/storefront/services/fi
|
|
|
22
20
|
import { useDataLayer } from '../../../../shared/ga/use-data-layer.js';
|
|
23
21
|
import { useDebouncedCallback } from '../../../../shared/hooks/use-debounced-callback.js';
|
|
24
22
|
import { currencySymbolToISO } from '../../../../shared/model/currency.js';
|
|
23
|
+
import { environment } from '../../../../shared/utils/environment.js';
|
|
25
24
|
import { BillingAndInvoiceInformation } from '../../components/billing-and-invoice-information.js';
|
|
26
25
|
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, onError: _onError, onPaymentComplete, onProcessing,
|
|
29
|
+
function Payment({ atp, cart: _cart, form, isProcessing, isValidatingVAT, onError: _onError, onPaymentComplete, onProcessing, onValidatingVAT, }) {
|
|
31
30
|
const { createEcommerceEvent, dataLayer } = useDataLayer();
|
|
32
|
-
const {
|
|
33
|
-
const {
|
|
34
|
-
const { isLoading: isPlacingCart, mutate: placeOrder } = usePlaceOrder();
|
|
31
|
+
const { mutate: patchCart } = usePatchCart();
|
|
32
|
+
const { mutate: placeOrder } = usePlaceOrder();
|
|
35
33
|
const { sendPurchaseEventFromPaymentPage } = useAlgoliaInsights();
|
|
36
34
|
const invalidateCurrentCart = useInvalidateCurrentCart();
|
|
37
35
|
const dropinRef = useRef(null);
|
|
38
36
|
const [paymentError, setPaymentError] = useState();
|
|
39
37
|
const [apiError, setAPIError] = useState();
|
|
40
38
|
const invalidateAdyen = useInvalidateAdyen();
|
|
41
|
-
const [isValidatingVAT, setIsValidatingVAT] = useState(false);
|
|
42
39
|
const t = useFormattedMessage();
|
|
43
40
|
const cartRef = useRef(_cart);
|
|
44
41
|
const cart = cartRef.current;
|
|
@@ -47,24 +44,19 @@ function Payment({ atp, cart: _cart, form, onError: _onError, onPaymentComplete,
|
|
|
47
44
|
const [deliveryDate, setDeliveryDate] = useState(cart.requestedDeliveryDateDisplay?.toString() || '');
|
|
48
45
|
const [selectedPaymentMethod, setSelectedPaymentMethod] = useState(cart.paymentOptions?.paymentMethods?.[0]?.name || 'ADY');
|
|
49
46
|
const countryCode = _cart.billTo?.country?.abbreviation;
|
|
47
|
+
const currencyCode = currencySymbolToISO[cart.currencySymbol];
|
|
48
|
+
if (!currencyCode)
|
|
49
|
+
throw new Error('Currency code not found for cart with currency symbol: ' +
|
|
50
|
+
cart.currencySymbol);
|
|
50
51
|
const isAdyenPayment = selectedPaymentMethod === 'ADY' &&
|
|
51
52
|
cart.paymentOptions &&
|
|
52
53
|
cart.billTo?.id &&
|
|
53
54
|
countryCode;
|
|
54
55
|
const hasReturnedFromAdyen = useHasReturnedFromAdyen();
|
|
55
|
-
const
|
|
56
|
+
const isDisabled = hasReturnedFromAdyen || isProcessing || isValidatingVAT;
|
|
56
57
|
useEffect(() => {
|
|
57
58
|
cartRef.current = _cart;
|
|
58
59
|
}, [_cart]);
|
|
59
|
-
useEffect(() => {
|
|
60
|
-
onValidating(isValidatingVAT || isPatchingSession);
|
|
61
|
-
}, [isPatchingSession, isValidatingVAT, onValidating]);
|
|
62
|
-
useEffect(() => {
|
|
63
|
-
onProcessing(isPatchingCart);
|
|
64
|
-
}, [isPatchingCart, onProcessing]);
|
|
65
|
-
useEffect(() => {
|
|
66
|
-
onProcessing(isProcessing);
|
|
67
|
-
}, [isProcessing, onProcessing]);
|
|
68
60
|
const [validationErrors, setValidationErrors] = useState({});
|
|
69
61
|
const atpSelectOptions = atp
|
|
70
62
|
.filter(atp => Boolean(atp.date))
|
|
@@ -86,7 +78,7 @@ function Payment({ atp, cart: _cart, form, onError: _onError, onPaymentComplete,
|
|
|
86
78
|
});
|
|
87
79
|
}
|
|
88
80
|
try {
|
|
89
|
-
|
|
81
|
+
onValidatingVAT(true);
|
|
90
82
|
const response = await validateVATNumber({ vatNumber: value });
|
|
91
83
|
if (response.isValid) {
|
|
92
84
|
setValidationErrors(prev => {
|
|
@@ -108,7 +100,7 @@ function Payment({ atp, cart: _cart, form, onError: _onError, onPaymentComplete,
|
|
|
108
100
|
});
|
|
109
101
|
}
|
|
110
102
|
finally {
|
|
111
|
-
|
|
103
|
+
onValidatingVAT(false);
|
|
112
104
|
}
|
|
113
105
|
}, 500);
|
|
114
106
|
const onPlaceOrderCompleted = useCallback(({ cart, payment_type }) => {
|
|
@@ -160,20 +152,20 @@ function Payment({ atp, cart: _cart, form, onError: _onError, onPaymentComplete,
|
|
|
160
152
|
dropinRef.current.showValidation();
|
|
161
153
|
if (!dropinRef.current.isValid)
|
|
162
154
|
return;
|
|
163
|
-
|
|
164
|
-
...cart,
|
|
165
|
-
customerVatNumber: formData.get('vatNumber')?.toString(),
|
|
166
|
-
poNumber: formData.get('poNumber')?.toString(),
|
|
167
|
-
properties: {
|
|
168
|
-
...cart.properties,
|
|
169
|
-
industry: formData.get('industry')?.toString() || '',
|
|
170
|
-
},
|
|
171
|
-
requestedDeliveryDate: formData.get('deliveryDate')?.toString(),
|
|
172
|
-
};
|
|
155
|
+
onProcessing(true);
|
|
173
156
|
try {
|
|
174
157
|
try {
|
|
175
158
|
cartRef.current = await patchCart({
|
|
176
|
-
cart:
|
|
159
|
+
cart: {
|
|
160
|
+
...cart,
|
|
161
|
+
customerVatNumber: formData.get('vatNumber')?.toString(),
|
|
162
|
+
poNumber: formData.get('poNumber')?.toString(),
|
|
163
|
+
properties: {
|
|
164
|
+
...cart.properties,
|
|
165
|
+
industry: formData.get('industry')?.toString() || '',
|
|
166
|
+
},
|
|
167
|
+
requestedDeliveryDate: formData.get('deliveryDate')?.toString(),
|
|
168
|
+
},
|
|
177
169
|
});
|
|
178
170
|
}
|
|
179
171
|
catch (error) {
|
|
@@ -192,11 +184,15 @@ function Payment({ atp, cart: _cart, form, onError: _onError, onPaymentComplete,
|
|
|
192
184
|
logger.error(error);
|
|
193
185
|
invalidateCurrentCart();
|
|
194
186
|
}
|
|
187
|
+
finally {
|
|
188
|
+
onProcessing(false);
|
|
189
|
+
}
|
|
195
190
|
}
|
|
196
191
|
else {
|
|
197
192
|
/* Pay by Invoice */
|
|
198
193
|
const cart = cartRef.current;
|
|
199
194
|
try {
|
|
195
|
+
onProcessing(true);
|
|
200
196
|
await placeOrder({ cart });
|
|
201
197
|
onPlaceOrderCompleted({
|
|
202
198
|
cart,
|
|
@@ -209,6 +205,9 @@ function Payment({ atp, cart: _cart, form, onError: _onError, onPaymentComplete,
|
|
|
209
205
|
setPaymentError(error);
|
|
210
206
|
invalidateCurrentCart();
|
|
211
207
|
}
|
|
208
|
+
finally {
|
|
209
|
+
onProcessing(false);
|
|
210
|
+
}
|
|
212
211
|
}
|
|
213
212
|
}
|
|
214
213
|
const onComplete = useCallback(
|
|
@@ -216,6 +215,7 @@ function Payment({ atp, cart: _cart, form, onError: _onError, onPaymentComplete,
|
|
|
216
215
|
async (result) => {
|
|
217
216
|
const cart = cartRef.current;
|
|
218
217
|
try {
|
|
218
|
+
onProcessing(true);
|
|
219
219
|
await placeOrder({
|
|
220
220
|
cart: {
|
|
221
221
|
...cart,
|
|
@@ -237,7 +237,10 @@ function Payment({ atp, cart: _cart, form, onError: _onError, onPaymentComplete,
|
|
|
237
237
|
logger.error(error);
|
|
238
238
|
setAPIError(error);
|
|
239
239
|
}
|
|
240
|
-
|
|
240
|
+
finally {
|
|
241
|
+
onProcessing(false);
|
|
242
|
+
}
|
|
243
|
+
}, [onPaymentComplete, onPlaceOrderCompleted, onProcessing, placeOrder]);
|
|
241
244
|
const onError = useCallback((error, result) => {
|
|
242
245
|
invalidateAdyen();
|
|
243
246
|
// invalidateCurrentCart()
|
|
@@ -248,11 +251,11 @@ function Payment({ atp, cart: _cart, form, onError: _onError, onPaymentComplete,
|
|
|
248
251
|
return (jsxs(Form, { className: styles['payment-form'], "data-test-selector": "paymentForm", id: form, onSubmit: e => {
|
|
249
252
|
e.preventDefault();
|
|
250
253
|
onSubmit(e);
|
|
251
|
-
}, validationErrors: validationErrors, children: [Boolean(apiError) && (jsx("div", { className: styles['error-message'], children: jsx(FormattedMessage, { id: "An unexpected error occured" }) })), hasAtp && (jsxs("div", { className: styles['delivery-date'], children: [jsx(Select, { showLabel: true, "data-test-selector": "deliveryDateSelect", isDisabled:
|
|
254
|
+
}, validationErrors: validationErrors, children: [Boolean(apiError) && (jsx("div", { className: styles['error-message'], children: jsx(FormattedMessage, { id: "An unexpected error occured" }) })), hasAtp && (jsxs("div", { className: styles['delivery-date'], children: [jsx(Select, { showLabel: true, "data-test-selector": "deliveryDateSelect", isDisabled: isDisabled || asSoonAsPossible, isRequired: !asSoonAsPossible, label: t('Select a desired delivery date'), name: "deliveryDate", onChange: setDeliveryDate, options: atpSelectOptions, selectedOption: deliveryDate, variant: "solid" }, String(asSoonAsPossible)), jsxs("div", { className: styles['asap-checkbox'], children: [jsx(Checkbox, { "data-test-selector": "asapCheckbox", isDisabled: isDisabled, isSelected: asSoonAsPossible, onChange: checked => {
|
|
252
255
|
setAsSoonAsPossible(checked);
|
|
253
256
|
if (checked)
|
|
254
257
|
setDeliveryDate('');
|
|
255
|
-
}, children: jsx(FormattedMessage, { id: "As soon as possible" }) }), jsx(InfoIconTooltip, { variant: "stroke", children: t('Selecting As Soon As Possible will enable us to send the products to you as they become available.') })] })] })), jsx(Select, { isRequired: true, "data-test-selector": "industrySelect", defaultSelectedOption: cart.properties.industry, isDisabled:
|
|
258
|
+
}, children: jsx(FormattedMessage, { id: "As soon as possible" }) }), jsx(InfoIconTooltip, { variant: "stroke", children: t('Selecting As Soon As Possible will enable us to send the products to you as they become available.') })] })] })), jsx(Select, { isRequired: true, "data-test-selector": "industrySelect", defaultSelectedOption: cart.properties.industry, isDisabled: isDisabled, label: t('Industry'), name: "industry", options: {
|
|
256
259
|
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
|
257
260
|
PP: 'Private User',
|
|
258
261
|
AU: 'Automotive',
|
|
@@ -264,15 +267,13 @@ function Payment({ atp, cart: _cart, form, onError: _onError, onPaymentComplete,
|
|
|
264
267
|
MA: 'Maritime',
|
|
265
268
|
OT: 'Other',
|
|
266
269
|
/* eslint-enable sort-keys-fix/sort-keys-fix */
|
|
267
|
-
}, variant: "solid" }), jsx(TextField, { showLabel: true, defaultValue: cart.customerVatNumber, isDisabled:
|
|
268
|
-
(cart.paymentOptions?.paymentMethods &&
|
|
269
|
-
cart.paymentOptions.paymentMethods.length <= 1)) ??
|
|
270
|
-
true, 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: currencySymbolToISO[cart.currencySymbol], customerId: cart.billTo.id, dropinRef: dropinRef,
|
|
270
|
+
}, variant: "solid" }), jsx(TextField, { showLabel: true, defaultValue: cart.customerVatNumber, isDisabled: isDisabled, label: t('VAT Number'), name: "vatNumber", onInput: e => debouncedValidator(e.target.value), validate: () => validationErrors.vatNumber ?? true }), 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,
|
|
271
271
|
// TODO: Use the correct Adyen environment before going live
|
|
272
|
-
environment:
|
|
272
|
+
environment: environment === 'production' ? 'live' : 'test', isDisabled: isDisabled, onComplete: onComplete, onError: onError, orderAmount: cart.orderGrandTotal, returnUrl:
|
|
273
|
+
/* eslint-disable ssr-friendly/no-dom-globals-in-react-fc */
|
|
274
|
+
typeof window === 'undefined'
|
|
273
275
|
? ''
|
|
274
|
-
:
|
|
275
|
-
`${config.SHOP_API_URL}${window.location.pathname}${window.location.search ? `${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, { id: "invoice-and-shipping", title: "Factuur- en verzendinformatie", children: jsx(BillingAndInvoiceInformation, { billToAddress: {
|
|
276
|
+
: `${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, { id: "invoice-and-shipping", isDisabled: isDisabled, title: "Factuur- en verzendinformatie", children: jsx(BillingAndInvoiceInformation, { billToAddress: {
|
|
276
277
|
address1: cart.billTo?.address1,
|
|
277
278
|
address2: cart.billTo?.address2,
|
|
278
279
|
address3: cart.billTo?.address3,
|
|
@@ -5,11 +5,11 @@ export interface PaymentContentProps {
|
|
|
5
5
|
formId: string;
|
|
6
6
|
hasAtp: boolean;
|
|
7
7
|
isProcessing: boolean;
|
|
8
|
-
|
|
8
|
+
isValidatingVAT: boolean;
|
|
9
9
|
onPaymentComplete: ({ cartId }: {
|
|
10
10
|
cartId: string;
|
|
11
11
|
}) => void;
|
|
12
12
|
setIsProcessing: (isProcessing: boolean) => void;
|
|
13
|
-
|
|
13
|
+
setIsValidatingVAT: (isValidating: boolean) => void;
|
|
14
14
|
}
|
|
15
|
-
export declare function PaymentPageContent({ atp, cart, formId, hasAtp, isProcessing,
|
|
15
|
+
export declare function PaymentPageContent({ atp, cart, formId, hasAtp, isProcessing, isValidatingVAT, onPaymentComplete, setIsProcessing, setIsValidatingVAT, }: PaymentContentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,24 +7,24 @@ import { FormattedMessage } from '../../../intl/formatted-message.js';
|
|
|
7
7
|
import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
|
|
8
8
|
import { OrderLineList } from '../../../lists/orderline-list/orderline-list.js';
|
|
9
9
|
import { Page } from '../../components/page/page.js';
|
|
10
|
-
import {
|
|
10
|
+
import { PATHS } from '../../paths.js';
|
|
11
11
|
import { CheckoutPageLayout } from '../layouts/checkout-page-layout/checkout-page-layout.js';
|
|
12
12
|
import { CheckoutPageSection } from '../layouts/checkout-page-layout/components/checkout-page-section.js';
|
|
13
13
|
import { CheckoutPageSectionContent } from '../layouts/checkout-page-layout/components/checkout-page-section-content.js';
|
|
14
14
|
import { Payment } from './components/payment.js';
|
|
15
15
|
|
|
16
|
-
function PaymentPageContent({ atp, cart, formId, hasAtp, isProcessing,
|
|
16
|
+
function PaymentPageContent({ atp, cart, formId, hasAtp, isProcessing, isValidatingVAT, onPaymentComplete, setIsProcessing, setIsValidatingVAT, }) {
|
|
17
17
|
const t = useFormattedMessage();
|
|
18
|
-
return (jsx(Page, {
|
|
19
|
-
{ href:
|
|
18
|
+
return (jsx(Page, { breadcrumb: [
|
|
19
|
+
{ href: PATHS.HOME, label: t('Home') },
|
|
20
20
|
{
|
|
21
|
-
href:
|
|
21
|
+
href: PATHS.REVIEW_AND_SUBMIT,
|
|
22
22
|
label: t('Review and payment'),
|
|
23
23
|
},
|
|
24
24
|
], title: t('Review and payment'), children: jsxs(CheckoutPageLayout, { actions: {
|
|
25
|
-
primary: (jsx(Button, { withArrow: true, "data-test-selector": "checkoutReviewAndSubmit_placeOrder", form: formId, isDisabled: isProcessing, isLoading: isProcessing ? (jsx(FormattedMessage, { id: "Processing" })) :
|
|
25
|
+
primary: (jsx(Button, { withArrow: true, "data-test-selector": "checkoutReviewAndSubmit_placeOrder", form: formId, isDisabled: isProcessing, isLoading: isProcessing ? (jsx(FormattedMessage, { id: "Processing" })) : isValidatingVAT ? (jsx(FormattedMessage, { id: "Validating" })) : (false), type: "submit", children: jsx(FormattedMessage, { id: "Pay" }) })),
|
|
26
26
|
}, mobileSummary: jsx(CartTotalsSummary, { totalAmount: cart.orderGrandTotalDisplay }), overview: jsx(CartTotals, { deliveryDate: hasAtp ? undefined : cart.requestedDeliveryDate, fulfillmentMethod: cart.fulfillmentMethod, isPayByInvoice: (cart.paymentOptions?.paymentMethods?.length || 1) <= 1 &&
|
|
27
|
-
cart.paymentMethod?.name === 'PBI', shippingCost: cart.shippingAndHandlingDisplay, subtotal: cart.orderSubTotalDisplay, tax: cart.totalTaxDisplay, total: cart.orderGrandTotalDisplay, 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, onPaymentComplete: onPaymentComplete, onProcessing: setIsProcessing,
|
|
27
|
+
cart.paymentMethod?.name === 'PBI', shippingCost: cart.shippingAndHandlingDisplay, subtotal: cart.orderSubTotalDisplay, tax: cart.totalTaxDisplay, total: cart.orderGrandTotalDisplay, 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, isValidatingVAT: isValidatingVAT, onPaymentComplete: onPaymentComplete, onProcessing: setIsProcessing, onValidatingVAT: setIsValidatingVAT }) }) }), 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, href: cartLine.productUri, image: {
|
|
28
28
|
fit: 'contain',
|
|
29
29
|
image: {
|
|
30
30
|
'1': cartLine.smallImagePath,
|
|
@@ -7,7 +7,7 @@ import { useNavigate } from '../../../shared/routing/route-provider.js';
|
|
|
7
7
|
import { hasNo } from '../../../shared/utils/types.js';
|
|
8
8
|
import { ErrorPage } from '../../error-page/error-page.js';
|
|
9
9
|
import { LoadingPage } from '../../loading-page/loading-page.js';
|
|
10
|
-
import {
|
|
10
|
+
import { PATHS } from '../../paths.js';
|
|
11
11
|
import { useHasReturnedFromAdyen } from './hooks/use-has-returned-from-adyen.js';
|
|
12
12
|
import { PaymentPageContent } from './payment-page-content.js';
|
|
13
13
|
|
|
@@ -25,7 +25,7 @@ function PaymentPage() {
|
|
|
25
25
|
const [isValidating, setIsValidating] = useState(false);
|
|
26
26
|
const { isNavigating, navigate } = useNavigate();
|
|
27
27
|
const onPaymentComplete = useCallback(({ cartId }) => {
|
|
28
|
-
navigate(`${
|
|
28
|
+
navigate(`${PATHS.ORDER_CONFIRMATION}?cartId=${cartId}`);
|
|
29
29
|
}, [navigate]);
|
|
30
30
|
useEffect(() => {
|
|
31
31
|
if (isNavigating)
|
|
@@ -33,15 +33,15 @@ function PaymentPage() {
|
|
|
33
33
|
if (isAuthenticated === undefined)
|
|
34
34
|
return;
|
|
35
35
|
if (!isAuthenticated)
|
|
36
|
-
return navigate(
|
|
36
|
+
return navigate(PATHS.CHECKOUT_SHIPPING_VIA_SIGNIN);
|
|
37
37
|
if (hasNo(cart))
|
|
38
38
|
return;
|
|
39
39
|
if (hasNo(cart.cartLines) || cart.cartLines.length === 0)
|
|
40
|
-
return navigate(
|
|
40
|
+
return navigate(PATHS.CART);
|
|
41
41
|
if (hasNo(cart.billTo))
|
|
42
|
-
return navigate(
|
|
42
|
+
return navigate(PATHS.CHECKOUT_SHIPPING_VIA_SIGNIN);
|
|
43
43
|
if (hasNo(cart.billTo.address1))
|
|
44
|
-
return navigate(
|
|
44
|
+
return navigate(PATHS.CHECKOUT_SHIPPING);
|
|
45
45
|
}, [cart, navigate, isAuthenticated, isNavigating]);
|
|
46
46
|
if (error)
|
|
47
47
|
return jsx(ErrorPage, { error: error });
|
|
@@ -54,7 +54,7 @@ function PaymentPage() {
|
|
|
54
54
|
cart.cartLines.length === 0 ||
|
|
55
55
|
hasNo(cart.billTo?.address1))
|
|
56
56
|
return null;
|
|
57
|
-
return (jsx(PaymentPageContent, { atp: atp, cart: cart, formId: PAYMENT_FORM_ID, hasAtp: Boolean(hasAtp), isProcessing: isProcessing,
|
|
57
|
+
return (jsx(PaymentPageContent, { atp: atp, cart: cart, formId: PAYMENT_FORM_ID, hasAtp: Boolean(hasAtp), isProcessing: isProcessing, isValidatingVAT: isValidating, onPaymentComplete: onPaymentComplete, setIsProcessing: setIsProcessing, setIsValidatingVAT: setIsValidating }));
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
export { PaymentPage };
|
|
@@ -6,6 +6,7 @@ import { TextField } from '../../../../forms/text-field/text-field.js';
|
|
|
6
6
|
import { FormattedMessage } from '../../../../intl/formatted-message.js';
|
|
7
7
|
import { useFormattedMessage } from '../../../../intl/use-formatted-message.js';
|
|
8
8
|
import { RouteLink } from '../../../../shared/routing/route-link.js';
|
|
9
|
+
import { PATHS } from '../../../paths.js';
|
|
9
10
|
import { CheckoutPageSection } from '../../layouts/checkout-page-layout/components/checkout-page-section.js';
|
|
10
11
|
import { CheckoutPageSectionContent } from '../../layouts/checkout-page-layout/components/checkout-page-section-content.js';
|
|
11
12
|
import { CheckoutPageSectionLink } from '../../layouts/checkout-page-layout/components/checkout-page-section-link.js';
|
|
@@ -13,7 +14,6 @@ import { EDIT_ADDRESS_FORM_ID } from './edit-address.js';
|
|
|
13
14
|
import { SonicAddress } from './sonic-address.js';
|
|
14
15
|
import styles from './readonly-address.module.css.js';
|
|
15
16
|
|
|
16
|
-
const ACCOUNT_ADDRESSES_PATH = '/MyAccount/Addresses';
|
|
17
17
|
function ReadOnlyAddresses({ billTo, isLoading, isPickup, notes, onSubmit, shipTo, }) {
|
|
18
18
|
const t = useFormattedMessage();
|
|
19
19
|
return (jsxs(Form, { "data-test-selector": "billToAddressForm", id: EDIT_ADDRESS_FORM_ID, onSubmit: e => {
|
|
@@ -22,7 +22,7 @@ function ReadOnlyAddresses({ billTo, isLoading, isPickup, notes, onSubmit, shipT
|
|
|
22
22
|
onSubmit({
|
|
23
23
|
notes: formData.get('notes')?.toString() || '',
|
|
24
24
|
});
|
|
25
|
-
}, children: [jsxs(CheckoutPageSection, { title: jsx(FormattedMessage, { id: "Billing address" }), children: [jsx(CheckoutPageSectionLink, { children: jsxs(RouteLink, { color: "secondary", href:
|
|
25
|
+
}, children: [jsxs(CheckoutPageSection, { title: jsx(FormattedMessage, { id: "Billing address" }), children: [jsx(CheckoutPageSectionLink, { children: jsxs(RouteLink, { color: "secondary", href: PATHS.ACCOUNT_ADDRESSES, isDisabled: isLoading, children: [jsx(FormattedMessage, { id: "Edit billing address" }), " >"] }) }), jsxs(CheckoutPageSectionContent, { children: [billTo && (jsx(Address, { address: {
|
|
26
26
|
address1: billTo.address1,
|
|
27
27
|
address2: billTo.address2,
|
|
28
28
|
address3: billTo.address3,
|
|
@@ -34,7 +34,7 @@ function ReadOnlyAddresses({ billTo, isLoading, isPickup, notes, onSubmit, shipT
|
|
|
34
34
|
lastName: billTo.lastName,
|
|
35
35
|
phone: billTo.phone,
|
|
36
36
|
postalCode: billTo.postalCode,
|
|
37
|
-
} })), jsx("div", { className: styles.notes, children: jsx(TextField, { defaultValue: notes, isDisabled: isLoading, isMultiline: true, label: t('Add order notes'), name: "notes", rows: 3, showLabel: true }) })] })] }), jsxs(CheckoutPageSection, { title: jsx(FormattedMessage, { id: isPickup ? 'Pickup address' : 'Shipping address' }), children: [!isPickup && (jsx(CheckoutPageSectionLink, { children: jsxs(RouteLink, { color: "secondary", href:
|
|
37
|
+
} })), jsx("div", { className: styles.notes, children: jsx(TextField, { defaultValue: notes, isDisabled: isLoading, isMultiline: true, label: t('Add order notes'), name: "notes", rows: 3, showLabel: true }) })] })] }), jsxs(CheckoutPageSection, { title: jsx(FormattedMessage, { id: isPickup ? 'Pickup address' : 'Shipping address' }), children: [!isPickup && (jsx(CheckoutPageSectionLink, { children: jsxs(RouteLink, { color: "secondary", href: PATHS.ACCOUNT_ADDRESSES, isDisabled: isLoading, children: [jsx(FormattedMessage, { id: "Edit shipping address" }), " >"] }) })), jsx(CheckoutPageSectionContent, { children: isPickup ? (jsx(SonicAddress, {})) : (jsxs(Fragment, { children: [jsx(Checkbox, { className: styles['use-invoice-checkbox'], "data-test-selector": "checkboxUseBillingAddress", isDisabled: true, isSelected: true, children: jsx(FormattedMessage, { id: "Use billing address" }) }), shipTo && (jsx(Address, { address: {
|
|
38
38
|
address1: shipTo.address1,
|
|
39
39
|
address2: shipTo.address2,
|
|
40
40
|
address3: shipTo.address3,
|
|
@@ -7,7 +7,7 @@ import { Select } from '../../../forms/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 { Page } from '../../components/page/page.js';
|
|
10
|
-
import {
|
|
10
|
+
import { PATHS } from '../../paths.js';
|
|
11
11
|
import { CheckoutPageLayout } from '../layouts/checkout-page-layout/checkout-page-layout.js';
|
|
12
12
|
import { CheckoutPageSection } from '../layouts/checkout-page-layout/components/checkout-page-section.js';
|
|
13
13
|
import { CheckoutPageSectionContent } from '../layouts/checkout-page-layout/components/checkout-page-section-content.js';
|
|
@@ -24,10 +24,10 @@ function ShippingPageContent({ cart, editAddress, errorPatchBillingAddress, fulf
|
|
|
24
24
|
return Boolean(cart.billTo?.address1);
|
|
25
25
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
26
26
|
}, [Boolean(cart)]);
|
|
27
|
-
return (jsx(Page, {
|
|
28
|
-
{ href:
|
|
27
|
+
return (jsx(Page, { breadcrumb: [
|
|
28
|
+
{ href: PATHS.HOME, label: t('Home') },
|
|
29
29
|
{
|
|
30
|
-
href:
|
|
30
|
+
href: PATHS.CHECKOUT_SHIPPING,
|
|
31
31
|
label: t('Shipping details'),
|
|
32
32
|
},
|
|
33
33
|
], title: t('Shipping details'), children: jsxs(CheckoutPageLayout, { actions: {
|
|
@@ -10,7 +10,7 @@ import { useNavigate } from '../../../shared/routing/route-provider.js';
|
|
|
10
10
|
import { hasNo } from '../../../shared/utils/types.js';
|
|
11
11
|
import { ErrorPage } from '../../error-page/error-page.js';
|
|
12
12
|
import { LoadingPage } from '../../loading-page/loading-page.js';
|
|
13
|
-
import {
|
|
13
|
+
import { PATHS } from '../../paths.js';
|
|
14
14
|
import { EditAddresses } from './components/edit-address.js';
|
|
15
15
|
import { ReadOnlyAddresses } from './components/readonly-address.js';
|
|
16
16
|
import { usePatchShippingDetails } from './hooks/use-patch-shipping-details.js';
|
|
@@ -38,13 +38,13 @@ function ShippingPage() {
|
|
|
38
38
|
if (isAuthenticated === undefined)
|
|
39
39
|
return;
|
|
40
40
|
if (!isAuthenticated)
|
|
41
|
-
return navigate(
|
|
41
|
+
return navigate(PATHS.CHECKOUT_SHIPPING_VIA_SIGNIN);
|
|
42
42
|
if (hasNo(cart))
|
|
43
43
|
return;
|
|
44
44
|
if (hasNo(cart.cartLines) || cart.cartLines.length === 0)
|
|
45
|
-
return navigate(
|
|
45
|
+
return navigate(PATHS.CART);
|
|
46
46
|
if (hasNo(cart.billTo))
|
|
47
|
-
return navigate(
|
|
47
|
+
return navigate(PATHS.CHECKOUT_SHIPPING_VIA_SIGNIN);
|
|
48
48
|
}, [cart, navigate, isAuthenticated, isNavigating]);
|
|
49
49
|
useEffect(() => {
|
|
50
50
|
/* Guards for when the bill to address is saved and we should navigate to the next page */
|
|
@@ -58,7 +58,7 @@ function ShippingPage() {
|
|
|
58
58
|
return location?.reload();
|
|
59
59
|
if (hasNo(cart?.billTo?.address1))
|
|
60
60
|
return;
|
|
61
|
-
return navigate(
|
|
61
|
+
return navigate(PATHS.REVIEW_AND_SUBMIT);
|
|
62
62
|
}, [isSuccess, cart, navigate, isNavigating, isPatching, isError]);
|
|
63
63
|
useEffect(() => {
|
|
64
64
|
if (!cart || gaEventPushed.current)
|
|
@@ -2,9 +2,11 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { BreadcrumbLink } from '../../../breadcrumbs/breadcrumb';
|
|
3
3
|
import { PageMetaDataProps } from '../page-meta-data/page-meta-data';
|
|
4
4
|
export interface PageProps extends PageMetaDataProps {
|
|
5
|
-
|
|
5
|
+
breadcrumb?: BreadcrumbLink[];
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
className?: string;
|
|
8
|
+
fluid?: boolean;
|
|
9
|
+
fullHeight?: boolean;
|
|
8
10
|
title?: string;
|
|
9
11
|
}
|
|
10
|
-
export declare function Page({ alternateLanguageUrls,
|
|
12
|
+
export declare function Page({ alternateLanguageUrls, breadcrumb, canonicalUrl, children, className, fluid, fullHeight, meta, openGraph, title, windowTitle, }: PageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import clsx from 'clsx';
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
4
3
|
import { Breadcrumb } from '../../../breadcrumbs/breadcrumb.js';
|
|
5
4
|
import { Heading } from '../../../typography/heading/heading.js';
|
|
6
5
|
import { PageContainer } from '../page-container/page-container.js';
|
|
7
6
|
import { PageMetaData } from '../page-meta-data/page-meta-data.js';
|
|
8
|
-
import styles from './page.module.css.js';
|
|
9
7
|
|
|
10
8
|
function PageTitle({ children }) {
|
|
11
|
-
return (jsx(Heading, { italic: true, uppercase: true, breakpoints: { lg: 'm', xxl: 'xl' },
|
|
9
|
+
return (jsx(Heading, { italic: true, uppercase: true, breakpoints: { lg: 'm', xxl: 'xl' }, size: "s", tag: "h1", children: children }));
|
|
12
10
|
}
|
|
13
|
-
function Page({ alternateLanguageUrls,
|
|
14
|
-
return (jsxs(
|
|
11
|
+
function Page({ alternateLanguageUrls, breadcrumb, canonicalUrl, children, className, fluid, fullHeight, meta, openGraph, title, windowTitle, }) {
|
|
12
|
+
return (jsxs(Fragment, { children: [jsx(PageMetaData, { alternateLanguageUrls: alternateLanguageUrls, canonicalUrl: canonicalUrl, meta: meta, openGraph: openGraph, windowTitle: windowTitle }), jsx(PageContainer, { breadcrumbSlot: breadcrumb && jsx(Breadcrumb, { links: breadcrumb }), className: className, fluid: fluid, fullHeight: fullHeight, titleSlot: title && jsx(PageTitle, { children: title }), children: children })] }));
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
export { Page };
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
export declare function PageContainer({ children, className, }: {
|
|
2
|
+
export declare function PageContainer({ breadcrumbSlot, children, className, fluid, fullHeight, titleSlot, }: {
|
|
3
|
+
breadcrumbSlot?: ReactNode;
|
|
3
4
|
children: ReactNode;
|
|
4
5
|
className?: string;
|
|
6
|
+
fluid?: boolean;
|
|
7
|
+
fullHeight?: boolean;
|
|
8
|
+
titleSlot?: ReactNode;
|
|
5
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import styles from './page-container.module.css.js';
|
|
4
4
|
|
|
5
|
-
function PageContainer({ children, className, }) {
|
|
6
|
-
return (jsx("div", { className: styles['page-container'], children:
|
|
5
|
+
function PageContainer({ breadcrumbSlot, children, className, fluid, fullHeight, titleSlot, }) {
|
|
6
|
+
return (jsx("div", { className: clsx(styles['page-container'], fullHeight && styles['full-height'], fluid && styles['fluid'], className), children: jsxs("main", { className: styles['page-main'], children: [breadcrumbSlot && (jsx("div", { className: styles.breadcrumb, children: breadcrumbSlot })), titleSlot && jsx("div", { className: styles.title, children: titleSlot }), jsx("div", { className: styles.content, children: children })] }) }));
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export { PageContainer };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var styles = {"page-container":"page-container-module-eFYSe","
|
|
1
|
+
var styles = {"page-container":"page-container-module-eFYSe","page-main":"page-container-module-JkoQY","full-height":"page-container-module-iCrH5","fluid":"page-container-module-glxAS","breadcrumb":"page-container-module-WfQXa","title":"page-container-module-GKN5s","content":"page-container-module-r0SOZ"};
|
|
2
2
|
|
|
3
3
|
export { styles as default };
|
|
@@ -5,6 +5,7 @@ import { isRequestError } from '../../shared/fetch/request.js';
|
|
|
5
5
|
import { environment } from '../../shared/utils/environment.js';
|
|
6
6
|
import { Heading } from '../../typography/heading/heading.js';
|
|
7
7
|
import { Page } from '../components/page/page.js';
|
|
8
|
+
import { PATHS } from '../paths.js';
|
|
8
9
|
|
|
9
10
|
function ErrorPage({ error }) {
|
|
10
11
|
useEffect(() => {
|
|
@@ -13,9 +14,9 @@ function ErrorPage({ error }) {
|
|
|
13
14
|
throw error;
|
|
14
15
|
}, 0);
|
|
15
16
|
}, [error]);
|
|
16
|
-
return (jsx(Page, {
|
|
17
|
-
{ href:
|
|
18
|
-
{ href:
|
|
17
|
+
return (jsx(Page, { breadcrumb: [
|
|
18
|
+
{ href: PATHS.HOME, label: 'Home' },
|
|
19
|
+
{ href: PATHS.HOME, label: 'Error' },
|
|
19
20
|
], title: "Something went wrong", children: environment !== 'production' && (jsxs(Fragment, { children: [jsx(Heading, { size: "l", children: isRequestError(error) ? (jsxs(Fragment, { children: [error.status, " - ", error.statusText || 'Unknown error'] })) : (jsx(Fragment, { children: error.message })) }), isRequestError(error) && (jsxs(Fragment, { children: [jsx(Heading, { size: "xs", children: "Error details" }), jsx(Heading, { size: "xxs", children: "Body" }), jsx("pre", { children: JSON.stringify(error.body, null, 2) }), jsx(Heading, { size: "xxs", children: "Options" }), jsx("pre", { children: JSON.stringify(error.options, null, 2) })] }))] })) }));
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const PATHS: {
|
|
2
|
+
readonly ACCOUNT: "/account";
|
|
3
|
+
readonly ACCOUNT_ADDRESSES: "/MyAccount/Addresses";
|
|
2
4
|
readonly CART: "/cart";
|
|
3
5
|
readonly CHECKOUT_SHIPPING: "/CheckoutShipping";
|
|
4
6
|
readonly CHECKOUT_SHIPPING_VIA_SIGNIN: "/signin?returnUrl=/CheckoutShipping";
|
|
5
7
|
readonly HOME: "/";
|
|
6
8
|
readonly ORDER_CONFIRMATION: "/OrderConfirmation";
|
|
7
9
|
readonly REVIEW_AND_SUBMIT: "/CheckoutReviewAndSubmit";
|
|
10
|
+
readonly SIGN_IN: "/signin";
|
|
8
11
|
};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
const
|
|
1
|
+
const PATHS = {
|
|
2
|
+
ACCOUNT: '/account',
|
|
3
|
+
ACCOUNT_ADDRESSES: '/MyAccount/Addresses',
|
|
2
4
|
CART: '/cart',
|
|
3
5
|
CHECKOUT_SHIPPING: '/CheckoutShipping',
|
|
4
6
|
CHECKOUT_SHIPPING_VIA_SIGNIN: '/signin?returnUrl=/CheckoutShipping',
|
|
5
7
|
HOME: '/',
|
|
6
8
|
ORDER_CONFIRMATION: '/OrderConfirmation',
|
|
7
9
|
REVIEW_AND_SUBMIT: '/CheckoutReviewAndSubmit',
|
|
10
|
+
SIGN_IN: '/signin',
|
|
8
11
|
};
|
|
9
12
|
|
|
10
|
-
export {
|
|
13
|
+
export { PATHS };
|
|
@@ -20,7 +20,7 @@ function ProductDetails({ data, priceComponent, recentlyViewedComponent, }) {
|
|
|
20
20
|
},
|
|
21
21
|
product,
|
|
22
22
|
});
|
|
23
|
-
return (jsx(Page, { alternateLanguageUrls: page.alternateLanguageUrls,
|
|
23
|
+
return (jsx(Page, { alternateLanguageUrls: page.alternateLanguageUrls, breadcrumb: breadCrumb, canonicalUrl: page.canonicalPath, meta: {
|
|
24
24
|
description: page.metaDescription,
|
|
25
25
|
keywords: page.metaKeywords,
|
|
26
26
|
}, openGraph: {
|
|
@@ -8,7 +8,7 @@ import styles from './no-results.module.css.js';
|
|
|
8
8
|
|
|
9
9
|
function NoResults({ content, title }) {
|
|
10
10
|
const { lg } = useBreakpoint();
|
|
11
|
-
return (jsxs("div", { className: styles['no-results'], children: [jsx(Heading, { bold: false, className: styles.title, size: lg ? 's' : 'xs', tag: "h2", children: title }), jsx("p", { className: styles.body, children: content }), jsx("div", { className: styles.buttons, children: jsx(RouteButton, { withArrow: true, href: "/", size: "md", children: jsx(FormattedMessage, { id: "Continue shopping" }) }) })] }));
|
|
11
|
+
return (jsxs("div", { className: styles['no-results'], children: [jsx(Heading, { bold: false, className: styles.title, size: lg ? 's' : 'xs', tag: "h2", children: title }), jsx("p", { className: styles.body, children: content }), jsx("div", { className: styles.buttons, children: jsx(RouteButton, { withArrow: true, "data-test-selector": "buttonContinueShopping", href: "/", size: "md", children: jsx(FormattedMessage, { id: "Continue shopping" }) }) })] }));
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export { NoResults };
|
|
@@ -24,7 +24,7 @@ import styles from './product-listing-page.module.css.js';
|
|
|
24
24
|
function ProductListing({ data, searchClient, }) {
|
|
25
25
|
const languageCode = useLanguageCode();
|
|
26
26
|
const category = data.breadCrumb.slice(1).map(breadCrumb => breadCrumb.label);
|
|
27
|
-
return (jsx(AlgoliaProvider, { categoryPages: data.categoryPages, hierarchicalCategories: data.hierarchicalCategories, languageCode: languageCode, offlineSearchClient: offlineSearchClient, searchClient: searchClient, children: jsx(Page, { alternateLanguageUrls: data.page.alternateLanguageUrls,
|
|
27
|
+
return (jsx(AlgoliaProvider, { categoryPages: data.categoryPages, hierarchicalCategories: data.hierarchicalCategories, languageCode: languageCode, offlineSearchClient: offlineSearchClient, searchClient: searchClient, children: jsx(Page, { alternateLanguageUrls: data.page.alternateLanguageUrls, breadcrumb: data.breadCrumb, canonicalUrl: data.page.canonicalPath, className: styles['product-listing'], meta: {
|
|
28
28
|
description: data.page.metaDescription,
|
|
29
29
|
keywords: data.page.metaKeywords,
|
|
30
30
|
}, openGraph: {
|
|
@@ -27,7 +27,9 @@ function SearchResultsPage({ location, searchClient, }) {
|
|
|
27
27
|
const keyword = Array.isArray(keywords) ? keywords.join(' ') : keywords;
|
|
28
28
|
if (!keyword)
|
|
29
29
|
return jsx("h1", { children: "No search results...." });
|
|
30
|
-
return (jsx(AlgoliaProvider, { languageCode: languageCode, query: keyword, searchClient: searchClient, children: jsx(Page
|
|
30
|
+
return (jsx(AlgoliaProvider, { languageCode: languageCode, query: keyword, searchClient: searchClient, children: jsx(Page
|
|
31
|
+
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
|
|
32
|
+
, {
|
|
31
33
|
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
|
|
32
34
|
canonicalUrl: typeof window === 'undefined' ? '' : window.location.href, className: styles['search-results'], title: t("'{0}' in all products", {
|
|
33
35
|
replacementValues: { 0: keyword },
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
import { AccountModel } from 'shared/api/storefront/model/storefront.model';
|
|
2
|
-
export declare function useCreateGuestAccount(): import("@tanstack/react-query").UseMutationResult<AccountModel, Error,
|
|
3
|
-
defaultWarehouseId: string;
|
|
4
|
-
}, unknown>;
|
|
2
|
+
export declare function useCreateGuestAccount(): import("@tanstack/react-query").UseMutationResult<AccountModel, Error, void, unknown>;
|