@mercurjs/vendor 2.2.0-canary.13 → 2.2.0-canary.14

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 (181) hide show
  1. package/dist/{[id]-RFEYRBLI.js → [id]-2TI2PRRJ.js} +12 -12
  2. package/dist/{[id]-J6BZG5PU.js → [id]-ASXERAZ4.js} +3 -3
  3. package/dist/{[id]-ET35KT2M.js → [id]-CDA4INC4.js} +5 -5
  4. package/dist/{[id]-ZMLS73X5.js → [id]-DZC5AXL5.js} +11 -11
  5. package/dist/{[id]-YZSVSJWU.js → [id]-IBI7RQ5U.js} +10 -10
  6. package/dist/{[id]-IW2AZE77.js → [id]-JMO5ONLU.js} +13 -13
  7. package/dist/{[id]-FALIOGXK.js → [id]-KZ4AUWKS.js} +12 -12
  8. package/dist/{[id]-GY5R652O.js → [id]-NGAIPW6P.js} +12 -12
  9. package/dist/{[id]-US6IULL2.js → [id]-OQ2LU74O.js} +53 -24
  10. package/dist/{[id]-OTK2NOXT.js → [id]-WFTES472.js} +11 -11
  11. package/dist/{[id]-IGQTT3AM.js → [id]-WLX5IYWH.js} +11 -11
  12. package/dist/{[id]-PEUI67SP.js → [id]-Z47IMQRW.js} +2 -2
  13. package/dist/{[province_id]-J3OB2LZ4.js → [province_id]-24DPO3NE.js} +11 -11
  14. package/dist/{add-RU3WL4YB.js → add-KHYOS24M.js} +3 -3
  15. package/dist/{add-XEUXK63F.js → add-RK7LC7HS.js} +13 -13
  16. package/dist/{add-customer-groups-HZNWWRVG.js → add-customer-groups-IYXY4KM4.js} +10 -10
  17. package/dist/{add-products-E5GULF6B.js → add-products-GX5Z63TJ.js} +11 -11
  18. package/dist/{add-promotions-KW5YZHLS.js → add-promotions-HDJ7XR6Z.js} +5 -5
  19. package/dist/{address-6T4H6P7O.js → address-X5L7Q2VF.js} +8 -8
  20. package/dist/{adjust-inventory-AFJLWF5R.js → adjust-inventory-MCPV25XO.js} +1 -1
  21. package/dist/allocate-items-HI7KLPIB.js +654 -0
  22. package/dist/{areas-XUC5V5UO.js → areas-IHZROM6V.js} +3 -3
  23. package/dist/{attributes-SZP2MM5L.js → attributes-2JXH2BT2.js} +1 -1
  24. package/dist/{breadcrumb-L3MFH4I2.js → breadcrumb-4CK7LE6V.js} +1 -1
  25. package/dist/{breadcrumb-IK6XCQOQ.js → breadcrumb-6MIWWTK2.js} +2 -2
  26. package/dist/{breadcrumb-ZMACILH3.js → breadcrumb-DCWCXAFT.js} +2 -2
  27. package/dist/{breadcrumb-LKLWHB63.js → breadcrumb-NNFO7JCI.js} +9 -9
  28. package/dist/{breadcrumb-PBR27GGX.js → breadcrumb-PEKYMNVH.js} +2 -2
  29. package/dist/{breadcrumb-5HYIEPCL.js → breadcrumb-PV4XAZQW.js} +8 -8
  30. package/dist/{breadcrumb-KTARIL65.js → breadcrumb-PZCTXZ7Y.js} +2 -2
  31. package/dist/{breadcrumb-HL7NKNX4.js → breadcrumb-T5AIM6N3.js} +8 -8
  32. package/dist/{breadcrumb-FPWBT76A.js → breadcrumb-VOZAYLW3.js} +2 -2
  33. package/dist/{breadcrumb-2XA2WOK7.js → breadcrumb-XDTRPJYA.js} +1 -1
  34. package/dist/{campaigns-JAQTSA4Z.js → campaigns-4I2T6EDZ.js} +3 -3
  35. package/dist/{categories-T4QJYX4R.js → categories-LGV4X26B.js} +5 -5
  36. package/dist/{chunk-QLBIBLOY.js → chunk-22CIYLKO.js} +1 -1
  37. package/dist/{chunk-T5MJWWDX.js → chunk-2H4FGZ4U.js} +1 -1
  38. package/dist/{chunk-YHIJCI4U.js → chunk-2XOEFFYB.js} +2 -2
  39. package/dist/{chunk-PAVZ6FPK.js → chunk-3Z46N7A4.js} +4 -3
  40. package/dist/{chunk-YPTJETJQ.js → chunk-4NQJN4KR.js} +1 -1
  41. package/dist/{chunk-VAOJVT7R.js → chunk-5EIRIDGB.js} +2 -2
  42. package/dist/{chunk-VDHW6H5F.js → chunk-5QG6P6EU.js} +1 -1
  43. package/dist/{chunk-SIEEMXNZ.js → chunk-5ZJE3O2T.js} +1 -1
  44. package/dist/{chunk-4WCPN4OA.js → chunk-6EATIA34.js} +1 -1
  45. package/dist/{chunk-JAUZ73XE.js → chunk-6ORRPSPG.js} +3 -0
  46. package/dist/{chunk-KIFSQOM2.js → chunk-6QS6IZC6.js} +1 -1
  47. package/dist/{chunk-463CNCJC.js → chunk-7DDRUUXI.js} +2 -2
  48. package/dist/{chunk-GAE6TKOR.js → chunk-7GKAK7SG.js} +2 -4
  49. package/dist/{chunk-3PMM6AMP.js → chunk-AG6KIAUD.js} +1 -1
  50. package/dist/{chunk-DDJQRV6E.js → chunk-AQ7HHCHJ.js} +1 -1
  51. package/dist/{chunk-KJWVLGXG.js → chunk-AUMAF6RS.js} +5 -5
  52. package/dist/{chunk-A6QH53CS.js → chunk-BSBEIZPO.js} +7 -6
  53. package/dist/{chunk-LARLBYU6.js → chunk-CCGKFRKX.js} +1 -1
  54. package/dist/{chunk-BXRNZS5K.js → chunk-D2KMKWPI.js} +1 -1
  55. package/dist/chunk-EXRCJ2KI.js +33 -0
  56. package/dist/{chunk-BPVMJN2D.js → chunk-FQKVJALF.js} +5 -5
  57. package/dist/{chunk-STWHJLVV.js → chunk-FW6NLFW2.js} +1 -1
  58. package/dist/{chunk-AQTEEQWX.js → chunk-GDME2OBZ.js} +1 -1
  59. package/dist/{chunk-UDOBGAP7.js → chunk-GXZTYSQA.js} +1 -1
  60. package/dist/{chunk-VMFC2UDJ.js → chunk-HDPP7NAH.js} +3 -3
  61. package/dist/{chunk-DQKK43PR.js → chunk-ITEXO6BI.js} +2 -2
  62. package/dist/{chunk-5T6UWTRU.js → chunk-IV57G2CB.js} +19 -11
  63. package/dist/{chunk-IBEUR3J7.js → chunk-JI5BZTBK.js} +2 -2
  64. package/dist/{chunk-MVYAN2RR.js → chunk-K5H7FQPJ.js} +202 -474
  65. package/dist/{chunk-6OUPJNYO.js → chunk-KCHYLLVG.js} +2 -2
  66. package/dist/{chunk-ZBSFGCWY.js → chunk-MGKFVZFH.js} +2 -2
  67. package/dist/{chunk-ZPH3WXJ6.js → chunk-MQ7AZH5E.js} +1 -1
  68. package/dist/{chunk-TF6V3TFG.js → chunk-N7RHA7GE.js} +1 -1
  69. package/dist/{chunk-5YCDZ4AU.js → chunk-NN7E6UBM.js} +1 -2
  70. package/dist/{chunk-2QTNCGKX.js → chunk-NXSUJYZ4.js} +1 -1
  71. package/dist/{chunk-TW324MAT.js → chunk-PR4GU3GB.js} +1 -1
  72. package/dist/{chunk-Y2MQ5EMD.js → chunk-QCAMAXTE.js} +1 -1
  73. package/dist/{chunk-7CMRFP5Q.js → chunk-QS35HWC5.js} +1 -1
  74. package/dist/{chunk-U6PBLMXD.js → chunk-REUNEGSN.js} +3 -0
  75. package/dist/{chunk-DEJIBIQZ.js → chunk-RIF5X77T.js} +3 -3
  76. package/dist/{chunk-J7ZU2HZZ.js → chunk-SL4HFNPH.js} +2 -2
  77. package/dist/{chunk-5QI3NDJG.js → chunk-TFGWDC2N.js} +1 -1
  78. package/dist/{chunk-6FUIK3PX.js → chunk-U6AAK4OP.js} +3 -3
  79. package/dist/{chunk-R5QZO3QY.js → chunk-UZQKGNIW.js} +1 -1
  80. package/dist/{chunk-6UZERVBI.js → chunk-VKMU4ONH.js} +1 -1
  81. package/dist/{chunk-SSUUT5LK.js → chunk-WKRW5OPL.js} +1 -1
  82. package/dist/{chunk-XCIMOIX6.js → chunk-XBKWFLJG.js} +1 -1
  83. package/dist/{chunk-UFFVRF4V.js → chunk-Y34BG5JZ.js} +1 -1
  84. package/dist/{chunk-SJT6A4AV.js → chunk-YMDSGETV.js} +4 -4
  85. package/dist/{chunk-VZUA5SRD.js → chunk-Z2OUSXGV.js} +1 -1
  86. package/dist/{collections-HO2F62RN.js → collections-R7DDMVEO.js} +13 -13
  87. package/dist/{configuration-7IYZ6GNP.js → configuration-O6BMBYJZ.js} +2 -2
  88. package/dist/{create-DB4EYPJ5.js → create-5NSIF5BL.js} +8 -8
  89. package/dist/{create-J5OLH7OJ.js → create-5T2D7D4M.js} +8 -8
  90. package/dist/create-AP4P3L3F.js +216 -0
  91. package/dist/{create-FBPPNBLQ.js → create-C5VKLWPC.js} +8 -8
  92. package/dist/{create-WQ5TM5IZ.js → create-E75FI4OZ.js} +6 -6
  93. package/dist/{create-QZBCYHHQ.js → create-G2IW6LIT.js} +15 -15
  94. package/dist/{create-7EVR4N6N.js → create-G5DHEV55.js} +7 -7
  95. package/dist/{create-EFMCNOR5.js → create-IJDGWFHH.js} +12 -12
  96. package/dist/{create-SLJ2BMH7.js → create-JQSABIR4.js} +13 -13
  97. package/dist/{create-MZYXMGKP.js → create-OKYCDS6U.js} +3 -3
  98. package/dist/{create-TKXH5KQY.js → create-SHDZQLXT.js} +1 -1
  99. package/dist/{create-F5R76QML.js → create-VH33IROG.js} +5 -5
  100. package/dist/{create-QAEOARJO.js → create-VWZMWLSB.js} +8 -8
  101. package/dist/{customers-SOLJ2KQQ.js → customers-PPCUFKDS.js} +3 -3
  102. package/dist/{edit-G57GESSR.js → edit-3HTGOJCC.js} +6 -6
  103. package/dist/{edit-WPX2ANVI.js → edit-66N4HDDX.js} +8 -8
  104. package/dist/{edit-FXNXTVIW.js → edit-CDSNMD4A.js} +2 -2
  105. package/dist/{edit-YW4RBDPH.js → edit-IOM4RMSJ.js} +10 -10
  106. package/dist/{edit-RJE7L3PH.js → edit-KP5W2WAX.js} +8 -8
  107. package/dist/{edit-XSICGAVO.js → edit-M5KYT35E.js} +2 -2
  108. package/dist/{edit-3O6WVIMM.js → edit-QM7LQGYO.js} +10 -10
  109. package/dist/{edit-PUZ23M7V.js → edit-SY3POWMU.js} +2 -2
  110. package/dist/{edit-TIRMXOLT.js → edit-TNLEIQJX.js} +10 -10
  111. package/dist/{edit-W6WKYNOG.js → edit-WHRMHGLX.js} +13 -13
  112. package/dist/{edit-PVJ3S4TW.js → edit-XZL6WZRK.js} +8 -8
  113. package/dist/{edit-inventory-item-ZKXXL3QK.js → edit-inventory-item-EQRH4IH7.js} +1 -1
  114. package/dist/{edit-inventory-item-attributes-GSKUMORD.js → edit-inventory-item-attributes-J3NRDMGO.js} +1 -1
  115. package/dist/{edit-price-5ICQPJ42.js → edit-price-BVHSQFEU.js} +2 -2
  116. package/dist/{edit-stock-KS2NFC2Z.js → edit-stock-Y4KJHMYJ.js} +2 -2
  117. package/dist/{fulfillment-ZV2R43N2.js → fulfillment-FU5QETOZ.js} +8 -8
  118. package/dist/{fulfillment-providers-KKCL25KA.js → fulfillment-providers-XOXXACFQ.js} +11 -11
  119. package/dist/index.css +21 -4
  120. package/dist/index.js +152 -148
  121. package/dist/{inventory-5UNDKYDL.js → inventory-FCP7K3G3.js} +2 -2
  122. package/dist/{inventory-WSFLTA6Z.js → inventory-ILMHOB43.js} +4 -4
  123. package/dist/{invite-P7I5BGOJ.js → invite-HSK2XQRX.js} +11 -11
  124. package/dist/{invite-KKIJNMER.js → invite-QLA3ZZLF.js} +11 -11
  125. package/dist/{loader-WEJZTX5Q.js → loader-2X7OWRHW.js} +2 -2
  126. package/dist/{loader-UZTTBKYF.js → loader-R5KO7E6G.js} +1 -1
  127. package/dist/{login-A65IAXSI.js → login-7GCYZIPX.js} +9 -9
  128. package/dist/{manage-locations-XHH5DVIR.js → manage-locations-BGOYWQEM.js} +1 -1
  129. package/dist/{media-EM3K4AWO.js → media-CYFQMAEX.js} +11 -11
  130. package/dist/media-QMQ27X4G.js +314 -0
  131. package/dist/{metadata-JFLFWXOS.js → metadata-43O67QUY.js} +8 -8
  132. package/dist/{metadata-A5XZKPL4.js → metadata-DBVAS7ZM.js} +8 -8
  133. package/dist/{metadata-USXOQUIX.js → metadata-HDA6BLVR.js} +8 -8
  134. package/dist/{metadata-SFO3J5O5.js → metadata-IIN4NLRH.js} +8 -8
  135. package/dist/{metadata-WJ4CNB6I.js → metadata-KMWGUE7G.js} +8 -8
  136. package/dist/{offer-create-page-3PIJXHWZ.js → offer-create-page-FHT4JKVU.js} +14 -14
  137. package/dist/{offer-detail-page-SPHP3XKC.js → offer-detail-page-ZZLNGK27.js} +4 -5
  138. package/dist/{offer-variant-detail-page-KTHKV6WW.js → offer-variant-detail-page-ZYLRLCUO.js} +4 -4
  139. package/dist/{offers-GWMIEPCM.js → offers-ZM3AEZNM.js} +12 -12
  140. package/dist/{onboarding-JOGRNDPI.js → onboarding-SLDOWDFW.js} +8 -8
  141. package/dist/{orders-Q2IKEJIM.js → orders-2L73IOGC.js} +13 -13
  142. package/dist/{organization-HRYDC66D.js → organization-A4IG4WAR.js} +9 -9
  143. package/dist/{organize-5XRZWD5C.js → organize-STHGGW6P.js} +3 -3
  144. package/dist/{organize-Z7JTTDH4.js → organize-YQUFBBJY.js} +3 -3
  145. package/dist/pages/index.js +41 -41
  146. package/dist/{payment-details-YLPIR52N.js → payment-details-DBRT7W2N.js} +8 -8
  147. package/dist/{payouts-7Q7D4FET.js → payouts-D4A4CILI.js} +3 -3
  148. package/dist/{price-lists-6TFLA53G.js → price-lists-GO3BESTP.js} +6 -6
  149. package/dist/{pricing-ECJH4VXZ.js → pricing-2YFK2AR5.js} +8 -8
  150. package/dist/{pricing-EPNQ63NT.js → pricing-MQBWOWKW.js} +2 -2
  151. package/dist/{product-tags-WMC7G3C4.js → product-tags-AQN35DDX.js} +13 -13
  152. package/dist/{product-types-PKUEL7X5.js → product-types-XXU7X42K.js} +3 -3
  153. package/dist/product-variant-detail-4Q4YCN3E.js +369 -0
  154. package/dist/{product-variant-edit-GACQHD46.js → product-variant-edit-7OCP6ZT7.js} +1 -1
  155. package/dist/{products-PQ3FG5KC.js → products-FGL7RHWE.js} +11 -11
  156. package/dist/{products-LGQMESEZ.js → products-K2OPKRB2.js} +19 -19
  157. package/dist/{professional-details-AASVGTUO.js → professional-details-IPTTXX52.js} +8 -8
  158. package/dist/{profile-ZNQEDSDM.js → profile-7AUYSTIZ.js} +8 -8
  159. package/dist/{promotions-MFAFFHF3.js → promotions-75P5F3ZB.js} +6 -6
  160. package/dist/{receive-224KLULH.js → receive-4IQGDJZU.js} +3 -3
  161. package/dist/{refund-IGMSXQNX.js → refund-BVIKFQVS.js} +3 -3
  162. package/dist/{register-3A6G6QNI.js → register-CUKIMHHO.js} +10 -10
  163. package/dist/{reset-password-FV5762CA.js → reset-password-MVLTJWIR.js} +1 -1
  164. package/dist/{return-reasons-QJRA2ZX6.js → return-reasons-WAS4YMAP.js} +3 -3
  165. package/dist/{sales-channels-CZDU7VTE.js → sales-channels-E6OYLORW.js} +2 -2
  166. package/dist/{sales-channels-U55MUDQP.js → sales-channels-NNQGBEEH.js} +2 -2
  167. package/dist/{settings-OKNGWUKL.js → settings-4OJUBMGV.js} +19 -19
  168. package/dist/{shipment-ZF7IRKKS.js → shipment-2UN3V3OO.js} +8 -8
  169. package/dist/{shipping-HWJPX34K.js → shipping-AYEJMMT6.js} +2 -2
  170. package/dist/{shipping-profile-3QKTQI6L.js → shipping-profile-6DNDCV3D.js} +1 -1
  171. package/dist/{shipping-profiles-FZCKGCBU.js → shipping-profiles-CUCOF54J.js} +11 -11
  172. package/dist/{stock-FI5WXVWN.js → stock-UWTFM2V7.js} +8 -8
  173. package/dist/{store-VFRKJYMD.js → store-DSU25BJD.js} +9 -9
  174. package/dist/{store-closure-WZIWGESD.js → store-closure-7NGEFWM2.js} +8 -8
  175. package/dist/{store-select-GKRDFGEY.js → store-select-XICZEMFW.js} +9 -9
  176. package/dist/{tax-regions-HDLBFZVG.js → tax-regions-2JCIB4T7.js} +2 -2
  177. package/dist/{team-CXEAYN7O.js → team-U6XLUSDE.js} +11 -11
  178. package/package.json +1 -1
  179. package/dist/allocate-items-TCM5A55Y.js +0 -548
  180. package/dist/create-WBZJFMA7.js +0 -224
  181. package/dist/product-variant-detail-BQL2NGVE.js +0 -209
