@sonic-equipment/ui 239.0.0 → 241.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/algolia/algolia-index-config.d.ts +3 -1
- package/dist/algolia/algolia-index-config.js +19 -112
- package/dist/algolia/algolia-initialization.js +1 -1
- package/dist/buttons/button/button.js +1 -1
- package/dist/cart-totals/cart-totals-summary.js +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/delivery-time/delivery-time.js +1 -1
- package/dist/display/details/details.d.ts +7 -0
- package/dist/display/details/details.js +11 -0
- package/dist/display/details/details.module.css.js +3 -0
- package/dist/display/price/price.js +15 -5
- package/dist/exports.d.ts +1 -0
- package/dist/header/buttons/account/connected-account-button.js +3 -1
- package/dist/icons/glyph/glyphs-chevrons-bold-right-icon.js +8 -0
- package/dist/index.js +1 -0
- package/dist/info-icon-tooltip/info-icon-tooltip.js +1 -1
- package/dist/intl/translation-id.d.ts +1 -1
- package/dist/modals/confirmation/confirmation-dialog.d.ts +1 -1
- package/dist/navigation/quick-access-menu/quick-access-menu.js +4 -1
- package/dist/pages/checkout/cart-page/cart-page.js +2 -2
- package/dist/pages/checkout/payment-page/components/adyen-payment.d.ts +1 -1
- package/dist/pages/error-page/error-page.d.ts +2 -1
- package/dist/pages/error-page/error-page.js +2 -2
- package/dist/pages/my-sonic/actions/create-ship-to-address/connected-create-ship-to-address-form.js +1 -2
- package/dist/pages/my-sonic/actions/edit-bill-to-address/connected-edit-bill-to-address-form.js +1 -2
- package/dist/pages/my-sonic/actions/edit-ship-to-address/connected-edit-ship-to-address-form.js +1 -2
- package/dist/pages/my-sonic/pages/favorites/favorites-page.js +2 -2
- package/dist/pages/my-sonic/pages/order-details/order-details-content.js +1 -1
- package/dist/pages/my-sonic/pages/order-details/order-details-page.js +5 -5
- package/dist/pages/my-sonic/pages/order-history/order-history-page.js +2 -2
- package/dist/pages/product/product-details-page/components/product-details-panel/product-details-panel.d.ts +1 -1
- package/dist/pages/product/product-details-page/components/product-details-panel/product-details-panel.js +1 -1
- package/dist/shared/api/storefront/hooks/account/use-create-account.d.ts +2 -2
- package/dist/shared/api/storefront/hooks/account/use-create-guest-account.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/authentication/use-patch-session.js +1 -1
- package/dist/shared/api/storefront/hooks/authentication/use-sign-out-mutation.d.ts +6 -2
- package/dist/shared/api/storefront/hooks/authentication/use-sign-out-mutation.js +1 -1
- package/dist/shared/api/storefront/hooks/authentication/use-sign-out.d.ts +3 -1
- package/dist/shared/api/storefront/hooks/authentication/use-sign-out.js +4 -2
- package/dist/shared/api/storefront/hooks/customer/use-patch-bill-to-address.js +1 -1
- package/dist/shared/api/storefront/hooks/customer/use-patch-ship-to-address.js +1 -1
- package/dist/shared/api/storefront/hooks/customer/use-post-ship-to-address.js +1 -1
- package/dist/shared/api/storefront/hooks/payment/use-create-adyen-session.d.ts +2 -2
- package/dist/shared/api/storefront/hooks/payment/use-fetch-adyen-config.js +1 -1
- package/dist/shared/api/storefront/services/payment-service.d.ts +1 -1
- package/dist/shared/error/basic-error-view.js +3 -10
- package/dist/shared/error/basic-error-view.module.css.js +3 -0
- package/dist/shared/error/default-error-view.d.ts +1 -1
- package/dist/shared/error/default-error-view.js +10 -28
- package/dist/shared/error/default-error-view.module.css.js +3 -0
- package/dist/shared/error/types.d.ts +3 -0
- package/dist/shared/utils/price.d.ts +4 -2
- package/dist/shared/utils/price.js +8 -5
- package/dist/styles.css +170 -2
- package/dist/tooltip/tooltip.js +1 -1
- package/package.json +2 -1
|
@@ -15,10 +15,10 @@ import { useIntl } from '../../../../intl/use-intl.js';
|
|
|
15
15
|
import { DynamicLoadingOverlay } from '../../../../loading/dynamic-loading-overlay.js';
|
|
16
16
|
import { useFetchOrders } from '../../../../shared/api/storefront/hooks/orders/use-fetch-orders.js';
|
|
17
17
|
import { orderStatuses } from '../../../../shared/api/storefront/model/storefront.model.js';
|
|
18
|
+
import { DefaultErrorView } from '../../../../shared/error/default-error-view.js';
|
|
18
19
|
import { usePaths } from '../../../../shared/routing/use-paths.js';
|
|
19
20
|
import { scrollIntoViewRef } from '../../../../shared/utils/scrolling.js';
|
|
20
21
|
import { DataTable } from '../../../../table/data-table.js';
|
|
21
|
-
import { ErrorPage } from '../../../error-page/error-page.js';
|
|
22
22
|
import { MySonicLayoutBreadcrumb } from '../../layouts/my-sonic-layout/my-sonic-layout-breadcrumb.js';
|
|
23
23
|
import { MySonicLayoutPage } from '../../layouts/my-sonic-layout/my-sonic-layout-page.js';
|
|
24
24
|
import styles from './order-history-page.module.css.js';
|
|
@@ -51,7 +51,7 @@ function OrderHistoryPage() {
|
|
|
51
51
|
scrollIntoViewRef(orderHistoryRef);
|
|
52
52
|
}, [page]);
|
|
53
53
|
if (error)
|
|
54
|
-
return jsx(
|
|
54
|
+
return (jsx(MySonicLayoutPage, { "data-test-selector": "order-history", title: t('Order history'), children: jsx(DefaultErrorView, { error: error, title: "" }) }));
|
|
55
55
|
const { orders, pagination } = data ?? {
|
|
56
56
|
orders: [],
|
|
57
57
|
pagination: {},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProductDetails } from 'shared/api/bff/model/bff.model';
|
|
1
|
+
import { ProductDetails } from '../../../../../shared/api/bff/model/bff.model';
|
|
2
2
|
export declare function ProductDetailsPanel({ priceComponent, product, }: {
|
|
3
3
|
priceComponent?: React.ReactNode;
|
|
4
4
|
product: ProductDetails;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useAlgoliaInsights } from '../../../../../algolia/use-algolia-insights.js';
|
|
3
4
|
import { ConnectedAddToCartButton } from '../../../../../buttons/add-to-cart-button/connected-add-to-cart-button.js';
|
|
4
5
|
import { ConnectedFavoriteButton } from '../../../../../buttons/favorite/connected-favorite-button.js';
|
|
5
6
|
import { Accordion } from '../../../../../collapsables/accordion/accordion.js';
|
|
@@ -11,7 +12,6 @@ import { FormattedMessage } from '../../../../../intl/formatted-message.js';
|
|
|
11
12
|
import { DownloadDocumentList } from '../../../../../lists/download-document-list/download-document-list.js';
|
|
12
13
|
import { FeatureList } from '../../../../../lists/feature-list/feature-list.js';
|
|
13
14
|
import { Heading } from '../../../../../typography/heading/heading.js';
|
|
14
|
-
import { useAlgoliaInsights } from '../../../../../algolia/use-algolia-insights.js';
|
|
15
15
|
import styles from './product-details-panel.module.css.js';
|
|
16
16
|
|
|
17
17
|
function ProductDetailsPanel({ priceComponent, product, }) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { AccountModel } from '
|
|
2
|
-
import { CreateAccountRequestBody } from '
|
|
1
|
+
import { AccountModel } from '../../model/storefront.model';
|
|
2
|
+
import { CreateAccountRequestBody } from '../../services/account-service';
|
|
3
3
|
export declare function useCreateAccount(): import("@tanstack/react-query").UseMutationResult<AccountModel, Error, CreateAccountRequestBody, unknown>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AccountModel } from '
|
|
1
|
+
import { AccountModel } from '../../model/storefront.model';
|
|
2
2
|
export declare function useCreateGuestAccount(): import("@tanstack/react-query").UseMutationResult<AccountModel, Error, void, unknown>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useQueryClient } from '@tanstack/react-query';
|
|
3
|
-
import { patchSession } from '../../services/authentication-service.js';
|
|
4
3
|
import { useAwaitableMutation } from '../../../shared/hooks/use-awaitable-mutation.js';
|
|
4
|
+
import { patchSession } from '../../services/authentication-service.js';
|
|
5
5
|
|
|
6
6
|
function usePatchSession() {
|
|
7
7
|
const queryClient = useQueryClient();
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
type SignOutVariables = {
|
|
2
|
+
returnUrl?: string;
|
|
3
|
+
} | void;
|
|
1
4
|
export interface UseSignOutArgs {
|
|
2
5
|
onError?: (error: Error) => void;
|
|
3
|
-
onSuccess?:
|
|
6
|
+
onSuccess?: (data: void, variables: SignOutVariables) => void;
|
|
4
7
|
}
|
|
5
|
-
export declare function useSignOutMutation(options?: UseSignOutArgs): import("@tanstack/react-query").UseMutationResult<void, Error,
|
|
8
|
+
export declare function useSignOutMutation(options?: UseSignOutArgs): import("@tanstack/react-query").UseMutationResult<void, Error, SignOutVariables, unknown>;
|
|
9
|
+
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export declare function useSignOut(options?: {
|
|
2
2
|
onSignOut?: VoidFunction;
|
|
3
|
-
}): import("@tanstack/react-query").UseMutateFunction<void, Error, void
|
|
3
|
+
}): import("@tanstack/react-query").UseMutateFunction<void, Error, void | {
|
|
4
|
+
returnUrl?: string;
|
|
5
|
+
}, unknown>;
|
|
@@ -10,10 +10,12 @@ function useSignOut(options = {}) {
|
|
|
10
10
|
const paths = usePaths();
|
|
11
11
|
const { mutate } = useSignOutMutation({
|
|
12
12
|
onError: logger.error,
|
|
13
|
-
onSuccess: () => {
|
|
13
|
+
onSuccess: (_data, variables) => {
|
|
14
14
|
// TODO: Remove when Spire is deprecated
|
|
15
15
|
Cookies.remove('NavigationMode');
|
|
16
|
-
navigate(paths.HOME, {
|
|
16
|
+
navigate((variables && variables.returnUrl) || paths.HOME, {
|
|
17
|
+
reload: true,
|
|
18
|
+
});
|
|
17
19
|
options.onSignOut?.();
|
|
18
20
|
},
|
|
19
21
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { patchBillToAddress } from '../../services/customer-service.js';
|
|
3
2
|
import { useAwaitableMutation } from '../../../shared/hooks/use-awaitable-mutation.js';
|
|
3
|
+
import { patchBillToAddress } from '../../services/customer-service.js';
|
|
4
4
|
|
|
5
5
|
function usePatchBillToAddress({ skipInvalidation = false, } = {}) {
|
|
6
6
|
return useAwaitableMutation({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { patchShipToAddress } from '../../services/customer-service.js';
|
|
3
2
|
import { useAwaitableMutation } from '../../../shared/hooks/use-awaitable-mutation.js';
|
|
3
|
+
import { patchShipToAddress } from '../../services/customer-service.js';
|
|
4
4
|
|
|
5
5
|
function usePatchShipToAddress({ skipInvalidation = false, } = {}) {
|
|
6
6
|
return useAwaitableMutation({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { postShipToAddress } from '../../services/customer-service.js';
|
|
3
2
|
import { useAwaitableMutation } from '../../../shared/hooks/use-awaitable-mutation.js';
|
|
3
|
+
import { postShipToAddress } from '../../services/customer-service.js';
|
|
4
4
|
|
|
5
5
|
function usePostShipToAddress({ skipInvalidation = false, } = {}) {
|
|
6
6
|
return useAwaitableMutation({
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { PaymentAuthenticationModel } from '
|
|
2
|
-
import { CreateAdyenSessionParameters } from '
|
|
1
|
+
import { PaymentAuthenticationModel } from '../../model/storefront.model';
|
|
2
|
+
import { CreateAdyenSessionParameters } from '../../services/payment-service';
|
|
3
3
|
export declare function useCreateAdyenSession(): import("@tanstack/react-query").UseMutationResult<PaymentAuthenticationModel, Error, CreateAdyenSessionParameters, unknown>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useQuery } from '@tanstack/react-query';
|
|
3
|
-
import { useIsAuthenticated } from '../authentication/use-is-authenticated.js';
|
|
4
3
|
import { fetchAdyenConfig } from '../../services/payment-service.js';
|
|
4
|
+
import { useIsAuthenticated } from '../authentication/use-is-authenticated.js';
|
|
5
5
|
|
|
6
6
|
function useFetchAdyenConfig() {
|
|
7
7
|
const isAuthenticated = useIsAuthenticated();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AdyenSettings, PaymentAuthenticationModel } from '
|
|
1
|
+
import { AdyenSettings, PaymentAuthenticationModel } from '../model/storefront.model';
|
|
2
2
|
export interface CreateAdyenSessionParameters {
|
|
3
3
|
cartId: string | undefined;
|
|
4
4
|
orderAmount: number | undefined;
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { Heading } from '../../typography/heading/heading.js';
|
|
4
|
+
import styles from './basic-error-view.module.css.js';
|
|
4
5
|
|
|
5
6
|
function BasicErrorView() {
|
|
6
|
-
return (
|
|
7
|
-
alignItems: 'center',
|
|
8
|
-
display: 'flex',
|
|
9
|
-
flexDirection: 'column',
|
|
10
|
-
height: '100vh',
|
|
11
|
-
justifyContent: 'center',
|
|
12
|
-
padding: '1rem',
|
|
13
|
-
textAlign: 'center',
|
|
14
|
-
}, children: [jsx(Heading, { size: "m", children: "Something went wrong" }), jsx("p", { children: "An unexpected error occurred. Please try refreshing the page, or come back later." }), jsx("a", { href: "/", children: "Go to homepage" })] }) }) }));
|
|
7
|
+
return (jsxs("html", { className: styles['basic-error-view'], lang: "en", children: [jsx("head", { children: jsx("title", { children: "Something went wrong" }) }), jsx("body", { children: jsxs("main", { "data-test-selector": "basicErrorView", children: [jsx(Heading, { className: styles['title'], size: "s", tag: "h1", children: "Something went wrong" }), jsx("p", { children: "An unexpected error occurred. Please try refreshing the page, or come back later." }), jsx("a", { href: "/", children: "Go to the homepage" })] }) })] }));
|
|
15
8
|
}
|
|
16
9
|
|
|
17
10
|
export { BasicErrorView };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ErrorViewProps } from './types';
|
|
2
|
-
export declare function DefaultErrorView({ error, errorInfo, resetError, showErrorDetails, showReset, }: ErrorViewProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function DefaultErrorView({ className, error, errorInfo, resetError, resetLabel, showErrorDetails, showReset, title, }: ErrorViewProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,35 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { Button } from '../../buttons/button/button.js';
|
|
5
|
+
import { Details } from '../../display/details/details.js';
|
|
6
|
+
import { StrokeRecentIcon } from '../../icons/stroke/stroke-recent-icon.js';
|
|
7
|
+
import { useFormattedMessage } from '../../intl/use-formatted-message.js';
|
|
8
|
+
import { Heading } from '../../typography/heading/heading.js';
|
|
3
9
|
import { environment } from '../utils/environment.js';
|
|
10
|
+
import styles from './default-error-view.module.css.js';
|
|
4
11
|
|
|
5
|
-
function DefaultErrorView({ error, errorInfo, resetError, showErrorDetails = environment !== 'production', showReset, }) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
border: '2px solid #ef4444',
|
|
9
|
-
borderRadius: '8px',
|
|
10
|
-
color: '#991b1b',
|
|
11
|
-
margin: '1rem',
|
|
12
|
-
padding: '2rem',
|
|
13
|
-
}, children: [jsx("h2", { style: { fontSize: '1.5rem', fontWeight: 'bold', marginTop: 0 }, children: "\u26A0\uFE0F Something went wrong" }), jsx("p", { style: { marginBottom: '1rem' }, children: error.message || 'An unexpected error occurred.' }), showErrorDetails && (jsxs("details", { style: { marginBottom: '1rem' }, children: [jsx("summary", { style: { cursor: 'pointer', fontWeight: 'bold' }, children: "Technical Details (only visible in development mode)" }), jsxs("div", { style: {
|
|
14
|
-
backgroundColor: '#fff',
|
|
15
|
-
border: '1px solid #fca5a5',
|
|
16
|
-
borderRadius: '4px',
|
|
17
|
-
fontFamily: 'monospace',
|
|
18
|
-
fontSize: '0.875rem',
|
|
19
|
-
marginTop: '0.5rem',
|
|
20
|
-
maxHeight: '300px',
|
|
21
|
-
overflow: 'auto',
|
|
22
|
-
padding: '1rem',
|
|
23
|
-
whiteSpace: 'pre-wrap',
|
|
24
|
-
}, children: [jsxs("div", { style: { marginBottom: '1rem' }, children: [jsx("strong", { children: "Error:" }), " ", error.toString()] }), error.stack && (jsxs("div", { style: { marginBottom: '1rem' }, children: [jsx("strong", { children: "Stack:" }), jsx("pre", { style: { margin: '0.5rem 0 0 0' }, children: error.stack })] })), errorInfo?.componentStack && (jsxs("div", { children: [jsx("strong", { children: "Component Stack:" }), jsx("pre", { style: { margin: '0.5rem 0 0 0' }, children: errorInfo.componentStack })] }))] })] })), jsx("div", { style: { display: 'flex', flexWrap: 'wrap', gap: '0.5rem' }, children: showReset && resetError && (jsx("button", { onClick: resetError, style: {
|
|
25
|
-
backgroundColor: '#6b7280',
|
|
26
|
-
border: 'none',
|
|
27
|
-
borderRadius: '4px',
|
|
28
|
-
color: 'white',
|
|
29
|
-
cursor: 'pointer',
|
|
30
|
-
fontWeight: '500',
|
|
31
|
-
padding: '0.5rem 1rem',
|
|
32
|
-
}, type: "button", children: "\u21BA Reset" })) })] }));
|
|
12
|
+
function DefaultErrorView({ className, error, errorInfo, resetError, resetLabel, showErrorDetails = environment !== 'production', showReset, title, }) {
|
|
13
|
+
const t = useFormattedMessage();
|
|
14
|
+
return (jsxs("section", { className: clsx(styles['default-error-view'], className), children: [title && (jsx(Heading, { className: styles['title'], size: "s", tag: "h1", children: title || t('Something went wrong') })), jsx("p", { children: error.message || t('An unexpected error occured. Please try again.') }), showErrorDetails && (jsxs(Details, { className: styles['error-details'], lang: "en", summary: "Technical Details (only visible in development mode)", children: [jsx("output", { className: styles['error-kind'], children: error.toString() }), error.stack && (jsxs("div", { className: styles['error-info'], children: [jsx(Heading, { className: styles['error-info-title'], size: "xs", tag: "h2", children: "Stack:" }), jsx("pre", { className: styles['error-info-data'], children: error.stack })] })), errorInfo?.componentStack && (jsxs("div", { className: styles['component-info'], children: [jsx(Heading, { className: styles['error-info-title'], size: "xs", tag: "h2", children: "Component stack:" }), jsx("pre", { className: styles['error-info-data'], children: errorInfo.componentStack })] }))] })), showReset && resetError && (jsx(Button, { light: true, className: styles['reset-button'], color: "secondary", icon: jsx(StrokeRecentIcon, {}), onClick: resetError, size: "sm", type: "button", variant: "outline", children: resetLabel || t('Reset') }))] }));
|
|
33
15
|
}
|
|
34
16
|
|
|
35
17
|
export { DefaultErrorView };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var styles = {"default-error-view":"default-error-view-module-IXKuf","title":"default-error-view-module-ZfydO","error-details":"default-error-view-module-pGbzW","error-kind":"default-error-view-module-LRchn","error-info":"default-error-view-module-Tz1Vb","error-info-title":"default-error-view-module-go6yg","error-info-data":"default-error-view-module--B3DB"};
|
|
2
|
+
|
|
3
|
+
export { styles as default };
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { ErrorInfo } from 'react';
|
|
2
2
|
export interface ErrorViewProps {
|
|
3
|
+
className?: string;
|
|
3
4
|
context?: ErrorContext;
|
|
4
5
|
error: Error;
|
|
5
6
|
errorInfo?: ErrorInfo;
|
|
6
7
|
resetError?: () => void;
|
|
8
|
+
resetLabel?: string;
|
|
7
9
|
showErrorDetails?: boolean;
|
|
8
10
|
showReset?: boolean;
|
|
11
|
+
title?: string;
|
|
9
12
|
}
|
|
10
13
|
export interface ErrorContext {
|
|
11
14
|
[key: string]: unknown;
|