@sonic-equipment/ui 171.0.0 → 174.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-categories-filters.js +1 -5
- package/dist/buttons/button/button.d.ts +2 -1
- package/dist/buttons/button/button.js +3 -3
- package/dist/buttons/button/button.module.css.js +1 -1
- package/dist/cards/category-card/category-card.d.ts +1 -2
- package/dist/cards/category-card/category-card.js +2 -3
- package/dist/cards/category-card/category-card.module.css.js +1 -1
- package/dist/cards/data-card/data-card.d.ts +27 -0
- package/dist/cards/data-card/data-card.js +17 -0
- package/dist/cards/data-card/data-card.module.css.js +3 -0
- package/dist/cards/orderline-card/orderline-card.d.ts +1 -1
- package/dist/carousel/category-carousel/category-carousel.js +1 -1
- package/dist/carousel/category-carousel/category-carousel.module.css.js +1 -1
- package/dist/delivery-time/delivery-time.d.ts +2 -2
- package/dist/delivery-time/delivery-time.js +3 -1
- package/dist/exports.d.ts +8 -1
- package/dist/forms/number-field/number-field.js +3 -3
- package/dist/global-search/categories-grid/categories-grid.js +1 -1
- package/dist/icons/solid/solid-add-icon.d.ts +1 -0
- package/dist/icons/solid/solid-close-icon.js +1 -1
- package/dist/icons/solid/solid-dashboard-icon.d.ts +1 -0
- package/dist/icons/solid/solid-dashboard-icon.js +7 -0
- package/dist/icons/solid/solid-edit-icon.d.ts +1 -0
- package/dist/icons/solid/solid-facebook-icon.d.ts +1 -0
- package/dist/icons/solid/solid-folder-icon.d.ts +1 -0
- package/dist/icons/solid/solid-instagram-icon.d.ts +1 -0
- package/dist/icons/solid/solid-link-icon.d.ts +1 -0
- package/dist/icons/solid/solid-linkedin-icon.d.ts +1 -0
- package/dist/icons/solid/solid-logout-icon.d.ts +1 -0
- package/dist/icons/solid/solid-logout-icon.js +7 -0
- package/dist/icons/solid/solid-mail-icon.d.ts +1 -0
- package/dist/icons/solid/solid-news-icon.js +1 -1
- package/dist/icons/solid/solid-okay-icon.js +1 -1
- package/dist/icons/solid/solid-package-icon.d.ts +1 -0
- package/dist/icons/solid/solid-payment-icon.d.ts +1 -0
- package/dist/icons/solid/solid-remove-icon.d.ts +1 -0
- package/dist/icons/solid/solid-salecategory-icon.d.ts +1 -0
- package/dist/icons/solid/solid-salecategory-icon.js +7 -0
- package/dist/icons/solid/solid-stories-icon.d.ts +1 -0
- package/dist/icons/solid/solid-thumbsdown-icon.d.ts +1 -0
- package/dist/icons/solid/solid-thumbsup-icon.d.ts +1 -0
- package/dist/icons/solid/solid-tiktok-icon.d.ts +1 -0
- package/dist/icons/solid/solid-youtube-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-3d-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-3dview-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-add-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-arkit-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-closebox-icon.js +1 -1
- package/dist/icons/stroke/stroke-dashboard-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-edit-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-efficiency-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-event-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-event-icon.js +7 -0
- package/dist/icons/stroke/stroke-facebook-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-fallback-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-folder-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-happy-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-information-icon.js +1 -1
- package/dist/icons/stroke/stroke-innovate-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-instagram-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-link-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-linkedin-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-logout-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-mail-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-minus-icon.d.ts +1 -0
- package/dist/icons/stroke/{stroke-collapse-icon.js → stroke-minus-icon.js} +2 -2
- package/dist/icons/stroke/stroke-modular-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-neutral-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-news-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-package-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-payment-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-plus-icon.d.ts +1 -0
- package/dist/icons/stroke/{stroke-expand-icon.js → stroke-plus-icon.js} +2 -2
- package/dist/icons/stroke/stroke-proactive-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-productivity-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-remove-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-sad-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-sale-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-salecategory-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-stories-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-style-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-support-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-teamplayer-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-thumbsdown-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-thumbsup-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-tiktok-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-warranty10y-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-warranty1y-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-warranty3y-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-warranty5y-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-warrantyconsumable-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-warrantylifetime-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-youtube-icon.d.ts +1 -0
- package/dist/index.js +9 -2
- package/dist/intl/translation-id.d.ts +1 -1
- package/dist/lists/menu-list/menu-list-item.d.ts +2 -1
- package/dist/lists/menu-list/menu-list-item.js +2 -2
- package/dist/notifications/announcements/announcement.js +4 -4
- package/dist/pages/checkout/cart-page/cart-page.js +1 -1
- package/dist/pages/checkout/order-confirmation-page/order-confirmation-page-content.js +1 -1
- package/dist/pages/checkout/payment-page/payment-page-content.js +1 -1
- package/dist/pages/my-account/navigation/connected-my-account-navigation.d.ts +1 -0
- package/dist/pages/my-account/navigation/connected-my-account-navigation.js +27 -0
- package/dist/pages/my-account/navigation/my-account-desktop-navigation.d.ts +6 -0
- package/dist/pages/my-account/navigation/my-account-desktop-navigation.js +17 -0
- package/dist/pages/my-account/navigation/my-account-desktop-navigation.module.css.js +3 -0
- package/dist/pages/my-account/navigation/my-account-mobile-navigation.d.ts +4 -0
- package/dist/pages/my-account/navigation/my-account-mobile-navigation.js +25 -0
- package/dist/pages/my-account/widgets/connected-company-information-widget.d.ts +1 -0
- package/dist/pages/my-account/widgets/connected-company-information-widget.js +43 -0
- package/dist/pages/my-account/widgets/connected-user-account-widget.d.ts +1 -0
- package/dist/pages/my-account/widgets/connected-user-account-widget.js +32 -0
- package/dist/pages/paths.d.ts +4 -0
- package/dist/pages/paths.js +4 -0
- package/dist/shared/api/bff/services/bff-service.js +29 -0
- package/dist/shared/api/storefront/hooks/authentication/use-sign-out.d.ts +5 -1
- package/dist/shared/api/storefront/hooks/authentication/use-sign-out.js +2 -1
- package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-with-atp.js +1 -1
- package/dist/shared/api/storefront/hooks/customer/use-fetch-current-bill-to-address.d.ts +1 -0
- package/dist/shared/api/storefront/hooks/customer/use-fetch-current-bill-to-address.js +11 -0
- package/dist/shared/api/storefront/services/authentication-service.js +12 -5
- package/dist/shared/api/storefront/services/customer-service.d.ts +1 -0
- package/dist/shared/api/storefront/services/customer-service.js +8 -1
- package/dist/shared/routing/route-provider.d.ts +6 -2
- package/dist/shared/routing/route-provider.js +6 -2
- package/dist/shared/routing/route-utils.d.ts +2 -2
- package/dist/shared/routing/route-utils.js +6 -3
- package/dist/shared/routing/types.d.ts +6 -2
- package/dist/shared/routing/use-location.d.ts +9 -0
- package/dist/shared/routing/use-location.js +18 -0
- package/dist/shared/routing/use-route-link.d.ts +1 -0
- package/dist/shared/routing/use-route-link.js +5 -4
- package/dist/shared/routing/with-routing.js +2 -9
- package/dist/sidebar/toggle-sidebar-button.js +1 -1
- package/dist/styles.css +244 -128
- package/package.json +1 -1
- package/dist/icons/other/career-innovate-icon.d.ts +0 -1
- package/dist/icons/other/career-proactive-icon.d.ts +0 -1
- package/dist/icons/other/career-teamplayer-icon.d.ts +0 -1
- package/dist/icons/other/fallback-icon.d.ts +0 -1
- package/dist/icons/other/some-facebook-icon.d.ts +0 -1
- package/dist/icons/other/some-instagram-icon.d.ts +0 -1
- package/dist/icons/other/some-linkedin-icon.d.ts +0 -1
- package/dist/icons/other/some-mail-icon.d.ts +0 -1
- package/dist/icons/other/some-youtube-icon.d.ts +0 -1
- package/dist/icons/other/usp-efficiency-icon.d.ts +0 -1
- package/dist/icons/other/usp-style-icon.d.ts +0 -1
- package/dist/icons/other/usp-support-icon.d.ts +0 -1
- package/dist/icons/other/warranty-10y-icon.d.ts +0 -1
- package/dist/icons/other/warranty-1y-icon.d.ts +0 -1
- package/dist/icons/other/warranty-3y-icon.d.ts +0 -1
- package/dist/icons/other/warranty-5y-icon.d.ts +0 -1
- package/dist/icons/other/warranty-consumable-icon.d.ts +0 -1
- package/dist/icons/other/warranty-lifetime-icon.d.ts +0 -1
- package/dist/icons/solid/solid-event-icon.d.ts +0 -1
- package/dist/icons/solid/solid-event-icon.js +0 -7
- package/dist/icons/solid/solid-sale-icon.d.ts +0 -1
- package/dist/icons/solid/solid-sale-icon.js +0 -7
- package/dist/icons/solid/solid-vote-thumbsdown-icon.d.ts +0 -1
- package/dist/icons/solid/solid-vote-thumbsup-icon.d.ts +0 -1
- package/dist/icons/stroke/stroke-collapse-icon.d.ts +0 -1
- package/dist/icons/stroke/stroke-expand-icon.d.ts +0 -1
- package/dist/icons/stroke/stroke-vote-thumbsdown-icon.d.ts +0 -1
- package/dist/icons/stroke/stroke-vote-thumbsup-icon.d.ts +0 -1
- package/dist/shared/routing/use-base-path.d.ts +0 -1
- package/dist/shared/routing/use-base-path.js +0 -12
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { config } from '../../../../config.js';
|
|
2
|
-
import { request,
|
|
2
|
+
import { request, isRequestError, RequestError } from '../../../fetch/request.js';
|
|
3
3
|
|
|
4
4
|
async function fetchSession() {
|
|
5
5
|
const { body } = await request({
|
|
@@ -58,10 +58,17 @@ async function createSession({ accessToken, isGuest, keepMeSignedIn, password, r
|
|
|
58
58
|
return body;
|
|
59
59
|
}
|
|
60
60
|
async function signOut() {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
try {
|
|
62
|
+
await request({
|
|
63
|
+
method: 'DELETE',
|
|
64
|
+
url: `${config.SHOP_API_URL}/api/v1/sessions/current`,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
if (isRequestError(error) && error.status === 401)
|
|
69
|
+
return;
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
65
72
|
}
|
|
66
73
|
async function createGuestAccount({ defaultWarehouseId, }) {
|
|
67
74
|
const { body } = await request({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BillToCollectionModel, BillToModel, PatchBillToModel, ShipToCollectionModel } from 'shared/api/storefront/model/storefront.model';
|
|
2
|
+
export declare function fetchCurrentBillToAddress(): Promise<BillToModel>;
|
|
2
3
|
export declare function fetchBillToAddresses(): Promise<BillToCollectionModel>;
|
|
3
4
|
export declare function fetchShipToAddresses({ shipToId }: {
|
|
4
5
|
shipToId: string;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { config } from '../../../../config.js';
|
|
2
2
|
import { request } from '../../../fetch/request.js';
|
|
3
3
|
|
|
4
|
+
async function fetchCurrentBillToAddress() {
|
|
5
|
+
const { body } = await request({
|
|
6
|
+
credentials: 'include',
|
|
7
|
+
url: `${config.SHOP_API_URL}/api/v1/billtos/current`,
|
|
8
|
+
});
|
|
9
|
+
return body;
|
|
10
|
+
}
|
|
4
11
|
async function fetchBillToAddresses() {
|
|
5
12
|
const { body } = await request({
|
|
6
13
|
credentials: 'include',
|
|
@@ -36,4 +43,4 @@ async function fetchFulfillmentMethods({ customerId, }) {
|
|
|
36
43
|
return updatedBillTo;
|
|
37
44
|
}
|
|
38
45
|
|
|
39
|
-
export { fetchBillToAddresses, fetchFulfillmentMethods, fetchShipToAddresses, patchBillToAddress };
|
|
46
|
+
export { fetchBillToAddresses, fetchCurrentBillToAddress, fetchFulfillmentMethods, fetchShipToAddresses, patchBillToAddress };
|
|
@@ -2,8 +2,12 @@ import { ElementType, ReactNode } from 'react';
|
|
|
2
2
|
import { NavigateFunction, RouteLinkElementProps } from './types';
|
|
3
3
|
export interface RouteProviderProps {
|
|
4
4
|
Link?: ElementType<RouteLinkElementProps>;
|
|
5
|
-
basePath?: string;
|
|
6
5
|
children: ReactNode;
|
|
7
6
|
navigate: NavigateFunction;
|
|
7
|
+
url: {
|
|
8
|
+
basePathname?: string;
|
|
9
|
+
pathname: string;
|
|
10
|
+
search: string;
|
|
11
|
+
};
|
|
8
12
|
}
|
|
9
|
-
export declare function RouteProvider({
|
|
13
|
+
export declare function RouteProvider({ children, Link, navigate, url, }: RouteProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,8 +3,12 @@ import { jsx, Fragment } from 'react/jsx-runtime';
|
|
|
3
3
|
import { useGlobalState } from '../providers/global-state-provider.js';
|
|
4
4
|
import { withRouting } from './with-routing.js';
|
|
5
5
|
|
|
6
|
-
function RouteProvider({
|
|
7
|
-
useGlobalState('routing', {
|
|
6
|
+
function RouteProvider({ children, Link = FallbackRouteLink, navigate, url, }) {
|
|
7
|
+
useGlobalState('routing', {
|
|
8
|
+
Link,
|
|
9
|
+
navigate,
|
|
10
|
+
url,
|
|
11
|
+
});
|
|
8
12
|
return jsx(Fragment, { children: children });
|
|
9
13
|
}
|
|
10
14
|
const FallbackRouteLink = withRouting('a');
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
function buildHref({
|
|
2
|
-
if (
|
|
3
|
-
|
|
1
|
+
function buildHref({ basePathname, href, }) {
|
|
2
|
+
if (!href.startsWith('http') &&
|
|
3
|
+
basePathname &&
|
|
4
|
+
basePathname !== '/' &&
|
|
5
|
+
!href.startsWith(`/${basePathname}`)) {
|
|
6
|
+
return `/${basePathname.replace(/^\//, '')}/${href.replace(/^\//, '')}`;
|
|
4
7
|
}
|
|
5
8
|
return href;
|
|
6
9
|
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { ElementType } from 'react';
|
|
2
2
|
export interface RouteContext {
|
|
3
3
|
Link?: ElementType<RouteLinkElementProps>;
|
|
4
|
-
basePath?: string;
|
|
5
4
|
navigate: NavigateFunction;
|
|
5
|
+
url: {
|
|
6
|
+
basePathname?: string;
|
|
7
|
+
pathname: string;
|
|
8
|
+
search: string;
|
|
9
|
+
};
|
|
6
10
|
}
|
|
7
11
|
export interface RouteLinkElementProps extends React.HTMLProps<HTMLAnchorElement> {
|
|
8
12
|
href: string;
|
|
9
|
-
onNavigate
|
|
13
|
+
onNavigate?: () => void;
|
|
10
14
|
route?: NavigateOptions;
|
|
11
15
|
}
|
|
12
16
|
export interface NavigateOptions {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import qs from 'query-string';
|
|
2
|
+
import { useGlobalState } from '../providers/global-state-provider.js';
|
|
3
|
+
|
|
4
|
+
function useLocation() {
|
|
5
|
+
const [routeState] = useGlobalState('routing');
|
|
6
|
+
const { url: { basePathname, pathname, search }, } = routeState || { url: {} };
|
|
7
|
+
const query = qs.parse(search || '');
|
|
8
|
+
return {
|
|
9
|
+
basePathname,
|
|
10
|
+
fullPathname: pathname,
|
|
11
|
+
href: `${pathname}${search}`,
|
|
12
|
+
pathname: pathname?.replace(new RegExp(`^${basePathname}`), ''),
|
|
13
|
+
query,
|
|
14
|
+
search,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { useLocation };
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
2
|
import { buildHref } from './route-utils.js';
|
|
3
|
-
import {
|
|
3
|
+
import { useLocation } from './use-location.js';
|
|
4
4
|
import { useOnNavigate } from './use-on-navigate.js';
|
|
5
5
|
import { useRouteLinkElement } from './use-route-link-element.js';
|
|
6
6
|
|
|
7
7
|
function useRouteLink() {
|
|
8
|
-
const
|
|
8
|
+
const { basePathname } = useLocation();
|
|
9
9
|
const RouteLinkElement = useRouteLinkElement();
|
|
10
10
|
const triggerCallbacks = useOnNavigate();
|
|
11
11
|
const getRouteLinkProps = useCallback((href, route) => {
|
|
12
|
-
href = buildHref({
|
|
12
|
+
href = buildHref({ basePathname, href });
|
|
13
13
|
return {
|
|
14
14
|
href,
|
|
15
15
|
onNavigate: () => triggerCallbacks(href, route),
|
|
16
|
+
route,
|
|
16
17
|
};
|
|
17
|
-
}, [
|
|
18
|
+
}, [basePathname, triggerCallbacks]);
|
|
18
19
|
return {
|
|
19
20
|
RouteLinkElement,
|
|
20
21
|
getRouteLinkProps,
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
import { createElement } from 'react';
|
|
2
|
-
import { useBasePath } from './use-base-path.js';
|
|
3
2
|
import { useNavigate } from './use-navigate.js';
|
|
4
3
|
|
|
5
4
|
function withRouting(component) {
|
|
6
|
-
const Component = ({ href, onClick, route, ...rest }) => {
|
|
5
|
+
const Component = ({ href, onClick, onNavigate, route, ...rest }) => {
|
|
7
6
|
const { navigate } = useNavigate();
|
|
8
|
-
const basePath = useBasePath();
|
|
9
|
-
if (basePath &&
|
|
10
|
-
href &&
|
|
11
|
-
href.startsWith('/') &&
|
|
12
|
-
!href.startsWith(`/${basePath}`)) {
|
|
13
|
-
href = `/${basePath}${href}`;
|
|
14
|
-
}
|
|
15
7
|
const props = {
|
|
16
8
|
...rest,
|
|
17
9
|
href,
|
|
@@ -28,6 +20,7 @@ function withRouting(component) {
|
|
|
28
20
|
}
|
|
29
21
|
return navigate(href, route);
|
|
30
22
|
},
|
|
23
|
+
...(component === 'a' ? {} : { onNavigate }),
|
|
31
24
|
route,
|
|
32
25
|
};
|
|
33
26
|
return createElement(component, props);
|
|
@@ -7,7 +7,7 @@ import { useSidebar } from './use-sidebar.js';
|
|
|
7
7
|
|
|
8
8
|
const ToggleSidebarButton = () => {
|
|
9
9
|
const { isOpen, toggle } = useSidebar();
|
|
10
|
-
return (jsx(Button, { color: "secondary", icon: jsx(StrokeFilterIcon, {}), onClick: toggle, size: "sm", variant: "outline", children: isOpen ? (jsx(FormattedMessage, { id: "Hide filters" })) : (jsx(FormattedMessage, { id: "Show filters" })) }));
|
|
10
|
+
return (jsx(Button, { light: true, color: "secondary", icon: jsx(StrokeFilterIcon, {}), onClick: toggle, size: "sm", variant: "outline", children: isOpen ? (jsx(FormattedMessage, { id: "Hide filters" })) : (jsx(FormattedMessage, { id: "Show filters" })) }));
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export { ToggleSidebarButton };
|