@sonic-equipment/ui 214.0.0 → 216.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 (101) hide show
  1. package/dist/address-info-display/address-info-display.js +1 -1
  2. package/dist/algolia/algolia-insights-provider.d.ts +1 -1
  3. package/dist/buttons/button/button.d.ts +1 -1
  4. package/dist/buttons/link/link.d.ts +1 -1
  5. package/dist/buttons/print-button/print-button.d.ts +2 -1
  6. package/dist/buttons/print-button/print-button.js +2 -2
  7. package/dist/cards/product-card/product-card.js +1 -1
  8. package/dist/cards/table-card/table-card.d.ts +1 -1
  9. package/dist/cards/table-card/table-card.js +5 -3
  10. package/dist/carousel/carousel-navigation-button.d.ts +1 -1
  11. package/dist/cart-totals/cart-totals.js +1 -1
  12. package/dist/collapsables/accordion/accordion-item.js +3 -1
  13. package/dist/collapsables/cascading-component/cascading-component-container-context.d.ts +1 -1
  14. package/dist/collapsables/show-all/show-all.js +4 -2
  15. package/dist/collapsables/unmounter/unmounter.d.ts +1 -1
  16. package/dist/cookies/cookie-context.d.ts +1 -1
  17. package/dist/country-select/country-select.js +3 -1
  18. package/dist/country-selector/country-selector-trigger/country-selector-trigger.js +3 -1
  19. package/dist/exports.d.ts +13 -1
  20. package/dist/filters/active-filters/active-filters.js +1 -1
  21. package/dist/forms/elements/field-error/field-error.js +3 -1
  22. package/dist/forms/fields/number-field/number-field.d.ts +1 -1
  23. package/dist/forms/partials/address-form/address-form.js +6 -2
  24. package/dist/header/buttons/account/connected-account-button.js +1 -1
  25. package/dist/index.js +15 -3
  26. package/dist/intl/formatted-message.d.ts +3 -2
  27. package/dist/intl/formatted-message.js +25 -5
  28. package/dist/intl/intl-context.d.ts +1 -1
  29. package/dist/intl/intl-context.js +1 -10
  30. package/dist/intl/translation-id.d.ts +1 -1
  31. package/dist/intl/types.d.ts +27 -15
  32. package/dist/intl/types.js +7 -1
  33. package/dist/intl/use-formatted-message.d.ts +2 -2
  34. package/dist/intl/use-formatted-message.js +5 -5
  35. package/dist/intl/use-intl.js +4 -1
  36. package/dist/intl/utils.js +1 -1
  37. package/dist/lists/menu-list/menu-list-provider.d.ts +1 -1
  38. package/dist/modals/confirmation/confirmation-dialog.d.ts +3 -2
  39. package/dist/modals/dialog/dialog.js +1 -1
  40. package/dist/notifications/announcements/announcement.d.ts +1 -1
  41. package/dist/observers/intersection-observer.js +1 -1
  42. package/dist/pages/my-sonic/actions/change-password/change-password.js +1 -1
  43. package/dist/pages/my-sonic/actions/edit-bill-to-address/connected-edit-bill-to-address-form.js +1 -1
  44. package/dist/pages/my-sonic/actions/edit-ship-to-address/connected-edit-ship-to-address-form.js +1 -1
  45. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-breadcrumb.d.ts +4 -0
  46. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-breadcrumb.js +9 -0
  47. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout.module.css.js +1 -1
  48. package/dist/pages/my-sonic/navigation/connected-my-sonic-navigation.js +2 -2
  49. package/dist/pages/my-sonic/navigation/my-sonic-desktop-navigation.js +3 -1
  50. package/dist/pages/my-sonic/navigation/my-sonic-mobile-navigation.js +4 -2
  51. package/dist/pages/my-sonic/navigation/my-sonic-navigation-items.d.ts +1 -1
  52. package/dist/pages/my-sonic/navigation/my-sonic-navigation-items.js +3 -3
  53. package/dist/pages/my-sonic/pages/create-ship-to-address-details-page/create-ship-to-address-details-page.d.ts +7 -0
  54. package/dist/pages/my-sonic/pages/create-ship-to-address-details-page/create-ship-to-address-details-page.js +29 -0
  55. package/dist/pages/my-sonic/pages/edit-bill-to-address-details-page/edit-bill-to-address-details-page.d.ts +7 -0
  56. package/dist/pages/my-sonic/pages/edit-bill-to-address-details-page/edit-bill-to-address-details-page.js +29 -0
  57. package/dist/pages/my-sonic/pages/edit-ship-to-address-details-page/edit-ship-to-address-details-page.d.ts +9 -0
  58. package/dist/pages/my-sonic/pages/edit-ship-to-address-details-page/edit-ship-to-address-details-page.js +29 -0
  59. package/dist/pages/my-sonic/pages/favorites/favorites-page.d.ts +2 -0
  60. package/dist/pages/my-sonic/pages/favorites/favorites-page.js +23 -0
  61. package/dist/pages/my-sonic/pages/my-account/my-account-page.d.ts +2 -0
  62. package/dist/pages/my-sonic/pages/my-account/my-account-page.js +30 -0
  63. package/dist/pages/my-sonic/pages/order-details/order-details-content.d.ts +8 -0
  64. package/dist/pages/my-sonic/pages/order-details/order-details-content.js +69 -0
  65. package/dist/pages/my-sonic/pages/order-details/order-details-content.module.css.js +3 -0
  66. package/dist/pages/my-sonic/pages/order-details/order-details-page.d.ts +8 -0
  67. package/dist/pages/my-sonic/pages/order-details/order-details-page.js +41 -0
  68. package/dist/pages/my-sonic/pages/order-history/order-history-page.d.ts +2 -0
  69. package/dist/pages/my-sonic/pages/order-history/{order-history.js → order-history-page.js} +25 -7
  70. package/dist/pages/my-sonic/pages/order-history/order-history-page.module.css.js +3 -0
  71. package/dist/pages/my-sonic/widgets/connected-address-book-widget.js +8 -6
  72. package/dist/pages/product/product-listing-page/product-listing-page-provider/product-listing-page-context.d.ts +1 -1
  73. package/dist/shared/api/storefront/hooks/orders/use-fetch-order-by-id.d.ts +1 -0
  74. package/dist/shared/api/storefront/hooks/orders/use-fetch-order-by-id.js +14 -0
  75. package/dist/shared/api/storefront/model/storefront.model.d.ts +2 -1
  76. package/dist/shared/api/storefront/services/order-service.d.ts +3 -1
  77. package/dist/shared/api/storefront/services/order-service.js +12 -1
  78. package/dist/shared/data/order.d.ts +2 -0
  79. package/dist/shared/data/order.js +41 -0
  80. package/dist/shared/hooks/use-inert.d.ts +3 -0
  81. package/dist/shared/hooks/use-inert.js +16 -0
  82. package/dist/shared/model/address.d.ts +1 -1
  83. package/dist/shared/providers/global-state-provider.d.ts +1 -1
  84. package/dist/shared/routing/route-context.d.ts +1 -1
  85. package/dist/shared/routing/types.d.ts +1 -1
  86. package/dist/shared/routing/use-route-link-element.d.ts +1 -1
  87. package/dist/shared/routing/use-route-link.d.ts +1 -1
  88. package/dist/shared/routing/with-routing.d.ts +2 -2
  89. package/dist/sidebar/sidebar.js +4 -2
  90. package/dist/styles.css +129 -48
  91. package/dist/table/elements/table-context.d.ts +1 -1
  92. package/dist/table/elements/table-row-context.d.ts +1 -1
  93. package/dist/table/elements/types.d.ts +1 -0
  94. package/dist/text/status-text/status-text.d.ts +6 -0
  95. package/dist/text/status-text/status-text.js +8 -0
  96. package/dist/text/status-text/status-text.module.css.js +3 -0
  97. package/dist/toast/toast.d.ts +1 -1
  98. package/dist/typography/heading/heading.d.ts +2 -2
  99. package/package.json +7 -7
  100. package/dist/pages/my-sonic/pages/order-history/order-history.d.ts +0 -1
  101. package/dist/pages/my-sonic/pages/order-history/order-history.module.css.js +0 -3
