@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.
- package/dist/address-info-display/address-info-display.js +1 -1
- package/dist/algolia/algolia-insights-provider.d.ts +1 -1
- package/dist/buttons/button/button.d.ts +1 -1
- package/dist/buttons/link/link.d.ts +1 -1
- package/dist/buttons/print-button/print-button.d.ts +2 -1
- package/dist/buttons/print-button/print-button.js +2 -2
- package/dist/cards/product-card/product-card.js +1 -1
- package/dist/cards/table-card/table-card.d.ts +1 -1
- package/dist/cards/table-card/table-card.js +5 -3
- package/dist/carousel/carousel-navigation-button.d.ts +1 -1
- package/dist/cart-totals/cart-totals.js +1 -1
- package/dist/collapsables/accordion/accordion-item.js +3 -1
- package/dist/collapsables/cascading-component/cascading-component-container-context.d.ts +1 -1
- package/dist/collapsables/show-all/show-all.js +4 -2
- package/dist/collapsables/unmounter/unmounter.d.ts +1 -1
- package/dist/cookies/cookie-context.d.ts +1 -1
- package/dist/country-select/country-select.js +3 -1
- package/dist/country-selector/country-selector-trigger/country-selector-trigger.js +3 -1
- package/dist/exports.d.ts +13 -1
- package/dist/filters/active-filters/active-filters.js +1 -1
- package/dist/forms/elements/field-error/field-error.js +3 -1
- package/dist/forms/fields/number-field/number-field.d.ts +1 -1
- package/dist/forms/partials/address-form/address-form.js +6 -2
- package/dist/header/buttons/account/connected-account-button.js +1 -1
- package/dist/index.js +15 -3
- package/dist/intl/formatted-message.d.ts +3 -2
- package/dist/intl/formatted-message.js +25 -5
- package/dist/intl/intl-context.d.ts +1 -1
- package/dist/intl/intl-context.js +1 -10
- package/dist/intl/translation-id.d.ts +1 -1
- package/dist/intl/types.d.ts +27 -15
- package/dist/intl/types.js +7 -1
- package/dist/intl/use-formatted-message.d.ts +2 -2
- package/dist/intl/use-formatted-message.js +5 -5
- package/dist/intl/use-intl.js +4 -1
- package/dist/intl/utils.js +1 -1
- package/dist/lists/menu-list/menu-list-provider.d.ts +1 -1
- package/dist/modals/confirmation/confirmation-dialog.d.ts +3 -2
- package/dist/modals/dialog/dialog.js +1 -1
- package/dist/notifications/announcements/announcement.d.ts +1 -1
- package/dist/observers/intersection-observer.js +1 -1
- package/dist/pages/my-sonic/actions/change-password/change-password.js +1 -1
- package/dist/pages/my-sonic/actions/edit-bill-to-address/connected-edit-bill-to-address-form.js +1 -1
- package/dist/pages/my-sonic/actions/edit-ship-to-address/connected-edit-ship-to-address-form.js +1 -1
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-breadcrumb.d.ts +4 -0
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-breadcrumb.js +9 -0
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout.module.css.js +1 -1
- package/dist/pages/my-sonic/navigation/connected-my-sonic-navigation.js +2 -2
- package/dist/pages/my-sonic/navigation/my-sonic-desktop-navigation.js +3 -1
- package/dist/pages/my-sonic/navigation/my-sonic-mobile-navigation.js +4 -2
- package/dist/pages/my-sonic/navigation/my-sonic-navigation-items.d.ts +1 -1
- package/dist/pages/my-sonic/navigation/my-sonic-navigation-items.js +3 -3
- package/dist/pages/my-sonic/pages/create-ship-to-address-details-page/create-ship-to-address-details-page.d.ts +7 -0
- package/dist/pages/my-sonic/pages/create-ship-to-address-details-page/create-ship-to-address-details-page.js +29 -0
- package/dist/pages/my-sonic/pages/edit-bill-to-address-details-page/edit-bill-to-address-details-page.d.ts +7 -0
- package/dist/pages/my-sonic/pages/edit-bill-to-address-details-page/edit-bill-to-address-details-page.js +29 -0
- package/dist/pages/my-sonic/pages/edit-ship-to-address-details-page/edit-ship-to-address-details-page.d.ts +9 -0
- package/dist/pages/my-sonic/pages/edit-ship-to-address-details-page/edit-ship-to-address-details-page.js +29 -0
- package/dist/pages/my-sonic/pages/favorites/favorites-page.d.ts +2 -0
- package/dist/pages/my-sonic/pages/favorites/favorites-page.js +23 -0
- package/dist/pages/my-sonic/pages/my-account/my-account-page.d.ts +2 -0
- package/dist/pages/my-sonic/pages/my-account/my-account-page.js +30 -0
- package/dist/pages/my-sonic/pages/order-details/order-details-content.d.ts +8 -0
- package/dist/pages/my-sonic/pages/order-details/order-details-content.js +69 -0
- package/dist/pages/my-sonic/pages/order-details/order-details-content.module.css.js +3 -0
- package/dist/pages/my-sonic/pages/order-details/order-details-page.d.ts +8 -0
- package/dist/pages/my-sonic/pages/order-details/order-details-page.js +41 -0
- package/dist/pages/my-sonic/pages/order-history/order-history-page.d.ts +2 -0
- package/dist/pages/my-sonic/pages/order-history/{order-history.js → order-history-page.js} +25 -7
- package/dist/pages/my-sonic/pages/order-history/order-history-page.module.css.js +3 -0
- package/dist/pages/my-sonic/widgets/connected-address-book-widget.js +8 -6
- package/dist/pages/product/product-listing-page/product-listing-page-provider/product-listing-page-context.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/orders/use-fetch-order-by-id.d.ts +1 -0
- package/dist/shared/api/storefront/hooks/orders/use-fetch-order-by-id.js +14 -0
- package/dist/shared/api/storefront/model/storefront.model.d.ts +2 -1
- package/dist/shared/api/storefront/services/order-service.d.ts +3 -1
- package/dist/shared/api/storefront/services/order-service.js +12 -1
- package/dist/shared/data/order.d.ts +2 -0
- package/dist/shared/data/order.js +41 -0
- package/dist/shared/hooks/use-inert.d.ts +3 -0
- package/dist/shared/hooks/use-inert.js +16 -0
- package/dist/shared/model/address.d.ts +1 -1
- package/dist/shared/providers/global-state-provider.d.ts +1 -1
- package/dist/shared/routing/route-context.d.ts +1 -1
- package/dist/shared/routing/types.d.ts +1 -1
- package/dist/shared/routing/use-route-link-element.d.ts +1 -1
- package/dist/shared/routing/use-route-link.d.ts +1 -1
- package/dist/shared/routing/with-routing.d.ts +2 -2
- package/dist/sidebar/sidebar.js +4 -2
- package/dist/styles.css +129 -48
- package/dist/table/elements/table-context.d.ts +1 -1
- package/dist/table/elements/table-row-context.d.ts +1 -1
- package/dist/table/elements/types.d.ts +1 -0
- package/dist/text/status-text/status-text.d.ts +6 -0
- package/dist/text/status-text/status-text.js +8 -0
- package/dist/text/status-text/status-text.module.css.js +3 -0
- package/dist/toast/toast.d.ts +1 -1
- package/dist/typography/heading/heading.d.ts +2 -2
- package/package.json +7 -7
- package/dist/pages/my-sonic/pages/order-history/order-history.d.ts +0 -1
- 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 };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx,
|
|
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
|
|
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
|
|
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(
|
|
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:
|
|
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: {
|
|
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 {
|
|
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
|
|
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 =>
|
|
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:
|
|
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:
|
|
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,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,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 };
|
|
@@ -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:
|
|
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:
|
|
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():
|
|
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:
|
|
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>):
|
|
8
|
-
export declare const FallbackRouteLink:
|
|
7
|
+
export declare function withRouting(component: ElementType<RouteLinkElementProps>): React.FunctionComponent<RouteLinkElementProps>;
|
|
8
|
+
export declare const FallbackRouteLink: React.FunctionComponent<RouteLinkElementProps>;
|
package/dist/sidebar/sidebar.js
CHANGED
|
@@ -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
|
-
|
|
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),
|
|
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 };
|