@sonic-equipment/ui 260.0.3 → 260.0.4

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.
@@ -20,10 +20,13 @@ function CreateAccountPage({ returnUrl } = {}) {
20
20
  const { error: errorCreateAccount, isPending: isPendingCreateAccount, isSuccess, mutate: createAccount, } = useCreateAccount();
21
21
  const isExistingAccount = errorCreateAccount instanceof ExistingAccountError;
22
22
  const isDisabled = isSuccess || isExistingAccount;
23
- const continuePath = returnUrl && decodeURIComponent(returnUrl) !== paths.ACCOUNT_CREATE
24
- ? decodeURIComponent(returnUrl)
25
- : paths.ACCOUNT;
26
- const isReturnToShipping = returnUrl && decodeURIComponent(returnUrl) === paths.CHECKOUT_SHIPPING;
23
+ let continuePath = paths.ACCOUNT;
24
+ let isReturnToShipping = false;
25
+ if (returnUrl) {
26
+ const decodedReturnUrl = decodeURIComponent(returnUrl).toLowerCase();
27
+ continuePath = returnUrl;
28
+ isReturnToShipping = decodedReturnUrl.includes(paths.CHECKOUT_SHIPPING.toLowerCase());
29
+ }
27
30
  const onSubmit = ({ data }) => {
28
31
  createAccount(data, {
29
32
  onSuccess() {
@@ -1,7 +1,6 @@
1
1
  "use client";
2
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { Button } from '../../../buttons/button/button.js';
4
- import { PrintButton } from '../../../buttons/print-button/print-button.js';
5
4
  import { OrderLineCard } from '../../../cards/orderline-card/orderline-card.js';
6
5
  import { CartTotals } from '../../../cart-totals/cart-totals.js';
7
6
  import { InfoDisplay } from '../../../display/info-display/info-display.js';
@@ -9,11 +8,9 @@ import { FormattedDate } from '../../../intl/formatted-date.js';
9
8
  import { FormattedMessage } from '../../../intl/formatted-message.js';
10
9
  import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
11
10
  import { OrderLineList } from '../../../lists/orderline-list/orderline-list.js';
12
- import { useSaveCartForLater } from '../../../shared/api/bff/hooks/cart/use-save-cart-for-later.js';
13
11
  import { getCurrencyCodeBySymbol } from '../../../shared/model/currency.js';
14
12
  import { usePaths } from '../../../shared/routing/use-paths.js';
15
13
  import { ensureNumber } from '../../../shared/utils/number.js';
16
- import { useToast } from '../../../toast/use-toast.js';
17
14
  import { Page } from '../../components/page/page.js';
18
15
  import { BillingAndInvoiceInformation } from '../components/billing-and-invoice-information.js';
19
16
  import { CheckoutPageLayout } from '../layouts/checkout-page-layout/checkout-page-layout.js';
@@ -24,23 +21,23 @@ import styles from './order-confirmation-page.module.css.js';
24
21
  function OrderConfirmationPageContent({ cart, }) {
25
22
  const t = useFormattedMessage();
26
23
  const paths = usePaths();
27
- const { addToast } = useToast();
28
- const saveCartForLater = useSaveCartForLater({
29
- onError: () => {
30
- addToast({
31
- body: jsx(FormattedMessage, { id: "Unable to save cart for later." }),
32
- isUserDismissable: false,
33
- messageType: 'danger',
34
- });
35
- },
36
- onSuccess: () => {
37
- addToast({
38
- body: jsx(FormattedMessage, { id: "Saved cart for later." }),
39
- isUserDismissable: false,
40
- messageType: 'success',
41
- });
42
- },
43
- });
24
+ // const { addToast } = useToast()
25
+ // const saveCartForLater = useSaveCartForLater({
26
+ // onError: () => {
27
+ // addToast({
28
+ // body: <FormattedMessage id="Unable to save cart for later." />,
29
+ // isUserDismissable: false,
30
+ // messageType: 'danger',
31
+ // })
32
+ // },
33
+ // onSuccess: () => {
34
+ // addToast({
35
+ // body: <FormattedMessage id="Saved cart for later." />,
36
+ // isUserDismissable: false,
37
+ // messageType: 'success',
38
+ // })
39
+ // },
40
+ // })
44
41
  const currencyCode = getCurrencyCodeBySymbol(cart.currencySymbol);
45
42
  if (!currencyCode)
46
43
  throw new Error(`Currency code not found for symbol ${cart.currencySymbol}`);
@@ -52,9 +49,21 @@ function OrderConfirmationPageContent({ cart, }) {
52
49
  },
53
50
  ], "data-test-selector": "orderConfirmationPage", title: t('Order confirmation'), children: jsx(CheckoutPageLayout, { actions: {
54
51
  primary: (jsx(Button, { withArrow: true, "data-test-selector": "checkoutReviewAndSubmit_continueShopping", href: paths.HOME, children: jsx(FormattedMessage, { id: "Continue shopping" }) })),
55
- secondary: (jsxs(Fragment, { children: [cart.canSaveOrder && (jsx(Button, { color: "secondary", onClick: () => {
56
- saveCartForLater.mutate({ cart });
57
- }, variant: "outline", children: jsx(FormattedMessage, { id: "Save order" }) })), jsx(PrintButton, {})] })),
52
+ // secondary: (
53
+ // <>
54
+ // {cart.canSaveOrder && (
55
+ // <Button
56
+ // color="secondary"
57
+ // onClick={() => {
58
+ // saveCartForLater.mutate({ cart })
59
+ // }}
60
+ // variant="outline">
61
+ // <FormattedMessage id="Save order" />
62
+ // </Button>
63
+ // )}
64
+ // <PrintButton />
65
+ // </>
66
+ // ),
58
67
  }, overview: jsx(CartTotals, { currencyCode: currencyCode, fulfillmentMethod: cart.fulfillmentMethod, orderNumber: cart.orderNumber, shippingCost: cart.shippingAndHandling, subtotal: cart.orderSubTotal, tax: cart.totalTax, total: cart.orderGrandTotal, 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: jsx(FormattedDate, { date: cart.orderDate }) })), cart.requestedDeliveryDateDisplay && (jsx(InfoDisplay, { id: "requested-delivery-date", label: t('Requested delivery date'), value: jsx(FormattedDate, { date: cart.requestedDeliveryDateDisplay }) })), 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: cart.billTo && {
59
68
  address1: cart.billTo.address1,
60
69
  address2: cart.billTo.address2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonic-equipment/ui",
3
- "version": "260.0.3",
3
+ "version": "260.0.4",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "engines": {