@evenicanpm/storefront-core 2.4.1 → 2.5.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/CHANGELOG.md +16 -0
- package/package.json +1 -1
- package/src/api-manager/datasources/d365/d365-cart.datasource.ts +4 -3
- package/src/api-manager/datasources/d365/d365-user.datasource.ts +3 -3
- package/src/api-manager/datasources/d365/utils/get-context-cookie.ts +1 -0
- package/src/api-manager/datasources/e4/address/e4-address.datasource.ts +5 -14
- package/src/api-manager/datasources/e4/address/e4-address.translator.ts +4 -3
- package/src/api-manager/datasources/e4/categories/e4-categories.translator.ts +1 -1
- package/src/api-manager/datasources/e4/graphqlRequestSdk.ts +29 -3
- package/src/api-manager/datasources/e4/product/e4-product.translator.ts +1 -1
- package/src/api-manager/index.ts +1 -1
- package/src/api-manager/lib/get-graphql-client.ts +1 -1
- package/src/api-manager/services/cart/mutations/add-discount-code.ts +0 -11
- package/src/api-manager/services/create-query.ts +13 -7
- package/src/api-manager/services/user/mutations/add-to-wishlist.ts +1 -1
- package/src/api-manager/services/user/mutations/remove-from-wishlist.ts +1 -1
- package/src/auth/AUTH GUIDE.md +880 -0
- package/src/cms/blocks/components/featured-categories.tsx +18 -15
- package/src/cms/blocks/components/featured-products.tsx +3 -2
- package/src/cms/blocks/components/footer/sections/footer-contact.tsx +0 -2
- package/src/cms/blocks/components/footer/sections/footer-logo.tsx +2 -1
- package/src/components/SearchInput.stories.tsx +12 -10
- package/src/components/base-layout.tsx +42 -0
- package/src/components/categories/category-list/category-list.tsx +32 -12
- package/src/components/header/__tests__/header.test.tsx +0 -24
- package/src/components/header/components/mobile-header.tsx +16 -8
- package/src/components/header/header.tsx +6 -3
- package/src/components/mini-cart/components/bottom-actions.tsx +7 -2
- package/src/components/mini-cart/components/cart-item.tsx +16 -13
- package/src/components/mini-cart/components/empty-view.tsx +12 -6
- package/src/components/mini-cart/components/top-header.tsx +9 -8
- package/src/components/mini-cart/mini-cart-trigger.tsx +11 -5
- package/src/components/mini-cart/mini-cart.tsx +30 -15
- package/src/components/mobile-navigation/mobile-navigation-bar.tsx +6 -2
- package/src/components/navbar/categories.tsx +8 -2
- package/src/components/navbar/category-based-menu/category-based-menu.tsx +6 -2
- package/src/components/navbar/mega-menu/mega-menu.tsx +22 -14
- package/src/components/navbar/mobile-menu/mobile-menu.test.tsx +8 -11
- package/src/components/navbar/mobile-menu/mobile-menu.tsx +13 -11
- package/src/components/navbar/nav-list/nav-list.tsx +3 -2
- package/src/components/navbar/navbar.tsx +4 -2
- package/src/components/product-cards/product-card/product-card.tsx +50 -26
- package/src/components/product-cards/product-card-plp/product-card.tsx +37 -16
- package/src/components/product-cards/product-card-plp-list/product-card.tsx +38 -16
- package/src/components/product-cards/product-card-search/product-card.tsx +34 -13
- package/src/components/product-dialog/ProductDialog.stories.tsx +20 -18
- package/src/components/product-dialog/compound/product-dialog.tsx +7 -4
- package/src/components/product-dimensions/compound/dimensions-group.tsx +4 -2
- package/src/components/product-dimensions/compound/dimensions.tsx +15 -6
- package/src/components/product-quantity-buttons/compound/quantity-buttons-root.tsx +21 -13
- package/src/components/products-view/compound/products-grid-view.tsx +11 -4
- package/src/components/products-view/compound/products-list-view.tsx +11 -4
- package/src/components/search-bar/compound/search-bar-root.tsx +6 -4
- package/src/components/search-bar/compound/textfield-adornment-category.tsx +25 -8
- package/src/components/search-bar/hooks/use-click-outside.ts +7 -1
- package/src/components/search-bar/hooks/use-search.ts +3 -3
- package/src/components/user/index.ts +3 -0
- package/src/components/user/use-user-auth.ts +163 -0
- package/src/components/user/user.tsx +215 -0
- package/src/components/wishlist-dialogs/add-to-wishlist/AddToWishlist.stories.tsx +20 -15
- package/src/components/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-dialog.tsx +11 -8
- package/src/components/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-list.tsx +18 -3
- package/src/components/wishlist-dialogs/add-to-wishlist/index.tsx +0 -1
- package/src/components/wishlist-dialogs/create-wishlist/compound/create-wishlist-dialog.tsx +6 -2
- package/src/hooks/use-overflow-detect.ts +4 -4
- package/src/lib/page-slugs.ts +16 -0
- package/src/pages/account/account-navigation.tsx +7 -14
- package/src/pages/account/account-routes.ts +4 -9
- package/src/pages/account/addresses/address-form.tsx +38 -16
- package/src/pages/account/addresses/address-item.tsx +18 -8
- package/src/pages/account/dashboard-header.tsx +20 -13
- package/src/pages/account/orders/order-history-filters-panel.tsx +21 -20
- package/src/pages/account/orders/order-history-header.tsx +14 -4
- package/src/pages/account/orders/order-history-root.tsx +3 -1
- package/src/pages/account/orders/order-history-row.tsx +12 -4
- package/src/pages/account/orders/order-history-search-and-filter.tsx +88 -59
- package/src/pages/account/orders/order-history-search-dropdown.tsx +26 -9
- package/src/pages/account/orders/order-history-sort.tsx +3 -1
- package/src/pages/account/orders/order-history-table.tsx +27 -5
- package/src/pages/account/orders/order-progress.tsx +12 -6
- package/src/pages/account/orders/order-row.tsx +18 -6
- package/src/pages/account/orders/order-summary.tsx +24 -8
- package/src/pages/account/orders/ordered-products.tsx +15 -5
- package/src/pages/account/profile/user-info.tsx +11 -3
- package/src/pages/account/table-row-skeleton.tsx +1 -1
- package/src/pages/account/wishlist/create-new-list.tsx +33 -9
- package/src/pages/account/wishlist/wishlist-item.tsx +18 -6
- package/src/pages/cart/cart-item.tsx +21 -7
- package/src/pages/cart/checkout-form.tsx +55 -22
- package/src/pages/cart/coupon-entry.tsx +143 -36
- package/src/pages/cart/estimate-shipping.tsx +45 -21
- package/src/pages/checkout/checkout-alt-form/checkout-form.tsx +22 -14
- package/src/pages/checkout/checkout-alt-form/checkout-step.tsx +37 -16
- package/src/pages/checkout/checkout-alt-form/steps/address/address-card.tsx +9 -3
- package/src/pages/checkout/checkout-alt-form/steps/address/delivery-address.tsx +84 -51
- package/src/pages/checkout/checkout-alt-form/steps/address/new-address-form.tsx +41 -19
- package/src/pages/checkout/checkout-alt-form/steps/customer-info/customer-information.tsx +17 -10
- package/src/pages/checkout/checkout-alt-form/steps/payment/payment-details.tsx +15 -6
- package/src/pages/checkout/checkout-alt-form/steps/shipping/delivery-options.tsx +6 -2
- package/src/pages/checkout/checkout-alt-summary/cart-item.tsx +12 -4
- package/src/pages/checkout/checkout-alt-summary/checkout-alt-summary.tsx +12 -5
- package/src/pages/checkout/checkout-alt-summary/list-item.tsx +17 -10
- package/src/pages/confirmation/address.tsx +6 -2
- package/src/pages/confirmation/confirmation-summary.tsx +12 -4
- package/src/pages/confirmation/ordered-products.tsx +12 -4
- package/src/pages/product-details/bopis/store-card/shop-card.tsx +2 -2
- package/src/pages/product-details/bopis/store-card/utils/getDaysResources.ts +1 -1
- package/src/pages/product-details/product-intro/compound/product-info.tsx +41 -18
- package/src/pages/product-details/product-intro/compound/product-intro-images.tsx +18 -12
- package/src/pages/product-details/product-intro/compound/product-intro.tsx +20 -10
- package/src/pages/product-details/product-intro/compound/thumbnail-with-skeleton.tsx +1 -1
- package/src/pages/product-details/product-tabs.tsx +20 -12
- package/src/pages/product-list/product-list-view.tsx +4 -2
- package/src/pages/product-list/search-bar.tsx +7 -7
- package/src/pages/product-list/side-nav.tsx +5 -3
- package/src/pages/quickorder/order-upload.tsx +1 -1
- package/src/pages/quickorder/provider.tsx +26 -14
- package/src/pages/quickorder/quick-order.tsx +49 -22
- package/src/providers/nav-provider/index.tsx +16 -11
- package/tsconfig.json +0 -5
- package/src/components/header/components/user.tsx +0 -322
- /package/src/components/{header → user}/__tests__/user.test.tsx +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Image from "next/image";
|
|
2
2
|
|
|
3
3
|
const shimmer = `<svg width="50" height="50" xmlns="http://www.w3.org/2000/svg"><rect width="50" height="50" fill="#f0f0f0"/></svg>`;
|
|
4
|
-
const blurDataURL = `data:image/svg+xml;base64,${
|
|
4
|
+
const blurDataURL = `data:image/svg+xml;base64,${globalThis.window === undefined ? Buffer.from(shimmer).toString("base64") : btoa(shimmer)}`;
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Product thumbnail image
|
|
@@ -8,7 +8,7 @@ import styled from "@mui/material/styles/styled";
|
|
|
8
8
|
import Tab from "@mui/material/Tab";
|
|
9
9
|
import Tabs from "@mui/material/Tabs";
|
|
10
10
|
import type React from "react";
|
|
11
|
-
import { createContext, useContext, useState } from "react";
|
|
11
|
+
import { createContext, useContext, useMemo, useState } from "react";
|
|
12
12
|
|
|
13
13
|
// STYLED COMPONENT
|
|
14
14
|
const StyledTabs = styled(Tabs)(({ theme }) => ({
|
|
@@ -65,16 +65,18 @@ export default function ProductTabs({
|
|
|
65
65
|
const [selectedOption, setSelectedOption] = useState(0);
|
|
66
66
|
const handleOptionClick = (_: React.SyntheticEvent, value: number) =>
|
|
67
67
|
setSelectedOption(value);
|
|
68
|
+
const contextValue = useMemo(
|
|
69
|
+
() => ({
|
|
70
|
+
selectedOption,
|
|
71
|
+
handleOptionClick,
|
|
72
|
+
productAttributes,
|
|
73
|
+
productDescription,
|
|
74
|
+
}),
|
|
75
|
+
[selectedOption, handleOptionClick, productAttributes, productDescription],
|
|
76
|
+
);
|
|
68
77
|
|
|
69
78
|
return (
|
|
70
|
-
<TabsContext.Provider
|
|
71
|
-
value={{
|
|
72
|
-
selectedOption,
|
|
73
|
-
handleOptionClick,
|
|
74
|
-
productAttributes,
|
|
75
|
-
productDescription,
|
|
76
|
-
}}
|
|
77
|
-
>
|
|
79
|
+
<TabsContext.Provider value={contextValue}>
|
|
78
80
|
<Box mb={6}>{children}</Box>
|
|
79
81
|
</TabsContext.Provider>
|
|
80
82
|
);
|
|
@@ -83,7 +85,7 @@ export default function ProductTabs({
|
|
|
83
85
|
/**
|
|
84
86
|
* @category Sub-Component
|
|
85
87
|
*/
|
|
86
|
-
|
|
88
|
+
const ProductTabsTabs = ({ children }: { children: React.ReactNode }) => {
|
|
87
89
|
const ctx = useContext(TabsContext);
|
|
88
90
|
if (!ctx)
|
|
89
91
|
throw new Error(
|
|
@@ -102,6 +104,8 @@ ProductTabs.Tabs = ({ children }: { children: React.ReactNode }) => {
|
|
|
102
104
|
);
|
|
103
105
|
};
|
|
104
106
|
|
|
107
|
+
ProductTabs.Tabs = ProductTabsTabs;
|
|
108
|
+
|
|
105
109
|
/**
|
|
106
110
|
* @category Sub-Component
|
|
107
111
|
*/
|
|
@@ -112,7 +116,7 @@ ProductTabs.Option = (props: { label: string; value: number }) => {
|
|
|
112
116
|
/**
|
|
113
117
|
* @category Sub-Component
|
|
114
118
|
*/
|
|
115
|
-
|
|
119
|
+
const ProductTabsContent = ({
|
|
116
120
|
index,
|
|
117
121
|
children,
|
|
118
122
|
}: {
|
|
@@ -132,10 +136,12 @@ ProductTabs.Content = ({
|
|
|
132
136
|
);
|
|
133
137
|
};
|
|
134
138
|
|
|
139
|
+
ProductTabs.Content = ProductTabsContent;
|
|
140
|
+
|
|
135
141
|
/**
|
|
136
142
|
* @category Sub-Component
|
|
137
143
|
*/
|
|
138
|
-
|
|
144
|
+
const ProductTabsDescription = () => {
|
|
139
145
|
const ctx = useContext(TabsContext);
|
|
140
146
|
if (!ctx)
|
|
141
147
|
throw new Error(
|
|
@@ -149,3 +155,5 @@ ProductTabs.Description = () => {
|
|
|
149
155
|
/>
|
|
150
156
|
);
|
|
151
157
|
};
|
|
158
|
+
|
|
159
|
+
ProductTabs.Description = ProductTabsDescription;
|
|
@@ -19,7 +19,7 @@ import type { ProductSearchResult } from "@msdyn365-commerce/retail-proxy";
|
|
|
19
19
|
import { Box, CircularProgress, Paper, Typography } from "@mui/material";
|
|
20
20
|
import Grid from "@mui/material/Grid2";
|
|
21
21
|
import { useLocale, useTranslations } from "next-intl";
|
|
22
|
-
import { createContext, type ReactNode, useContext } from "react";
|
|
22
|
+
import { createContext, type ReactNode, useContext, useMemo } from "react";
|
|
23
23
|
|
|
24
24
|
type PLViewCtx = { categoryId: number };
|
|
25
25
|
const ProductListViewContext = createContext<PLViewCtx | null>(null);
|
|
@@ -37,8 +37,10 @@ export default function ProductListView({
|
|
|
37
37
|
categoryId,
|
|
38
38
|
children,
|
|
39
39
|
}: Readonly<RootProps>) {
|
|
40
|
+
const contextValue = useMemo(() => ({ categoryId }), [categoryId]);
|
|
41
|
+
|
|
40
42
|
return (
|
|
41
|
-
<ProductListViewContext.Provider value={
|
|
43
|
+
<ProductListViewContext.Provider value={contextValue}>
|
|
42
44
|
{children}
|
|
43
45
|
</ProductListViewContext.Provider>
|
|
44
46
|
);
|
|
@@ -91,6 +91,12 @@ const SearchBar: SearchBarType = (({ children }: RootProps) => {
|
|
|
91
91
|
);
|
|
92
92
|
}) as SearchBarType;
|
|
93
93
|
|
|
94
|
+
const renderMobileFilterToggle = (close: () => void) => (
|
|
95
|
+
<IconButton onClick={close}>
|
|
96
|
+
<FilterList fontSize="small" />
|
|
97
|
+
</IconButton>
|
|
98
|
+
);
|
|
99
|
+
|
|
94
100
|
SearchBar.PerPage = function PerPage() {
|
|
95
101
|
const { itemsPerPage, paramHandlers, downMd } = useSB();
|
|
96
102
|
return (
|
|
@@ -186,13 +192,7 @@ SearchBar.View = function View() {
|
|
|
186
192
|
</ToggleButtonGroup>
|
|
187
193
|
|
|
188
194
|
{downMd && (
|
|
189
|
-
<Sidenav
|
|
190
|
-
handler={(close) => (
|
|
191
|
-
<IconButton onClick={close}>
|
|
192
|
-
<FilterList fontSize="small" />
|
|
193
|
-
</IconButton>
|
|
194
|
-
)}
|
|
195
|
-
>
|
|
195
|
+
<Sidenav handler={renderMobileFilterToggle}>
|
|
196
196
|
<Box px={3} py={2}>
|
|
197
197
|
{mobileFiltersContent}
|
|
198
198
|
</Box>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Drawer from "@mui/material/Drawer";
|
|
2
|
-
import { type ReactNode, useEffect, useState } from "react";
|
|
2
|
+
import React, { type ReactNode, useEffect, useState } from "react";
|
|
3
3
|
// GLOBAL CUSTOM COMPONENT
|
|
4
4
|
import Scrollbar from "./scrollbar";
|
|
5
5
|
|
|
@@ -14,7 +14,7 @@ interface Props {
|
|
|
14
14
|
}
|
|
15
15
|
// ================================================================
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const SideNav: React.FC<Props> = (props: Readonly<Props>) => {
|
|
18
18
|
const {
|
|
19
19
|
position = "left",
|
|
20
20
|
open = false,
|
|
@@ -46,4 +46,6 @@ export default function SideNav(props: Readonly<Props>) {
|
|
|
46
46
|
{handler(handleClose)}
|
|
47
47
|
</div>
|
|
48
48
|
);
|
|
49
|
-
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default SideNav;
|
|
@@ -42,7 +42,7 @@ export default function OrderUpload({
|
|
|
42
42
|
const t = useTranslations("QuickOrder");
|
|
43
43
|
|
|
44
44
|
const [items, setItems] = useState<OrderUploadItem[]>([]);
|
|
45
|
-
const [
|
|
45
|
+
const [, setErrCount] = useState<number>(0);
|
|
46
46
|
const [files, setFiles] = useState<File[]>();
|
|
47
47
|
const [fileRejections, setFileRejections] = useState<string[]>([]);
|
|
48
48
|
|
|
@@ -4,7 +4,7 @@ import useAddToCart from "@evenicanpm/storefront-core/src/api-manager/services/c
|
|
|
4
4
|
import getCart from "@evenicanpm/storefront-core/src/api-manager/services/cart/queries/get-cart";
|
|
5
5
|
import useSearchProducts from "@evenicanpm/storefront-core/src/api-manager/services/product/mutations/search-products";
|
|
6
6
|
import type React from "react";
|
|
7
|
-
import { useCallback, useEffect, useState } from "react";
|
|
7
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
8
8
|
import { QuickOrderContext, RowError, type UploadedItem } from "./context";
|
|
9
9
|
import type { QuickOrderRowData } from "./quick-order-row";
|
|
10
10
|
|
|
@@ -183,21 +183,33 @@ export default function QuickOrderProvider({
|
|
|
183
183
|
};
|
|
184
184
|
|
|
185
185
|
useEffect(() => initTable(), [initTable]);
|
|
186
|
+
const contextValue = useMemo(
|
|
187
|
+
() => ({
|
|
188
|
+
rows,
|
|
189
|
+
cart,
|
|
190
|
+
handleRowUpdate,
|
|
191
|
+
handleRowDelete,
|
|
192
|
+
handleAddRows,
|
|
193
|
+
handleAddToCart,
|
|
194
|
+
handleUploadedItems,
|
|
195
|
+
resetForm: initTable,
|
|
196
|
+
generateFile,
|
|
197
|
+
}),
|
|
198
|
+
[
|
|
199
|
+
rows,
|
|
200
|
+
cart,
|
|
201
|
+
handleRowUpdate,
|
|
202
|
+
handleRowDelete,
|
|
203
|
+
handleAddRows,
|
|
204
|
+
handleAddToCart,
|
|
205
|
+
handleUploadedItems,
|
|
206
|
+
initTable,
|
|
207
|
+
generateFile,
|
|
208
|
+
],
|
|
209
|
+
);
|
|
186
210
|
|
|
187
211
|
return (
|
|
188
|
-
<QuickOrderContext.Provider
|
|
189
|
-
value={{
|
|
190
|
-
rows,
|
|
191
|
-
cart,
|
|
192
|
-
handleRowUpdate,
|
|
193
|
-
handleRowDelete,
|
|
194
|
-
handleAddRows,
|
|
195
|
-
handleAddToCart,
|
|
196
|
-
handleUploadedItems,
|
|
197
|
-
resetForm: initTable,
|
|
198
|
-
generateFile,
|
|
199
|
-
}}
|
|
200
|
-
>
|
|
212
|
+
<QuickOrderContext.Provider value={contextValue}>
|
|
201
213
|
{children}
|
|
202
214
|
</QuickOrderContext.Provider>
|
|
203
215
|
);
|
|
@@ -105,8 +105,8 @@ const QuickOrder = ({ children }: { children?: ReactNode }) => {
|
|
|
105
105
|
if (idx > -1) {
|
|
106
106
|
current.splice(idx, 1);
|
|
107
107
|
// Ensure there's always a trailing empty row for input
|
|
108
|
-
const lastRow = current
|
|
109
|
-
if (lastRow
|
|
108
|
+
const lastRow = current.at(-1);
|
|
109
|
+
if (lastRow?.value) {
|
|
110
110
|
const newRowId = current.reduce((m, r) => Math.max(m, r.id), 0) + 1;
|
|
111
111
|
current.push(generateEmptyRow(newRowId));
|
|
112
112
|
}
|
|
@@ -184,8 +184,8 @@ const QuickOrder = ({ children }: { children?: ReactNode }) => {
|
|
|
184
184
|
current[idx] = generateRowData(product, id, value, found, quantity);
|
|
185
185
|
|
|
186
186
|
// Auto-add an empty row when the last row has data entered
|
|
187
|
-
const lastRow = current
|
|
188
|
-
if (lastRow
|
|
187
|
+
const lastRow = current.at(-1);
|
|
188
|
+
if (lastRow?.value) {
|
|
189
189
|
const newRowId = current.reduce((m, r) => Math.max(m, r.id), 0) + 1;
|
|
190
190
|
current.push(generateEmptyRow(newRowId));
|
|
191
191
|
}
|
|
@@ -277,17 +277,30 @@ const QuickOrder = ({ children }: { children?: ReactNode }) => {
|
|
|
277
277
|
tableInit();
|
|
278
278
|
}, [tableInit]);
|
|
279
279
|
|
|
280
|
-
const value: Ctx =
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
280
|
+
const value: Ctx = useMemo(
|
|
281
|
+
() => ({
|
|
282
|
+
rows,
|
|
283
|
+
setRows,
|
|
284
|
+
addRows,
|
|
285
|
+
resetTable: tableInit,
|
|
286
|
+
updateRow,
|
|
287
|
+
deleteRow,
|
|
288
|
+
generateCsv,
|
|
289
|
+
handleUploadedItems,
|
|
290
|
+
addToCart,
|
|
291
|
+
}),
|
|
292
|
+
[
|
|
293
|
+
rows,
|
|
294
|
+
setRows,
|
|
295
|
+
addRows,
|
|
296
|
+
tableInit,
|
|
297
|
+
updateRow,
|
|
298
|
+
deleteRow,
|
|
299
|
+
generateCsv,
|
|
300
|
+
handleUploadedItems,
|
|
301
|
+
addToCart,
|
|
302
|
+
],
|
|
303
|
+
);
|
|
291
304
|
|
|
292
305
|
return (
|
|
293
306
|
<QuickOrderContext.Provider value={value}>
|
|
@@ -304,7 +317,7 @@ QuickOrder.Table = ({ children }: { children?: ReactNode }) => (
|
|
|
304
317
|
</TableContainer>
|
|
305
318
|
);
|
|
306
319
|
|
|
307
|
-
|
|
320
|
+
const QuickOrderHead = () => {
|
|
308
321
|
const t = useTranslations("QuickOrder");
|
|
309
322
|
return (
|
|
310
323
|
<TableHead sx={{ backgroundColor: "#323337" }}>
|
|
@@ -327,7 +340,9 @@ QuickOrder.Head = () => {
|
|
|
327
340
|
);
|
|
328
341
|
};
|
|
329
342
|
|
|
330
|
-
QuickOrder.
|
|
343
|
+
QuickOrder.Head = QuickOrderHead;
|
|
344
|
+
|
|
345
|
+
const QuickOrderBody = () => {
|
|
331
346
|
const ctx = useQuickOrder();
|
|
332
347
|
if (!ctx) return null;
|
|
333
348
|
const { rows } = ctx;
|
|
@@ -340,7 +355,9 @@ QuickOrder.Body = () => {
|
|
|
340
355
|
);
|
|
341
356
|
};
|
|
342
357
|
|
|
343
|
-
QuickOrder.
|
|
358
|
+
QuickOrder.Body = QuickOrderBody;
|
|
359
|
+
|
|
360
|
+
const QuickOrderRow = ({ row }: { row: QuickOrderRowData }) => {
|
|
344
361
|
const ctx = useQuickOrder();
|
|
345
362
|
const theme = useTheme();
|
|
346
363
|
const t = useTranslations("QuickOrder");
|
|
@@ -435,6 +452,8 @@ QuickOrder.Row = ({ row }: { row: QuickOrderRowData }) => {
|
|
|
435
452
|
);
|
|
436
453
|
};
|
|
437
454
|
|
|
455
|
+
QuickOrder.Row = QuickOrderRow;
|
|
456
|
+
|
|
438
457
|
QuickOrder.SkuInput = ({
|
|
439
458
|
value,
|
|
440
459
|
onChange,
|
|
@@ -485,7 +504,7 @@ QuickOrder.Actions = ({ children }: { children?: ReactNode }) => (
|
|
|
485
504
|
</BorderShadowCard>
|
|
486
505
|
);
|
|
487
506
|
|
|
488
|
-
|
|
507
|
+
const QuickOrderAddToCartButton = () => {
|
|
489
508
|
const ctx = useQuickOrder();
|
|
490
509
|
const t = useTranslations("QuickOrder");
|
|
491
510
|
if (!ctx) return null;
|
|
@@ -496,7 +515,9 @@ QuickOrder.AddToCartButton = () => {
|
|
|
496
515
|
);
|
|
497
516
|
};
|
|
498
517
|
|
|
499
|
-
QuickOrder.
|
|
518
|
+
QuickOrder.AddToCartButton = QuickOrderAddToCartButton;
|
|
519
|
+
|
|
520
|
+
const QuickOrderResetButton = () => {
|
|
500
521
|
const ctx = useQuickOrder();
|
|
501
522
|
const t = useTranslations("QuickOrder");
|
|
502
523
|
if (!ctx) return null;
|
|
@@ -507,7 +528,9 @@ QuickOrder.ResetButton = () => {
|
|
|
507
528
|
);
|
|
508
529
|
};
|
|
509
530
|
|
|
510
|
-
QuickOrder.
|
|
531
|
+
QuickOrder.ResetButton = QuickOrderResetButton;
|
|
532
|
+
|
|
533
|
+
const QuickOrderDownloadCsvButton = () => {
|
|
511
534
|
const ctx = useQuickOrder();
|
|
512
535
|
const t = useTranslations("QuickOrder");
|
|
513
536
|
if (!ctx) return null;
|
|
@@ -518,6 +541,8 @@ QuickOrder.DownloadCsvButton = () => {
|
|
|
518
541
|
);
|
|
519
542
|
};
|
|
520
543
|
|
|
544
|
+
QuickOrder.DownloadCsvButton = QuickOrderDownloadCsvButton;
|
|
545
|
+
|
|
521
546
|
QuickOrder.Upload = ({ children }: { children?: ReactNode }) => (
|
|
522
547
|
<BorderShadowCard>
|
|
523
548
|
<FlexBox justifyContent="center" gap={2} flexDirection="column" px={2}>
|
|
@@ -526,10 +551,12 @@ QuickOrder.Upload = ({ children }: { children?: ReactNode }) => (
|
|
|
526
551
|
</BorderShadowCard>
|
|
527
552
|
);
|
|
528
553
|
|
|
529
|
-
|
|
554
|
+
const QuickOrderOrderUpload = () => {
|
|
530
555
|
const ctx = useQuickOrder();
|
|
531
556
|
if (!ctx) return null;
|
|
532
557
|
return <OrderUploadInner onUploadItems={ctx.handleUploadedItems} />;
|
|
533
558
|
};
|
|
534
559
|
|
|
560
|
+
QuickOrder.OrderUpload = QuickOrderOrderUpload;
|
|
561
|
+
|
|
535
562
|
export default QuickOrder;
|
|
@@ -3,7 +3,12 @@ import type { CmsNavItem } from "@evenicanpm/cms/src/content/navigation/types";
|
|
|
3
3
|
import type { CategoryHierarchy } from "@evenicanpm/storefront-core/src/lib/category-helpers";
|
|
4
4
|
import { createLink } from "@evenicanpm/storefront-core/src/providers/nav-provider/utils/createLink";
|
|
5
5
|
import { useTranslations } from "next-intl";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
createContext,
|
|
8
|
+
type PropsWithChildren,
|
|
9
|
+
useMemo,
|
|
10
|
+
useState,
|
|
11
|
+
} from "react";
|
|
7
12
|
|
|
8
13
|
type NavContextType = {
|
|
9
14
|
cmsNav: CmsNavItem[];
|
|
@@ -41,18 +46,18 @@ const NavProvider = ({
|
|
|
41
46
|
|
|
42
47
|
// Extend nav by creating links here
|
|
43
48
|
const blogLink = createLink(t("blogLink"), "/blog"); //Localization example with hooks
|
|
49
|
+
const contextValue = useMemo(
|
|
50
|
+
() => ({
|
|
51
|
+
categories,
|
|
52
|
+
cmsNav: [blogLink, ...cmsNav],
|
|
53
|
+
isMobileSideNavOpen,
|
|
54
|
+
toggleMobileSideNav,
|
|
55
|
+
}),
|
|
56
|
+
[categories, blogLink, cmsNav, isMobileSideNavOpen, toggleMobileSideNav],
|
|
57
|
+
);
|
|
44
58
|
|
|
45
59
|
return (
|
|
46
|
-
<NavContext.Provider
|
|
47
|
-
value={{
|
|
48
|
-
categories,
|
|
49
|
-
cmsNav: [blogLink, ...cmsNav],
|
|
50
|
-
isMobileSideNavOpen,
|
|
51
|
-
toggleMobileSideNav,
|
|
52
|
-
}}
|
|
53
|
-
>
|
|
54
|
-
{children}
|
|
55
|
-
</NavContext.Provider>
|
|
60
|
+
<NavContext.Provider value={contextValue}>{children}</NavContext.Provider>
|
|
56
61
|
);
|
|
57
62
|
};
|
|
58
63
|
|
package/tsconfig.json
CHANGED
|
@@ -27,11 +27,6 @@
|
|
|
27
27
|
"@evenicanpm/storefront-core/src/hooks/*": ["./src/hooks/*"],
|
|
28
28
|
"@config": ["./src/config"],
|
|
29
29
|
"@messages/*": ["../../../../storefront/messages/*"],
|
|
30
|
-
"*": [
|
|
31
|
-
"../../node_modules/.pnpm/node_modules/*",
|
|
32
|
-
"./node_modules/*",
|
|
33
|
-
"../../apps/storefront/node_modules/*"
|
|
34
|
-
]
|
|
35
30
|
}
|
|
36
31
|
},
|
|
37
32
|
"include": ["src"]
|