@sonic-equipment/ui 132.0.0 → 134.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.
Files changed (130) hide show
  1. package/dist/address/address.d.ts +2 -13
  2. package/dist/algolia/{algolia-intialization.js → algolia-initialization.js} +7 -0
  3. package/dist/algolia/algolia-insights-provider.js +7 -0
  4. package/dist/algolia/algolia-search-provider.js +19 -0
  5. package/dist/algolia/use-algolia-insights.d.ts +13 -6
  6. package/dist/algolia/use-algolia-insights.js +93 -10
  7. package/dist/buttons/add-to-cart-button/connected-add-to-cart-button.js +1 -1
  8. package/dist/buttons/button/button.d.ts +4 -1
  9. package/dist/buttons/button/button.js +3 -2
  10. package/dist/country-selector/country-select/country-select.d.ts +1 -0
  11. package/dist/country-selector/country-select/country-select.js +2 -2
  12. package/dist/delivery-time/delivery-time.js +6 -5
  13. package/dist/display/info-display/info-display.d.ts +7 -0
  14. package/dist/display/info-display/info-display.js +8 -0
  15. package/dist/display/info-display/info-display.module.css.js +3 -0
  16. package/dist/exports.d.ts +20 -7
  17. package/dist/forms/checkbox/checkbox.d.ts +2 -1
  18. package/dist/forms/checkbox/checkbox.js +2 -2
  19. package/dist/forms/field-error/field-error.d.ts +2 -1
  20. package/dist/forms/field-error/field-error.js +3 -2
  21. package/dist/forms/input/input.d.ts +2 -0
  22. package/dist/forms/input/input.js +5 -3
  23. package/dist/forms/input/input.module.css.js +1 -1
  24. package/dist/forms/label/label.d.ts +3 -1
  25. package/dist/forms/label/label.js +3 -2
  26. package/dist/forms/switch/switch.d.ts +3 -1
  27. package/dist/forms/switch/switch.js +2 -2
  28. package/dist/forms/text-field/password-reveal-toggle/password-reveal-toggle.d.ts +10 -0
  29. package/dist/forms/text-field/password-reveal-toggle/password-reveal-toggle.js +18 -0
  30. package/dist/forms/text-field/password-reveal-toggle/password-reveal-toggle.module.css.js +3 -0
  31. package/dist/forms/text-field/text-field.d.ts +5 -3
  32. package/dist/forms/text-field/text-field.js +11 -3
  33. package/dist/forms/text-field/text-field.module.css.js +1 -1
  34. package/dist/forms/textarea/textarea.d.ts +1 -0
  35. package/dist/forms/textarea/textarea.js +3 -2
  36. package/dist/global-search/plugins/categories-plugin.js +2 -1
  37. package/dist/global-search/plugins/popular-categories-plugin.js +2 -0
  38. package/dist/global-search/plugins/query-suggestions-plugin.js +1 -0
  39. package/dist/global-search/plugins/quick-access-plugin.js +2 -2
  40. package/dist/global-search/search-result-panel/sections/with-results.js +0 -1
  41. package/dist/icons/stroke/stroke-dehashed-icon.js +7 -0
  42. package/dist/icons/stroke/stroke-hashed-icon.js +7 -0
  43. package/dist/index.js +22 -9
  44. package/dist/info-icon-tooltip/info-icon-tooltip.d.ts +7 -0
  45. package/dist/info-icon-tooltip/info-icon-tooltip.js +20 -0
  46. package/dist/info-icon-tooltip/info-icon-tooltip.module.css.js +3 -0
  47. package/dist/intl/translation-id.d.ts +1 -1
  48. package/dist/pages/checkout/cart-page/cart-page.js +6 -9
  49. package/dist/pages/checkout/cart-page/components/empty-cart-page.d.ts +1 -0
  50. package/dist/pages/checkout/cart-page/components/empty-cart-page.js +11 -0
  51. package/dist/pages/checkout/components/billing-and-invoice-information.d.ts +7 -0
  52. package/dist/pages/checkout/components/billing-and-invoice-information.js +12 -0
  53. package/dist/pages/checkout/components/billing-and-invoice-information.module.css.js +3 -0
  54. package/dist/pages/checkout/constants.d.ts +8 -0
  55. package/dist/pages/checkout/constants.js +10 -0
  56. package/dist/pages/checkout/layouts/checkout-page-layout/components/checkout-page-section.module.css.js +1 -1
  57. package/dist/pages/checkout/order-confirmation-page/order-confirmation-page-content.d.ts +5 -0
  58. package/dist/pages/checkout/order-confirmation-page/order-confirmation-page-content.js +83 -0
  59. package/dist/pages/checkout/order-confirmation-page/order-confirmation-page.d.ts +4 -0
  60. package/dist/pages/checkout/order-confirmation-page/order-confirmation-page.js +41 -0
  61. package/dist/pages/checkout/order-confirmation-page/order-confirmation-page.module.css.js +3 -0
  62. package/dist/{checkout → pages/checkout/payment-page/components}/adyen-payment.js +5 -5
  63. package/dist/pages/checkout/payment-page/components/adyen-payment.module.css.js +3 -0
  64. package/dist/{checkout → pages/checkout/payment-page/components}/payment.d.ts +4 -2
  65. package/dist/pages/checkout/payment-page/components/payment.js +288 -0
  66. package/dist/pages/checkout/payment-page/components/payment.module.css.js +3 -0
  67. package/dist/pages/checkout/payment-page/payment-page-content.d.ts +15 -0
  68. package/dist/pages/checkout/payment-page/payment-page-content.js +43 -0
  69. package/dist/pages/checkout/payment-page/payment-page.js +13 -41
  70. package/dist/{checkout → pages/checkout/payment-page/utils}/parse-amount.js +1 -1
  71. package/dist/pages/checkout/shipping-page/components/edit-address.js +11 -7
  72. package/dist/pages/checkout/shipping-page/hooks/use-patch-shipping-details.d.ts +12 -0
  73. package/dist/pages/checkout/shipping-page/hooks/use-patch-shipping-details.js +21 -0
  74. package/dist/pages/checkout/shipping-page/shipping-page-content.d.ts +14 -0
  75. package/dist/pages/checkout/shipping-page/shipping-page-content.js +40 -0
  76. package/dist/pages/checkout/shipping-page/shipping-page.js +55 -78
  77. package/dist/pages/checkout/shipping-page/shipping-page.module.css.js +1 -1
  78. package/dist/pages/components/page/page.d.ts +3 -2
  79. package/dist/pages/components/page/page.js +3 -2
  80. package/dist/pages/components/page-meta-data/page-meta-data.d.ts +3 -4
  81. package/dist/pages/components/page-meta-data/page-meta-data.js +2 -2
  82. package/dist/pages/product/product-details-page/components/product-details-panel/product-details-panel.js +11 -1
  83. package/dist/pages/product/product-details-page/product-details-page.js +2 -10
  84. package/dist/pages/product/product-details-page/product-details.js +10 -4
  85. package/dist/pages/product/product-listing-page/product-listing-page-data-types.d.ts +1 -1
  86. package/dist/pages/product/product-listing-page/product-listing-page.js +2 -10
  87. package/dist/pages/product/product-listing-page/product-listing-product-overview/product-listing-product-overview.js +0 -1
  88. package/dist/pages/product/product-listing-page/product-listing.js +8 -1
  89. package/dist/pages/product/search-result-page/search-result-product-overview/search-result-product-overview.js +0 -1
  90. package/dist/pages/product/search-result-page/search-results-page.js +4 -7
  91. package/dist/shared/api/bff/model/bff.model.d.ts +4 -4
  92. package/dist/shared/api/bff/services/bff-service.js +1 -4
  93. package/dist/shared/api/storefront/hooks/cart/use-fetch-cart-by-id.d.ts +8 -0
  94. package/dist/shared/api/storefront/hooks/cart/use-fetch-cart-by-id.js +20 -0
  95. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-count.d.ts +1 -1
  96. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-count.js +3 -3
  97. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart.d.ts +2 -5
  98. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart.js +3 -16
  99. package/dist/shared/api/storefront/hooks/cart/use-patch-cart.js +11 -8
  100. package/dist/shared/api/storefront/hooks/cart/use-place-order.js +2 -2
  101. package/dist/shared/fetch/request.d.ts +18 -13
  102. package/dist/shared/fetch/request.js +22 -9
  103. package/dist/shared/ga/use-data-layer.d.ts +7 -3
  104. package/dist/shared/ga/use-data-layer.js +6 -1
  105. package/dist/shared/model/address.d.ts +13 -0
  106. package/dist/shared/providers/react-query-container.d.ts +2 -1
  107. package/dist/shared/providers/react-query-container.js +2 -2
  108. package/dist/shared/utils/date.d.ts +2 -0
  109. package/dist/shared/utils/date.js +11 -1
  110. package/dist/shared/utils/promise.d.ts +2 -0
  111. package/dist/shared/utils/promise.js +9 -0
  112. package/dist/sign-in-form/sign-in-form.d.ts +19 -0
  113. package/dist/sign-in-form/sign-in-form.js +49 -0
  114. package/dist/sign-in-form/sign-in-form.module.css.js +3 -0
  115. package/dist/styles.css +532 -314
  116. package/dist/tooltip/tooltip.d.ts +3 -2
  117. package/dist/tooltip/tooltip.js +12 -6
  118. package/package.json +1 -1
  119. package/dist/checkout/adyen-payment.module.css.js +0 -3
  120. package/dist/checkout/payment.js +0 -213
  121. package/dist/checkout/payment.module.css.js +0 -3
  122. package/dist/shared/utils/wait.d.ts +0 -1
  123. package/dist/shared/utils/wait.js +0 -5
  124. /package/dist/algolia/{algolia-intialization.d.ts → algolia-initialization.d.ts} +0 -0
  125. /package/dist/{checkout → pages/checkout/payment-page/components}/adyen-payment.d.ts +0 -0
  126. /package/dist/{checkout → pages/checkout/payment-page/hooks}/use-get-adyen-redirect-result.d.ts +0 -0
  127. /package/dist/{checkout → pages/checkout/payment-page/hooks}/use-get-adyen-redirect-result.js +0 -0
  128. /package/dist/{checkout → pages/checkout/payment-page/hooks}/use-has-returned-from-adyen.d.ts +0 -0
  129. /package/dist/{checkout → pages/checkout/payment-page/hooks}/use-has-returned-from-adyen.js +0 -0
  130. /package/dist/{checkout → pages/checkout/payment-page/utils}/parse-amount.d.ts +0 -0
