umwd-components 0.1.742 → 0.1.744
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/auth/DenseRegisterForm.js +1 -1
- package/dist/cjs/src/components/auth/DenseSigninForm.js +1 -1
- package/dist/cjs/src/components/auth/ForgotPasswordForm.js +1 -1
- package/dist/cjs/src/components/auth/PasswordResetForm.js +1 -1
- package/dist/cjs/src/components/auth/RegisterForm.js +1 -1
- package/dist/cjs/src/components/common/media/DenseEditMediaForm.js +1 -1
- package/dist/cjs/src/components/common/media/UploadBase64MediaForm.js +1 -1
- package/dist/cjs/src/components/common/media/UploadMediaForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/categories/AddCategoryForm.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/CustomerProfileEditForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/enduser/EnduserProfileEditForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/invoice/CreateInvoiceForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/CreateIROForm.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/TextualManageIROForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/CreateOpoForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/ManageOpoForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/TextualManageOpoForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/products/AddProductForm.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/logistics/dispatcher/DispatcherProfileEditForm.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/AddIPOForm.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/ManageIPOForm.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/TextualManageIPOForm.js +1 -1
- package/dist/cjs/src/components/logistics/note/NoteTakingComponent.js +1 -1
- package/dist/cjs/src/components/logistics/report/ReportMakingComponent.js +1 -1
- package/dist/cjs/src/components/logistics/vendor/AddVendorForm.js +1 -1
- package/dist/cjs/src/components/logistics/vendor/EditVendorForm.js +1 -1
- package/dist/cjs/src/components/page-builder/PageBuilder.js +1 -1
- package/dist/cjs/src/components/public-information/PublicInformationForm.js +1 -1
- package/dist/cjs/src/data/loaders/e-commerce/getSingleProduct.js +1 -1
- package/dist/cjs/src/index.js +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/src/components/auth/DenseRegisterForm.js +2 -2
- package/dist/esm/src/components/auth/DenseSigninForm.js +2 -2
- package/dist/esm/src/components/auth/ForgotPasswordForm.js +2 -2
- package/dist/esm/src/components/auth/PasswordResetForm.js +2 -2
- package/dist/esm/src/components/auth/RegisterForm.js +2 -2
- package/dist/esm/src/components/common/media/DenseEditMediaForm.js +2 -2
- package/dist/esm/src/components/common/media/UploadBase64MediaForm.js +2 -3
- package/dist/esm/src/components/common/media/UploadMediaForm.js +4 -5
- package/dist/esm/src/components/e-commerce/categories/AddCategoryForm.js +2 -3
- package/dist/esm/src/components/e-commerce/categories/EditCategoryForm.js +2 -3
- package/dist/esm/src/components/e-commerce/checkout/Step4.js +2 -3
- package/dist/esm/src/components/e-commerce/customer/CustomerProfileEditForm.js +2 -3
- package/dist/esm/src/components/e-commerce/enduser/EnduserProfileEditForm.js +2 -3
- package/dist/esm/src/components/e-commerce/invoice/CreateInvoiceForm.js +2 -3
- package/dist/esm/src/components/e-commerce/iro/CreateIROForm.js +2 -3
- package/dist/esm/src/components/e-commerce/iro/ManageIROForm.js +2 -3
- package/dist/esm/src/components/e-commerce/iro/RmaForm.js +2 -3
- package/dist/esm/src/components/e-commerce/iro/TextualManageIROForm.js +2 -3
- package/dist/esm/src/components/e-commerce/opo/CreateOpoForm.js +2 -3
- package/dist/esm/src/components/e-commerce/opo/ManageOpoForm.js +3 -4
- package/dist/esm/src/components/e-commerce/opo/TextualManageOpoForm.js +2 -3
- package/dist/esm/src/components/e-commerce/products/AddProductForm.js +2 -3
- package/dist/esm/src/components/e-commerce/products/EditProductForm.js +2 -3
- package/dist/esm/src/components/e-commerce/products/EditStockForm.js +3 -4
- package/dist/esm/src/components/logistics/dispatcher/DispatcherProfileEditForm.js +2 -3
- package/dist/esm/src/components/logistics/ipo/AddIPOForm.js +3 -4
- package/dist/esm/src/components/logistics/ipo/ManageIPOForm.js +2 -3
- package/dist/esm/src/components/logistics/ipo/TextualManageIPOForm.js +2 -3
- package/dist/esm/src/components/logistics/note/NoteTakingComponent.js +2 -3
- package/dist/esm/src/components/logistics/report/ReportMakingComponent.js +2 -3
- package/dist/esm/src/components/logistics/vendor/AddVendorForm.js +7 -8
- package/dist/esm/src/components/logistics/vendor/EditVendorForm.js +9 -10
- package/dist/esm/src/components/page-builder/PageBuilder.js +2 -2
- package/dist/esm/src/components/public-information/PublicInformationForm.js +8 -9
- package/dist/esm/src/data/loaders/e-commerce/getSingleProduct.js +20 -1
- package/dist/esm/src/index.js +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
-
import { useState, useEffect } from 'react';
|
|
9
|
-
import { useFormState } from 'react-dom';
|
|
8
|
+
import { useActionState, useState, useEffect } from 'react';
|
|
10
9
|
import { useSnackbar } from '../../../context/common/SnackbarContext.js';
|
|
11
10
|
import { updateIpoAction } from '../../../data/actions/logistics/ipo/updateIpoAction.js';
|
|
12
11
|
import { UploadBase64MediaForm } from '../../common/media/UploadBase64MediaForm.js';
|
|
@@ -45,7 +44,7 @@ function ConfirmFormDialog({ open, handleClose, orderID, currentStatus, revalida
|
|
|
45
44
|
}, children: "Confirm" }), jsx(Button, { variant: "outlined", onClick: handleClose, children: "Cancel" })] })] }));
|
|
46
45
|
}
|
|
47
46
|
function ManageIPOForm({ data, sx, revalidateCallback, handleClose, role, }) {
|
|
48
|
-
const [formState, formAction] =
|
|
47
|
+
const [formState, formAction] = useActionState((prevState, formData) => updateIpoAction(data.documentId, prevState, formData), INITIAL_STATE);
|
|
49
48
|
const { handleAddMessage } = useSnackbar();
|
|
50
49
|
const [items, setItems] = useState(data.items ? data.items : []);
|
|
51
50
|
const [confirmDialogOpen, setConfirmDialogOpen] = useState(false);
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
-
import { useState, useEffect } from 'react';
|
|
9
|
-
import { useFormState } from 'react-dom';
|
|
8
|
+
import { useActionState, useState, useEffect } from 'react';
|
|
10
9
|
import { useSnackbar } from '../../../context/common/SnackbarContext.js';
|
|
11
10
|
import { updateIpoAction } from '../../../data/actions/logistics/ipo/updateIpoAction.js';
|
|
12
11
|
import { confirmationService } from '../../../data/services/common/confirmation-service.js';
|
|
@@ -98,7 +97,7 @@ function CancelIpoDialog({ open, handleClose, orderID, revalidateCallback, }) {
|
|
|
98
97
|
return (jsxs(Dialog, { open: open, onClose: handleClose, children: [jsx(DialogTitle, { children: "Cancel Return" }), jsx(DialogContent, { children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { children: "Are you sure you want to cancel this return?" }), jsxs(List, { children: [jsx(ListItem, { children: "By cancelling this return order you will update it's status from requested to cancelled" }), jsx(ListItem, { children: "Please provide a reason for the cancellation" }), jsx(ListItem, { children: "The customer will be notified about the cancellation and of the reason for the cancellation" })] }), jsx(TextField, { label: "Cancellation reason", name: "reason", multiline: true, rows: 4, fullWidth: true, variant: "outlined", value: reason, onChange: (e) => setReason(e.target.value), placeholder: "Please provide a reason for the cancellation", error: !!reasonError, helperText: reasonError })] }) }), jsxs(DialogActions, { children: [jsx(Button, { variant: "outlined", onClick: handleClose, children: "Close" }), jsx(Button, { variant: "contained", color: "error", onClick: handleCancel, children: "Confirm Cancellation" })] })] }));
|
|
99
98
|
}
|
|
100
99
|
function TextualManageIPOForm({ data, sx, revalidateCallback, handleClose, role, }) {
|
|
101
|
-
const [formState, formAction] =
|
|
100
|
+
const [formState, formAction] = useActionState((prevState, formData) => updateIpoAction(data.documentId, prevState, formData), INITIAL_STATE);
|
|
102
101
|
const { handleAddMessage } = useSnackbar();
|
|
103
102
|
const [items, setItems] = useState(data.items ? data.items : []);
|
|
104
103
|
const [confirmDialogOpen, setConfirmDialogOpen] = useState(false);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
8
|
-
import { useState, useEffect } from 'react';
|
|
8
|
+
import { useState, useActionState, useEffect } from 'react';
|
|
9
9
|
import IconButton from '@mui/material/IconButton';
|
|
10
10
|
import Dialog from '@mui/material/Dialog';
|
|
11
11
|
import DialogContent from '@mui/material/DialogContent';
|
|
@@ -17,7 +17,6 @@ import Stack from '@mui/material/Stack';
|
|
|
17
17
|
import dayjs from '../../../../node_modules/dayjs/dayjs.min.js';
|
|
18
18
|
import NoteAltIcon from '@mui/icons-material/NoteAlt';
|
|
19
19
|
import { SubmitButton } from '../../SubmitButton.js';
|
|
20
|
-
import { useFormState } from 'react-dom';
|
|
21
20
|
import { createNoteAction } from '../../../data/actions/logistics/note/createNoteAction.js';
|
|
22
21
|
import MarkdownEditor from '../../common/markdown/MarkdownEditor.js';
|
|
23
22
|
import { useSnackbar } from '../../../context/common/SnackbarContext.js';
|
|
@@ -34,7 +33,7 @@ const INITIAL_STATE = {
|
|
|
34
33
|
function NoteTakingComponent({ content, related, revalidateCallback, }) {
|
|
35
34
|
const [open, setOpen] = useState(false);
|
|
36
35
|
const createNoteWithRelationsAction = createNoteAction.bind(null, related);
|
|
37
|
-
const [formState, formAction] =
|
|
36
|
+
const [formState, formAction] = useActionState(createNoteWithRelationsAction, INITIAL_STATE);
|
|
38
37
|
const { handleAddMessage } = useSnackbar();
|
|
39
38
|
useEffect(() => {
|
|
40
39
|
if (formState?.strapiErrors) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
8
|
-
import { useState, useEffect } from 'react';
|
|
8
|
+
import { useState, useActionState, useEffect } from 'react';
|
|
9
9
|
import IconButton from '@mui/material/IconButton';
|
|
10
10
|
import Dialog from '@mui/material/Dialog';
|
|
11
11
|
import DialogContent from '@mui/material/DialogContent';
|
|
@@ -16,7 +16,6 @@ import Stack from '@mui/material/Stack';
|
|
|
16
16
|
import TextField from '@mui/material/TextField';
|
|
17
17
|
import dayjs from '../../../../node_modules/dayjs/dayjs.min.js';
|
|
18
18
|
import { SubmitButton } from '../../SubmitButton.js';
|
|
19
|
-
import { useFormState } from 'react-dom';
|
|
20
19
|
import { createReportAction } from '../../../data/actions/logistics/report/createReportAction.js';
|
|
21
20
|
import MarkdownEditor from '../../common/markdown/MarkdownEditor.js';
|
|
22
21
|
import AnnouncementIcon from '@mui/icons-material/Announcement';
|
|
@@ -37,7 +36,7 @@ function ReportMakingComponent({ content, related, type, minValue, maxValue, rev
|
|
|
37
36
|
const [open, setOpen] = useState(false);
|
|
38
37
|
const [currentUser, setCurrentUser] = useState(null);
|
|
39
38
|
const createReportWithRelationsAction = createReportAction.bind(null, related, type);
|
|
40
|
-
const [formState, formAction] =
|
|
39
|
+
const [formState, formAction] = useActionState(createReportWithRelationsAction, INITIAL_STATE);
|
|
41
40
|
const { handleAddMessage } = useSnackbar();
|
|
42
41
|
useEffect(() => {
|
|
43
42
|
if (formState?.message) {
|
|
@@ -6,14 +6,13 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
9
|
-
import { useState, useEffect } from 'react';
|
|
9
|
+
import { useActionState, useState, useEffect } from 'react';
|
|
10
10
|
import Box from '@mui/material/Box';
|
|
11
11
|
import Stack from '@mui/material/Stack';
|
|
12
12
|
import Button from '@mui/material/Button';
|
|
13
13
|
import TextField from '@mui/material/TextField';
|
|
14
14
|
import Typography from '@mui/material/Typography';
|
|
15
15
|
import { SubmitButton } from '../../SubmitButton.js';
|
|
16
|
-
import { useFormState } from 'react-dom';
|
|
17
16
|
import { useSnackbar } from '../../../context/common/SnackbarContext.js';
|
|
18
17
|
import { createVendorAction } from '../../../data/actions/logistics/vendor/createVendorAction.js';
|
|
19
18
|
import Grid from '@mui/material/Grid';
|
|
@@ -34,7 +33,7 @@ const INITIAL_STATE = {
|
|
|
34
33
|
severity: null,
|
|
35
34
|
};
|
|
36
35
|
function AddVendorForm({ productNamesArr, revalidateCallback, handleClose, sx, }) {
|
|
37
|
-
const [formState, formAction] =
|
|
36
|
+
const [formState, formAction] = useActionState(createVendorAction, INITIAL_STATE);
|
|
38
37
|
const { handleAddMessage } = useSnackbar();
|
|
39
38
|
const [newContacts, setNewContacts] = useState([]);
|
|
40
39
|
const handleDeleteContact = (index) => {
|
|
@@ -63,13 +62,13 @@ function AddVendorForm({ productNamesArr, revalidateCallback, handleClose, sx, }
|
|
|
63
62
|
}, [formState?.strapiErrors]);
|
|
64
63
|
return (jsx(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: jsx("form", { action: formAction, children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { size: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h3", component: "h1", children: "Add Vendor" }), jsx(Typography, { variant: "body1", children: "Create a new vendor for your business" })] }) }), jsx(Grid, { size: 12, children: jsx(ExplanatoryFoldOut, { title: "Vendor", description: "Vendors are businesses that you purchase products from." }) }), jsx(Grid, { size: {
|
|
65
64
|
xs: 12,
|
|
66
|
-
md: 6
|
|
65
|
+
md: 6,
|
|
67
66
|
}, children: jsx(BusinessCredentialsFields, { componentName: "business_credentials", componentReference: "common.business-credentials" }) }), jsx(Grid, { size: {
|
|
68
67
|
xs: 12,
|
|
69
|
-
md: 6
|
|
68
|
+
md: 6,
|
|
70
69
|
}, children: jsxs(Stack, { spacing: 1, sx: { pt: 1 }, children: [jsx(TextField, { id: "website_url", name: "website_url", label: "Website Url" }), jsx(TextField, { id: "phone_number", name: "phone_number", label: "Phone Number" }), jsx(TextField, { id: "email", name: "email", label: "Email" })] }) }), jsxs(Grid, { size: {
|
|
71
70
|
xs: 12,
|
|
72
|
-
md: 6
|
|
71
|
+
md: 6,
|
|
73
72
|
}, children: [jsx(Typography, { variant: "h6", children: "Address" }), jsx(AddressFields, { componentName: "address", componentReference: "common.address" })] }), jsx(Grid, { size: 12, children: jsx(Typography, { variant: "h6", children: "Products" }) }), jsx(Grid, { size: 12, children: jsx(ProductSelector, { productNames: productNamesArr, currentValue: [] }) }), jsx(Grid, { size: 12, children: jsx(Typography, { variant: "h6", children: "Contacts" }) }), newContacts.map((contact, index) => {
|
|
74
73
|
return (jsx(Grid, { sx: {
|
|
75
74
|
justifyContent: "center",
|
|
@@ -79,7 +78,7 @@ function AddVendorForm({ productNamesArr, revalidateCallback, handleClose, sx, }
|
|
|
79
78
|
xs: 12,
|
|
80
79
|
sm: 6,
|
|
81
80
|
md: 4,
|
|
82
|
-
lg: 3
|
|
81
|
+
lg: 3,
|
|
83
82
|
}, children: jsx(Paper, { sx: {
|
|
84
83
|
p: 2,
|
|
85
84
|
width: "100%",
|
|
@@ -98,7 +97,7 @@ function AddVendorForm({ productNamesArr, revalidateCallback, handleClose, sx, }
|
|
|
98
97
|
xs: 12,
|
|
99
98
|
sm: 6,
|
|
100
99
|
md: 4,
|
|
101
|
-
lg: 3
|
|
100
|
+
lg: 3,
|
|
102
101
|
}, children: jsx(Paper, { sx: {
|
|
103
102
|
p: 2,
|
|
104
103
|
width: "100%",
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
9
|
-
import { useEffect, useState } from 'react';
|
|
9
|
+
import { useActionState, useEffect, useState } from 'react';
|
|
10
10
|
import Paper from '@mui/material/Paper';
|
|
11
11
|
import Box from '@mui/material/Box';
|
|
12
12
|
import Stack from '@mui/material/Stack';
|
|
@@ -14,7 +14,6 @@ import Button from '@mui/material/Button';
|
|
|
14
14
|
import TextField from '@mui/material/TextField';
|
|
15
15
|
import Typography from '@mui/material/Typography';
|
|
16
16
|
import { SubmitButton } from '../../SubmitButton.js';
|
|
17
|
-
import { useFormState } from 'react-dom';
|
|
18
17
|
import { useSnackbar } from '../../../context/common/SnackbarContext.js';
|
|
19
18
|
import { updateVendorAction } from '../../../data/actions/logistics/vendor/updateVendorAction.js';
|
|
20
19
|
import Grid from '@mui/material/Grid';
|
|
@@ -37,7 +36,7 @@ const INITIAL_STATE = {
|
|
|
37
36
|
};
|
|
38
37
|
function EditVendorForm({ data, productNamesArr, revalidateCallback, handleClose, sx, }) {
|
|
39
38
|
const { documentId, website_url, phone_number, email, business_credentials, address, products, contacts, notes, } = data;
|
|
40
|
-
const [formState, formAction] =
|
|
39
|
+
const [formState, formAction] = useActionState((prevState, formData) => updateVendorAction(documentId, prevState, formData), INITIAL_STATE);
|
|
41
40
|
const { handleAddMessage } = useSnackbar();
|
|
42
41
|
useEffect(() => {
|
|
43
42
|
if (formState?.message) {
|
|
@@ -88,13 +87,13 @@ function EditVendorForm({ data, productNamesArr, revalidateCallback, handleClose
|
|
|
88
87
|
},
|
|
89
88
|
], revalidateCallback: revalidateCallback })] }) }), jsx(Grid, { size: 12, children: jsx(ExplanatoryFoldOut, { title: "Vendor", description: "Vendors are businesses that you purchase products from." }) }), jsx(Grid, { size: {
|
|
90
89
|
xs: 12,
|
|
91
|
-
md: 6
|
|
90
|
+
md: 6,
|
|
92
91
|
}, children: jsx(BusinessCredentialsFields, { data: business_credentials, componentName: "business_credentials", componentReference: "common.business-credentials" }) }), jsx(Grid, { size: {
|
|
93
92
|
xs: 12,
|
|
94
|
-
md: 6
|
|
93
|
+
md: 6,
|
|
95
94
|
}, children: jsxs(Stack, { spacing: 2, children: [jsx(TextField, { id: "website_url", name: "website_url", label: "Website Url", defaultValue: website_url }), jsx(TextField, { id: "phone_number", name: "phone_number", label: "Phone Number", defaultValue: phone_number }), jsx(TextField, { id: "email", name: "email", label: "Email", defaultValue: email })] }) }), jsxs(Grid, { size: {
|
|
96
95
|
xs: 12,
|
|
97
|
-
md: 6
|
|
96
|
+
md: 6,
|
|
98
97
|
}, children: [jsx(Typography, { variant: "h6", children: "Address" }), jsx(AddressFields, { data: address, componentName: "address", componentReference: "common.address" })] }), jsxs(Grid, { sx: { mt: 1 }, size: 12, children: [jsx(Typography, { variant: "h6", children: "Products" }), jsx(ProductSelector, { productNames: productNamesArr, currentValue: initialProducts.map((prod) => prod.documentId) })] }), jsx(Grid, { sx: { mt: 1 }, size: 12, children: jsx(Typography, { variant: "h6", children: "Contacts" }) }), oldContacts?.map((contact, index) => {
|
|
99
98
|
console.log("contact", contact);
|
|
100
99
|
if (contact.data?.first_name) {
|
|
@@ -107,7 +106,7 @@ function EditVendorForm({ data, productNamesArr, revalidateCallback, handleClose
|
|
|
107
106
|
xs: 12,
|
|
108
107
|
sm: 6,
|
|
109
108
|
md: 4,
|
|
110
|
-
lg: 3
|
|
109
|
+
lg: 3,
|
|
111
110
|
}, children: jsx(Paper, { sx: {
|
|
112
111
|
p: 2,
|
|
113
112
|
width: "100%",
|
|
@@ -131,7 +130,7 @@ function EditVendorForm({ data, productNamesArr, revalidateCallback, handleClose
|
|
|
131
130
|
xs: 12,
|
|
132
131
|
sm: 6,
|
|
133
132
|
md: 4,
|
|
134
|
-
lg: 3
|
|
133
|
+
lg: 3,
|
|
135
134
|
}, children: jsx(Paper, { sx: {
|
|
136
135
|
p: 2,
|
|
137
136
|
width: "100%",
|
|
@@ -152,7 +151,7 @@ function EditVendorForm({ data, productNamesArr, revalidateCallback, handleClose
|
|
|
152
151
|
xs: 12,
|
|
153
152
|
sm: 6,
|
|
154
153
|
md: 4,
|
|
155
|
-
lg: 3
|
|
154
|
+
lg: 3,
|
|
156
155
|
}, children: jsx(Paper, { sx: {
|
|
157
156
|
p: 2,
|
|
158
157
|
width: "100%",
|
|
@@ -178,7 +177,7 @@ function EditVendorForm({ data, productNamesArr, revalidateCallback, handleClose
|
|
|
178
177
|
xs: 12,
|
|
179
178
|
sm: 6,
|
|
180
179
|
md: 4,
|
|
181
|
-
lg: 3
|
|
180
|
+
lg: 3,
|
|
182
181
|
}, children: jsx(Paper, { sx: {
|
|
183
182
|
p: 2,
|
|
184
183
|
width: "100%",
|
|
@@ -21,7 +21,7 @@ import PBContactForm from './PBContactForm.js';
|
|
|
21
21
|
import { PBPersonaliaSection } from './PBPersonaliaSection.js';
|
|
22
22
|
import { PictureBarSection } from './PictureBarSection.js';
|
|
23
23
|
import { LogoBarSection } from './LogoBarSection.js';
|
|
24
|
-
import {
|
|
24
|
+
import { useActionState } from 'react';
|
|
25
25
|
import { updatePageAction } from '../../data/actions/pagebuilder-actions.js';
|
|
26
26
|
import { SubmitButton } from '../SubmitButton.js';
|
|
27
27
|
import { StrapiErrors } from '../StrapiErrors.js';
|
|
@@ -67,7 +67,7 @@ function PageBuilder({ data, }) {
|
|
|
67
67
|
return jsx("p", { children: "No sections found" });
|
|
68
68
|
}
|
|
69
69
|
const theme = useTheme();
|
|
70
|
-
const [formState, formAction] =
|
|
70
|
+
const [formState, formAction] = useActionState(updatePageAction, INITIAL_STATE);
|
|
71
71
|
return (jsx(Box, { sx: [
|
|
72
72
|
// You cannot spread `sx` directly because `SxProps` (typeof sx) can be an array.
|
|
73
73
|
...(Array.isArray(sx) ? sx : [sx]),
|
|
@@ -15,10 +15,9 @@ import TextField from '@mui/material/TextField';
|
|
|
15
15
|
import Typography from '@mui/material/Typography';
|
|
16
16
|
import Grid from '@mui/material/Grid';
|
|
17
17
|
import { SubmitButton } from '../SubmitButton.js';
|
|
18
|
-
import {
|
|
18
|
+
import React, { useActionState, useState } from 'react';
|
|
19
19
|
import { StrapiErrors } from '../StrapiErrors.js';
|
|
20
20
|
import { BusinessCredentialsFields } from '../e-commerce/customer/BusinessCredentials.js';
|
|
21
|
-
import React, { useState } from 'react';
|
|
22
21
|
import { AddressFields } from '../common/Address.js';
|
|
23
22
|
import { updatePublicInformationAction } from '../../data/actions/public-information/updatePublicInformationAction.js';
|
|
24
23
|
import SocialsDisplay, { SocialsFields } from '../common/socials/Socials.js';
|
|
@@ -34,7 +33,7 @@ const INITIAL_STATE = {
|
|
|
34
33
|
function PublicInformationForm({ publicInformation, sx, }) {
|
|
35
34
|
const { documentId, title, description, disclaimer_link, privacypolicy_link, maxWidth, email, phone_number, business_credentials, address, socials, header_logo, footer_logo, } = publicInformation;
|
|
36
35
|
console.log(socials);
|
|
37
|
-
const [formState, formAction] =
|
|
36
|
+
const [formState, formAction] = useActionState((prevState, formData) => updatePublicInformationAction(documentId, prevState, formData), INITIAL_STATE);
|
|
38
37
|
const [open, setOpen] = useState([]);
|
|
39
38
|
const onClickHandler = (event, name) => {
|
|
40
39
|
if (open.includes(name)) {
|
|
@@ -61,17 +60,17 @@ function PublicInformationForm({ publicInformation, sx, }) {
|
|
|
61
60
|
...(Array.isArray(sx) ? sx : [sx]),
|
|
62
61
|
], component: Paper, children: jsx("form", { action: formAction, children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { size: 12, children: jsx(Typography, { variant: "h5", children: "Edit Public Information" }) }), jsx(Grid, { size: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(TextField, { id: "title", name: "title", label: "Title", defaultValue: title }), jsx(TextField, { id: "description", name: "description", label: "Description", defaultValue: description }), jsx(TextField, { id: "email", name: "email", label: "email", defaultValue: email }), jsx(TextField, { id: "phone_number", name: "phone_number", label: "phone_number", defaultValue: phone_number })] }) }), jsx(Grid, { size: {
|
|
63
62
|
xs: 12,
|
|
64
|
-
lg: 6
|
|
63
|
+
lg: 6,
|
|
65
64
|
}, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h6", children: "Company Address" }), jsx(Divider, {}), jsx(AddressFields, { componentName: "address", componentReference: "common.address", data: address })] }) }), jsx(Grid, { size: {
|
|
66
65
|
xs: 12,
|
|
67
|
-
lg: 6
|
|
66
|
+
lg: 6,
|
|
68
67
|
}, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h6", children: "Business Credentials" }), jsx(Divider, {}), jsx(BusinessCredentialsFields, { componentName: "business_credentials", componentReference: "business.credentials", data: business_credentials })] }) }), jsx(Grid, { sx: { mt: 1 }, size: 12, children: jsx(Typography, { variant: "h6", children: "Socials" }) }), oldSocials.map((social, index) => {
|
|
69
68
|
if (social.data?.name) {
|
|
70
69
|
if (open.includes(social.data.name)) {
|
|
71
70
|
return (jsx(Grid, { size: {
|
|
72
71
|
xs: 12,
|
|
73
72
|
md: 6,
|
|
74
|
-
lg: 4
|
|
73
|
+
lg: 4,
|
|
75
74
|
}, children: jsx(SocialsFields, { data: social.data, componentName: `socials[${index}]`, componentReference: "common.social", deleteCallback: () => {
|
|
76
75
|
setOldSocials(oldSocials.filter((_, i) => i !== index));
|
|
77
76
|
/* setOpen(
|
|
@@ -83,7 +82,7 @@ function PublicInformationForm({ publicInformation, sx, }) {
|
|
|
83
82
|
return (jsxs(Grid, { size: {
|
|
84
83
|
xs: 12,
|
|
85
84
|
md: 6,
|
|
86
|
-
lg: 4
|
|
85
|
+
lg: 4,
|
|
87
86
|
}, children: [jsx("input", { type: "hidden", name: `socials[${index}].documentId`, value: social.data.documentId }), jsx("input", { type: "hidden", name: `socials[${index}].name`, value: social.data.name }), jsx("input", { type: "hidden", name: `socials[${index}].url`, value: social.data.url }), jsx("input", { type: "hidden", name: `socials[${index}].icon`, value: social.data.icon }), jsx(SocialsDisplay, { data: { ...social.data, onClick: onClickHandler } })] }, index));
|
|
88
87
|
}
|
|
89
88
|
}
|
|
@@ -92,7 +91,7 @@ function PublicInformationForm({ publicInformation, sx, }) {
|
|
|
92
91
|
return (jsx(Grid, { size: {
|
|
93
92
|
xs: 12,
|
|
94
93
|
md: 6,
|
|
95
|
-
lg: 4
|
|
94
|
+
lg: 4,
|
|
96
95
|
}, children: jsx(SocialsFields, { data: social.data, componentName: social.componentName, componentReference: "common.social", deleteCallback: () => {
|
|
97
96
|
setNewSocials(newSocials
|
|
98
97
|
.filter((_, i) => i !== index)
|
|
@@ -106,7 +105,7 @@ function PublicInformationForm({ publicInformation, sx, }) {
|
|
|
106
105
|
}), jsx(Grid, { justifyContent: "center", alignItems: "center", size: {
|
|
107
106
|
xs: 12,
|
|
108
107
|
md: 6,
|
|
109
|
-
lg: 4
|
|
108
|
+
lg: 4,
|
|
110
109
|
}, children: jsx(IconButton, { onClick: () => {
|
|
111
110
|
setNewSocials([
|
|
112
111
|
...newSocials,
|
|
@@ -30,5 +30,24 @@ async function getSingleProduct(documentId) {
|
|
|
30
30
|
});
|
|
31
31
|
return await fetchData(url.href);
|
|
32
32
|
}
|
|
33
|
+
async function getSingleProductBySlug(slug) {
|
|
34
|
+
unstable_noStore();
|
|
35
|
+
const url = new URL(`/api/slugify/slugs/product/${slug}`, baseUrl);
|
|
36
|
+
url.search = qs.stringify({
|
|
37
|
+
filters: {
|
|
38
|
+
is_archive: false,
|
|
39
|
+
},
|
|
40
|
+
populate: {
|
|
41
|
+
price: true,
|
|
42
|
+
image: true,
|
|
43
|
+
gallery: true,
|
|
44
|
+
dimensions: true,
|
|
45
|
+
categories: true,
|
|
46
|
+
brand: true,
|
|
47
|
+
vendors: true,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
return await fetchData(url.href);
|
|
51
|
+
}
|
|
33
52
|
|
|
34
|
-
export { getSingleProduct };
|
|
53
|
+
export { getSingleProduct, getSingleProductBySlug };
|
package/dist/esm/src/index.js
CHANGED
|
@@ -76,7 +76,7 @@ export { getSingleCategory } from './data/loaders/e-commerce/getSingleCategory.j
|
|
|
76
76
|
export { getTableProducts } from './data/loaders/e-commerce/getTableProducts.js';
|
|
77
77
|
export { getAllCategoryNames } from './data/loaders/e-commerce/getAllCategoryNames.js';
|
|
78
78
|
export { getPaginatedCategories } from './data/loaders/e-commerce/getPaginatedCategories.js';
|
|
79
|
-
export { getSingleProduct } from './data/loaders/e-commerce/getSingleProduct.js';
|
|
79
|
+
export { getSingleProduct, getSingleProductBySlug } from './data/loaders/e-commerce/getSingleProduct.js';
|
|
80
80
|
export { getAllCustomers } from './data/loaders/e-commerce/getAllCustomers.js';
|
|
81
81
|
export { getProductNames } from './data/loaders/e-commerce/getProductNames.js';
|
|
82
82
|
export { getAllInvoices } from './data/loaders/e-commerce/getAllInvoices.js';
|