@sonic-equipment/ui 260.0.5 → 260.0.6

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.
@@ -52,7 +52,10 @@ function SignInPage({ returnUrl } = {}) {
52
52
  setIsSuccess(true);
53
53
  navigate(returnUrl || paths.HOME, { reload: true });
54
54
  };
55
- const allowGuestSignIn = returnUrl?.toLowerCase() === paths.CHECKOUT_SHIPPING.toLowerCase();
55
+ const decodedReturnUrl = returnUrl
56
+ ? decodeURIComponent(returnUrl).toLowerCase()
57
+ : undefined;
58
+ const allowGuestSignIn = !!decodedReturnUrl?.includes(paths.CHECKOUT_SHIPPING.toLowerCase());
56
59
  const createAccountPath = `${paths.ACCOUNT_CREATE}${returnUrl ? `?returnUrl=${encodeURIComponent(returnUrl)}` : ''}`;
57
60
  const onSignIn = ({ data }) => {
58
61
  resetSignIn();
@@ -11,8 +11,6 @@ import { CheckoutPageLayout } from '../layouts/checkout-page-layout/checkout-pag
11
11
  import { Page } from '../../components/page/page.js';
12
12
  import { ErrorPage } from '../../error-page/error-page.js';
13
13
  import { LoadingPage } from '../../loading-page/loading-page.js';
14
- import { useSaveCartForLater } from '../../../shared/api/bff/hooks/cart/use-save-cart-for-later.js';
15
- import { useIsAuthenticated } from '../../../shared/api/storefront/hooks/authentication/use-is-authenticated.js';
16
14
  import { useDeleteCartLineById } from '../../../shared/api/storefront/hooks/cart/use-delete-cart-line-by-id.js';
17
15
  import { useDeleteCurrentCart } from '../../../shared/api/storefront/hooks/cart/use-delete-current-cart.js';
18
16
  import { useFetchCurrentCartLinesWithAtp } from '../../../shared/api/storefront/hooks/cart/use-fetch-current-cart-lines-with-atp.js';
@@ -27,22 +25,22 @@ function CartContent({ cartLines }) {
27
25
  const paths = usePaths();
28
26
  const { addToast } = useToast();
29
27
  const { data: currentCart } = useFetchCurrentCartWithAtp();
30
- const saveCartForLater = useSaveCartForLater({
31
- onError: () => {
32
- addToast({
33
- body: jsx(FormattedMessage, { id: "Unable to save cart for later." }),
34
- isUserDismissable: false,
35
- messageType: 'danger',
36
- });
37
- },
38
- onSuccess: () => {
39
- addToast({
40
- body: jsx(FormattedMessage, { id: "Saved cart for later." }),
41
- isUserDismissable: false,
42
- messageType: 'success',
43
- });
44
- },
45
- });
28
+ // const saveCartForLater = useSaveCartForLater({
29
+ // onError: () => {
30
+ // addToast({
31
+ // body: <FormattedMessage id="Unable to save cart for later." />,
32
+ // isUserDismissable: false,
33
+ // messageType: 'danger',
34
+ // })
35
+ // },
36
+ // onSuccess: () => {
37
+ // addToast({
38
+ // body: <FormattedMessage id="Saved cart for later." />,
39
+ // isUserDismissable: false,
40
+ // messageType: 'success',
41
+ // })
42
+ // },
43
+ // })
46
44
  const deleteCurrentCart = useDeleteCurrentCart({
47
45
  onError: () => {
48
46
  addToast({
@@ -75,7 +73,7 @@ function CartContent({ cartLines }) {
75
73
  });
76
74
  },
77
75
  });
78
- const isAuthenticated = useIsAuthenticated();
76
+ // const isAuthenticated = useIsAuthenticated()
79
77
  if (!currentCart)
80
78
  return null;
81
79
  const currencyCode = getCurrencyCodeBySymbol(currentCart.currencySymbol);
@@ -83,9 +81,25 @@ function CartContent({ cartLines }) {
83
81
  throw new Error(`Currency code not found for symbol ${currentCart.currencySymbol}`);
84
82
  return (jsx(CheckoutPageLayout, { actions: {
85
83
  primary: (jsx(Button, { withArrow: true, "data-test-selector": "checkoutShippingCartTotalContinueButton", href: paths.CHECKOUT_SHIPPING, children: jsx(FormattedMessage, { id: "Start checkout" }) })),
86
- secondary: isAuthenticated ? (jsx(Button, { color: "secondary", "data-test-selector": "saveCartForLaterButton", onClick: () => {
87
- saveCartForLater.mutate({ cart: currentCart });
88
- }, variant: "outline", children: jsx(FormattedMessage, { id: "Save order" }) })) : (jsx(Button, { color: "secondary", "data-test-selector": "saveCartForLaterButton", href: paths.SIGN_IN, variant: "outline", children: jsx(FormattedMessage, { id: "Save order" }) })),
84
+ // secondary: isAuthenticated ? (
85
+ // <Button
86
+ // color="secondary"
87
+ // data-test-selector="saveCartForLaterButton"
88
+ // onClick={() => {
89
+ // saveCartForLater.mutate({ cart: currentCart })
90
+ // }}
91
+ // variant="outline">
92
+ // <FormattedMessage id="Save order" />
93
+ // </Button>
94
+ // ) : (
95
+ // <Button
96
+ // color="secondary"
97
+ // data-test-selector="saveCartForLaterButton"
98
+ // href={paths.SIGN_IN}
99
+ // variant="outline">
100
+ // <FormattedMessage id="Save order" />
101
+ // </Button>
102
+ // ),
89
103
  }, mobileSummary: jsx(CartTotalsSummary, { currencyCode: currencyCode, totalAmount: currentCart.orderGrandTotal }), overview: jsx(CartTotals, { currencyCode: currencyCode, shippingCost: currentCart.shippingAndHandling, subtotal: currentCart.orderSubTotal, tax: currentCart.totalTax, total: currentCart.orderGrandTotal, vatPercentage: cartLines[0]?.pricing?.vatRate || 0 }), children: jsx(OrderLineList, { onRemoveAll: () => deleteCurrentCart.mutate(), children: cartLines.map(cartLine => (jsx(ConnectedOrderLineCard, { deliveryDate: cartLine.atp?.date ?? null, href: cartLine.productUri, image: {
90
104
  fit: 'contain',
91
105
  image: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonic-equipment/ui",
3
- "version": "260.0.5",
3
+ "version": "260.0.6",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "engines": {