@@ -1,3 +1,6 @@
1
+ import {
2
+ defineTabMeta
3
+ } from "./chunk-LEWA4BPH.js";
1
4
  import {
2
5
  DataGrid,
3
6
  createDataGridHelper
@@ -5,28 +8,24 @@ import {
5
8
  import {
6
9
  HandleInput
7
10
  } from "./chunk-HJ56YXBU.js";
8
- import {
9
- defineTabMeta
10
- } from "./chunk-LEWA4BPH.js";
11
11
  import {
12
12
  SwitchBox
13
13
  } from "./chunk-YVCBMOJG.js";
14
14
  import {
15
15
  SingleCategoryCombobox
16
- } from "./chunk-GAE6TKOR.js";
16
+ } from "./chunk-7GKAK7SG.js";
17
17
  import {
18
18
  useComboboxData
19
19
  } from "./chunk-OVPAOBZB.js";
20
20
  import {
21
21
  UploadMediaFormItem
22
- } from "./chunk-AQTEEQWX.js";
22
+ } from "./chunk-GDME2OBZ.js";
23
23
  import {
24
24
  PRODUCT_CREATE_FORM_DEFAULTS,
25
25
  ProductCreateSchema,
26
- decorateVariantsWithDefaultValues,
27
26
  generateVariantsFromAttributes,
28
27
  normalizeProductFormValues
29
- } from "./chunk-5YCDZ4AU.js";
28
+ } from "./chunk-NN7E6UBM.js";
30
29
  import {
31
30
  ChipInput
32
31
  } from "./chunk-YGRTRAWX.js";
