@mercurjs/admin 2.3.9-canary.2 → 2.3.9-canary.4

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 (35) hide show
  1. package/dist/{category-detail-NCT667Q5.js → category-detail-3O5R5ERZ.js} +1 -1
  2. package/dist/{chunk-PC2KYGGZ.js → chunk-2WC2HCAF.js} +18 -5
  3. package/dist/{chunk-BTHHPKCS.js → chunk-4PX63HUF.js} +31 -7
  4. package/dist/{chunk-7OFD2K5S.js → chunk-5GPXMPGI.js} +15 -3
  5. package/dist/{chunk-AUNBNATP.js → chunk-7V3JWYEO.js} +16 -2
  6. package/dist/{chunk-A6JWUPH5.js → chunk-BCGTBSGP.js} +2 -2
  7. package/dist/{chunk-H4ZFKIVQ.js → chunk-FGSYS2KD.js} +2 -2
  8. package/dist/{chunk-VI7SQHZW.js → chunk-LH4AV4VB.js} +40 -11
  9. package/dist/{chunk-EEVKZMQQ.js → chunk-NEUJTY2R.js} +22 -6
  10. package/dist/{chunk-YJBT2HTY.js → chunk-TWHVBX3P.js} +1 -1
  11. package/dist/{chunk-NHLKAUGR.js → chunk-UKVEQ24N.js} +446 -199
  12. package/dist/{chunk-DKRNK7LD.js → chunk-WAYBZLBI.js} +2 -2
  13. package/dist/{chunk-SNRPCOU4.js → chunk-ZASF7XBG.js} +57 -1
  14. package/dist/{chunk-XZ4GKMFM.js → chunk-ZEXGMG5L.js} +1 -1
  15. package/dist/{collection-detail-C2VHK6JM.js → collection-detail-SREJ5XM6.js} +1 -1
  16. package/dist/extension-targets.d.ts +45 -0
  17. package/dist/index.js +21 -21
  18. package/dist/{inventory-detail-4O53UJDE.js → inventory-detail-VUGZZMVT.js} +1 -1
  19. package/dist/{inventory-stock-3SDSWZ45.js → inventory-stock-FRETNM2W.js} +1 -1
  20. package/dist/{location-service-zone-shipping-option-create-PDEJJ6E3.js → location-service-zone-shipping-option-create-VZVSNB3W.js} +3 -3
  21. package/dist/{location-service-zone-shipping-option-pricing-JZAQVSGB.js → location-service-zone-shipping-option-pricing-CTDN4AEZ.js} +2 -2
  22. package/dist/{offer-detail-page-4U4PPA7Q.js → offer-detail-page-SFMQXRGK.js} +16 -3
  23. package/dist/{offer-variant-detail-page-4ZDMBL4R.js → offer-variant-detail-page-MG6QWFMT.js} +1 -1
  24. package/dist/pages/index.d.ts +10 -0
  25. package/dist/pages/index.js +12 -12
  26. package/dist/{price-list-create-R2JDXJRG.js → price-list-create-K4NOZFAS.js} +3 -3
  27. package/dist/{price-list-prices-add-Q7UR2HAT.js → price-list-prices-add-63TWHUTG.js} +3 -3
  28. package/dist/{price-list-prices-edit-Q7VBH25K.js → price-list-prices-edit-SP67DNIG.js} +2 -2
  29. package/dist/{product-bulk-edit-UA4PM7Q5.js → product-bulk-edit-B4IJNNYK.js} +1 -1
  30. package/dist/{product-create-7OOB5EJF.js → product-create-75ITVW4M.js} +3 -3
  31. package/dist/{product-detail-YOLJY6UR.js → product-detail-D4C4BPM3.js} +1 -1
  32. package/dist/{product-media-AE3YKMZI.js → product-media-EN27BB3X.js} +1 -1
  33. package/dist/{store-bulk-edit-5G5STIL2.js → store-bulk-edit-OGATAAML.js} +1 -1
  34. package/dist/{store-edit-FXGGXEPH.js → store-edit-YXUNYHEB.js} +1 -1
  35. package/package.json +6 -6
@@ -5,12 +5,15 @@ import {
5
5
  UploadMediaFormItem
6
6
  } from "./chunk-32URSQ4F.js";
7
7
  import {
8
+ PRODUCT_CREATE_FIELD_IDS,
8
9
  PRODUCT_CREATE_FORM_DEFAULTS,
10
+ PRODUCT_CREATE_VARIANT_COLUMN_IDS,
9
11
  ProductCreateSchema,
10
12
  decorateVariantsWithDefaultValues,
11
13
  normalizeProductFormValues,
14
+ seedVariantAdditionalData,
12
15
  subscribeVariantsToAttributes
13
- } from "./chunk-VI7SQHZW.js";
16
+ } from "./chunk-LH4AV4VB.js";
14
17
  import {
15
18
  HandleInput
16
19
  } from "./chunk-HJ56YXBU.js";
@@ -45,8 +48,9 @@ import {
45
48
  } from "./chunk-2EME4AWX.js";
