@mercurjs/admin 2.2.0-canary.18 → 2.2.0-canary.19

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 (173) hide show
  1. package/dist/{add-campaign-promotions-4QP4LF7G.js → add-campaign-promotions-KK4JMLSK.js} +3 -3
  2. package/dist/{adjust-inventory-AHIKDW7M.js → adjust-inventory-F3OTF6O6.js} +5 -5
  3. package/dist/{api-key-management-detail-ZRLG6YRB.js → api-key-management-detail-JMWPGN6M.js} +6 -6
  4. package/dist/{attribute-create-NIYUQEHQ.js → attribute-create-TJRNP5SK.js} +7 -7
  5. package/dist/{attribute-detail-GA4FDSAG.js → attribute-detail-7I2SQCDK.js} +6 -6
  6. package/dist/{attribute-edit-KJL36HQ4.js → attribute-edit-UBG6SMUF.js} +2 -2
  7. package/dist/{attribute-edit-possible-value-LGOD3ZKQ.js → attribute-edit-possible-value-3BYEPC4X.js} +2 -2
  8. package/dist/{attribute-list-A3RFO32Z.js → attribute-list-EFU4DPB5.js} +5 -5
  9. package/dist/{campaign-detail-A7ZM4Q7M.js → campaign-detail-H32E6EDD.js} +9 -9
  10. package/dist/{categories-metadata-FCV4YK74.js → categories-metadata-V37DXTVZ.js} +5 -5
  11. package/dist/{category-detail-CIEHVR4M.js → category-detail-5MRHPG6T.js} +10 -10
  12. package/dist/{category-products-AB3YAGSW.js → category-products-3KYY662O.js} +9 -9
  13. package/dist/{chunk-WUGV75DM.js → chunk-3F6U44M6.js} +1 -1
  14. package/dist/{chunk-IBX52HBP.js → chunk-3N7QXAMO.js} +1 -1
  15. package/dist/{chunk-K2C42QAV.js → chunk-4DYSSDAA.js} +4 -4
  16. package/dist/{chunk-2PUBUYFG.js → chunk-5GXPXVVD.js} +2 -2
  17. package/dist/{chunk-CIKXWLWE.js → chunk-6AYGDFNE.js} +2 -2
  18. package/dist/{chunk-G5DQCCPL.js → chunk-6LG3VL3Q.js} +2 -2
  19. package/dist/{chunk-A2GVK4VZ.js → chunk-AXVZ56UD.js} +2 -2
  20. package/dist/{chunk-2LKMOTLX.js → chunk-B7HIZN4V.js} +2 -2
  21. package/dist/{chunk-EOLSQKPV.js → chunk-BJQ4UBK7.js} +529 -480
  22. package/dist/{chunk-OMBP3YSV.js → chunk-CFBEBAQS.js} +1 -1
  23. package/dist/{chunk-FJRNNDZS.js → chunk-EASE3NLF.js} +1 -1
  24. package/dist/chunk-EG45GIE3.js +368 -0
  25. package/dist/{chunk-TWCYZF6X.js → chunk-EM5TF7YZ.js} +1 -1
  26. package/dist/{chunk-MEXH366L.js → chunk-FCLS6CKW.js} +2 -2
  27. package/dist/{chunk-ENFXIYIH.js → chunk-FYKG35MR.js} +1 -1
  28. package/dist/{chunk-VZ7GNMGX.js → chunk-GA4ZFAOV.js} +1 -1
  29. package/dist/{chunk-RZ5SFALB.js → chunk-GFUCELIZ.js} +2 -2
  30. package/dist/{chunk-OFOKVLV3.js → chunk-GHGOOZEL.js} +2 -2
  31. package/dist/{chunk-CVZA23ES.js → chunk-GNWWL47L.js} +3 -3
  32. package/dist/{chunk-MR3MLNWV.js → chunk-HYQPZADS.js} +1 -1
  33. package/dist/{chunk-DELK6EWH.js → chunk-IHTQOPB6.js} +1 -1
  34. package/dist/chunk-JEJQKTZO.js +191 -0
  35. package/dist/{chunk-5BF5JDWT.js → chunk-JWE2IW4R.js} +5 -5
  36. package/dist/chunk-KZB7LCF2.js +82 -0
  37. package/dist/{chunk-N6YOACEW.js → chunk-L5Z4JGRD.js} +1 -1
  38. package/dist/{chunk-3VDLE5GA.js → chunk-LVCIAKJI.js} +1 -1
  39. package/dist/{chunk-PE6JFXWU.js → chunk-MFIT2RX5.js} +1 -1
  40. package/dist/{chunk-ZB4TESPP.js → chunk-O62SUNK2.js} +16 -7
  41. package/dist/{chunk-Q5WTOVZZ.js → chunk-O63MLTQV.js} +71 -0
  42. package/dist/{chunk-WPVDACTL.js → chunk-OA24YN34.js} +1 -1
  43. package/dist/{chunk-3DMUKRIX.js → chunk-OXONMLRP.js} +2 -2
  44. package/dist/{chunk-LJDGVBOQ.js → chunk-PJR6W35H.js} +1 -1
  45. package/dist/chunk-PN5C4AND.js +115 -0
  46. package/dist/chunk-QR3GYYX6.js +0 -0
  47. package/dist/{chunk-VT6QIVZW.js → chunk-RMAQKNBA.js} +10 -1
  48. package/dist/{chunk-IEPH6A2W.js → chunk-RV7DWZZB.js} +2 -2
  49. package/dist/chunk-RXRDZ47F.js +103 -0
  50. package/dist/{chunk-623TMW36.js → chunk-T53YX34K.js} +1 -1
  51. package/dist/{chunk-EYFWEKFJ.js → chunk-TLOJG7LK.js} +2 -2
  52. package/dist/{chunk-7Y6A7XK6.js → chunk-UCHVBAUB.js} +2 -2
  53. package/dist/{chunk-47W2JHOE.js → chunk-UT2O7IS7.js} +2 -2
  54. package/dist/{chunk-B4K7H6DH.js → chunk-UUTACMA5.js} +1 -1
  55. package/dist/{chunk-JSMUFZZN.js → chunk-WHIYSLYW.js} +1 -1
  56. package/dist/{chunk-SEQJOCTT.js → chunk-X4N7EMFO.js} +2 -2
  57. package/dist/{chunk-RUSMGNQ6.js → chunk-X7E65HM2.js} +1 -1
  58. package/dist/{chunk-RWRL4AXD.js → chunk-XKD67CD4.js} +2 -2
  59. package/dist/{chunk-UCYSCKZV.js → chunk-Y7FNFQCU.js} +1 -6
  60. package/dist/{chunk-HEGPAGJT.js → chunk-YI7I7JFX.js} +2 -2
  61. package/dist/{chunk-EB6ZFOTO.js → chunk-YLK2WZU3.js} +2 -2
  62. package/dist/{chunk-OCRKS4Z7.js → chunk-ZDJWTF64.js} +2 -2
  63. package/dist/{chunk-T4GL73RP.js → chunk-ZG6DNI7O.js} +1 -1
  64. package/dist/{chunk-OHOWEMHO.js → chunk-ZIFHQXP3.js} +31 -25
  65. package/dist/{collection-add-products-KTUW23TD.js → collection-add-products-4EZ6W4N6.js} +9 -9
  66. package/dist/{collection-detail-TR7TDQZG.js → collection-detail-X22ZIM5S.js} +10 -10
  67. package/dist/{collection-list-FOWSOTS7.js → collection-list-6CUEOLUU.js} +9 -9
  68. package/dist/{collection-metadata-DS32TGOK.js → collection-metadata-AWJYPZKR.js} +5 -5
  69. package/dist/commission-rule-commission-edit-TA3H3EEN.js +196 -0
  70. package/dist/commission-rule-create-O7Z25SC7.js +412 -0
  71. package/dist/commission-rule-detail-I7LVSNAM.js +45 -0
  72. package/dist/commission-rule-edit-YSHDTYZY.js +342 -0
  73. package/dist/{commission-rate-list-Y5XLEO67.js → commissions-list-OUGVPED6.js} +13 -4
  74. package/dist/{customer-detail-5XGZ2K3H.js → customer-detail-6MBW3FHO.js} +6 -6
  75. package/dist/{customer-group-detail-JX3BEYFG.js → customer-group-detail-G53RB6EA.js} +5 -5
  76. package/dist/{customer-group-list-F5TFLDVH.js → customer-group-list-XDNCZ4K6.js} +5 -5
  77. package/dist/{customer-group-metadata-CHOTUAS2.js → customer-group-metadata-FWLKUHIZ.js} +5 -5
  78. package/dist/{customer-metadata-LG6HA56I.js → customer-metadata-KU4YWD3R.js} +5 -5
  79. package/dist/{customers-add-customer-group-3YKZEZKJ.js → customers-add-customer-group-5Y5XPN7C.js} +5 -5
  80. package/dist/{edit-inventory-item-5EYVQ6CM.js → edit-inventory-item-MBLHBGBH.js} +5 -5
  81. package/dist/{edit-inventory-item-attributes-7QM4YHAQ.js → edit-inventory-item-attributes-GTTGNBO4.js} +5 -5
  82. package/dist/{edit-rules-2S5H7MC2.js → edit-rules-UFGKSAJV.js} +5 -5
  83. package/dist/global-commission-edit-LCD6JJUX.js +194 -0
  84. package/dist/index.js +158 -150
  85. package/dist/{inventory-create-RBMMOSC3.js → inventory-create-4O4L6NXK.js} +5 -5
  86. package/dist/{inventory-detail-LSAJ3ZB5.js → inventory-detail-ZWHSLLLI.js} +5 -5
  87. package/dist/{inventory-metadata-OZAKLWNY.js → inventory-metadata-GZYYWU3S.js} +5 -5
  88. package/dist/{inventory-stock-WUAIUFQS.js → inventory-stock-S5B6ZZQW.js} +5 -5
  89. package/dist/{location-detail-PBCP7BBV.js → location-detail-QS7HM2KG.js} +5 -5
  90. package/dist/{location-fulfillment-providers-D4EFIF3Z.js → location-fulfillment-providers-6RUGYQ3W.js} +7 -7
  91. package/dist/{location-list-DM4WU57J.js → location-list-7RTDLHGR.js} +5 -5
  92. package/dist/{location-service-zone-shipping-option-create-T4LT4E6M.js → location-service-zone-shipping-option-create-UKULBDGM.js} +5 -5
  93. package/dist/{login-LTASZXSR.js → login-SFGV4QGP.js} +5 -5
  94. package/dist/{marketplace-detail-GSPPUVR7.js → marketplace-detail-7VPTFUPB.js} +5 -5
  95. package/dist/{marketplace-metadata-PB7JEK2K.js → marketplace-metadata-E25VT5TH.js} +5 -5
  96. package/dist/{offers-D2QQQD2F.js → offers-WYAJB75N.js} +9 -9
  97. package/dist/{order-create-claim-HND7RODU.js → order-create-claim-3AQK3FH2.js} +3 -3
  98. package/dist/{order-create-edit-LIQGALQ2.js → order-create-edit-UFD26FE2.js} +2 -2
  99. package/dist/{order-create-exchange-QE2TJ36U.js → order-create-exchange-QCYD3DC4.js} +7 -7
  100. package/dist/{order-create-refund-37JJA6MM.js → order-create-refund-TR4XMHRY.js} +5 -5
  101. package/dist/{order-create-return-AVVT3OUO.js → order-create-return-Y7QS52UL.js} +2 -2
  102. package/dist/{order-detail-A2WC2OZU.js → order-detail-FZT74HMD.js} +10 -10
  103. package/dist/{order-edit-billing-address-IPWVSYR2.js → order-edit-billing-address-OJZICMBN.js} +6 -6
  104. package/dist/{order-edit-email-ZQZNTV4P.js → order-edit-email-TH26N5HK.js} +5 -5
  105. package/dist/{order-edit-shipping-address-YPYWT3YN.js → order-edit-shipping-address-GBOUGZPD.js} +5 -5
  106. package/dist/{order-list-QR3ZVI4U.js → order-list-C5YOR6B5.js} +2 -2
  107. package/dist/{order-metadata-E25YHGCC.js → order-metadata-RT3BVTYZ.js} +5 -5
  108. package/dist/{order-request-transfer-XDNXRB66.js → order-request-transfer-3HTFPYFD.js} +5 -5
  109. package/dist/pages/index.d.ts +5 -23
  110. package/dist/pages/index.js +79 -77
  111. package/dist/{price-list-create-GBUUE3NP.js → price-list-create-XQWV352E.js} +10 -10
  112. package/dist/{price-list-detail-77FAEXXO.js → price-list-detail-347UU3LU.js} +10 -10
  113. package/dist/{price-list-prices-add-2XS5TX5X.js → price-list-prices-add-R656I6QF.js} +10 -10
  114. package/dist/{price-list-prices-edit-C2C3I64A.js → price-list-prices-edit-BOKBTLEI.js} +5 -5
  115. package/dist/{product-add-existing-attributes-NFXKW6SW.js → product-add-existing-attributes-MNGWZFGD.js} +7 -7
  116. package/dist/{product-create-AG4AYDM3.js → product-create-LMYR36NA.js} +9 -9
  117. package/dist/{product-create-variant-7DVYYUDX.js → product-create-variant-XETT2WJC.js} +3 -3
  118. package/dist/{product-detail-CNVETME5.js → product-detail-WSL4PXKK.js} +7 -7
  119. package/dist/{product-edit-attribute-GXFMVPCQ.js → product-edit-attribute-XEYHQJ6D.js} +2 -2
  120. package/dist/{product-list-KM37QJ6F.js → product-list-7YPGRGHX.js} +10 -10
  121. package/dist/{product-media-H5DAWUYR.js → product-media-H6SYBNLI.js} +2 -2
  122. package/dist/{product-metadata-4ZLL42UF.js → product-metadata-MGLJJ7QG.js} +5 -5
  123. package/dist/{product-tag-create-KKRQQT3A.js → product-tag-create-JCYAG42N.js} +5 -5
  124. package/dist/{product-tag-detail-R6UFJDCW.js → product-tag-detail-AUNKJJLP.js} +12 -12
  125. package/dist/{product-tag-edit-TISDF4FQ.js → product-tag-edit-2FREKKVN.js} +5 -5
  126. package/dist/{product-tag-list-NFPQVVMO.js → product-tag-list-IKL46JZT.js} +12 -12
  127. package/dist/{product-tag-metadata-GJFYX5HU.js → product-tag-metadata-UV3TBPXS.js} +5 -5
  128. package/dist/{product-type-detail-XJPSQDL2.js → product-type-detail-DKHKFADI.js} +13 -13
  129. package/dist/{product-type-metadata-GKVLFBF6.js → product-type-metadata-22OACFMD.js} +8 -8
  130. package/dist/{product-variant-detail-VCMC4BZP.js → product-variant-detail-MNMJBYIP.js} +5 -5
  131. package/dist/{product-variant-edit-QLDFN6LI.js → product-variant-edit-THZLEOGL.js} +7 -7
  132. package/dist/{product-variant-metadata-VZZMPRRG.js → product-variant-metadata-7N7PL7WY.js} +5 -5
  133. package/dist/{promotion-create-POBB7B23.js → promotion-create-RB3AA5GE.js} +5 -5
  134. package/dist/{promotion-detail-NSOGXQAY.js → promotion-detail-PEDTLXZ4.js} +8 -8
  135. package/dist/{promotion-list-7C3SQCSO.js → promotion-list-MCYWN5TF.js} +4 -4
  136. package/dist/{refund-reason-create-HPLJOL6S.js → refund-reason-create-YWA5XP4J.js} +5 -5
  137. package/dist/{refund-reason-edit-JI4U4RWO.js → refund-reason-edit-MBG5WL43.js} +5 -5
  138. package/dist/{refund-reason-list-SWU4B2ED.js → refund-reason-list-GPDRI2QM.js} +10 -10
  139. package/dist/{region-metadata-LDWMTB7G.js → region-metadata-WDZ7DRGU.js} +5 -5
  140. package/dist/{reservation-detail-BLPISKPA.js → reservation-detail-WTYOR6IB.js} +5 -5
  141. package/dist/{reservation-metadata-AZ265HZI.js → reservation-metadata-PJVHEJRU.js} +5 -5
  142. package/dist/{reset-password-6CAYNSJ6.js → reset-password-2NVKH6QA.js} +1 -1
  143. package/dist/{return-reason-list-7HTIV7NK.js → return-reason-list-E6L7VJY7.js} +5 -5
  144. package/dist/{sales-channel-add-products-S47CQCJF.js → sales-channel-add-products-BKT3CFLY.js} +9 -9
  145. package/dist/{sales-channel-detail-6JPHP4FZ.js → sales-channel-detail-MUBMJGQV.js} +10 -10
  146. package/dist/{sales-channel-list-D673ONK2.js → sales-channel-list-O5SFOGMA.js} +5 -5
  147. package/dist/{sales-channel-metadata-OY47MCFI.js → sales-channel-metadata-67RGBA7X.js} +5 -5
  148. package/dist/{shipping-option-type-create-H2YRDETZ.js → shipping-option-type-create-OBF6GG5W.js} +5 -5
  149. package/dist/{shipping-option-type-detail-NVSXILP4.js → shipping-option-type-detail-TJC2GBUA.js} +7 -7
  150. package/dist/{shipping-option-type-edit-KBPDYAUJ.js → shipping-option-type-edit-INKLJRSH.js} +5 -5
  151. package/dist/{shipping-option-type-list-OUKJZJ6R.js → shipping-option-type-list-WKA64NYE.js} +7 -7
  152. package/dist/{shipping-profile-metadata-CQCDC45M.js → shipping-profile-metadata-RI6Y2N6V.js} +5 -5
  153. package/dist/{store-bulk-edit-DXWHZMGL.js → store-bulk-edit-WML2DUA4.js} +1 -1
  154. package/dist/{store-create-MVHUY3I3.js → store-create-AGF2LZWR.js} +5 -5
  155. package/dist/{store-details-V3NMV665.js → store-details-3HWOCRYI.js} +11 -11
  156. package/dist/{store-edit-6CC2GBFY.js → store-edit-5WWOOSHT.js} +3 -3
  157. package/dist/{store-list-WV6XHGLU.js → store-list-YEEKX2AV.js} +9 -9
  158. package/dist/{store-member-invite-7YIXFC56.js → store-member-invite-TULPI3N5.js} +1 -1
  159. package/dist/{tax-region-create-RGE5ZIBR.js → tax-region-create-X2LAHX27.js} +6 -6
  160. package/dist/{tax-region-detail-OKEK6WNJ.js → tax-region-detail-3X3TNFJA.js} +5 -5
  161. package/dist/{tax-region-edit-QQ3LB74P.js → tax-region-edit-7ECYGXEA.js} +5 -5
  162. package/dist/{tax-region-metadata-GPTD6KZB.js → tax-region-metadata-FQLEYY2R.js} +5 -5
  163. package/dist/{tax-region-province-detail-WHO3RLUX.js → tax-region-province-detail-DIV5AAFQ.js} +5 -5
  164. package/dist/{tax-region-tax-override-create-223MPYUG.js → tax-region-tax-override-create-BV4O3QCU.js} +14 -16
  165. package/dist/{tax-region-tax-override-edit-WFOXP6A7.js → tax-region-tax-override-edit-QUA77YTI.js} +16 -18
  166. package/dist/{user-metadata-A3JS6O4K.js → user-metadata-64LX64QI.js} +5 -5
  167. package/package.json +1 -1
  168. package/dist/chunk-AKTAFKIU.js +0 -228
  169. package/dist/chunk-HLJ24XVH.js +0 -390
  170. package/dist/chunk-SWL7ZCP3.js +0 -11
  171. package/dist/commission-rate-create-G42ZUJPH.js +0 -782
  172. package/dist/commission-rate-detail-VGYTGWLH.js +0 -85
  173. package/dist/commission-rate-edit-3CYWYOMS.js +0 -767
