umwd-components 0.1.732 → 0.1.733

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/cjs/src/components/common/Address.js +1 -1
  2. package/dist/cjs/src/components/e-commerce/customer/CustomerProfileEditForm.js +1 -1
  3. package/dist/cjs/src/components/e-commerce/enduser/EnduserProfileEditForm.js +1 -1
  4. package/dist/cjs/src/components/logistics/dispatcher/DispatcherProfileEditForm.js +1 -1
  5. package/dist/cjs/src/components/logistics/vendor/EditVendorForm.js +1 -1
  6. package/dist/cjs/src/components/public-information/PublicInformationForm.js +1 -1
  7. package/dist/cjs/src/data/actions/e-commerce/product/updateProductAction.js +1 -1
  8. package/dist/cjs/src/data/actions/logistics/vendor/updateVendorAction.js +1 -1
  9. package/dist/cjs/src/data/actions/media/uploadBase64MediaAction.js +1 -1
  10. package/dist/cjs/src/data/actions/pagebuilder-actions.js +1 -1
  11. package/dist/cjs/src/data/actions/profile-actions.js +1 -1
  12. package/dist/cjs/src/data/actions/public-information/updatePublicInformationAction.js +1 -1
  13. package/dist/cjs/src/data/loaders/logistics/getIpoNames.js +1 -1
  14. package/dist/cjs/src/data/loaders/logistics/getVendorNames.js +1 -1
  15. package/dist/cjs/src/data/loaders/logistics/queryAllIpos.js +1 -1
  16. package/dist/cjs/src/data/loaders/logistics/queryAllVendors.js +1 -1
  17. package/dist/cjs/src/data/loaders/page-elements/getSinglePage.js +1 -1
  18. package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
  19. package/dist/esm/src/components/common/Address.js +4 -4
  20. package/dist/esm/src/components/e-commerce/customer/CustomerProfileEditForm.js +4 -3
  21. package/dist/esm/src/components/e-commerce/enduser/EnduserProfileEditForm.js +2 -2
  22. package/dist/esm/src/components/logistics/dispatcher/DispatcherProfileEditForm.js +2 -2
  23. package/dist/esm/src/components/logistics/vendor/EditVendorForm.js +76 -77
  24. package/dist/esm/src/components/public-information/PublicInformationForm.js +42 -42
  25. package/dist/esm/src/data/actions/e-commerce/enduser/profile-actions.js +2 -2
  26. package/dist/esm/src/data/actions/e-commerce/product/updateProductAction.js +0 -2
  27. package/dist/esm/src/data/actions/logistics/dispatcher/profile-actions.js +2 -2
  28. package/dist/esm/src/data/actions/logistics/vendor/updateVendorAction.js +2 -2
  29. package/dist/esm/src/data/actions/media/uploadBase64MediaAction.js +3 -3
  30. package/dist/esm/src/data/actions/pagebuilder-actions.js +3 -3
  31. package/dist/esm/src/data/actions/profile-actions.js +3 -3
  32. package/dist/esm/src/data/actions/public-information/updatePublicInformationAction.js +2 -5
  33. package/dist/esm/src/data/loaders/logistics/getIpoNames.js +1 -1
  34. package/dist/esm/src/data/loaders/logistics/getVendorNames.js +1 -1
  35. package/dist/esm/src/data/loaders/logistics/queryAllIpos.js +0 -1
  36. package/dist/esm/src/data/loaders/logistics/queryAllVendors.js +0 -1
  37. package/dist/esm/src/data/loaders/page-elements/getSinglePage.js +0 -1
  38. package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
  39. package/dist/esm/types/data/actions/e-commerce/checkout-action.d.ts +2 -1
  40. package/dist/esm/types/data/actions/e-commerce/enduser/profile-actions.d.ts +2 -1
  41. package/dist/esm/types/data/actions/logistics/dispatcher/profile-actions.d.ts +2 -1
  42. package/dist/esm/types/data/actions/logistics/vendor/updateVendorAction.d.ts +1 -1
  43. package/dist/esm/types/data/actions/media/uploadBase64MediaAction.d.ts +1 -1
  44. package/dist/esm/types/data/actions/pagebuilder-actions.d.ts +3 -3
  45. package/dist/esm/types/data/actions/profile-actions.d.ts +1 -1
  46. package/dist/esm/types/data/actions/public-information/updatePublicInformationAction.d.ts +1 -1
  47. package/dist/esm/types/data/loaders/page-elements/getSinglePage.d.ts +2 -1
  48. package/dist/esm/types/types/AddressProps.d.ts +1 -1
  49. package/dist/esm/types/types/e-commerce/customer/types.d.ts +1 -1
  50. package/dist/esm/types/types/e-commerce/enduser/types.d.ts +1 -1
  51. package/dist/esm/types/types/logistics/Note.d.ts +1 -1
  52. package/dist/esm/types/types/logistics/dispatcher/types.d.ts +1 -1
  53. package/dist/esm/types/types/public-information/types.d.ts +1 -1
  54. package/package.json +1 -1
@@ -13,11 +13,11 @@ import Typography from '@mui/material/Typography';
13
13
  import HomeIcon from '@mui/icons-material/Home';
14
14
 
15
15
  function Address({ data }) {
16
- const { id, street, street_number, street_number_addition, postal_code, city, } = data;
16
+ const { documentId, street, street_number, street_number_addition, postal_code, city, } = data;
17
17
  return (jsx(Stack, { children: jsxs(Stack, { spacing: 2, direction: "row", children: [jsx(HomeIcon, {}), jsxs(Stack, { children: [jsxs(Typography, { variant: "body1", component: "p", children: [street, " ", street_number, " ", street_number_addition] }), jsxs(Typography, { variant: "body1", component: "p", children: [postal_code, " ", city] })] })] }) }));
18
18
  }