46
49
  import {
47
50
  DataGrid,
51
+ createDataGridExtensionColumn,
48
52
  createDataGridHelper
49
- } from "./chunk-SNRPCOU4.js";
53
+ } from "./chunk-ZASF7XBG.js";
50
54
  import {
51
55
  RouteFocusModal,
52
56
  StackedFocusModal,
@@ -98,14 +102,20 @@ import { useCan as useCan4 } from "@mercurjs/dashboard-shared";
98
102
 
99
103
  // src/pages/products/product-create/components/product-create-form/product-create-form.tsx
100
104
  import { Button as Button3, toast } from "@medusajs/ui";
101
- import { useEffect as useEffect3, useMemo as useMemo4, Children } from "react";
105
+ import { useCallback as useCallback2, useEffect as useEffect3, useMemo as useMemo4, Children } from "react";
102
106
  import { useForm } from "react-hook-form";
103
107
  import { useTranslation as useTranslation9 } from "react-i18next";
104
- import { isForbidden as isForbidden2, useCan as useCan3 } from "@mercurjs/dashboard-shared";
108
+ import {
109
+ buildScopedAdditionalData,
110
+ isForbidden as isForbidden2,
111
+ refineAdditionalData,
112
+ useCan as useCan3,
113
+ useExtension
114
+ } from "@mercurjs/dashboard-shared";
105
115
 
106
116
  // src/pages/products/product-create/components/product-create-attributes-form/product-create-attributes-form.tsx
107
117
  var import_types = __toESM(require_dist(), 1);
108
- import { useCan as useCan2 } from "@mercurjs/dashboard-shared";
118
+ import { FormExtensionZone, useCan as useCan2 } from "@mercurjs/dashboard-shared";
109
119
  import { XMarkMini } from "@medusajs/icons";
110
120
  import {
111
121
  Button as Button2,
@@ -474,7 +484,18 @@ var Root = () => {
474
484
  )
475
485
  }
476
486
  ),
477
- /* @__PURE__ */ jsx2(RequiredAttributes, {})
487
+ /* @__PURE__ */ jsx2(RequiredAttributes, {}),
488
+ /* @__PURE__ */ jsx2(
489
+ FormExtensionZone,
490
+ {
491
+ model: "product",
492
+ zone: "create",
493
+ tab: "attributes",
494
+ exactTab: true,
495
+ control: form.control,
496
+ builtInFieldIds: PRODUCT_CREATE_FIELD_IDS
497
+ }
498
+ )
478
499
  ] })
479
500
  ]
480
501
  }
@@ -975,11 +996,15 @@ var ProductCreateAttributesForm = Root;
975
996
 
976
997
  // src/pages/products/product-create/components/product-create-details-form/product-create-details-form.tsx
977
998
  import { Heading as Heading3 } from "@medusajs/ui";
999
+ import {
1000
+ ExtendableFormField as ExtendableFormField2,
1001
+ FormExtensionZone as FormExtensionZone2
1002
+ } from "@mercurjs/dashboard-shared";
978
1003
  import { useTranslation as useTranslation6 } from "react-i18next";
979
1004
 
980
1005
  // src/pages/products/product-create/components/product-create-details-form/components/product-create-details-general-section/product-create-general-section.tsx
981
1006
  import { Input as Input2 } from "@medusajs/ui";
982
- import { RichTextEditor } from "@mercurjs/dashboard-shared";
1007
+ import { ExtendableFormField, RichTextEditor } from "@mercurjs/dashboard-shared";
983
1008
  import { useTranslation as useTranslation3 } from "react-i18next";
984
1009
  import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
