@mercurjs/vendor 2.2.0 → 2.2.1-canary.1

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 (200) hide show
  1. package/dist/{[id]-OV5VX7KD.js → [id]-4H5PHF5Y.js} +12 -12
  2. package/dist/{[id]-LJABCC3D.js → [id]-DO6VH55G.js} +14 -14
  3. package/dist/{[id]-RFC2YGFT.js → [id]-JZSYMEEU.js} +3 -3
  4. package/dist/{[id]-AXGVRF7M.js → [id]-L3SFKXZ7.js} +9 -9
  5. package/dist/{[id]-NGB5OLRW.js → [id]-ME4FNZNO.js} +77 -240
  6. package/dist/{[id]-VKEADKFV.js → [id]-OHHNUQEA.js} +13 -13
  7. package/dist/{[id]-FOWK6QIJ.js → [id]-UPNT4QPB.js} +14 -14
  8. package/dist/{[id]-H3YKIFO3.js → [id]-URI4QFRU.js} +81 -32
  9. package/dist/{[id]-WUXFJPPB.js → [id]-V4RDXDN5.js} +7 -7
  10. package/dist/{[id]-IFWREJVP.js → [id]-X75OHEV7.js} +13 -13
  11. package/dist/{[id]-DKF4YEXN.js → [id]-XMJLPBNR.js} +10 -10
  12. package/dist/{[id]-3GF4DR5K.js → [id]-ZD5HBP2R.js} +11 -11
  13. package/dist/{[location_id]-ZG5GZKHC.js → [location_id]-CJDVYICJ.js} +1 -1
  14. package/dist/{[province_id]-KEDQTW6S.js → [province_id]-4WMI4GFG.js} +9 -9
  15. package/dist/{add-HARVSLKD.js → add-Q4A7JELU.js} +14 -14
  16. package/dist/{add-IEIH4CBT.js → add-YEUSE5QA.js} +9 -9
  17. package/dist/{add-customer-groups-EJIRM264.js → add-customer-groups-U2VVS2U4.js} +9 -9
  18. package/dist/{add-products-MW2JYTSJ.js → add-products-GVD6RS4H.js} +13 -13
  19. package/dist/{add-promotions-7KCUDY3S.js → add-promotions-C4EVHYS6.js} +7 -7
  20. package/dist/{add-to-campaign-B7RFNWPF.js → add-to-campaign-WBSCTSKW.js} +2 -2
  21. package/dist/{address-CP2MSWLA.js → address-ZMZ4ST5T.js} +7 -7
  22. package/dist/{adjust-inventory-CQPDV5X7.js → adjust-inventory-QUGKDXOC.js} +1 -1
  23. package/dist/{allocate-items-646J75L2.js → allocate-items-7NSBGXSF.js} +2 -2
  24. package/dist/{areas-VO7NUUUL.js → areas-V6PALYZ5.js} +3 -3
  25. package/dist/{attributes-HU6I723C.js → attributes-6KZMMR7U.js} +1 -1
  26. package/dist/{breadcrumb-3M7RKX5V.js → breadcrumb-C7M5PG2Q.js} +7 -7
  27. package/dist/{breadcrumb-X5TTCKIB.js → breadcrumb-CX5327S5.js} +1 -1
  28. package/dist/{breadcrumb-C7X6FV2H.js → breadcrumb-JWFTKHLE.js} +2 -2
  29. package/dist/{breadcrumb-4Z7NR2BO.js → breadcrumb-KLNC72RI.js} +2 -2
  30. package/dist/{breadcrumb-HK53R6S2.js → breadcrumb-KNBZ3JNR.js} +1 -1
  31. package/dist/{breadcrumb-UVODV3YP.js → breadcrumb-M657ZCG6.js} +2 -2
  32. package/dist/{breadcrumb-KV6K64PW.js → breadcrumb-M6NW3DRQ.js} +1 -1
  33. package/dist/{breadcrumb-TPITDYD7.js → breadcrumb-MXYWEBK6.js} +7 -7
  34. package/dist/{breadcrumb-FF7H3XPP.js → breadcrumb-NBO7UIBV.js} +2 -2
  35. package/dist/{breadcrumb-EAYZVNKS.js → breadcrumb-QPV566YX.js} +7 -7
  36. package/dist/{campaigns-JKFMRYZE.js → campaigns-JVLK7PZZ.js} +3 -3
  37. package/dist/{categories-2PGWWGP6.js → categories-V5UXBO7N.js} +5 -5
  38. package/dist/{chunk-P7UBW2EI.js → chunk-2S2WK2OG.js} +1 -1
  39. package/dist/{chunk-AAKR2CB4.js → chunk-3GSR455R.js} +1 -1
  40. package/dist/{chunk-DSNCEHLY.js → chunk-3WQSQ46M.js} +54 -12
  41. package/dist/{chunk-53JNB4BP.js → chunk-4E26HOEQ.js} +3 -3
  42. package/dist/{chunk-B25W27XK.js → chunk-4PLH6C5Y.js} +2 -2
  43. package/dist/{chunk-52KJSIHS.js → chunk-4UQMRTSC.js} +1393 -1359
  44. package/dist/{chunk-D6XR2USM.js → chunk-5YRE7YS6.js} +6 -6
  45. package/dist/{chunk-DHARUTMI.js → chunk-63F4K3JV.js} +1 -1
  46. package/dist/{chunk-RPMYKDNA.js → chunk-6VKJM537.js} +1 -1
  47. package/dist/{chunk-2GVPLCQR.js → chunk-72HQFLZI.js} +1 -1
  48. package/dist/{chunk-ORI73OPX.js → chunk-7BIBEQTK.js} +1 -1
  49. package/dist/{chunk-YVI3LZ3X.js → chunk-7LSQNTWJ.js} +5 -5
  50. package/dist/{chunk-ZZ4JC4WE.js → chunk-A2KHOOJJ.js} +305 -271
  51. package/dist/{chunk-F4ORNDFU.js → chunk-B6PFCERY.js} +1 -1
  52. package/dist/{chunk-P76QYIFF.js → chunk-BTQN4KKH.js} +1 -1
  53. package/dist/{chunk-JDMNEMRJ.js → chunk-BX3JE7IE.js} +1 -1
  54. package/dist/{chunk-54SCBOWD.js → chunk-BZ62QUXM.js} +5 -5
  55. package/dist/{chunk-3IZSQI6K.js → chunk-CQ2LZLMZ.js} +1 -1
  56. package/dist/{chunk-656G74I2.js → chunk-DETQ6IBQ.js} +1 -1
  57. package/dist/{chunk-YAUGB4LD.js → chunk-EMUCGKHP.js} +19 -23
  58. package/dist/{chunk-D6RN3ONJ.js → chunk-EPSRO7C5.js} +2 -2
  59. package/dist/{chunk-6PSJJHI4.js → chunk-GIKVFOQL.js} +1 -1
  60. package/dist/{chunk-DSY5PNK6.js → chunk-HCUIYIIY.js} +1 -1
  61. package/dist/{chunk-SCPQYA26.js → chunk-HJKH5CIN.js} +1 -1
  62. package/dist/{chunk-KUH5ZX7G.js → chunk-IMIPUUZG.js} +1 -1
  63. package/dist/chunk-J75EFK5A.js +59 -0
  64. package/dist/{chunk-IP6TSKUQ.js → chunk-JB32ZD4Y.js} +2 -2
  65. package/dist/chunk-MDABSESI.js +38 -0
  66. package/dist/{chunk-UWU6VSO4.js → chunk-MJDXUH62.js} +2 -2
  67. package/dist/{chunk-RSOV55K7.js → chunk-NIBVITRN.js} +1 -1
  68. package/dist/{chunk-XKEYHWBS.js → chunk-OCYVN77Z.js} +1 -1
  69. package/dist/{chunk-DIAWPVYS.js → chunk-OGUTFP6B.js} +1 -1
  70. package/dist/{chunk-OCS24TF4.js → chunk-OTBX6TP5.js} +1 -1
  71. package/dist/{chunk-OZ2UHCWA.js → chunk-OZJVEN6Y.js} +1 -1
  72. package/dist/{chunk-N7YRIXJA.js → chunk-OZUKJHBG.js} +2 -2
  73. package/dist/{chunk-5DKUSZQ7.js → chunk-PF7R7LMW.js} +1 -1
  74. package/dist/{chunk-WJ4KVDFV.js → chunk-PFZJDFJE.js} +1 -1
  75. package/dist/{chunk-7TQNE3E2.js → chunk-RR276N7K.js} +1 -1
  76. package/dist/{chunk-YXEC5XAV.js → chunk-RVFPWOR2.js} +1 -1
  77. package/dist/{chunk-MDGTQT5D.js → chunk-RW2EF2S2.js} +15 -44
  78. package/dist/{chunk-S5KWI3MM.js → chunk-RZNF5OGM.js} +12 -12
  79. package/dist/{chunk-G64YUZSL.js → chunk-S2VYK3YC.js} +1 -1
  80. package/dist/{chunk-E73SSHJR.js → chunk-SA7ZGKMI.js} +1 -1
  81. package/dist/{chunk-SFQOECF7.js → chunk-SI55QRZ4.js} +7 -6
  82. package/dist/{chunk-XQO243HC.js → chunk-TGAJLPO4.js} +1 -1
  83. package/dist/{chunk-WN2NWWVO.js → chunk-TII3PB6X.js} +1 -1
  84. package/dist/{chunk-VUWAOX7H.js → chunk-U5V6HNVW.js} +1 -1
  85. package/dist/{chunk-XEQU2OQP.js → chunk-UJ57OE7G.js} +4 -4
  86. package/dist/{chunk-4GPAS5GW.js → chunk-UST2RGWB.js} +3 -2
  87. package/dist/{chunk-DRKRLQZZ.js → chunk-VHFKJLDH.js} +1 -1
  88. package/dist/{chunk-KGHHGMDU.js → chunk-VVTBCP3J.js} +2 -2
  89. package/dist/{chunk-XUJUJD2E.js → chunk-VVX7PL6K.js} +77 -14
  90. package/dist/{chunk-P27MQBMZ.js → chunk-WJF24CGA.js} +1 -1
  91. package/dist/{chunk-OQTL7PXK.js → chunk-XVBONKRV.js} +1 -1
  92. package/dist/{chunk-ZZ7T7GN5.js → chunk-YG5K4DQ2.js} +25 -16
  93. package/dist/{chunk-4ZWIWI2H.js → chunk-Z6KOYIKK.js} +2 -2
  94. package/dist/{chunk-VQTQILLY.js → chunk-ZEXF3ABX.js} +1 -1
  95. package/dist/{chunk-CVXKASWV.js → chunk-ZHXIOG62.js} +1 -1
  96. package/dist/{chunk-LFX6R456.js → chunk-ZXDMPIXN.js} +3 -3
  97. package/dist/{collections-BLDMQOVB.js → collections-K7H2MWBH.js} +13 -13
  98. package/dist/{configuration-YVYVOLSP.js → configuration-QEDVL2WF.js} +2 -2
  99. package/dist/{create-FYKFT7TQ.js → create-2I3GAX4C.js} +7 -7
  100. package/dist/{create-3WBHG32J.js → create-2VDED7TL.js} +6 -6
  101. package/dist/{create-QZVZF3MJ.js → create-7FT7N2NH.js} +2 -2
  102. package/dist/{create-PO3JC6QK.js → create-GEOTGYQK.js} +7 -7
  103. package/dist/{create-NNBIDU4Q.js → create-GEYXN6SW.js} +7 -7
  104. package/dist/{create-Z6ZHEAKU.js → create-H77ZUZG5.js} +7 -7
  105. package/dist/{create-Y2FZ4565.js → create-HQVENM5H.js} +159 -132
  106. package/dist/{create-TDQISX3H.js → create-LJO4YEDW.js} +5 -5
  107. package/dist/{create-ZLYEPOAQ.js → create-MFGMTZ5A.js} +8 -8
  108. package/dist/{create-PO2JF7F5.js → create-PF2465JI.js} +15 -15
  109. package/dist/{create-XORPYXNT.js → create-S7VYYTUD.js} +9 -9
  110. package/dist/{create-7VKH255E.js → create-T6WOFJDM.js} +3 -3
  111. package/dist/{create-DU2V6X5H.js → create-V4YOFXW7.js} +13 -13
  112. package/dist/{create-G6VJD52A.js → create-VWONAYEZ.js} +15 -15
  113. package/dist/{customer-group-add-customers-UTBBZ6T4.js → customer-group-add-customers-GUJQAPU4.js} +2 -2
  114. package/dist/{customer-group-detail-WSBXE23J.js → customer-group-detail-ZQOMC6C5.js} +3 -3
  115. package/dist/{customer-groups-TWCYFU3U.js → customer-groups-JKF46LEB.js} +3 -3
  116. package/dist/{customers-6HDZKARD.js → customers-OZJ5UBIZ.js} +3 -3
  117. package/dist/{edit-K2IP2H25.js → edit-4B364HGZ.js} +2 -2
  118. package/dist/{edit-Y4XONJJU.js → edit-6VJWRZHQ.js} +7 -7
  119. package/dist/{edit-IVBVZ5NL.js → edit-735HBYH2.js} +2 -2
  120. package/dist/{edit-YDMBLXGU.js → edit-M4AP65HO.js} +8 -8
  121. package/dist/{edit-CKO32TA3.js → edit-MPOTIGUY.js} +8 -8
  122. package/dist/{edit-3AM5DZE7.js → edit-PUGFEETJ.js} +10 -10
  123. package/dist/edit-QBUYHSE7.js +122 -0
  124. package/dist/{edit-CNXA4GKJ.js → edit-QHXQ4XOC.js} +6 -6
  125. package/dist/{edit-YPIJHIGC.js → edit-RJUZDCAC.js} +15 -15
  126. package/dist/{edit-3HMTDPZK.js → edit-SQU5UOGE.js} +8 -8
  127. package/dist/{edit-OOY2XGLZ.js → edit-TFFIBHDE.js} +53 -42
  128. package/dist/edit-TTW5DB77.js +525 -0
  129. package/dist/{edit-inventory-item-5VBH365V.js → edit-inventory-item-BCVECCLT.js} +1 -1
  130. package/dist/{edit-inventory-item-attributes-RMKG2IRO.js → edit-inventory-item-attributes-GWEMP67O.js} +1 -1
  131. package/dist/{edit-price-PDS4XN2J.js → edit-price-GLAEAO7R.js} +2 -2
  132. package/dist/{edit-stock-UI6HXHJJ.js → edit-stock-E3PM2YOP.js} +2 -2
  133. package/dist/extension-targets.d.ts +2 -2
  134. package/dist/{fulfillment-6GC3NRFT.js → fulfillment-HDU7GATG.js} +7 -7
  135. package/dist/{fulfillment-providers-IND53UPG.js → fulfillment-providers-KT6GFVHM.js} +12 -12
  136. package/dist/index.css +9 -0
  137. package/dist/index.js +158 -158
  138. package/dist/{inventory-BDST2XIX.js → inventory-4DHRHO5G.js} +4 -4
  139. package/dist/{inventory-LSG2IEWD.js → inventory-CKA34HWM.js} +2 -2
  140. package/dist/{invite-DD2G6UUM.js → invite-4CRK5AKM.js} +10 -10
  141. package/dist/{invite-CNJQ27AY.js → invite-755AJC3M.js} +7 -7
  142. package/dist/{loader-MJTR2S7V.js → loader-B4T2VBGV.js} +2 -2
  143. package/dist/{loader-BLRQLIJT.js → loader-UUSAVCK6.js} +1 -1
  144. package/dist/{locations-HHP2DZ4N.js → locations-BN2BTULF.js} +2 -2
  145. package/dist/{login-VMLJYOCF.js → login-UGKYRKMD.js} +9 -9
  146. package/dist/{manage-locations-V2AJVZXA.js → manage-locations-PRQI5TI4.js} +1 -1
  147. package/dist/{media-ZXUMWWXV.js → media-QXTBUKRL.js} +11 -11
  148. package/dist/{media-T26YU24S.js → media-TGFAHFBV.js} +9 -9
  149. package/dist/{metadata-WB37SSTG.js → metadata-4ZZ4ZIWJ.js} +7 -7
  150. package/dist/{metadata-XS3VAC3N.js → metadata-5TVRCKWX.js} +7 -7
  151. package/dist/{metadata-BGYWXGMG.js → metadata-7JWZ4VFM.js} +7 -7
  152. package/dist/{metadata-3CER2AEK.js → metadata-BQQFHVKF.js} +7 -7
  153. package/dist/{metadata-MSAODJ2T.js → metadata-G73TILNE.js} +7 -7
  154. package/dist/{offer-create-page-VHNJL3UO.js → offer-create-page-WPGYWE3P.js} +12 -12
  155. package/dist/{offer-detail-page-ZLGP4ELR.js → offer-detail-page-MCCTZS4U.js} +16 -23
  156. package/dist/{offer-variant-detail-page-2A7TRGYS.js → offer-variant-detail-page-ITNWEDPL.js} +16 -19
  157. package/dist/{offers-ZBAZOZ7Q.js → offers-VURV22HI.js} +13 -13
  158. package/dist/{onboarding-XCCZ2TMN.js → onboarding-7MURQYXX.js} +7 -7
  159. package/dist/{orders-VFSDZYOV.js → orders-WX5YB4QC.js} +13 -13
  160. package/dist/{organization-YB45TRUN.js → organization-T6ZTYMMW.js} +9 -9
  161. package/dist/{organize-T62CDRZC.js → organize-F2KDXDHQ.js} +3 -3
  162. package/dist/{organize-HQLROEUF.js → organize-GZ5URDMH.js} +3 -3
  163. package/dist/pages/index.d.ts +1 -2
  164. package/dist/pages/index.js +40 -39
  165. package/dist/{payment-details-O4EWCOYQ.js → payment-details-UQ65D5AY.js} +7 -7
  166. package/dist/{payouts-7O5W2X5J.js → payouts-64CG65KK.js} +3 -3
  167. package/dist/{price-lists-5C4MCWWR.js → price-lists-ZRXB2V7W.js} +6 -6
  168. package/dist/{pricing-CF3FJP6A.js → pricing-3NLEJYRP.js} +2 -2
  169. package/dist/{pricing-OQ4RKZO5.js → pricing-CPPIL627.js} +7 -7
  170. package/dist/{product-tags-2TLA7BVO.js → product-tags-AE5K6YFE.js} +15 -15
  171. package/dist/{product-types-LZAMCLGS.js → product-types-OMPZFQH4.js} +3 -3
  172. package/dist/{product-variant-detail-UNG6LWDP.js → product-variant-detail-4DDE6RJ5.js} +8 -8
  173. package/dist/{product-variant-edit-K5U3JZFW.js → product-variant-edit-SAZUI4E3.js} +9 -9
  174. package/dist/{products-WJJBC3NI.js → products-4AAGMX3C.js} +13 -13
  175. package/dist/{products-QIGSKI65.js → products-7SPJXANH.js} +19 -19
  176. package/dist/{professional-details-ZCRAWCXZ.js → professional-details-UN5B4YDJ.js} +7 -7
  177. package/dist/{profile-T2QLFLI7.js → profile-6MIDTK52.js} +7 -7
  178. package/dist/{promotions-JT5PFYPT.js → promotions-FUPYU3EL.js} +8 -8
  179. package/dist/{receive-QCVCAR3R.js → receive-ZG6FFN7H.js} +3 -3
  180. package/dist/{refund-GAOWE636.js → refund-KJX74N6T.js} +3 -3
  181. package/dist/{register-S4EBPL7B.js → register-GAG7SNL6.js} +9 -9
  182. package/dist/{reset-password-VTYSKEFH.js → reset-password-YI7COKLV.js} +1 -1
  183. package/dist/{return-reasons-RH6IEU2M.js → return-reasons-I7YVFYB7.js} +5 -5
  184. package/dist/{sales-channels-ZHYGTRWU.js → sales-channels-LWEVGTY6.js} +3 -2
  185. package/dist/{sales-channels-C5M2ZA5L.js → sales-channels-RJLPZDOZ.js} +3 -2
  186. package/dist/{settings-5IUDEPUN.js → settings-YWUHDHET.js} +19 -19
  187. package/dist/{shipment-UP2OGESO.js → shipment-6CTA2GHU.js} +7 -7
  188. package/dist/{shipping-ACK5UOA5.js → shipping-TKKMYQHJ.js} +2 -2
  189. package/dist/{shipping-profile-3US7LC5E.js → shipping-profile-CFISOMTE.js} +1 -1
  190. package/dist/{shipping-profiles-34432J3C.js → shipping-profiles-42EXTQKX.js} +10 -10
  191. package/dist/{stock-QOUDJSFO.js → stock-465GEUY3.js} +7 -7
  192. package/dist/{store-BCNSSIO6.js → store-BRVTHHXV.js} +9 -9
  193. package/dist/{store-closure-QGR3F45Y.js → store-closure-DYW54VHB.js} +7 -7
  194. package/dist/{store-select-55ZOJGGV.js → store-select-6A5YR7WH.js} +8 -8
  195. package/dist/{tax-regions-RTPVM4IC.js → tax-regions-SQVEIHUK.js} +2 -2
  196. package/dist/{team-DAUWBJAI.js → team-5SBIRJKL.js} +10 -10
  197. package/package.json +15 -15
  198. package/dist/chunk-S2WEYEQR.js +0 -14
  199. package/dist/edit-DCMMX4GW.js +0 -366
  200. package/dist/edit-P6YZBA32.js +0 -324
