@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.
Files changed (166) hide show
  1. package/dist/algolia/algolia-categories-filters.js +1 -5
  2. package/dist/buttons/button/button.d.ts +2 -1
  3. package/dist/buttons/button/button.js +3 -3
  4. package/dist/buttons/button/button.module.css.js +1 -1
  5. package/dist/cards/category-card/category-card.d.ts +1 -2
  6. package/dist/cards/category-card/category-card.js +2 -3
  7. package/dist/cards/category-card/category-card.module.css.js +1 -1
  8. package/dist/cards/data-card/data-card.d.ts +27 -0
  9. package/dist/cards/data-card/data-card.js +17 -0
  10. package/dist/cards/data-card/data-card.module.css.js +3 -0
  11. package/dist/cards/orderline-card/orderline-card.d.ts +1 -1
  12. package/dist/carousel/category-carousel/category-carousel.js +1 -1
  13. package/dist/carousel/category-carousel/category-carousel.module.css.js +1 -1
  14. package/dist/delivery-time/delivery-time.d.ts +2 -2
  15. package/dist/delivery-time/delivery-time.js +3 -1
  16. package/dist/exports.d.ts +8 -1
  17. package/dist/forms/number-field/number-field.js +3 -3
  18. package/dist/global-search/categories-grid/categories-grid.js +1 -1
  19. package/dist/icons/solid/solid-add-icon.d.ts +1 -0
  20. package/dist/icons/solid/solid-close-icon.js +1 -1
  21. package/dist/icons/solid/solid-dashboard-icon.d.ts +1 -0
  22. package/dist/icons/solid/solid-dashboard-icon.js +7 -0
  23. package/dist/icons/solid/solid-edit-icon.d.ts +1 -0
  24. package/dist/icons/solid/solid-facebook-icon.d.ts +1 -0
  25. package/dist/icons/solid/solid-folder-icon.d.ts +1 -0
  26. package/dist/icons/solid/solid-instagram-icon.d.ts +1 -0
  27. package/dist/icons/solid/solid-link-icon.d.ts +1 -0
  28. package/dist/icons/solid/solid-linkedin-icon.d.ts +1 -0
  29. package/dist/icons/solid/solid-logout-icon.d.ts +1 -0
  30. package/dist/icons/solid/solid-logout-icon.js +7 -0
  31. package/dist/icons/solid/solid-mail-icon.d.ts +1 -0
  32. package/dist/icons/solid/solid-news-icon.js +1 -1
  33. package/dist/icons/solid/solid-okay-icon.js +1 -1
  34. package/dist/icons/solid/solid-package-icon.d.ts +1 -0
  35. package/dist/icons/solid/solid-payment-icon.d.ts +1 -0
  36. package/dist/icons/solid/solid-remove-icon.d.ts +1 -0
  37. package/dist/icons/solid/solid-salecategory-icon.d.ts +1 -0
  38. package/dist/icons/solid/solid-salecategory-icon.js +7 -0
  39. package/dist/icons/solid/solid-stories-icon.d.ts +1 -0
  40. package/dist/icons/solid/solid-thumbsdown-icon.d.ts +1 -0
  41. package/dist/icons/solid/solid-thumbsup-icon.d.ts +1 -0
  42. package/dist/icons/solid/solid-tiktok-icon.d.ts +1 -0
  43. package/dist/icons/solid/solid-youtube-icon.d.ts +1 -0
  44. package/dist/icons/stroke/stroke-3d-icon.d.ts +1 -0
  45. package/dist/icons/stroke/stroke-3dview-icon.d.ts +1 -0
  46. package/dist/icons/stroke/stroke-add-icon.d.ts +1 -0
  47. package/dist/icons/stroke/stroke-arkit-icon.d.ts +1 -0
  48. package/dist/icons/stroke/stroke-closebox-icon.js +1 -1
  49. package/dist/icons/stroke/stroke-dashboard-icon.d.ts +1 -0
  50. package/dist/icons/stroke/stroke-edit-icon.d.ts +1 -0
  51. package/dist/icons/stroke/stroke-efficiency-icon.d.ts +1 -0
  52. package/dist/icons/stroke/stroke-event-icon.d.ts +1 -0
  53. package/dist/icons/stroke/stroke-event-icon.js +7 -0
  54. package/dist/icons/stroke/stroke-facebook-icon.d.ts +1 -0
  55. package/dist/icons/stroke/stroke-fallback-icon.d.ts +1 -0
  56. package/dist/icons/stroke/stroke-folder-icon.d.ts +1 -0
  57. package/dist/icons/stroke/stroke-happy-icon.d.ts +1 -0
  58. package/dist/icons/stroke/stroke-information-icon.js +1 -1
  59. package/dist/icons/stroke/stroke-innovate-icon.d.ts +1 -0
  60. package/dist/icons/stroke/stroke-instagram-icon.d.ts +1 -0
  61. package/dist/icons/stroke/stroke-link-icon.d.ts +1 -0
  62. package/dist/icons/stroke/stroke-linkedin-icon.d.ts +1 -0
  63. package/dist/icons/stroke/stroke-logout-icon.d.ts +1 -0
  64. package/dist/icons/stroke/stroke-mail-icon.d.ts +1 -0
  65. package/dist/icons/stroke/stroke-minus-icon.d.ts +1 -0
  66. package/dist/icons/stroke/{stroke-collapse-icon.js → stroke-minus-icon.js} +2 -2
  67. package/dist/icons/stroke/stroke-modular-icon.d.ts +1 -0
  68. package/dist/icons/stroke/stroke-neutral-icon.d.ts +1 -0
  69. package/dist/icons/stroke/stroke-news-icon.d.ts +1 -0
  70. package/dist/icons/stroke/stroke-package-icon.d.ts +1 -0
  71. package/dist/icons/stroke/stroke-payment-icon.d.ts +1 -0
  72. package/dist/icons/stroke/stroke-plus-icon.d.ts +1 -0
  73. package/dist/icons/stroke/{stroke-expand-icon.js → stroke-plus-icon.js} +2 -2
  74. package/dist/icons/stroke/stroke-proactive-icon.d.ts +1 -0
  75. package/dist/icons/stroke/stroke-productivity-icon.d.ts +1 -0
  76. package/dist/icons/stroke/stroke-remove-icon.d.ts +1 -0
  77. package/dist/icons/stroke/stroke-sad-icon.d.ts +1 -0
  78. package/dist/icons/stroke/stroke-sale-icon.d.ts +1 -0
  79. package/dist/icons/stroke/stroke-salecategory-icon.d.ts +1 -0
  80. package/dist/icons/stroke/stroke-stories-icon.d.ts +1 -0
  81. package/dist/icons/stroke/stroke-style-icon.d.ts +1 -0
  82. package/dist/icons/stroke/stroke-support-icon.d.ts +1 -0
  83. package/dist/icons/stroke/stroke-teamplayer-icon.d.ts +1 -0
  84. package/dist/icons/stroke/stroke-thumbsdown-icon.d.ts +1 -0
  85. package/dist/icons/stroke/stroke-thumbsup-icon.d.ts +1 -0
  86. package/dist/icons/stroke/stroke-tiktok-icon.d.ts +1 -0
  87. package/dist/icons/stroke/stroke-warranty10y-icon.d.ts +1 -0
  88. package/dist/icons/stroke/stroke-warranty1y-icon.d.ts +1 -0
  89. package/dist/icons/stroke/stroke-warranty3y-icon.d.ts +1 -0
  90. package/dist/icons/stroke/stroke-warranty5y-icon.d.ts +1 -0
  91. package/dist/icons/stroke/stroke-warrantyconsumable-icon.d.ts +1 -0
  92. package/dist/icons/stroke/stroke-warrantylifetime-icon.d.ts +1 -0
  93. package/dist/icons/stroke/stroke-youtube-icon.d.ts +1 -0
  94. package/dist/index.js +9 -2
  95. package/dist/intl/translation-id.d.ts +1 -1
  96. package/dist/lists/menu-list/menu-list-item.d.ts +2 -1
  97. package/dist/lists/menu-list/menu-list-item.js +2 -2
  98. package/dist/notifications/announcements/announcement.js +4 -4
  99. package/dist/pages/checkout/cart-page/cart-page.js +1 -1
  100. package/dist/pages/checkout/order-confirmation-page/order-confirmation-page-content.js +1 -1
  101. package/dist/pages/checkout/payment-page/payment-page-content.js +1 -1
  102. package/dist/pages/my-account/navigation/connected-my-account-navigation.d.ts +1 -0
  103. package/dist/pages/my-account/navigation/connected-my-account-navigation.js +27 -0
  104. package/dist/pages/my-account/navigation/my-account-desktop-navigation.d.ts +6 -0
  105. package/dist/pages/my-account/navigation/my-account-desktop-navigation.js +17 -0
  106. package/dist/pages/my-account/navigation/my-account-desktop-navigation.module.css.js +3 -0
  107. package/dist/pages/my-account/navigation/my-account-mobile-navigation.d.ts +4 -0
  108. package/dist/pages/my-account/navigation/my-account-mobile-navigation.js +25 -0
  109. package/dist/pages/my-account/widgets/connected-company-information-widget.d.ts +1 -0
  110. package/dist/pages/my-account/widgets/connected-company-information-widget.js +43 -0
  111. package/dist/pages/my-account/widgets/connected-user-account-widget.d.ts +1 -0
  112. package/dist/pages/my-account/widgets/connected-user-account-widget.js +32 -0
  113. package/dist/pages/paths.d.ts +4 -0
  114. package/dist/pages/paths.js +4 -0
  115. package/dist/shared/api/bff/services/bff-service.js +29 -0
  116. package/dist/shared/api/storefront/hooks/authentication/use-sign-out.d.ts +5 -1
  117. package/dist/shared/api/storefront/hooks/authentication/use-sign-out.js +2 -1
  118. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-with-atp.js +1 -1
  119. package/dist/shared/api/storefront/hooks/customer/use-fetch-current-bill-to-address.d.ts +1 -0
  120. package/dist/shared/api/storefront/hooks/customer/use-fetch-current-bill-to-address.js +11 -0
  121. package/dist/shared/api/storefront/services/authentication-service.js +12 -5
  122. package/dist/shared/api/storefront/services/customer-service.d.ts +1 -0
  123. package/dist/shared/api/storefront/services/customer-service.js +8 -1
  124. package/dist/shared/routing/route-provider.d.ts +6 -2
  125. package/dist/shared/routing/route-provider.js +6 -2
  126. package/dist/shared/routing/route-utils.d.ts +2 -2
  127. package/dist/shared/routing/route-utils.js +6 -3
  128. package/dist/shared/routing/types.d.ts +6 -2
  129. package/dist/shared/routing/use-location.d.ts +9 -0
  130. package/dist/shared/routing/use-location.js +18 -0
  131. package/dist/shared/routing/use-route-link.d.ts +1 -0
  132. package/dist/shared/routing/use-route-link.js +5 -4
  133. package/dist/shared/routing/with-routing.js +2 -9
  134. package/dist/sidebar/toggle-sidebar-button.js +1 -1
  135. package/dist/styles.css +244 -128
  136. package/package.json +1 -1
  137. package/dist/icons/other/career-innovate-icon.d.ts +0 -1
  138. package/dist/icons/other/career-proactive-icon.d.ts +0 -1
  139. package/dist/icons/other/career-teamplayer-icon.d.ts +0 -1
  140. package/dist/icons/other/fallback-icon.d.ts +0 -1
  141. package/dist/icons/other/some-facebook-icon.d.ts +0 -1
  142. package/dist/icons/other/some-instagram-icon.d.ts +0 -1
  143. package/dist/icons/other/some-linkedin-icon.d.ts +0 -1
  144. package/dist/icons/other/some-mail-icon.d.ts +0 -1
  145. package/dist/icons/other/some-youtube-icon.d.ts +0 -1
  146. package/dist/icons/other/usp-efficiency-icon.d.ts +0 -1
  147. package/dist/icons/other/usp-style-icon.d.ts +0 -1
  148. package/dist/icons/other/usp-support-icon.d.ts +0 -1
  149. package/dist/icons/other/warranty-10y-icon.d.ts +0 -1
  150. package/dist/icons/other/warranty-1y-icon.d.ts +0 -1
  151. package/dist/icons/other/warranty-3y-icon.d.ts +0 -1
  152. package/dist/icons/other/warranty-5y-icon.d.ts +0 -1
  153. package/dist/icons/other/warranty-consumable-icon.d.ts +0 -1
  154. package/dist/icons/other/warranty-lifetime-icon.d.ts +0 -1
  155. package/dist/icons/solid/solid-event-icon.d.ts +0 -1
  156. package/dist/icons/solid/solid-event-icon.js +0 -7
  157. package/dist/icons/solid/solid-sale-icon.d.ts +0 -1
  158. package/dist/icons/solid/solid-sale-icon.js +0 -7
  159. package/dist/icons/solid/solid-vote-thumbsdown-icon.d.ts +0 -1
  160. package/dist/icons/solid/solid-vote-thumbsup-icon.d.ts +0 -1
  161. package/dist/icons/stroke/stroke-collapse-icon.d.ts +0 -1
  162. package/dist/icons/stroke/stroke-expand-icon.d.ts +0 -1
  163. package/dist/icons/stroke/stroke-vote-thumbsdown-icon.d.ts +0 -1
  164. package/dist/icons/stroke/stroke-vote-thumbsup-icon.d.ts +0 -1
  165. package/dist/shared/routing/use-base-path.d.ts +0 -1
  166. package/dist/shared/routing/use-base-path.js +0 -12