985
1010
  var ProductCreateGeneralSection = () => {
@@ -988,73 +1013,113 @@ var ProductCreateGeneralSection = () => {
988
1013
  return /* @__PURE__ */ jsxs3("div", { id: "general", className: "flex flex-col gap-y-6", "data-testid": "product-create-general-section", children: [
989
1014
  /* @__PURE__ */ jsx3("div", { className: "flex flex-col gap-y-2", "data-testid": "product-create-general-section-fields", children: /* @__PURE__ */ jsxs3("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-3", "data-testid": "product-create-general-section-title-fields", children: [
990
1015
  /* @__PURE__ */ jsx3(
991
- Form.Field,
1016
+ ExtendableFormField,
992
1017
  {
1018
+ model: "product",
1019
+ zone: "create",
1020
+ tab: "details",
1021
+ id: "title",
993
1022
  control: form.control,
994
- name: "title",
995
- render: ({ field }) => {
996
- return /* @__PURE__ */ jsxs3(Form.Item, { "data-testid": "product-create-general-section-title-item", children: [
997
- /* @__PURE__ */ jsx3(Form.Label, { "data-testid": "product-create-general-section-title-label", children: t("products.fields.title.label") }),
998
- /* @__PURE__ */ jsx3(Form.Control, { "data-testid": "product-create-general-section-title-control", children: /* @__PURE__ */ jsx3(Input2, { ...field, placeholder: t("products.fields.title.placeholder"), "data-testid": "product-create-general-section-title-input" }) }),
999
- /* @__PURE__ */ jsx3(Form.ErrorMessage, { "data-testid": "product-create-general-section-title-error" })
1000
- ] });
1001
- }
1023
+ children: /* @__PURE__ */ jsx3(
1024
+ Form.Field,
1025
+ {
1026
+ control: form.control,
1027
+ name: "title",
1028
+ render: ({ field }) => {
1029
+ return /* @__PURE__ */ jsxs3(Form.Item, { "data-testid": "product-create-general-section-title-item", children: [
1030
+ /* @__PURE__ */ jsx3(Form.Label, { "data-testid": "product-create-general-section-title-label", children: t("products.fields.title.label") }),
1031
+ /* @__PURE__ */ jsx3(Form.Control, { "data-testid": "product-create-general-section-title-control", children: /* @__PURE__ */ jsx3(Input2, { ...field, placeholder: t("products.fields.title.placeholder"), "data-testid": "product-create-general-section-title-input" }) }),
1032
+ /* @__PURE__ */ jsx3(Form.ErrorMessage, { "data-testid": "product-create-general-section-title-error" })
1033
+ ] });
1034
+ }
1035
+ }
1036
+ )
1002
1037
  }
1003
1038
  ),
1004
1039
  /* @__PURE__ */ jsx3(
1005
- Form.Field,
1040
+ ExtendableFormField,
1006
1041
  {
1042
+ model: "product",
1043
+ zone: "create",
1044
+ tab: "details",
1045
+ id: "subtitle",
1007
1046
  control: form.control,
1008
- name: "subtitle",
1009
- render: ({ field }) => {
1010
- return /* @__PURE__ */ jsxs3(Form.Item, { "data-testid": "product-create-general-section-subtitle-item", children: [
1011
- /* @__PURE__ */ jsx3(Form.Label, { optional: true, "data-testid": "product-create-general-section-subtitle-label", children: t("products.fields.subtitle.label") }),
1012
- /* @__PURE__ */ jsx3(Form.Control, { "data-testid": "product-create-general-section-subtitle-control", children: /* @__PURE__ */ jsx3(Input2, { ...field, placeholder: t("products.fields.subtitle.placeholder"), "data-testid": "product-create-general-section-subtitle-input" }) })
1013
- ] });
1014
- }
1047
+ children: /* @__PURE__ */ jsx3(
1048
+ Form.Field,
1049
+ {
1050
+ control: form.control,
1051
+ name: "subtitle",
1052
+ render: ({ field }) => {
1053
+ return /* @__PURE__ */ jsxs3(Form.Item, { "data-testid": "product-create-general-section-subtitle-item", children: [
1054
+ /* @__PURE__ */ jsx3(Form.Label, { optional: true, "data-testid": "product-create-general-section-subtitle-label", children: t("products.fields.subtitle.label") }),
1055
+ /* @__PURE__ */ jsx3(Form.Control, { "data-testid": "product-create-general-section-subtitle-control", children: /* @__PURE__ */ jsx3(Input2, { ...field, placeholder: t("products.fields.subtitle.placeholder"), "data-testid": "product-create-general-section-subtitle-input" }) })
1056
+ ] });
1057
+ }
1058
+ }
1059
+ )
1015
1060
  }
1016
1061
  ),
1017
1062
  /* @__PURE__ */ jsx3(
1018
- Form.Field,
1063
+ ExtendableFormField,
1019
1064
  {
1065
+ model: "product",
1066
+ zone: "create",
1067
+ tab: "details",
1068
+ id: "handle",
1020
1069
  control: form.control,
1021
- name: "handle",
1022
- render: ({ field }) => {
1023
- return /* @__PURE__ */ jsxs3(Form.Item, { "data-testid": "product-create-general-section-handle-item", children: [
1024
- /* @__PURE__ */ jsx3(
1025
- Form.Label,
1026
- {
1027
- tooltip: t("products.fields.handle.tooltip"),
1028
- optional: true,
1029
- "data-testid": "product-create-general-section-handle-label",
1030
- children: t("fields.handle")
1031
- }
1032
- ),
1033
- /* @__PURE__ */ jsx3(Form.Control, { "data-testid": "product-create-general-section-handle-control", children: /* @__PURE__ */ jsx3(HandleInput, { ...field, placeholder: t("products.fields.handle.placeholder"), "data-testid": "product-create-general-section-handle-input" }) })
1034
- ] });
1035
- }
1070
+ children: /* @__PURE__ */ jsx3(
1071
+ Form.Field,
1072
+ {
1073
+ control: form.control,
1074
+ name: "handle",
1075
+ render: ({ field }) => {
1076
+ return /* @__PURE__ */ jsxs3(Form.Item, { "data-testid": "product-create-general-section-handle-item", children: [
1077
+ /* @__PURE__ */ jsx3(
1078
+ Form.Label,
1079
+ {
1080
+ tooltip: t("products.fields.handle.tooltip"),
1081
+ optional: true,
1082
+ "data-testid": "product-create-general-section-handle-label",
1083
+ children: t("fields.handle")
1084
+ }
1085
+ ),
1086
+ /* @__PURE__ */ jsx3(Form.Control, { "data-testid": "product-create-general-section-handle-control", children: /* @__PURE__ */ jsx3(HandleInput, { ...field, placeholder: t("products.fields.handle.placeholder"), "data-testid": "product-create-general-section-handle-input" }) })
1087
+ ] });
1088
+ }
1089
+ }
1090
+ )
1036
1091
  }
1037
1092
  )
1038
1093
  ] }) }),
1039
1094
  /* @__PURE__ */ jsx3(
1040
- Form.Field,
1095
+ ExtendableFormField,
1041
1096
  {
1097
+ model: "product",
1098
+ zone: "create",
1099
+ tab: "details",
1100
+ id: "description",
1042
1101
  control: form.control,
1043
- name: "description",
1044
- render: ({ field }) => {
1045
- return /* @__PURE__ */ jsxs3(Form.Item, { "data-testid": "product-create-general-section-description-item", children: [
1046
- /* @__PURE__ */ jsx3(Form.Label, { optional: true, "data-testid": "product-create-general-section-description-label", children: t("products.fields.description.label") }),
1047
- /* @__PURE__ */ jsx3(Form.Control, { "data-testid": "product-create-general-section-description-control", children: /* @__PURE__ */ jsx3(
1048
- RichTextEditor,
1049
- {
1050
- ...field,
1051
- placeholder: t("products.fields.description.placeholder"),
1052
- onUpload: uploadRichTextImage,
1053
- "data-testid": "product-create-general-section-description-input"
1054
- }
1055
- ) })
1056
- ] });
1057
- }
1102
+ children: /* @__PURE__ */ jsx3(
1103
+ Form.Field,
1104
+ {
1105
+ control: form.control,
1106
+ name: "description",
1107
+ render: ({ field }) => {
1108
+ return /* @__PURE__ */ jsxs3(Form.Item, { "data-testid": "product-create-general-section-description-item", children: [
1109
+ /* @__PURE__ */ jsx3(Form.Label, { optional: true, "data-testid": "product-create-general-section-description-label", children: t("products.fields.description.label") }),
1110
+ /* @__PURE__ */ jsx3(Form.Control, { "data-testid": "product-create-general-section-description-control", children: /* @__PURE__ */ jsx3(
1111
+ RichTextEditor,
1112
+ {
1113
+ ...field,
1114
+ placeholder: t("products.fields.description.placeholder"),
1115
+ onUpload: uploadRichTextImage,
1116
+ "data-testid": "product-create-general-section-description-input"
1117
+ }
1118
+ ) })
1119
+ ] });
1120
+ }
1121
+ }
1122
+ )
1058
1123
  }
1059
1124
  )
1060
1125
  ] });
@@ -1535,6 +1600,7 @@ var ProductCreateVariantsSection = () => {
1535
1600
  // src/pages/products/product-create/components/product-create-details-form/product-create-details-form.tsx
1536
1601
  import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1537
1602
  var Root2 = () => {
1603
+ const form = useTabbedForm();
1538
1604
  return /* @__PURE__ */ jsx6(
1539
1605
  "div",
1540
1606
  {
@@ -1554,11 +1620,31 @@ var Root2 = () => {
1554
1620
  "data-testid": "product-create-details-form-sections",
1555
1621
  children: [
1556
1622
  /* @__PURE__ */ jsx6(ProductCreateGeneralSection, {}),
1557
- /* @__PURE__ */ jsx6(ProductCreateMediaSection, {})
1623
+ /* @__PURE__ */ jsx6(
1624
+ ExtendableFormField2,
1625
+ {
1626
+ model: "product",
1627
+ zone: "create",
1628
+ tab: "details",
1629
+ id: "media",
1630
+ control: form.control,
1631
+ children: /* @__PURE__ */ jsx6(ProductCreateMediaSection, {})
1632
+ }
1633
+ )
1558
1634
  ]
1559
1635
  }
1560
1636
  ),
1561
- /* @__PURE__ */ jsx6(ProductCreateVariantsSection, {})
1637
+ /* @__PURE__ */ jsx6(ProductCreateVariantsSection, {}),
1638
+ /* @__PURE__ */ jsx6(
1639
+ FormExtensionZone2,
1640
+ {
1641
+ model: "product",
1642
+ zone: "create",
1643
+ tab: "details",
1644
+ control: form.control,
1645
+ builtInFieldIds: PRODUCT_CREATE_FIELD_IDS
1646
+ }
1647
+ )
1562
1648
  ]
1563
1649
  }
1564
1650
  )
@@ -1583,8 +1669,11 @@ var Header = () => {
1583
1669
  );
1584
1670
  };