@@ -0,0 +1,41 @@
1
+ "use client";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { Breadcrumb } from '../../../../breadcrumbs/breadcrumb.js';
4
+ import { useFormattedMessage } from '../../../../intl/use-formatted-message.js';
5
+ import { useFetchOrderById } from '../../../../shared/api/storefront/hooks/orders/use-fetch-order-by-id.js';
6
+ import { usePaths } from '../../../../shared/routing/use-paths.js';
7
+ import { ErrorPage } from '../../../error-page/error-page.js';
8
+ import { LoadingPage } from '../../../loading-page/loading-page.js';
9
+ import { MySonicLayoutBreadcrumb } from '../../layouts/my-sonic-layout/my-sonic-layout-breadcrumb.js';
10
+ import { MySonicLayoutPage } from '../../layouts/my-sonic-layout/my-sonic-layout-page.js';
11
+ import { OrderDetailsContent } from './order-details-content.js';
12
+
13
+ function OrderDetailsPage({ orderId, returnUrl }) {
14
+ const { data: order, error, isLoading } = useFetchOrderById(orderId);
15
+ const t = useFormattedMessage();
16
+ if (isLoading) {
17
+ return jsx(LoadingPage, {});
18
+ }
19
+ if (error) {
20
+ return jsx(ErrorPage, { error: new Error(error.message) });
21
+ }
22
+ if (!order) {
23
+ return (jsx(ErrorPage, { error: new Error(`Order with ID ${orderId} not found. Please try again later.`) }));
24
+ }
25
+ return (jsx(MySonicLayoutPage, { "data-test-selector": "order-history", title: t('Order details'), children: jsx(OrderDetailsContent, { order: order, returnUrl: returnUrl }) }));
26
+ }
27
+ function OrderDetailsPageBreadcrumb({ orderId }) {
28
+ const t = useFormattedMessage();
29
+ const paths = usePaths();
30
+ return (jsx(MySonicLayoutBreadcrumb, { children: jsx(Breadcrumb, { links: [
31
+ { href: paths.HOME, label: t('Home') },
32
+ { href: paths.MY_SONIC, label: t('My Sonic') },
33
+ { href: paths.ACCOUNT_ORDERS, label: t('Orders') },
34
+ {
35
+ href: `${paths.ACCOUNT_ORDERS}/${orderId}`,
36
+ label: t('Order details'),
37
+ },
38
+ ] }) }));
39
+ }
40
+
41
+ export { OrderDetailsPage, OrderDetailsPageBreadcrumb };
@@ -0,0 +1,2 @@
1
+ export declare function OrderHistoryPage(): import("react/jsx-runtime").JSX.Element;
2
+ export declare function OrderHistoryPageBreadcrumb(): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  "use client";
2
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { useRef, useState, useEffect } from 'react';
4
+ import { Breadcrumb } from '../../../../breadcrumbs/breadcrumb.js';
4
5
  import { Link } from '../../../../buttons/link/link.js';