@@ -52,20 +51,20 @@ import {
52
51
  } from "./chunk-3QSRE5LS.js";
53
52
  import {
54
53
  DataTable
55
- } from "./chunk-5T6UWTRU.js";
54
+ } from "./chunk-IV57G2CB.js";
56
55
  import {
57
56
  require_dist
58
57
  } from "./chunk-UCYSCKZV.js";
59
58
  import {
60
59
  useFeatureFlags
61
- } from "./chunk-R5QZO3QY.js";
60
+ } from "./chunk-UZQKGNIW.js";
62
61
  import {
63
62
  ActionMenu
64
63
  } from "./chunk-BDGZ4EQO.js";
65
64
  import {
66
65
  useCreateProduct,
67
66
  useProductAttributes
68
- } from "./chunk-JAUZ73XE.js";
67
+ } from "./chunk-6ORRPSPG.js";
69
68
  import {
70
69
  sdk,
71
70
  uploadFilesQuery
@@ -76,19 +75,19 @@ import {
76
75
 
77
76
  // src/pages/products/create/product-create.tsx
78
77
  import { Children as Children2 } from "react";
79
- import { useTranslation as useTranslation10 } from "react-i18next";
78
+ import { useTranslation as useTranslation9 } from "react-i18next";
80
79
 
81
80
  // src/pages/products/create/components/product-create-form/product-create-form.tsx
82
81
  var import_types6 = __toESM(require_dist(), 1);
83
82
  import { Button as Button3, toast } from "@medusajs/ui";
84
- import { useEffect as useEffect3, useMemo as useMemo5, Children } from "react";
85
- import { useForm, useWatch as useWatch3 } from "react-hook-form";
86
- import { useTranslation as useTranslation9 } from "react-i18next";
83
+ import { useEffect as useEffect3, useMemo as useMemo3, Children } from "react";
84
+ import { useForm, useWatch as useWatch2 } from "react-hook-form";
85
+ import { useTranslation as useTranslation8 } from "react-i18next";
87
86
  import { zodResolver } from "@hookform/resolvers/zod";
88
87
 
89
88
  // src/pages/products/create/components/product-create-attributes-form/product-create-attributes-form.tsx
90
89
  var import_types = __toESM(require_dist(), 1);
91
- import { CircleMiniFilledSolid, XMarkMini } from "@medusajs/icons";
90
+ import { EllipseMiniSolid, XMarkMini } from "@medusajs/icons";
92
91
  import {
93
92
  Button as Button2,
94
93
  Heading,
@@ -111,6 +110,63 @@ import {
111
110
  } from "react-hook-form";
112
111
  import { useTranslation as useTranslation2 } from "react-i18next";
113
112
 
113
+ // src/pages/products/create/components/product-create-attributes-form/attribute-merge.ts
114
+ var MULTI_SELECT = "multi_select";
115
+ var buildRequiredEntry = (attr) => ({
116
+ attribute_id: attr.id,
117
+ title: attr.name,
118
+ values: attr.type === MULTI_SELECT ? [] : "",
119
+ is_custom: false,
120
+ is_required: true,
121
+ use_for_variants: !!attr.is_variant_axis,
122
+ type: attr.type
123
+ });
124
+ var mergeRequiredAttributes = (current, productAttributes) => {
125
+ const requiredById = new Map(productAttributes.map((a) => [a.id, a]));
126
+ const present = /* @__PURE__ */ new Set();
127
+ let changed = false;
128
+ const next = current.map((entry) => {
129
+ if (!entry.is_custom && entry.attribute_id && requiredById.has(entry.attribute_id)) {
130
+ present.add(entry.attribute_id);
131
+ if (!entry.is_required) {
132
+ changed = true;
133
+ return { ...entry, is_required: true };
134
+ }
135
+ }
136
+ return entry;
137
+ });
138
+ for (const attr of productAttributes) {
139
+ if (!present.has(attr.id)) {
140
+ next.push(buildRequiredEntry(attr));
141
+ changed = true;
142
+ }
143
+ }
144
+ return changed ? next : current;
145
+ };
146
+ var mergeSelectedAttributes = (current, selected) => {
147
+ const selectedById = new Map(
148
+ selected.filter((a) => a.attribute_id).map((a) => [a.attribute_id, a])
149
+ );
150
+ const next = [];
151
+ for (const entry of current) {
152
+ if (entry.is_custom) {
153
+ next.push(entry);
154
+ continue;
155
+ }
156
+ if (entry.attribute_id && selectedById.has(entry.attribute_id)) {
157
+ next.push(selectedById.get(entry.attribute_id));
158
+ selectedById.delete(entry.attribute_id);
159
+ }
160
+ }
161
+ for (const attr of selected) {
162
+ if (attr.attribute_id && selectedById.has(attr.attribute_id)) {
163
+ next.push(attr);
164
+ selectedById.delete(attr.attribute_id);
165
+ }
166
+ }
167
+ return next;
168
+ };
169
+
114
170
  // src/pages/products/create/components/product-create-attributes-form/product-create-add-attributes-modal.tsx
115
171
  import {
116
172
  Badge,
@@ -227,7 +283,6 @@ var ProductCreateAddAttributesModal = () => {
227
283
  };
228
284
  const handleAdd = () => {
229
285
  const currentAttributes = getValues("attributes") ?? [];
230
- const customAttributes = currentAttributes.filter((a) => a.is_custom);
231
286
  const requiredIds = new Set(
232
287
  product_attributes?.filter((a) => a.is_required).map((a) => a.id) ?? []
233
288
  );
@@ -241,10 +296,14 @@ var ProductCreateAddAttributesModal = () => {
241
296
  type: a.type,
242
297
  available_values: a.available_values
243
298
  }));
244
- setValue("attributes", [...selectedAttributes, ...customAttributes], {
245
- shouldDirty: true,
246
- shouldTouch: true
247
- });
299
+ setValue(
300
+ "attributes",
301
+ mergeSelectedAttributes(currentAttributes, selectedAttributes),
302
+ {
303
+ shouldDirty: true,
304
+ shouldTouch: true
305
+ }
306
+ );
248
307
  setIsOpen(ADD_ATTRIBUTES_MODAL_ID, false);
249
308
  };
250
309
  const filters = useAttributeTableFilters();
@@ -285,7 +344,6 @@ var ProductCreateAddAttributesModal = () => {
285
344
  isLoading,
286
345
  layout: "fill",
287
346
  prefix: ADD_ATTRIBUTES_MODAL_ID,
288
- compact: true,
289
347
  emptyState
290
348
  }
291
349
  )
@@ -768,26 +826,13 @@ var RequiredAttributes = () => {
768
826
  useEffect2(() => {
769
827
  if (!product_attributes) return;
770
828
  const currentAttributes = form.getValues("attributes") || [];
771
- const requiredIds = new Set(product_attributes.map((a) => a.id));
772
- const otherAttributes = currentAttributes.filter(
773
- (a) => a.is_custom || !requiredIds.has(a.attribute_id ?? "")
829
+ const nextAttributes = mergeRequiredAttributes(
830
+ currentAttributes,
831
+ product_attributes
774
832
  );
775
- const requiredAttributes = product_attributes.map((attr) => {
776
- const existing = currentAttributes.find(
777
- (a) => a.attribute_id === attr.id
778
- );
779
- if (existing) return existing;
780
- return {
781
- attribute_id: attr.id,
782
- title: attr.name,
783
- values: attr.type === import_types.AttributeType.MULTI_SELECT ? [] : "",
784
- is_custom: false,
785
- is_required: true,
786
- use_for_variants: attr.is_variant_axis,
787
- type: attr.type
788
- };
789
- });
790
- form.setValue("attributes", [...otherAttributes, ...requiredAttributes]);
833
+ if (nextAttributes !== currentAttributes) {
834
+ form.setValue("attributes", nextAttributes);
835
+ }
791
836
  }, [product_attributes]);
792
837
  if (!categoryId || !product_attributes?.length) return null;
793
838
  const requiredEntries = attributes.map((attr, index) => ({ attr, index })).filter(({ attr }) => !attr.is_custom);
@@ -829,7 +874,7 @@ var RadioSelectItem = forwardRef(({ className, children, ...props }, ref) => /*
829
874
  ),
830
875
  ...props,
831
876
  children: [
832
- /* @__PURE__ */ jsx2("span", { className: "flex h-[15px] w-[15px] items-center justify-center", children: /* @__PURE__ */ jsx2(RadixSelect.ItemIndicator, { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx2(CircleMiniFilledSolid, {}) }) }),
877
+ /* @__PURE__ */ jsx2("span", { className: "flex h-[15px] w-[15px] items-center justify-center", children: /* @__PURE__ */ jsx2(RadixSelect.ItemIndicator, { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx2(EllipseMiniSolid, {}) }) }),
833
878
  /* @__PURE__ */ jsx2(RadixSelect.ItemText, { className: "flex-1 truncate", children })
834
879
  ]
835
880
  }
@@ -948,8 +993,8 @@ Root._tabMeta = defineTabMeta({
948
993
  var ProductCreateAttributesForm = Root;
949
994
 
950
995
  // src/pages/products/create/components/product-create-details-form/product-create-details-form.tsx
951
- import { Heading as Heading3 } from "@medusajs/ui";
952
- import { useTranslation as useTranslation6 } from "react-i18next";
996
+ import { Heading as Heading2 } from "@medusajs/ui";
997
+ import { useTranslation as useTranslation5 } from "react-i18next";
953
998
 
954
999
  // src/pages/products/create/components/product-create-details-form/components/product-create-details-general-section/product-create-general-section.tsx
955
1000
  import { Input as Input2, Textarea as Textarea2 } from "@medusajs/ui";
@@ -1317,381 +1362,32 @@ function formatFileSize(bytes, decimalPlaces = 2) {
1317
1362
  return parseFloat((bytes / Math.pow(k, i)).toFixed(decimalPlaces)) + " " + sizes[i];
1318
1363
  }
1319
1364
 
1320
- // src/pages/products/create/components/product-create-details-form/components/product-create-details-variant-section/product-create-details-variant-section.tsx
1321
- import {
1322
- Alert,
1323
- Checkbox as Checkbox2,
1324
- clx as clx3,
1325
- Heading as Heading2,
1326
- Hint as Hint2,
1327
- InlineTip as InlineTip2,
1328
- Label as Label2,
1329
- Text as Text3
1330
- } from "@medusajs/ui";
1331
- import { useFieldArray as useFieldArray3, useWatch } from "react-hook-form";
1332
- import { useTranslation as useTranslation5 } from "react-i18next";
1333
- import { useMemo as useMemo3 } from "react";
1334
-
1335
- // src/components/common/sortable-list/sortable-list.tsx
1336
- import {
1337
- DndContext as DndContext2,
1338
- DragOverlay as DragOverlay2,
1339
- KeyboardSensor as KeyboardSensor2,
1340
- PointerSensor as PointerSensor2,
1341
- defaultDropAnimationSideEffects as defaultDropAnimationSideEffects2,
1342
- useSensor as useSensor2,
1343
- useSensors as useSensors2
1344
- } from "@dnd-kit/core";
1345
- import {
1346
- SortableContext as SortableContext2,
1347
- arrayMove as arrayMove2,
1348
- sortableKeyboardCoordinates as sortableKeyboardCoordinates2,
1349
- useSortable as useSortable2
1350
- } from "@dnd-kit/sortable";
1351
- import { CSS as CSS2 } from "@dnd-kit/utilities";
1352
- import { DotsSix as DotsSix2 } from "@medusajs/icons";
1353
- import { IconButton as IconButton3, clx as clx2 } from "@medusajs/ui";
1354
- import {
1355
- Fragment as Fragment2,
1356
- createContext,
1357
- useContext,
1358
- useMemo as useMemo2,
1359
- useState as useState3
1360
- } from "react";
1361
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1362
- var List = ({
1363
- items,
1364
- onChange,
1365
- renderItem
1366
- }) => {
1367
- const [active, setActive] = useState3(null);
1368
- const [activeItem, activeIndex] = useMemo2(() => {
1369
- if (active === null) {
1370
- return [null, null];
1371
- }
1372
- const index = items.findIndex(({ id }) => id === active.id);
1373
- return [items[index], index];
1374
- }, [active, items]);
1375
- const sensors = useSensors2(
1376
- useSensor2(PointerSensor2),
1377
- useSensor2(KeyboardSensor2, {
1378
- coordinateGetter: sortableKeyboardCoordinates2
1379
- })
1380
- );
1381
- const handleDragStart = ({ active: active2 }) => {
1382
- setActive(active2);
1383
- };
1384
- const handleDragEnd = ({ active: active2, over }) => {
1385
- if (over && active2.id !== over.id) {
1386
- const activeIndex2 = items.findIndex(({ id }) => id === active2.id);
1387
- const overIndex = items.findIndex(({ id }) => id === over.id);
1388
- onChange(arrayMove2(items, activeIndex2, overIndex));
1389
- }
1390
- setActive(null);
1391
- };
1392
- const handleDragCancel = () => {
1393
- setActive(null);
1394
- };
1395
- return /* @__PURE__ */ jsxs5(
1396
- DndContext2,
1397
- {
1398
- sensors,
1399
- onDragStart: handleDragStart,
1400
- onDragEnd: handleDragEnd,
1401
- onDragCancel: handleDragCancel,
1402
- children: [
1403
- /* @__PURE__ */ jsx5(Overlay, { children: activeItem && activeIndex !== null ? renderItem(activeItem, activeIndex) : null }),
1404
- /* @__PURE__ */ jsx5(SortableContext2, { items, children: /* @__PURE__ */ jsx5(
1405
- "ul",
1406
- {
1407
- role: "application",
1408
- className: "flex list-inside list-none list-image-none flex-col p-0",
1409
- children: items.map((item, index) => /* @__PURE__ */ jsx5(Fragment2, { children: renderItem(item, index) }, item.id))
1410
- }
1411
- ) })
1412
- ]
1413
- }
1414
- );
1415
- };
1416
- var dropAnimationConfig2 = {
1417
- sideEffects: defaultDropAnimationSideEffects2({
1418
- styles: {
1419
- active: {
1420
- opacity: "0.4"
1421
- }
1422
- }
1423
- })
1424
- };
1425
- var Overlay = ({ children }) => {
1426
- return /* @__PURE__ */ jsx5(
1427
- DragOverlay2,
1428
- {
1429
- className: "shadow-elevation-card-hover overflow-hidden rounded-md [&>li]:border-b-0",
1430
- dropAnimation: dropAnimationConfig2,
1431
- children
1432
- }
1433
- );
1434
- };
1435
- var SortableItemContext = createContext(null);
1436
- var useSortableItemContext = () => {
1437
- const context = useContext(SortableItemContext);
1438
- if (!context) {
1439
- throw new Error(
1440
- "useSortableItemContext must be used within a SortableItemContext"
1441
- );
1442
- }
1443
- return context;
1444
- };
1445
- var Item = ({
1446
- id,
1447
- className,
1448
- children
1449
- }) => {
1450
- const {
1451
- attributes,
1452
- isDragging,
1453
- listeners,
1454
- setNodeRef,
1455
- setActivatorNodeRef,
1456
- transform,
1457
- transition
1458
- } = useSortable2({ id });
1459
- const context = useMemo2(
1460
- () => ({
1461
- attributes,
1462
- listeners,
1463
- ref: setActivatorNodeRef,
1464
- isDragging
1465
- }),
1466
- [attributes, listeners, setActivatorNodeRef, isDragging]
1467
- );
1468
- const style = {
1469
- opacity: isDragging ? 0.4 : void 0,
1470
- transform: CSS2.Translate.toString(transform),
1471
- transition
1472
- };
1473
- return /* @__PURE__ */ jsx5(SortableItemContext.Provider, { value: context, children: /* @__PURE__ */ jsx5(
1474
- "li",
1475
- {
1476
- className: clx2("transition-fg flex flex-1 list-none", className),
1477
- ref: setNodeRef,
1478
- style,
1479
- children
1480
- }
1481
- ) });
1482
- };
1483
- var DragHandle = () => {
1484
- const { attributes, listeners, ref } = useSortableItemContext();
1485
- return /* @__PURE__ */ jsx5(
1486
- IconButton3,
1487
- {
1488
- variant: "transparent",
1489
- size: "small",
1490
- ...attributes,
1491
- ...listeners,
1492
- ref,
1493
- className: "cursor-grab touch-none active:cursor-grabbing",
1494
- children: /* @__PURE__ */ jsx5(DotsSix2, { className: "text-ui-fg-muted" })
1495
- }
1496
- );
1497
- };
1498
- var SortableList = Object.assign(List, {
1499
- Item,
1500
- DragHandle
1501
- });
1502
-
1503
- // src/pages/products/create/components/product-create-details-form/components/product-create-details-variant-section/product-create-details-variant-section.tsx
1504
- import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1505
- var ProductCreateVariantsSection = () => {
1506
- const form = useTabbedForm();
1507
- const { t } = useTranslation5();
1508
- const variants = useFieldArray3({
1509
- control: form.control,
1510
- name: "variants"
1511
- });
1512
- const watchedAttributes = useWatch({
1513
- control: form.control,
1514
- name: "attributes",
1515
- defaultValue: []
1516
- });
1517
- const watchedVariants = useWatch({
1518
- control: form.control,
1519
- name: "variants",
1520
- defaultValue: []
1521
- });
1522
- const variantAxes = useMemo3(() => {
1523
- return (watchedAttributes ?? []).filter((attr) => attr.use_for_variants).map((attr) => ({
1524
- title: attr.title,
1525
- values: Array.isArray(attr.values) ? attr.values : attr.values ? [attr.values] : []
1526
- })).filter((axis) => axis.title && axis.values.length > 0);
1527
- }, [watchedAttributes]);
1528
- const hasVariantAxes = variantAxes.length > 0;
1529
- const showInvalidVariantsMessage = form.formState.errors.variants?.root?.message === "invalid_length";
1530
- const handleRankChange = (items) => {
1531
- const update = items.map((item, index) => {
1532
- const variant = watchedVariants.find((v) => v.title === item.title);
1533
- return {
1534
- id: item.id,
1535
- ...variant || item,
1536
- variant_rank: index
1537
- };
1538
- });
1539
- variants.replace(update);
1540
- };
1541
- const getCheckboxState = (variants2) => {
1542
- if (variants2.every((variant) => variant.should_create)) {
1543
- return true;
1544
- }
1545
- if (variants2.some((variant) => variant.should_create)) {
1546
- return "indeterminate";
1547
- }
1548
- return false;
1549
- };
1550
- const onCheckboxChange = (value) => {
1551
- switch (value) {
1552
- case true: {
1553
- const update = watchedVariants.map((variant) => ({
1554
- ...variant,
1555
- should_create: true
1556
- }));
1557
- form.setValue("variants", update);
1558
- break;
1559
- }
1560
- case false: {
1561
- const update = watchedVariants.map((variant) => ({
1562
- ...variant,
1563
- should_create: false
1564
- }));
1565
- form.setValue("variants", decorateVariantsWithDefaultValues(update));
1566
- break;
1567
- }
1568
- case "indeterminate":
1569
- break;
1570
- }
1571
- };
1572
- if (!hasVariantAxes) {
1573
- return null;
1574
- }
1575
- return /* @__PURE__ */ jsxs6(
1576
- "div",
1577
- {
1578
- id: "variants",
1579
- className: "flex flex-col gap-y-8",
1580
- "data-testid": "product-create-variants-section",
1581
- children: [
1582
- /* @__PURE__ */ jsx6("div", { className: "flex flex-col gap-y-6", children: /* @__PURE__ */ jsx6(Heading2, { level: "h2", children: t("products.create.variants.header") }) }),
1583
- /* @__PURE__ */ jsx6("div", { className: "grid grid-cols-1 gap-x-4 gap-y-8", children: /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-y-6", children: [
1584
- /* @__PURE__ */ jsxs6("div", { className: "flex flex-col", children: [
1585
- /* @__PURE__ */ jsx6(Label2, { weight: "plus", children: t("products.create.variants.productVariants.label") }),
1586
- /* @__PURE__ */ jsx6(Hint2, { children: t("products.create.variants.productVariants.hint") })
1587
- ] }),
1588
- showInvalidVariantsMessage && /* @__PURE__ */ jsx6(Alert, { dismissible: true, variant: "error", children: t("products.create.errors.variants") }),
1589
- variants.fields.length > 0 ? /* @__PURE__ */ jsxs6("div", { className: "overflow-hidden rounded-xl border", children: [
1590
- /* @__PURE__ */ jsxs6(
1591
- "div",
1592
- {
1593
- className: "bg-ui-bg-component text-ui-fg-subtle grid items-center gap-3 border-b px-6 py-2.5",
1594
- style: {
1595
- gridTemplateColumns: `20px 28px repeat(${variantAxes.length}, 1fr)`
1596
- },
1597
- children: [
1598
- /* @__PURE__ */ jsx6("div", { children: /* @__PURE__ */ jsx6(
1599
- Checkbox2,
1600
- {
1601
- className: "relative",
1602
- checked: getCheckboxState(watchedVariants),
1603
- onCheckedChange: onCheckboxChange
1604
- }
1605
- ) }),
1606
- /* @__PURE__ */ jsx6("div", {}),
1607
- variantAxes.map((axis, index) => /* @__PURE__ */ jsx6("div", { children: /* @__PURE__ */ jsx6(Text3, { size: "small", leading: "compact", weight: "plus", children: axis.title }) }, index))
1608
- ]
1609
- }
1610
- ),
1611
- /* @__PURE__ */ jsx6(
1612
- SortableList,
1613
- {
1614
- items: variants.fields,
1615
- onChange: handleRankChange,
1616
- renderItem: (item, index) => {
1617
- return /* @__PURE__ */ jsx6(
1618
- SortableList.Item,
1619
- {
1620
- id: item.id,
1621
- className: clx3("bg-ui-bg-base border-b", {
1622
- "border-b-0": index === variants.fields.length - 1
1623
- }),
1624
- children: /* @__PURE__ */ jsxs6(
1625
- "div",
1626
- {
1627
- className: "text-ui-fg-subtle grid w-full items-center gap-3 px-6 py-2.5",
1628
- style: {
1629
- gridTemplateColumns: `20px 28px repeat(${variantAxes.length}, 1fr)`
1630
- },
1631
- children: [
1632
- /* @__PURE__ */ jsx6(
1633
- Form.Field,
1634
- {
1635
- control: form.control,
1636
- name: `variants.${index}.should_create`,
1637
- render: ({
1638
- field: { value, onChange, ...field }
1639
- }) => /* @__PURE__ */ jsx6(Form.Item, { children: /* @__PURE__ */ jsx6(Form.Control, { children: /* @__PURE__ */ jsx6(
1640
- Checkbox2,
1641
- {
1642
- className: "relative",
1643
- ...field,
1644
- checked: value,
1645
- onCheckedChange: onChange
1646
- }
1647
- ) }) })
1648
- }
1649
- ),
1650
- /* @__PURE__ */ jsx6(SortableList.DragHandle, {}),
1651
- variantAxes.map((axis, i) => /* @__PURE__ */ jsx6(Text3, { size: "small", leading: "compact", children: item.options?.[axis.title] ?? "-" }, i))
1652
- ]
1653
- }
1654
- )
1655
- }
1656
- );
1657
- }
1658
- }
1659
- )
1660
- ] }) : /* @__PURE__ */ jsx6(Alert, { children: t("products.create.variants.productVariants.alert") }),
1661
- variants.fields.length > 0 && /* @__PURE__ */ jsx6(InlineTip2, { label: t("general.tip"), children: t("products.create.variants.productVariants.tip") })
1662
- ] }) })
1663
- ]
1664
- }
1665
- );
1666
- };
1667
-
1668
1365
  // src/pages/products/create/components/product-create-details-form/product-create-details-form.tsx
1669
- import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1366
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1670
1367
  var Root2 = () => {
1671
- return /* @__PURE__ */ jsx7(
1368
+ return /* @__PURE__ */ jsx5(
1672
1369
  "div",
1673
1370
  {
1674
1371
  className: "flex flex-col items-center p-16",
1675
1372
  "data-testid": "product-create-details-form",
1676
- children: /* @__PURE__ */ jsxs7(
1373
+ children: /* @__PURE__ */ jsxs5(
1677
1374
  "div",
1678
1375
  {
1679
1376
  className: "flex w-full max-w-[720px] flex-col gap-y-8",
1680
1377
  "data-testid": "product-create-details-form-content",
1681
1378
  children: [
1682
- /* @__PURE__ */ jsx7(Header, {}),
1683
- /* @__PURE__ */ jsxs7(
1379
+ /* @__PURE__ */ jsx5(Header, {}),
1380
+ /* @__PURE__ */ jsxs5(
1684
1381
  "div",
1685
1382
  {
1686
1383
  className: "flex flex-col gap-y-6",
1687
1384
  "data-testid": "product-create-details-form-sections",
1688
1385
  children: [
1689
- /* @__PURE__ */ jsx7(ProductCreateGeneralSection, {}),
1690
- /* @__PURE__ */ jsx7(ProductCreateMediaSection, {})
1386
+ /* @__PURE__ */ jsx5(ProductCreateGeneralSection, {}),
1387
+ /* @__PURE__ */ jsx5(ProductCreateMediaSection, {})
1691
1388
  ]
1692
1389
  }
1693
- ),
1694
- /* @__PURE__ */ jsx7(ProductCreateVariantsSection, {})
1390
+ )
1695
1391
  ]
1696
1392
  }
1697
1393
  )
@@ -1705,24 +1401,24 @@ Root2._tabMeta = defineTabMeta({
1705
1401
  });
1706
1402
  var ProductCreateDetailsForm = Root2;
1707
1403
  var Header = () => {
1708
- const { t } = useTranslation6();
1709
- return /* @__PURE__ */ jsx7(
1404
+ const { t } = useTranslation5();
1405
+ return /* @__PURE__ */ jsx5(
1710
1406
  "div",
1711
1407
  {
1712
1408
  className: "flex flex-col",
1713
1409
  "data-testid": "product-create-details-form-header",
1714
- children: /* @__PURE__ */ jsx7(Heading3, { "data-testid": "product-create-details-form-heading", children: t("products.create.header") })
1410
+ children: /* @__PURE__ */ jsx5(Heading2, { "data-testid": "product-create-details-form-heading", children: t("products.create.header") })
1715
1411
  }
1716
1412
  );
1717
1413
  };
1718
1414
 
1719
1415
  // src/pages/products/create/components/product-create-organize-form/components/product-create-organize-section/product-create-details-organize-section.tsx
1720
- import { Heading as Heading4 } from "@medusajs/ui";
1721
- import { useTranslation as useTranslation7 } from "react-i18next";
1722
- import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
1416
+ import { Heading as Heading3 } from "@medusajs/ui";
1417
+ import { useTranslation as useTranslation6 } from "react-i18next";
1418
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1723
1419
  var ProductCreateOrganizationSection = () => {
1724
1420
  const form = useTabbedForm();
1725
- const { t } = useTranslation7();
1421
+ const { t } = useTranslation6();
1726
1422
  const collections = useComboboxData({
1727
1423
  queryKey: ["product_collections"],
1728
1424
  queryFn: (params) => sdk.vendor.collections.query(params),
@@ -1747,9 +1443,9 @@ var ProductCreateOrganizationSection = () => {
1747
1443
  value: tag.id
1748
1444
  }))
1749
1445
  });
1750
- return /* @__PURE__ */ jsxs8("div", { id: "organize", className: "flex flex-col gap-y-8", "data-testid": "product-create-organize-section", children: [
1751
- /* @__PURE__ */ jsx8(Heading4, { "data-testid": "product-create-organize-section-heading", children: t("products.organization.header") }),
1752
- /* @__PURE__ */ jsx8(
1446
+ return /* @__PURE__ */ jsxs6("div", { id: "organize", className: "flex flex-col gap-y-8", "data-testid": "product-create-organize-section", children: [
1447
+ /* @__PURE__ */ jsx6(Heading3, { "data-testid": "product-create-organize-section-heading", children: t("products.organization.header") }),
1448
+ /* @__PURE__ */ jsx6(
1753
1449
  SwitchBox,
1754
1450
  {
1755
1451
  control: form.control,
@@ -1759,15 +1455,15 @@ var ProductCreateOrganizationSection = () => {
1759
1455
  optional: true
1760
1456
  }
1761
1457
  ),
1762
- /* @__PURE__ */ jsxs8("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", "data-testid": "product-create-organize-section-category-collection", children: [
1763
- /* @__PURE__ */ jsx8(
1458
+ /* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", "data-testid": "product-create-organize-section-category-collection", children: [
1459
+ /* @__PURE__ */ jsx6(
1764
1460
  Form.Field,
1765
1461
  {
1766
1462
  control: form.control,
1767
1463
  name: "category_id",
1768
1464
  render: ({ field }) => {
1769
- return /* @__PURE__ */ jsxs8(Form.Item, { "data-testid": "product-create-organize-section-category-item", children: [
1770
- /* @__PURE__ */ jsx8(
1465
+ return /* @__PURE__ */ jsxs6(Form.Item, { "data-testid": "product-create-organize-section-category-item", children: [
1466
+ /* @__PURE__ */ jsx6(
1771
1467
  Form.Label,
1772
1468
  {
1773
1469
  tooltip: t("products.fields.primaryCategory.tooltip"),
@@ -1775,21 +1471,21 @@ var ProductCreateOrganizationSection = () => {
1775
1471
  children: t("fields.category")
1776
1472
  }
1777
1473
  ),
1778
- /* @__PURE__ */ jsx8(Form.Control, { "data-testid": "product-create-organize-section-category-control", children: /* @__PURE__ */ jsx8(SingleCategoryCombobox, { ...field }) }),
1779
- /* @__PURE__ */ jsx8(Form.ErrorMessage, {})
1474
+ /* @__PURE__ */ jsx6(Form.Control, { "data-testid": "product-create-organize-section-category-control", children: /* @__PURE__ */ jsx6(SingleCategoryCombobox, { ...field }) }),
1475
+ /* @__PURE__ */ jsx6(Form.ErrorMessage, {})
1780
1476
  ] });
1781
1477
  }
1782
1478
  }
1783
1479
  ),
1784
- /* @__PURE__ */ jsx8(
1480
+ /* @__PURE__ */ jsx6(
1785
1481
  Form.Field,
1786
1482
  {
1787
1483
  control: form.control,
1788
1484
  name: "collection_id",
1789
1485
  render: ({ field }) => {
1790
- return /* @__PURE__ */ jsxs8(Form.Item, { "data-testid": "product-create-organize-section-collection-item", children: [
1791
- /* @__PURE__ */ jsx8(Form.Label, { optional: true, "data-testid": "product-create-organize-section-collection-label", children: t("products.fields.collection.label") }),
1792
- /* @__PURE__ */ jsx8(Form.Control, { "data-testid": "product-create-organize-section-collection-control", children: /* @__PURE__ */ jsx8(
1486
+ return /* @__PURE__ */ jsxs6(Form.Item, { "data-testid": "product-create-organize-section-collection-item", children: [
1487
+ /* @__PURE__ */ jsx6(Form.Label, { optional: true, "data-testid": "product-create-organize-section-collection-label", children: t("products.fields.collection.label") }),
1488
+ /* @__PURE__ */ jsx6(Form.Control, { "data-testid": "product-create-organize-section-collection-control", children: /* @__PURE__ */ jsx6(
1793
1489
  Combobox,
1794
1490
  {
1795
1491
  ...field,
@@ -1799,22 +1495,22 @@ var ProductCreateOrganizationSection = () => {
1799
1495
  fetchNextPage: collections.fetchNextPage
1800
1496
  }
1801
1497
  ) }),
1802
- /* @__PURE__ */ jsx8(Form.ErrorMessage, {})
1498
+ /* @__PURE__ */ jsx6(Form.ErrorMessage, {})
1803
1499
  ] });
1804
1500
  }
1805
1501
  }
1806
1502
  )
1807
1503
  ] }),
1808
- /* @__PURE__ */ jsxs8("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", "data-testid": "product-create-organize-section-type-tags", children: [
1809
- /* @__PURE__ */ jsx8(
1504
+ /* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", "data-testid": "product-create-organize-section-type-tags", children: [
1505
+ /* @__PURE__ */ jsx6(
1810
1506
  Form.Field,
1811
1507
  {
1812
1508
  control: form.control,
1813
1509
  name: "type_id",
1814
1510
  render: ({ field }) => {
1815
- return /* @__PURE__ */ jsxs8(Form.Item, { "data-testid": "product-create-organize-section-type-item", children: [
1816
- /* @__PURE__ */ jsx8(Form.Label, { optional: true, "data-testid": "product-create-organize-section-type-label", children: t("products.fields.type.label") }),
1817
- /* @__PURE__ */ jsx8(Form.Control, { "data-testid": "product-create-organize-section-type-control", children: /* @__PURE__ */ jsx8(
1511
+ return /* @__PURE__ */ jsxs6(Form.Item, { "data-testid": "product-create-organize-section-type-item", children: [
1512
+ /* @__PURE__ */ jsx6(Form.Label, { optional: true, "data-testid": "product-create-organize-section-type-label", children: t("products.fields.type.label") }),
1513
+ /* @__PURE__ */ jsx6(Form.Control, { "data-testid": "product-create-organize-section-type-control", children: /* @__PURE__ */ jsx6(
1818
1514
  Combobox,
1819
1515
  {
1820
1516
  ...field,
@@ -1824,20 +1520,20 @@ var ProductCreateOrganizationSection = () => {
1824
1520
  fetchNextPage: types.fetchNextPage
1825
1521
  }
1826
1522
  ) }),
1827
- /* @__PURE__ */ jsx8(Form.ErrorMessage, {})
1523
+ /* @__PURE__ */ jsx6(Form.ErrorMessage, {})
1828
1524
  ] });
1829
1525
  }
1830
1526
  }
1831
1527
  ),
1832
- /* @__PURE__ */ jsx8(
1528
+ /* @__PURE__ */ jsx6(
1833
1529
  Form.Field,
1834
1530
  {
1835
1531
  control: form.control,
1836
1532
  name: "tags",
1837
1533
  render: ({ field }) => {
1838
- return /* @__PURE__ */ jsxs8(Form.Item, { "data-testid": "product-create-organize-section-tags-item", children: [
1839
- /* @__PURE__ */ jsx8(Form.Label, { optional: true, "data-testid": "product-create-organize-section-tags-label", children: t("products.fields.tags.label") }),
1840
- /* @__PURE__ */ jsx8(Form.Control, { "data-testid": "product-create-organize-section-tags-control", children: /* @__PURE__ */ jsx8(
1534
+ return /* @__PURE__ */ jsxs6(Form.Item, { "data-testid": "product-create-organize-section-tags-item", children: [
1535
+ /* @__PURE__ */ jsx6(Form.Label, { optional: true, "data-testid": "product-create-organize-section-tags-label", children: t("products.fields.tags.label") }),
1536
+ /* @__PURE__ */ jsx6(Form.Control, { "data-testid": "product-create-organize-section-tags-control", children: /* @__PURE__ */ jsx6(
1841
1537
  Combobox,
1842
1538
  {
1843
1539
  ...field,
@@ -1847,7 +1543,7 @@ var ProductCreateOrganizationSection = () => {
1847
1543
  fetchNextPage: tags.fetchNextPage
1848
1544
  }
1849
1545
  ) }),
1850
- /* @__PURE__ */ jsx8(Form.ErrorMessage, {})
1546
+ /* @__PURE__ */ jsx6(Form.ErrorMessage, {})
1851
1547
  ] });
1852
1548
  }
1853
1549
  }
@@ -1857,19 +1553,19 @@ var ProductCreateOrganizationSection = () => {
1857
1553
  };
1858
1554
 
1859
1555
  // src/pages/products/create/components/product-create-organize-form/product-create-organize-form.tsx
1860
- import { jsx as jsx9 } from "react/jsx-runtime";
1556
+ import { jsx as jsx7 } from "react/jsx-runtime";
1861
1557
  var Root3 = () => {
1862
- return /* @__PURE__ */ jsx9(
1558
+ return /* @__PURE__ */ jsx7(
1863
1559
  "div",
1864
1560
  {
1865
1561
  className: "flex flex-col items-center p-16",
1866
1562
  "data-testid": "product-create-organize-form",
1867
- children: /* @__PURE__ */ jsx9(
1563
+ children: /* @__PURE__ */ jsx7(
1868
1564
  "div",
1869
1565
  {
1870
1566
  className: "flex w-full max-w-[720px] flex-col gap-y-8",
1871
1567
  "data-testid": "product-create-organize-form-content",
1872
- children: /* @__PURE__ */ jsx9(ProductCreateOrganizationSection, {})
1568
+ children: /* @__PURE__ */ jsx7(ProductCreateOrganizationSection, {})
1873
1569
  }
1874
1570
  )
1875
1571
  }
@@ -1896,30 +1592,33 @@ Root3._tabMeta = defineTabMeta({
1896
1592
  var ProductCreateOrganizeForm = Root3;
1897
1593
 
1898
1594
  // src/pages/products/create/components/product-create-variants-form/product-create-variants-form.tsx
1899
- import { useMemo as useMemo4 } from "react";
1900
- import { useWatch as useWatch2 } from "react-hook-form";
1901
- import { useTranslation as useTranslation8 } from "react-i18next";
1902
- import { jsx as jsx10 } from "react/jsx-runtime";
1595
+ import { Input as Input3 } from "@medusajs/ui";
1596
+ import { useMemo as useMemo2, useState as useState3 } from "react";
1597
+ import { useWatch } from "react-hook-form";
1598
+ import { useTranslation as useTranslation7 } from "react-i18next";
1599
+ import { jsx as jsx8 } from "react/jsx-runtime";
1903
1600
  var Root4 = () => {
1601
+ const { t } = useTranslation7();
1904
1602
  const form = useTabbedForm();
1905
1603
  const { setCloseOnEscape } = useRouteModal();
1906
- const variants = useWatch2({
1604
+ const [search, setSearch] = useState3("");
1605
+ const variants = useWatch({
1907
1606
  control: form.control,
1908
1607
  name: "variants",
1909
1608
  defaultValue: []
1910
1609
  });
1911
- const watchedAttributes = useWatch2({
1610
+ const watchedAttributes = useWatch({
1912
1611
  control: form.control,
1913
1612
  name: "attributes",
1914
1613
  defaultValue: []
1915
1614
  });
1916
- const variantAxes = useMemo4(() => {
1615
+ const variantAxes = useMemo2(() => {
1917
1616
  return (watchedAttributes ?? []).filter((attr) => attr.use_for_variants && attr.title).map((attr) => ({
1918
1617
  title: attr.title
1919
1618
  }));
1920
1619
  }, [watchedAttributes]);
1921
1620
  const columns = useColumns2({ variantAxes });
1922
- const variantData = useMemo4(() => {
1621
+ const variantData = useMemo2(() => {
1923
1622
  const ret = [];
1924
1623
  variants.forEach((v, i) => {
1925
1624
  if (v.should_create) {
@@ -1928,18 +1627,47 @@ var Root4 = () => {
1928
1627
  });
1929
1628
  return ret;
1930
1629
  }, [variants]);
1931
- return /* @__PURE__ */ jsx10(
1630
+ const filteredVariantData = useMemo2(() => {
1631
+ const query = search.trim().toLowerCase();
1632
+ if (!query) {
1633
+ return variantData;
1634
+ }
1635
+ return variantData.filter((variant) => {
1636
+ const haystack = [
1637
+ variant.title,
1638
+ variant.sku,
1639
+ ...Object.values(variant.options ?? {})
1640
+ ];
1641
+ return haystack.some((value) => value?.toLowerCase().includes(query));
1642
+ });
1643
+ }, [variantData, search]);
1644
+ const headerContent = /* @__PURE__ */ jsx8(
1645
+ Input3,
1646
+ {
1647
+ type: "search",
1648
+ size: "small",
1649
+ autoComplete: "off",
1650
+ value: search,
1651
+ onChange: (event) => setSearch(event.target.value),
1652
+ placeholder: t(
1653
+ "products.create.variants.productVariants.searchPlaceholder"
1654
+ ),
1655
+ "data-testid": "product-create-variants-search-input"
1656
+ }
1657
+ );
1658
+ return /* @__PURE__ */ jsx8(
1932
1659
  "div",
1933
1660
  {
1934
1661
  className: "flex size-full flex-col divide-y overflow-hidden",
1935
1662
  "data-testid": "product-create-variants-form",
1936
- children: /* @__PURE__ */ jsx10("div", { "data-testid": "product-create-variants-form-datagrid", children: /* @__PURE__ */ jsx10(
1663
+ children: /* @__PURE__ */ jsx8("div", { "data-testid": "product-create-variants-form-datagrid", children: /* @__PURE__ */ jsx8(
1937
1664
  DataGrid,
1938
1665
  {
1939
1666
  columns,
1940
- data: variantData,
1667
+ data: filteredVariantData,
1941
1668
  state: form,
1942
- onEditingChange: (editing) => setCloseOnEscape(!editing)
1669
+ onEditingChange: (editing) => setCloseOnEscape(!editing),
1670
+ headerContent
1943
1671
  }
1944
1672
  ) })
1945
1673
  }
@@ -1955,14 +1683,14 @@ var columnHelper2 = createDataGridHelper();
1955
1683
  var useColumns2 = ({
1956
1684
  variantAxes
1957
1685
  }) => {
1958
- const { t } = useTranslation8();
1959
- return useMemo4(
1686
+ const { t } = useTranslation7();
1687
+ return useMemo2(
1960
1688
  () => [
1961
1689
  columnHelper2.column({
1962
1690
  id: "attributes",
1963
- header: () => /* @__PURE__ */ jsx10("div", { className: "flex size-full items-center overflow-hidden", children: /* @__PURE__ */ jsx10("span", { className: "truncate", children: variantAxes.map((a) => a.title).join(" / ") }) }),
1691
+ header: () => /* @__PURE__ */ jsx8("div", { className: "flex size-full items-center overflow-hidden", children: /* @__PURE__ */ jsx8("span", { className: "truncate", children: variantAxes.map((a) => a.title).join(" / ") }) }),
1964
1692
  cell: (context) => {
1965
- return /* @__PURE__ */ jsx10(DataGrid.ReadonlyCell, { context, children: variantAxes.map((a) => context.row.original.options?.[a.title]).join(" / ") });
1693
+ return /* @__PURE__ */ jsx8(DataGrid.ReadonlyCell, { context, children: variantAxes.map((a) => context.row.original.options?.[a.title]).join(" / ") });
1966
1694
  },
1967
1695
  disableHiding: true
1968
1696
  }),
@@ -1973,7 +1701,7 @@ var useColumns2 = ({
1973
1701
  field: (context) => `variants.${context.row.original.originalIndex}.title`,
1974
1702
  type: "text",
1975
1703
  cell: (context) => {
1976
- return /* @__PURE__ */ jsx10(DataGrid.TextCell, { context });
1704
+ return /* @__PURE__ */ jsx8(DataGrid.TextCell, { context });
1977
1705
  }
1978
1706
  }),
1979
1707
  columnHelper2.column({
@@ -1983,7 +1711,7 @@ var useColumns2 = ({
1983
1711
  field: (context) => `variants.${context.row.original.originalIndex}.sku`,
1984
1712
  type: "text",
1985
1713
  cell: (context) => {
1986
- return /* @__PURE__ */ jsx10(DataGrid.TextCell, { context });
1714
+ return /* @__PURE__ */ jsx8(DataGrid.TextCell, { context });
1987
1715
  }
1988
1716
  })
1989
1717
  ],
@@ -1992,13 +1720,13 @@ var useColumns2 = ({
1992
1720
  };
1993
1721
 
1994
1722
  // src/pages/products/create/components/product-create-form/product-create-form.tsx
1995
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
1723
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1996
1724
  var ProductCreateForm = ({
1997
1725
  children,
1998
1726
  schema,
1999
1727
  defaultValues: extraDefaults
2000
1728
  }) => {
2001
- const { t } = useTranslation9();
1729
+ const { t } = useTranslation8();
2002
1730
  const { handleSuccess } = useRouteModal();
2003
1731
  const form = useForm({
2004
1732
  defaultValues: {
@@ -2010,7 +1738,7 @@ var ProductCreateForm = ({
2010
1738
  const { mutateAsync, isPending } = useCreateProduct();
2011
1739
  const { feature_flags } = useFeatureFlags();
2012
1740
  const productRequestEnabled = !!feature_flags?.[import_types6.MercurFeatureFlags.PRODUCT_REQUEST];
2013
- const watchedAttributes = useWatch3({
1741
+ const watchedAttributes = useWatch2({
2014
1742
  control: form.control,
2015
1743
  name: "attributes"
2016
1744
  });
@@ -2081,29 +1809,29 @@ var ProductCreateForm = ({
2081
1809
  }
2082
1810
  await submitProduct(form.getValues(), true);
2083
1811
  };
2084
- const defaultTabs = useMemo5(
1812
+ const defaultTabs = useMemo3(
2085
1813
  () => [
2086
- /* @__PURE__ */ jsx11(ProductCreateDetailsForm, {}, "details"),
2087
- /* @__PURE__ */ jsx11(ProductCreateOrganizeForm, {}, "organize"),
2088
- /* @__PURE__ */ jsx11(ProductCreateAttributesForm, {}, "attributes"),
2089
- /* @__PURE__ */ jsx11(ProductCreateVariantsForm, {}, "variants")
1814
+ /* @__PURE__ */ jsx9(ProductCreateDetailsForm, {}, "details"),
1815
+ /* @__PURE__ */ jsx9(ProductCreateOrganizeForm, {}, "organize"),
1816
+ /* @__PURE__ */ jsx9(ProductCreateAttributesForm, {}, "attributes"),
1817
+ /* @__PURE__ */ jsx9(ProductCreateVariantsForm, {}, "variants")
2090
1818
  ],
2091
1819
  []
2092
1820
  );
2093
1821
  const hasCustomChildren = Children.count(children) > 0;
2094
- return /* @__PURE__ */ jsx11(
1822
+ return /* @__PURE__ */ jsx9(
2095
1823
  TabbedForm,
2096
1824
  {
2097
1825
  form,
2098
1826
  onSubmit: handleSubmit,
2099
1827
  isLoading: isPending,
2100
- footer: ({ isLastTab, onNext, isLoading }) => /* @__PURE__ */ jsxs9(
1828
+ footer: ({ isLastTab, onNext, isLoading }) => /* @__PURE__ */ jsxs7(
2101
1829
  "div",
2102
1830
  {
2103
1831
  className: "flex items-center justify-end gap-x-2",
2104
1832
  "data-testid": "product-create-form-footer-actions",
2105
1833
  children: [
2106
- /* @__PURE__ */ jsx11(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx11(
1834
+ /* @__PURE__ */ jsx9(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx9(
2107
1835
  Button3,
2108
1836
  {
2109
1837
  variant: "secondary",
@@ -2112,7 +1840,7 @@ var ProductCreateForm = ({
2112
1840
  children: t("actions.cancel")
2113
1841
  }
2114
1842
  ) }),
2115
- /* @__PURE__ */ jsx11(
1843
+ /* @__PURE__ */ jsx9(
2116
1844
  Button3,
2117
1845
  {
2118
1846
  variant: "secondary",
@@ -2125,7 +1853,7 @@ var ProductCreateForm = ({
2125
1853
  children: t("actions.saveAsDraft")
2126
1854
  }
2127
1855
  ),
2128
- isLastTab ? /* @__PURE__ */ jsx11(
1856
+ isLastTab ? /* @__PURE__ */ jsx9(
2129
1857
  Button3,
2130
1858
  {
2131
1859
  "data-name": "publish-button",
@@ -2137,7 +1865,7 @@ var ProductCreateForm = ({
2137
1865
  children: t("actions.publish")
2138
1866
  },
2139
1867
  "submit-button"
2140
- ) : /* @__PURE__ */ jsx11(
1868
+ ) : /* @__PURE__ */ jsx9(
2141
1869
  Button3,
2142
1870
  {
2143
1871
  type: "button",
@@ -2158,13 +1886,13 @@ var ProductCreateForm = ({
2158
1886
  };
2159
1887
 
2160
1888
  // src/pages/products/create/product-create.tsx
2161
- import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
1889
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
2162
1890
  var Root5 = ({ children }) => {
2163
- const { t } = useTranslation10();
2164
- return /* @__PURE__ */ jsxs10(RouteFocusModal, { children: [
2165
- /* @__PURE__ */ jsx12(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx12("span", { className: "sr-only", children: t("products.create.title") }) }),
2166
- /* @__PURE__ */ jsx12(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx12("span", { className: "sr-only", children: t("products.create.description") }) }),
2167
- Children2.count(children) > 0 ? children : /* @__PURE__ */ jsx12(ProductCreateForm, {})
1891
+ const { t } = useTranslation9();
1892
+ return /* @__PURE__ */ jsxs8(RouteFocusModal, { children: [
1893
+ /* @__PURE__ */ jsx10(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx10("span", { className: "sr-only", children: t("products.create.title") }) }),
1894
+ /* @__PURE__ */ jsx10(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx10("span", { className: "sr-only", children: t("products.create.description") }) }),
1895
+ Children2.count(children) > 0 ? children : /* @__PURE__ */ jsx10(ProductCreateForm, {})
2168
1896
  ] });
2169
1897
  };
2170
1898
  var ProductCreate = Root5;