1585
1671
 
1672
+ // src/pages/products/product-create/components/product-create-organize-form/product-create-organize-form.tsx
1673
+ import { FormExtensionZone as FormExtensionZone3 } from "@mercurjs/dashboard-shared";
1674
+
1586
1675
  // src/pages/products/product-create/components/product-create-organize-form/components/product-create-organize-section/product-create-details-organize-section.tsx
1587
- import { usePermissionGate } from "@mercurjs/dashboard-shared";
1676
+ import { ExtendableFormField as ExtendableFormField3, usePermissionGate } from "@mercurjs/dashboard-shared";
1588
1677
  import { Heading as Heading4 } from "@medusajs/ui";
1589
1678
  import { useWatch as useWatch3 } from "react-hook-form";
1590
1679
  import { useTranslation as useTranslation7 } from "react-i18next";
@@ -1640,198 +1729,282 @@ var ProductCreateOrganizationSection = () => {
1640
1729
  /* @__PURE__ */ jsx7(Heading4, { "data-testid": "product-create-organize-section-heading", children: t("products.organization.header") }),
1641
1730
  /* @__PURE__ */ jsxs7("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", "data-testid": "product-create-organize-section-category-collection", children: [
1642
1731
  /* @__PURE__ */ jsx7(
1643
- Form.Field,
1732
+ ExtendableFormField3,
1644
1733
  {
1734
+ model: "product",
1735
+ zone: "create",
1736
+ tab: "organize",
1737
+ id: "category_id",
1645
1738
  control: form.control,
1646
- name: "category_id",
1647
- render: ({ field }) => {
1648
- return /* @__PURE__ */ jsxs7(Form.Item, { "data-testid": "product-create-organize-section-category-item", children: [
1649
- /* @__PURE__ */ jsx7(Form.Label, { "data-testid": "product-create-organize-section-category-label", children: t("fields.category") }),
1650
- /* @__PURE__ */ jsx7(Form.Control, { "data-testid": "product-create-organize-section-category-control", children: /* @__PURE__ */ jsx7(
1651
- SingleCategoryCombobox,
1652
- {
1653
- ...field,
1654
- "data-testid": "product-create-organize-section-category-input"
1655
- }
1656
- ) }),
1657
- /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
1658
- ] });
1659
- }
1739
+ children: /* @__PURE__ */ jsx7(
1740
+ Form.Field,
1741
+ {
1742
+ control: form.control,
1743
+ name: "category_id",
1744
+ render: ({ field }) => {
1745
+ return /* @__PURE__ */ jsxs7(Form.Item, { "data-testid": "product-create-organize-section-category-item", children: [
1746
+ /* @__PURE__ */ jsx7(Form.Label, { "data-testid": "product-create-organize-section-category-label", children: t("fields.category") }),
1747
+ /* @__PURE__ */ jsx7(Form.Control, { "data-testid": "product-create-organize-section-category-control", children: /* @__PURE__ */ jsx7(
1748
+ SingleCategoryCombobox,
1749
+ {
1750
+ ...field,
1751
+ "data-testid": "product-create-organize-section-category-input"
1752
+ }
1753
+ ) }),
1754
+ /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
1755
+ ] });
1756
+ }
1757
+ }
1758
+ )
1660
1759
  }
1661
1760
  ),
1662
1761
  /* @__PURE__ */ jsx7(
1663
- Form.Field,
1762
+ ExtendableFormField3,
1664
1763
  {
1764
+ model: "product",
1765
+ zone: "create",
1766
+ tab: "organize",
1767
+ id: "collection_id",
1665
1768
  control: form.control,
1666
- name: "collection_id",
1667
- render: ({ field }) => {
1668
- return /* @__PURE__ */ jsxs7(Form.Item, { "data-testid": "product-create-organize-section-collection-item", children: [
1669
- /* @__PURE__ */ jsx7(Form.Label, { optional: true, "data-testid": "product-create-organize-section-collection-label", children: t("products.fields.collection.label") }),
1670
- /* @__PURE__ */ jsx7(
1671
- ConditionalTooltip,
1672
- {
1673
- showTooltip: collectionsGate.denied,
1674
- content: collectionsGate.tooltip,
1675
- children: /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(Form.Control, { "data-testid": "product-create-organize-section-collection-control", children: /* @__PURE__ */ jsx7(
1676
- Combobox,
1769
+ children: /* @__PURE__ */ jsx7(
1770
+ Form.Field,
1771
+ {
1772
+ control: form.control,
1773
+ name: "collection_id",
1774
+ render: ({ field }) => {
1775
+ return /* @__PURE__ */ jsxs7(Form.Item, { "data-testid": "product-create-organize-section-collection-item", children: [
1776
+ /* @__PURE__ */ jsx7(Form.Label, { optional: true, "data-testid": "product-create-organize-section-collection-label", children: t("products.fields.collection.label") }),
1777
+ /* @__PURE__ */ jsx7(
1778
+ ConditionalTooltip,
1677
1779
  {
1678
- ...field,
1679
- disabled: collectionsGate.denied,
1680
- options: collections.options,
1681
- searchValue: collections.searchValue,
1682
- onSearchValueChange: collections.onSearchValueChange,
1683
- fetchNextPage: collections.fetchNextPage,
1684
- "data-testid": "product-create-organize-section-collection-input"
1780
+ showTooltip: collectionsGate.denied,
1781
+ content: collectionsGate.tooltip,
1782
+ children: /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(Form.Control, { "data-testid": "product-create-organize-section-collection-control", children: /* @__PURE__ */ jsx7(
1783
+ Combobox,
1784
+ {
1785
+ ...field,
1786
+ disabled: collectionsGate.denied,
1787
+ options: collections.options,
1788
+ searchValue: collections.searchValue,
1789
+ onSearchValueChange: collections.onSearchValueChange,
1790
+ fetchNextPage: collections.fetchNextPage,
1791
+ "data-testid": "product-create-organize-section-collection-input"
1792
+ }
1793
+ ) }) })
1685
1794
  }
1686
- ) }) })
1687
- }
1688
- ),
1689
- /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
1690
- ] });
1691
- }
1795
+ ),
1796
+ /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
1797
+ ] });
1798
+ }
1799
+ }
1800
+ )
1692
1801
  }