@@ -0,0 +1,525 @@
1
+ import {
2
+ DeprecatedPercentageInput
3
+ } from "./chunk-MAEP2UCK.js";
4
+ import {
5
+ getCurrencySymbol
6
+ } from "./chunk-IQPN4PZJ.js";
7
+ import {
8
+ SwitchBox
9
+ } from "./chunk-YVCBMOJG.js";
10
+ import "./chunk-TKGWSUEI.js";
11
+ import {
12
+ KeyboundForm
13
+ } from "./chunk-SITRHMZZ.js";
14
+ import {
15
+ RouteDrawer,
16
+ useRouteModal
17
+ } from "./chunk-GDWBOQI5.js";
18
+ import {
19
+ Form
20
+ } from "./chunk-3QSRE5LS.js";
21
+ import {
22
+ usePromotion,
23
+ useUpdatePromotion
24
+ } from "./chunk-MR6REQKT.js";
25
+ import "./chunk-RHKRREUU.js";
26
+ import "./chunk-ZA2KFUFR.js";
27
+ import "./chunk-DTGEFKK4.js";
28
+ import "./chunk-NBMM2TZK.js";
29
+
30
+ // src/pages/promotions/[id]/edit/index.tsx
31
+ import { Heading } from "@medusajs/ui";
32
+ import { useLinkQuery } from "@mercurjs/dashboard-shared";
33
+ import { useTranslation as useTranslation2 } from "react-i18next";
34
+ import { useParams } from "react-router-dom";
35
+
36
+ // src/pages/promotions/[id]/edit/edit-promotion-form/edit-promotion-details-form.tsx
37
+ import { useEffect } from "react";
38
+ import {
39
+ Button,
40
+ CurrencyInput,
41
+ Divider,
42
+ Input,
43
+ RadioGroup,
44
+ Text,
45
+ toast
46
+ } from "@medusajs/ui";
47
+ import i18n from "i18next";
48
+ import { useWatch } from "react-hook-form";
49
+ import { Trans, useTranslation } from "react-i18next";
50
+ import * as zod from "zod";
51
+ import {
52
+ FormExtensionZone,
53
+ useExtendableForm
54
+ } from "@mercurjs/dashboard-shared";
55
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
56
+ var EditPromotionSchema = zod.object({
57
+ is_automatic: zod.string().toLowerCase(),
58
+ code: zod.string().min(1, { message: i18n.t("validation.requiredField") }),
59
+ is_tax_inclusive: zod.boolean().optional(),
60
+ status: zod.enum(["active", "inactive", "draft"]),
61
+ value_type: zod.enum(["fixed", "percentage"]),
62
+ value: zod.number().min(0, { message: i18n.t("validation.requiredField") }).or(zod.string().min(1, { message: i18n.t("validation.requiredField") })),
63
+ allocation: zod.enum(["each", "across", "once"]),
64
+ target_type: zod.enum(["order", "shipping_methods", "items"]),
65
+ max_quantity: zod.number().min(1).optional().nullable(),
66
+ limit: zod.number().int().min(1).optional().nullable()
67
+ });
68
+ var EditPromotionDetailsForm = ({ promotion }) => {
69
+ const { t } = useTranslation();
70
+ const { handleSuccess } = useRouteModal();
71
+ const form = useExtendableForm({
72
+ schema: EditPromotionSchema,
73
+ model: "promotion",
74
+ zone: "edit",
75
+ data: promotion,
76
+ defaultValues: {
77
+ is_automatic: promotion.is_automatic.toString(),
78
+ is_tax_inclusive: promotion.is_tax_inclusive ?? false,
79
+ code: promotion.code,
80
+ status: promotion.status,
81
+ value: promotion.application_method.value,
82
+ value_type: promotion.application_method.type,
83
+ allocation: promotion.application_method.allocation,
84
+ target_type: promotion.application_method.target_type,
85
+ max_quantity: promotion.application_method?.max_quantity ?? 1,
86
+ limit: promotion.limit ?? null
87
+ }
88
+ });
89
+ const { mutateAsync, isPending } = useUpdatePromotion(promotion.id);
90
+ const watchValueType = useWatch({
91
+ control: form.control,
92
+ name: "value_type"
93
+ });
94
+ const isFixedValueType = watchValueType === "fixed";
95
+ const watchAllocation = useWatch({
96
+ control: form.control,
97
+ name: "allocation"
98
+ });
99
+ const currencyCode = promotion.application_method?.currency_code;
100
+ const isTargetTypeShipping = promotion.application_method?.target_type === "shipping_methods";
101
+ const canBeTaxInclusive = isFixedValueType && promotion.type === "standard";
102
+ useEffect(() => {
103
+ if (!canBeTaxInclusive) {
104
+ form.setValue("is_tax_inclusive", false);
105
+ }
106
+ }, [canBeTaxInclusive, form]);
107
+ const handleSubmit = form.handleSubmit(async (data) => {
108
+ const value = parseFloat(String(data.value));
109
+ if (isNaN(value) || value < 0) {
110
+ form.setError("value", {
111
+ message: t("promotions.form.value.invalid")
112
+ });
113
+ return;
114
+ }
115
+ await mutateAsync(
116
+ {
117
+ is_automatic: data.is_automatic === "true",
118
+ code: data.code,
119
+ status: data.status,
120
+ is_tax_inclusive: data.is_tax_inclusive,
121
+ limit: data.is_automatic === "true" ? void 0 : data.limit,
122
+ application_method: {
123
+ value,
124
+ type: data.value_type,
125
+ allocation: data.allocation,
126
+ max_quantity: data.max_quantity
127
+ }
128
+ },
129
+ {
130
+ onSuccess: () => {
131
+ toast.success(t("promotions.toasts.promotionUpdateSuccess"));
132
+ handleSuccess();
133
+ },
134
+ onError: (e) => {
135
+ toast.error(e.message);
136
+ }
137
+ }
138
+ );
139
+ });
140
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
141
+ KeyboundForm,
142
+ {
143
+ onSubmit: handleSubmit,
144
+ className: "flex flex-1 flex-col overflow-hidden",
145
+ children: [
146
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-8", children: [
147
+ /* @__PURE__ */ jsx(
148
+ Form.Field,
149
+ {
150
+ control: form.control,
151
+ name: "is_automatic",
152
+ render: ({ field }) => {
153
+ return /* @__PURE__ */ jsxs(Form.Item, { children: [
154
+ /* @__PURE__ */ jsx(Form.Label, { children: t("promotions.form.method.label") }),
155
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(
156
+ RadioGroup,
157
+ {
158
+ className: "flex-col gap-y-3",
159
+ ...field,
160
+ value: field.value,
161
+ onValueChange: field.onChange,
162
+ children: [
163
+ /* @__PURE__ */ jsx(
164
+ RadioGroup.ChoiceBox,
165
+ {
166
+ value: "false",
167
+ label: t("promotions.form.method.code.title"),
168
+ description: t("promotions.form.method.code.description")
169
+ }
170
+ ),
171
+ /* @__PURE__ */ jsx(
172
+ RadioGroup.ChoiceBox,
173
+ {
174
+ value: "true",
175
+ label: t("promotions.form.method.automatic.title"),
176
+ description: t("promotions.form.method.automatic.description")
177
+ }
178
+ )
179
+ ]
180
+ }
181
+ ) }),
182
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
183
+ ] });
184
+ }
185
+ }
186
+ ),
187
+ /* @__PURE__ */ jsx(
188
+ Form.Field,
189
+ {
190
+ control: form.control,
191
+ name: "status",
192
+ render: ({ field }) => {
193
+ return /* @__PURE__ */ jsxs(Form.Item, { children: [
194
+ /* @__PURE__ */ jsx(Form.Label, { children: t("promotions.form.status.label") }),
195
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(
196
+ RadioGroup,
197
+ {
198
+ className: "flex-col gap-y-3",
199
+ ...field,
200
+ value: field.value,
201
+ onValueChange: field.onChange,
202
+ children: [
203
+ /* @__PURE__ */ jsx(
204
+ RadioGroup.ChoiceBox,
205
+ {
206
+ value: "draft",
207
+ label: t("promotions.form.status.draft.title"),
208
+ description: t("promotions.form.status.draft.description")
209
+ }
210
+ ),
211
+ /* @__PURE__ */ jsx(
212
+ RadioGroup.ChoiceBox,
213
+ {
214
+ value: "active",
215
+ label: t("promotions.form.status.active.title"),
216
+ description: t("promotions.form.status.active.description")
217
+ }
218
+ ),
219
+ /* @__PURE__ */ jsx(
220
+ RadioGroup.ChoiceBox,
221
+ {
222
+ value: "inactive",
223
+ label: t("promotions.form.status.inactive.title"),
224
+ description: t("promotions.form.status.inactive.description")
225
+ }
226
+ )
227
+ ]
228
+ }
229
+ ) }),
230
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
231
+ ] });
232
+ }
233
+ }
234
+ ),
235
+ canBeTaxInclusive && /* @__PURE__ */ jsx(
236
+ SwitchBox,
237
+ {
238
+ control: form.control,
239
+ name: "is_tax_inclusive",
240
+ label: t("promotions.form.taxInclusive.title"),
241
+ description: t("promotions.form.taxInclusive.description")
242
+ }
243
+ ),
244
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
245
+ /* @__PURE__ */ jsx(
246
+ Form.Field,
247
+ {
248
+ control: form.control,
249
+ name: "code",
250
+ render: ({ field }) => {
251
+ return /* @__PURE__ */ jsxs(Form.Item, { children: [
252
+ /* @__PURE__ */ jsx(Form.Label, { children: t("promotions.form.code.title") }),
253
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) })
254
+ ] });
255
+ }
256
+ }
257
+ ),
258
+ /* @__PURE__ */ jsx(
259
+ Text,
260
+ {
261
+ size: "small",
262
+ leading: "compact",
263
+ className: "text-ui-fg-subtle",
264
+ children: /* @__PURE__ */ jsx(
265
+ Trans,
266
+ {
267
+ t,
268
+ i18nKey: "promotions.form.code.description",
269
+ components: [/* @__PURE__ */ jsx("br", {}, "break")]
270
+ }
271
+ )
272
+ }
273
+ )
274
+ ] }),
275
+ !isTargetTypeShipping && /* @__PURE__ */ jsxs(Fragment, { children: [
276
+ /* @__PURE__ */ jsx(
277
+ Form.Field,
278
+ {
279
+ control: form.control,
280
+ name: "value_type",
281
+ render: ({ field }) => {
282
+ return /* @__PURE__ */ jsxs(Form.Item, { children: [
283
+ /* @__PURE__ */ jsx(Form.Label, { children: t("promotions.fields.value_type") }),
284
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(
285
+ RadioGroup,
286
+ {
287
+ className: "flex-col gap-y-3",
288
+ ...field,
289
+ value: field.value,
290
+ onValueChange: field.onChange,
291
+ children: [
292
+ /* @__PURE__ */ jsx(
293
+ RadioGroup.ChoiceBox,
294
+ {
295
+ value: "fixed",
296
+ label: t("promotions.form.value_type.fixed.title"),
297
+ description: t("promotions.form.value_type.fixed.description")
298
+ }
299
+ ),
300
+ /* @__PURE__ */ jsx(
301
+ RadioGroup.ChoiceBox,
302
+ {
303
+ value: "percentage",
304
+ label: t("promotions.form.value_type.percentage.title"),
305
+ description: t("promotions.form.value_type.percentage.description")
306
+ }
307
+ )
308
+ ]
309
+ }
310
+ ) }),
311
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
312
+ ] });
313
+ }
314
+ }
315
+ ),
316
+ /* @__PURE__ */ jsx(
317
+ Form.Field,
318
+ {
319
+ control: form.control,
320
+ name: "allocation",
321
+ render: ({ field }) => {
322
+ return /* @__PURE__ */ jsxs(Form.Item, { children: [
323
+ /* @__PURE__ */ jsx(Form.Label, { children: t("promotions.fields.allocation") }),
324
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(
325
+ RadioGroup,
326
+ {
327
+ className: "flex-col gap-y-3",
328
+ ...field,
329
+ value: field.value,
330
+ onValueChange: field.onChange,
331
+ children: [
332
+ /* @__PURE__ */ jsx(
333
+ RadioGroup.ChoiceBox,
334
+ {
335
+ value: "each",
336
+ label: t("promotions.form.allocation.each.title"),
337
+ description: t("promotions.form.allocation.each.description")
338
+ }
339
+ ),
340
+ /* @__PURE__ */ jsx(
341
+ RadioGroup.ChoiceBox,
342
+ {
343
+ value: "once",
344
+ label: t("promotions.form.allocation.once.title"),
345
+ description: t("promotions.form.allocation.once.description")
346
+ }
347
+ )
348
+ ]
349
+ }
350
+ ) }),
351
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
352
+ ] });
353
+ }
354
+ }
355
+ ),
356
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-8", children: [
357
+ /* @__PURE__ */ jsx(
358
+ Form.Field,
359
+ {
360
+ control: form.control,
361
+ name: "value",
362
+ render: ({ field: { onChange, value, ...field } }) => {
363
+ return /* @__PURE__ */ jsxs(Form.Item, { children: [
364
+ /* @__PURE__ */ jsx(Form.Label, { children: isFixedValueType ? t("promotions.form.value.title") : t("fields.percentage") }),
365
+ /* @__PURE__ */ jsx(Form.Control, { children: isFixedValueType ? /* @__PURE__ */ jsx(
366
+ CurrencyInput,
367
+ {
368
+ ...field,
369
+ min: 0,
370
+ onValueChange: (val) => {
371
+ onChange(val ? parseInt(val) : "");
372
+ },
373
+ code: currencyCode || "USD",
374
+ symbol: currencyCode ? getCurrencySymbol(currencyCode) : "$",
375
+ value
376
+ }
377
+ ) : /* @__PURE__ */ jsx(
378
+ DeprecatedPercentageInput,
379
+ {
380
+ min: 0,
381
+ max: 100,
382
+ ...field,
383
+ value: value || "",
384
+ onChange: (e) => {
385
+ onChange(
386
+ e.target.value === "" ? null : parseInt(e.target.value)
387
+ );
388
+ }
389
+ },
390
+ "amount"
391
+ ) }),
392
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
393
+ ] });
394
+ }
395
+ }
396
+ ),
397
+ (watchAllocation === "each" || watchAllocation === "once") && /* @__PURE__ */ jsx(
398
+ Form.Field,
399
+ {
400
+ control: form.control,
401
+ name: "max_quantity",
402
+ render: () => {
403
+ return /* @__PURE__ */ jsxs(Form.Item, { children: [
404
+ /* @__PURE__ */ jsx(Form.Label, { children: t("promotions.form.max_quantity.title") }),
405
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
406
+ Input,
407
+ {
408
+ ...form.register("max_quantity", {
409
+ valueAsNumber: true
410
+ }),
411
+ type: "number",
412
+ min: 1,
413
+ placeholder: "999"
414
+ }
415
+ ) }),
416
+ /* @__PURE__ */ jsx(
417
+ Text,
418
+ {
419
+ size: "small",
420
+ leading: "compact",
421
+ className: "text-ui-fg-subtle",
422
+ children: /* @__PURE__ */ jsx(
423
+ Trans,
424
+ {
425
+ t,
426
+ i18nKey: "promotions.form.max_quantity.description",
427
+ components: [/* @__PURE__ */ jsx("br", {}, "break")]
428
+ }
429
+ )
430
+ }
431
+ ),
432
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
433
+ ] });
434
+ }
435
+ }
436
+ )
437
+ ] })
438
+ ] }),
439
+ /* @__PURE__ */ jsx(Divider, {}),
440
+ /* @__PURE__ */ jsx(
441
+ Form.Field,
442
+ {
443
+ control: form.control,
444
+ name: "limit",
445
+ render: ({ field: { onChange, value, ...field } }) => {
446
+ return /* @__PURE__ */ jsxs(Form.Item, { children: [
447
+ /* @__PURE__ */ jsx(Form.Label, { optional: true, children: t("promotions.form.usageLimit.title") }),
448
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
449
+ Input,
450
+ {
451
+ type: "number",
452
+ min: 1,
453
+ ...field,
454
+ value: value ?? "",
455
+ onChange: (e) => {
456
+ onChange(
457
+ e.target.value === "" ? null : parseInt(e.target.value)
458
+ );
459
+ }
460
+ }
461
+ ) }),
462
+ /* @__PURE__ */ jsx(
463
+ Text,
464
+ {
465
+ size: "small",
466
+ leading: "compact",
467
+ className: "text-ui-fg-subtle",
468
+ children: t("promotions.form.usageLimit.description")
469
+ }
470
+ ),
471
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
472
+ ] });
473
+ }
474
+ }
475
+ ),
476
+ /* @__PURE__ */ jsx(
477
+ FormExtensionZone,
478
+ {
479
+ model: "promotion",
480
+ zone: "edit",
481
+ control: form.control,
482
+ data: promotion
483
+ }
484
+ )
485
+ ] }) }),
486
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
487
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(
488
+ Button,
489
+ {
490
+ size: "small",
491
+ variant: "secondary",
492
+ children: t("actions.cancel")
493
+ }
494
+ ) }),
495
+ /* @__PURE__ */ jsx(
496
+ Button,
497
+ {
498
+ size: "small",
499
+ type: "submit",
500
+ isLoading: isPending,
501
+ children: t("actions.save")
502
+ }
503
+ )
504
+ ] }) })
505
+ ]
506
+ }
507
+ ) });
508
+ };
509
+
510
+ // src/pages/promotions/[id]/edit/index.tsx
511
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
512
+ var Component = () => {
513
+ const { id } = useParams();
514
+ const { t } = useTranslation2();
515
+ const linkQuery = useLinkQuery("promotion");
516
+ const { promotion, isLoading, isError, error } = usePromotion(id, linkQuery);
517
+ if (isError) throw error;
518
+ return /* @__PURE__ */ jsxs2(RouteDrawer, { children: [
519
+ /* @__PURE__ */ jsx2(RouteDrawer.Header, { children: /* @__PURE__ */ jsx2(Heading, { children: t("promotions.edit.title") }) }),
520
+ !isLoading && promotion && /* @__PURE__ */ jsx2(EditPromotionDetailsForm, { promotion })
521
+ ] });
522
+ };
523
+ export {
524
+ Component
525
+ };
@@ -12,7 +12,7 @@ import {
12
12
  import {
13
13
  useInventoryItem,
14
14
  useUpdateInventoryItem
15
- } from "./chunk-YAUGB4LD.js";
15
+ } from "./chunk-EMUCGKHP.js";
16
16
  import "./chunk-A5DJIOHN.js";