@@ -0,0 +1,412 @@
1
+ import {
2
+ CommissionValueFields,
3
+ useStoreCurrencies
4
+ } from "./chunk-KZB7LCF2.js";
5
+ import "./chunk-QR3GYYX6.js";
6
+ import {
7
+ SCOPE_TYPE_DIMENSIONS,
8
+ buildRulesFromScope,
9
+ buildValuesPayload
10
+ } from "./chunk-PN5C4AND.js";
11
+ import "./chunk-MAEP2UCK.js";
12
+ import {
13
+ useComboboxData
14
+ } from "./chunk-5KGMGL4N.js";
15
+ import "./chunk-PYDRHQTY.js";
16
+ import {
17
+ Combobox
18
+ } from "./chunk-AW77UWCZ.js";
19
+ import {
20
+ TabbedForm,
21
+ defineTabMeta,
22
+ useTabbedForm
23
+ } from "./chunk-FREUYHMS.js";
24
+ import {
25
+ SwitchBox
26
+ } from "./chunk-2EME4AWX.js";
27
+ import "./chunk-IQPN4PZJ.js";
28
+ import "./chunk-TKGWSUEI.js";
29
+ import "./chunk-SITRHMZZ.js";
30
+ import {
31
+ RouteFocusModal,
32
+ useRouteModal
33
+ } from "./chunk-FWJLS7XD.js";
34
+ import {
35
+ Form
36
+ } from "./chunk-3QSRE5LS.js";
37
+ import {
38
+ useCreateCommissionRule
39
+ } from "./chunk-ZIFHQXP3.js";
40
+ import "./chunk-FXWKGNRV.js";
41
+ import "./chunk-VDKOJ5WD.js";
42
+ import {
43
+ useDocumentDirection
44
+ } from "./chunk-Y7QKP6QU.js";
45
+ import "./chunk-RHKRREUU.js";
46
+ import "./chunk-ZA2KFUFR.js";
47
+ import {
48
+ sdk
49
+ } from "./chunk-ZBWL72TB.js";
50
+ import "./chunk-NBMM2TZK.js";
51
+
52
+ // src/pages/commissions/commission-rule-create/commission-rule-create.tsx
53
+ import { Children } from "react";
54
+ import { useTranslation as useTranslation4 } from "react-i18next";
55
+
56
+ // src/pages/commissions/commission-rule-create/components/create-commission-rule-form/create-commission-rule-form.tsx
57
+ import { zodResolver } from "@hookform/resolvers/zod";
58
+ import { toast } from "@medusajs/ui";
59
+ import { useForm } from "react-hook-form";
60
+ import { useTranslation as useTranslation3 } from "react-i18next";
61
+
62
+ // src/pages/commissions/commission-rule-create/components/create-commission-rule-form/create-commission-rule-commission.tsx
63
+ import { Heading, Select } from "@medusajs/ui";
64
+ import { useTranslation } from "react-i18next";
65
+ import { jsx, jsxs } from "react/jsx-runtime";
66
+ var CreateCommissionRuleCommission = () => {
67
+ const { t } = useTranslation();
68
+ const form = useTabbedForm();
69
+ const direction = useDocumentDirection();
70
+ const { currencies } = useStoreCurrencies();
71
+ const commissionType = form.watch("commissionType");
72
+ return /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center p-16", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8", children: [
73
+ /* @__PURE__ */ jsx(Heading, { children: t("commissions.create.commission", "Commission") }),
74
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
75
+ /* @__PURE__ */ jsx(
76
+ Form.Field,
77
+ {
78
+ control: form.control,
79
+ name: "commissionType",
80
+ render: ({ field: { onChange, ref, ...field } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
81
+ /* @__PURE__ */ jsx(Form.Label, { children: t("commissions.fields.type.label", "Type") }),
82
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(Select, { ...field, onValueChange: onChange, dir: direction, children: [
83
+ /* @__PURE__ */ jsx(Select.Trigger, { ref, children: /* @__PURE__ */ jsx(Select.Value, {}) }),
84
+ /* @__PURE__ */ jsxs(Select.Content, { children: [
85
+ /* @__PURE__ */ jsx(Select.Item, { value: "percentage", children: t("commissions.fields.type.percentage", "Percentage") }),
86
+ /* @__PURE__ */ jsx(Select.Item, { value: "fixed", children: t("commissions.fields.type.fixed", "Fixed") })
87
+ ] })
88
+ ] }) }),
89
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
90
+ ] })
91
+ }
92
+ ),
93
+ /* @__PURE__ */ jsx(
94
+ CommissionValueFields,
95
+ {
96
+ control: form.control,
97
+ type: commissionType,
98
+ currencies
99
+ }
100
+ )
101
+ ] }),
102
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
103
+ /* @__PURE__ */ jsx(
104
+ SwitchBox,
105
+ {
106
+ control: form.control,
107
+ name: "include_tax",
108
+ label: t("commissions.fields.taxIncluded", "Tax included"),
109
+ description: t(
110
+ "commissions.fields.taxIncludedHint",
111
+ "If checked, commission is calculated based on the total amount including tax. If unchecked, tax is excluded and goes entirely to the store."
112
+ )
113
+ }
114
+ ),
115
+ /* @__PURE__ */ jsx(
116
+ SwitchBox,
117
+ {
118
+ control: form.control,
119
+ name: "include_shipping",
120
+ label: t(
121
+ "commissions.fields.shippingIncluded",
122
+ "Shipping included"
123
+ ),
124
+ description: t(
125
+ "commissions.fields.shippingIncludedHint",
126
+ "If checked, commission is calculated based on the total amount including shipping. If unchecked, shipping fees go entirely to the store."
127
+ )
128
+ }
129
+ )
130
+ ] })
131
+ ] }) });
132
+ };
133
+ CreateCommissionRuleCommission._tabMeta = defineTabMeta({
134
+ id: "commission",
135
+ labelKey: "commissions.create.commission",
136
+ validationFields: ["commissionType"]
137
+ });
138
+
139
+ // src/pages/commissions/commission-rule-create/components/create-commission-rule-form/create-commission-rule-details.tsx
140
+ import { Heading as Heading2, Input, Select as Select2 } from "@medusajs/ui";
141
+ import { useTranslation as useTranslation2 } from "react-i18next";
142
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
143
+ var CreateCommissionRuleDetails = () => {
144
+ const { t } = useTranslation2();
145
+ const form = useTabbedForm();
146
+ const direction = useDocumentDirection();
147
+ const scopeType = form.watch("scopeType");
148
+ const dimensions = SCOPE_TYPE_DIMENSIONS[scopeType];
149
+ const stores = useComboboxData({
150
+ queryKey: ["commission_stores"],
151
+ queryFn: (params) => sdk.admin.sellers.query({ ...params }),
152
+ getOptions: (data) => data.sellers.map((s) => ({
153
+ label: s.name,
154
+ value: s.id
155
+ }))
156
+ });
157
+ const productTypes = useComboboxData({
158
+ queryKey: ["commission_product_types"],
159
+ queryFn: (params) => sdk.admin.productTypes.query({ ...params }),
160
+ getOptions: (data) => data.product_types.map((pt) => ({
161
+ label: pt.value,
162
+ value: pt.id
163
+ }))
164
+ });
165
+ const categories = useComboboxData({
166
+ queryKey: ["commission_categories"],
167
+ queryFn: (params) => sdk.admin.productCategories.query({ ...params }),
168
+ getOptions: (data) => data.product_categories.map((c) => ({
169
+ label: c.name,
170
+ value: c.id
171
+ }))
172
+ });
173
+ return /* @__PURE__ */ jsx2("div", { className: "flex flex-col items-center p-16", children: /* @__PURE__ */ jsxs2("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8", children: [
174
+ /* @__PURE__ */ jsx2(Heading2, { children: t("commissions.create.details", "Details") }),
175
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-y-4", children: [
176
+ /* @__PURE__ */ jsxs2("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
177
+ /* @__PURE__ */ jsx2(
178
+ Form.Field,
179
+ {
180
+ control: form.control,
181
+ name: "title",
182
+ render: ({ field }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
183
+ /* @__PURE__ */ jsx2(Form.Label, { children: t("fields.title") }),
184
+ /* @__PURE__ */ jsx2(Form.Control, { children: /* @__PURE__ */ jsx2(Input, { autoComplete: "off", ...field }) }),
185
+ /* @__PURE__ */ jsx2(Form.ErrorMessage, {})
186
+ ] })
187
+ }
188
+ ),
189
+ /* @__PURE__ */ jsx2(
190
+ Form.Field,
191
+ {
192
+ control: form.control,
193
+ name: "code",
194
+ render: ({ field }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
195
+ /* @__PURE__ */ jsx2(Form.Label, { children: t("commissions.fields.code", "Code") }),
196
+ /* @__PURE__ */ jsx2(Form.Control, { children: /* @__PURE__ */ jsx2(Input, { autoComplete: "off", ...field }) }),
197
+ /* @__PURE__ */ jsx2(Form.ErrorMessage, {})
198
+ ] })
199
+ }
200
+ )
201
+ ] }),
202
+ /* @__PURE__ */ jsx2(
203
+ Form.Field,
204
+ {
205
+ control: form.control,
206
+ name: "scopeType",
207
+ render: ({ field: { onChange, ref, ...field } }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
208
+ /* @__PURE__ */ jsx2(Form.Label, { children: t("commissions.fields.scopeType.label", "Type") }),
209
+ /* @__PURE__ */ jsx2(Form.Control, { children: /* @__PURE__ */ jsxs2(Select2, { ...field, onValueChange: onChange, dir: direction, children: [
210
+ /* @__PURE__ */ jsx2(Select2.Trigger, { ref, children: /* @__PURE__ */ jsx2(Select2.Value, {}) }),
211
+ /* @__PURE__ */ jsxs2(Select2.Content, { children: [
212
+ /* @__PURE__ */ jsx2(Select2.Item, { value: "store", children: t("commissions.fields.scopeType.store", "Store") }),
213
+ /* @__PURE__ */ jsx2(Select2.Item, { value: "product_type", children: t(
214
+ "commissions.fields.scopeType.productType",
215
+ "Product Type"
216
+ ) }),
217
+ /* @__PURE__ */ jsx2(Select2.Item, { value: "category", children: t("commissions.fields.scopeType.category", "Category") }),
218
+ /* @__PURE__ */ jsx2(Select2.Item, { value: "store_product_type", children: t(
219
+ "commissions.fields.scopeType.storeProductType",
220
+ "Store + Product Type"
221
+ ) }),
222
+ /* @__PURE__ */ jsx2(Select2.Item, { value: "store_category", children: t(
223
+ "commissions.fields.scopeType.storeCategory",
224
+ "Store + Category"
225
+ ) })
226
+ ] })
227
+ ] }) }),
228
+ /* @__PURE__ */ jsx2(Form.ErrorMessage, {})
229
+ ] })
230
+ }
231
+ ),
232
+ dimensions.includes("seller") && /* @__PURE__ */ jsx2(
233
+ Form.Field,
234
+ {
235
+ control: form.control,
236
+ name: "stores",
237
+ render: ({ field }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
238
+ /* @__PURE__ */ jsx2(Form.Label, { children: t("commissions.fields.stores", "Stores") }),
239
+ /* @__PURE__ */ jsx2(Form.Control, { children: /* @__PURE__ */ jsx2(
240
+ Combobox,
241
+ {
242
+ options: stores.options,
243
+ fetchNextPage: stores.fetchNextPage,
244
+ searchValue: stores.searchValue,
245
+ onSearchValueChange: stores.onSearchValueChange,
246
+ ...field
247
+ }
248
+ ) }),
249
+ /* @__PURE__ */ jsx2(Form.ErrorMessage, {})
250
+ ] })
251
+ }
252
+ ),
253
+ dimensions.includes("product_type") && /* @__PURE__ */ jsx2(
254
+ Form.Field,
255
+ {
256
+ control: form.control,
257
+ name: "productTypes",
258
+ render: ({ field }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
259
+ /* @__PURE__ */ jsx2(Form.Label, { children: t("commissions.fields.productTypes", "Product Types") }),
260
+ /* @__PURE__ */ jsx2(Form.Control, { children: /* @__PURE__ */ jsx2(
261
+ Combobox,
262
+ {
263
+ options: productTypes.options,
264
+ fetchNextPage: productTypes.fetchNextPage,
265
+ searchValue: productTypes.searchValue,
266
+ onSearchValueChange: productTypes.onSearchValueChange,
267
+ ...field
268
+ }
269
+ ) }),
270
+ /* @__PURE__ */ jsx2(Form.ErrorMessage, {})
271
+ ] })
272
+ }
273
+ ),
274
+ dimensions.includes("product_category") && /* @__PURE__ */ jsx2(
275
+ Form.Field,
276
+ {
277
+ control: form.control,
278
+ name: "categories",
279
+ render: ({ field }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
280
+ /* @__PURE__ */ jsx2(Form.Label, { children: t("commissions.fields.categories", "Categories") }),
281
+ /* @__PURE__ */ jsx2(Form.Control, { children: /* @__PURE__ */ jsx2(
282
+ Combobox,
283
+ {
284
+ options: categories.options,
285
+ fetchNextPage: categories.fetchNextPage,
286
+ searchValue: categories.searchValue,
287
+ onSearchValueChange: categories.onSearchValueChange,
288
+ ...field
289
+ }
290
+ ) }),
291
+ /* @__PURE__ */ jsx2(Form.ErrorMessage, {})
292
+ ] })
293
+ }
294
+ )
295
+ ] })
296
+ ] }) });
297
+ };
298
+ CreateCommissionRuleDetails._tabMeta = defineTabMeta(
299
+ {
300
+ id: "details",
301
+ labelKey: "commissions.create.details",
302
+ validationFields: ["title", "code", "scopeType"]
303
+ }
304
+ );
305
+
306
+ // src/pages/commissions/commission-rule-create/components/create-commission-rule-form/schema.ts
307
+ import * as zod from "zod";
308
+ var CreateCommissionRuleSchema = zod.object({
309
+ title: zod.string().min(1),
310
+ code: zod.string().min(1),
311
+ scopeType: zod.enum([
312
+ "store",
313
+ "product_type",
314
+ "category",
315
+ "store_product_type",
316
+ "store_category"
317
+ ]),
318
+ stores: zod.array(zod.string()),
319
+ productTypes: zod.array(zod.string()),
320
+ categories: zod.array(zod.string()),
321
+ commissionType: zod.enum(["percentage", "fixed"]),
322
+ value: zod.coerce.number().min(0),
323
+ fixed_values: zod.record(zod.string(), zod.coerce.number()).optional(),
324
+ include_tax: zod.boolean(),
325
+ include_shipping: zod.boolean()
326
+ });
327
+
328
+ // src/pages/commissions/commission-rule-create/components/create-commission-rule-form/create-commission-rule-form.tsx
329
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
330
+ var CreateCommissionRuleForm = () => {
331
+ const { t } = useTranslation3();
332
+ const { handleSuccess } = useRouteModal();
333
+ const { currencies } = useStoreCurrencies();
334
+ const form = useForm({
335
+ defaultValues: {
336
+ title: "",
337
+ code: "",
338
+ scopeType: "store",
339
+ stores: [],
340
+ productTypes: [],
341
+ categories: [],
342
+ commissionType: "percentage",
343
+ value: 0,
344
+ fixed_values: {},
345
+ include_tax: false,
346
+ include_shipping: false
347
+ },
348
+ resolver: zodResolver(CreateCommissionRuleSchema)
349
+ });
350
+ const { mutateAsync, isPending } = useCreateCommissionRule();
351
+ const handleSubmit = form.handleSubmit(async (values) => {
352
+ const rules = buildRulesFromScope(values.scopeType, {
353
+ stores: values.stores,
354
+ productTypes: values.productTypes,
355
+ categories: values.categories
356
+ });
357
+ const isFixed = values.commissionType === "fixed";
358
+ await mutateAsync(
359
+ {
360
+ name: values.title,
361
+ code: values.code,
362
+ type: values.commissionType,
363
+ value: isFixed ? 0 : values.value,
364
+ ...isFixed ? { values: buildValuesPayload(currencies, values.fixed_values) } : {},
365
+ include_tax: values.include_tax,
366
+ include_shipping: values.include_shipping,
367
+ is_enabled: true,
368
+ ...rules.length > 0 ? { rules } : {}
369
+ },
370
+ {
371
+ onSuccess: ({ commission_rate }) => {
372
+ toast.success(
373
+ t("commissions.create.successToast", {
374
+ defaultValue: "Commission rule created"
375
+ })
376
+ );
377
+ handleSuccess(`/settings/commissions/${commission_rate.id}`);
378
+ },
379
+ onError: (e) => toast.error(e.message)
380
+ }
381
+ );
382
+ });
383
+ return /* @__PURE__ */ jsxs3(
384
+ TabbedForm,
385
+ {
386
+ form,
387
+ onSubmit: handleSubmit,
388
+ isLoading: isPending,
389
+ children: [
390
+ /* @__PURE__ */ jsx3(CreateCommissionRuleDetails, {}),
391
+ /* @__PURE__ */ jsx3(CreateCommissionRuleCommission, {})
392
+ ]
393
+ }
394
+ );
395
+ };
396
+
397
+ // src/pages/commissions/commission-rule-create/commission-rule-create.tsx
398
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
399
+ var Root = ({ children }) => {
400
+ const { t } = useTranslation4();
401
+ return /* @__PURE__ */ jsxs4(RouteFocusModal, { children: [
402
+ /* @__PURE__ */ jsx4(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx4("span", { className: "sr-only", children: t("commissions.create.header", "Create Commission Rule") }) }),
403
+ /* @__PURE__ */ jsx4(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx4("span", { className: "sr-only", children: t("commissions.create.header", "Create Commission Rule") }) }),
404
+ Children.count(children) > 0 ? children : /* @__PURE__ */ jsx4(CreateCommissionRuleForm, {})
405
+ ] });
406
+ };
407
+ var CommissionRuleCreate = Object.assign(Root, {
408
+ Form: CreateCommissionRuleForm
409
+ });
410
+ export {
411
+ CommissionRuleCreate as Component
412
+ };
@@ -0,0 +1,45 @@
1
+ import {
2
+ CommissionRuleDetail
3
+ } from "./chunk-JEJQKTZO.js";
4
+ import "./chunk-RXRDZ47F.js";
5
+ import "./chunk-PN5C4AND.js";
6
+ import "./chunk-FI474ADU.js";
7
+ import "./chunk-3XPXUIK3.js";
8
+ import "./chunk-E74OUNA3.js";
9
+ import "./chunk-H6MYB7GB.js";
10
+ import "./chunk-46M463BR.js";
11
+ import {
12
+ useCommissionRule
13
+ } from "./chunk-ZIFHQXP3.js";
14
+ import "./chunk-LEG67A2R.js";
15
+ import "./chunk-BDGZ4EQO.js";
16
+ import "./chunk-KYFWVLWO.js";
17
+ import "./chunk-LAVHRER2.js";
18
+ import "./chunk-Y7QKP6QU.js";
19
+ import "./chunk-M2E3PKA4.js";
20
+ import "./chunk-RHKRREUU.js";
21
+ import "./chunk-ZA2KFUFR.js";
22
+ import "./chunk-ZBWL72TB.js";
23
+ import "./chunk-NBMM2TZK.js";
24
+
25
+ // src/pages/commissions/commission-rule-detail/breadcrumb.tsx
26
+ import { jsx } from "react/jsx-runtime";
27
+ var CommissionRuleBreadcrumb = (props) => {
28
+ const { id } = props.params || {};
29
+ const { commission_rate } = useCommissionRule(
30
+ id,
31
+ void 0,
32
+ {
33
+ initialData: props.data,
34
+ enabled: Boolean(id)
35
+ }
36
+ );
37
+ if (!commission_rate) {
38
+ return null;
39
+ }
40
+ return /* @__PURE__ */ jsx("span", { children: commission_rate.name });
41
+ };
42
+ export {
43
+ CommissionRuleBreadcrumb as Breadcrumb,
44
+ CommissionRuleDetail as Component
45
+ };