1693
1802
  )
1694
1803
  ] }),
1695
1804
  /* @__PURE__ */ jsxs7("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", "data-testid": "product-create-organize-section-type-tags", children: [
1696
1805
  /* @__PURE__ */ jsx7(
1697
- Form.Field,
1806
+ ExtendableFormField3,
1698
1807
  {
1808
+ model: "product",
1809
+ zone: "create",
1810
+ tab: "organize",
1811
+ id: "type_id",
1699
1812
  control: form.control,
1700
- name: "type_id",
1701
- render: ({ field }) => {
1702
- return /* @__PURE__ */ jsxs7(Form.Item, { "data-testid": "product-create-organize-section-type-item", children: [
1703
- /* @__PURE__ */ jsx7(Form.Label, { optional: true, "data-testid": "product-create-organize-section-type-label", children: t("products.fields.type.label") }),
1704
- /* @__PURE__ */ jsx7(
1705
- ConditionalTooltip,
1706
- {
1707
- showTooltip: typesGate.denied,
1708
- content: typesGate.tooltip,
1709
- children: /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(Form.Control, { "data-testid": "product-create-organize-section-type-control", children: /* @__PURE__ */ jsx7(
1710
- Combobox,
1813
+ children: /* @__PURE__ */ jsx7(
1814
+ Form.Field,
1815
+ {
1816
+ control: form.control,
1817
+ name: "type_id",
1818
+ render: ({ field }) => {
1819
+ return /* @__PURE__ */ jsxs7(Form.Item, { "data-testid": "product-create-organize-section-type-item", children: [
1820
+ /* @__PURE__ */ jsx7(Form.Label, { optional: true, "data-testid": "product-create-organize-section-type-label", children: t("products.fields.type.label") }),
1821
+ /* @__PURE__ */ jsx7(
1822
+ ConditionalTooltip,
1711
1823
  {
1712
- ...field,
1713
- disabled: typesGate.denied,
1714
- options: types.options,
1715
- searchValue: types.searchValue,
1716
- onSearchValueChange: types.onSearchValueChange,
1717
- fetchNextPage: types.fetchNextPage,
1718
- "data-testid": "product-create-organize-section-type-input"
1824
+ showTooltip: typesGate.denied,
1825
+ content: typesGate.tooltip,
1826
+ children: /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(Form.Control, { "data-testid": "product-create-organize-section-type-control", children: /* @__PURE__ */ jsx7(
1827
+ Combobox,
1828
+ {
1829
+ ...field,
1830
+ disabled: typesGate.denied,
1831
+ options: types.options,
1832
+ searchValue: types.searchValue,
1833
+ onSearchValueChange: types.onSearchValueChange,
1834
+ fetchNextPage: types.fetchNextPage,
1835
+ "data-testid": "product-create-organize-section-type-input"
1836
+ }
1837
+ ) }) })
1719
1838
  }
1720
- ) }) })
1721
- }
1722
- ),
1723
- /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
1724
- ] });
1725
- }
1839
+ ),
1840
+ /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
1841
+ ] });
1842
+ }
1843
+ }
1844
+ )
1726
1845
  }
1727
1846
  ),