17
17
  import "./chunk-RHKRREUU.js";
18
18
  import "./chunk-ZA2KFUFR.js";
@@ -17,7 +17,7 @@ import {
17
17
  import {
18
18
  useInventoryItem,
19
19
  useUpdateInventoryItem
20
- } from "./chunk-YAUGB4LD.js";
20
+ } from "./chunk-EMUCGKHP.js";
21
21
  import "./chunk-A5DJIOHN.js";
22
22
  import "./chunk-RHKRREUU.js";
23
23
  import "./chunk-ZA2KFUFR.js";
@@ -30,11 +30,11 @@ import {
30
30
  } from "./chunk-W34KDYZA.js";
31
31
  import {
32
32
  offerQueryKeys
33
- } from "./chunk-5DKUSZQ7.js";
33
+ } from "./chunk-PF7R7LMW.js";
34
34
  import {
35
35
  productsQueryKeys,
36
36
  useProduct
37
- } from "./chunk-YAUGB4LD.js";
37
+ } from "./chunk-EMUCGKHP.js";
38
38
  import "./chunk-A5DJIOHN.js";
39
39
  import {
40
40
  queryClient
@@ -27,12 +27,12 @@ import {
27
27
  } from "./chunk-O72AIZUN.js";
28
28
  import {
29
29
  offerQueryKeys
30
- } from "./chunk-5DKUSZQ7.js";
30
+ } from "./chunk-PF7R7LMW.js";
31
31
  import {
32
32
  productsQueryKeys,
33
33
  useBatchInventoryItemsLocationLevels,
34
34
  useProduct
35
- } from "./chunk-YAUGB4LD.js";
35
+ } from "./chunk-EMUCGKHP.js";
36
36
  import "./chunk-A5DJIOHN.js";
