@sonic-equipment/ui 139.0.0 → 141.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/exports.d.ts +7 -1
- package/dist/forms/text-field/text-field.d.ts +3 -2
- package/dist/forms/text-field/text-field.js +2 -2
- package/dist/global-search/global-search.js +1 -1
- package/dist/global-search/search-input/connected-search-input.js +1 -1
- package/dist/icons/stroke/stroke-closebox-icon.js +1 -1
- package/dist/index.js +8 -4
- package/dist/intl/translation-id.d.ts +1 -1
- package/dist/modals/dialog/dialog.js +3 -1
- package/dist/modals/recover-password/recover-password-dialog.d.ts +6 -0
- package/dist/modals/recover-password/recover-password-dialog.js +37 -0
- package/dist/modals/signin/sign-in-dialog.js +2 -3
- package/dist/pages/account/sign-in-page/sign-in-page.js +19 -6
- package/dist/pages/checkout/order-confirmation-page/order-confirmation-page.js +1 -1
- package/dist/pages/checkout/payment-page/components/payment.d.ts +1 -2
- package/dist/pages/checkout/payment-page/components/payment.js +29 -16
- package/dist/pages/checkout/payment-page/payment-page-content.js +1 -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} +4 -4
- 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 +2 -1
- package/dist/pages/paths.js +2 -1
- package/dist/shared/api/storefront/hooks/authentication/use-create-guest-account.js +2 -2
- package/dist/shared/api/storefront/hooks/authentication/use-recover-password.d.ts +4 -0
- package/dist/shared/api/storefront/hooks/authentication/use-recover-password.js +15 -0
- 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/authentication-service.d.ts +6 -3
- package/dist/shared/api/storefront/services/authentication-service.js +15 -1
- 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/fetch/request.d.ts +15 -14
- 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.d.ts +3 -1
- package/dist/sign-in-form/sign-in-form.js +9 -3
- package/dist/styles.css +16 -12
- package/package.json +3 -3
- package/dist/modals/signin/sign-in-dialog.module.css.js +0 -3
- package/dist/pages/checkout/shipping-page/components/edit-address.module.css.js +0 -3
|
@@ -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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const PATHS: {
|
|
2
|
-
readonly ACCOUNT: "/
|
|
2
|
+
readonly ACCOUNT: "/MyAccount";
|
|
3
3
|
readonly ACCOUNT_ADDRESSES: "/MyAccount/Addresses";
|
|
4
|
+
readonly ACCOUNT_CREATE: "/MyAccount/CreateAccount";
|
|
4
5
|
readonly CART: "/cart";
|
|
5
6
|
readonly CHECKOUT_SHIPPING: "/CheckoutShipping";
|
|
6
7
|
readonly CHECKOUT_SHIPPING_VIA_SIGNIN: "/signin?returnUrl=/CheckoutShipping";
|
package/dist/pages/paths.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const PATHS = {
|
|
2
|
-
ACCOUNT: '/
|
|
2
|
+
ACCOUNT: '/MyAccount',
|
|
3
3
|
ACCOUNT_ADDRESSES: '/MyAccount/Addresses',
|
|
4
|
+
ACCOUNT_CREATE: '/MyAccount/CreateAccount',
|
|
4
5
|
CART: '/cart',
|
|
5
6
|
CHECKOUT_SHIPPING: '/CheckoutShipping',
|
|
6
7
|
CHECKOUT_SHIPPING_VIA_SIGNIN: '/signin?returnUrl=/CheckoutShipping',
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useQueryClient, useMutation } from '@tanstack/react-query';
|
|
2
|
+
import { recoverPassword } from '../../services/authentication-service.js';
|
|
3
|
+
|
|
4
|
+
function useRecoverPassword() {
|
|
5
|
+
const queryClient = useQueryClient();
|
|
6
|
+
return useMutation({
|
|
7
|
+
mutationFn: async ({ userName }) => {
|
|
8
|
+
const session = await recoverPassword({ userName });
|
|
9
|
+
queryClient.setQueryData(['session'], session);
|
|
10
|
+
return session;
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { useRecoverPassword };
|
|
@@ -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
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AccountModel, PatchSessionModel, SessionModel
|
|
2
|
-
export declare function fetchSession(): Promise<
|
|
1
|
+
import { AccountModel, PatchSessionModel, SessionModel } from '../model/storefront.model';
|
|
2
|
+
export declare function fetchSession(): Promise<SessionModel>;
|
|
3
3
|
export declare function patchSession({ session, }: {
|
|
4
4
|
session: PatchSessionModel;
|
|
5
|
-
}): Promise<
|
|
5
|
+
}): Promise<SessionModel>;
|
|
6
6
|
export interface AuthenticationResponse {
|
|
7
7
|
access_token: string;
|
|
8
8
|
error_description: string;
|
|
@@ -28,3 +28,6 @@ export declare function signOut(): Promise<void>;
|
|
|
28
28
|
export declare function createGuestAccount({ defaultWarehouseId, }: {
|
|
29
29
|
defaultWarehouseId: string;
|
|
30
30
|
}): Promise<AccountModel>;
|
|
31
|
+
export declare function recoverPassword({ userName, }: {
|
|
32
|
+
userName: string;
|
|
33
|
+
}): Promise<SessionModel>;
|
|
@@ -78,5 +78,19 @@ async function createGuestAccount({ defaultWarehouseId, }) {
|
|
|
78
78
|
});
|
|
79
79
|
return body;
|
|
80
80
|
}
|
|
81
|
+
async function recoverPassword({ userName, }) {
|
|
82
|
+
const { body } = await request({
|
|
83
|
+
body: {
|
|
84
|
+
resetPassword: true,
|
|
85
|
+
userName,
|
|
86
|
+
},
|
|
87
|
+
headers: {
|
|
88
|
+
'Content-Type': 'application/json',
|
|
89
|
+
},
|
|
90
|
+
method: 'PATCH',
|
|
91
|
+
url: `${config.SHOP_API_URL}/api/v1/sessions/current`,
|
|
92
|
+
});
|
|
93
|
+
return body;
|
|
94
|
+
}
|
|
81
95
|
|
|
82
|
-
export { createGuestAccount, createSession, fetchSession, patchSession, signIn, signOut };
|
|
96
|
+
export { createGuestAccount, createSession, fetchSession, patchSession, recoverPassword, signIn, signOut };
|
|
@@ -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
|
}
|
|
@@ -3,6 +3,20 @@ interface RequestErrorOptions {
|
|
|
3
3
|
context?: string;
|
|
4
4
|
options?: RequestOptions;
|
|
5
5
|
}
|
|
6
|
+
interface RequestErrorToJSONReturnType {
|
|
7
|
+
context: string | undefined;
|
|
8
|
+
error: {
|
|
9
|
+
message: string;
|
|
10
|
+
stack: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
isRequestError: boolean;
|
|
13
|
+
request: RequestOptions | object;
|
|
14
|
+
response: {
|
|
15
|
+
body: unknown;
|
|
16
|
+
status: number;
|
|
17
|
+
statusText: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
6
20
|
export declare class RequestError extends Error {
|
|
7
21
|
isRequestError: boolean;
|
|
8
22
|
status: number;
|
|
@@ -11,20 +25,7 @@ export declare class RequestError extends Error {
|
|
|
11
25
|
context?: string;
|
|
12
26
|
options?: RequestOptions;
|
|
13
27
|
constructor(responseOrError: Response | any, options?: RequestErrorOptions, status?: number, statusText?: string);
|
|
14
|
-
toJSON():
|
|
15
|
-
context: string | undefined;
|
|
16
|
-
error: {
|
|
17
|
-
message: string;
|
|
18
|
-
stack: string | undefined;
|
|
19
|
-
};
|
|
20
|
-
isRequestError: boolean;
|
|
21
|
-
request: {};
|
|
22
|
-
response: {
|
|
23
|
-
body: any;
|
|
24
|
-
status: number;
|
|
25
|
-
statusText: string | undefined;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
+
toJSON(): RequestErrorToJSONReturnType;
|
|
28
29
|
}
|
|
29
30
|
export declare const isRequestError: (error: any) => error is RequestError;
|
|
30
31
|
export declare class BadRequestError extends RequestError {
|
|
@@ -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 }) => {
|
|
@@ -11,15 +11,17 @@ export type SubmitData = LoginData | GuestLoginData;
|
|
|
11
11
|
export type ErrorMessage = 'Access denied' | 'Unexpected error';
|
|
12
12
|
export interface SignInFormProps {
|
|
13
13
|
allowGuestSignIn?: boolean;
|
|
14
|
+
createAccountPath: string;
|
|
14
15
|
errorMessage?: ErrorMessage;
|
|
15
16
|
initialEmail?: string;
|
|
16
17
|
initialRememberMe?: boolean;
|
|
17
18
|
isDisabled?: boolean;
|
|
18
19
|
isPendingGuestSignIn?: boolean;
|
|
19
20
|
isPendingUserSignIn?: boolean;
|
|
21
|
+
onRecoverPasswordDialogOpen?: () => void;
|
|
20
22
|
onSubmit?: ({ data }: {
|
|
21
23
|
data: SubmitData;
|
|
22
24
|
}) => void;
|
|
23
25
|
}
|
|
24
|
-
export declare function SignInForm({ allowGuestSignIn, errorMessage, initialEmail, initialRememberMe, isDisabled: _isDisabled, isPendingGuestSignIn, isPendingUserSignIn, onSubmit, }: SignInFormProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export declare function SignInForm({ allowGuestSignIn, createAccountPath, errorMessage, initialEmail, initialRememberMe, isDisabled: _isDisabled, isPendingGuestSignIn, isPendingUserSignIn, onRecoverPasswordDialogOpen, onSubmit, }: SignInFormProps): import("react/jsx-runtime").JSX.Element;
|
|
25
27
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { Form } from 'react-aria-components';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { Button } from '../buttons/button/button.js';
|
|
@@ -8,11 +8,13 @@ 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';
|
|
12
|
+
import { RouteLink } from '../shared/routing/route-link.js';
|
|
11
13
|
import { Heading } from '../typography/heading/heading.js';
|
|
12
14
|
import styles from './sign-in-form.module.css.js';
|
|
13
15
|
|
|
14
16
|
const GUEST_SIGN_IN_BUTTON_NAME = 'guestSignin';
|
|
15
|
-
function SignInForm({ allowGuestSignIn = false, errorMessage, initialEmail, initialRememberMe, isDisabled: _isDisabled = false, isPendingGuestSignIn = false, isPendingUserSignIn = false, onSubmit = () => { }, }) {
|
|
17
|
+
function SignInForm({ allowGuestSignIn = false, createAccountPath, errorMessage, initialEmail, initialRememberMe, isDisabled: _isDisabled = false, isPendingGuestSignIn = false, isPendingUserSignIn = false, onRecoverPasswordDialogOpen = () => { }, onSubmit = () => { }, }) {
|
|
16
18
|
const t = useFormattedMessage();
|
|
17
19
|
const title = t('sign in');
|
|
18
20
|
const isDisabled = isPendingUserSignIn || isPendingGuestSignIn || _isDisabled;
|
|
@@ -46,7 +48,11 @@ function SignInForm({ allowGuestSignIn = false, errorMessage, initialEmail, init
|
|
|
46
48
|
},
|
|
47
49
|
});
|
|
48
50
|
};
|
|
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"
|
|
51
|
+
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 => {
|
|
52
|
+
if (!value)
|
|
53
|
+
return value;
|
|
54
|
+
return (validateEmail(value) || t('Please enter a valid email address'));
|
|
55
|
+
} }) }), 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, isDisabled: isDisabled, onClick: onRecoverPasswordDialogOpen, children: t('Forgot password?') }) }), jsx("p", { children: jsxs(Fragment, { children: [t('New user?'), ' ', jsx(RouteLink, { "data-test-selector": "signInCreateNewAccount_createNewAccount", hasUnderline: true, href: createAccountPath, 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
56
|
}
|
|
51
57
|
|
|
52
58
|
export { SignInForm };
|
package/dist/styles.css
CHANGED
|
@@ -828,7 +828,7 @@
|
|
|
828
828
|
|
|
829
829
|
.button-module-V4meK.button-module-U5IxM .button-module-13ndF {
|
|
830
830
|
position: absolute;
|
|
831
|
-
right: var(--space-
|
|
831
|
+
right: var(--space-12);
|
|
832
832
|
}
|
|
833
833
|
|
|
834
834
|
.button-module-V4meK.button-module-U5IxM .button-module-ydQAo {
|
|
@@ -1799,6 +1799,7 @@
|
|
|
1799
1799
|
margin: 0;
|
|
1800
1800
|
color: var(--color-brand-black);
|
|
1801
1801
|
font-weight: var(--font-weight-normal);
|
|
1802
|
+
text-wrap: pretty;
|
|
1802
1803
|
transition: all 0.2s ease-out;
|
|
1803
1804
|
}
|
|
1804
1805
|
|
|
@@ -2241,6 +2242,7 @@
|
|
|
2241
2242
|
|
|
2242
2243
|
.dialog-module-qKzgy {
|
|
2243
2244
|
position: relative;
|
|
2245
|
+
max-width: 403px;
|
|
2244
2246
|
padding: var(--space-24);
|
|
2245
2247
|
padding-right: var(--space-32);
|
|
2246
2248
|
}
|
|
@@ -2277,10 +2279,6 @@
|
|
|
2277
2279
|
gap: 8px;
|
|
2278
2280
|
}
|
|
2279
2281
|
|
|
2280
|
-
.sign-in-dialog-module-P-AHV {
|
|
2281
|
-
max-width: 403px;
|
|
2282
|
-
}
|
|
2283
|
-
|
|
2284
2282
|
.favorite-button-module-tXSS3:where(.favorite-button-module-l557q) {
|
|
2285
2283
|
animation: favorite-button-module-6Tsmy 0.4s ease-in-out 0s 1 normal both;
|
|
2286
2284
|
color: var(--color-brand-red);
|
|
@@ -5361,6 +5359,7 @@ button.swiper-pagination-bullet {
|
|
|
5361
5359
|
|
|
5362
5360
|
.message-module-Gi4uR {
|
|
5363
5361
|
grid-area: body;
|
|
5362
|
+
text-wrap: pretty;
|
|
5364
5363
|
}
|
|
5365
5364
|
|
|
5366
5365
|
/* variants */
|
|
@@ -5842,10 +5841,14 @@ button.swiper-pagination-bullet {
|
|
|
5842
5841
|
}
|
|
5843
5842
|
}
|
|
5844
5843
|
|
|
5845
|
-
.page-container-module-eFYSe.page-container-module-iCrH5
|
|
5846
|
-
|
|
5844
|
+
.page-container-module-eFYSe.page-container-module-iCrH5 {
|
|
5845
|
+
flex-grow: 1; /* TODO: required for Spire, remove later */
|
|
5847
5846
|
}
|
|
5848
5847
|
|
|
5848
|
+
.page-container-module-eFYSe.page-container-module-iCrH5 .page-container-module-r0SOZ {
|
|
5849
|
+
padding-block-end: 0;
|
|
5850
|
+
}
|
|
5851
|
+
|
|
5849
5852
|
.checkout-page-layout-module-lULV3 {
|
|
5850
5853
|
--layout-width: var(--page-container-max-width, 100svw);
|
|
5851
5854
|
--padding-inline: var(--page-container-padding-inline, 10px);
|
|
@@ -6053,27 +6056,28 @@ button.swiper-pagination-bullet {
|
|
|
6053
6056
|
white-space: pre;
|
|
6054
6057
|
}
|
|
6055
6058
|
|
|
6056
|
-
.edit-address-module-
|
|
6059
|
+
.edit-address-form-module-s19Fg {
|
|
6057
6060
|
display: grid;
|
|
6058
6061
|
gap: var(--space-16);
|
|
6059
6062
|
grid-template-columns: 1fr;
|
|
6060
6063
|
}
|
|
6061
6064
|
|
|
6062
|
-
.edit-address-module-
|
|
6065
|
+
.edit-address-form-module-s19Fg .edit-address-form-module-O1w3c {
|
|
6063
6066
|
display: grid;
|
|
6064
6067
|
}
|
|
6065
6068
|
|
|
6066
|
-
@media (width >= 768px) {.edit-address-module-
|
|
6069
|
+
@media (width >= 768px) {.edit-address-form-module-s19Fg {
|
|
6070
|
+
align-items: flex-start;
|
|
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonic-equipment/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "141.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -140,8 +140,8 @@
|
|
|
140
140
|
"instantsearch.js": "4.77.3",
|
|
141
141
|
"js-cookie": "3.0.5",
|
|
142
142
|
"query-string": "9.1.1",
|
|
143
|
-
"react-aria": "3.
|
|
144
|
-
"react-aria-components": "1.
|
|
143
|
+
"react-aria": "3.38.1",
|
|
144
|
+
"react-aria-components": "1.7.1",
|
|
145
145
|
"react-instantsearch": "7.15.3",
|
|
146
146
|
"react-toastify": "10.0.6",
|
|
147
147
|
"react-transition-group": "4.4.5",
|