1728
1847
  /* @__PURE__ */ jsx7(
1729
- Form.Field,
1848
+ ExtendableFormField3,
1730
1849
  {
1850
+ model: "product",
1851
+ zone: "create",
1852
+ tab: "organize",
1853
+ id: "tags",
1731
1854
  control: form.control,
1732
- name: "tags",
1733
- render: ({ field }) => {
1734
- return /* @__PURE__ */ jsxs7(Form.Item, { "data-testid": "product-create-organize-section-tags-item", children: [
1735
- /* @__PURE__ */ jsx7(Form.Label, { optional: true, "data-testid": "product-create-organize-section-tags-label", children: t("products.fields.tags.label") }),
1736
- /* @__PURE__ */ jsx7(
1737
- ConditionalTooltip,
1738
- {
1739
- showTooltip: tagsGate.denied,
1740
- content: tagsGate.tooltip,
1741
- children: /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(Form.Control, { "data-testid": "product-create-organize-section-tags-control", children: /* @__PURE__ */ jsx7(
1742
- Combobox,
1855
+ children: /* @__PURE__ */ jsx7(
1856
+ Form.Field,
1857
+ {
1858
+ control: form.control,
1859
+ name: "tags",
1860
+ render: ({ field }) => {
1861
+ return /* @__PURE__ */ jsxs7(Form.Item, { "data-testid": "product-create-organize-section-tags-item", children: [
1862
+ /* @__PURE__ */ jsx7(Form.Label, { optional: true, "data-testid": "product-create-organize-section-tags-label", children: t("products.fields.tags.label") }),
1863
+ /* @__PURE__ */ jsx7(
1864
+ ConditionalTooltip,
1743
1865
  {
1744
- ...field,
1745
- disabled: tagsGate.denied,
1746
- options: tags.options,
1747
- searchValue: tags.searchValue,
1748
- onSearchValueChange: tags.onSearchValueChange,
1749
- fetchNextPage: tags.fetchNextPage,
1750
- "data-testid": "product-create-organize-section-tags-input"
1866
+ showTooltip: tagsGate.denied,
1867
+ content: tagsGate.tooltip,
1868
+ children: /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(Form.Control, { "data-testid": "product-create-organize-section-tags-control", children: /* @__PURE__ */ jsx7(
1869
+ Combobox,
1870
+ {
1871
+ ...field,
1872
+ disabled: tagsGate.denied,
1873
+ options: tags.options,
1874
+ searchValue: tags.searchValue,
1875
+ onSearchValueChange: tags.onSearchValueChange,
1876
+ fetchNextPage: tags.fetchNextPage,
1877
+ "data-testid": "product-create-organize-section-tags-input"
1878
+ }
1879
+ ) }) })
1751
1880
  }
1752
- ) }) })
1753
- }
1754
- ),
1755
- /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
1756
- ] });
1757
- }
1881
+ ),
1882
+ /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
1883
+ ] });
1884
+ }
1885
+ }
1886
+ )
1758
1887
  }
1759
1888
  )
1760
1889
  ] }),
1761
1890
  /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-y-4", children: [
1762
1891
  /* @__PURE__ */ jsx7(
1763
- SwitchBox,
1892
+ ExtendableFormField3,
1764
1893
  {
1894
+ model: "product",
1895
+ zone: "create",
1896
+ tab: "organize",
1897
+ id: "discountable",
1765
1898
  control: form.control,
1766
- name: "discountable",
1767
- label: t("products.fields.discountable.label"),
1768
- description: t("products.fields.discountable.hint"),
1769
- optional: true,
1770
- "data-testid": "product-create-organize-section-discountable-switch"
1899
+ children: /* @__PURE__ */ jsx7(
1900
+ SwitchBox,
1901
+ {
1902
+ control: form.control,
1903
+ name: "discountable",
1904
+ label: t("products.fields.discountable.label"),
1905
+ description: t("products.fields.discountable.hint"),
1906
+ optional: true,
1907
+ "data-testid": "product-create-organize-section-discountable-switch"
1908
+ }
1909
+ )
1771
1910
  }
1772
1911
  ),
1773
1912
  /* @__PURE__ */ jsx7(
1774
- SwitchBox,
1913
+ ExtendableFormField3,
1775
1914
  {
1915
+ model: "product",
1916
+ zone: "create",
1917
+ tab: "organize",
1918
+ id: "globally_available",
1776
1919
  control: form.control,
1777
- name: "globally_available",
1778
- label: t("products.fields.globally_available.label"),
1779
- description: t("products.fields.globally_available.hint"),
1780
- optional: true,
1781
- "data-testid": "product-create-organize-section-globally-available-switch"
1920
+ children: /* @__PURE__ */ jsx7(
1921
+ SwitchBox,
1922
+ {
1923
+ control: form.control,
1924
+ name: "globally_available",
1925
+ label: t("products.fields.globally_available.label"),
1926
+ description: t("products.fields.globally_available.hint"),
1927
+ optional: true,
1928
+ "data-testid": "product-create-organize-section-globally-available-switch"
1929
+ }
1930
+ )
1782
1931
  }
1783
1932
  )
1784
1933
  ] }),