5
6
  import { Price } from '../../../../display/price/price.js';
6
7
  import { Pagination } from '../../../../filters/pagination/pagination.js';
@@ -13,20 +14,24 @@ import { useIntl } from '../../../../intl/use-intl.js';
13
14
  import { DynamicLoadingOverlay } from '../../../../loading/dynamic-loading-overlay.js';
14
15
  import { useFetchOrders } from '../../../../shared/api/storefront/hooks/orders/use-fetch-orders.js';
15
16
  import { orderStatuses } from '../../../../shared/api/storefront/model/storefront.model.js';
17
+ import { usePaths } from '../../../../shared/routing/use-paths.js';
16
18
  import { scrollIntoViewRef } from '../../../../shared/utils/scrolling.js';
17
19
  import { DataTable } from '../../../../table/data-table.js';
18
20
  import { ErrorPage } from '../../../error-page/error-page.js';
19
- import styles from './order-history.module.css.js';
21
+ import { MySonicLayoutBreadcrumb } from '../../layouts/my-sonic-layout/my-sonic-layout-breadcrumb.js';
22
+ import { MySonicLayoutPage } from '../../layouts/my-sonic-layout/my-sonic-layout-page.js';
23
+ import styles from './order-history-page.module.css.js';
20
24
 
21
25
  const dateOptions = {
22
26
  day: 'numeric',
23
27
  month: 'numeric',
24
28
  year: 'numeric',
25
29
  };