19
19
  function AddressFields({ data, componentName, componentReference, disabled = false, onChangeCallback, }) {
20
- const { id, street: initialStreet, street_number: initialStreetNumber, street_number_addition: initialStreetNumberAddition, postal_code: initialPostalCode, city: initialCity, } = data || {};
20
+ const { documentId, street: initialStreet, street_number: initialStreetNumber, street_number_addition: initialStreetNumberAddition, postal_code: initialPostalCode, city: initialCity, } = data || {};
21
21
  const [street, setStreet] = useState(initialStreet || "");
22
22
  const [streetNumber, setStreetNumber] = useState(initialStreetNumber || "");
23
23
  const [streetNumberAddition, setStreetNumberAddition] = useState(initialStreetNumberAddition || "");
@@ -39,7 +39,7 @@ function AddressFields({ data, componentName, componentReference, disabled = fal
39
39
  useEffect(() => {
40
40
  if (onChangeCallback) {
41
41
  onChangeCallback({
42
- id: id || null,
42
+ documentId: documentId || null,
43
43
  street,
44
44
  street_number: streetNumber,
45
45
  street_number_addition: streetNumberAddition,
@@ -48,7 +48,7 @@ function AddressFields({ data, componentName, componentReference, disabled = fal
48
48
  });
49
49
  }
50
50
  }, [street, streetNumber, streetNumberAddition, postalCode, city]);
51
- return (jsxs(Stack, { spacing: 2, direction: "row", children: [jsx(HomeIcon, {}), jsxs(Stack, { spacing: 1, sx: { flex: 1 }, children: [jsx("input", { id: ``, type: "hidden", name: `${componentName}.__component`, value: componentReference }), id && (jsx("input", { id: ``, type: "hidden", name: `${componentName}.id`, value: id })), jsx(TextField, { id: "street", name: `${componentName}.street`, label: "Street", value: street, onChange: (e) => setStreet(e.target.value), disabled: disabled }), jsx(TextField, { id: "street_number", name: `${componentName}.street_number`, label: "Street Number", value: streetNumber, onChange: (e) => setStreetNumber(e.target.value), disabled: disabled }), jsx(TextField, { id: "street_number_addition", name: `${componentName}.street_number_addition`, label: "Street Number Addition", value: streetNumberAddition, onChange: (e) => setStreetNumberAddition(e.target.value), disabled: disabled }), jsx(TextField, { id: "postal_code", name: `${componentName}.postal_code`, label: "Postal Code", value: postalCode, onChange: (e) => setPostalCode(e.target.value), disabled: disabled }), jsx(TextField, { id: "city", name: `${componentName}.city`, label: "City", value: city, onChange: (e) => setCity(e.target.value), disabled: disabled })] })] }));
51
+ return (jsxs(Stack, { spacing: 2, direction: "row", children: [jsx(HomeIcon, {}), jsxs(Stack, { spacing: 1, sx: { flex: 1 }, children: [jsx("input", { id: ``, type: "hidden", name: `${componentName}.__component`, value: componentReference }), documentId && (jsx("input", { id: ``, type: "hidden", name: `${componentName}.documentId`, value: documentId })), jsx(TextField, { id: "street", name: `${componentName}.street`, label: "Street", value: street, onChange: (e) => setStreet(e.target.value), disabled: disabled }), jsx(TextField, { id: "street_number", name: `${componentName}.street_number`, label: "Street Number", value: streetNumber, onChange: (e) => setStreetNumber(e.target.value), disabled: disabled }), jsx(TextField, { id: "street_number_addition", name: `${componentName}.street_number_addition`, label: "Street Number Addition", value: streetNumberAddition, onChange: (e) => setStreetNumberAddition(e.target.value), disabled: disabled }), jsx(TextField, { id: "postal_code", name: `${componentName}.postal_code`, label: "Postal Code", value: postalCode, onChange: (e) => setPostalCode(e.target.value), disabled: disabled }), jsx(TextField, { id: "city", name: `${componentName}.city`, label: "City", value: city, onChange: (e) => setCity(e.target.value), disabled: disabled })] })] }));
52
52
  }
53
53
 
54
54
  export { AddressFields, Address as default };
@@ -44,8 +44,9 @@ const INITIAL_STATE = {
44
44
  business_credentials: BusinessCredentialsProps;
45
45
  } */
46
46
  function CustomerProfileEditForm({ data, sx, revalidateCallback, handleClose, }) {
47
- const { id, uuid, customer_number, first_name, last_name, email, phone, company_address, delivery_address, billing_address, business_credentials, } = data;
48
- const [formState, formAction] = useFormState(updateCustomerProfileAction, INITIAL_STATE);
47
+ const { documentId, uuid, customer_number, first_name, last_name, email, phone, company_address, delivery_address, billing_address, business_credentials, } = data;
48
+ const boundAction = updateCustomerProfileAction.bind(null, documentId);
49
+ const [formState, formAction] = useFormState(boundAction, INITIAL_STATE);
49
50
  const [withDeliveryAddress, setWithDeliveryAddress] = useState(typeof delivery_address !== "undefined" && delivery_address !== null);
50
51
  const [withBillingAddress, setWithBillingAddress] = useState(typeof billing_address !== "undefined" && billing_address !== null);
51
52
  const { refreshSession } = useSession();
@@ -71,7 +72,7 @@ function CustomerProfileEditForm({ data, sx, revalidateCallback, handleClose, })
71
72
  });
72
73
  }
73
74
  }, [formState?.strapiErrors]);