1785
1934
  !isGloballyAvailable && /* @__PURE__ */ jsx7(
1786
- Form.Field,
1935
+ ExtendableFormField3,
1787
1936
  {
1937
+ model: "product",
1938
+ zone: "create",
1939
+ tab: "organize",
1940
+ id: "seller_ids",
1788
1941
  control: form.control,
1789
- name: "seller_ids",
1790
- render: ({ field }) => {
1791
- return /* @__PURE__ */ jsxs7(Form.Item, { "data-testid": "product-create-organize-section-stores-item", children: [
1792
- /* @__PURE__ */ jsx7(Form.Label, { "data-testid": "product-create-organize-section-stores-label", children: t("products.fields.stores.label") }),
1793
- /* @__PURE__ */ jsx7(
1794
- ConditionalTooltip,
1795
- {
1796
- showTooltip: sellersGate.denied,
1797
- content: sellersGate.tooltip,
1798
- children: /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(Form.Control, { "data-testid": "product-create-organize-section-stores-control", children: /* @__PURE__ */ jsx7(
1799
- Combobox,
1942
+ children: /* @__PURE__ */ jsx7(
1943
+ Form.Field,
1944
+ {
1945
+ control: form.control,
1946
+ name: "seller_ids",
1947
+ render: ({ field }) => {
1948
+ return /* @__PURE__ */ jsxs7(Form.Item, { "data-testid": "product-create-organize-section-stores-item", children: [
1949
+ /* @__PURE__ */ jsx7(Form.Label, { "data-testid": "product-create-organize-section-stores-label", children: t("products.fields.stores.label") }),
1950
+ /* @__PURE__ */ jsx7(
1951
+ ConditionalTooltip,
1800
1952
  {
1801
- ...field,
1802
- value: field.value ?? [],
1803
- disabled: sellersGate.denied,
1804
- options: sellers.options,
1805
- searchValue: sellers.searchValue,
1806
- onSearchValueChange: sellers.onSearchValueChange,
1807
- fetchNextPage: sellers.fetchNextPage,
1808
- "data-testid": "product-create-organize-section-stores-input"
1953
+ showTooltip: sellersGate.denied,
1954
+ content: sellersGate.tooltip,
1955
+ children: /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(Form.Control, { "data-testid": "product-create-organize-section-stores-control", children: /* @__PURE__ */ jsx7(
1956
+ Combobox,
1957
+ {
1958
+ ...field,
1959
+ value: field.value ?? [],
1960
+ disabled: sellersGate.denied,
1961
+ options: sellers.options,
1962
+ searchValue: sellers.searchValue,
1963
+ onSearchValueChange: sellers.onSearchValueChange,
1964
+ fetchNextPage: sellers.fetchNextPage,
1965
+ "data-testid": "product-create-organize-section-stores-input"
1966
+ }
1967
+ ) }) })
1809
1968
  }
1810
- ) }) })
1811
- }
1812
- ),
1813
- /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
1814
- ] });
1815
- }
1969
+ ),
1970
+ /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
1971
+ ] });
1972
+ }
1973
+ }
1974
+ )
1816
1975
  }
1817
1976
  )
1818
1977
  ] });
1819
1978
  };
1820
1979
 
1821
1980
  // src/pages/products/product-create/components/product-create-organize-form/product-create-organize-form.tsx
1822
- import { jsx as jsx8 } from "react/jsx-runtime";
1981
+ import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
1823
1982
  var Root3 = () => {
1983
+ const form = useTabbedForm();
1824
1984
  return /* @__PURE__ */ jsx8(
1825
1985
  "div",
1826
1986
  {
1827
1987
  className: "flex flex-col items-center p-16",
1828
1988
  "data-testid": "product-create-organize-form",
1829
- children: /* @__PURE__ */ jsx8(
1989
+ children: /* @__PURE__ */ jsxs8(
1830
1990
  "div",
1831
1991
  {
1832
1992
  className: "flex w-full max-w-[720px] flex-col gap-y-8",
1833
1993
  "data-testid": "product-create-organize-form-content",
1834
- children: /* @__PURE__ */ jsx8(ProductCreateOrganizationSection, {})
1994
+ children: [
1995
+ /* @__PURE__ */ jsx8(ProductCreateOrganizationSection, {}),
1996
+ /* @__PURE__ */ jsx8(
1997
+ FormExtensionZone3,
1998
+ {
1999
+ model: "product",
2000
+ zone: "create",
2001
+ tab: "organize",
2002
+ exactTab: true,
2003
+ control: form.control,
2004
+ builtInFieldIds: PRODUCT_CREATE_FIELD_IDS
2005
+ }
2006
+ )
2007
+ ]
1835
2008
  }
1836
2009
  )
1837
2010
  }
@@ -1861,7 +2034,8 @@ var ProductCreateOrganizeForm = Root3;
1861
2034
 
1862
2035
  // src/pages/products/product-create/components/product-create-variants-form/product-create-variants-form.tsx
1863
2036
  import { Input as Input3 } from "@medusajs/ui";
1864
- import { useMemo as useMemo3, useState as useState3 } from "react";
2037
+ import { useExtendableGrid } from "@mercurjs/dashboard-shared";
2038
+ import { useCallback, useMemo as useMemo3, useState as useState3 } from "react";
1865
2039
  import { useWatch as useWatch4 } from "react-hook-form";
1866
2040
  import { useTranslation as useTranslation8 } from "react-i18next";
1867
2041
  import { jsx as jsx9 } from "react/jsx-runtime";
@@ -1885,9 +2059,22 @@ var Root4 = () => {
1885
2059
  title: attr.title
1886
2060
  }));
1887
2061
  }, [watchedAttributes]);
