@sonic-equipment/ui 138.0.0 → 140.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/collapsables/accordion/accordion-item.d.ts +2 -1
- package/dist/collapsables/accordion/accordion-item.js +2 -2
- package/dist/exports.d.ts +5 -1
- package/dist/global-search/global-search.js +1 -1
- package/dist/global-search/search-input/connected-search-input.js +1 -1
- package/dist/index.js +6 -3
- package/dist/media/image/image.js +14 -4
- package/dist/modals/dialog/dialog.js +2 -2
- package/dist/pages/account/sign-in-page/sign-in-page.js +11 -5
- package/dist/pages/checkout/order-confirmation-page/order-confirmation-page.js +1 -1
- package/dist/pages/checkout/payment-page/components/payment.js +2 -1
- package/dist/pages/checkout/payment-page/payment-page.js +1 -1
- package/dist/pages/checkout/shipping-page/components/{edit-address.d.ts → edit-address-form.d.ts} +1 -1
- package/dist/pages/checkout/shipping-page/components/{edit-address.js → edit-address-form.js} +3 -3
- package/dist/pages/checkout/shipping-page/components/edit-address-form.module.css.js +3 -0
- package/dist/pages/checkout/shipping-page/components/readonly-address.js +1 -1
- package/dist/pages/checkout/shipping-page/shipping-page-content.js +1 -1
- package/dist/pages/checkout/shipping-page/shipping-page.js +3 -3
- package/dist/pages/paths.d.ts +1 -1
- package/dist/pages/paths.js +1 -1
- package/dist/shared/api/storefront/hooks/authentication/use-create-guest-account.js +2 -2
- package/dist/shared/api/storefront/hooks/authentication/use-sign-in.js +8 -2
- package/dist/shared/api/storefront/hooks/cart/use-patch-cart.d.ts +1 -0
- package/dist/shared/api/storefront/services/cart-service.d.ts +2 -1
- package/dist/shared/api/storefront/services/cart-service.js +2 -2
- package/dist/shared/ga/google-analytics-provider.d.ts +2 -1
- package/dist/shared/ga/google-analytics-provider.js +9 -8
- package/dist/shared/model/image.d.ts +1 -1
- package/dist/shared/model/image.js +3 -1
- package/dist/shared/routing/route-provider.d.ts +2 -17
- package/dist/shared/routing/route-provider.js +1 -43
- package/dist/shared/routing/types.d.ts +10 -0
- package/dist/shared/routing/use-base-path.d.ts +1 -0
- package/dist/shared/routing/use-base-path.js +12 -0
- package/dist/shared/routing/use-navigate.d.ts +6 -0
- package/dist/shared/routing/use-navigate.js +23 -0
- package/dist/shared/routing/use-on-navigate.d.ts +2 -0
- package/dist/shared/routing/use-on-navigate.js +19 -0
- package/dist/shared/routing/with-routing.d.ts +1 -1
- package/dist/shared/routing/with-routing.js +2 -1
- package/dist/sign-in-form/sign-in-form.js +6 -1
- package/dist/styles.css +13 -9
- package/package.json +1 -1
- package/dist/pages/checkout/shipping-page/components/edit-address.module.css.js +0 -3
|
@@ -7,10 +7,11 @@ export interface AccordionItemProps {
|
|
|
7
7
|
borderType?: BorderType | BorderType[];
|
|
8
8
|
children: ReactNode;
|
|
9
9
|
className?: string;
|
|
10
|
+
'data-test-selector'?: string;
|
|
10
11
|
id: string;
|
|
11
12
|
initialIsOpen?: boolean;
|
|
12
13
|
isDisabled?: boolean;
|
|
13
14
|
size?: 'md' | 'lg';
|
|
14
15
|
title: ReactNode;
|
|
15
16
|
}
|
|
16
|
-
export declare function AccordionItem({ _pseudo, allowCollapse, allowToggle, borderType, children, className, id, initialIsOpen, isDisabled, size, title, }: AccordionItemProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function AccordionItem({ _pseudo, allowCollapse, allowToggle, borderType, children, className, 'data-test-selector': dataTestSelector, id, initialIsOpen, isDisabled, size, title, }: AccordionItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,7 +8,7 @@ import { useDisclosure } from '../../shared/hooks/use-disclosure.js';
|
|
|
8
8
|
import { ensureArray } from '../../shared/utils/array.js';
|
|
9
9
|
import styles from './accordion.module.css.js';
|
|
10
10
|
|
|
11
|
-
function AccordionItem({ _pseudo = 'none', allowCollapse = true, allowToggle = true, borderType = 'bottom', children, className, id, initialIsOpen = false, isDisabled = false, size, title, }) {
|
|
11
|
+
function AccordionItem({ _pseudo = 'none', allowCollapse = true, allowToggle = true, borderType = 'bottom', children, className, 'data-test-selector': dataTestSelector, id, initialIsOpen = false, isDisabled = false, size, title, }) {
|
|
12
12
|
const { close, isOpen, open, toggle } = useDisclosure(initialIsOpen);
|
|
13
13
|
useEffect(() => {
|
|
14
14
|
if (initialIsOpen) {
|
|
@@ -22,7 +22,7 @@ function AccordionItem({ _pseudo = 'none', allowCollapse = true, allowToggle = t
|
|
|
22
22
|
return (jsxs("div", { className: clsx(className, ...ensureArray(borderType).map(type => styles[`border-type-${type}`]), styles['accordion-item'], isDisabled && styles.disabled, {
|
|
23
23
|
[styles['is-open']]: isOpen,
|
|
24
24
|
[styles['allow-toggle']]: allowToggle,
|
|
25
|
-
}), children: [jsx("h3", { children: allowCollapse ? (jsxs("button", { "aria-controls": panelId, "aria-expanded": isOpen, className: clsx(styles.button, styles[_pseudo]), disabled: isDisabled, id: id, onClick: () => {
|
|
25
|
+
}), "data-test-selector": dataTestSelector, children: [jsx("h3", { children: allowCollapse ? (jsxs("button", { "aria-controls": panelId, "aria-expanded": isOpen, className: clsx(styles.button, styles[_pseudo]), disabled: isDisabled, id: id, onClick: () => {
|
|
26
26
|
if (allowToggle)
|
|
27
27
|
toggle();
|
|
28
28
|
}, type: "button", children: [title, jsx("span", { className: styles.icon, children: size === 'lg' ? (jsx(GlyphsChevronsBoldDownIcon, {})) : (jsx(GlyphsChevronsSlimDownIcon, {})) })] })) : (jsx("span", { className: styles.button, children: title })) }), jsx("div", { "aria-labelledby": id, className: styles.panel, id: panelId, role: "region", children: jsx("div", { className: styles.content, children: children }) })] }));
|
package/dist/exports.d.ts
CHANGED
|
@@ -167,7 +167,7 @@ export * from './pages/checkout/payment-page/hooks/use-has-returned-from-adyen';
|
|
|
167
167
|
export * from './pages/checkout/payment-page/payment-page';
|
|
168
168
|
export * from './pages/checkout/payment-page/payment-page-content';
|
|
169
169
|
export * from './pages/checkout/payment-page/utils/parse-amount';
|
|
170
|
-
export * from './pages/checkout/shipping-page/components/edit-address';
|
|
170
|
+
export * from './pages/checkout/shipping-page/components/edit-address-form';
|
|
171
171
|
export * from './pages/checkout/shipping-page/components/readonly-address';
|
|
172
172
|
export * from './pages/checkout/shipping-page/components/sonic-address';
|
|
173
173
|
export * from './pages/checkout/shipping-page/hooks/use-patch-shipping-details';
|
|
@@ -293,6 +293,10 @@ export * from './shared/routing/route-button';
|
|
|
293
293
|
export * from './shared/routing/route-icon-button';
|
|
294
294
|
export * from './shared/routing/route-link';
|
|
295
295
|
export * from './shared/routing/route-provider';
|
|
296
|
+
export * from './shared/routing/types';
|
|
297
|
+
export * from './shared/routing/use-base-path';
|
|
298
|
+
export * from './shared/routing/use-navigate';
|
|
299
|
+
export * from './shared/routing/use-on-navigate';
|
|
296
300
|
export * from './shared/routing/with-routing';
|
|
297
301
|
export * from './shared/utils/array';
|
|
298
302
|
export * from './shared/utils/breakpoints';
|
|
@@ -4,7 +4,7 @@ import { useEffect, useRef } from 'react';
|
|
|
4
4
|
import { Transition, TransitionGroup } from 'react-transition-group';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { useAlgoliaSearch } from '../algolia/use-algolia-search.js';
|
|
7
|
-
import { useOnNavigate } from '../shared/routing/
|
|
7
|
+
import { useOnNavigate } from '../shared/routing/use-on-navigate.js';
|
|
8
8
|
import { useGlobalSearchDisclosure } from './global-search-provider/use-search-disclosure.js';
|
|
9
9
|
import { ConnectedSearchInput } from './search-input/connected-search-input.js';
|
|
10
10
|
import { SearchResultPanel } from './search-result-panel/search-result-panel.js';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useAlgoliaSearch } from '../../algolia/use-algolia-search.js';
|
|
4
4
|
import { useFormattedMessage } from '../../intl/use-formatted-message.js';
|
|
5
|
-
import { useNavigate } from '../../shared/routing/
|
|
5
|
+
import { useNavigate } from '../../shared/routing/use-navigate.js';
|
|
6
6
|
import { useGlobalSearchDisclosure } from '../global-search-provider/use-search-disclosure.js';
|
|
7
7
|
import { SearchInput } from './search-input.js';
|
|
8
8
|
|
package/dist/index.js
CHANGED
|
@@ -170,7 +170,7 @@ export { useHasReturnedFromAdyen } from './pages/checkout/payment-page/hooks/use
|
|
|
170
170
|
export { PaymentPage } from './pages/checkout/payment-page/payment-page.js';
|
|
171
171
|
export { PaymentPageContent } from './pages/checkout/payment-page/payment-page-content.js';
|
|
172
172
|
export { parseAmount } from './pages/checkout/payment-page/utils/parse-amount.js';
|
|
173
|
-
export { EDIT_ADDRESS_FORM_ID,
|
|
173
|
+
export { EDIT_ADDRESS_FORM_ID, EditAddressesForm } from './pages/checkout/shipping-page/components/edit-address-form.js';
|
|
174
174
|
export { ReadOnlyAddresses } from './pages/checkout/shipping-page/components/readonly-address.js';
|
|
175
175
|
export { SonicAddress } from './pages/checkout/shipping-page/components/sonic-address.js';
|
|
176
176
|
export { usePatchShippingDetails } from './pages/checkout/shipping-page/hooks/use-patch-shipping-details.js';
|
|
@@ -261,7 +261,7 @@ export { WishListNameAlreadyExistsError, addWishListItemToWishList, createWishLi
|
|
|
261
261
|
export { useFeatureFlags } from './shared/feature-flags/use-feature-flags.js';
|
|
262
262
|
export { BadRequestError, ForbiddenRequestError, InternalServerErrorRequestError, NotFoundRequestError, RequestError, TimeoutRequestError, UnauthorizedRequestError, UnprocessableContentRequestError, isFormData, isJsonBody, isRequestError, request } from './shared/fetch/request.js';
|
|
263
263
|
export { dataLayer } from './shared/ga/data-layer.js';
|
|
264
|
-
export { GoogleAnalyticsProvider, useGoogleAnalyticsProvider } from './shared/ga/google-analytics-provider.js';
|
|
264
|
+
export { GoogleAnalyticsProvider, InitializeGoogleAnalyticsProvider, useGoogleAnalyticsProvider } from './shared/ga/google-analytics-provider.js';
|
|
265
265
|
export { isGAEvent } from './shared/ga/types.js';
|
|
266
266
|
export { useDataLayer } from './shared/ga/use-data-layer.js';
|
|
267
267
|
export { useBreakpoint } from './shared/hooks/use-breakpoint.js';
|
|
@@ -292,7 +292,10 @@ export { ReactQueryContainer } from './shared/providers/react-query-container.js
|
|
|
292
292
|
export { RouteButton } from './shared/routing/route-button.js';
|
|
293
293
|
export { RouteIconButton } from './shared/routing/route-icon-button.js';
|
|
294
294
|
export { RouteLink } from './shared/routing/route-link.js';
|
|
295
|
-
export { RouteProvider
|
|
295
|
+
export { RouteProvider } from './shared/routing/route-provider.js';
|
|
296
|
+
export { useBasePath } from './shared/routing/use-base-path.js';
|
|
297
|
+
export { useNavigate } from './shared/routing/use-navigate.js';
|
|
298
|
+
export { useOnNavigate } from './shared/routing/use-on-navigate.js';
|
|
296
299
|
export { withRouting } from './shared/routing/with-routing.js';
|
|
297
300
|
export { ensureArray } from './shared/utils/array.js';
|
|
298
301
|
export { breakpoints, getCurrentBreakpoints } from './shared/utils/breakpoints.js';
|
|
@@ -34,20 +34,30 @@ function createSrcSet(image) {
|
|
|
34
34
|
.filter(Boolean)
|
|
35
35
|
.join(', ') || undefined);
|
|
36
36
|
}
|
|
37
|
+
function getPrimarySrc(image) {
|
|
38
|
+
if (image === undefined)
|
|
39
|
+
return undefined;
|
|
40
|
+
if (isResponsiveImage(image)) {
|
|
41
|
+
return (getPrimarySrc(image.sm) ||
|
|
42
|
+
getPrimarySrc(image.md) ||
|
|
43
|
+
getPrimarySrc(image.lg));
|
|
44
|
+
}
|
|
45
|
+
return image[3] || image[2] || image[1];
|
|
46
|
+
}
|
|
37
47
|
function ImageComponent({ className, fallbackSrc, fit = 'cover', hasError, image, ...rest }) {
|
|
38
|
-
if (!image)
|
|
48
|
+
if (!image || (!image[1] && !image[2] && !image[3]))
|
|
39
49
|
return (jsx("img", { alt: "Missing", className: clsx(styles.image, className, styles[fit], styles['has-error']), src: fallbackSrc, ...rest }));
|
|
40
50
|
const srcSet = hasError ? undefined : createSrcSet(image);
|
|
41
51
|
return (jsx("img", { alt: image.altText, className: clsx(styles.image, className, styles[fit], {
|
|
42
52
|
[styles['has-error']]: hasError,
|
|
43
|
-
}), src: fallbackSrc, srcSet: srcSet, ...rest }));
|
|
53
|
+
}), src: hasError ? fallbackSrc : getPrimarySrc(image), srcSet: srcSet, ...rest }));
|
|
44
54
|
}
|
|
45
55
|
function PictureComponent({ className, fallbackSrc, fit = 'cover', hasError, image, ...rest }) {
|
|
46
|
-
if (!image)
|
|
56
|
+
if (!image || (!image.sm && !image.md && !image.lg))
|
|
47
57
|
return (jsx("picture", { className: clsx(styles.picture, className), children: jsx("img", { alt: "Missing", className: clsx(styles.image, styles[fit], styles['has-error']), src: fallbackSrc, ...rest }) }));
|
|
48
58
|
return (jsxs("picture", { className: clsx(styles.picture, className), children: [image.sm && (jsx("source", { media: "(max-width: 768px)", srcSet: createSrcSet(image.sm) })), image.md && (jsx("source", { media: "(max-width: 1439px)", srcSet: createSrcSet(image.md) })), image.lg && (jsx("source", { media: "(min-width: 1440px)", srcSet: createSrcSet(image.lg) })), jsx("img", { alt: image.altText, className: clsx(styles.image, styles[fit], {
|
|
49
59
|
[styles['has-error']]: hasError,
|
|
50
|
-
}), src: fallbackSrc, ...rest })] }));
|
|
60
|
+
}), src: hasError ? fallbackSrc : getPrimarySrc(image), ...rest })] }));
|
|
51
61
|
}
|
|
52
62
|
|
|
53
63
|
export { Image };
|
|
@@ -11,10 +11,10 @@ import { Modal } from '../modal/modal.js';
|
|
|
11
11
|
import styles from './dialog.module.css.js';
|
|
12
12
|
|
|
13
13
|
function Footer({ cancelLabel, close, submitLabel }) {
|
|
14
|
-
return (jsxs(Fragment, { children: [jsx(Button, { withArrow: true, color: "primary", size: "md", type: "submit", children: jsx(FormattedMessage, { id: submitLabel }) }), jsx(Button, { color: "secondary", onClick: close, size: "md", variant: "outline", children: jsx(FormattedMessage, { id: cancelLabel }) })] }));
|
|
14
|
+
return (jsxs(Fragment, { children: [jsx(Button, { withArrow: true, color: "primary", "data-test-selector": "dialogSubmit", size: "md", type: "submit", children: jsx(FormattedMessage, { id: submitLabel }) }), jsx(Button, { color: "secondary", "data-test-selector": "dialogCancel", onClick: close, size: "md", variant: "outline", children: jsx(FormattedMessage, { id: cancelLabel }) })] }));
|
|
15
15
|
}
|
|
16
16
|
function Dialog({ allowClose = true, cancelLabel = 'Close', children, className, footer = Footer, hasCloseButton = true, hideTitle, isDismissable, isFullScreen, isKeyboardDismissDisabled, isOpen, onOpenChange, onSubmit, shouldCloseOnInteractOutside, submitLabel = 'Submit', title, validationErrors, }) {
|
|
17
|
-
return (jsx(Modal, { className: clsx(styles['modal-overlay'], typeof className === 'string' ? className : className?.modal), hasCloseButton: false, isDismissable: isDismissable, isFullScreen: isFullScreen, isKeyboardDismissDisabled: isKeyboardDismissDisabled, isOpen: isOpen, onOpenChange: onOpenChange, shouldCloseOnInteractOutside: shouldCloseOnInteractOutside, children: jsx(Dialog$1, { "aria-label": title, className: clsx(styles.dialog, typeof className === 'string' ? undefined : className?.dialog), children: ({ close }) => (jsxs(Form, { className: clsx(styles.form, typeof className === 'string' ? undefined : className?.form), onSubmit: e => {
|
|
17
|
+
return (jsx(Modal, { className: clsx(styles['modal-overlay'], typeof className === 'string' ? className : className?.modal), hasCloseButton: false, isDismissable: isDismissable, isFullScreen: isFullScreen, isKeyboardDismissDisabled: isKeyboardDismissDisabled, isOpen: isOpen, onOpenChange: onOpenChange, shouldCloseOnInteractOutside: shouldCloseOnInteractOutside, children: jsx(Dialog$1, { "aria-label": title, className: clsx(styles.dialog, typeof className === 'string' ? undefined : className?.dialog), "data-test-selector": "dialog", children: ({ close }) => (jsxs(Form, { className: clsx(styles.form, typeof className === 'string' ? undefined : className?.form), onSubmit: e => {
|
|
18
18
|
e.preventDefault();
|
|
19
19
|
e.stopPropagation();
|
|
20
20
|
onSubmit?.(e);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useMemo } from 'react';
|
|
2
|
+
import { useState, useMemo } from 'react';
|
|
3
3
|
import { useCreateGuestAccount } from '../../../shared/api/storefront/hooks/authentication/use-create-guest-account.js';
|
|
4
4
|
import { useFetchSession } from '../../../shared/api/storefront/hooks/authentication/use-fetch-session.js';
|
|
5
5
|
import { useSignIn } from '../../../shared/api/storefront/hooks/authentication/use-sign-in.js';
|
|
6
6
|
import { isRequestError } from '../../../shared/fetch/request.js';
|
|
7
|
-
import { useNavigate } from '../../../shared/routing/
|
|
7
|
+
import { useNavigate } from '../../../shared/routing/use-navigate.js';
|
|
8
8
|
import { SignInForm } from '../../../sign-in-form/sign-in-form.js';
|
|
9
9
|
import { Page } from '../../components/page/page.js';
|
|
10
10
|
import { PATHS } from '../../paths.js';
|
|
@@ -19,6 +19,7 @@ const IMAGE = {
|
|
|
19
19
|
};
|
|
20
20
|
function SignInPage({ returnUrl } = {}) {
|
|
21
21
|
const { navigate } = useNavigate();
|
|
22
|
+
const [isSuccess, setIsSuccess] = useState(false);
|
|
22
23
|
const { data: session } = useFetchSession();
|
|
23
24
|
const { error: errorSignIn, isPending: isPendingSignIn, mutate: signIn, reset: resetSignIn, } = useSignIn();
|
|
24
25
|
const { error: errorCreateGuest, isPending: isPendingCreateGuest, mutate: createGuest, reset: resetCreateGuest, } = useCreateGuestAccount();
|
|
@@ -28,11 +29,16 @@ function SignInPage({ returnUrl } = {}) {
|
|
|
28
29
|
return undefined;
|
|
29
30
|
if (errorCreateGuest)
|
|
30
31
|
return 'Unexpected error';
|
|
31
|
-
if (isRequestError(error) &&
|
|
32
|
+
if (isRequestError(error) &&
|
|
33
|
+
error.status === 400 &&
|
|
34
|
+
error.body?.error === 'invalid_grant')
|
|
32
35
|
return 'Access denied';
|
|
33
36
|
return 'Unexpected error';
|
|
34
37
|
}, [errorCreateGuest, errorSignIn]);
|
|
35
|
-
const onSuccess = () =>
|
|
38
|
+
const onSuccess = () => {
|
|
39
|
+
setIsSuccess(true);
|
|
40
|
+
navigate(returnUrl || PATHS.ACCOUNT, { reload: true });
|
|
41
|
+
};
|
|
36
42
|
const allowGuestSignIn = returnUrl === PATHS.CHECKOUT_SHIPPING;
|
|
37
43
|
const onSubmit = ({ data }) => {
|
|
38
44
|
resetSignIn();
|
|
@@ -50,7 +56,7 @@ function SignInPage({ returnUrl } = {}) {
|
|
|
50
56
|
}, { onSuccess });
|
|
51
57
|
}
|
|
52
58
|
};
|
|
53
|
-
return (jsx(Page, { fullHeight: true, fluid: true, children: jsx(SignInPageLayout, { fullHeight: true, image: IMAGE, children: jsx(SignInForm, { allowGuestSignIn: allowGuestSignIn, errorMessage: errorMessage, initialEmail: session?.isGuest ? '' : session?.email, initialRememberMe: session?.rememberMe, isDisabled: !session, isPendingGuestSignIn: isPendingCreateGuest, isPendingUserSignIn: isPendingSignIn, onSubmit: onSubmit }) }) }));
|
|
59
|
+
return (jsx(Page, { fullHeight: true, fluid: true, children: jsx(SignInPageLayout, { fullHeight: true, image: IMAGE, children: jsx(SignInForm, { allowGuestSignIn: allowGuestSignIn, errorMessage: errorMessage, initialEmail: session?.isGuest ? '' : session?.email, initialRememberMe: session?.rememberMe, isDisabled: !session || isSuccess, isPendingGuestSignIn: isPendingCreateGuest, isPendingUserSignIn: isPendingSignIn, onSubmit: onSubmit }) }) }));
|
|
54
60
|
}
|
|
55
61
|
|
|
56
62
|
export { SignInPage };
|
|
@@ -3,7 +3,7 @@ import { useEffect } from 'react';
|
|
|
3
3
|
import { LoadingPage } from '../../loading-page/loading-page.js';
|
|
4
4
|
import { useIsAuthenticated } from '../../../shared/api/storefront/hooks/authentication/use-is-authenticated.js';
|
|
5
5
|
import { useFetchCartById } from '../../../shared/api/storefront/hooks/cart/use-fetch-cart-by-id.js';
|
|
6
|
-
import { useNavigate } from '../../../shared/routing/
|
|
6
|
+
import { useNavigate } from '../../../shared/routing/use-navigate.js';
|
|
7
7
|
import { hasNo } from '../../../shared/utils/types.js';
|
|
8
8
|
import { ErrorPage } from '../../error-page/error-page.js';
|
|
9
9
|
import { PATHS } from '../../paths.js';
|
|
@@ -166,6 +166,7 @@ function Payment({ atp, cart: _cart, form, isProcessing, isValidatingVAT, onErro
|
|
|
166
166
|
},
|
|
167
167
|
requestedDeliveryDate: formData.get('deliveryDate')?.toString(),
|
|
168
168
|
},
|
|
169
|
+
forceRecalculation: false,
|
|
169
170
|
});
|
|
170
171
|
}
|
|
171
172
|
catch (error) {
|
|
@@ -273,7 +274,7 @@ function Payment({ atp, cart: _cart, form, isProcessing, isValidatingVAT, onErro
|
|
|
273
274
|
/* eslint-disable ssr-friendly/no-dom-globals-in-react-fc */
|
|
274
275
|
typeof window === 'undefined'
|
|
275
276
|
? ''
|
|
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:
|
|
277
|
+
: `${window.location.pathname}${window.location.search}` })), Boolean(paymentError) && (jsx("div", { className: styles['error-message'], children: jsx(FormattedMessage, { id: "An error occurred while processing your payment. Please try again." }) })), jsx(InfoDisplay, { id: "shipping-and-invoice-information", label: t('Billing and shipping address'), value: jsx(Accordion, { variant: "select", children: jsx(AccordionItem, { "data-test-selector": "billingAndShippingInformation", id: "invoice-and-shipping", isDisabled: isDisabled, title: t('Billing and shipping information'), children: jsx(BillingAndInvoiceInformation, { billToAddress: {
|
|
277
278
|
address1: cart.billTo?.address1,
|
|
278
279
|
address2: cart.billTo?.address2,
|
|
279
280
|
address3: cart.billTo?.address3,
|
|
@@ -3,7 +3,7 @@ import { useState, useCallback, useEffect } from 'react';
|
|
|
3
3
|
import { useIsAuthenticated } from '../../../shared/api/storefront/hooks/authentication/use-is-authenticated.js';
|
|
4
4
|
import { useFetchCurrentCheckoutAtp } from '../../../shared/api/storefront/hooks/cart/use-fetch-current-cart-checkout-atp.js';
|
|
5
5
|
import { useFetchCurrentCartWithAtp } from '../../../shared/api/storefront/hooks/cart/use-fetch-current-cart-with-atp.js';
|
|
6
|
-
import { useNavigate } from '../../../shared/routing/
|
|
6
|
+
import { useNavigate } from '../../../shared/routing/use-navigate.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';
|
package/dist/pages/checkout/shipping-page/components/{edit-address.d.ts → edit-address-form.d.ts}
RENAMED
|
@@ -14,7 +14,7 @@ interface Address {
|
|
|
14
14
|
phone: string;
|
|
15
15
|
postalCode: string;
|
|
16
16
|
}
|
|
17
|
-
export declare function
|
|
17
|
+
export declare function EditAddressesForm({ billTo, countries, isLoading, isPickup, onSubmit, }: {
|
|
18
18
|
billTo: BillToModel | undefined | null;
|
|
19
19
|
countries: CountryModel[];
|
|
20
20
|
isLoading: boolean;
|
package/dist/pages/checkout/shipping-page/components/{edit-address.js → edit-address-form.js}
RENAMED
|
@@ -12,10 +12,10 @@ import { validatePhone, validateEmail } from '../../../../shared/model/address.j
|
|
|
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 { SonicAddress } from './sonic-address.js';
|
|
15
|
-
import styles from './edit-address.module.css.js';
|
|
15
|
+
import styles from './edit-address-form.module.css.js';
|
|
16
16
|
|
|
17
17
|
const EDIT_ADDRESS_FORM_ID = 'billToForm';
|
|
18
|
-
function
|
|
18
|
+
function EditAddressesForm({ billTo, countries, isLoading, isPickup, onSubmit, }) {
|
|
19
19
|
const t = useFormattedMessage();
|
|
20
20
|
const [companyName, setCompanyName] = useState(billTo?.companyName || '');
|
|
21
21
|
const [lastName, setLastName] = useState(billTo?.lastName || '');
|
|
@@ -57,4 +57,4 @@ function EditAddresses({ billTo, countries, isLoading, isPickup, onSubmit, }) {
|
|
|
57
57
|
} }) }), jsx("div", { className: styles['span-2'], children: jsx(TextField, { defaultValue: cart?.notes, isDisabled: isLoading, isMultiline: true, label: t('Add order notes'), name: "notes", rows: 3, showLabel: true }) })] }) }) }), jsx(CheckoutPageSection, { title: jsx(FormattedMessage, { id: isPickup ? 'Pickup address' : 'Shipping address' }), children: jsx(CheckoutPageSectionContent, { children: jsx(Fragment, { children: isPickup ? (jsx(SonicAddress, {})) : (jsxs("div", { className: styles['use-invoice-checkbox'], children: [jsx(Checkbox, { "data-test-selector": "checkboxUseBillingAddress", isDisabled: true, isSelected: true, children: jsx(FormattedMessage, { id: "Use billing address" }) }), jsx(InfoIconTooltip, { variant: "stroke", children: t('Changing your address is currently not possible. Please contact customer support to change your address.') })] })) }) }) })] }));
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
export { EDIT_ADDRESS_FORM_ID,
|
|
60
|
+
export { EDIT_ADDRESS_FORM_ID, EditAddressesForm };
|
|
@@ -10,7 +10,7 @@ import { PATHS } from '../../../paths.js';
|
|
|
10
10
|
import { CheckoutPageSection } from '../../layouts/checkout-page-layout/components/checkout-page-section.js';
|
|
11
11
|
import { CheckoutPageSectionContent } from '../../layouts/checkout-page-layout/components/checkout-page-section-content.js';
|
|
12
12
|
import { CheckoutPageSectionLink } from '../../layouts/checkout-page-layout/components/checkout-page-section-link.js';
|
|
13
|
-
import { EDIT_ADDRESS_FORM_ID } from './edit-address.js';
|
|
13
|
+
import { EDIT_ADDRESS_FORM_ID } from './edit-address-form.js';
|
|
14
14
|
import { SonicAddress } from './sonic-address.js';
|
|
15
15
|
import styles from './readonly-address.module.css.js';
|
|
16
16
|
|
|
@@ -11,7 +11,7 @@ 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
|
-
import { EDIT_ADDRESS_FORM_ID } from './components/edit-address.js';
|
|
14
|
+
import { EDIT_ADDRESS_FORM_ID } from './components/edit-address-form.js';
|
|
15
15
|
import styles from './shipping-page.module.css.js';
|
|
16
16
|
|
|
17
17
|
function ShippingPageContent({ cart, editAddress, errorPatchBillingAddress, fulfillmentMethods, isGuest, isLoadingFulfillmentMethods, isPatching, isPatchingSession, onChangeFulfillmentMethod, readOnlyAddress, }) {
|
|
@@ -6,12 +6,12 @@ import { useFetchCurrentCart } from '../../../shared/api/storefront/hooks/cart/u
|
|
|
6
6
|
import { useFetchFulfillmentMethodsForCurrentCart } from '../../../shared/api/storefront/hooks/customer/use-fetch-fulfillment-methods-for-current-cart.js';
|
|
7
7
|
import { useFetchCountries } from '../../../shared/api/storefront/hooks/website/use-fetch-countries.js';
|
|
8
8
|
import { useDataLayer } from '../../../shared/ga/use-data-layer.js';
|
|
9
|
-
import { useNavigate } from '../../../shared/routing/
|
|
9
|
+
import { useNavigate } from '../../../shared/routing/use-navigate.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
13
|
import { PATHS } from '../../paths.js';
|
|
14
|
-
import {
|
|
14
|
+
import { EditAddressesForm } from './components/edit-address-form.js';
|
|
15
15
|
import { ReadOnlyAddresses } from './components/readonly-address.js';
|
|
16
16
|
import { usePatchShippingDetails } from './hooks/use-patch-shipping-details.js';
|
|
17
17
|
import { ShippingPageContent } from './shipping-page-content.js';
|
|
@@ -81,7 +81,7 @@ function ShippingPage() {
|
|
|
81
81
|
hasNo(cart.billTo) ||
|
|
82
82
|
(hasNo(cart.billTo.address1) && hasNo(countries)))
|
|
83
83
|
return null;
|
|
84
|
-
return (jsx(ShippingPageContent, { cart: cart, editAddress: jsx(
|
|
84
|
+
return (jsx(ShippingPageContent, { cart: cart, editAddress: jsx(EditAddressesForm, { billTo: cart.billTo, countries: countries || [], isLoading: isPatching, isPickup: isPickup, onSubmit: async ({ address, notes }) => {
|
|
85
85
|
if (!cart.billTo)
|
|
86
86
|
return;
|
|
87
87
|
await patchShippingDetails({
|
package/dist/pages/paths.d.ts
CHANGED
package/dist/pages/paths.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useQueryClient, useMutation } from '@tanstack/react-query';
|
|
2
|
+
import { isRequestError } from '../../../../fetch/request.js';
|
|
2
3
|
import { signIn, createSession } from '../../services/authentication-service.js';
|
|
3
4
|
|
|
4
5
|
function useSignIn() {
|
|
@@ -16,8 +17,13 @@ function useSignIn() {
|
|
|
16
17
|
});
|
|
17
18
|
return body;
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
catch (error) {
|
|
21
|
+
if (!(isRequestError(error) &&
|
|
22
|
+
error.status === 400 &&
|
|
23
|
+
error.body?.error === 'invalid_grant')) {
|
|
24
|
+
queryClient.resetQueries();
|
|
25
|
+
}
|
|
26
|
+
throw error;
|
|
21
27
|
}
|
|
22
28
|
},
|
|
23
29
|
});
|
|
@@ -12,8 +12,9 @@ export declare function patchCartLineById({ cartLine, cartLineId, }: {
|
|
|
12
12
|
cartLine: CartLineModel;
|
|
13
13
|
cartLineId: string;
|
|
14
14
|
}): Promise<void>;
|
|
15
|
-
export declare function patchCart({ cart, }: {
|
|
15
|
+
export declare function patchCart({ cart, forceRecalculation, }: {
|
|
16
16
|
cart: PatchCartModel;
|
|
17
|
+
forceRecalculation?: boolean;
|
|
17
18
|
}): Promise<CartModel>;
|
|
18
19
|
export declare function deleteCurrentCart(): Promise<CartModel>;
|
|
19
20
|
export declare function deleteCartLineById({ cartLineId, }: {
|
|
@@ -36,7 +36,7 @@ async function patchCartLineById({ cartLine, cartLineId, }) {
|
|
|
36
36
|
url: `${config.SHOP_API_URL}/api/v1/carts/current/cartlines/${cartLineId}`,
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
async function patchCart({ cart, }) {
|
|
39
|
+
async function patchCart({ cart, forceRecalculation = true, }) {
|
|
40
40
|
const { body } = await request({
|
|
41
41
|
body: cart,
|
|
42
42
|
credentials: 'include',
|
|
@@ -44,7 +44,7 @@ async function patchCart({ cart, }) {
|
|
|
44
44
|
'Content-Type': 'application/json',
|
|
45
45
|
},
|
|
46
46
|
method: 'PATCH',
|
|
47
|
-
url: `${config.BFF_API_URL}/api/v1/carts/current`,
|
|
47
|
+
url: `${config.BFF_API_URL}/api/v1/carts/current${forceRecalculation ? '?forceRecalculation=true' : ''}`,
|
|
48
48
|
});
|
|
49
49
|
return body;
|
|
50
50
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
export declare function useGoogleAnalyticsProvider(): {
|
|
3
3
|
customerNumber: string | undefined;
|
|
4
|
-
|
|
4
|
+
isLoading: boolean;
|
|
5
5
|
};
|
|
6
|
+
export declare function InitializeGoogleAnalyticsProvider(): null;
|
|
6
7
|
export declare function GoogleAnalyticsProvider({ children }?: {
|
|
7
8
|
children?: ReactNode;
|
|
8
9
|
}): JSX.Element | null;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useFetchSession } from '../api/storefront/hooks/authentication/use-fetch-session.js';
|
|
4
4
|
|
|
5
5
|
function useGoogleAnalyticsProvider() {
|
|
6
|
-
const { data: session,
|
|
7
|
-
return { customerNumber: session?.billTo?.customerNumber,
|
|
6
|
+
const { data: session, isLoading } = useFetchSession();
|
|
7
|
+
return { customerNumber: session?.billTo?.customerNumber, isLoading };
|
|
8
|
+
}
|
|
9
|
+
function InitializeGoogleAnalyticsProvider() {
|
|
10
|
+
useGoogleAnalyticsProvider();
|
|
11
|
+
return null;
|
|
8
12
|
}
|
|
9
13
|
function GoogleAnalyticsProvider({ children = null } = { children: null }) {
|
|
10
|
-
|
|
11
|
-
if (isFetching)
|
|
12
|
-
return null;
|
|
13
|
-
return jsx(Fragment, { children: children });
|
|
14
|
+
return (jsxs(Fragment, { children: [jsx(InitializeGoogleAnalyticsProvider, {}), children] }));
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
export { GoogleAnalyticsProvider, useGoogleAnalyticsProvider };
|
|
17
|
+
export { GoogleAnalyticsProvider, InitializeGoogleAnalyticsProvider, useGoogleAnalyticsProvider };
|
|
@@ -23,4 +23,4 @@ export interface ResponsiveImageType {
|
|
|
23
23
|
md?: DPRSrcSet;
|
|
24
24
|
sm?: DPRSrcSet;
|
|
25
25
|
}
|
|
26
|
-
export declare function isResponsiveImage(image:
|
|
26
|
+
export declare function isResponsiveImage(image: unknown): image is ResponsiveImageType;
|
|
@@ -1,23 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
prefetch?: boolean;
|
|
4
|
-
replace?: boolean;
|
|
5
|
-
}
|
|
6
|
-
export type NavigateFn = (href: string, options?: NavigateOptions) => void;
|
|
7
|
-
export interface UseNavigateReturnType {
|
|
8
|
-
isNavigating: boolean;
|
|
9
|
-
navigate: NavigateFn;
|
|
10
|
-
}
|
|
11
|
-
export interface RouteContext {
|
|
12
|
-
basePath?: string;
|
|
13
|
-
navigate: NavigateFn;
|
|
14
|
-
}
|
|
2
|
+
import { NavigateFunction } from './types';
|
|
15
3
|
export interface RouteProviderProps {
|
|
16
4
|
basePath?: string;
|
|
17
5
|
children: ReactNode;
|
|
18
|
-
navigate:
|
|
6
|
+
navigate: NavigateFunction;
|
|
19
7
|
}
|
|
20
8
|
export declare function RouteProvider({ basePath, children, navigate, }: RouteProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
export declare function useOnNavigate(callback?: NavigateFn): NavigateFn;
|
|
22
|
-
export declare function useNavigate(): UseNavigateReturnType;
|
|
23
|
-
export declare function useBasePath(): string | undefined;
|
|
@@ -1,52 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import { useEffect, useCallback, useRef } from 'react';
|
|
4
3
|
import { useGlobalState } from '../providers/global-state-provider.js';
|
|
5
4
|
|
|
6
5
|
function RouteProvider({ basePath, children, navigate, }) {
|
|
7
6
|
useGlobalState('routing', { basePath, navigate });
|
|
8
7
|
return jsx(Fragment, { children: children });
|
|
9
8
|
}
|
|
10
|
-
const onNavigateCallbacks = [];
|
|
11
|
-
function useOnNavigate(callback) {
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
if (!callback)
|
|
14
|
-
return;
|
|
15
|
-
onNavigateCallbacks.push(callback);
|
|
16
|
-
return () => {
|
|
17
|
-
onNavigateCallbacks.splice(onNavigateCallbacks.indexOf(callback), 1);
|
|
18
|
-
};
|
|
19
|
-
}, [callback]);
|
|
20
|
-
return useCallback((href, options) => {
|
|
21
|
-
onNavigateCallbacks.forEach(cb => cb(href, options));
|
|
22
|
-
}, []);
|
|
23
|
-
}
|
|
24
|
-
function useNavigate() {
|
|
25
|
-
const isNavigatingRef = useRef(false);
|
|
26
|
-
const [state] = useGlobalState('routing');
|
|
27
|
-
const trigger = useOnNavigate();
|
|
28
|
-
if (!state) {
|
|
29
|
-
throw new Error('RouteProvider not found');
|
|
30
|
-
}
|
|
31
|
-
const navigate = useCallback((href, options) => {
|
|
32
|
-
trigger(href, options);
|
|
33
|
-
if (href.toLowerCase().startsWith('http')) {
|
|
34
|
-
if (typeof window === 'undefined')
|
|
35
|
-
return;
|
|
36
|
-
isNavigatingRef.current = true;
|
|
37
|
-
return (window.location.href = href);
|
|
38
|
-
}
|
|
39
|
-
isNavigatingRef.current = true;
|
|
40
|
-
return state.navigate(href, options);
|
|
41
|
-
}, [state, trigger]);
|
|
42
|
-
return { isNavigating: isNavigatingRef.current, navigate };
|
|
43
|
-
}
|
|
44
|
-
function useBasePath() {
|
|
45
|
-
const [state] = useGlobalState('routing');
|
|
46
|
-
if (!state) {
|
|
47
|
-
throw new Error('RouteProvider not found');
|
|
48
|
-
}
|
|
49
|
-
return state.basePath;
|
|
50
|
-
}
|
|
51
9
|
|
|
52
|
-
export { RouteProvider
|
|
10
|
+
export { RouteProvider };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface RouteContext {
|
|
2
|
+
basePath?: string;
|
|
3
|
+
navigate: NavigateFunction;
|
|
4
|
+
}
|
|
5
|
+
export interface NavigateOptions {
|
|
6
|
+
prefetch?: boolean;
|
|
7
|
+
reload?: boolean;
|
|
8
|
+
replace?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type NavigateFunction = (href: string, options?: NavigateOptions) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useBasePath(): string | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useGlobalState } from '../providers/global-state-provider.js';
|
|
3
|
+
|
|
4
|
+
function useBasePath() {
|
|
5
|
+
const [state] = useGlobalState('routing');
|
|
6
|
+
if (!state) {
|
|
7
|
+
throw new Error('RouteProvider not found');
|
|
8
|
+
}
|
|
9
|
+
return state.basePath;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { useBasePath };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef, useCallback } from 'react';
|
|
3
|
+
import { useGlobalState } from '../providers/global-state-provider.js';
|
|
4
|
+
import { useOnNavigate } from './use-on-navigate.js';
|
|
5
|
+
|
|
6
|
+
function useNavigate() {
|
|
7
|
+
const isNavigatingRef = useRef(false);
|
|
8
|
+
const [state] = useGlobalState('routing');
|
|
9
|
+
const trigger = useOnNavigate(() => {
|
|
10
|
+
isNavigatingRef.current = false;
|
|
11
|
+
});
|
|
12
|
+
if (!state) {
|
|
13
|
+
throw new Error('RouteProvider not found');
|
|
14
|
+
}
|
|
15
|
+
const navigate = useCallback((href, options) => {
|
|
16
|
+
trigger(href, options);
|
|
17
|
+
isNavigatingRef.current = true;
|
|
18
|
+
return state.navigate(href, options);
|
|
19
|
+
}, [state, trigger]);
|
|
20
|
+
return { isNavigating: isNavigatingRef.current, navigate };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { useNavigate };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useCallback } from 'react';
|
|
3
|
+
|
|
4
|
+
const onNavigateCallbacks = [];
|
|
5
|
+
function useOnNavigate(callback) {
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (!callback)
|
|
8
|
+
return;
|
|
9
|
+
onNavigateCallbacks.push(callback);
|
|
10
|
+
return () => {
|
|
11
|
+
onNavigateCallbacks.splice(onNavigateCallbacks.indexOf(callback), 1);
|
|
12
|
+
};
|
|
13
|
+
}, [callback]);
|
|
14
|
+
return useCallback((href, options) => {
|
|
15
|
+
onNavigateCallbacks.forEach(cb => cb(href, options));
|
|
16
|
+
}, []);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { useOnNavigate };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createElement } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useBasePath } from './use-base-path.js';
|
|
3
|
+
import { useNavigate } from './use-navigate.js';
|
|
3
4
|
|
|
4
5
|
function withRouting(component) {
|
|
5
6
|
const Component = ({ href, onClick, route, ...rest }) => {
|
|
@@ -8,6 +8,7 @@ import { Switch } from '../forms/switch/switch.js';
|
|
|
8
8
|
import { TextField } from '../forms/text-field/text-field.js';
|
|
9
9
|
import { useFormattedMessage } from '../intl/use-formatted-message.js';
|
|
10
10
|
import { Message } from '../message/message.js';
|
|
11
|
+
import { validateEmail } from '../shared/model/address.js';
|
|
11
12
|
import { Heading } from '../typography/heading/heading.js';
|
|
12
13
|
import styles from './sign-in-form.module.css.js';
|
|
13
14
|
|
|
@@ -46,7 +47,11 @@ function SignInForm({ allowGuestSignIn = false, errorMessage, initialEmail, init
|
|
|
46
47
|
},
|
|
47
48
|
});
|
|
48
49
|
};
|
|
49
|
-
return (jsxs(Form, { "aria-label": title, autoComplete: "off", className: clsx(styles['sign-in-form'], styles['form']), onSubmit: handleSubmit, validationBehavior: "native", children: [jsx("header", { className: styles['form-header'], children: jsx(Heading, { "data-test-selector": "PageTitle", italic: true, size: "m", tag: "h1", uppercase: true, children: title }) }), errorMessage === 'Access denied' && (jsx(Message, { type: "danger", children: t('Your email and password were not recognized.') })), errorMessage === 'Unexpected error' && (jsx(Message, { type: "danger", children: t('An unexpected error occured. Please try again.') })), jsxs("fieldset", { className: clsx(styles['form-fieldset'], styles['columns']), children: [jsx("div", { className: styles['form-segment'], children: jsx(TextField, { "data-test-selector": "signIn_userName", defaultValue: initialEmail, isDisabled: isDisabled, isRequired: true, label: t('Email'), name: "email", showLabel: true, type: "email"
|
|
50
|
+
return (jsxs(Form, { "aria-label": title, autoComplete: "off", className: clsx(styles['sign-in-form'], styles['form']), onSubmit: handleSubmit, validationBehavior: "native", children: [jsx("header", { className: styles['form-header'], children: jsx(Heading, { "data-test-selector": "PageTitle", italic: true, size: "m", tag: "h1", uppercase: true, children: title }) }), errorMessage === 'Access denied' && (jsx(Message, { type: "danger", children: t('Your email and password were not recognized.') })), errorMessage === 'Unexpected error' && (jsx(Message, { type: "danger", children: t('An unexpected error occured. Please try again.') })), jsxs("fieldset", { className: clsx(styles['form-fieldset'], styles['columns']), children: [jsx("div", { className: styles['form-segment'], children: jsx(TextField, { "data-test-selector": "signIn_userName", defaultValue: initialEmail, isDisabled: isDisabled, isRequired: true, label: t('Email'), name: "email", showLabel: true, type: "email", validate: value => {
|
|
51
|
+
if (!value)
|
|
52
|
+
return value;
|
|
53
|
+
return (validateEmail(value) || t('Please enter a valid e-mail address'));
|
|
54
|
+
} }) }), jsx("div", { className: styles['form-segment'], children: jsx(TextField, { "data-test-selector": "signIn_password", isDisabled: isDisabled, isRequired: true, label: t('Password'), name: "password", showLabel: true, type: "password" }) })] }), jsxs("footer", { className: styles['form-footer'], children: [jsx("div", { className: styles['form-segment'], children: jsx(Switch, { className: styles['floating'], defaultSelected: initialRememberMe, isDisabled: isDisabled, name: "rememberMe", value: "true", children: t('Remember me') }) }), jsx("div", { className: styles['form-segment'], children: jsx(Button, { "data-test-selector": "signIn_submit", isDisabled: isDisabled, isLoading: isPendingUserSignIn && t('Signing in…'), type: "submit", withArrow: true, children: t('sign in') }) }), jsxs("div", { className: styles['form-segment'], children: [jsx("p", { children: jsx(Link, { color: "primary", "data-test-selector": "signIn_forgotPassword", hasUnderline: true, href: "#", isDisabled: isDisabled, children: t('Forgot password?') }) }), jsxs("p", { children: [t('New user?'), ' ', jsx(Link, { "data-test-selector": "signInCreateNewAccount_createNewAccount", hasUnderline: true, href: "#", isDisabled: isDisabled, children: t('create account') })] })] }), allowGuestSignIn && (jsx("div", { className: styles['form-segment'], children: jsx(Button, { color: "secondary", isDisabled: isDisabled, isLoading: isPendingGuestSignIn && t('Signing in…'), isValidating: false, name: GUEST_SIGN_IN_BUTTON_NAME, type: "submit", value: "true", variant: "outline", children: t('Or continue as guest') }) }))] })] }));
|
|
50
55
|
}
|
|
51
56
|
|
|
52
57
|
export { SignInForm };
|
package/dist/styles.css
CHANGED
|
@@ -5768,11 +5768,11 @@ button.swiper-pagination-bullet {
|
|
|
5768
5768
|
display: grid;
|
|
5769
5769
|
overflow: clip;
|
|
5770
5770
|
font-family: var(--font-family-sonic);
|
|
5771
|
+
grid-template: minmax(0, min-content) 1fr minmax(0, min-content) / 100%;
|
|
5771
5772
|
grid-template-areas:
|
|
5772
5773
|
'page-header'
|
|
5773
5774
|
'page-main'
|
|
5774
5775
|
'page-footer';
|
|
5775
|
-
grid-template-rows: minmax(0, min-content) 1fr minmax(0, min-content);
|
|
5776
5776
|
}
|
|
5777
5777
|
|
|
5778
5778
|
/* main area, between page header and footer */
|
|
@@ -5782,11 +5782,11 @@ button.swiper-pagination-bullet {
|
|
|
5782
5782
|
box-sizing: border-box;
|
|
5783
5783
|
margin: 0 auto;
|
|
5784
5784
|
grid-area: page-main;
|
|
5785
|
+
grid-template: minmax(0, max-content) minmax(0, max-content) 1fr / 100%;
|
|
5785
5786
|
grid-template-areas:
|
|
5786
5787
|
'breadcrumbs'
|
|
5787
5788
|
'title'
|
|
5788
5789
|
'content';
|
|
5789
|
-
grid-template-rows: minmax(0, max-content) minmax(0, max-content) 1fr;
|
|
5790
5790
|
inline-size: 100%;
|
|
5791
5791
|
max-inline-size: var(--page-container-max-width);
|
|
5792
5792
|
padding-inline: var(--page-container-padding-inline);
|
|
@@ -5842,10 +5842,14 @@ button.swiper-pagination-bullet {
|
|
|
5842
5842
|
}
|
|
5843
5843
|
}
|
|
5844
5844
|
|
|
5845
|
-
.page-container-module-eFYSe.page-container-module-iCrH5
|
|
5846
|
-
|
|
5845
|
+
.page-container-module-eFYSe.page-container-module-iCrH5 {
|
|
5846
|
+
flex-grow: 1; /* TODO: required for Spire, remove later */
|
|
5847
5847
|
}
|
|
5848
5848
|
|
|
5849
|
+
.page-container-module-eFYSe.page-container-module-iCrH5 .page-container-module-r0SOZ {
|
|
5850
|
+
padding-block-end: 0;
|
|
5851
|
+
}
|
|
5852
|
+
|
|
5849
5853
|
.checkout-page-layout-module-lULV3 {
|
|
5850
5854
|
--layout-width: var(--page-container-max-width, 100svw);
|
|
5851
5855
|
--padding-inline: var(--page-container-padding-inline, 10px);
|
|
@@ -6053,27 +6057,27 @@ button.swiper-pagination-bullet {
|
|
|
6053
6057
|
white-space: pre;
|
|
6054
6058
|
}
|
|
6055
6059
|
|
|
6056
|
-
.edit-address-module-
|
|
6060
|
+
.edit-address-form-module-s19Fg {
|
|
6057
6061
|
display: grid;
|
|
6058
6062
|
gap: var(--space-16);
|
|
6059
6063
|
grid-template-columns: 1fr;
|
|
6060
6064
|
}
|
|
6061
6065
|
|
|
6062
|
-
.edit-address-module-
|
|
6066
|
+
.edit-address-form-module-s19Fg .edit-address-form-module-O1w3c {
|
|
6063
6067
|
display: grid;
|
|
6064
6068
|
}
|
|
6065
6069
|
|
|
6066
|
-
@media (width >= 768px) {.edit-address-module-
|
|
6070
|
+
@media (width >= 768px) {.edit-address-form-module-s19Fg {
|
|
6067
6071
|
grid-template-columns: 1fr 1fr
|
|
6068
6072
|
}
|
|
6069
6073
|
|
|
6070
|
-
.edit-address-module-
|
|
6074
|
+
.edit-address-form-module-s19Fg .edit-address-form-module-O1w3c {
|
|
6071
6075
|
display: grid;
|
|
6072
6076
|
grid-column: span 2;
|
|
6073
6077
|
}
|
|
6074
6078
|
}
|
|
6075
6079
|
|
|
6076
|
-
.edit-address-module-
|
|
6080
|
+
.edit-address-form-module-2bfdq {
|
|
6077
6081
|
display: flex;
|
|
6078
6082
|
flex-wrap: wrap;
|
|
6079
6083
|
align-items: center;
|
package/package.json
CHANGED