37
37
  import {
38
38
  queryClient
@@ -223,14 +223,14 @@ declare module "@mercurjs/dashboard-sdk" {
223
223
  "product": {
224
224
  formZones: "create" | "edit"
225
225
  formTabs: { "create": "attributes" | "details" | "organize" | "variants" }
226
- displayZones: "attributes" | "general" | "media" | "organize" | "sales-channels" | "shipping-profile" | "variants"
226
+ displayZones: "general" | "media" | "organize" | "sales-channels" | "shipping-profile" | "variants"
227
227
  displayFieldIds: "description" | "discountable" | "handle" | "status" | "subtitle" | "title"
228
228
  }
229
229
  "promotion": {
230
230
  formZones: "edit"
231
231
  formTabs: Record<string, string>
232
232
  displayZones: "campaign" | "general"
233
- displayFieldIds: "allocation" | "code" | "code_value" | "is_automatic" | "status" | "type" | "value"
233
+ displayFieldIds: "allocation" | "code" | "code_value" | "is_automatic" | "status" | "tax_inclusive" | "type" | "usage_limit" | "value"
234
234
  }
235
235
  "reservation": {
236
236
  formZones: "edit"
@@ -25,29 +25,29 @@ import "./chunk-FV76G2D7.js";
25
25
  import "./chunk-GHDLST2P.js";
26
26
  import "./chunk-YVYYOBAE.js";
27
27
  import "./chunk-L2NJPDUD.js";
28
- import "./chunk-P7UBW2EI.js";
28
+ import "./chunk-2S2WK2OG.js";
29
29
  import "./chunk-MR6REQKT.js";
30
30
  import "./chunk-EPSDO2MJ.js";
31
31
  import "./chunk-BHEU34FL.js";
32
32
  import "./chunk-W34KDYZA.js";
33
33
  import "./chunk-II3CLUXA.js";
34
- import "./chunk-XKEYHWBS.js";
34
+ import "./chunk-OCYVN77Z.js";
35
35
  import "./chunk-J2XUEO2E.js";
36
- import "./chunk-656G74I2.js";
36
+ import "./chunk-DETQ6IBQ.js";
37
37
  import {
38
38
  useShippingOptions
39
39
  } from "./chunk-VWPNMEOE.js";
40
40
  import {
41
41
  useStockLocations
42
42
  } from "./chunk-O72AIZUN.js";
43
- import "./chunk-VUWAOX7H.js";
44
- import "./chunk-5DKUSZQ7.js";
43
+ import "./chunk-U5V6HNVW.js";
44
+ import "./chunk-PF7R7LMW.js";
45
45
  import {
46
46
  useCreateOrderFulfillment,
47
47
  useOrder
48
- } from "./chunk-DIAWPVYS.js";
48
+ } from "./chunk-OGUTFP6B.js";
49
49
  import "./chunk-4U2BLH45.js";
50
- import "./chunk-YAUGB4LD.js";
50
+ import "./chunk-EMUCGKHP.js";
51
51
  import "./chunk-A5DJIOHN.js";
52
52
  import "./chunk-RHKRREUU.js";
53
53
  import "./chunk-ZA2KFUFR.js";