1888
- const columns = useColumns2({
2062
+ const baseColumns = useColumns2({
1889
2063
  variantAxes
1890
2064
  });
2065
+ const createColumn = useCallback(
2066
+ createDataGridExtensionColumn,
2067
+ []
2068
+ );
2069
+ const columns = useExtendableGrid({
2070
+ model: "product",
2071
+ zone: "create",
2072
+ tab: "variants",
2073
+ columns: baseColumns,
2074
+ lockedColumnIds: LOCKED_COLUMN_IDS,
2075
+ getRowPath: rowPath,
2076
+ createColumn
2077
+ });
1891
2078
  const variantData = useMemo3(() => {
1892
2079
  const ret = [];
1893
2080
  variants.forEach((v, i) => {
@@ -1954,6 +2141,8 @@ Root4._tabMeta = defineTabMeta({
1954
2141
  validationFields: ["variants"]
1955
2142
  });
1956
2143
  var ProductCreateVariantsForm = Root4;
2144
+ var LOCKED_COLUMN_IDS = ["attributes"];
2145
+ var rowPath = (row) => `variants.${row.originalIndex}`;
1957
2146
  var columnHelper2 = createDataGridHelper();
1958
2147
  var useColumns2 = ({
1959
2148
  variantAxes
@@ -1996,8 +2185,10 @@ var useColumns2 = ({
1996
2185
 
1997
2186
  // src/pages/products/product-create/components/product-create-form/product-create-form.tsx
1998
2187
  import { zodResolver } from "@hookform/resolvers/zod";
1999
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
2188
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
2000
2189
  var SAVE_DRAFT_BUTTON = "save-draft-button";
2190
+ var FORM_TABS = ["details", "organize", "attributes"];
2191
+ var VARIANTS_TAB = "variants";
2001
2192
  var ProductCreateForm = ({
2002
2193
  children,
2003
2194
  schema,
@@ -2005,12 +2196,48 @@ var ProductCreateForm = ({
2005
2196
  }) => {
2006
2197
  const { t } = useTranslation9();
2007
2198
  const { handleSuccess } = useRouteModal();
2199
+ const extension = useExtension();
2200
+ const productAdditionalData = useMemo4(
2201
+ () => buildScopedAdditionalData(extension, {
2202
+ model: "product",
2203
+ zone: "create",
2204
+ tabs: FORM_TABS,
2205
+ builtInFieldIds: PRODUCT_CREATE_FIELD_IDS
2206
+ }),
2207
+ [extension]
2208
+ );
2209
+ const variantAdditionalData = useMemo4(
2210
+ () => buildScopedAdditionalData(extension, {
2211
+ model: "product",
2212
+ zone: "create",
2213
+ tabs: [VARIANTS_TAB],
2214
+ exactTab: true,
2215
+ builtInFieldIds: PRODUCT_CREATE_VARIANT_COLUMN_IDS
2216
+ }),
2217
+ [extension]
2218
+ );
2219
+ const resolverSchema = useMemo4(
2220
+ () => refineAdditionalData(schema ?? ProductCreateSchema, {
2221
+ additionalData: productAdditionalData.schema,
2222
+ rows: {
2223
+ path: "variants",
2224
+ schema: variantAdditionalData.schema,
2225
+ include: (row) => row.should_create === true
2226
+ }
2227
+ }),
2228
+ [schema, productAdditionalData, variantAdditionalData]
2229
+ );
2008
2230
  const form = useForm({
2009
2231
  defaultValues: {
2010
2232
  ...PRODUCT_CREATE_FORM_DEFAULTS,
2011
- ...extraDefaults
2233
+ additional_data: productAdditionalData.defaults,
2234
+ ...extraDefaults,
2235
+ variants: seedVariantAdditionalData(
2236
+ extraDefaults?.variants ?? PRODUCT_CREATE_FORM_DEFAULTS.variants ?? [],
2237
+ variantAdditionalData.defaults
2238
+ )
2012
2239
  },
2013
- resolver: zodResolver(schema ?? ProductCreateSchema)
2240
+ resolver: zodResolver(resolverSchema)
2014
2241
  });
2015
2242
  const { mutateAsync, isPending } = useCreateProduct();
2016
2243
  const canViewRegions = useCan3("regions");
@@ -2036,7 +2263,26 @@ var ProductCreateForm = ({
2036
2263
  {}
2037
2264
  );
2038
2265
  }, [regions]);
2039
- useEffect3(() => subscribeVariantsToAttributes(form), [form]);
2266
+ useEffect3(
2267
+ () => subscribeVariantsToAttributes(form, variantAdditionalData.defaults),
2268
+ [form, variantAdditionalData]
2269
+ );
2270
+ const transformTabs = useCallback2(
2271
+ (tabs) => tabs.map((tab, index) => {
2272
+ if (!tab.validationFields || !FORM_TABS.includes(tab.id)) return tab;
2273
+ const custom = extension.getFormFields(
2274
+ "product",
2275
+ "create",
2276
+ tab.id,
2277
+ PRODUCT_CREATE_FIELD_IDS,
2278
+ index > 0
2279
+ ).map(
2280
+ ({ name }) => `additional_data.${name}`
2281
+ );
2282
+ return custom.length ? { ...tab, validationFields: [...tab.validationFields, ...custom] } : tab;
2283
+ }),
2284
+ [extension]
2285
+ );
2040
2286
  const handleSubmit = form.handleSubmit(async (values, e) => {
2041
2287
  if (isRegionsPending) {
2042
2288
  return;
@@ -2109,10 +2355,11 @@ var ProductCreateForm = ({
2109
2355
  {
2110
2356
  model: "product",
2111
2357
  zone: "create",
2358
+ transformTabs,
2112
2359
  form,
2113
2360
  onSubmit: handleSubmit,
2114
2361
  isLoading: isPending || isRegionsPending,
2115
- footer: ({ isLastTab, onNext, isLoading }) => /* @__PURE__ */ jsxs8(
2362
+ footer: ({ isLastTab, onNext, isLoading }) => /* @__PURE__ */ jsxs9(
2116
2363
  "div",
2117
2364
  {
2118
2365
  className: "flex items-center justify-end gap-x-2",
@@ -2173,7 +2420,7 @@ var ProductCreateForm = ({
2173
2420
  };
2174
2421
 
2175
2422
  // src/pages/products/product-create/product-create.tsx
2176
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2423
+ import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
2177
2424
  var Root5 = ({ children }) => {
2178
2425
  const { t } = useTranslation10();
2179
2426
  const canViewSalesChannels = useCan4("sales_channels");
@@ -2200,7 +2447,7 @@ var Root5 = ({ children }) => {
2200
2447
  if (isSalesChannelError) {
2201
2448
  throw salesChannelError;
2202
2449
  }
2203
- return /* @__PURE__ */ jsxs9(RouteFocusModal, { children: [
2450
+ return /* @__PURE__ */ jsxs10(RouteFocusModal, { children: [
2204
2451
  /* @__PURE__ */ jsx11(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx11("span", { className: "sr-only", children: t("products.create.title") }) }),
2205
2452
  /* @__PURE__ */ jsx11(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx11("span", { className: "sr-only", children: t("products.create.description") }) }),
2206
2453
  ready && (Children2.count(children) > 0 ? children : /* @__PURE__ */ jsx11(ProductCreateForm, {}))