@@ -1,5 +1,5 @@
1
1
  import { config } from '../../../../config.js';
2
- import { request, RequestError, isRequestError } from '../../../fetch/request.js';
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
- await request({
62
- method: 'DELETE',
63
- url: `${config.SHOP_API_URL}/api/v1/sessions/current`,
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({ basePath, children, Link, navigate, }: RouteProviderProps): import("react/jsx-runtime").JSX.Element;
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({ basePath, children, Link = FallbackRouteLink, navigate, }) {
7
- useGlobalState('routing', { Link, basePath, navigate });
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,4 +1,4 @@
1
- export declare function buildHref({ basePath, href, }: {
2
- basePath?: string;
1
+ export declare function buildHref({ basePathname, href, }: {
2
+ basePathname?: string;
3
3
  href: string;
4
4
  }): string;
@@ -1,6 +1,9 @@
1
- function buildHref({ basePath, href, }) {
2
- if (basePath && href.startsWith('/') && !href.startsWith(`/${basePath}`)) {
3
- return `/${basePath}${href}`;
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: () => void;
13
+ onNavigate?: () => void;
10
14
  route?: NavigateOptions;
11
15
  }
12
16
  export interface NavigateOptions {
@@ -0,0 +1,9 @@
1
+ import qs from 'query-string';
2
+ export declare function useLocation(): {
3
+ basePathname: string | undefined;
4
+ fullPathname: string | undefined;
5
+ href: string;
6
+ pathname: string | undefined;
7
+ query: qs.ParsedQuery<string>;
8
+ search: string | undefined;
9
+ };
@@ -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 };
@@ -4,5 +4,6 @@ export declare function useRouteLink(): {
4
4
  getRouteLinkProps: (href: string, route?: NavigateOptions) => {
5
5
  href: string;
6
6
  onNavigate: () => void;
7
+ route: NavigateOptions | undefined;
7
8
  };
8
9
  };
@@ -1,20 +1,21 @@
1
1
  import { useCallback } from 'react';
2
2
  import { buildHref } from './route-utils.js';
3
- import { useBasePath } from './use-base-path.js';
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 basePath = useBasePath();
8
+ const { basePathname } = useLocation();
9
9
  const RouteLinkElement = useRouteLinkElement();
10
10
  const triggerCallbacks = useOnNavigate();
11
11
  const getRouteLinkProps = useCallback((href, route) => {
12
- href = buildHref({ basePath, href });
12
+ href = buildHref({ basePathname, href });
13
13
  return {
14
14
  href,
15
15
  onNavigate: () => triggerCallbacks(href, route),
16
+ route,
16
17
  };
17
- }, [basePath, triggerCallbacks]);
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 };