26
- function OrderHistory() {
30
+ function OrderHistoryPage() {
27
31
  const t = useFormattedMessage();
28
32
  const { cultureCode } = useIntl();
29
33
  const orderHistoryRef = useRef(null);
34
+ const paths = usePaths();
30
35
  const [status, setStatus] = useState();
31
36
  const [search, setSearch] = useState('');
32
37
  const [sort, setSort] = useState({
@@ -66,7 +71,7 @@ function OrderHistory() {
66
71
  ...options,
67
72
  [status]: t(`orderStatus.${status}`),
68
73
  }), { any: t('orderStatus.Any') });
69
- return (jsx(Fragment, { children: jsxs("section", { ref: orderHistoryRef, className: styles['order-history'], "data-test-selector": "order-history", children: [jsx("div", { className: styles['search'], children: jsx(SearchField, { isDebounced: true, "data-test-selector": "order-history-search", label: t('Search orders'), onChange: searchOrders, placeholder: t('Search orders'), showLabel: false, variant: "outline" }) }), jsx("div", { className: styles['filter'], children: jsx(SelectField, { "data-test-selector": "order-history-filter", label: t('Filter order status'), onChange: filterOrders, options: filterOptions, selectedOption: status, showLabel: false }) }), jsx("div", { "aria-label": t('Results'), "aria-live": "polite", className: styles['results'], children: jsx(DynamicLoadingOverlay, { isLoading: isFetching, children: orders && orders.length > 0 ? (jsx(DataTable, { actions: [
74
+ return (jsx(MySonicLayoutPage, { "data-test-selector": "order-history", title: t('Order history'), children: jsxs("section", { ref: orderHistoryRef, className: styles['order-history'], children: [jsx("div", { className: styles['search'], children: jsx(SearchField, { isDebounced: true, "data-test-selector": "order-history-search", label: t('Search orders'), onChange: searchOrders, placeholder: t('Search orders'), showLabel: false, variant: "outline" }) }), jsx("div", { className: styles['filter'], children: jsx(SelectField, { "data-test-selector": "order-history-filter", label: t('Filter order status'), onChange: filterOrders, options: filterOptions, selectedOption: status, showLabel: false }) }), jsx("div", { "aria-label": t('Results'), "aria-live": "polite", className: styles['results'], children: jsx(DynamicLoadingOverlay, { isLoading: isFetching, children: orders && orders.length > 0 ? (jsx(DataTable, { actions: [
70
75
  {
71
76
  'data-test-selector': 'order-history-reorder',
72
77
  isPrimary: false,
@@ -87,7 +92,7 @@ function OrderHistory() {
87
92
  },
88
93
  sort: { direction: 'DESC', isEnabled: true },
89
94
  value: {
90
- render: order => (jsx(Link, { hasUnderline: true, color: "secondary", "data-test-selector": "order-history-order-link", href: `/my-sonic/order-history/${order.id}`, onClick: () => window?.alert(`open ${order.id}`), children: order.webOrderNumber })),
95
+ render: order => (jsx(Link, { hasUnderline: true, color: "secondary", "data-test-selector": "order-history-order-link", href: `${paths.ACCOUNT_ORDERS}/${order.webOrderNumber}?returnUrl=${encodeURIComponent(`${paths.ACCOUNT_ORDERS}`)}`, children: order.webOrderNumber })),
91
96
  },
92
97
  },
93
98
  {
@@ -154,7 +159,11 @@ function OrderHistory() {
154
159
  label: 'Reorder',
155
160
  },
156
161
  key: 'reorder',
157
- props: { align: 'center', nowrap: true },
162
+ props: {
163
+ align: 'center',
164
+ 'data-test-selector': 'reorderButton',
165
+ nowrap: true,
166
+ },
158
167
  value: { action: 'reorder' },
159
168
  },
160
169
  ], data: orders, onSort: (key, direction) => {
@@ -168,5 +177,14 @@ function OrderHistory() {
168
177
  'data-test-selector': (order, _) => `order-${order.id}`,
169
178
  } })) : (!isFetching && (jsx("p", { className: styles['no-results'], children: t('No orders found.') }))) }) }), orders && orders.length > 0 && (jsx("nav", { className: styles['paging'], children: jsx(Pagination, { currentPage: pagination?.currentPage || 1, "data-test-selector": "order-history-pagination", onChange: page => setPage(page), totalPages: pagination?.numberOfPages || 1 }) })), jsx("div", { className: styles['sticky-bar'], role: "presentation" })] }) }));
170
179
  }
180
+ function OrderHistoryPageBreadcrumb() {
181
+ const t = useFormattedMessage();
182
+ const paths = usePaths();
183
+ return (jsx(MySonicLayoutBreadcrumb, { children: jsx(Breadcrumb, { links: [
184
+ { href: paths.HOME, label: t('Home') },
185
+ { href: paths.MY_SONIC, label: t('My Sonic') },
186
+ { href: paths.ACCOUNT_ORDERS, label: t('Orders') },
187
+ ] }) }));
188
+ }
171
189
 
172
- export { OrderHistory };
190
+ export { OrderHistoryPage, OrderHistoryPageBreadcrumb };
@@ -0,0 +1,3 @@
1
+ var styles = {"order-history":"order-history-page-module-A-YGB","search":"order-history-page-module-A-oqW","filter":"order-history-page-module--fnE1","results":"order-history-page-module-Gp4CJ","no-results":"order-history-page-module-ulch1","paging":"order-history-page-module-D35yK","sticky-bar":"order-history-page-module-xgntY"};
2
+
3
+ export { styles as default };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx } from 'react/jsx-runtime';
3
- import { useState, useRef, useEffect } from 'react';
3
+ import { useState, useRef } from 'react';
4
4
  import { Button } from '../../../buttons/button/button.js';
5
5
  import { TableCard } from '../../../cards/table-card/table-card.js';
6
6
  import { Pagination } from '../../../filters/pagination/pagination.js';
@@ -39,20 +39,21 @@ function ConnectedAddressBookWidget() {
39
39
  pagination: {},
40
40
  shipTos: [],
41
41
  };
42
- useEffect(() => {
43
- scrollIntoViewRef(addressBookRef);
44
- }, [page]);
45
42
  const searchAddresses = (value) => {
46
43
  if (value.length >= 3 || value.length === 0) {
47
44
  setPage(1);
48
45
  setSearch(value);
46
+ scrollIntoViewRef(addressBookRef);
49
47
  }
50
48
  };
51
- return (jsx(TableCard, { stickyHeader: true, actions: [
49
+ return (jsx(TableCard, { ref: addressBookRef, stickyHeader: true, actions: [
52
50
  jsx(SearchField, { isDebounced: true, className: styles['search-field'], "data-test-selector": "address-book-search", label: t('Search'), onChange: searchAddresses, placeholder: t('Search'), showLabel: false, size: "md", variant: "outline" }, "searchAddresses"),
53
51
  jsx(Button, { color: "secondary", "data-test-selector": "address-book-add-address", href: `${paths.ACCOUNT_EDIT_BILL_TO_ADDRESS}/current${paths.ACCOUNT_EDIT_SHIP_TO_ADDRESS}/new?returnUrl=${encodeURIComponent(`${href}#${addressBookId}`)}`, size: "sm", variant: "outline", children: t('Add address') }, "addAddress"),
54
52
  ], className: styles['address-book-widget'], "data-test-selector": "address-book", id: addressBookId, isLoading: isFetching, paging: addresses &&
55
- addresses.length > 0 && (jsx("nav", { className: styles['paging'], children: jsx(Pagination, { currentPage: pagination?.currentPage || 1, onChange: page => setPage(page), totalPages: pagination?.numberOfPages || 1 }) })), results: addresses ? addresses.length : 0, showError: error, title: "Address book", children: jsx("div", { ref: addressBookRef, "aria-label": "Results", "aria-live": "polite", className: styles['results'], children: jsx(DynamicLoadingOverlay, { isLoading: isFetching, children: jsx(DataTable, { actions: [
53
+ addresses.length > 0 && (jsx("nav", { className: styles['paging'], children: jsx(Pagination, { currentPage: pagination?.currentPage || 1, onChange: page => {
54
+ setPage(page);
55
+ scrollIntoViewRef(addressBookRef);
56
+ }, totalPages: pagination?.numberOfPages || 1 }) })), results: addresses ? addresses.length : 0, showError: error, title: "Address book", children: jsx("div", { "aria-label": "Results", "aria-live": "polite", className: styles['results'], children: jsx(DynamicLoadingOverlay, { isLoading: isFetching, children: jsx(DataTable, { actions: [
56
57
  {
57
58
  'data-test-selector': 'edit-address',
58
59
  href: address => `${paths.ACCOUNT_EDIT_BILL_TO_ADDRESS}/current${paths.ACCOUNT_EDIT_SHIP_TO_ADDRESS}/${address.id}?returnUrl=${encodeURIComponent(`${href}#${addressBookId}`)}`,
@@ -163,6 +164,7 @@ function ConnectedAddressBookWidget() {
163
164
  name: key,
164
165
  order: direction,
165
166
  });
167
+ scrollIntoViewRef(addressBookRef);
166
168
  }, row: {
167
169
  'data-test-selector': (address, _) => `address-${address.id}`,
168
170
  selected: (address, _) => address.isDefault,
@@ -5,4 +5,4 @@ export interface ProductListingPageContextType {
5
5
  isError?: boolean;
6
6
  isLoading?: boolean;
7
7
  }
8
- export declare const ProductListingPageContext: import("react").Context<ProductListingPageContextType>;
8
+ export declare const ProductListingPageContext: React.Context<ProductListingPageContextType>;
@@ -0,0 +1 @@
1
+ export declare function useFetchOrderById(id: string): import("@tanstack/react-query").UseQueryResult<import("../../model/storefront.model").OrderModel, Error>;
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { useQuery } from '@tanstack/react-query';
3
+ import { fetchOrderById } from '../../services/order-service.js';
4
+
5
+ function useFetchOrderById(id) {
6
+ return useQuery({
7
+ enabled: Boolean(id),
8
+ placeholderData: prev => prev,
9
+ queryFn: () => fetchOrderById(id),
10
+ queryKey: ['order', id],
11
+ });
12
+ }
13
+
14
+ export { useFetchOrderById };
@@ -1,4 +1,5 @@
1
1
  import { JSX } from 'react';
2
+ import { CurrencyCode } from '../../../../intl/types';
2
3
  export interface BaseModel {
3
4
  properties: {
4
5
  [key: string]: string;
@@ -2219,7 +2220,7 @@ export interface OrderModel extends BaseModel {
2219
2220
  btCountry: string;
2220
2221
  canAddAllToCart: boolean;
2221
2222
  canAddToCart: boolean;
2222
- currencyCode: string;
2223
+ currencyCode: CurrencyCode;
2223
2224
  currencySymbol: string;
2224
2225
  customerNumber: string;
2225
2226
  customerPO: string;
@@ -1,4 +1,4 @@
1
- import { OrderCollectionModel, OrderStatus, SortOption } from '../model/storefront.model';
1
+ import { OrderCollectionModel, OrderModel, OrderStatus, SortOption } from '../model/storefront.model';
2
2
  export declare function fetchOrders({ page, pageSize, search, sort, status, }?: {
3
3
  page?: number;
4
4
  pageSize?: number;
@@ -6,3 +6,5 @@ export declare function fetchOrders({ page, pageSize, search, sort, status, }?:
6
6
  sort?: SortOption;
7
7
  status?: OrderStatus;
8
8
  }): Promise<OrderCollectionModel>;
9
+ export type ExpansionType = 'orderLines' | 'shipments' | 'vmidetails';
10
+ export declare function fetchOrderById(id: string, expand?: ExpansionType[]): Promise<OrderModel>;
@@ -25,5 +25,16 @@ async function fetchOrders({ page = 1, pageSize = 20, search, sort, status, } =
25
25
  body.orders?.forEach(order => (order.status = fromApiStatusToOrderStatus(order.status)));
26
26
  return body;
27
27
  }
28
+ async function fetchOrderById(id, expand = ['orderLines', 'shipments']) {
29
+ const { body } = await request({
30
+ credentials: 'include',
31
+ params: {
32
+ expand,
33
+ },
34
+ url: `${config.SHOP_API_URL}/api/v1/orders/${id}`,
35
+ });
36
+ body.status = fromApiStatusToOrderStatus(body.status);
37
+ return body;
38
+ }
28
39
 
29
- export { fetchOrders };
40
+ export { fetchOrderById, fetchOrders };
@@ -0,0 +1,2 @@
1
+ import { OrderModel } from '../api/storefront/model/storefront.model';
2
+ export declare const orderModel: OrderModel;
@@ -0,0 +1,41 @@
1
+ const orderModel = {
2
+ billToCity: 'Basel',
3
+ billToPostalCode: '4051',
4
+ btAddress1: '1 St. Alban-Graben',
5
+ btAddress2: '',
6
+ btAddress3: '',
7
+ btCompanyName: 'TestIt CYPRESSDIDIT StableCHFR',
8
+ btCountry: 'Switzerland',
9
+ currencyCode: 'CHF',
10
+ customerNumber: 'C002733',
11
+ id: 'bedcd4dd-cc40-4a96-aef9-b3440054ae76',
12
+ orderDate: new Date('2025-08-24T00:00:00'),
13
+ orderLines: [
14
+ {
15
+ altText: 'TEST Slotted screwdriver 10mm',
16
+ customerProductNumber: '',
17
+ id: '7199e7c5-a248-44a2-ad37-b3440054ae78',
18
+ lineTotal: 5000,
19
+ mediumImagePath: 'https://images.sonic-equipment.com/TEST13110/test-slotted-screwdriver-10mm_BaseProductImage_13355-002.webp',
20
+ productId: 'd9d13b6a-85c6-488d-8837-b259017ef5ab',
21
+ productUri: '/Product/TEST13110-Slotted-screwdriver-10mm',
22
+ qtyOrdered: 10,
23
+ shortDescription: 'TEST Slotted screwdriver 10mm',
24
+ unitPrice: 500,
25
+ },
26
+ ],
27
+ orderSubTotal: 5000,
28
+ orderTotal: 5405,
29
+ shipToCity: 'Basel',
30
+ shipToPostalCode: '4051',
31
+ shippingAndHandling: 0,
32
+ stAddress1: '1 St. Alban-Graben',
33
+ stAddress2: '',
34
+ stAddress3: '',
35
+ stCompanyName: 'TestIt CYPRESSDIDIT StableCHFR',
36
+ stCountry: 'Switzerland',
37
+ status: 'ForwardToReseller',
38
+ taxAmount: 405,
39
+ };
40
+
41
+ export { orderModel };
@@ -0,0 +1,3 @@
1
+ export declare const useInert: <T extends HTMLElement>(isEnabled: boolean | undefined | null) => {
2
+ ref: React.MutableRefObject<T | null>;
3
+ };
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { useRef, useEffect } from 'react';
3
+
4
+ // TODO: when moving to React 19, we should simply set the inert attribute on the element (boolean value)
5
+ const useInert = (isEnabled) => {
6
+ const ref = useRef(null);
7
+ useEffect(() => {
8
+ if (isEnabled)
9
+ ref.current?.removeAttribute('inert');
10
+ else
11
+ ref.current?.setAttribute('inert', '');
12
+ }, [isEnabled]);
13
+ return { ref };
14
+ };
15
+
16
+ export { useInert };
@@ -18,7 +18,7 @@ export interface Address {
18
18
  attention: string;
19
19
  city: string;
20
20
  companyName: string;
21
- country: AddressCountry | null | undefined;
21
+ country: AddressCountry | null | undefined | string;
22
22
  email: string;
23
23
  firstName: string;
24
24
  lastName: string;
@@ -15,7 +15,7 @@ declare class GlobalState {
15
15
  get<T>(key: string | symbol, initialState: T | undefined): State<T>;
16
16
  set<T>(key: string | symbol, state: State<T>): void;
17
17
  }
18
- export declare const GlobalStateProviderContext: import("react").Context<GlobalState>;
18
+ export declare const GlobalStateProviderContext: React.Context<GlobalState>;
19
19
  interface GlobalStateProviderProps {
20
20
  children: ReactNode;
21
21
  }
@@ -1,2 +1,2 @@
1
1
  import { RouteContextValue } from './types';
2
- export declare const RouteContext: import("react").Context<RouteContextValue | undefined>;
2
+ export declare const RouteContext: React.Context<RouteContextValue | undefined>;
@@ -8,12 +8,12 @@ export interface Paths {
8
8
  ACCOUNT_INVOICES: string;
9
9
  ACCOUNT_MY_LISTS: string;
10
10
  ACCOUNT_ORDERS: string;
11
- ACCOUNT_SETTINGS: string;
12
11
  CART: string;
13
12
  CHECKOUT_SHIPPING: string;
14
13
  CHECKOUT_SHIPPING_VIA_SIGNIN: string;
15
14
  FAVORITES: string;
16
15
  HOME: string;
16
+ MY_SONIC: string;
17
17
  ORDER_CONFIRMATION: string;
18
18
  REVIEW_AND_SUBMIT: string;
19
19
  SIGN_IN: string;
@@ -1 +1 @@
1
- export declare function useRouteLinkElement(): import("react").ElementType<import("./types").RouteLinkElementProps>;
1
+ export declare function useRouteLinkElement(): React.ElementType<import("./types").RouteLinkElementProps>;
@@ -1,6 +1,6 @@
1
1
  import { NavigateOptions } from './types';
2
2
  export declare function useRouteLink(): {
3
- RouteLinkElement: import("react").ElementType<import("./types").RouteLinkElementProps>;
3
+ RouteLinkElement: React.ElementType<import("./types").RouteLinkElementProps>;
4
4
  getRouteLinkProps: (href: string, route?: NavigateOptions) => {
5
5
  href: string;
6
6
  onNavigate: () => void;
@@ -4,5 +4,5 @@ export interface WithRoutingProps {
4
4
  href?: string;
5
5
  route?: NavigateOptions;
6
6
  }
7
- export declare function withRouting(component: ElementType<RouteLinkElementProps>): import("react").FunctionComponent<RouteLinkElementProps>;
8
- export declare const FallbackRouteLink: import("react").FunctionComponent<RouteLinkElementProps>;
7
+ export declare function withRouting(component: ElementType<RouteLinkElementProps>): React.FunctionComponent<RouteLinkElementProps>;
8
+ export declare const FallbackRouteLink: React.FunctionComponent<RouteLinkElementProps>;
@@ -3,18 +3,20 @@ import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import clsx from 'clsx';
4
4
  import { IconButton } from '../buttons/icon-button/icon-button.js';
5
5
  import { StrokeCloseboxIcon } from '../icons/stroke/stroke-closebox-icon.js';
6
+ import { useInert } from '../shared/hooks/use-inert.js';
6
7
  import { useSidebar } from './use-sidebar.js';
7
8
  import styles from './sidebar.module.css.js';
8
9
 
9
10
  function Sidebar({ children, className }) {
10
11
  const { isDocked, isOpen, toggle, transition } = useSidebar();
11
- return (jsxs("aside", { "aria-hidden": !isOpen, className: clsx(styles.sidebar, {
12
+ const { ref: sidebarRef } = useInert(isOpen);
13
+ return (jsxs("aside", { ref: sidebarRef, "aria-hidden": !isOpen.toString(), className: clsx(styles.sidebar, {
12
14
  [styles['transition']]: transition,
13
15
  [styles['is-open']]: isOpen,
14
16
  [styles['is-closed']]: !isOpen,
15
17
  [styles['is-docked']]: isDocked,
16
18
  [styles['is-not-docked']]: !isDocked,
17
- }, className), inert: isOpen ? undefined : true, children: [jsx(IconButton, { className: styles.close, color: "secondary", onClick: toggle, children: jsx(StrokeCloseboxIcon, {}) }), jsx("div", { className: styles['content'], children: children })] }));
19
+ }, className), children: [jsx(IconButton, { className: styles.close, color: "secondary", onClick: toggle, children: jsx(StrokeCloseboxIcon, {}) }), jsx("div", { className: styles['content'], children: children })] }));
18
20
  }
19
21
 
20
22
  export { Sidebar };