@mercurjs/admin 2.0.0-canary.100

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 (447) hide show
  1. package/dist/add-campaign-promotions-CQDZBX3V.js +266 -0
  2. package/dist/adjust-inventory-3GPDYI3V.js +266 -0
  3. package/dist/api-key-management-create-GUNLFGNT.js +283 -0
  4. package/dist/api-key-management-detail-4IL3BQJW.js +87 -0
  5. package/dist/api-key-management-edit-SIXXFLNP.js +107 -0
  6. package/dist/api-key-management-list-XLRD4ASE.js +34 -0
  7. package/dist/api-key-management-sales-channels-GCUMV6YA.js +202 -0
  8. package/dist/campaign-budget-edit-GAP5KUI3.js +148 -0
  9. package/dist/campaign-configuration-LTHPZGYC.js +155 -0
  10. package/dist/campaign-create-TRNE6L26.js +30 -0
  11. package/dist/campaign-detail-GYMMDRUV.js +106 -0
  12. package/dist/campaign-edit-CRQCVEFT.js +207 -0
  13. package/dist/campaign-list-WEKSY62X.js +32 -0
  14. package/dist/categories-metadata-GESU3DEU.js +87 -0
  15. package/dist/category-create-PSAN6SA2.js +23 -0
  16. package/dist/category-detail-67ZTYE5M.js +106 -0
  17. package/dist/category-edit-QYKE3GAC.js +221 -0
  18. package/dist/category-list-ZRDWHPEI.js +33 -0
  19. package/dist/category-organize-D26G234L.js +112 -0
  20. package/dist/category-products-XMIZ2KRR.js +285 -0
  21. package/dist/chunk-25DQRKFS.js +102 -0
  22. package/dist/chunk-25LYVP3C.js +37 -0
  23. package/dist/chunk-26OOAKQ6.js +18 -0
  24. package/dist/chunk-2TDFXWGC.js +742 -0
  25. package/dist/chunk-2Y3WMGN6.js +39 -0
  26. package/dist/chunk-2ZFELO2L.js +13 -0
  27. package/dist/chunk-33XUAKRP.js +6 -0
  28. package/dist/chunk-35NDMIYZ.js +8 -0
  29. package/dist/chunk-3B6MTW5G.js +64 -0
  30. package/dist/chunk-3CKTAFTR.js +143 -0
  31. package/dist/chunk-3EF54XFY.js +64 -0
  32. package/dist/chunk-3GCRM6UM.js +1155 -0
  33. package/dist/chunk-3KOTDGC2.js +18 -0
  34. package/dist/chunk-3QSRE5LS.js +161 -0
  35. package/dist/chunk-3XPXUIK3.js +34 -0
  36. package/dist/chunk-4F5GP7J7.js +45 -0
  37. package/dist/chunk-4GPAS5GW.js +36 -0
  38. package/dist/chunk-4JYZU65L.js +2144 -0
  39. package/dist/chunk-4ZIQGDNH.js +184 -0
  40. package/dist/chunk-54EPH67T.js +34 -0
  41. package/dist/chunk-54RTJBYO.js +153 -0
  42. package/dist/chunk-54TMLQH3.js +9 -0
  43. package/dist/chunk-5A4JNOK3.js +109 -0
  44. package/dist/chunk-5HZT54X7.js +374 -0
  45. package/dist/chunk-5LI2P5VT.js +433 -0
  46. package/dist/chunk-5N24A4CX.js +296 -0
  47. package/dist/chunk-64B6RWZI.js +159 -0
  48. package/dist/chunk-64XMEZ5A.js +50 -0
  49. package/dist/chunk-6ERRELWD.js +3892 -0
  50. package/dist/chunk-6HJINLUB.js +94 -0
  51. package/dist/chunk-6IJMSVC6.js +16 -0
  52. package/dist/chunk-6S72GJRI.js +142 -0
  53. package/dist/chunk-77R2QD4O.js +337 -0
  54. package/dist/chunk-7AV5EJJ5.js +29 -0
  55. package/dist/chunk-7H2I3TA2.js +420 -0
  56. package/dist/chunk-7ITJ4725.js +185 -0
  57. package/dist/chunk-7JZMCLD3.js +165 -0
  58. package/dist/chunk-7KMDLRLG.js +248 -0
  59. package/dist/chunk-7NNA33IY.js +600 -0
  60. package/dist/chunk-7OSCNHHQ.js +69 -0
  61. package/dist/chunk-7RPRNVBS.js +45 -0
  62. package/dist/chunk-7SQW55FI.js +470 -0
  63. package/dist/chunk-7SVLKK6Q.js +31 -0
  64. package/dist/chunk-A2F5MDPU.js +79 -0
  65. package/dist/chunk-AEFDAU3Y.js +110 -0
  66. package/dist/chunk-AFQS6E4N.js +61 -0
  67. package/dist/chunk-AJQ6EVLE.js +501 -0
  68. package/dist/chunk-AW77UWCZ.js +363 -0
  69. package/dist/chunk-AYVH6Q5O.js +31 -0
  70. package/dist/chunk-AZVAL5E5.js +303 -0
  71. package/dist/chunk-BBZ6YISG.js +371 -0
  72. package/dist/chunk-BDGZ4EQO.js +86 -0
  73. package/dist/chunk-BLHFWBK3.js +199 -0
  74. package/dist/chunk-BPTVQM72.js +9496 -0
  75. package/dist/chunk-BYKTBURG.js +250 -0
  76. package/dist/chunk-C6OVKRMH.js +294 -0
  77. package/dist/chunk-C6SUTRP2.js +13 -0
  78. package/dist/chunk-CARSKIPW.js +87 -0
  79. package/dist/chunk-CJQRZEZU.js +614 -0
  80. package/dist/chunk-CMHI2RPL.js +20 -0
  81. package/dist/chunk-CP5IL4P6.js +98 -0
  82. package/dist/chunk-DB6ANJBO.js +35 -0
  83. package/dist/chunk-DBYUB2YI.js +174 -0
  84. package/dist/chunk-DPH3FG5H.js +528 -0
  85. package/dist/chunk-DY3XQPHC.js +31 -0
  86. package/dist/chunk-EEOEIXDA.js +112 -0
  87. package/dist/chunk-EF47ASFU.js +39 -0
  88. package/dist/chunk-EJY35WBK.js +60 -0
  89. package/dist/chunk-EOZUAYQL.js +6 -0
  90. package/dist/chunk-EWFOFSF7.js +78 -0
  91. package/dist/chunk-FD7OJEGQ.js +345 -0
  92. package/dist/chunk-FI474ADU.js +0 -0
  93. package/dist/chunk-FIVW6L2I.js +269 -0
  94. package/dist/chunk-FIYO3KTR.js +710 -0
  95. package/dist/chunk-FMFVTERD.js +0 -0
  96. package/dist/chunk-FQERBIVS.js +0 -0
  97. package/dist/chunk-FWPGOIFA.js +22 -0
  98. package/dist/chunk-G2N27VIE.js +164 -0
  99. package/dist/chunk-G4MIA23Y.js +100 -0
  100. package/dist/chunk-G5OVX555.js +26 -0
  101. package/dist/chunk-GCEOEV6P.js +241 -0
  102. package/dist/chunk-GR6JUIRU.js +32 -0
  103. package/dist/chunk-GVXAFQDF.js +170 -0
  104. package/dist/chunk-GYRTURN7.js +29 -0
  105. package/dist/chunk-HC25LNX7.js +45 -0
  106. package/dist/chunk-HDUVTTOW.js +396 -0
  107. package/dist/chunk-HGHJRKUC.js +223 -0
  108. package/dist/chunk-HINXQTCW.js +97 -0
  109. package/dist/chunk-HLL6GLZO.js +109 -0
  110. package/dist/chunk-HPQG3PEA.js +67 -0
  111. package/dist/chunk-I5LLMPI2.js +108 -0
  112. package/dist/chunk-I6GNV6QA.js +175 -0
  113. package/dist/chunk-IGTRIAUC.js +84 -0
  114. package/dist/chunk-INNFZYX2.js +183 -0
  115. package/dist/chunk-IQPN4PZJ.js +749 -0
  116. package/dist/chunk-IUB4C2WJ.js +420 -0
  117. package/dist/chunk-J54BZXZX.js +83 -0
  118. package/dist/chunk-J5SOBS7K.js +298 -0
  119. package/dist/chunk-JAJMMPOF.js +1260 -0
  120. package/dist/chunk-JHIMVLB2.js +42 -0
  121. package/dist/chunk-JI7HMGMO.js +79 -0
  122. package/dist/chunk-JJ4XUGHZ.js +312 -0
  123. package/dist/chunk-JOX3ZSRT.js +50 -0
  124. package/dist/chunk-JQV7CXEC.js +37 -0
  125. package/dist/chunk-JRTZWK77.js +1764 -0
  126. package/dist/chunk-K6RZE3F7.js +39 -0
  127. package/dist/chunk-KAZ5BYTQ.js +132 -0
  128. package/dist/chunk-KBYZLKI4.js +1093 -0
  129. package/dist/chunk-KHXRL3BH.js +85 -0
  130. package/dist/chunk-KWW4RDRS.js +199 -0
  131. package/dist/chunk-L74EVHCU.js +176 -0
  132. package/dist/chunk-L7DIEO5B.js +33 -0
  133. package/dist/chunk-LAVHRER2.js +17 -0
  134. package/dist/chunk-LFKTHNWI.js +83 -0
  135. package/dist/chunk-LGVVX4I6.js +422 -0
  136. package/dist/chunk-LQAAVRET.js +88 -0
  137. package/dist/chunk-LTBX54CI.js +11 -0
  138. package/dist/chunk-LXSBG6LK.js +18 -0
  139. package/dist/chunk-LXZXXOJ3.js +64 -0
  140. package/dist/chunk-LZO7MWH7.js +102 -0
  141. package/dist/chunk-MAEP2UCK.js +110 -0
  142. package/dist/chunk-MG4GKUJW.js +31 -0
  143. package/dist/chunk-MMDRMNPE.js +424 -0
  144. package/dist/chunk-MO7TNIVQ.js +23 -0
  145. package/dist/chunk-MZCJZRR6.js +381 -0
  146. package/dist/chunk-N2TQXB44.js +1280 -0
  147. package/dist/chunk-N3WRPCPT.js +94 -0
  148. package/dist/chunk-N5IUYCUZ.js +31 -0
  149. package/dist/chunk-N5XVXV47.js +530 -0
  150. package/dist/chunk-NBMM2TZK.js +33 -0
  151. package/dist/chunk-NCMUZ6BQ.js +0 -0
  152. package/dist/chunk-NCYTM57J.js +160 -0
  153. package/dist/chunk-NHGR2OFE.js +292 -0
  154. package/dist/chunk-NOWUEJ74.js +44 -0
  155. package/dist/chunk-NQ2RDSI3.js +43 -0
  156. package/dist/chunk-NXDFDEKP.js +0 -0
  157. package/dist/chunk-NYWESQ6J.js +86705 -0
  158. package/dist/chunk-NZN7PFPB.js +169 -0
  159. package/dist/chunk-O4LSCHTC.js +245 -0
  160. package/dist/chunk-O5VKW5FL.js +41 -0
  161. package/dist/chunk-O5ZOACVV.js +593 -0
  162. package/dist/chunk-OEDISQ2O.js +98 -0
  163. package/dist/chunk-OJI3SRZ3.js +373 -0
  164. package/dist/chunk-OSI3M4M2.js +473 -0
  165. package/dist/chunk-OT5X3VOQ.js +42 -0
  166. package/dist/chunk-OZMCKYJL.js +204 -0
  167. package/dist/chunk-P52JGPUG.js +135 -0
  168. package/dist/chunk-PHOCVOZ5.js +9 -0
  169. package/dist/chunk-PJTR2MBS.js +459 -0
  170. package/dist/chunk-PUQSQBZW.js +49 -0
  171. package/dist/chunk-PVZBDWLK.js +41 -0
  172. package/dist/chunk-PWMB7ITO.js +344 -0
  173. package/dist/chunk-PXYDR7WQ.js +48 -0
  174. package/dist/chunk-PYF5EER5.js +32 -0
  175. package/dist/chunk-Q6GUA5VE.js +92 -0
  176. package/dist/chunk-QDIPFZLV.js +113 -0
  177. package/dist/chunk-QDPLZDMX.js +17 -0
  178. package/dist/chunk-QG6PLWNH.js +106 -0
  179. package/dist/chunk-QLTN2DIY.js +119 -0
  180. package/dist/chunk-QSGR43JM.js +30 -0
  181. package/dist/chunk-QUNCQMFH.js +219 -0
  182. package/dist/chunk-QUTZUW55.js +163 -0
  183. package/dist/chunk-QVLL4MKH.js +245 -0
  184. package/dist/chunk-R325CPYC.js +88 -0
  185. package/dist/chunk-R4O667NT.js +80 -0
  186. package/dist/chunk-R55Q5LAH.js +47 -0
  187. package/dist/chunk-RF7BE47J.js +685 -0
  188. package/dist/chunk-RHKRREUU.js +15 -0
  189. package/dist/chunk-RHYS2TFP.js +266 -0
  190. package/dist/chunk-RK5N3XIX.js +56 -0
  191. package/dist/chunk-RQQ53CQJ.js +87 -0
  192. package/dist/chunk-RSBZREKG.js +144 -0
  193. package/dist/chunk-RXM4B6HR.js +8 -0
  194. package/dist/chunk-S2WEYEQR.js +14 -0
  195. package/dist/chunk-S3L6CIN2.js +459 -0
  196. package/dist/chunk-S4SVK5DE.js +39 -0
  197. package/dist/chunk-SBH4E5NY.js +129 -0
  198. package/dist/chunk-SDNGZDNK.js +170 -0
  199. package/dist/chunk-SJQ4QAFK.js +471 -0
  200. package/dist/chunk-SMQT3ZNO.js +8 -0
  201. package/dist/chunk-STSW4GDV.js +325 -0
  202. package/dist/chunk-SWL7ZCP3.js +11 -0
  203. package/dist/chunk-THHRRYRS.js +16 -0
  204. package/dist/chunk-THYWJQI4.js +635 -0
  205. package/dist/chunk-TK3XKN2P.js +357 -0
  206. package/dist/chunk-TKEAOWBZ.js +178 -0
  207. package/dist/chunk-TKFMOTJK.js +297 -0
  208. package/dist/chunk-TKGWSUEI.js +0 -0
  209. package/dist/chunk-TKSKCH3S.js +199 -0
  210. package/dist/chunk-TLE6YHGH.js +26 -0
  211. package/dist/chunk-TN4TIT7O.js +116 -0
  212. package/dist/chunk-TOUMBTYI.js +41 -0
  213. package/dist/chunk-TP7M43SI.js +189 -0
  214. package/dist/chunk-TUJIAA5O.js +101 -0
  215. package/dist/chunk-TZSOL34K.js +106 -0
  216. package/dist/chunk-U2EI2ZLM.js +32 -0
  217. package/dist/chunk-U2L77ZDR.js +17 -0
  218. package/dist/chunk-U2ZFCAPX.js +34 -0
  219. package/dist/chunk-U3OWJE7V.js +4113 -0
  220. package/dist/chunk-U5MJIHLY.js +87 -0
  221. package/dist/chunk-U5QDMLTR.js +294 -0
  222. package/dist/chunk-UI2BJVP5.js +170 -0
  223. package/dist/chunk-ULJ3OMWU.js +467 -0
  224. package/dist/chunk-UM7ZR3VU.js +14 -0
  225. package/dist/chunk-UQITHKTH.js +342 -0
  226. package/dist/chunk-UXD3VNBO.js +53 -0
  227. package/dist/chunk-UZWFZMOX.js +40 -0
  228. package/dist/chunk-V5J73NPW.js +117 -0
  229. package/dist/chunk-V6LO4BXB.js +460 -0
  230. package/dist/chunk-V74Y5NIV.js +49 -0
  231. package/dist/chunk-V7Y7WBGF.js +112 -0
  232. package/dist/chunk-VEW7PQ3X.js +209 -0
  233. package/dist/chunk-VHCDSNXF.js +89 -0
  234. package/dist/chunk-VKOE5J66.js +31 -0
  235. package/dist/chunk-VOHEQ7B5.js +31 -0
  236. package/dist/chunk-VRGXUUPH.js +772 -0
  237. package/dist/chunk-VVWB3GIK.js +70 -0
  238. package/dist/chunk-VW56KWO2.js +9 -0
  239. package/dist/chunk-VXW3BCN2.js +171 -0
  240. package/dist/chunk-VZEMURY7.js +35 -0
  241. package/dist/chunk-W6Y3PPU5.js +73 -0
  242. package/dist/chunk-WBNGBRBK.js +482 -0
  243. package/dist/chunk-WCEMRNW4.js +6 -0
  244. package/dist/chunk-WEVK4TBV.js +257 -0
  245. package/dist/chunk-WIYFXWRI.js +30 -0
  246. package/dist/chunk-WMA3WTCM.js +117 -0
  247. package/dist/chunk-WW7VLWKJ.js +360 -0
  248. package/dist/chunk-X6HEEFUW.js +1104 -0
  249. package/dist/chunk-XBFWFGZH.js +249 -0
  250. package/dist/chunk-XFKRBJLK.js +104 -0
  251. package/dist/chunk-XFR5JLNF.js +44 -0
  252. package/dist/chunk-XIZLPYEE.js +261 -0
  253. package/dist/chunk-XQNVC4Q7.js +212 -0
  254. package/dist/chunk-XR2UEF6U.js +433 -0
  255. package/dist/chunk-XSEF6KRY.js +335 -0
  256. package/dist/chunk-XSX255FK.js +12 -0
  257. package/dist/chunk-Y2M536WR.js +67 -0
  258. package/dist/chunk-Y456KVIN.js +116 -0
  259. package/dist/chunk-Y7QKP6QU.js +35 -0
  260. package/dist/chunk-YAMNPEPW.js +345 -0
  261. package/dist/chunk-YBZWO4ZV.js +57 -0
  262. package/dist/chunk-YDAJI7WF.js +389 -0
  263. package/dist/chunk-YMKZS2HK.js +82 -0
  264. package/dist/chunk-YQYGAFCS.js +119 -0
  265. package/dist/chunk-YVCBMOJG.js +50 -0
  266. package/dist/chunk-YWWUOGJA.js +62 -0
  267. package/dist/chunk-YXFG3M2D.js +792 -0
  268. package/dist/chunk-ZA2KFUFR.js +19 -0
  269. package/dist/chunk-ZGEMSYN7.js +61 -0
  270. package/dist/chunk-ZJO4DDOP.js +454 -0
  271. package/dist/chunk-ZNA2XOGX.js +675 -0
  272. package/dist/chunk-ZQZHFMD7.js +19 -0
  273. package/dist/collection-add-products-4TTEF6QV.js +288 -0
  274. package/dist/collection-create-SD4GKHFC.js +134 -0
  275. package/dist/collection-detail-64YVMLBU.js +97 -0
  276. package/dist/collection-edit-Z474HXCJ.js +122 -0
  277. package/dist/collection-list-OTSGOEBC.js +79 -0
  278. package/dist/collection-metadata-FFHA6CQ3.js +84 -0
  279. package/dist/commission-rate-create-7BBUGS2I.js +779 -0
  280. package/dist/commission-rate-detail-FORKXXJY.js +83 -0
  281. package/dist/commission-rate-edit-SAX2DAND.js +762 -0
  282. package/dist/commission-rate-list-EESTCCRP.js +28 -0
  283. package/dist/constants-CAwtRicB.d.ts +42 -0
  284. package/dist/customer-create-WA4GYGVD.js +184 -0
  285. package/dist/customer-create-address-YBI4KWWH.js +300 -0
  286. package/dist/customer-detail-SDE4TDZD.js +107 -0
  287. package/dist/customer-edit-TFR6PVJJ.js +193 -0
  288. package/dist/customer-group-add-customers-77BVWLTN.js +247 -0
  289. package/dist/customer-group-create-32UIUO46.js +114 -0
  290. package/dist/customer-group-detail-QRY6BHGI.js +106 -0
  291. package/dist/customer-group-edit-HFL7LZZZ.js +109 -0
  292. package/dist/customer-group-list-Q3T72VH2.js +57 -0
  293. package/dist/customer-group-metadata-FXI3J6DB.js +85 -0
  294. package/dist/customer-list-CXTUBLCK.js +33 -0
  295. package/dist/customer-metadata-BV4CHHWI.js +85 -0
  296. package/dist/customers-add-customer-group-SUE2KKJR.js +312 -0
  297. package/dist/edit-inventory-item-DDRUGVSK.js +156 -0
  298. package/dist/edit-inventory-item-attributes-MDL7FSLR.js +327 -0
  299. package/dist/edit-reservation-JWABBNJ6.js +247 -0
  300. package/dist/edit-rules-ECNFIPUC.js +320 -0
  301. package/dist/home-I3OILW5Z.js +16 -0
  302. package/dist/index.css +6 -0
  303. package/dist/index.d.ts +255 -0
  304. package/dist/index.js +4989 -0
  305. package/dist/inventory-create-S6CB4JYN.js +56 -0
  306. package/dist/inventory-detail-OIKNOS5A.js +107 -0
  307. package/dist/inventory-list-XSHWCPO4.js +30 -0
  308. package/dist/inventory-metadata-MHGDNLXT.js +87 -0
  309. package/dist/inventory-stock-JG5CZWZA.js +292 -0
  310. package/dist/invite-25CGHT4W.js +373 -0
  311. package/dist/location-create-G3MNWQWB.js +239 -0
  312. package/dist/location-detail-5CGAZMBR.js +100 -0
  313. package/dist/location-edit-UI6AWCZS.js +254 -0
  314. package/dist/location-fulfillment-providers-BA2VMZHX.js +293 -0
  315. package/dist/location-list-656DEW7L.js +53 -0
  316. package/dist/location-sales-channels-WXBK4EJO.js +216 -0
  317. package/dist/location-service-zone-create-647O67PU.js +174 -0
  318. package/dist/location-service-zone-edit-BUY6HNZM.js +135 -0
  319. package/dist/location-service-zone-manage-areas-X2ZGRHHA.js +155 -0
  320. package/dist/location-service-zone-shipping-option-create-IASFWJ2Z.js +57 -0
  321. package/dist/location-service-zone-shipping-option-edit-IJDU5PTW.js +363 -0
  322. package/dist/location-service-zone-shipping-option-pricing-3T7HLKJC.js +363 -0
  323. package/dist/login-WU5VB5LW.js +264 -0
  324. package/dist/manage-locations-IJIPCYAY.js +250 -0
  325. package/dist/marketplace-add-currencies-RXLEQ6MZ.js +305 -0
  326. package/dist/marketplace-detail-23KSAJVI.js +75 -0
  327. package/dist/marketplace-edit-XPIEDQYD.js +247 -0
  328. package/dist/marketplace-metadata-5GEWGH2M.js +89 -0
  329. package/dist/no-match-JLVLPCRH.js +33 -0
  330. package/dist/order-allocate-items-GYGER65Z.js +559 -0
  331. package/dist/order-create-claim-RNUFU2MP.js +2207 -0
  332. package/dist/order-create-edit-DLH76B2Q.js +936 -0
  333. package/dist/order-create-exchange-FA27FZU7.js +2194 -0
  334. package/dist/order-create-fulfillment-4F5JAUOX.js +625 -0
  335. package/dist/order-create-refund-3LCTQXFD.js +407 -0
  336. package/dist/order-create-return-EO2C5RAA.js +1293 -0
  337. package/dist/order-create-shipment-PIQ43ZSG.js +212 -0
  338. package/dist/order-detail-2U26JNU2.js +123 -0
  339. package/dist/order-edit-billing-address-PRXCLUNR.js +404 -0
  340. package/dist/order-edit-email-GVKVQESG.js +175 -0
  341. package/dist/order-edit-shipping-address-UDNHXO2V.js +401 -0
  342. package/dist/order-list-U2HL7VBX.js +49 -0
  343. package/dist/order-metadata-HPXIR6KI.js +86 -0
  344. package/dist/order-receive-return-FMM74XYM.js +553 -0
  345. package/dist/order-request-transfer-SI5PSOKA.js +575 -0
  346. package/dist/pages/index.d.ts +3165 -0
  347. package/dist/pages/index.js +447 -0
  348. package/dist/payout-detail-L4VYAP53.js +52 -0
  349. package/dist/payout-list-4S6MAU4R.js +30 -0
  350. package/dist/price-list-configuration-F2BZC6QX.js +357 -0
  351. package/dist/price-list-create-ZJTDGJSS.js +76 -0
  352. package/dist/price-list-detail-IUJXNM6Y.js +103 -0
  353. package/dist/price-list-edit-CERYYMC5.js +228 -0
  354. package/dist/price-list-list-RBD2MEZ5.js +36 -0
  355. package/dist/price-list-prices-add-AJJ76VMY.js +71 -0
  356. package/dist/price-list-prices-edit-2NYN6WVJ.js +332 -0
  357. package/dist/product-attributes-EUDG25XA.js +362 -0
  358. package/dist/product-create-XA7UOISW.js +68 -0
  359. package/dist/product-create-option-BG2ZKSFN.js +148 -0
  360. package/dist/product-create-variant-4Z6HSHRE.js +54 -0
  361. package/dist/product-detail-F67SLUIA.js +103 -0
  362. package/dist/product-edit-HFWSBQQI.js +401 -0
  363. package/dist/product-edit-option-Y46SNVHN.js +156 -0
  364. package/dist/product-export-ABNA6ZTY.js +132 -0
  365. package/dist/product-import-SQSXBPK5.js +265 -0
  366. package/dist/product-list-NWHRQHVJ.js +86 -0
  367. package/dist/product-media-YIQCVDCC.js +883 -0
  368. package/dist/product-metadata-2Z5DIXJH.js +87 -0
  369. package/dist/product-organization-L666C2EQ.js +316 -0
  370. package/dist/product-prices-DPGO4KHT.js +267 -0
  371. package/dist/product-sales-channels-6IS6T3EC.js +161 -0
  372. package/dist/product-shipping-profile-LMLRMJ36.js +150 -0
  373. package/dist/product-stock-AQKD6EQO.js +542 -0
  374. package/dist/product-tag-create-5CF7JLN5.js +126 -0
  375. package/dist/product-tag-detail-2RJNUUT7.js +136 -0
  376. package/dist/product-tag-edit-KGT54WP5.js +138 -0
  377. package/dist/product-tag-list-PJG7ICZE.js +130 -0
  378. package/dist/product-tag-metadata-WU7DVJUM.js +84 -0
  379. package/dist/product-type-create-WHYGTCYX.js +102 -0
  380. package/dist/product-type-detail-MZ3MAV2B.js +98 -0
  381. package/dist/product-type-edit-A4IE6BSF.js +114 -0
  382. package/dist/product-type-list-ND2IIR6O.js +35 -0
  383. package/dist/product-type-metadata-KX4ETP3Y.js +84 -0
  384. package/dist/product-variant-detail-USZXPSVX.js +112 -0
  385. package/dist/product-variant-edit-5L2GWAHB.js +545 -0
  386. package/dist/product-variant-manage-inventory-items-54V2HTA6.js +341 -0
  387. package/dist/product-variant-metadata-SBYZTEIH.js +90 -0
  388. package/dist/profile-detail-OAQD5VJC.js +18 -0
  389. package/dist/profile-edit-DSZCGRY7.js +177 -0
  390. package/dist/promotion-add-campaign-JC4B53LS.js +44 -0
  391. package/dist/promotion-create-A6FMNECA.js +54 -0
  392. package/dist/promotion-detail-XOQTYXTV.js +88 -0
  393. package/dist/promotion-edit-details-KFZ2VVVQ.js +513 -0
  394. package/dist/promotion-list-EH7CW4JZ.js +58 -0
  395. package/dist/refund-reason-create-EMGCAW5S.js +196 -0
  396. package/dist/refund-reason-edit-3D25LGKM.js +196 -0
  397. package/dist/refund-reason-list-V7HDVFS2.js +102 -0
  398. package/dist/region-add-countries-ZAQBBXIL.js +227 -0
  399. package/dist/region-create-IMSMEASB.js +508 -0
  400. package/dist/region-detail-RASFBR5O.js +74 -0
  401. package/dist/region-edit-HGSLB3RU.js +381 -0
  402. package/dist/region-list-WEILXVMS.js +35 -0
  403. package/dist/region-metadata-4COKDRZH.js +87 -0
  404. package/dist/reservation-create-CIYW3ZKU.js +310 -0
  405. package/dist/reservation-detail-2ARWTBE6.js +83 -0
  406. package/dist/reservation-list-W6IOXQZK.js +31 -0
  407. package/dist/reservation-metadata-3ZJ2C5BM.js +87 -0
  408. package/dist/reset-password-YQ6HMFFZ.js +458 -0
  409. package/dist/return-reason-create-HHZ3EMCC.js +166 -0
  410. package/dist/return-reason-edit-5P43JRYC.js +169 -0
  411. package/dist/return-reason-list-32MCIQMK.js +81 -0
  412. package/dist/sales-channel-add-products-U2UTBUKE.js +278 -0
  413. package/dist/sales-channel-create-TMRTMLIX.js +155 -0
  414. package/dist/sales-channel-detail-FRBKGP4X.js +98 -0
  415. package/dist/sales-channel-edit-4LE2N6EV.js +164 -0
  416. package/dist/sales-channel-list-36UHU63C.js +50 -0
  417. package/dist/sales-channel-metadata-OKKVLC7G.js +92 -0
  418. package/dist/seller-address-edit-VH4X5OIO.js +223 -0
  419. package/dist/seller-details-52PG56BK.js +104 -0
  420. package/dist/seller-edit-TU72D5QS.js +331 -0
  421. package/dist/seller-list-CYNCPXYT.js +80 -0
  422. package/dist/settings-AVE3VCCM.js +19 -0
  423. package/dist/shipping-option-type-create-ZHRADP5E.js +199 -0
  424. package/dist/shipping-option-type-detail-ZDEEU3P5.js +82 -0
  425. package/dist/shipping-option-type-edit-2FCNVHNE.js +195 -0
  426. package/dist/shipping-option-type-list-OCCZ4DNS.js +60 -0
  427. package/dist/shipping-profile-create-WLHDFQ4Q.js +124 -0
  428. package/dist/shipping-profile-detail-AUWRGYYL.js +57 -0
  429. package/dist/shipping-profile-metadata-W7CND3IQ.js +88 -0
  430. package/dist/shipping-profiles-list-RZT6HIZV.js +27 -0
  431. package/dist/tax-region-create-U5JWJUX4.js +304 -0
  432. package/dist/tax-region-detail-UNGDO64V.js +68 -0
  433. package/dist/tax-region-edit-5DOYTPEF.js +166 -0
  434. package/dist/tax-region-list-MRQ63BL3.js +27 -0
  435. package/dist/tax-region-metadata-WN3XSWGA.js +87 -0
  436. package/dist/tax-region-province-create-3GZUYVBY.js +316 -0
  437. package/dist/tax-region-province-detail-QTBP47GV.js +99 -0
  438. package/dist/tax-region-tax-override-create-PRZ3DEZE.js +688 -0
  439. package/dist/tax-region-tax-override-edit-YAA6TB6A.js +797 -0
  440. package/dist/tax-region-tax-rate-create-KHNADBCN.js +194 -0
  441. package/dist/tax-region-tax-rate-edit-JR5262VW.js +193 -0
  442. package/dist/user-detail-I66RREWP.js +55 -0
  443. package/dist/user-edit-LBJOZ4LG.js +116 -0
  444. package/dist/user-invite-EUNVBT5W.js +398 -0
  445. package/dist/user-list-BDJJI33F.js +28 -0
  446. package/dist/user-metadata-4RXAMVDT.js +87 -0
  447. package/package.json +87 -0