@@ -0,0 +1,83 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { PrintButton } from '../../../buttons/print-button/print-button.js';
3
+ import { OrderLineCard } from '../../../cards/orderline-card/orderline-card.js';
4
+ import { CartTotals } from '../../../cart-totals/cart-totals.js';
5
+ import { InfoDisplay } from '../../../display/info-display/info-display.js';
6
+ import { FormattedMessage } from '../../../intl/formatted-message.js';
7
+ import { useCultureCode } from '../../../intl/use-culture-code.js';
8
+ import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
9
+ import { OrderLineList } from '../../../lists/orderline-list/orderline-list.js';
10
+ import { useSaveCartForLater } from '../../../shared/api/storefront/hooks/cart/use-save-cart-for-later.js';
11
+ import { RouteButton } from '../../../shared/routing/route-button.js';
12
+ import { formatDateToLocaleString } from '../../../shared/utils/date.js';
13
+ import { useToast } from '../../../toast/use-toast.js';
14
+ import { Page } from '../../components/page/page.js';
15
+ import { BillingAndInvoiceInformation } from '../components/billing-and-invoice-information.js';
16
+ import { CHECKOUT_PATHS } from '../constants.js';
17
+ import { CheckoutPageLayout } from '../layouts/checkout-page-layout/checkout-page-layout.js';
18
+ import { CheckoutPageSection } from '../layouts/checkout-page-layout/components/checkout-page-section.js';
19
+ import { CheckoutPageSectionContent } from '../layouts/checkout-page-layout/components/checkout-page-section-content.js';
20
+ import styles from './order-confirmation-page.module.css.js';
21
+
22
+ function OrderConfirmationPageContent({ cart, }) {
23
+ const t = useFormattedMessage();
24
+ const { addToast } = useToast();
25
+ const cultureCode = useCultureCode();
26
+ const saveCartForLater = useSaveCartForLater({
27
+ onError: () => {
28
+ addToast({
29
+ body: jsx(FormattedMessage, { id: "Unable to save cart for later." }),
30
+ isUserDismissable: false,
31
+ messageType: 'danger',
32
+ });
33
+ },
34
+ onSuccess: () => {
35
+ addToast({
36
+ body: jsx(FormattedMessage, { id: "Saved cart for later." }),
37
+ isUserDismissable: false,
38
+ messageType: 'success',
39
+ });
40
+ },
41
+ });
42
+ return (jsx(Page, { breadCrumb: [{ href: CHECKOUT_PATHS.HOME, label: t('Home') }], title: t('Order confirmation'), children: jsx(CheckoutPageLayout, { actions: {
43
+ primary: (jsx(RouteButton, { withArrow: true, "data-test-selector": "checkoutShippingCartTotalContinueButton", href: "/", children: jsx(FormattedMessage, { id: "Continue shopping" }) })),
44
+ secondary: (jsxs(Fragment, { children: [cart.canSaveOrder && (jsx(RouteButton, { color: "secondary", onClick: () => {
45
+ saveCartForLater.mutate({ cart });
46
+ }, variant: "outline", children: jsx(FormattedMessage, { id: "Save order" }) })), jsx(PrintButton, {})] })),
47
+ }, overview: jsx(CartTotals, { fulfillmentMethod: t(`fulfillmentmethod.${cart.fulfillmentMethod}`), orderNumber: cart.orderNumber, shippingCost: cart.shippingAndHandlingDisplay, subtotal: cart.orderSubTotalDisplay, tax: cart.totalTaxDisplay, total: cart.orderGrandTotalDisplay, vatPercentage: cart.cartLines?.[0]?.pricing?.vatRate }), children: jsxs("div", { children: [jsx(CheckoutPageSection, { hasBorder: false, title: t('General'), children: jsx(CheckoutPageSectionContent, { children: jsxs("div", { className: styles['general-order-info'], children: [cart.orderDate && (jsx(InfoDisplay, { id: "order-date", label: t('Order date'), value: formatDateToLocaleString(new Date(cart.orderDate), cultureCode) })), cart.requestedDeliveryDateDisplay && (jsx(InfoDisplay, { id: "requested-delivery-date", label: t('Requested delivery date'), value: formatDateToLocaleString(new Date(cart.requestedDeliveryDateDisplay.toString()), cultureCode) })), cart.poNumber && (jsx(InfoDisplay, { id: "po-number", label: t('PO Number'), value: cart.poNumber }))] }) }) }), jsx(CheckoutPageSection, { hasBorder: false, title: t('Billing and shipping information'), children: jsx(CheckoutPageSectionContent, { children: jsx(BillingAndInvoiceInformation, { billToAddress: {
48
+ address1: cart.billTo?.address1,
49
+ address2: cart.billTo?.address2,
50
+ address3: cart.billTo?.address3,
51
+ city: cart.billTo?.city,
52
+ companyName: cart.billTo?.companyName,
53
+ country: cart.billTo?.country?.name,
54
+ email: cart.billTo?.email,
55
+ phone: cart.billTo?.phone,
56
+ postalCode: cart.billTo?.postalCode,
57
+ }, shipToAddress: {
58
+ address1: cart.shipTo?.address1,
59
+ address2: cart.shipTo?.address2,
60
+ address3: cart.shipTo?.address3,
61
+ city: cart.shipTo?.city,
62
+ companyName: cart.shipTo?.companyName,
63
+ country: cart.shipTo?.country?.name,
64
+ email: cart.shipTo?.email,
65
+ phone: cart.shipTo?.phone,
66
+ postalCode: cart.shipTo?.postalCode,
67
+ } }) }) }), jsx(CheckoutPageSection, { hasBorder: false, title: t('Order'), children: jsx(CheckoutPageSectionContent, { stretch: true, children: jsx(OrderLineList, { children: cart.cartLines?.map(cartLine => (jsx(OrderLineCard, { deliveryDate: cartLine.atp?.date, href: cartLine.productUri, image: {
68
+ fit: 'contain',
69
+ image: {
70
+ '1': cartLine.smallImagePath,
71
+ '2': cartLine.smallImagePath,
72
+ '3': cartLine.smallImagePath,
73
+ altText: cartLine.altText,
74
+ },
75
+ title: cartLine.altText,
76
+ }, isReadonly: true, price: {
77
+ originalTotalPrice: cartLine.pricing?.extendedUnitNetPrice || 0,
78
+ pricePerUnit: cartLine.pricing?.unitNetPrice || 0,
79
+ totalPrice: cartLine.pricing?.extendedUnitNetPrice || 0,
80
+ }, productId: cartLine.productId || '', quantity: cartLine.qtyOrdered || 1, sku: cartLine.erpNumber || '', tags: [], title: cartLine.productName }, cartLine.id))) }) }) })] }) }) }));
81
+ }
82
+
83
+ export { OrderConfirmationPageContent };
@@ -0,0 +1,4 @@
1
+ export interface OrderConfirmationPageProps {
2
+ cartId: string;
3
+ }
4
+ export declare function OrderConfirmationPage({ cartId }: OrderConfirmationPageProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,41 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useEffect } from 'react';
3
+ import { LoadingPage } from '../../loading-page/loading-page.js';
4
+ import { useIsAuthenticated } from '../../../shared/api/storefront/hooks/authentication/use-is-authenticated.js';
5
+ import { useFetchCartById } from '../../../shared/api/storefront/hooks/cart/use-fetch-cart-by-id.js';
6
+ import { useNavigate } from '../../../shared/routing/route-provider.js';
7
+ import { hasNo } from '../../../shared/utils/types.js';
8
+ import { ErrorPage } from '../../error-page/error-page.js';
9
+ import { CHECKOUT_PATHS } from '../constants.js';
10
+ import { OrderConfirmationPageContent } from './order-confirmation-page-content.js';
11
+
12
+ function OrderConfirmationPage({ cartId }) {
13
+ const isAuthenticated = useIsAuthenticated();
14
+ const { isNavigating, navigate } = useNavigate();
15
+ const { data: cart, error, isLoading: cartIsLoading, } = useFetchCartById({
16
+ id: cartId,
17
+ });
18
+ useEffect(() => {
19
+ if (!cart)
20
+ return;
21
+ if (isAuthenticated === undefined)
22
+ return;
23
+ if (!isAuthenticated)
24
+ return navigate(CHECKOUT_PATHS.CART);
25
+ if (cart.status === 'Cart')
26
+ navigate(CHECKOUT_PATHS.CART);
27
+ }, [cart, navigate, isAuthenticated]);
28
+ if (error)
29
+ return jsx(ErrorPage, { error: error });
30
+ if (cartIsLoading || isNavigating)
31
+ return jsx(LoadingPage, {});
32
+ if (!isAuthenticated ||
33
+ hasNo(cart) ||
34
+ hasNo(cart.cartLines) ||
35
+ cart.cartLines.length === 0) {
36
+ return null;
37
+ }
38
+ return jsx(OrderConfirmationPageContent, { cart: cart });
39
+ }
40
+
41
+ export { OrderConfirmationPage };
@@ -0,0 +1,3 @@
1
+ var styles = {"general-order-info":"order-confirmation-page-module-UvVzH"};
2
+
3
+ export { styles as default };
@@ -3,11 +3,11 @@ import { useRef, useEffect } from 'react';
3
3
  import AdyenCheckout from '@adyen/adyen-web';