74
- return (jsx(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: jsx("form", { action: formAction, children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h3", component: "h1", children: "Edit Profile" }), jsx(Typography, { variant: "body2", children: "Update your personal and business information" })] }) }), jsxs(Grid, { item: true, xs: 12, children: [jsx("input", { type: "hidden", name: "id", value: id }), jsx(Typography, { variant: "h6", children: "Personal Details" }), jsx(Divider, {}), jsxs(Stack, { spacing: 2, sx: { mt: 2 }, children: [jsx(TextField, { id: "first_name", name: "first_name", label: "First Name", defaultValue: first_name }), jsx(TextField, { id: "last_name", name: "last_name", label: "Last Name", defaultValue: last_name }), jsx(TextField, { id: "email", name: "email", label: "Email", defaultValue: email, disabled: true }), jsx(TextField, { id: "phone", name: "phone", label: "Phone", defaultValue: phone })] })] }), jsxs(Grid, { item: true, xs: 12, children: [jsx(Typography, { variant: "h6", children: "Business Credentials" }), jsx(Divider, {}), jsx(Box, { sx: { mt: 2 }, children: jsx(BusinessCredentialsFields, { componentName: "business_credentials", componentReference: "business.credentials", data: business_credentials }) })] }), jsxs(Grid, { item: true, xs: 12, children: [jsx(Typography, { variant: "h6", children: "Company Address" }), jsx(Divider, {}), jsx(Box, { sx: { mt: 2 }, children: jsx(AddressFields, { componentName: "company_address", componentReference: "common.address", data: company_address }) })] }), jsxs(Grid, { item: true, xs: 12, children: [jsx(Typography, { variant: "h6", children: "Delivery Address" }), jsx(Divider, {}), jsxs(Stack, { spacing: 2, sx: { mt: 2 }, children: [jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [jsx(Checkbox, { value: withDeliveryAddress, checked: withDeliveryAddress, onChange: () => setWithDeliveryAddress(!withDeliveryAddress) }), jsx(Typography, { children: "Use a different address for delivery" })] }), withDeliveryAddress && (jsx(AddressFields, { componentName: "delivery_address", componentReference: "common.address", data: delivery_address }))] })] }), jsxs(Grid, { item: true, xs: 12, children: [jsx(Typography, { variant: "h6", children: "Billing Address" }), jsx(Divider, {}), jsxs(Stack, { spacing: 2, sx: { mt: 2 }, children: [jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [jsx(Checkbox, { value: withBillingAddress, checked: withBillingAddress, onChange: () => setWithBillingAddress(!withBillingAddress) }), jsx(Typography, { children: "Use a different address for billing" })] }), withBillingAddress && (jsx(AddressFields, { componentName: "billing_address", componentReference: "common.address", data: billing_address }))] })] }), jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { pt: 2 }, children: [handleClose && (jsx(Button, { onClick: handleClose, variant: "outlined", children: "Cancel" })), jsx(SubmitButton, { text: "Save changes", loadingText: "Saving...", variant: "contained" })] }) })] }) }) }));
75
+ return (jsx(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: jsx("form", { action: formAction, children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h3", component: "h1", children: "Edit Profile" }), jsx(Typography, { variant: "body2", children: "Update your personal and business information" })] }) }), jsxs(Grid, { item: true, xs: 12, children: [jsx(Typography, { variant: "h6", children: "Personal Details" }), jsx(Divider, {}), jsxs(Stack, { spacing: 2, sx: { mt: 2 }, children: [jsx(TextField, { id: "first_name", name: "first_name", label: "First Name", defaultValue: first_name }), jsx(TextField, { id: "last_name", name: "last_name", label: "Last Name", defaultValue: last_name }), jsx(TextField, { id: "email", name: "email", label: "Email", defaultValue: email, disabled: true }), jsx(TextField, { id: "phone", name: "phone", label: "Phone", defaultValue: phone })] })] }), jsxs(Grid, { item: true, xs: 12, children: [jsx(Typography, { variant: "h6", children: "Business Credentials" }), jsx(Divider, {}), jsx(Box, { sx: { mt: 2 }, children: jsx(BusinessCredentialsFields, { componentName: "business_credentials", componentReference: "business.credentials", data: business_credentials }) })] }), jsxs(Grid, { item: true, xs: 12, children: [jsx(Typography, { variant: "h6", children: "Company Address" }), jsx(Divider, {}), jsx(Box, { sx: { mt: 2 }, children: jsx(AddressFields, { componentName: "company_address", componentReference: "common.address", data: company_address }) })] }), jsxs(Grid, { item: true, xs: 12, children: [jsx(Typography, { variant: "h6", children: "Delivery Address" }), jsx(Divider, {}), jsxs(Stack, { spacing: 2, sx: { mt: 2 }, children: [jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [jsx(Checkbox, { value: withDeliveryAddress, checked: withDeliveryAddress, onChange: () => setWithDeliveryAddress(!withDeliveryAddress) }), jsx(Typography, { children: "Use a different address for delivery" })] }), withDeliveryAddress && (jsx(AddressFields, { componentName: "delivery_address", componentReference: "common.address", data: delivery_address }))] })] }), jsxs(Grid, { item: true, xs: 12, children: [jsx(Typography, { variant: "h6", children: "Billing Address" }), jsx(Divider, {}), jsxs(Stack, { spacing: 2, sx: { mt: 2 }, children: [jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [jsx(Checkbox, { value: withBillingAddress, checked: withBillingAddress, onChange: () => setWithBillingAddress(!withBillingAddress) }), jsx(Typography, { children: "Use a different address for billing" })] }), withBillingAddress && (jsx(AddressFields, { componentName: "billing_address", componentReference: "common.address", data: billing_address }))] })] }), jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { pt: 2 }, children: [handleClose && (jsx(Button, { onClick: handleClose, variant: "outlined", children: "Cancel" })), jsx(SubmitButton, { text: "Save changes", loadingText: "Saving...", variant: "contained" })] }) })] }) }) }));
75
76
  }
76
77
 
77
78
  export { CustomerProfileEditForm as default };
@@ -30,8 +30,8 @@ const INITIAL_STATE = {
30
30
  severity: null,
31
31
  };
32
32
  function EnduserProfileEditForm({ data, sx, revalidateCallback, handleClose, }) {
33
- const { id, first_name, last_name, email, phone } = data;
34
- const boundAction = updateEnduserProfileAction.bind(null, parseInt(id));
33
+ const { documentId, first_name, last_name, email, phone } = data;
34
+ const boundAction = updateEnduserProfileAction.bind(null, documentId);
35
35
  const [formState, formAction] = useFormState(boundAction, INITIAL_STATE);
36
36
  const { handleAddMessage } = useSnackbar();
37
37
  const { refreshSession } = useSession();
@@ -34,8 +34,8 @@ const INITIAL_STATE = {
34
34
  severity: null,
35
35
  };
36
36
  function DispatcherProfileEditForm({ data, sx, revalidateCallback, handleClose, }) {
37
- const { id, first_name, last_name, email, phone, company_address, business_credentials, } = data;
38
- const boundAction = updateDispatcherProfileAction.bind(null, parseInt(id));
37
+ const { documentId, first_name, last_name, email, phone, company_address, business_credentials, } = data;
38
+ const boundAction = updateDispatcherProfileAction.bind(null, documentId);
39
39
  const [formState, formAction] = useFormState(boundAction, INITIAL_STATE);
40
40
  const { handleAddMessage } = useSnackbar();
41
41
  const { refreshSession } = useSession();
@@ -37,8 +37,7 @@ const INITIAL_STATE = {
37
37
  };
38
38
  function EditVendorForm({ data, productNamesArr, revalidateCallback, handleClose, sx, }) {
39
39
  const { documentId, website_url, phone_number, email, business_credentials, address, products, contacts, notes, } = data;
40
- console.log("data", data);
41
- const [formState, formAction] = useFormState(updateVendorAction, INITIAL_STATE);
40
+ const [formState, formAction] = useFormState((prevState, formData) => updateVendorAction(documentId, prevState, formData), INITIAL_STATE);
42
41
  const { handleAddMessage } = useSnackbar();
43
42
  useEffect(() => {
44
43
  if (formState?.message) {
@@ -81,71 +80,50 @@ function EditVendorForm({ data, productNamesArr, revalidateCallback, handleClose
81
80
  // INFO must utilize the uuid to ensure that the new contacts are unique
82
81
  // this is important to use both the deleteCallback and still not have problems with the key
83
82
  const [newContacts, setNewContacts] = useState([]);
84
- return (jsx(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: jsxs("form", { action: formAction, children: [documentId && (jsx("input", { id: "id", type: "hidden", name: "id", value: documentId })), jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { direction: "row", justifyContent: "space-between", children: [jsx(Typography, { variant: "h5", children: "Edit Vendor" }), jsx(NoteTakingComponent, { content: "", related: [
85
- {
86
- id: data.documentId,
87
- __type: "api::logistics.vendor-profile",
88
- },
89
- ], revalidateCallback: revalidateCallback })] }) }), jsx(Grid, { item: true, xs: 12, children: jsx(ExplanatoryFoldOut, { title: "Vendor", description: "Vendors are businesses that you purchase products from." }) }), jsx(Grid, { item: true, xs: 12, md: 6, children: jsx(BusinessCredentialsFields, { data: business_credentials, componentName: "business_credentials", componentReference: "common.business-credentials" }) }), jsx(Grid, { item: true, xs: 12, md: 6, 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, { item: true, xs: 12, md: 6, children: [jsx(Typography, { variant: "h6", children: "Address" }), jsx(AddressFields, { data: address, componentName: "address", componentReference: "common.address" })] }), jsxs(Grid, { item: true, xs: 12, sx: { mt: 1 }, children: [jsx(Typography, { variant: "h6", children: "Products" }), jsx(ProductSelector, { productNames: productNamesArr, currentValue: initialProducts.map((prod) => prod.documentId) })] }), jsx(Grid, { item: true, xs: 12, sx: { mt: 1 }, children: jsx(Typography, { variant: "h6", children: "Contacts" }) }), oldContacts?.map((contact, index) => {
90
- if (contact.data?.id) {
91
- if (open.includes(contact.data?.id)) {
92
- return (jsx(Grid, { item: true, xs: 12, sm: 6, md: 4, lg: 3, sx: {
93
- justifyContent: "center",
83
+ return (jsx(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: jsx("form", { action: formAction, children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { direction: "row", justifyContent: "space-between", children: [jsx(Typography, { variant: "h5", children: "Edit Vendor" }), jsx(NoteTakingComponent, { content: "", related: [
84
+ {
85
+ id: data.documentId,
86
+ __type: "api::logistics.vendor-profile",
87
+ },
88
+ ], revalidateCallback: revalidateCallback })] }) }), jsx(Grid, { item: true, xs: 12, children: jsx(ExplanatoryFoldOut, { title: "Vendor", description: "Vendors are businesses that you purchase products from." }) }), jsx(Grid, { item: true, xs: 12, md: 6, children: jsx(BusinessCredentialsFields, { data: business_credentials, componentName: "business_credentials", componentReference: "common.business-credentials" }) }), jsx(Grid, { item: true, xs: 12, md: 6, 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, { item: true, xs: 12, md: 6, children: [jsx(Typography, { variant: "h6", children: "Address" }), jsx(AddressFields, { data: address, componentName: "address", componentReference: "common.address" })] }), jsxs(Grid, { item: true, xs: 12, sx: { mt: 1 }, children: [jsx(Typography, { variant: "h6", children: "Products" }), jsx(ProductSelector, { productNames: productNamesArr, currentValue: initialProducts.map((prod) => prod.documentId) })] }), jsx(Grid, { item: true, xs: 12, sx: { mt: 1 }, children: jsx(Typography, { variant: "h6", children: "Contacts" }) }), oldContacts?.map((contact, index) => {
89
+ if (contact.data?.id) {
90
+ if (open.includes(contact.data?.id)) {
91
+ return (jsx(Grid, { item: true, xs: 12, sm: 6, md: 4, lg: 3, sx: {
92
+ justifyContent: "center",
93
+ display: "flex",
94
+ alignItems: "center",
95
+ }, children: jsx(Paper, { sx: {
96
+ p: 2,
97
+ width: "100%",
94
98
  display: "flex",
95
- alignItems: "center",
96
- }, children: jsx(Paper, { sx: {
97
- p: 2,
98
- width: "100%",
99
- display: "flex",
100
- justifyContent: "center",
101
- alignItems: "center",
102
- height: "100%",
103
- }, children: jsx(ContactsFields, { data: contact.data, componentName: `contacts[${index}]`, componentReference: "logistics-elements.contact", deleteCallback: () => {
104
- setOldContacts(oldContacts.filter((_, i) => i !== index));
105
- /* setOpen(
106
- open.filter((openId) => openId !== contact.data?.id)
107
- ); */
108
- } }) }) }, contact.data.id));
109
- }
110
- else {
111
- return (jsx(Grid, { item: true, xs: 12, sm: 6, md: 4, lg: 3, sx: {
112
99
  justifyContent: "center",
113
- display: "flex",
114
100
  alignItems: "center",
115
- }, children: jsxs(Paper, { sx: {
116
- p: 2,
117
- width: "100%",
118
- display: "flex",
119
- justifyContent: "center",
120
- alignItems: "center",
121
- height: "100%",
122
- }, children: [jsx("input", { type: "hidden", name: `contacts[${index}].id`, value: contact.data.id }), jsx("input", { type: "hidden", name: `contacts[${index}].__component`, value: "logistics-elements.contact" }), jsx(Contacts, { data: { ...contact.data, onClick: onClickHandler } })] }) }, contact.data.id));
123
- }
101
+ height: "100%",
102
+ }, children: jsx(ContactsFields, { data: contact.data, componentName: `contacts[${index}]`, componentReference: "logistics-elements.contact", deleteCallback: () => {
103
+ setOldContacts(oldContacts.filter((_, i) => i !== index));
104
+ /* setOpen(
105
+ open.filter((openId) => openId !== contact.data?.id)
106
+ ); */
107
+ } }) }) }, contact.data.id));
124
108
  }
125
- return null;
126
- }), newContacts.map((contact, index) => {
127
- return (jsx(Grid, { item: true, xs: 12, sm: 6, md: 4, lg: 3, sx: {
128
- justifyContent: "center",
129
- display: "flex",
130
- alignItems: "center",
131
- }, children: jsx(Paper, { sx: {
132
- p: 2,
133
- width: "100%",
134
- display: "flex",
109
+ else {
110
+ return (jsx(Grid, { item: true, xs: 12, sm: 6, md: 4, lg: 3, sx: {
135
111
  justifyContent: "center",
112
+ display: "flex",
136
113
  alignItems: "center",
137
- height: "100%",
138
- }, children: jsx(ContactsFields, { data: contact.data, componentName: contact.componentName, componentReference: "logistics-elements.contact", deleteCallback: () => {
139
- setNewContacts(newContacts
140
- .filter((_, i) => i !== index)
141
- .map((_, i) => {
142
- return {
143
- ..._,
144
- componentName: `contacts[${i + oldContacts.length}]`,
145
- };
146
- }));
147
- } }) }) }, contact.data?.id || index));
148
- }), jsx(Grid, { item: true, xs: 12, sm: 6, md: 4, lg: 3, sx: {
114
+ }, children: jsxs(Paper, { sx: {
115
+ p: 2,
116
+ width: "100%",
117
+ display: "flex",
118
+ justifyContent: "center",
119
+ alignItems: "center",
120
+ height: "100%",
121
+ }, children: [jsx("input", { type: "hidden", name: `contacts[${index}].id`, value: contact.data.id }), jsx("input", { type: "hidden", name: `contacts[${index}].__component`, value: "logistics-elements.contact" }), jsx(Contacts, { data: { ...contact.data, onClick: onClickHandler } })] }) }, contact.data.id));
122
+ }
123
+ }
124
+ return null;
125
+ }), newContacts.map((contact, index) => {
126
+ return (jsx(Grid, { item: true, xs: 12, sm: 6, md: 4, lg: 3, sx: {
149
127
  justifyContent: "center",
150
128
  display: "flex",
151
129
  alignItems: "center",
@@ -156,23 +134,44 @@ function EditVendorForm({ data, productNamesArr, revalidateCallback, handleClose
156
134
  justifyContent: "center",
157
135
  alignItems: "center",
158
136
  height: "100%",
159
- }, children: jsx(Button, { variant: "contained", startIcon: jsx(AddIcon, {}), onClick: () => {
160
- setNewContacts([
161
- ...newContacts,
162
- {
163
- componentName: `contacts[${oldContacts.length + newContacts.length}]`,
164
- componentReference: "logistics-elements.contact",
165
- data: {
166
- uuid: Math.random(),
167
- first_name: "",
168
- last_name: "",
169
- email: "",
170
- phone_number: "",
171
- type: ContactType.Other,
172
- },
137
+ }, children: jsx(ContactsFields, { data: contact.data, componentName: contact.componentName, componentReference: "logistics-elements.contact", deleteCallback: () => {
138
+ setNewContacts(newContacts
139
+ .filter((_, i) => i !== index)
140
+ .map((_, i) => {
141
+ return {
142
+ ..._,
143
+ componentName: `contacts[${i + oldContacts.length}]`,
144
+ };
145
+ }));
146
+ } }) }) }, contact.data?.id || index));
147
+ }), jsx(Grid, { item: true, xs: 12, sm: 6, md: 4, lg: 3, sx: {
148
+ justifyContent: "center",
149
+ display: "flex",
150
+ alignItems: "center",
151
+ }, children: jsx(Paper, { sx: {
152
+ p: 2,
153
+ width: "100%",
154
+ display: "flex",
155
+ justifyContent: "center",
156
+ alignItems: "center",
157
+ height: "100%",
158
+ }, children: jsx(Button, { variant: "contained", startIcon: jsx(AddIcon, {}), onClick: () => {
159
+ setNewContacts([
160
+ ...newContacts,
161
+ {
162
+ componentName: `contacts[${oldContacts.length + newContacts.length}]`,
163
+ componentReference: "logistics-elements.contact",
164
+ data: {
165
+ uuid: Math.random(),
166
+ first_name: "",
167
+ last_name: "",
168
+ email: "",
169
+ phone_number: "",
170
+ type: ContactType.Other,
173
171
  },
174
- ]);
175
- }, size: "large", children: "Add contact" }) }) }), jsxs(Grid, { item: true, xs: 12, children: [jsx(Typography, { variant: "h6", children: "Notes" }), notes?.data !== undefined ? (jsx(NotesDisplay, { notes: notes.data })) : (jsx(Typography, { children: "No notes to display" }))] }), " ", jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { direction: "row", spacing: 2, justifyContent: "space-between", alignItems: "center", sx: { mt: 2 }, children: [handleClose && (jsx(Button, { onClick: handleClose, variant: "outlined", children: "Cancel" })), jsx(SubmitButton, { text: "Update Vendor", loadingText: "Updating..." })] }) })] })] }) }));
172
+ },
173
+ ]);
174
+ }, size: "large", children: "Add contact" }) }) }), jsxs(Grid, { item: true, xs: 12, children: [jsx(Typography, { variant: "h6", children: "Notes" }), notes?.data !== undefined ? (jsx(NotesDisplay, { notes: notes.data })) : (jsx(Typography, { children: "No notes to display" }))] }), " ", jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { direction: "row", spacing: 2, justifyContent: "space-between", alignItems: "center", sx: { mt: 2 }, children: [handleClose && (jsx(Button, { onClick: handleClose, variant: "outlined", children: "Cancel" })), jsx(SubmitButton, { text: "Update Vendor", loadingText: "Updating..." })] }) })] }) }) }));
176
175
  }