@@ -0,0 +1,1155 @@
1
+ import {
2
+ DeprecatedPercentageInput
3
+ } from "./chunk-MAEP2UCK.js";
4
+ import {
5
+ AddCampaignPromotionFields
6
+ } from "./chunk-TKFMOTJK.js";
7
+ import {
8
+ RulesFormField
9
+ } from "./chunk-THYWJQI4.js";
10
+ import {
11
+ CreateCampaignSchema,
12
+ DEFAULT_CAMPAIGN_VALUES
13
+ } from "./chunk-SBH4E5NY.js";
14
+ import {
15
+ currencies,
16
+ getCurrencySymbol
17
+ } from "./chunk-IQPN4PZJ.js";
18
+ import {
19
+ TabbedForm,
20
+ defineTabMeta,
21
+ useTabbedForm
22
+ } from "./chunk-XSEF6KRY.js";
23
+ import {
24
+ useDocumentDirection
25
+ } from "./chunk-Y7QKP6QU.js";
26
+ import {
27
+ RouteFocusModal,
28
+ useRouteModal
29
+ } from "./chunk-V6LO4BXB.js";
30
+ import {
31
+ Form
32
+ } from "./chunk-3QSRE5LS.js";
33
+ import {
34
+ useCreatePromotion
35
+ } from "./chunk-GCEOEV6P.js";
36
+
37
+ // src/pages/promotions/promotion-create/components/create-promotion-form/form-schema.ts
38
+ import { z } from "zod";
39
+ var RuleSchema = z.array(
40
+ z.object({
41
+ id: z.string().optional(),
42
+ attribute: z.string().min(1, { message: "Required field" }),
43
+ operator: z.string().min(1, { message: "Required field" }),
44
+ values: z.union([
45
+ z.number().min(1, { message: "Required field" }),
46
+ z.string().min(1, { message: "Required field" }),
47
+ z.array(z.string()).min(1, { message: "Required field" })
48
+ ]),
49
+ required: z.boolean().optional(),
50
+ disguised: z.boolean().optional(),
51
+ field_type: z.string().optional()
52
+ })
53
+ );
54
+ var CreatePromotionSchema = z.object({
55
+ template_id: z.string().optional(),
56
+ campaign_id: z.string().optional(),
57
+ campaign_choice: z.enum(["none", "existing", "new"]).optional(),
58
+ is_automatic: z.string().toLowerCase(),
59
+ code: z.string().min(1),
60
+ type: z.enum(["buyget", "standard"]),
61
+ status: z.enum(["draft", "active", "inactive"]),
62
+ rules: RuleSchema,
63
+ is_tax_inclusive: z.boolean().optional(),
64
+ application_method: z.object({
65
+ allocation: z.enum(["each", "across", "once"]),
66
+ value: z.number().min(0).or(z.string().min(1)),
67
+ currency_code: z.string().optional(),
68
+ max_quantity: z.number().optional().nullable(),
69
+ target_rules: RuleSchema,
70
+ buy_rules: RuleSchema,
71
+ type: z.enum(["fixed", "percentage"]),
72
+ target_type: z.enum(["order", "shipping_methods", "items"])
73
+ }),
74
+ campaign: CreateCampaignSchema.optional()
75
+ }).refine(
76
+ (data) => {
77
+ if (data.application_method.allocation === "across") {
78
+ return true;
79
+ }
80
+ return typeof data.application_method.max_quantity === "number";
81
+ },
82
+ {
83
+ path: ["application_method.max_quantity"],
84
+ message: `required field`
85
+ }
86
+ );
87
+
88
+ // src/pages/promotions/promotion-create/promotion-create.tsx
89
+ import { Children as Children2 } from "react";
90
+
91
+ // src/pages/promotions/promotion-create/components/create-promotion-form/create-promotion-form.tsx
92
+ import { Children, useEffect as useEffect2, useMemo } from "react";
93
+ import { zodResolver } from "@hookform/resolvers/zod";
94
+ import { toast } from "@medusajs/ui";
95
+ import { useForm, useWatch as useWatch3 } from "react-hook-form";
96
+ import { useTranslation as useTranslation3 } from "react-i18next";
97
+
98
+ // src/pages/promotions/promotion-create/components/create-promotion-form/promotion-campaign-tab.tsx
99
+ import { useWatch } from "react-hook-form";
100
+ import { jsx } from "react/jsx-runtime";
101
+ var Root = () => {
102
+ const form = useTabbedForm();
103
+ const currencyCode = useWatch({
104
+ control: form.control,
105
+ name: "application_method.currency_code"
106
+ });
107
+ return /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center", children: /* @__PURE__ */ jsx("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8 py-16", children: /* @__PURE__ */ jsx(
108
+ AddCampaignPromotionFields,
109
+ {
110
+ form,
111
+ promotionCurrencyCode: currencyCode
112
+ }
113
+ ) }) });
114
+ };
115
+ Root._tabMeta = defineTabMeta({
116
+ id: "campaign",
117
+ labelKey: "promotions.tabs.campaign",
118
+ validationFields: ["campaign_id", "campaign_choice", "campaign"]
119
+ });
120
+ var PromotionCampaignTab = Root;
121
+
122
+ // src/pages/promotions/promotion-create/components/create-promotion-form/promotion-details-tab.tsx
123
+ import { useEffect, useState } from "react";
124
+ import {
125
+ Alert,
126
+ Badge,
127
+ clx,
128
+ CurrencyInput,
129
+ Divider,
130
+ Heading,
131
+ Input,
132
+ RadioGroup,
133
+ Switch,
134
+ Text
135
+ } from "@medusajs/ui";
136
+ import { useWatch as useWatch2 } from "react-hook-form";
137
+ import { Trans, useTranslation } from "react-i18next";
138
+ import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
139
+ var Root2 = ({ currentTemplate }) => {
140
+ const { t } = useTranslation();
141
+ const direction = useDocumentDirection();
142
+ const form = useTabbedForm();
143
+ const { setValue } = form;
144
+ const [allocationMode, setAllocationMode] = useState("each");
145
+ const watchValueType = useWatch2({
146
+ control: form.control,
147
+ name: "application_method.type"
148
+ });
149
+ const isFixedValueType = watchValueType === "fixed";
150
+ const watchAllocation = useWatch2({
151
+ control: form.control,
152
+ name: "application_method.allocation"
153
+ });
154
+ useEffect(() => {
155
+ if (watchAllocation) {
156
+ setAllocationMode(watchAllocation);
157
+ }
158
+ }, [watchAllocation]);
159
+ const watchType = useWatch2({
160
+ control: form.control,
161
+ name: "type"
162
+ });
163
+ const isTypeStandard = watchType === "standard";
164
+ const isTypeBuyGet = watchType === "buyget";
165
+ const targetType = useWatch2({
166
+ control: form.control,
167
+ name: "application_method.target_type"
168
+ });
169
+ const isTargetTypeOrder = targetType === "order";
170
+ return /* @__PURE__ */ jsx2("div", { className: "flex size-full flex-col items-center", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8 py-16", children: [
171
+ /* @__PURE__ */ jsxs(
172
+ Heading,
173
+ {
174
+ level: "h1",
175
+ className: "text-fg-base",
176
+ "data-testid": "promotion-create-form-promotion-heading",
177
+ children: [
178
+ t(`promotions.sections.details`),
179
+ currentTemplate?.title && /* @__PURE__ */ jsx2(
180
+ Badge,
181
+ {
182
+ className: "ml-2 align-middle",
183
+ color: "grey",
184
+ size: "2xsmall",
185
+ rounded: "full",
186
+ "data-testid": "promotion-create-form-promotion-template-badge",
187
+ children: currentTemplate?.title
188
+ }
189
+ )
190
+ ]
191
+ }
192
+ ),
193
+ form.formState.errors.root && /* @__PURE__ */ jsx2(
194
+ Alert,
195
+ {
196
+ variant: "error",
197
+ dismissible: false,
198
+ className: "text-balance",
199
+ "data-testid": "promotion-create-form-promotion-error-alert",
200
+ children: form.formState.errors.root.message
201
+ }
202
+ ),
203
+ /* @__PURE__ */ jsx2(
204
+ Form.Field,
205
+ {
206
+ control: form.control,
207
+ name: "is_automatic",
208
+ render: ({ field }) => {
209
+ return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "promotion-create-form-method-item", children: [
210
+ /* @__PURE__ */ jsx2(Form.Label, { "data-testid": "promotion-create-form-method-label", children: t("promotions.form.method.label") }),
211
+ /* @__PURE__ */ jsx2(Form.Control, { "data-testid": "promotion-create-form-method-control", children: /* @__PURE__ */ jsxs(
212
+ RadioGroup,
213
+ {
214
+ dir: direction,
215
+ className: "flex gap-y-3",
216
+ ...field,
217
+ value: field.value,
218
+ onValueChange: field.onChange,
219
+ "data-testid": "promotion-create-form-method-radio-group",
220
+ children: [
221
+ /* @__PURE__ */ jsx2(
222
+ RadioGroup.ChoiceBox,
223
+ {
224
+ value: "false",
225
+ label: t("promotions.form.method.code.title"),
226
+ description: t("promotions.form.method.code.description"),
227
+ className: clx("basis-1/2"),
228
+ "data-testid": "promotion-create-form-method-option-code"
229
+ }
230
+ ),
231
+ /* @__PURE__ */ jsx2(
232
+ RadioGroup.ChoiceBox,
233
+ {
234
+ value: "true",
235
+ label: t("promotions.form.method.automatic.title"),
236
+ description: t(
237
+ "promotions.form.method.automatic.description"
238
+ ),
239
+ className: clx("basis-1/2"),
240
+ "data-testid": "promotion-create-form-method-option-automatic"
241
+ }
242
+ )
243
+ ]
244
+ }
245
+ ) }),
246
+ /* @__PURE__ */ jsx2(Form.ErrorMessage, { "data-testid": "promotion-create-form-method-error" })
247
+ ] });
248
+ }
249
+ }
250
+ ),
251
+ /* @__PURE__ */ jsx2(
252
+ Form.Field,
253
+ {
254
+ control: form.control,
255
+ name: "status",
256
+ render: ({ field }) => {
257
+ return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "promotion-create-form-status-item", children: [
258
+ /* @__PURE__ */ jsx2(Form.Label, { "data-testid": "promotion-create-form-status-label", children: t("promotions.form.status.label") }),
259
+ /* @__PURE__ */ jsx2(Form.Control, { "data-testid": "promotion-create-form-status-control", children: /* @__PURE__ */ jsxs(
260
+ RadioGroup,
261
+ {
262
+ dir: direction,
263
+ className: "flex gap-y-3",
264
+ ...field,
265
+ value: field.value,
266
+ onValueChange: field.onChange,
267
+ "data-testid": "promotion-create-form-status-radio-group",
268
+ children: [
269
+ /* @__PURE__ */ jsx2(
270
+ RadioGroup.ChoiceBox,
271
+ {
272
+ value: "draft",
273
+ label: t("promotions.form.status.draft.title"),
274
+ description: t(
275
+ "promotions.form.status.draft.description"
276
+ ),
277
+ className: clx("basis-1/2"),
278
+ "data-testid": "promotion-create-form-status-option-draft"
279
+ }
280
+ ),
281
+ /* @__PURE__ */ jsx2(
282
+ RadioGroup.ChoiceBox,
283
+ {
284
+ value: "active",
285
+ label: t("promotions.form.status.active.title"),
286
+ description: t(
287
+ "promotions.form.status.active.description"
288
+ ),
289
+ className: clx("basis-1/2"),
290
+ "data-testid": "promotion-create-form-status-option-active"
291
+ }
292
+ )
293
+ ]
294
+ }
295
+ ) }),
296
+ /* @__PURE__ */ jsx2(Form.ErrorMessage, { "data-testid": "promotion-create-form-status-error" })
297
+ ] });
298
+ }
299
+ }
300
+ ),
301
+ /* @__PURE__ */ jsx2("div", { className: "flex gap-y-4", children: /* @__PURE__ */ jsx2(
302
+ Form.Field,
303
+ {
304
+ control: form.control,
305
+ name: "code",
306
+ render: ({ field }) => {
307
+ return /* @__PURE__ */ jsxs(
308
+ Form.Item,
309
+ {
310
+ className: "basis-1/2",
311
+ "data-testid": "promotion-create-form-code-item",
312
+ children: [
313
+ /* @__PURE__ */ jsx2(Form.Label, { "data-testid": "promotion-create-form-code-label", children: t("promotions.form.code.title") }),
314
+ /* @__PURE__ */ jsx2(Form.Control, { "data-testid": "promotion-create-form-code-control", children: /* @__PURE__ */ jsx2(
315
+ Input,
316
+ {
317
+ ...field,
318
+ placeholder: "SUMMER15",
319
+ "data-testid": "promotion-create-form-code-input"
320
+ }
321
+ ) }),
322
+ /* @__PURE__ */ jsx2(
323
+ Text,
324
+ {
325
+ size: "small",
326
+ leading: "compact",
327
+ className: "text-ui-fg-subtle",
328
+ "data-testid": "promotion-create-form-code-description",
329
+ children: /* @__PURE__ */ jsx2(
330
+ Trans,
331
+ {
332
+ t,
333
+ i18nKey: "promotions.form.code.description",
334
+ components: [/* @__PURE__ */ jsx2("br", {}, "break")]
335
+ }
336
+ )
337
+ }
338
+ ),
339
+ /* @__PURE__ */ jsx2(Form.ErrorMessage, { "data-testid": "promotion-create-form-code-error" })
340
+ ]
341
+ }
342
+ );
343
+ }
344
+ }
345
+ ) }),
346
+ !currentTemplate?.hiddenFields?.includes("is_tax_inclusive") && /* @__PURE__ */ jsxs(Fragment, { children: [
347
+ /* @__PURE__ */ jsx2(Divider, {}),
348
+ /* @__PURE__ */ jsx2("div", { className: "flex gap-x-2 gap-y-4", children: /* @__PURE__ */ jsx2(
349
+ Form.Field,
350
+ {
351
+ control: form.control,
352
+ name: "is_tax_inclusive",
353
+ render: ({ field: { onChange, value, ...field } }) => {
354
+ return /* @__PURE__ */ jsxs(
355
+ Form.Item,
356
+ {
357
+ className: "basis-full",
358
+ "data-testid": "promotion-create-form-tax-inclusive-item",
359
+ children: [
360
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
361
+ /* @__PURE__ */ jsxs("div", { className: "block", children: [
362
+ /* @__PURE__ */ jsx2(Form.Label, { "data-testid": "promotion-create-form-tax-inclusive-label", children: t("promotions.form.taxInclusive.title") }),
363
+ /* @__PURE__ */ jsx2(
364
+ Form.Hint,
365
+ {
366
+ className: "!mt-1",
367
+ "data-testid": "promotion-create-form-tax-inclusive-hint",
368
+ children: t("promotions.form.taxInclusive.description")
369
+ }
370
+ )
371
+ ] }),
372
+ /* @__PURE__ */ jsx2(
373
+ Form.Control,
374
+ {
375
+ className: "mr-2 self-center",
376
+ "data-testid": "promotion-create-form-tax-inclusive-control",
377
+ children: /* @__PURE__ */ jsx2(
378
+ Switch,
379
+ {
380
+ dir: "ltr",
381
+ className: "mt-[2px] rtl:rotate-180",
382
+ checked: !!value,
383
+ onCheckedChange: onChange,
384
+ ...field,
385
+ "data-testid": "promotion-create-form-tax-inclusive-switch"
386
+ }
387
+ )
388
+ }
389
+ )
390
+ ] }),
391
+ /* @__PURE__ */ jsx2(Form.ErrorMessage, { "data-testid": "promotion-create-form-tax-inclusive-error" })
392
+ ]
393
+ }
394
+ );
395
+ }
396
+ }
397
+ ) })
398
+ ] }),
399
+ !currentTemplate?.hiddenFields?.includes("type") && /* @__PURE__ */ jsx2(
400
+ Form.Field,
401
+ {
402
+ control: form.control,
403
+ name: "type",
404
+ render: ({ field }) => {
405
+ return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "promotion-create-form-type-item", children: [
406
+ /* @__PURE__ */ jsx2(Form.Label, { "data-testid": "promotion-create-form-type-label", children: t("promotions.fields.type") }),
407
+ /* @__PURE__ */ jsx2(Form.Control, { "data-testid": "promotion-create-form-type-control", children: /* @__PURE__ */ jsxs(
408
+ RadioGroup,
409
+ {
410
+ dir: direction,
411
+ className: "flex gap-y-3",
412
+ ...field,
413
+ onValueChange: field.onChange,
414
+ "data-testid": "promotion-create-form-type-radio-group",
415
+ children: [
416
+ /* @__PURE__ */ jsx2(
417
+ RadioGroup.ChoiceBox,
418
+ {
419
+ value: "standard",
420
+ label: t("promotions.form.type.standard.title"),
421
+ description: t(
422
+ "promotions.form.type.standard.description"
423
+ ),
424
+ className: clx("basis-1/2"),
425
+ "data-testid": "promotion-create-form-type-option-standard"
426
+ }
427
+ ),
428
+ /* @__PURE__ */ jsx2(
429
+ RadioGroup.ChoiceBox,
430
+ {
431
+ value: "buyget",
432
+ label: t("promotions.form.type.buyget.title"),
433
+ description: t(
434
+ "promotions.form.type.buyget.description"
435
+ ),
436
+ className: clx("basis-1/2"),
437
+ "data-testid": "promotion-create-form-type-option-buyget"
438
+ }
439
+ )
440
+ ]
441
+ }
442
+ ) }),
443
+ /* @__PURE__ */ jsx2(Form.ErrorMessage, { "data-testid": "promotion-create-form-type-error" })
444
+ ] });
445
+ }
446
+ }
447
+ ),
448
+ /* @__PURE__ */ jsx2(Divider, {}),
449
+ /* @__PURE__ */ jsx2(RulesFormField, { form, ruleType: "rules" }),
450
+ !currentTemplate?.hiddenFields?.includes("application_method.type") && /* @__PURE__ */ jsxs(Fragment, { children: [
451
+ /* @__PURE__ */ jsx2(Divider, {}),
452
+ /* @__PURE__ */ jsx2(
453
+ Form.Field,
454
+ {
455
+ control: form.control,
456
+ name: "application_method.type",
457
+ render: ({ field }) => {
458
+ return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "promotion-create-form-value-type-item", children: [
459
+ /* @__PURE__ */ jsx2(Form.Label, { "data-testid": "promotion-create-form-value-type-label", children: t("promotions.fields.value_type") }),
460
+ /* @__PURE__ */ jsx2(Form.Control, { "data-testid": "promotion-create-form-value-type-control", children: /* @__PURE__ */ jsxs(
461
+ RadioGroup,
462
+ {
463
+ dir: direction,
464
+ className: "flex gap-y-3",
465
+ ...field,
466
+ onValueChange: field.onChange,
467
+ "data-testid": "promotion-create-form-value-type-radio-group",
468
+ children: [
469
+ /* @__PURE__ */ jsx2(
470
+ RadioGroup.ChoiceBox,
471
+ {
472
+ value: "fixed",
473
+ label: t(
474
+ "promotions.form.value_type.fixed.title"
475
+ ),
476
+ description: t(
477
+ "promotions.form.value_type.fixed.description"
478
+ ),
479
+ className: clx("basis-1/2"),
480
+ "data-testid": "promotion-create-form-value-type-option-fixed"
481
+ }
482
+ ),
483
+ /* @__PURE__ */ jsx2(
484
+ RadioGroup.ChoiceBox,
485
+ {
486
+ value: "percentage",
487
+ label: t(
488
+ "promotions.form.value_type.percentage.title"
489
+ ),
490
+ description: t(
491
+ "promotions.form.value_type.percentage.description"
492
+ ),
493
+ className: clx("basis-1/2"),
494
+ "data-testid": "promotion-create-form-value-type-option-percentage"
495
+ }
496
+ )
497
+ ]
498
+ }
499
+ ) }),
500
+ /* @__PURE__ */ jsx2(Form.ErrorMessage, { "data-testid": "promotion-create-form-value-type-error" })
501
+ ] });
502
+ }
503
+ }
504
+ )
505
+ ] }),
506
+ !currentTemplate?.hiddenFields?.includes(
507
+ "application_method.value"
508
+ ) && /* @__PURE__ */ jsxs(Fragment, { children: [
509
+ /* @__PURE__ */ jsx2(Divider, {}),
510
+ /* @__PURE__ */ jsx2(
511
+ Form.Field,
512
+ {
513
+ control: form.control,
514
+ name: "application_method.value",
515
+ render: ({ field: { onChange, value, ...field } }) => {
516
+ const currencyCode = form.getValues().application_method.currency_code;
517
+ const currencyInfo = currencies[currencyCode?.toUpperCase() || "USD"];
518
+ return /* @__PURE__ */ jsxs(
519
+ Form.Item,
520
+ {
521
+ className: "basis-1/2",
522
+ "data-testid": "promotion-create-form-value-item",
523
+ children: [
524
+ /* @__PURE__ */ jsx2(
525
+ Form.Label,
526
+ {
527
+ tooltip: currencyCode || !isFixedValueType ? void 0 : t("promotions.fields.amount.tooltip"),
528
+ "data-testid": "promotion-create-form-value-label",
529
+ children: t("promotions.form.value.title")
530
+ }
531
+ ),
532
+ /* @__PURE__ */ jsx2(Form.Control, { "data-testid": "promotion-create-form-value-control", children: isFixedValueType ? /* @__PURE__ */ jsx2(
533
+ CurrencyInput,
534
+ {
535
+ ...field,
536
+ min: 0,
537
+ code: currencyCode || "USD",
538
+ onValueChange: (_value, _name, values) => onChange(values?.value),
539
+ decimalScale: currencyInfo?.decimal_digits ?? 2,
540
+ decimalsLimit: currencyInfo?.decimal_digits ?? 2,
541
+ symbol: currencyCode ? getCurrencySymbol(currencyCode) : "$",
542
+ value,
543
+ disabled: !currencyCode,
544
+ "data-testid": "promotion-create-form-value-currency-input"
545
+ }
546
+ ) : /* @__PURE__ */ jsx2(
547
+ DeprecatedPercentageInput,
548
+ {
549
+ className: "text-right",
550
+ min: 0,
551
+ max: 100,
552
+ ...field,
553
+ value,
554
+ onChange: (e) => {
555
+ onChange(
556
+ e.target.value === "" ? null : parseFloat(e.target.value)
557
+ );
558
+ },
559
+ "data-testid": "promotion-create-form-value-percentage-input"
560
+ },
561
+ "amount"
562
+ ) }),
563
+ /* @__PURE__ */ jsx2(
564
+ Text,
565
+ {
566
+ size: "small",
567
+ leading: "compact",
568
+ className: "text-ui-fg-subtle",
569
+ "data-testid": "promotion-create-form-value-description",
570
+ children: /* @__PURE__ */ jsx2(
571
+ Trans,
572
+ {
573
+ t,
574
+ i18nKey: isFixedValueType ? "promotions.form.value_type.fixed.description" : "promotions.form.value_type.percentage.description",
575
+ components: [/* @__PURE__ */ jsx2("br", {}, "break")]
576
+ }
577
+ )
578
+ }
579
+ ),
580
+ /* @__PURE__ */ jsx2(Form.ErrorMessage, { "data-testid": "promotion-create-form-value-error" })
581
+ ]
582
+ }
583
+ );
584
+ }
585
+ }
586
+ )
587
+ ] }),
588
+ (isTypeStandard || isTypeBuyGet) && allocationMode !== "across" && /* @__PURE__ */ jsxs(Fragment, { children: [
589
+ isTypeBuyGet && /* @__PURE__ */ jsx2(Fragment, { children: /* @__PURE__ */ jsx2(Divider, {}) }),
590
+ /* @__PURE__ */ jsx2(
591
+ Form.Field,
592
+ {
593
+ control: form.control,
594
+ name: "application_method.max_quantity",
595
+ render: () => {
596
+ return /* @__PURE__ */ jsxs(
597
+ Form.Item,
598
+ {
599
+ className: "basis-1/2",
600
+ "data-testid": "promotion-create-form-max-quantity-item",
601
+ children: [
602
+ /* @__PURE__ */ jsx2(Form.Label, { "data-testid": "promotion-create-form-max-quantity-label", children: t("promotions.form.max_quantity.title") }),
603
+ /* @__PURE__ */ jsx2(Form.Control, { "data-testid": "promotion-create-form-max-quantity-control", children: /* @__PURE__ */ jsx2(
604
+ Input,
605
+ {
606
+ ...form.register("application_method.max_quantity", {
607
+ valueAsNumber: true
608
+ }),
609
+ type: "number",
610
+ min: 1,
611
+ placeholder: "3",
612
+ "data-testid": "promotion-create-form-max-quantity-input"
613
+ }
614
+ ) }),
615
+ /* @__PURE__ */ jsx2(
616
+ Text,
617
+ {
618
+ size: "small",
619
+ leading: "compact",
620
+ className: "text-ui-fg-subtle",
621
+ "data-testid": "promotion-create-form-max-quantity-description",
622
+ children: /* @__PURE__ */ jsx2(
623
+ Trans,
624
+ {
625
+ t,
626
+ i18nKey: "promotions.form.max_quantity.description",
627
+ components: [/* @__PURE__ */ jsx2("br", {}, "break")]
628
+ }
629
+ )
630
+ }
631
+ ),
632
+ /* @__PURE__ */ jsx2(Form.ErrorMessage, { "data-testid": "promotion-create-form-max-quantity-error" })
633
+ ]
634
+ }
635
+ );
636
+ }
637
+ }
638
+ )
639
+ ] }),
640
+ !currentTemplate?.hiddenFields?.includes(
641
+ "application_method.allocation"
642
+ ) && /* @__PURE__ */ jsx2(
643
+ Form.Field,
644
+ {
645
+ control: form.control,
646
+ name: "application_method.allocation",
647
+ render: ({ field }) => {
648
+ const handleAllocationChange = (value) => {
649
+ setAllocationMode(value);
650
+ setValue(
651
+ "application_method.allocation",
652
+ value
653
+ );
654
+ field.onChange(value);
655
+ if (value === "once") {
656
+ setValue("application_method.max_quantity", 1);
657
+ }
658
+ };
659
+ return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "promotion-create-form-allocation-item", children: [
660
+ /* @__PURE__ */ jsx2(Form.Label, { "data-testid": "promotion-create-form-allocation-label", children: t("promotions.fields.allocation") }),
661
+ /* @__PURE__ */ jsx2(Form.Control, { "data-testid": "promotion-create-form-allocation-control", children: /* @__PURE__ */ jsxs(
662
+ RadioGroup,
663
+ {
664
+ dir: direction,
665
+ className: "flex gap-y-3",
666
+ value: allocationMode,
667
+ onValueChange: (val) => handleAllocationChange(val),
668
+ "data-testid": "promotion-create-form-allocation-radio-group",
669
+ children: [
670
+ /* @__PURE__ */ jsx2(
671
+ RadioGroup.ChoiceBox,
672
+ {
673
+ value: "each",
674
+ label: t("promotions.form.allocation.each.title"),
675
+ description: t(
676
+ "promotions.form.allocation.each.description"
677
+ ),
678
+ className: clx("basis-1/2"),
679
+ "data-testid": "promotion-create-form-allocation-option-each"
680
+ }
681
+ ),
682
+ /* @__PURE__ */ jsx2(
683
+ RadioGroup.ChoiceBox,
684
+ {
685
+ value: "once",
686
+ label: t("promotions.form.allocation.once.title", {
687
+ defaultValue: "Once"
688
+ }),
689
+ description: t(
690
+ "promotions.form.allocation.once.description",
691
+ {
692
+ defaultValue: "Limit discount to max quantity"
693
+ }
694
+ ),
695
+ className: clx("basis-1/2"),
696
+ "data-testid": "promotion-create-form-allocation-option-once"
697
+ }
698
+ )
699
+ ]
700
+ }
701
+ ) }),
702
+ /* @__PURE__ */ jsx2(Form.ErrorMessage, { "data-testid": "promotion-create-form-allocation-error" })
703
+ ] });
704
+ }
705
+ }
706
+ ),
707
+ !isTypeStandard && /* @__PURE__ */ jsxs(Fragment, { children: [
708
+ /* @__PURE__ */ jsx2(Divider, {}),
709
+ /* @__PURE__ */ jsx2(
710
+ RulesFormField,
711
+ {
712
+ form,
713
+ ruleType: "buy-rules",
714
+ scope: "application_method.buy_rules"
715
+ }
716
+ )
717
+ ] }),
718
+ !isTargetTypeOrder && /* @__PURE__ */ jsxs(Fragment, { children: [
719
+ /* @__PURE__ */ jsx2(Divider, {}),
720
+ /* @__PURE__ */ jsx2(
721
+ RulesFormField,
722
+ {
723
+ form,
724
+ ruleType: "target-rules",
725
+ scope: "application_method.target_rules"
726
+ }
727
+ )
728
+ ] })
729
+ ] }) });
730
+ };
731
+ Root2._tabMeta = defineTabMeta({
732
+ id: "promotion",
733
+ labelKey: "promotions.tabs.details",
734
+ validationFields: [
735
+ "is_automatic",
736
+ "code",
737
+ "type",
738
+ "status",
739
+ "rules",
740
+ "is_tax_inclusive",
741
+ "application_method"
742
+ ]
743
+ });
744
+ var PromotionDetailsTab = Root2;
745
+
746
+ // src/pages/promotions/promotion-create/components/create-promotion-form/promotion-template-tab.tsx
747
+ import { RadioGroup as RadioGroup2 } from "@medusajs/ui";
748
+ import { useTranslation as useTranslation2 } from "react-i18next";
749
+
750
+ // src/pages/promotions/promotion-create/components/create-promotion-form/templates.ts
751
+ var commonHiddenFields = [
752
+ "type",
753
+ "application_method.type"
754
+ ];
755
+ var amountOfOrderHiddenFields = [...commonHiddenFields];
756
+ var amountOfProductHiddenFields = [...commonHiddenFields];
757
+ var percentageOfOrderHiddenFields = [
758
+ ...commonHiddenFields,
759
+ "is_tax_inclusive"
760
+ ];
761
+ var percentageOfProductHiddenFields = [
762
+ ...commonHiddenFields,
763
+ "is_tax_inclusive"
764
+ ];
765
+ var buyGetHiddenFields = [
766
+ ...commonHiddenFields,
767
+ "application_method.value",
768
+ "is_tax_inclusive"
769
+ ];
770
+ var freeShippingHiddenFields = [
771
+ ...commonHiddenFields,
772
+ "application_method.value",
773
+ "application_method.allocation",
774
+ "is_tax_inclusive"
775
+ ];
776
+ var templates = [
777
+ {
778
+ id: "amount_off_products",
779
+ type: "standard",
780
+ title: "Amount off products",
781
+ description: "Discount specific products or collection of products",
782
+ hiddenFields: amountOfProductHiddenFields,
783
+ defaults: {
784
+ is_automatic: "false",
785
+ type: "standard",
786
+ application_method: {
787
+ allocation: "each",
788
+ target_type: "items",
789
+ type: "fixed"
790
+ }
791
+ }
792
+ },
793
+ {
794
+ id: "amount_off_order",
795
+ type: "standard",
796
+ title: "Amount off order",
797
+ description: "Discounts the total order amount",
798
+ hiddenFields: amountOfOrderHiddenFields,
799
+ defaults: {
800
+ is_automatic: "false",
801
+ type: "standard",
802
+ application_method: {
803
+ allocation: "across",
804
+ target_type: "order",
805
+ type: "fixed"
806
+ }
807
+ }
808
+ },
809
+ {
810
+ id: "percentage_off_product",
811
+ type: "standard",
812
+ title: "Percentage off product",
813
+ description: "Discounts a percentage off selected products",
814
+ hiddenFields: percentageOfProductHiddenFields,
815
+ defaults: {
816
+ is_automatic: "false",
817
+ type: "standard",
818
+ application_method: {
819
+ allocation: "each",
820
+ target_type: "items",
821
+ type: "percentage"
822
+ }
823
+ }
824
+ },
825
+ {
826
+ id: "percentage_off_order",
827
+ type: "standard",
828
+ title: "Percentage off order",
829
+ description: "Discounts a percentage of the total order amount",
830
+ hiddenFields: percentageOfOrderHiddenFields,
831
+ defaults: {
832
+ is_automatic: "false",
833
+ type: "standard",
834
+ application_method: {
835
+ allocation: "across",
836
+ target_type: "order",
837
+ type: "percentage"
838
+ }
839
+ }
840
+ },
841
+ {
842
+ id: "buy_get",
843
+ type: "buy_get",
844
+ title: "Buy X Get Y",
845
+ description: "Buy X product(s), get Y product(s)",
846
+ hiddenFields: buyGetHiddenFields,
847
+ defaults: {
848
+ is_automatic: "false",
849
+ type: "buyget",
850
+ application_method: {
851
+ type: "percentage",
852
+ value: 100,
853
+ apply_to_quantity: 1,
854
+ max_quantity: 1
855
+ }
856
+ }
857
+ },
858
+ {
859
+ id: "shipping_discount",
860
+ type: "standard",
861
+ title: "Free shipping",
862
+ description: "Applies a 100% discount to shipping fees",
863
+ hiddenFields: freeShippingHiddenFields,
864
+ defaults: {
865
+ is_automatic: "false",
866
+ type: "standard",
867
+ application_method: {
868
+ allocation: "across",
869
+ target_type: "shipping_methods",
870
+ type: "percentage",
871
+ value: 100
872
+ }
873
+ }
874
+ }
875
+ ];
876
+
877
+ // src/pages/promotions/promotion-create/components/create-promotion-form/promotion-template-tab.tsx
878
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
879
+ var Root3 = () => {
880
+ const { t } = useTranslation2();
881
+ const direction = useDocumentDirection();
882
+ const form = useTabbedForm();
883
+ return /* @__PURE__ */ jsx3("div", { className: "flex size-full flex-col items-center", children: /* @__PURE__ */ jsx3("div", { className: "w-full max-w-[720px] py-16", children: /* @__PURE__ */ jsx3(
884
+ Form.Field,
885
+ {
886
+ control: form.control,
887
+ name: "template_id",
888
+ render: ({ field }) => {
889
+ return /* @__PURE__ */ jsxs2(Form.Item, { "data-testid": "promotion-create-form-template-item", children: [
890
+ /* @__PURE__ */ jsx3(Form.Label, { "data-testid": "promotion-create-form-template-label", children: t("promotions.fields.type") }),
891
+ /* @__PURE__ */ jsx3(Form.Control, { "data-testid": "promotion-create-form-template-control", children: /* @__PURE__ */ jsx3(
892
+ RadioGroup2,
893
+ {
894
+ dir: direction,
895
+ className: "flex-col gap-y-3",
896
+ ...field,
897
+ onValueChange: field.onChange,
898
+ "data-testid": "promotion-create-form-template-radio-group",
899
+ children: templates.map((template) => {
900
+ return /* @__PURE__ */ jsx3(
901
+ RadioGroup2.ChoiceBox,
902
+ {
903
+ value: template.id,
904
+ label: template.title,
905
+ description: template.description,
906
+ "data-testid": `promotion-create-form-template-option-${template.id}`
907
+ },
908
+ template.id
909
+ );
910
+ })
911
+ },
912
+ "template_id"
913
+ ) }),
914
+ /* @__PURE__ */ jsx3(Form.ErrorMessage, { "data-testid": "promotion-create-form-template-error" })
915
+ ] });
916
+ }
917
+ }
918
+ ) }) });
919
+ };
920
+ Root3._tabMeta = defineTabMeta({
921
+ id: "type",
922
+ labelKey: "promotions.tabs.template",
923
+ validationFields: ["template_id"]
924
+ });
925
+ var PromotionTemplateTab = Root3;
926
+
927
+ // src/pages/promotions/promotion-create/components/create-promotion-form/create-promotion-form.tsx
928
+ import { jsx as jsx4 } from "react/jsx-runtime";
929
+ var PROMOTION_CREATE_DEFAULTS = {
930
+ campaign_id: void 0,
931
+ template_id: templates[0].id,
932
+ campaign_choice: "none",
933
+ is_automatic: "false",
934
+ code: "",
935
+ type: "standard",
936
+ status: "draft",
937
+ rules: [],
938
+ is_tax_inclusive: false,
939
+ application_method: {
940
+ allocation: "each",
941
+ type: "fixed",
942
+ target_type: "items",
943
+ max_quantity: 1,
944
+ target_rules: [],
945
+ buy_rules: []
946
+ },
947
+ campaign: void 0
948
+ };
949
+ function CreatePromotionForm({
950
+ children,
951
+ schema,
952
+ defaultValues: extraDefaults
953
+ }) {
954
+ const { t } = useTranslation3();
955
+ const { handleSuccess } = useRouteModal();
956
+ const form = useForm({
957
+ defaultValues: {
958
+ ...PROMOTION_CREATE_DEFAULTS,
959
+ ...extraDefaults
960
+ },
961
+ resolver: zodResolver(schema ?? CreatePromotionSchema)
962
+ });
963
+ const { setValue, reset, getValues } = form;
964
+ const { mutateAsync: createPromotion, isPending: isLoading } = useCreatePromotion();
965
+ const handleSubmit = form.handleSubmit(
966
+ async (data) => {
967
+ if (data.campaign_choice === "existing" && !data.campaign_id) {
968
+ form.setError("campaign_id", {
969
+ message: t("promotions.errors.requiredField")
970
+ });
971
+ return;
972
+ }
973
+ const {
974
+ campaign_choice: _campaignChoice,
975
+ is_automatic,
976
+ is_tax_inclusive,
977
+ template_id: _templateId,
978
+ application_method,
979
+ rules,
980
+ ...promotionData
981
+ } = data;
982
+ const {
983
+ target_rules: targetRulesData = [],
984
+ buy_rules: buyRulesData = [],
985
+ ...applicationMethodData
986
+ } = application_method;
987
+ const allocationTyped = applicationMethodData.allocation;
988
+ const disguisedRules = [
989
+ ...targetRulesData.filter((r) => !!r.disguised),
990
+ ...buyRulesData.filter((r) => !!r.disguised),
991
+ ...rules.filter((r) => !!r.disguised)
992
+ ];
993
+ const applicationMethodRuleData = {};
994
+ for (const rule of disguisedRules) {
995
+ applicationMethodRuleData[rule.attribute] = rule.field_type === "number" ? parseInt(rule.values) : rule.values;
996
+ }
997
+ const buildRulesData = (rules2) => {
998
+ return rules2.filter((r) => !r.disguised).map((rule) => ({
999
+ operator: rule.operator,
1000
+ attribute: rule.attribute,
1001
+ values: rule.values
1002
+ }));
1003
+ };
1004
+ if (data.campaign) {
1005
+ data.campaign.budget.attribute = data.campaign.budget.attribute || null;
1006
+ data.campaign.budget.type = data.campaign.budget.attribute ? "use_by_attribute" : data.campaign.budget.type;
1007
+ }
1008
+ await createPromotion(
1009
+ {
1010
+ ...promotionData,
1011
+ rules: buildRulesData(rules),
1012
+ application_method: {
1013
+ ...applicationMethodData,
1014
+ allocation: allocationTyped,
1015
+ ...applicationMethodRuleData,
1016
+ value: parseFloat(applicationMethodData.value),
1017
+ target_rules: buildRulesData(targetRulesData),
1018
+ buy_rules: buildRulesData(buyRulesData),
1019
+ max_quantity: allocationTyped === "across" ? void 0 : applicationMethodData.max_quantity
1020
+ },
1021
+ is_tax_inclusive,
1022
+ is_automatic: is_automatic === "true"
1023
+ },
1024
+ {
1025
+ onSuccess: ({ promotion }) => {
1026
+ toast.success(
1027
+ t("promotions.toasts.promotionCreateSuccess", {
1028
+ code: promotion.code
1029
+ })
1030
+ );
1031
+ handleSuccess(`/promotions/${promotion.id}`);
1032
+ },
1033
+ onError: (e) => {
1034
+ toast.error(e.message);
1035
+ }
1036
+ }
1037
+ );
1038
+ },
1039
+ async (error) => {
1040
+ const { campaign: _campaign, ...rest } = error || {};
1041
+ const errorInPromotionTab = !!Object.keys(rest || {}).length;
1042
+ if (errorInPromotionTab) {
1043
+ toast.error(t("promotions.errors.promotionTabError"));
1044
+ }
1045
+ }
1046
+ );
1047
+ const watchTemplateId = useWatch3({
1048
+ control: form.control,
1049
+ name: "template_id"
1050
+ });
1051
+ const currentTemplate = useMemo(() => {
1052
+ const currentTemplate2 = templates.find(
1053
+ (template) => template.id === watchTemplateId
1054
+ );
1055
+ if (!currentTemplate2) {
1056
+ return;
1057
+ }
1058
+ reset({
1059
+ ...PROMOTION_CREATE_DEFAULTS,
1060
+ ...extraDefaults,
1061
+ template_id: watchTemplateId
1062
+ });
1063
+ for (const [key, value] of Object.entries(currentTemplate2.defaults)) {
1064
+ if (typeof value === "object") {
1065
+ for (const [subKey, subValue] of Object.entries(
1066
+ value
1067
+ )) {
1068
+ setValue(`application_method.${subKey}`, subValue);
1069
+ }
1070
+ } else {
1071
+ setValue(key, value);
1072
+ }
1073
+ }
1074
+ return currentTemplate2;
1075
+ }, [watchTemplateId, setValue, reset]);
1076
+ const watchCampaignChoice = useWatch3({
1077
+ control: form.control,
1078
+ name: "campaign_choice"
1079
+ });
1080
+ useEffect2(() => {
1081
+ const formData = getValues();
1082
+ if (watchCampaignChoice !== "existing") {
1083
+ setValue("campaign_id", void 0);
1084
+ form.clearErrors("campaign_id");
1085
+ }
1086
+ if (watchCampaignChoice !== "new") {
1087
+ setValue("campaign", void 0);
1088
+ }
1089
+ if (watchCampaignChoice === "new") {
1090
+ if (!formData.campaign || !formData.campaign?.budget?.type) {
1091
+ setValue("campaign", {
1092
+ ...DEFAULT_CAMPAIGN_VALUES,
1093
+ budget: {
1094
+ ...DEFAULT_CAMPAIGN_VALUES.budget,
1095
+ type: DEFAULT_CAMPAIGN_VALUES.budget.type,
1096
+ currency_code: formData.application_method.currency_code
1097
+ }
1098
+ });
1099
+ }
1100
+ }
1101
+ }, [watchCampaignChoice, getValues, setValue, form]);
1102
+ const watchRules = useWatch3({
1103
+ control: form.control,
1104
+ name: "rules"
1105
+ });
1106
+ const watchCurrencyRule = watchRules.find(
1107
+ (rule) => rule.attribute === "currency_code"
1108
+ );
1109
+ if (watchCurrencyRule) {
1110
+ const formData = form.getValues();
1111
+ const currencyCode = formData.application_method.currency_code;
1112
+ const ruleValue = watchCurrencyRule.values;
1113
+ if (!Array.isArray(ruleValue) && currencyCode !== ruleValue) {
1114
+ form.setValue("application_method.currency_code", ruleValue);
1115
+ }
1116
+ }
1117
+ const defaultTabs = useMemo(
1118
+ () => [
1119
+ /* @__PURE__ */ jsx4(PromotionTemplateTab, {}, "type"),
1120
+ /* @__PURE__ */ jsx4(PromotionDetailsTab, { currentTemplate }, "promotion"),
1121
+ /* @__PURE__ */ jsx4(PromotionCampaignTab, {}, "campaign")
1122
+ ],
1123
+ [currentTemplate]
1124
+ );
1125
+ const hasCustomChildren = Children.count(children) > 0;
1126
+ return /* @__PURE__ */ jsx4(
1127
+ TabbedForm,
1128
+ {
1129
+ form,
1130
+ onSubmit: handleSubmit,
1131
+ isLoading,
1132
+ children: hasCustomChildren ? children : defaultTabs
1133
+ }
1134
+ );
1135
+ }
1136
+
1137
+ // src/pages/promotions/promotion-create/promotion-create.tsx
1138
+ import { jsx as jsx5 } from "react/jsx-runtime";
1139
+ var Root4 = ({ children }) => {
1140
+ return /* @__PURE__ */ jsx5(RouteFocusModal, { "data-testid": "promotion-create-modal", children: Children2.count(children) > 0 ? children : /* @__PURE__ */ jsx5(CreatePromotionForm, {}) });
1141
+ };
1142
+ var PromotionCreatePage = Object.assign(Root4, {
1143
+ Form: CreatePromotionForm,
1144
+ TemplateTab: PromotionTemplateTab,
1145
+ DetailsTab: PromotionDetailsTab,
1146
+ CampaignTab: PromotionCampaignTab,
1147
+ Tab: TabbedForm.Tab
1148
+ });
1149
+ var PromotionCreate = Root4;
1150
+
1151
+ export {
1152
+ CreatePromotionSchema,
1153
+ PromotionCreatePage,
1154
+ PromotionCreate
1155
+ };