umwd-components 0.1.731 → 0.1.732
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/cjs/src/components/common/csv/CsvDownloader.js +1 -1
- package/dist/cjs/src/components/e-commerce/cart/CartSummary.js +1 -1
- package/dist/cjs/src/components/e-commerce/cart/CartSummaryRow.js +1 -1
- package/dist/cjs/src/components/e-commerce/categories/CategorySelectorV2.js +1 -1
- package/dist/cjs/src/components/e-commerce/categories/EditCategoryForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/checkout/Step4.js +1 -1
- package/dist/cjs/src/components/e-commerce/customer/CustomerProfileDisplay.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/IROItemFields.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/IroItemUpdater.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/ManageIROForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/RmaForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/TextualIROItemUpdater.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/TextualManageIROForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/ManageOpoForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/OPOItemFields.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/OpoItemUpdater.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/OpoSummary.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/OpoSummaryRow.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/TextualManageOpoForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/TextualOpoItemUpdater.js +1 -1
- package/dist/cjs/src/components/e-commerce/products/EditProductForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/products/EditStockForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/products/PriceFields.js +1 -1
- package/dist/cjs/src/components/e-commerce/products/ProductCard.js +1 -1
- package/dist/cjs/src/components/e-commerce/products/ProductCategoryCard.js +1 -1
- package/dist/cjs/src/components/e-commerce/products/ProductSelector.js +1 -1
- package/dist/cjs/src/components/e-commerce/products/SingleProduct.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/IPOItemFields.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/IPOItemUpdater.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/ManageIPOForm.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/TextualIPOItemUpdater.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/TextualManageIPOForm.js +1 -1
- package/dist/cjs/src/components/logistics/vendor/EditVendorForm.js +1 -1
- package/dist/cjs/src/components/logistics/vendor/VendorDisplay.js +1 -1
- package/dist/cjs/src/components/logistics/vendor/VendorSelector.js +1 -1
- package/dist/cjs/src/components/page-elements/CategoryBlock.js +1 -1
- package/dist/cjs/src/context/e-commerce/cart/CartContext.js +1 -1
- package/dist/cjs/src/data/actions/e-commerce/categories/updateCategoryAction.js +1 -1
- package/dist/cjs/src/data/actions/e-commerce/product/updateProductAction.js +1 -1
- package/dist/cjs/src/data/loaders/e-commerce/getSingleCustomer.js +1 -1
- package/dist/cjs/src/data/loaders/e-commerce/getSingleProduct.js +1 -1
- package/dist/cjs/src/data/loaders/logistics/getTableIpos.js +1 -1
- package/dist/cjs/src/lib/molliePaymentProvider.js +1 -1
- package/dist/cjs/src/lib/parseFormData.js +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/_virtual/index3.js +2 -2
- package/dist/esm/_virtual/index4.js +2 -2
- package/dist/esm/node_modules/prop-types/node_modules/react-is/index.js +1 -1
- package/dist/esm/node_modules/safe-buffer/index.js +1 -1
- package/dist/esm/src/components/common/csv/CsvDownloader.js +0 -1
- package/dist/esm/src/components/e-commerce/cart/CartSummary.js +1 -1
- package/dist/esm/src/components/e-commerce/cart/CartSummaryRow.js +4 -4
- package/dist/esm/src/components/e-commerce/categories/CategorySelectorV2.js +4 -3
- package/dist/esm/src/components/e-commerce/categories/EditCategoryForm.js +3 -3
- package/dist/esm/src/components/e-commerce/checkout/Step4.js +1 -1
- package/dist/esm/src/components/e-commerce/customer/CustomerProfileDisplay.js +1 -1
- package/dist/esm/src/components/e-commerce/iro/IROItemFields.js +2 -2
- package/dist/esm/src/components/e-commerce/iro/IroItemUpdater.js +9 -4
- package/dist/esm/src/components/e-commerce/iro/ManageIROForm.js +4 -2
- package/dist/esm/src/components/e-commerce/iro/RmaForm.js +3 -3
- package/dist/esm/src/components/e-commerce/iro/TextualIROItemUpdater.js +4 -4
- package/dist/esm/src/components/e-commerce/iro/TextualManageIROForm.js +10 -8
- package/dist/esm/src/components/e-commerce/opo/ManageOpoForm.js +2 -2
- package/dist/esm/src/components/e-commerce/opo/OPOItemFields.js +1 -1
- package/dist/esm/src/components/e-commerce/opo/OpoItemUpdater.js +9 -4
- package/dist/esm/src/components/e-commerce/opo/OpoSummary.js +1 -1
- package/dist/esm/src/components/e-commerce/opo/OpoSummaryRow.js +1 -1
- package/dist/esm/src/components/e-commerce/opo/TextualManageOpoForm.js +7 -7
- package/dist/esm/src/components/e-commerce/opo/TextualOpoItemUpdater.js +4 -4
- package/dist/esm/src/components/e-commerce/products/EditProductForm.js +19 -17
- package/dist/esm/src/components/e-commerce/products/EditStockForm.js +39 -16
- package/dist/esm/src/components/e-commerce/products/PriceFields.js +3 -2
- package/dist/esm/src/components/e-commerce/products/ProductCard.js +3 -3
- package/dist/esm/src/components/e-commerce/products/ProductCategoryCard.js +1 -1
- package/dist/esm/src/components/e-commerce/products/ProductSelector.js +5 -5
- package/dist/esm/src/components/e-commerce/products/SingleProduct.js +5 -5
- package/dist/esm/src/components/logistics/ipo/IPOItemFields.js +2 -2
- package/dist/esm/src/components/logistics/ipo/IPOItemUpdater.js +9 -4
- package/dist/esm/src/components/logistics/ipo/ManageIPOForm.js +7 -5
- package/dist/esm/src/components/logistics/ipo/TextualIPOItemUpdater.js +4 -4
- package/dist/esm/src/components/logistics/ipo/TextualManageIPOForm.js +10 -8
- package/dist/esm/src/components/logistics/vendor/EditVendorForm.js +7 -4
- package/dist/esm/src/components/logistics/vendor/VendorDisplay.js +1 -1
- package/dist/esm/src/components/logistics/vendor/VendorSelector.js +5 -4
- package/dist/esm/src/components/page-elements/CategoryBlock.js +1 -1
- package/dist/esm/src/context/e-commerce/cart/CartContext.js +2 -2
- package/dist/esm/src/data/actions/e-commerce/categories/updateCategoryAction.js +3 -3
- package/dist/esm/src/data/actions/e-commerce/product/updateProductAction.js +7 -6
- package/dist/esm/src/data/loaders/e-commerce/getAllOpos.js +8 -0
- package/dist/esm/src/data/loaders/e-commerce/getSingleCustomer.js +15 -6
- package/dist/esm/src/data/loaders/e-commerce/getSingleProduct.js +2 -2
- package/dist/esm/src/data/loaders/e-commerce/getSingleStock.js +2 -2
- package/dist/esm/src/data/loaders/logistics/getSingleVendor.js +2 -2
- package/dist/esm/src/data/loaders/logistics/getTableIpos.js +1 -1
- package/dist/esm/src/lib/molliePaymentProvider.js +7 -3
- package/dist/esm/src/lib/parseFormData.js +1 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/types/components/logistics/ipo/IPOItemFields.d.ts +1 -1
- package/dist/esm/types/components/logistics/report/PreReportsDisplay.d.ts +2 -2
- package/dist/esm/types/components/page-elements/CategoryBlock.d.ts +1 -1
- package/dist/esm/types/data/actions/e-commerce/categories/updateCategoryAction.d.ts +1 -1
- package/dist/esm/types/data/actions/e-commerce/product/updateProductAction.d.ts +1 -1
- package/dist/esm/types/data/loaders/e-commerce/getAllOpos.d.ts +8 -0
- package/dist/esm/types/data/loaders/e-commerce/getSingleProduct.d.ts +3 -2
- package/dist/esm/types/data/loaders/e-commerce/getSingleStock.d.ts +1 -1
- package/dist/esm/types/data/loaders/logistics/getSingleVendor.d.ts +1 -1
- package/dist/esm/types/types/e-commerce/cart/types.d.ts +2 -2
- package/dist/esm/types/types/e-commerce/category/types.d.ts +3 -3
- package/dist/esm/types/types/e-commerce/customer/types.d.ts +2 -6
- package/dist/esm/types/types/e-commerce/invoice/types.d.ts +6 -6
- package/dist/esm/types/types/e-commerce/iro/types.d.ts +2 -4
- package/dist/esm/types/types/e-commerce/opo/types.d.ts +2 -4
- package/dist/esm/types/types/e-commerce/product/types.d.ts +9 -16
- package/dist/esm/types/types/logistics/Ipo.d.ts +2 -4
- package/dist/esm/types/types/logistics/Report.d.ts +4 -4
- package/dist/esm/types/types/logistics/Vendor.d.ts +4 -4
- package/package.json +1 -1
|
@@ -29,7 +29,7 @@ function CategoryBlock({ data }) {
|
|
|
29
29
|
}, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h4", component: "a", href: `/shop/categories/${data.category.slug}`, sx: { textDecoration: "none", color: "inherit" }, children: data.category.title }), data.category?.description &&
|
|
30
30
|
typeof data.category.description === "string" && (jsx(MarkdownDisplay, { children: data.category.description.substring(0, 150) + "..." })), jsx(Button, { variant: "contained", href: `/shop/categories/${data.category.slug}`, children: "Learn More" }), data.category?.products?.data != undefined && (jsxs(Fragment, { children: [jsx(Divider, { sx: { my: 2 } }), jsx(Stack, { direction: { xs: "column", sm: "row" }, spacing: 2, justifyContent: "space-around", sx: { pt: 2 }, children: data.category.products.data
|
|
31
31
|
.slice(0, previewAmount)
|
|
32
|
-
.map((product) => (jsx(ProductCard, { product: product }, product.
|
|
32
|
+
.map((product) => (jsx(ProductCard, { product: product }, product.documentId))) })] })), jsx(Typography, { variant: "body2", component: "a", href: `/shop/categories/${data.category.slug}`, sx: { textDecoration: "none", color: "inherit" }, children: "Show all" })] }) }) }) }) }));
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export { CategoryBlock };
|
|
@@ -25,7 +25,7 @@ const CartContext = createContext({
|
|
|
25
25
|
const cartReducer = (state, action) => {
|
|
26
26
|
switch (action.type) {
|
|
27
27
|
case "ADD_ITEM": {
|
|
28
|
-
const existingItemIndex = state.items.findIndex((item) => item.
|
|
28
|
+
const existingItemIndex = state.items.findIndex((item) => item.documentId === action.payload.documentId);
|
|
29
29
|
if (existingItemIndex > -1) {
|
|
30
30
|
const updatedItems = state.items.map((item, index) => index === existingItemIndex
|
|
31
31
|
? { ...item, quantity: item.quantity + action.payload.quantity }
|
|
@@ -35,7 +35,7 @@ const cartReducer = (state, action) => {
|
|
|
35
35
|
return { ...state, items: [...state.items, action.payload] };
|
|
36
36
|
}
|
|
37
37
|
case "REMOVE_ITEM": {
|
|
38
|
-
const existingItemIndex = state.items.findIndex((item) => item.
|
|
38
|
+
const existingItemIndex = state.items.findIndex((item) => item.documentId === action.payload.documentId);
|
|
39
39
|
if (existingItemIndex > -1) {
|
|
40
40
|
const updatedItems = state.items
|
|
41
41
|
.map((item, index) => index === existingItemIndex
|
|
@@ -9,8 +9,8 @@ import { mutateData } from '../../../services/mutate-data.js';
|
|
|
9
9
|
import { flattenAttributes } from '../../../../lib/utils.js';
|
|
10
10
|
import { parseFormData } from '../../../../lib/parseFormData.js';
|
|
11
11
|
|
|
12
|
-
async function updateCategoryAction(prevState, formData) {
|
|
13
|
-
|
|
12
|
+
async function updateCategoryAction(documentId, prevState, formData) {
|
|
13
|
+
Object.fromEntries(formData);
|
|
14
14
|
const parsedFormData = parseFormData(formData);
|
|
15
15
|
/**
|
|
16
16
|
* INFO: The products are JSONStringyfied in the frontend to add them to the hidden input
|
|
@@ -19,7 +19,7 @@ async function updateCategoryAction(prevState, formData) {
|
|
|
19
19
|
if (parsedFormData.data.products) {
|
|
20
20
|
parsedFormData.data.products = JSON.parse(parsedFormData.data.products);
|
|
21
21
|
}
|
|
22
|
-
const responseData = await mutateData("PUT", `/api/product-categories/${
|
|
22
|
+
const responseData = await mutateData("PUT", `/api/product-categories/${documentId}`, parsedFormData);
|
|
23
23
|
if (!responseData) {
|
|
24
24
|
return {
|
|
25
25
|
...prevState,
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { mutateData } from '../../../services/mutate-data.js';
|
|
9
|
-
import { flattenAttributes } from '../../../../lib/utils.js';
|
|
10
9
|
import { parseFormData } from '../../../../lib/parseFormData.js';
|
|
11
10
|
|
|
12
|
-
async function updateProductAction(prevState, formData) {
|
|
13
|
-
|
|
11
|
+
async function updateProductAction(documentId, prevState, formData) {
|
|
12
|
+
Object.fromEntries(formData);
|
|
14
13
|
const parsedFormData = parseFormData(formData);
|
|
14
|
+
console.log("parsedFormData", parsedFormData);
|
|
15
15
|
/**
|
|
16
16
|
* INFO: The categories are JSONStringyfied in the frontend to add them to the hidden input
|
|
17
17
|
* in categorySelector.tsx but they should be parsed before sending them to the backend
|
|
@@ -29,7 +29,8 @@ async function updateProductAction(prevState, formData) {
|
|
|
29
29
|
if (parsedFormData.data.stock_reports) {
|
|
30
30
|
parsedFormData.data.stock_reports = JSON.parse(parsedFormData.data.stock_reports);
|
|
31
31
|
}
|
|
32
|
-
const responseData = await mutateData("PUT", `/api/products/${
|
|
32
|
+
const responseData = await mutateData("PUT", `/api/products/${documentId}`, parsedFormData);
|
|
33
|
+
console.log("responseData", responseData);
|
|
33
34
|
if (!responseData) {
|
|
34
35
|
return {
|
|
35
36
|
...prevState,
|
|
@@ -46,12 +47,12 @@ async function updateProductAction(prevState, formData) {
|
|
|
46
47
|
message: "Failed to Update Product.",
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
|
-
const flattenedData = flattenAttributes(responseData);
|
|
50
|
+
// const flattenedData = flattenAttributes(responseData);
|
|
50
51
|
return {
|
|
51
52
|
...prevState,
|
|
52
53
|
severity: "success",
|
|
53
54
|
message: "Product Updated Successfully",
|
|
54
|
-
data:
|
|
55
|
+
data: responseData,
|
|
55
56
|
strapiErrors: null,
|
|
56
57
|
};
|
|
57
58
|
}
|
|
@@ -16,6 +16,14 @@ const baseUrl = getStrapiURL();
|
|
|
16
16
|
/**
|
|
17
17
|
* INFO Fetch all OPOs
|
|
18
18
|
* used by the OPOs table in the admin panel
|
|
19
|
+
* @param currentPage - The current page number for pagination
|
|
20
|
+
* @param rowsPerPage - The number of rows per page for pagination
|
|
21
|
+
* @param order - The sort order (asc or desc)
|
|
22
|
+
* @param orderBy - The field to order by, defaults to "createdAt"
|
|
23
|
+
* @param is_archive - An array of booleans to filter by archived status, defaulting to only non-archived OPOs
|
|
24
|
+
* @param filters - An object containing additional filters to apply
|
|
25
|
+
* @return A promise that resolves to the fetched OPO data
|
|
26
|
+
* * @throws Will throw an error if the fetch fails
|
|
19
27
|
*/
|
|
20
28
|
async function getAllOpos(currentPage, rowsPerPage, order, orderBy, is_archive = [false], // default to only non-archived OPOs
|
|
21
29
|
filters = {}) {
|
|
@@ -16,12 +16,21 @@ async function getSingleCustomer(documentId) {
|
|
|
16
16
|
const url = new URL(`/api/customer-profiles/${documentId}`, baseUrl);
|
|
17
17
|
url.search = qs.stringify({
|
|
18
18
|
populate: {
|
|
19
|
-
company_address:
|
|
20
|
-
delivery_address:
|
|
21
|
-
billing_address:
|
|
22
|
-
business_credentials:
|
|
23
|
-
orders:
|
|
24
|
-
|
|
19
|
+
company_address: true,
|
|
20
|
+
delivery_address: true,
|
|
21
|
+
billing_address: true,
|
|
22
|
+
business_credentials: true,
|
|
23
|
+
orders: {
|
|
24
|
+
fields: [
|
|
25
|
+
"opo_number",
|
|
26
|
+
"order_date",
|
|
27
|
+
"internal_status",
|
|
28
|
+
"total_incl_vat",
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
returns: {
|
|
32
|
+
fields: ["return_number", "return_date", "internal_status"],
|
|
33
|
+
},
|
|
25
34
|
},
|
|
26
35
|
});
|
|
27
36
|
return await fetchData(url.href);
|
|
@@ -11,9 +11,9 @@ import { getStrapiURL } from '../../../lib/utils.js';
|
|
|
11
11
|
import { unstable_noStore } from 'next/cache';
|
|
12
12
|
|
|
13
13
|
const baseUrl = getStrapiURL();
|
|
14
|
-
async function getSingleProduct(
|
|
14
|
+
async function getSingleProduct(documentId) {
|
|
15
15
|
unstable_noStore();
|
|
16
|
-
const url = new URL(`/api/
|
|
16
|
+
const url = new URL(`/api/products/${documentId}`, baseUrl);
|
|
17
17
|
url.search = qs.stringify({
|
|
18
18
|
filters: {
|
|
19
19
|
is_archive: false,
|
|
@@ -10,9 +10,9 @@ import { getStrapiURL } from '../../../lib/utils.js';
|
|
|
10
10
|
import { unstable_noStore } from 'next/cache';
|
|
11
11
|
|
|
12
12
|
const baseUrl = getStrapiURL();
|
|
13
|
-
async function getSingleStock(
|
|
13
|
+
async function getSingleStock(documentId) {
|
|
14
14
|
unstable_noStore();
|
|
15
|
-
const url = new URL(`/api/products/getStock/${
|
|
15
|
+
const url = new URL(`/api/products/getStock/${documentId}`, baseUrl);
|
|
16
16
|
return await fetchData(url.href);
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -11,9 +11,9 @@ import { getStrapiURL } from '../../../lib/utils.js';
|
|
|
11
11
|
import { unstable_noStore } from 'next/cache';
|
|
12
12
|
|
|
13
13
|
const baseUrl = getStrapiURL();
|
|
14
|
-
async function getSingleVendor(
|
|
14
|
+
async function getSingleVendor(documentId) {
|
|
15
15
|
unstable_noStore();
|
|
16
|
-
const url = new URL(`/api/vendor-profiles/${
|
|
16
|
+
const url = new URL(`/api/vendor-profiles/${documentId}`, baseUrl);
|
|
17
17
|
url.search = qs.stringify({
|
|
18
18
|
populate: {
|
|
19
19
|
address: true,
|
|
@@ -11,9 +11,13 @@ const mollieClient = createMollieClient({
|
|
|
11
11
|
apiKey: `${process.env.MOLLIE_KEY}`,
|
|
12
12
|
});
|
|
13
13
|
async function createMolliePayment(order) {
|
|
14
|
-
const {
|
|
14
|
+
const { documentId, opo_number, total_incl_vat, order_currency, uuid } = order;
|
|
15
15
|
// check for errors
|
|
16
|
-
if (!
|
|
16
|
+
if (!documentId ||
|
|
17
|
+
!opo_number ||
|
|
18
|
+
!total_incl_vat ||
|
|
19
|
+
!order_currency ||
|
|
20
|
+
!uuid) {
|
|
17
21
|
return "missing order data";
|
|
18
22
|
}
|
|
19
23
|
const payment = await mollieClient.payments
|
|
@@ -26,7 +30,7 @@ async function createMolliePayment(order) {
|
|
|
26
30
|
redirectUrl: `${process.env.FRONTEND_URL}/shop/check-out?order=${uuid}`,
|
|
27
31
|
webhookUrl: `${process.env.FRONTEND_URL}/api/mollie`,
|
|
28
32
|
metadata: {
|
|
29
|
-
|
|
33
|
+
documentId: documentId,
|
|
30
34
|
opo_number: opo_number,
|
|
31
35
|
},
|
|
32
36
|
// TODO: add paymentMethod
|