177
176
 
178
177
  export { EditVendorForm };
@@ -32,8 +32,8 @@ const INITIAL_STATE = {
32
32
  message: null,
33
33
  };
34
34
  function PublicInformationForm({ publicInformation, sx, }) {
35
- const { id, title, description, disclaimer_link, privacypolicy_link, maxWidth, email, phone_number, business_credentials, address, socials, header_logo, footer_logo, } = publicInformation;
36
- const [formState, formAction] = useFormState(updatePublicInformationAction, INITIAL_STATE);
35
+ const { documentId, title, description, disclaimer_link, privacypolicy_link, maxWidth, email, phone_number, business_credentials, address, socials, header_logo, footer_logo, } = publicInformation;
36
+ const [formState, formAction] = useFormState((prevState, formData) => updatePublicInformationAction(documentId, prevState, formData), INITIAL_STATE);
37
37
  const [open, setOpen] = useState([]);
38
38
  const onClickHandler = (event, id) => {
39
39
  if (open.includes(id)) {
@@ -58,48 +58,48 @@ function PublicInformationForm({ publicInformation, sx, }) {
58
58
  // You cannot spread `sx` directly because `SxProps` (typeof sx) can be an array.
59
59
  { p: 2 },
60
60
  ...(Array.isArray(sx) ? sx : [sx]),
61
- ], component: Paper, children: jsxs("form", { action: formAction, children: [id && jsx("input", { id: "id", type: "hidden", name: "id", value: id }), jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { item: true, xs: 12, children: jsx(Typography, { variant: "h5", children: "Edit Public Information" }) }), jsx(Grid, { item: true, xs: 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, { item: true, xs: 12, lg: 6, 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, { item: true, xs: 12, lg: 6, 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, { item: true, xs: 12, sx: { mt: 1 }, children: jsx(Typography, { variant: "h6", children: "Socials" }) }), oldSocials.map((social, index) => {
62
- if (social.data?.id) {
63
- if (open.includes(social.data?.id)) {
64
- return (jsx(Grid, { item: true, xs: 12, md: 6, lg: 4, children: jsx(SocialsFields, { data: social.data, componentName: `socials[${index}]`, componentReference: "common.social", deleteCallback: () => {
65
- setOldSocials(oldSocials.filter((_, i) => i !== index));
66
- /* setOpen(
67
- open.filter((openId) => openId !== social.data?.id)
68
- ); */
69
- } }) }, social.data.id));
70
- }
71
- else {
72
- return (jsxs(Grid, { item: true, xs: 12, md: 6, lg: 4, children: [jsx("input", { type: "hidden", name: `socials[${index}].id`, value: social.data.id }), jsx("input", { type: "hidden", name: `socials[${index}].__component`, value: "logistics-elements.social" }), jsx(SocialsDisplay, { data: { ...social.data, onClick: onClickHandler } })] }, social.data.id));
73
- }
61
+ ], component: Paper, children: jsx("form", { action: formAction, children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { item: true, xs: 12, children: jsx(Typography, { variant: "h5", children: "Edit Public Information" }) }), jsx(Grid, { item: true, xs: 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, { item: true, xs: 12, lg: 6, 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, { item: true, xs: 12, lg: 6, 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, { item: true, xs: 12, sx: { mt: 1 }, children: jsx(Typography, { variant: "h6", children: "Socials" }) }), oldSocials.map((social, index) => {
62
+ if (social.data?.id) {
63
+ if (open.includes(social.data?.id)) {
64
+ return (jsx(Grid, { item: true, xs: 12, md: 6, lg: 4, children: jsx(SocialsFields, { data: social.data, componentName: `socials[${index}]`, componentReference: "common.social", deleteCallback: () => {
65
+ setOldSocials(oldSocials.filter((_, i) => i !== index));
66
+ /* setOpen(
67
+ open.filter((openId) => openId !== social.data?.id)
68
+ ); */
69
+ } }) }, social.data.id));
74
70
  }
75
- return null;
76
- }), newSocials.map((social, index) => {
77
- return (jsx(Grid, { item: true, xs: 12, md: 6, lg: 4, children: jsx(SocialsFields, { data: social.data, componentName: social.componentName, componentReference: "common.social", deleteCallback: () => {
78
- setNewSocials(newSocials
79
- .filter((_, i) => i !== index)
80
- .map((_, i) => {
81
- return {
82
- ..._,
83
- componentName: `socials[${i + oldSocials.length}]`,
84
- };
85
- }));
86
- } }) }, social.data?.uuid));
87
- }), jsx(Grid, { item: true, xs: 12, md: 6, lg: 4, justifyContent: "center", alignItems: "center", children: jsx(IconButton, { onClick: () => {
88
- setNewSocials([
89
- ...newSocials,
90
- {
91
- componentName: `socials[${oldSocials.length + newSocials.length}]`,
92
- componentReference: "logistics-elements.social",
93
- data: {
94
- uuid: Math.random(),
95
- name: "",
96
- url: "",
97
- },
71
+ else {
72
+ return (jsxs(Grid, { item: true, xs: 12, md: 6, lg: 4, children: [jsx("input", { type: "hidden", name: `socials[${index}].id`, value: social.data.id }), jsx("input", { type: "hidden", name: `socials[${index}].__component`, value: "logistics-elements.social" }), jsx(SocialsDisplay, { data: { ...social.data, onClick: onClickHandler } })] }, social.data.id));
73
+ }
74
+ }
75
+ return null;
76
+ }), newSocials.map((social, index) => {
77
+ return (jsx(Grid, { item: true, xs: 12, md: 6, lg: 4, children: jsx(SocialsFields, { data: social.data, componentName: social.componentName, componentReference: "common.social", deleteCallback: () => {
78
+ setNewSocials(newSocials
79
+ .filter((_, i) => i !== index)
80
+ .map((_, i) => {
81
+ return {
82
+ ..._,
83
+ componentName: `socials[${i + oldSocials.length}]`,
84
+ };
85
+ }));
86
+ } }) }, social.data?.uuid));
87
+ }), jsx(Grid, { item: true, xs: 12, md: 6, lg: 4, justifyContent: "center", alignItems: "center", children: jsx(IconButton, { onClick: () => {
88
+ setNewSocials([
89
+ ...newSocials,
90
+ {
91
+ componentName: `socials[${oldSocials.length + newSocials.length}]`,
92
+ componentReference: "logistics-elements.social",
93
+ data: {
94
+ uuid: Math.random(),
95
+ name: "",
96
+ url: "",
98
97
  },
99
- ]);
100
- }, children: jsx(AddIcon, {}) }) }), jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { direction: "row-reverse", spacing: 2, alignItems: "center", sx: {
101
- py: 1,
102
- }, children: [jsx(SubmitButton, { text: "save changes", loadingText: "loading" }), formState?.strapiErrors && (jsx(StrapiErrors, { error: formState?.strapiErrors })), formState?.message && (jsx(Alert, { severity: "error", children: formState?.message }))] }) })] })] }) }));
98
+ },
99
+ ]);
100
+ }, children: jsx(AddIcon, {}) }) }), jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { direction: "row-reverse", spacing: 2, alignItems: "center", sx: {
101
+ py: 1,
102
+ }, children: [jsx(SubmitButton, { text: "save changes", loadingText: "loading" }), formState?.strapiErrors && (jsx(StrapiErrors, { error: formState?.strapiErrors })), formState?.message && (jsx(Alert, { severity: "error", children: formState?.message }))] }) })] }) }) }));
103
103
  }