4
4
  import clsx from 'clsx';
5
5
  import qs from 'query-string';
6
- import { useCultureCode } from '../intl/use-culture-code.js';
7
- import { useCreateAdyenSession } from '../shared/api/storefront/hooks/payment/use-create-adyen-session.js';
8
- import { useFetchAdyenConfig } from '../shared/api/storefront/hooks/payment/use-fetch-adyen-config.js';
9
- import { getAdyenPaymentDetails, postAdyenPayment } from '../shared/api/storefront/services/cart-service.js';
10
- import { parseAmount } from './parse-amount.js';
6
+ import { useCultureCode } from '../../../../intl/use-culture-code.js';
7
+ import { useCreateAdyenSession } from '../../../../shared/api/storefront/hooks/payment/use-create-adyen-session.js';
8
+ import { useFetchAdyenConfig } from '../../../../shared/api/storefront/hooks/payment/use-fetch-adyen-config.js';
9
+ import { getAdyenPaymentDetails, postAdyenPayment } from '../../../../shared/api/storefront/services/cart-service.js';
10
+ import { parseAmount } from '../utils/parse-amount.js';
11
11
  import styles from './adyen-payment.module.css.js';
12
12
 
13
13
  function AdyenPayment({ amount, cartId, countryCode, currencyCode, customerId, dropinRef, environment, onComplete, onError, orderAmount, returnUrl, }) {
@@ -0,0 +1,3 @@
1
+ var styles = {"loading":"adyen-payment-module-rV-qW"};
2
+
3
+ export { styles as default };
@@ -1,10 +1,12 @@
1
- import { AdyenPaymentModel, CartModel, CheckoutAtpEntry } from '../shared/api/storefront/model/storefront.model';
1
+ import { AdyenPaymentModel, CartModel, CheckoutAtpEntry } from '../../../../shared/api/storefront/model/storefront.model';
2
2
  export declare function Payment({ atp, cart: _cart, form, onError: _onError, onPaymentComplete, onProcessing, onValidating, }: {
3
3
  atp: CheckoutAtpEntry[];
4
4
  cart: CartModel;
5
5
  form: string;
6
6
  onError?: (error: unknown, result: AdyenPaymentModel | null) => void;
7
- onPaymentComplete: () => void;
7
+ onPaymentComplete: ({ cartId }: {
8
+ cartId: string;
9
+ }) => void;
8
10
  onProcessing: (processing: boolean) => void;
9
11
  onValidating: (validating: boolean) => void;
10
12
  }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,288 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { useRef, useState, useMemo, useEffect, useCallback } from 'react';
3
+ import { Form } from 'react-aria-components';
4
+ import { useAlgoliaInsights } from '../../../../algolia/use-algolia-insights.js';
5
+ import { Accordion } from '../../../../collapsables/accordion/accordion.js';
6
+ import { AccordionItem } from '../../../../collapsables/accordion/accordion-item.js';
7
+ import { config } from '../../../../config.js';
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';
12
+ import { InfoIconTooltip } from '../../../../info-icon-tooltip/info-icon-tooltip.js';
13
+ import { FormattedMessage } from '../../../../intl/formatted-message.js';
14
+ import { useFormattedMessage } from '../../../../intl/use-formatted-message.js';
15
+ import { usePatchSession } from '../../../../shared/api/storefront/hooks/authentication/use-patch-session.js';
16
+ import { usePatchCart } from '../../../../shared/api/storefront/hooks/cart/use-patch-cart.js';
17
+ import { usePlaceOrder } from '../../../../shared/api/storefront/hooks/cart/use-place-order.js';
18
+ import { useInvalidateAdyen } from '../../../../shared/api/storefront/hooks/payment/use-invalidate-adyen.js';
19
+ import { validateVATNumber } from '../../../../shared/api/storefront/services/finance-service.js';
20
+ import { useDataLayer } from '../../../../shared/ga/use-data-layer.js';
21
+ import { useDebouncedCallback } from '../../../../shared/hooks/use-debounced-callback.js';
22
+ import { currencySymbolToISO } from '../../../../shared/model/currency.js';
23
+ import { BillingAndInvoiceInformation } from '../../components/billing-and-invoice-information.js';
24
+ import { useHasReturnedFromAdyen } from '../hooks/use-has-returned-from-adyen.js';
25
+ import { AdyenPayment } from './adyen-payment.js';
26
+ import styles from './payment.module.css.js';
27
+
28
+ function Payment({ atp, cart: _cart, form, onError: _onError, onPaymentComplete, onProcessing, onValidating, }) {
29
+ const { createEcommerceEvent, dataLayer } = useDataLayer();
30
+ const { isLoading: isPatchingCart, mutate: patchCart } = usePatchCart();
31
+ const { isLoading: isPatchingSession } = usePatchSession();
32
+ const { isLoading: isPlacingCart, mutate: placeOrder } = usePlaceOrder();
33
+ const { sendPurchaseEventFromPaymentPage } = useAlgoliaInsights();
34
+ const dropinRef = useRef(null);
35
+ const [paymentError, setPaymentError] = useState();
36
+ const [apiError, setAPIError] = useState();
37
+ const invalidateAdyen = useInvalidateAdyen();
38
+ const [isValidatingVAT, setIsValidatingVAT] = useState(false);
39
+ const t = useFormattedMessage();
40
+ const cartRef = useRef(_cart);
41
+ const cart = cartRef.current;
42
+ const hasAtp = atp.length > 1;
43
+ const [asSoonAsPossible, setAsSoonAsPossible] = useState(!hasAtp);
44
+ const [deliveryDate, setDeliveryDate] = useState(cart.requestedDeliveryDateDisplay?.toString() || '');
45
+ const [selectedPaymentMethod, setSelectedPaymentMethod] = useState(cart.paymentOptions?.paymentMethods?.[0]?.name || 'ADY');
46
+ const countryCode = _cart.billTo?.country?.abbreviation;
47
+ const isAdyenPayment = selectedPaymentMethod === 'ADY' &&
48
+ cart.paymentOptions &&
49
+ cart.billTo?.id &&
50
+ countryCode;
51
+ const hasReturnedFromAdyen = useHasReturnedFromAdyen();
52
+ const isProcessing = useMemo(() => hasReturnedFromAdyen || isPlacingCart, [isPlacingCart, hasReturnedFromAdyen]);
53
+ useEffect(() => {
54
+ cartRef.current = _cart;
55
+ }, [_cart]);
56
+ useEffect(() => {
57
+ onValidating(isValidatingVAT || isPatchingSession);
58
+ }, [isPatchingSession, isValidatingVAT, onValidating]);
59
+ useEffect(() => {
60
+ onProcessing(isPatchingCart);
61
+ }, [isPatchingCart, onProcessing]);
62
+ useEffect(() => {
63
+ onProcessing(isProcessing);
64
+ }, [isProcessing, onProcessing]);
65
+ const [validationErrors, setValidationErrors] = useState({});
66
+ const atpSelectOptions = atp
67
+ .filter(atp => Boolean(atp.date))
68
+ .reduce((acc, atp) => ({
69
+ ...acc,
70
+ [atp.date || '']: atp.displayDate,
71
+ }), {});
72
+ const paymentMethodOptions = cart.paymentOptions?.paymentMethods?.reduce((acc, method) => {
73
+ acc[method.name] = t(`paymentMethod.${method.description}`);
74
+ return acc;
75
+ }, {});
76
+ const debouncedValidator = useDebouncedCallback(async (value) => {
77
+ if (!value)
78
+ return setValidationErrors({});
79
+ if (value.length < 8) {
80
+ return setValidationErrors({
81
+ ...validationErrors,
82
+ vatNumber: t('validation.tooShort'),
83
+ });
84
+ }
85
+ try {
86
+ setIsValidatingVAT(true);
87
+ const response = await validateVATNumber({ vatNumber: value });
88
+ if (response.isValid) {
89
+ setValidationErrors(prev => {
90
+ delete prev.vatNumber;
91
+ return prev;
92
+ });
93
+ }
94
+ else {
95
+ setValidationErrors({
96
+ ...validationErrors,
97
+ vatNumber: t('validation.invalid'),
98
+ });
99
+ }
100
+ }
101
+ catch {
102
+ setValidationErrors({
103
+ ...validationErrors,
104
+ vatNumber: t('validation.invalid'),
105
+ });
106
+ }
107
+ finally {
108
+ setIsValidatingVAT(false);
109
+ }
110
+ }, 500);
111
+ const onPlaceOrderCompleted = useCallback(({ cart, payment_type }) => {
112
+ dataLayer.push(createEcommerceEvent({
113
+ cart,
114
+ event: {
115
+ ecommerce: {
116
+ payment_type,
117
+ },
118
+ event: 'add_payment_info',
119
+ },
120
+ }), createEcommerceEvent({
121
+ cart,
122
+ event: {
123
+ ecommerce: {
124
+ payment_type,
125
+ },
126
+ event: 'purchase',
127
+ },
128
+ }), {
129
+ currency: currencySymbolToISO[cart.currencySymbol],
130
+ event: 'transactionComplete',
131
+ transactionAffiliation: cart.billTo?.companyName,
132
+ transactionId: cart.orderNumber,
133
+ transactionProducts: cart.cartLines?.map(cartLine => ({
134
+ name: cartLine.shortDescription,
135
+ price: cartLine.pricing?.unitNetPrice,
136
+ quantity: cartLine.qtyOrdered,
137
+ sku: cartLine.erpNumber,
138
+ })) || [],
139
+ transactionShipping: cart.shippingAndHandling,
140
+ transactionTax: cart.totalTax,
141
+ transactionTotal: cart.orderGrandTotal,
142
+ });
143
+ sendPurchaseEventFromPaymentPage({ cart });
144
+ }, [createEcommerceEvent, dataLayer, sendPurchaseEventFromPaymentPage]);
145
+ async function onSubmit(e) {
146
+ const formData = new FormData(e.currentTarget);
147
+ const cart = cartRef.current;
148
+ setValidationErrors(prev => prev); // NOTE: This makes sure the form is revalidated on submit
149
+ if (Object.keys(validationErrors).length > 0)
150
+ return;
151
+ if (isAdyenPayment) {
152
+ /* Adyen Payment */
153
+ if (!dropinRef.current) {
154
+ console.warn('Adyen Dropin not ready');
155
+ return;
156
+ }
157
+ dropinRef.current.showValidation();
158
+ if (!dropinRef.current.isValid)
159
+ return;
160
+ const updatedCart = {
161
+ ...cart,
162
+ customerVatNumber: formData.get('vatNumber')?.toString(),
163
+ poNumber: formData.get('poNumber')?.toString(),
164
+ properties: {
165
+ ...cart.properties,
166
+ industry: formData.get('industry')?.toString() || '',
167
+ },
168
+ requestedDeliveryDate: formData.get('deliveryDate')?.toString(),
169
+ };
170
+ try {
171
+ cartRef.current = await patchCart({
172
+ cart: updatedCart,
173
+ });
174
+ }
175
+ catch (error) {
176
+ console.error(error);
177
+ setAPIError(error);
178
+ }
179
+ try {
180
+ dropinRef.current.submit();
181
+ }
182
+ catch (error) {
183
+ console.error(error);
184
+ setPaymentError(error);
185
+ }
186
+ }
187
+ else {
188
+ /* Pay by Invoice */
189
+ const cart = cartRef.current;
190
+ try {
191
+ await placeOrder({ cart });
192
+ onPlaceOrderCompleted({
193
+ cart,
194
+ payment_type: cart.paymentMethod?.name || '',
195
+ });
196
+ return onPaymentComplete({ cartId: cart.trackId });
197
+ }
198
+ catch (error) {
199
+ console.error(error);
200
+ setPaymentError(error);
201
+ }
202
+ }
203
+ }
204
+ const onComplete = useCallback(
205
+ /* Adyen payment continuation after submit */
206
+ async (result) => {
207
+ const cart = cartRef.current;
208
+ try {
209
+ await placeOrder({
210
+ cart: {
211
+ ...cart,
212
+ paymentMethod: null,
213
+ paymentOptions: {
214
+ ...cart.paymentOptions, // Hack needed to make B2B happy
215
+ adyenPspReference: result.pspReference,
216
+ isAdyenDropIn: true,
217
+ },
218
+ },
219
+ });
220
+ onPlaceOrderCompleted({
221
+ cart,
222
+ payment_type: 'Adyen',
223
+ });
224
+ return onPaymentComplete({ cartId: cart.trackId });
225
+ }
226
+ catch (error) {
227
+ console.error(error);
228
+ setAPIError(error);
229
+ }
230
+ }, [onPaymentComplete, onPlaceOrderCompleted, placeOrder]);
231
+ const onError = useCallback((error, result) => {
232
+ invalidateAdyen();
233
+ // invalidateCurrentCart()
234
+ setPaymentError(error);
235
+ console.error(error);
236
+ _onError?.(error, result);
237
+ }, [_onError, invalidateAdyen]);
238
+ return (jsxs(Form, { className: styles['payment-form'], "data-test-selector": "paymentForm", id: form, onSubmit: e => {
239
+ e.preventDefault();
240
+ onSubmit(e);
241
+ }, 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: hasReturnedFromAdyen || 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: hasReturnedFromAdyen || !hasAtp, isSelected: asSoonAsPossible, onChange: checked => {
242
+ setAsSoonAsPossible(checked);
243
+ if (checked)
244
+ setDeliveryDate('');
245
+ }, 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: hasReturnedFromAdyen, label: t('Industry'), name: "industry", options: {
246
+ /* eslint-disable sort-keys-fix/sort-keys-fix */
247
+ PP: 'Private User',
248
+ AU: 'Automotive',
249
+ MC: 'Motorcycle',
250
+ BC: 'Bicycle',
251
+ TR: 'Truck',
252
+ AG: 'Agricultural',
253
+ AV: 'Aviation',
254
+ MA: 'Maritime',
255
+ OT: 'Other',
256
+ /* eslint-enable sort-keys-fix/sort-keys-fix */
257
+ }, variant: "solid" }), jsx(TextField, { showLabel: true, defaultValue: cart.customerVatNumber, isDisabled: hasReturnedFromAdyen || isProcessing, label: t('VAT Number'), name: "vatNumber", onInput: e => debouncedValidator(e.target.value), validate: () => validationErrors.vatNumber ?? true }), jsx(TextField, { showLabel: true, defaultValue: cart.poNumber, isDisabled: hasReturnedFromAdyen || isProcessing, 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: (hasReturnedFromAdyen ||
258
+ (cart.paymentOptions?.paymentMethods &&
259
+ cart.paymentOptions.paymentMethods.length <= 1)) ??
260
+ 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,
261
+ // TODO: Use the correct Adyen environment before going live
262
+ environment: "test", onComplete: onComplete, onError: onError, orderAmount: cart.orderGrandTotal, returnUrl: typeof window === 'undefined'
263
+ ? ''
264
+ : /* eslint-disable ssr-friendly/no-dom-globals-in-react-fc */
265
+ `${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: {
266
+ address1: cart.billTo?.address1,
267
+ address2: cart.billTo?.address2,
268
+ address3: cart.billTo?.address3,
269
+ city: cart.billTo?.city,
270
+ companyName: cart.billTo?.companyName,
271
+ country: cart.billTo?.country?.name,
272
+ email: cart.billTo?.email,
273
+ phone: cart.billTo?.phone,
274
+ postalCode: cart.billTo?.postalCode,
275
+ }, shipToAddress: {
276
+ address1: cart.shipTo?.address1,
277
+ address2: cart.shipTo?.address2,
278
+ address3: cart.shipTo?.address3,
279
+ city: cart.shipTo?.city,
280
+ companyName: cart.shipTo?.companyName,
281
+ country: cart.shipTo?.country?.name,
282
+ email: cart.shipTo?.email,
283
+ phone: cart.shipTo?.phone,
284
+ postalCode: cart.shipTo?.postalCode,
285
+ } }) }) }) })] }));
286
+ }
287
+
288
+ export { Payment };
@@ -0,0 +1,3 @@
1
+ var styles = {"error-message":"payment-module-ZvObJ","payment-form":"payment-module-i4R0m","delivery-date":"payment-module-gtAqD","asap-checkbox":"payment-module-fP31W"};
2
+
3
+ export { styles as default };
@@ -0,0 +1,15 @@
1
+ import { CartModel, CheckoutAtpEntry } from '../../../shared/api/storefront/model/storefront.model';
2
+ export interface PaymentContentProps {
3
+ atp: CheckoutAtpEntry[];
4
+ cart: CartModel;
5
+ formId: string;
6
+ hasAtp: boolean;
7
+ isProcessing: boolean;
8
+ isValidating: boolean;
9
+ onPaymentComplete: ({ cartId }: {
10
+ cartId: string;
11
+ }) => void;
12
+ setIsProcessing: (isProcessing: boolean) => void;
13
+ setIsValidating: (isValidating: boolean) => void;
14
+ }
15
+ export declare function PaymentPageContent({ atp, cart, formId, hasAtp, isProcessing, isValidating, onPaymentComplete, setIsProcessing, setIsValidating, }: PaymentContentProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,43 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { Button } from '../../../buttons/button/button.js';
3
+ import { OrderLineCard } from '../../../cards/orderline-card/orderline-card.js';
4
+ import { CartTotals } from '../../../cart-totals/cart-totals.js';
5
+ import { CartTotalsSummary } from '../../../cart-totals/cart-totals-summary.js';
6
+ import { FormattedMessage } from '../../../intl/formatted-message.js';
7
+ import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
8
+ import { OrderLineList } from '../../../lists/orderline-list/orderline-list.js';
9
+ import { Page } from '../../components/page/page.js';
10
+ import { CHECKOUT_PATHS } from '../constants.js';
11
+ import { CheckoutPageLayout } from '../layouts/checkout-page-layout/checkout-page-layout.js';
12
+ import { CheckoutPageSection } from '../layouts/checkout-page-layout/components/checkout-page-section.js';
13
+ import { CheckoutPageSectionContent } from '../layouts/checkout-page-layout/components/checkout-page-section-content.js';
14
+ import { Payment } from './components/payment.js';
15
+
16
+ function PaymentPageContent({ atp, cart, formId, hasAtp, isProcessing, isValidating, onPaymentComplete, setIsProcessing, setIsValidating, }) {
17
+ const t = useFormattedMessage();
18
+ return (jsx(Page, { breadCrumb: [
19
+ { href: CHECKOUT_PATHS.HOME, label: t('Home') },
20
+ {
21
+ href: CHECKOUT_PATHS.REVIEW_AND_SUBMIT,
22
+ label: t('Review and payment'),
23
+ },
24
+ ], title: t('Review and payment'), children: jsxs(CheckoutPageLayout, { actions: {
25
+ primary: (jsx(Button, { withArrow: true, "data-test-selector": "checkoutShippingCartTotalContinueButton", form: formId, isDisabled: isProcessing, isLoading: isProcessing ? (jsx(FormattedMessage, { id: "Processing" })) : isValidating ? (jsx(FormattedMessage, { id: "Validating" })) : (false), type: "submit", children: jsx(FormattedMessage, { id: "Pay" }) })),
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, onValidating: setIsValidating }) }) }), 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
+ fit: 'contain',
29
+ image: {
30
+ '1': cartLine.smallImagePath,
31
+ '2': cartLine.smallImagePath,
32
+ '3': cartLine.smallImagePath,
33
+ altText: cartLine.altText,
34
+ },
35
+ title: cartLine.altText,
36
+ }, isReadonly: true, price: {
37
+ originalTotalPrice: cartLine.pricing?.extendedUnitNetPrice || 0,
38
+ pricePerUnit: cartLine.pricing?.unitNetPrice || 0,
39
+ totalPrice: cartLine.pricing?.extendedUnitNetPrice || 0,
40
+ }, productId: cartLine.productId || '', quantity: cartLine.qtyOrdered || 1, sku: cartLine.erpNumber || '', tags: [], title: cartLine.productName }, cartLine.id))) }) }) })] }) }));
41
+ }
42
+
43
+ export { PaymentPageContent };
@@ -1,25 +1,15 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import { useState, useCallback, useEffect } from 'react';
3
- import { Button } from '../../../buttons/button/button.js';
4
- import { OrderLineCard } from '../../../cards/orderline-card/orderline-card.js';
5
- import { CartTotals } from '../../../cart-totals/cart-totals.js';
6
- import { CartTotalsSummary } from '../../../cart-totals/cart-totals-summary.js';
7
- import { Payment } from '../../../checkout/payment.js';
8
- import { useHasReturnedFromAdyen } from '../../../checkout/use-has-returned-from-adyen.js';
9
- import { FormattedMessage } from '../../../intl/formatted-message.js';
10
- import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
11
- import { OrderLineList } from '../../../lists/orderline-list/orderline-list.js';
12
3
  import { useIsAuthenticated } from '../../../shared/api/storefront/hooks/authentication/use-is-authenticated.js';
13
4
  import { useFetchCurrentCheckoutAtp } from '../../../shared/api/storefront/hooks/cart/use-fetch-current-cart-checkout-atp.js';
14
5
  import { useFetchCurrentCartWithAtp } from '../../../shared/api/storefront/hooks/cart/use-fetch-current-cart-with-atp.js';
15
6
  import { useNavigate } from '../../../shared/routing/route-provider.js';
16
7
  import { hasNo } from '../../../shared/utils/types.js';
17
- import { Page } from '../../components/page/page.js';
18
8
  import { ErrorPage } from '../../error-page/error-page.js';
19
9
  import { LoadingPage } from '../../loading-page/loading-page.js';
20
- import { CheckoutPageLayout } from '../layouts/checkout-page-layout/checkout-page-layout.js';
21
- import { CheckoutPageSection } from '../layouts/checkout-page-layout/components/checkout-page-section.js';
22
- import { CheckoutPageSectionContent } from '../layouts/checkout-page-layout/components/checkout-page-section-content.js';
10
+ import { CHECKOUT_PATHS } from '../constants.js';
11
+ import { useHasReturnedFromAdyen } from './hooks/use-has-returned-from-adyen.js';
12
+ import { PaymentPageContent } from './payment-page-content.js';
23
13
 
24
14
  const PAYMENT_FORM_ID = 'paymentForm';
25
15
  function PaymentPage() {
@@ -29,28 +19,29 @@ function PaymentPage() {
29
19
  forceRecalculation: !hasReturnedFromAdyen,
30
20
  });
31
21
  const { data: atp, isLoading: isAtpLoading } = useFetchCurrentCheckoutAtp();
32
- const hasAtp = atp && atp.length > 0 && atp[0]?.date !== null;
22
+ const hasAtp = atp && atp.length > 1;
33
23
  const isLoading = isLoadingCart || isAtpLoading;
34
- const t = useFormattedMessage();
35
24
  const [isProcessing, setIsProcessing] = useState(false);
36
25
  const [isValidating, setIsValidating] = useState(false);
37
26
  const { isNavigating, navigate } = useNavigate();
38
- const onPaymentComplete = useCallback(() => navigate('/CheckoutConfirmation'), [navigate]);
27
+ const onPaymentComplete = useCallback(({ cartId }) => {
28
+ navigate(`${CHECKOUT_PATHS.ORDER_CONFIRMATION}?cartId=${cartId}`);
29
+ }, [navigate]);
39
30
  useEffect(() => {
40
31
  if (isNavigating)
41
32
  return;
42
33
  if (isAuthenticated === undefined)
43
34
  return;
44
35
  if (!isAuthenticated)
45
- return navigate('/signin?returnUrl=/CheckoutShipping');
36
+ return navigate(CHECKOUT_PATHS.CHECKOUT_SHIPPING_VIA_SIGNIN);
46
37
  if (hasNo(cart))
47
38
  return;
48
39
  if (hasNo(cart.cartLines) || cart.cartLines.length === 0)
49
- return navigate('/cart');
40
+ return navigate(CHECKOUT_PATHS.CART);
50
41
  if (hasNo(cart.billTo))
51
- return navigate('/signin?returnUrl=/CheckoutShipping');
42
+ return navigate(CHECKOUT_PATHS.CHECKOUT_SHIPPING_VIA_SIGNIN);
52
43
  if (hasNo(cart.billTo.address1))
53
- return navigate('/CheckoutShipping');
44
+ return navigate(CHECKOUT_PATHS.CHECKOUT_SHIPPING);
54
45
  }, [cart, navigate, isAuthenticated, isNavigating]);
55
46
  if (error)
56
47
  return jsx(ErrorPage, { error: error });
@@ -63,26 +54,7 @@ function PaymentPage() {
63
54
  cart.cartLines.length === 0 ||
64
55
  hasNo(cart.billTo?.address1))
65
56
  return null;
66
- return (jsx(Page, { breadCrumb: [
67
- { href: '/', label: t('Home') },
68
- { href: '/CheckoutReviewAndSubmit', label: t('Review and payment') },
69
- ], title: t('Review and payment'), children: jsxs(CheckoutPageLayout, { actions: {
70
- primary: (jsx(Button, { withArrow: true, "data-test-selector": "checkoutShippingCartTotalContinueButton", form: PAYMENT_FORM_ID, isDisabled: isProcessing, isLoading: isProcessing ? (jsx(FormattedMessage, { id: "Processing" })) : isValidating ? (jsx(FormattedMessage, { id: "Validating" })) : (false), type: "submit", children: jsx(FormattedMessage, { id: "Pay" }) })),
71
- }, mobileSummary: jsx(CartTotalsSummary, { totalAmount: cart.orderGrandTotalDisplay }), overview: jsx(CartTotals, { deliveryDate: hasAtp ? undefined : cart.requestedDeliveryDate, fulfillmentMethod: cart.fulfillmentMethod, isPayByInvoice: (cart.paymentOptions?.paymentMethods?.length || 1) <= 1 &&
72
- 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: PAYMENT_FORM_ID, onPaymentComplete: onPaymentComplete, onProcessing: setIsProcessing, onValidating: setIsValidating }) }) }), 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: {
73
- fit: 'contain',
74
- image: {
75
- '1': cartLine.smallImagePath,
76
- '2': cartLine.smallImagePath,
77
- '3': cartLine.smallImagePath,
78
- altText: cartLine.altText,
79
- },
80
- title: cartLine.altText,
81
- }, isReadonly: true, price: {
82
- originalTotalPrice: cartLine.pricing?.extendedUnitNetPrice || 0,
83
- pricePerUnit: cartLine.pricing?.unitNetPrice || 0,
84
- totalPrice: cartLine.pricing?.extendedUnitNetPrice || 0,
85
- }, productId: cartLine.productId || '', quantity: cartLine.qtyOrdered || 1, sku: cartLine.erpNumber || '', tags: [], title: cartLine.productName }, cartLine.id))) }) }) })] }) }));
57
+ return (jsx(PaymentPageContent, { atp: atp, cart: cart, formId: PAYMENT_FORM_ID, hasAtp: Boolean(hasAtp), isProcessing: isProcessing, isValidating: isValidating, onPaymentComplete: onPaymentComplete, setIsProcessing: setIsProcessing, setIsValidating: setIsValidating }));
86
58
  }
87
59
 
88
60
  export { PaymentPage };
@@ -1,4 +1,4 @@
1
- import { getCurrencyByCountryCode } from '../shared/utils/price.js';
1
+ import { getCurrencyByCountryCode } from '../../../../shared/utils/price.js';
2
2
 
3
3
  function parseAmount(amount, countryCode) {
4
4
  return {