104
104
 
105
105
  export { PublicInformationForm };
@@ -9,9 +9,9 @@ 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 updateEnduserProfileAction(id, prevState, formData) {
12
+ async function updateEnduserProfileAction(documentId, prevState, formData) {
13
13
  const parsedFormData = parseFormData(formData);
14
- const responseData = await mutateData("PUT", `/api/enduser-profiles/${id}`, parsedFormData);
14
+ const responseData = await mutateData("PUT", `/api/enduser-profiles/${documentId}`, parsedFormData);
15
15
  if (!responseData) {
16
16
  return {
17
17
  ...prevState,
@@ -11,7 +11,6 @@ import { parseFormData } from '../../../../lib/parseFormData.js';
11
11
  async function updateProductAction(documentId, prevState, formData) {
12
12
  Object.fromEntries(formData);
13
13
  const parsedFormData = parseFormData(formData);
14
- console.log("parsedFormData", parsedFormData);
15
14
  /**
16
15
  * INFO: The categories are JSONStringyfied in the frontend to add them to the hidden input
17
16
  * in categorySelector.tsx but they should be parsed before sending them to the backend
@@ -30,7 +29,6 @@ async function updateProductAction(documentId, prevState, formData) {
30
29
  parsedFormData.data.stock_reports = JSON.parse(parsedFormData.data.stock_reports);
31
30
  }
32
31
  const responseData = await mutateData("PUT", `/api/products/${documentId}`, parsedFormData);
33
- console.log("responseData", responseData);
34
32
  if (!responseData) {
35
33
  return {
36
34
  ...prevState,
@@ -9,9 +9,9 @@ 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 updateDispatcherProfileAction(id, prevState, formData) {
12
+ async function updateDispatcherProfileAction(documentId, prevState, formData) {
13
13
  const parsedFormData = parseFormData(formData);
14
- const responseData = await mutateData("PUT", `/api/dispatcher-profiles/${id}`, parsedFormData);
14
+ const responseData = await mutateData("PUT", `/api/dispatcher-profiles/${documentId}`, parsedFormData);
15
15
  if (!responseData) {
16
16
  return {
17
17
  ...prevState,
@@ -9,14 +9,14 @@ 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 updateVendorAction(prevState, formData) {
12
+ async function updateVendorAction(documentId, prevState, formData) {
13
13
  try {
14
14
  const rawFormData = Object.fromEntries(formData);
15
15
  const parsedFormData = parseFormData(formData);
16
16
  if (parsedFormData.data.products) {
17
17
  parsedFormData.data.products = JSON.parse(parsedFormData.data.products);
18
18
  }
19
- const responseData = await mutateData("PUT", `/api/vendor-profiles/${rawFormData.id}`, parsedFormData);
19
+ const responseData = await mutateData("PUT", `/api/vendor-profiles/${documentId}`, parsedFormData);
20
20
  if (!responseData) {
21
21
  return {
22
22
  ...prevState,
@@ -24,7 +24,7 @@ const fileSchema = z.object({
24
24
  )
25
25
  .refine((file) => file.size <= MAX_FILE_SIZE, `Max file size is 5MB.`), */
26
26
  });
27
- async function uploadBase64MediaAction(path, id, component_name, prevState, formData) {
27
+ async function uploadBase64MediaAction(path, documentId, component_name, prevState, formData) {
28
28
  // CONVERT FORM DATA TO OBJECT
29
29
  const rawFormData = Object.fromEntries(formData);
30
30
  parseFormData(formData);
@@ -43,7 +43,7 @@ async function uploadBase64MediaAction(path, id, component_name, prevState, form
43
43
  }
44
44
  // UPLOAD NEW IMAGE TO MEDIA LIBRARY
45
45
  // const fileUploadResponse = await fileUploadService(formData);
46
- const url = `${path}/${id}`;
46
+ const url = `${path}/${documentId}`;
47
47
  // const files = rawFormData.files;
48
48
  const files = formData.getAll("files");
49
49
  files
@@ -78,7 +78,7 @@ async function uploadBase64MediaAction(path, id, component_name, prevState, form
78
78
  }));
79
79
  const parsedData = {
80
80
  data: {
81
- id: id,
81
+ documentId: documentId,
82
82
  [component_name]: filesData[0],
83
83
  },
84
84
  };
@@ -10,7 +10,7 @@ import { formDataToBlocks } from '../../lib/utils.js';
10
10
  import { mutateData } from '../services/mutate-data.js';
11
11
 
12
12
  const schemaUpdate = z.object({
13
- id: z.string(),
13
+ documentId: z.string(),
14
14
  title: z.string().min(3).max(100, {
15
15
  message: "Title must be between 3 and 100 characters",
16
16
  }),
@@ -108,7 +108,7 @@ const schemaUpdate = z.object({
108
108
  async function updatePageAction(prevState, formData) {
109
109
  const newBlocks = formDataToBlocks(formData);
110
110
  const validatedFields = schemaUpdate.safeParse({
111
- id: formData.get("id"),
111
+ documentId: formData.get("documentId"),
112
112
  title: formData.get("title"),
113
113
  description: formData.get("description"),
114
114
  blocks: newBlocks,
@@ -123,7 +123,7 @@ async function updatePageAction(prevState, formData) {
123
123
  }
124
124
  const { data } = validatedFields;
125
125
  // important: the mutate data function expects an object (payload/body) with a data key
126
- const responseData = await mutateData("PUT", `/api/pages/${data.id}`, {
126
+ const responseData = await mutateData("PUT", `/api/pages/${data.documentId}`, {
127
127
  data: data,
128
128
  });
129
129
  if (!responseData) {
@@ -9,7 +9,7 @@ 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 updateCustomerProfileAction(prevState, formData) {
12
+ async function updateCustomerProfileAction(documentId, prevState, formData) {
13
13
  const rawFormData = Object.fromEntries(formData);
14
14
  const parsedFormData = parseFormData(formData);
15
15
  if (typeof parsedFormData.data.delivery_address === "undefined") {
@@ -18,8 +18,8 @@ async function updateCustomerProfileAction(prevState, formData) {
18
18
  if (typeof parsedFormData.data.billing_address === "undefined") {
19
19
  parsedFormData.data.billing_address = null;
20
20
  }
21
- const id = rawFormData.id;
22
- const responseData = await mutateData("PUT", `/api/customer-profiles/${id}`, parsedFormData);
21
+ rawFormData.id;
22
+ const responseData = await mutateData("PUT", `/api/customer-profiles/${documentId}`, parsedFormData);
23
23
  if (!responseData) {
24
24
  return {
25
25
  ...prevState,
@@ -10,15 +10,12 @@ import { flattenAttributes } from '../../../lib/utils.js';
10
10
  import { parseFormData } from '../../../lib/parseFormData.js';
11
11
 
12
12
  // TODO Not tested or finished
13
- async function updatePublicInformationAction(prevState, formData) {
13
+ async function updatePublicInformationAction(documentId, prevState, formData) {
14
14
  const rawFormData = Object.fromEntries(formData);
15
15
  console.log("rawFormData", rawFormData);
16
16
  const parsedFormData = parseFormData(formData); // ?? can i still use this or is it only for the pagebuilder form?
17
17
  console.log("parsedFormData", parsedFormData);
18
- rawFormData.id;
19
- // const validateRes = vatValidate("NL123456789B01");
20
- // console.log("validateRes", validateRes);
21
- const responseData = await mutateData("PUT", `/api/public-information`, parsedFormData);
18
+ const responseData = await mutateData("PUT", `/api/public-information/${documentId}`, parsedFormData);
22
19
  if (!responseData) {
23
20
  return {
24
21
  ...prevState,
@@ -14,7 +14,7 @@ const baseUrl = getStrapiURL();
14
14
  async function getIpoNames() {
15
15
  const url = new URL(`/api/ipos`, baseUrl);
16
16
  url.search = qs.stringify({
17
- fields: ["id", "ipo_number"],
17
+ fields: ["documentId", "ipo_number"],
18
18
  /* populate: {
19
19
  business_credentials: {
20
20
  fields: ["company_name", "business_entity_name"],
@@ -14,7 +14,7 @@ const baseUrl = getStrapiURL();
14
14
  async function getVendorNames() {
15
15
  const url = new URL(`/api/vendor-profiles`, baseUrl);
16
16
  url.search = qs.stringify({
17
- fields: ["id", "vendor_number"],
17
+ fields: ["documentId", "vendor_number"],
18
18
  populate: {
19
19
  business_credentials: {
20
20
  fields: ["company_name", "business_entity_name"],
@@ -13,7 +13,6 @@ const baseUrl = getStrapiURL();
13
13
  async function queryAllIpos(query) {
14
14
  unstable_noStore();
15
15
  const url = new URL(`/api/ipos`, baseUrl);
16
- console.log("query", query);
17
16
  url.search = query;
18
17
  const res = await fetchData(url.href);
19
18
  return res;
@@ -13,7 +13,6 @@ const baseUrl = getStrapiURL();
13
13
  async function queryAllVendors(query) {
14
14
  unstable_noStore();
15
15
  const url = new URL(`/api/vendor-profiles`, baseUrl);
16
- console.log("query", query);
17
16
  url.search = query;
18
17
  const res = await fetchData(url.href);
19
18
  return res;
@@ -12,7 +12,6 @@ import { unstable_noStore } from 'next/cache';
12
12
  const baseUrl = getStrapiURL();
13
13
  async function getSinglePage(slug) {
14
14
  unstable_noStore();
15
- console.log("getSinglePage", slug);
16
15
  if (!slug) {
17
16
  slug = "home";
18
17
  }