@mercurjs/admin 2.0.0-canary.29 → 2.0.0-canary.30

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 (128) hide show
  1. package/dist/{add-campaign-promotions-TXOODRHB.js → add-campaign-promotions-UVEH25GZ.js} +3 -3
  2. package/dist/{adjust-inventory-6RA7MJEM.js → adjust-inventory-B7O6DYKO.js} +5 -4
  3. package/dist/{api-key-management-detail-24BNBQNS.js → api-key-management-detail-4LXV7JDA.js} +5 -4
  4. package/dist/{campaign-detail-FBUQQL2W.js → campaign-detail-5Z7GPFAK.js} +8 -7
  5. package/dist/{categories-metadata-7NJ5AUE7.js → categories-metadata-BZXXH7O2.js} +5 -4
  6. package/dist/{category-detail-IQ4PUZG7.js → category-detail-RUHIR23W.js} +9 -8
  7. package/dist/{category-products-FSVFQAE4.js → category-products-HCTOGNYC.js} +9 -8
  8. package/dist/{chunk-4XHMNG3H.js → chunk-5X5373EQ.js} +11 -20
  9. package/dist/{chunk-PASXA3UX.js → chunk-7J3HKFZC.js} +22 -1
  10. package/dist/chunk-A4X5VP3G.js +102 -0
  11. package/dist/{chunk-NKLW7RD6.js → chunk-DTDWXHUJ.js} +1 -1
  12. package/dist/{chunk-TO7KBKHJ.js → chunk-F5PEK3DA.js} +5 -2
  13. package/dist/{chunk-6KI3GDYH.js → chunk-FMOQNZFZ.js} +39 -3
  14. package/dist/{chunk-6NNBZIM7.js → chunk-GFZ7GOEU.js} +4 -1
  15. package/dist/{chunk-RILFAVKM.js → chunk-HOZHWCST.js} +1 -1
  16. package/dist/{chunk-QM2TMBP3.js → chunk-KCCJYRBN.js} +9 -19
  17. package/dist/{chunk-AAW22JWF.js → chunk-O5AT2SQW.js} +1 -1
  18. package/dist/chunk-SWL7ZCP3.js +11 -0
  19. package/dist/{chunk-ZGQV4I7U.js → chunk-SXC5ZMLI.js} +3 -3
  20. package/dist/{chunk-KW56S7WF.js → chunk-VVWB3GIK.js} +5 -2
  21. package/dist/chunk-VZEMURY7.js +35 -0
  22. package/dist/{chunk-SJKPESDA.js → chunk-XE6KSRKQ.js} +1 -1
  23. package/dist/{collection-add-products-4HTDHYXO.js → collection-add-products-RPYKLNNJ.js} +9 -8
  24. package/dist/{collection-detail-CWGP5ICA.js → collection-detail-GWMDEONO.js} +9 -8
  25. package/dist/{collection-list-6DZKMCB5.js → collection-list-7YAMMLFL.js} +17 -16
  26. package/dist/{collection-metadata-7BON4MGI.js → collection-metadata-H53GCXYR.js} +5 -4
  27. package/dist/commission-rate-create-MSQJGMDS.js +777 -0
  28. package/dist/commission-rate-detail-FR6JFGB4.js +440 -0
  29. package/dist/commission-rate-edit-KPZXPZE7.js +760 -0
  30. package/dist/commission-rate-list-FCQ3HXC7.js +196 -0
  31. package/dist/{customer-detail-46UYP6GW.js → customer-detail-M7QXH7SD.js} +10 -9
  32. package/dist/{customer-group-detail-3RD6DT7U.js → customer-group-detail-QULQ5ZIZ.js} +8 -7
  33. package/dist/{customer-group-list-TFM2WJ4X.js → customer-group-list-SGAMPEJD.js} +5 -4
  34. package/dist/{customer-group-metadata-P7QANREG.js → customer-group-metadata-J3FH457E.js} +5 -4
  35. package/dist/{customer-metadata-MBI3NDAU.js → customer-metadata-ZU6PXP7M.js} +5 -4
  36. package/dist/{customers-add-customer-group-IHI2A5OO.js → customers-add-customer-group-TGJ422S7.js} +8 -7
  37. package/dist/{edit-inventory-item-EULGCSM4.js → edit-inventory-item-6Q5W6WJ2.js} +5 -4
  38. package/dist/{edit-inventory-item-attributes-56QN6GHF.js → edit-inventory-item-attributes-MPZZJFDD.js} +5 -4
  39. package/dist/{edit-rules-3WAX7GEP.js → edit-rules-HKGBBMHG.js} +5 -4
  40. package/dist/index.js +206 -124
  41. package/dist/{inventory-create-WCI6KWDJ.js → inventory-create-R33QWQMU.js} +5 -4
  42. package/dist/{inventory-detail-WDI5KD2U.js → inventory-detail-GN5KKOGO.js} +5 -4
  43. package/dist/{inventory-metadata-S34DYKIW.js → inventory-metadata-DN6CK42E.js} +5 -4
  44. package/dist/{inventory-stock-ITSFGRAG.js → inventory-stock-BIV6VHGX.js} +5 -4
  45. package/dist/{location-detail-DIAY4ZPW.js → location-detail-BXACBEYM.js} +5 -4
  46. package/dist/{location-fulfillment-providers-EBFA6G7P.js → location-fulfillment-providers-TGTZNVTK.js} +7 -6
  47. package/dist/{location-list-ZWDA6NC3.js → location-list-M5DLUBHD.js} +5 -4
  48. package/dist/{location-service-zone-shipping-option-create-LNLXDZYF.js → location-service-zone-shipping-option-create-P44YZNQP.js} +5 -4
  49. package/dist/{login-FXV4BRJ2.js → login-EVOZGQN3.js} +5 -4
  50. package/dist/{marketplace-detail-GOA4HYOL.js → marketplace-detail-LMLLZFKR.js} +5 -4
  51. package/dist/{marketplace-metadata-GCD7VD34.js → marketplace-metadata-O24YYWMO.js} +5 -4
  52. package/dist/{order-create-claim-OT3YIYG7.js → order-create-claim-3H6Q6BOK.js} +5 -4
  53. package/dist/{order-create-edit-KF5V64D7.js → order-create-edit-2Q5WZDWV.js} +5 -4
  54. package/dist/{order-create-exchange-5PH2DDPB.js → order-create-exchange-EWAOCVAD.js} +5 -4
  55. package/dist/{order-create-fulfillment-MIJWDDL2.js → order-create-fulfillment-S4FLI7H4.js} +5 -4
  56. package/dist/{order-create-refund-56LLPYLA.js → order-create-refund-EZRAUHW5.js} +5 -4
  57. package/dist/{order-create-shipment-TCGKO67Z.js → order-create-shipment-P6W3MIUO.js} +5 -4
  58. package/dist/{order-detail-ZDPCS42E.js → order-detail-CSNUBXUB.js} +5 -4
  59. package/dist/{order-edit-billing-address-C7YX7626.js → order-edit-billing-address-7OTVEKSV.js} +6 -5
  60. package/dist/{order-edit-email-7NMGVKNJ.js → order-edit-email-YL7HUYWW.js} +5 -4
  61. package/dist/{order-edit-shipping-address-BSWGO3G3.js → order-edit-shipping-address-OD6Q2YJB.js} +5 -4
  62. package/dist/{order-list-Y3CNRMSU.js → order-list-MVWNUSCV.js} +35 -16
  63. package/dist/{order-metadata-XXEPKUFM.js → order-metadata-HIKCMASJ.js} +5 -4
  64. package/dist/{order-receive-return-JFIMIGGV.js → order-receive-return-FFS3UDIX.js} +5 -4
  65. package/dist/{order-request-transfer-TXC2FK4A.js → order-request-transfer-AJ7Y7O4M.js} +5 -4
  66. package/dist/{price-list-configuration-GK4MA3BE.js → price-list-configuration-LIE2Z77K.js} +2 -2
  67. package/dist/{price-list-create-L5KWHQIJ.js → price-list-create-CJDS5WL6.js} +11 -10
  68. package/dist/{price-list-detail-E3F63UB6.js → price-list-detail-EXSNCIVE.js} +9 -8
  69. package/dist/{price-list-prices-add-OHMQZH73.js → price-list-prices-add-CM6ZTB5H.js} +9 -8
  70. package/dist/{price-list-prices-edit-ORJ3VWX2.js → price-list-prices-edit-WJP5NDFZ.js} +5 -4
  71. package/dist/{product-create-FWHZORNL.js → product-create-JL6E6O4U.js} +38 -6
  72. package/dist/{product-create-variant-ZMSJOFSJ.js → product-create-variant-MPXN3APE.js} +5 -4
  73. package/dist/{product-detail-V24PBFTX.js → product-detail-5EKZ4LHH.js} +10 -5
  74. package/dist/{product-export-H5Z6JVW7.js → product-export-5ZUQERTW.js} +17 -16
  75. package/dist/{product-import-HYPRL63J.js → product-import-KKR33B54.js} +5 -4
  76. package/dist/{product-list-XWJ5JFO2.js → product-list-PO7KEKYD.js} +17 -8
  77. package/dist/{product-media-TGVTQNDO.js → product-media-Z2DCRZSU.js} +2 -2
  78. package/dist/{product-metadata-LP6ZZFCV.js → product-metadata-VJLPWS6G.js} +5 -4
  79. package/dist/{product-stock-S6XIQVMO.js → product-stock-WRLT45MY.js} +5 -4
  80. package/dist/{product-tag-create-WIROVJ3M.js → product-tag-create-OQ5GZSH2.js} +5 -4
  81. package/dist/{product-tag-detail-F27ML7MQ.js → product-tag-detail-SRNMX6IT.js} +18 -17
  82. package/dist/{product-tag-edit-7A2H7OW2.js → product-tag-edit-4NRAHR44.js} +5 -4
  83. package/dist/{product-tag-list-KMVTIS7O.js → product-tag-list-A73YMLOW.js} +18 -17
  84. package/dist/{product-tag-metadata-AZUT3RGE.js → product-tag-metadata-KGMZ2FM5.js} +5 -4
  85. package/dist/{product-type-detail-LHNEJ5V3.js → product-type-detail-VLW54AOG.js} +9 -8
  86. package/dist/{product-type-metadata-SB7Z6X6E.js → product-type-metadata-S4BQXNMD.js} +5 -4
  87. package/dist/{product-variant-detail-VA7DHMCF.js → product-variant-detail-5ZXWEHCR.js} +16 -5
  88. package/dist/{product-variant-edit-FCOJQ4E7.js → product-variant-edit-LI37UINW.js} +5 -4
  89. package/dist/{product-variant-metadata-TH6U2EQW.js → product-variant-metadata-QMG7QSRO.js} +5 -4
  90. package/dist/{promotion-create-7L5LWMEM.js → promotion-create-CBUVIGJJ.js} +5 -4
  91. package/dist/{promotion-detail-NGOQNJER.js → promotion-detail-T3XF7SQY.js} +7 -6
  92. package/dist/{promotion-list-CV35S2NN.js → promotion-list-SJYMXQXT.js} +3 -3
  93. package/dist/{refund-reason-create-V2VJFJQ2.js → refund-reason-create-3FFIHVIK.js} +5 -4
  94. package/dist/{refund-reason-edit-ZTSUQ7IF.js → refund-reason-edit-CUCFK6QT.js} +5 -4
  95. package/dist/{refund-reason-list-FYROEGE3.js → refund-reason-list-MWO4CGF3.js} +7 -6
  96. package/dist/{region-metadata-R4EIHSPF.js → region-metadata-L2ZFFSYU.js} +5 -4
  97. package/dist/{reservation-detail-MKH3WGNU.js → reservation-detail-PRFJ3DCG.js} +5 -4
  98. package/dist/{reservation-metadata-W3BBPRGI.js → reservation-metadata-4UKKCAQW.js} +5 -4
  99. package/dist/{reset-password-EEDB3CUC.js → reset-password-WNANNJDX.js} +1 -1
  100. package/dist/{return-reason-list-B32WYMI2.js → return-reason-list-NDRI73EJ.js} +2 -2
  101. package/dist/{sales-channel-add-products-LHMQAZUR.js → sales-channel-add-products-BMFVRAEH.js} +9 -8
  102. package/dist/{sales-channel-detail-MYCYNGWP.js → sales-channel-detail-3X2A3IU3.js} +9 -8
  103. package/dist/{sales-channel-list-UK62MLV6.js → sales-channel-list-TOHSZEWI.js} +5 -4
  104. package/dist/{sales-channel-metadata-YQG6HIJA.js → sales-channel-metadata-NNGECIDY.js} +5 -4
  105. package/dist/seller-address-edit-ZD3CYNHQ.js +223 -0
  106. package/dist/{seller-details-MSDVT5IO.js → seller-details-4TOSFX3P.js} +172 -231
  107. package/dist/{seller-edit-RUYGO7CB.js → seller-edit-DL7IFKVU.js} +5 -212
  108. package/dist/{seller-list-B45KDWT7.js → seller-list-IXZYLSWC.js} +42 -2
  109. package/dist/{shipping-option-type-create-MPIM2Y2U.js → shipping-option-type-create-V7NL6F5R.js} +5 -4
  110. package/dist/{shipping-option-type-detail-FTLW2VVA.js → shipping-option-type-detail-EFGMRTEM.js} +6 -5
  111. package/dist/{shipping-option-type-edit-AAKLLV23.js → shipping-option-type-edit-4AZ42T5Y.js} +5 -4
  112. package/dist/{shipping-option-type-list-UDGLHQWB.js → shipping-option-type-list-NK6K72MU.js} +6 -5
  113. package/dist/{shipping-profile-metadata-D74JJSCX.js → shipping-profile-metadata-KFVHD2O7.js} +5 -4
  114. package/dist/{tax-region-create-JNOTV4L4.js → tax-region-create-BZJTEBMQ.js} +6 -5
  115. package/dist/{tax-region-detail-EKF3UNHB.js → tax-region-detail-BXFEMVY5.js} +7 -6
  116. package/dist/{tax-region-edit-4RUDAWE6.js → tax-region-edit-44S4TJNT.js} +5 -4
  117. package/dist/{tax-region-metadata-7DE72RDE.js → tax-region-metadata-FHBJJJRJ.js} +5 -4
  118. package/dist/{tax-region-province-detail-ENOLU5SV.js → tax-region-province-detail-2F4YIIAJ.js} +7 -6
  119. package/dist/{tax-region-tax-override-create-EAUDM7RZ.js → tax-region-tax-override-create-IURFV4MN.js} +20 -17
  120. package/dist/{tax-region-tax-override-edit-H5I3E3AJ.js → tax-region-tax-override-edit-XIPVZQSN.js} +20 -17
  121. package/dist/{user-metadata-4EBEIV3V.js → user-metadata-JDY6236C.js} +5 -4
  122. package/package.json +1 -1
  123. package/dist/{chunk-QNGHZSK3.js → chunk-24CEDEWS.js} +3 -3
  124. package/dist/{chunk-O4E3MAKS.js → chunk-BGDOVLJF.js} +3 -3
  125. package/dist/{customer-group-add-customers-FTRCJHE7.js → customer-group-add-customers-KG6P27YA.js} +3 -3
  126. package/dist/{customer-list-DYQHKNJV.js → customer-list-RK3BEFV7.js} +3 -3
  127. package/dist/{product-type-list-T5KO5J3W.js → product-type-list-BYHYR2PL.js} +3 -3
  128. package/dist/{region-list-PGWUOULN.js → region-list-IBVQAMBQ.js} +3 -3
@@ -0,0 +1,760 @@
1
+ import {
2
+ TargetForm,
3
+ TargetItem,
4
+ TaxRateRuleReferenceSchema
5
+ } from "./chunk-5X5373EQ.js";
6
+ import "./chunk-LTBX54CI.js";
7
+ import {
8
+ PercentageInput
9
+ } from "./chunk-MAEP2UCK.js";
10
+ import "./chunk-HC25LNX7.js";
11
+ import "./chunk-5A4JNOK3.js";
12
+ import "./chunk-O5VKW5FL.js";
13
+ import "./chunk-2PZGY332.js";
14
+ import "./chunk-AFQS6E4N.js";
15
+ import "./chunk-QG6PLWNH.js";
16
+ import "./chunk-BRUOBAPY.js";
17
+ import "./chunk-4F5GP7J7.js";
18
+ import "./chunk-54EPH67T.js";
19
+ import "./chunk-JQV7CXEC.js";
20
+ import "./chunk-HINXQTCW.js";
21
+ import "./chunk-25LYVP3C.js";
22
+ import "./chunk-LQSLDDPT.js";
23
+ import "./chunk-VW56KWO2.js";
24
+ import "./chunk-2Y3WMGN6.js";
25
+ import "./chunk-JHIMVLB2.js";
26
+ import "./chunk-PXYDR7WQ.js";
27
+ import "./chunk-3CKTAFTR.js";
28
+ import "./chunk-G5OVX555.js";
29
+ import "./chunk-FWPGOIFA.js";
30
+ import "./chunk-DB6ANJBO.js";
31
+ import "./chunk-FQERBIVS.js";
32
+ import "./chunk-PHOCVOZ5.js";
33
+ import "./chunk-FLCYR7E5.js";
34
+ import "./chunk-YBZWO4ZV.js";
35
+ import "./chunk-KAZ5BYTQ.js";
36
+ import "./chunk-3EF54XFY.js";
37
+ import "./chunk-WIYFXWRI.js";
38
+ import {
39
+ currencies,
40
+ getCurrencySymbol
41
+ } from "./chunk-IQPN4PZJ.js";
42
+ import "./chunk-TKGWSUEI.js";
43
+ import {
44
+ KeyboundForm
45
+ } from "./chunk-U2ZFCAPX.js";
46
+ import "./chunk-SXC5ZMLI.js";
47
+ import "./chunk-MG4GKUJW.js";
48
+ import "./chunk-AYVH6Q5O.js";
49
+ import "./chunk-VOHEQ7B5.js";
50
+ import "./chunk-FMOQNZFZ.js";
51
+ import "./chunk-2ZFELO2L.js";
52
+ import "./chunk-26OOAKQ6.js";
53
+ import "./chunk-N5IUYCUZ.js";
54
+ import "./chunk-7SVLKK6Q.js";
55
+ import "./chunk-ZQZHFMD7.js";
56
+ import "./chunk-GR6JUIRU.js";
57
+ import "./chunk-PVZBDWLK.js";
58
+ import "./chunk-K3GJ266Z.js";
59
+ import "./chunk-O5HZRJPB.js";
60
+ import "./chunk-GEVYE225.js";
61
+ import "./chunk-VKOE5J66.js";
62
+ import "./chunk-CMHI2RPL.js";
63
+ import "./chunk-DY3XQPHC.js";
64
+ import "./chunk-S2WEYEQR.js";
65
+ import "./chunk-VVWB3GIK.js";
66
+ import "./chunk-7J3HKFZC.js";
67
+ import "./chunk-KBYZLKI4.js";
68
+ import "./chunk-YWWUOGJA.js";
69
+ import {
70
+ RouteDrawer,
71
+ StackedDrawer,
72
+ useRouteModal,
73
+ useStackedModal
74
+ } from "./chunk-MWOKFNRO.js";
75
+ import {
76
+ Form
77
+ } from "./chunk-3QSRE5LS.js";
78
+ import "./chunk-JRTZWK77.js";
79
+ import "./chunk-INNFZYX2.js";
80
+ import "./chunk-LAVHRER2.js";
81
+ import {
82
+ useDocumentDirection
83
+ } from "./chunk-Y7QKP6QU.js";
84
+ import "./chunk-THHRRYRS.js";
85
+ import "./chunk-UZWFZMOX.js";
86
+ import "./chunk-XQNVC4Q7.js";
87
+ import "./chunk-KCCJYRBN.js";
88
+ import "./chunk-ODBDAABQ.js";
89
+ import "./chunk-CDQJKJMX.js";
90
+ import "./chunk-JLATVDLM.js";
91
+ import "./chunk-GPRBBA7S.js";
92
+ import "./chunk-E7ZBQO6E.js";
93
+ import "./chunk-XGHM75N2.js";
94
+ import "./chunk-U2GCSKW3.js";
95
+ import "./chunk-RTAIDSDS.js";
96
+ import "./chunk-LW3UWYZU.js";
97
+ import {
98
+ useBatchCommissionRules,
99
+ useCommissionRate,
100
+ useUpdateCommissionRate
101
+ } from "./chunk-A4X5VP3G.js";
102
+ import "./chunk-NNZP4PYP.js";
103
+ import "./chunk-GF4QHVX3.js";
104
+ import "./chunk-JOQ3RTF5.js";
105
+ import "./chunk-V534K7G4.js";
106
+ import "./chunk-A5XOYSDC.js";
107
+ import "./chunk-TQI3DOQ5.js";
108
+ import "./chunk-5PB7KCTF.js";
109
+ import "./chunk-YOIARITB.js";
110
+ import "./chunk-W7G64ULL.js";
111
+ import "./chunk-6C7TCU42.js";
112
+ import "./chunk-4YF3GAKE.js";
113
+ import "./chunk-LORVU5II.js";
114
+ import "./chunk-36ORDF7W.js";
115
+ import "./chunk-QSM56ZOP.js";
116
+ import {
117
+ useStore
118
+ } from "./chunk-MIHEJ6Y6.js";
119
+ import "./chunk-3VZV6SJQ.js";
120
+ import "./chunk-K357FGGP.js";
121
+ import "./chunk-RHKRREUU.js";
122
+ import "./chunk-ZA2KFUFR.js";
123
+ import "./chunk-ZYNBKBY3.js";
124
+ import "./chunk-NBMM2TZK.js";
125
+
126
+ // src/pages/commission-rates/commission-rate-edit/commission-rate-edit.tsx
127
+ import { Heading as Heading2 } from "@medusajs/ui";
128
+ import { useParams } from "react-router-dom";
129
+
130
+ // src/pages/commission-rates/commission-rate-edit/components/edit-commission-rate-form/edit-commission-rate-form.tsx
131
+ import { zodResolver } from "@hookform/resolvers/zod";
132
+ import { MagnifyingGlass } from "@medusajs/icons";
133
+ import {
134
+ Button,
135
+ clx,
136
+ CurrencyInput,
137
+ Divider,
138
+ Heading,
139
+ Hint,
140
+ Input,
141
+ Label,
142
+ Select,
143
+ Switch,
144
+ Text,
145
+ toast
146
+ } from "@medusajs/ui";
147
+ import { useFieldArray, useForm, useWatch } from "react-hook-form";
148
+ import { useTranslation } from "react-i18next";
149
+ import * as zod from "zod";
150
+ import { jsx, jsxs } from "react/jsx-runtime";
151
+ var STACKED_MODAL_ID = "cr";
152
+ var getStackedModalId = (type) => `${STACKED_MODAL_ID}-${type}`;
153
+ var EditCommissionRateSchema = zod.object({
154
+ name: zod.string().min(1),
155
+ code: zod.string().min(1),
156
+ type: zod.enum(["fixed", "percentage"]),
157
+ target: zod.enum(["item", "shipping"]),
158
+ value: zod.coerce.number().min(0),
159
+ currency_code: zod.string().optional(),
160
+ min_amount: zod.coerce.number().optional(),
161
+ include_tax: zod.boolean(),
162
+ priority: zod.coerce.number().int().min(0),
163
+ enabled_rules: zod.object({
164
+ product: zod.boolean(),
165
+ product_type: zod.boolean(),
166
+ shipping_option: zod.boolean()
167
+ }),
168
+ product: zod.array(TaxRateRuleReferenceSchema).optional(),
169
+ product_type: zod.array(TaxRateRuleReferenceSchema).optional(),
170
+ shipping_option: zod.array(TaxRateRuleReferenceSchema).optional()
171
+ });
172
+ var getRulesByType = (rules, type) => {
173
+ return (rules || []).filter((r) => r.reference === type).map((r) => ({ value: r.reference_id, label: "" }));
174
+ };
175
+ var EditCommissionRateForm = ({
176
+ commissionRate
177
+ }) => {
178
+ const { t } = useTranslation();
179
+ const { handleSuccess } = useRouteModal();
180
+ const { setIsOpen } = useStackedModal();
181
+ const direction = useDocumentDirection();
182
+ const initialProducts = getRulesByType(
183
+ commissionRate.rules,
184
+ "product" /* PRODUCT */
185
+ );
186
+ const initialProductTypes = getRulesByType(
187
+ commissionRate.rules,
188
+ "product_type" /* PRODUCT_TYPE */
189
+ );
190
+ const initialShippingOptions = getRulesByType(
191
+ commissionRate.rules,
192
+ "shipping_option" /* SHIPPING_OPTION */
193
+ );
194
+ const form = useForm({
195
+ defaultValues: {
196
+ name: commissionRate.name,
197
+ code: commissionRate.code,
198
+ type: commissionRate.type,
199
+ target: commissionRate.target,
200
+ value: commissionRate.value,
201
+ currency_code: commissionRate.currency_code ?? "",
202
+ min_amount: commissionRate.min_amount ?? void 0,
203
+ include_tax: commissionRate.include_tax,
204
+ priority: commissionRate.priority,
205
+ enabled_rules: {
206
+ product: initialProducts.length > 0,
207
+ product_type: initialProductTypes.length > 0,
208
+ shipping_option: initialShippingOptions.length > 0
209
+ },
210
+ product: initialProducts,
211
+ product_type: initialProductTypes,
212
+ shipping_option: initialShippingOptions
213
+ },
214
+ resolver: zodResolver(EditCommissionRateSchema)
215
+ });
216
+ const { store } = useStore();
217
+ const storeCurrencies = (store?.supported_currencies ?? []).map(
218
+ (c) => currencies[c.currency_code.toUpperCase()]
219
+ );
220
+ const { mutateAsync: updateCommissionRate, isPending: isUpdating } = useUpdateCommissionRate(commissionRate.id);
221
+ const { mutateAsync: batchRules, isPending: isBatching } = useBatchCommissionRules(commissionRate.id);
222
+ const handleSubmit = form.handleSubmit(async (values) => {
223
+ const newRules = [
224
+ ...(values.product || []).map((ref) => ({
225
+ reference: "product" /* PRODUCT */,
226
+ reference_id: ref.value
227
+ })),
228
+ ...(values.product_type || []).map((ref) => ({
229
+ reference: "product_type" /* PRODUCT_TYPE */,
230
+ reference_id: ref.value
231
+ })),
232
+ ...(values.shipping_option || []).map((ref) => ({
233
+ reference: "shipping_option" /* SHIPPING_OPTION */,
234
+ reference_id: ref.value
235
+ }))
236
+ ];
237
+ const existingRules = commissionRate.rules || [];
238
+ const toCreate = newRules.filter(
239
+ (nr) => !existingRules.some(
240
+ (er) => er.reference === nr.reference && er.reference_id === nr.reference_id
241
+ )
242
+ );
243
+ const toDelete = existingRules.filter(
244
+ (er) => !newRules.some(
245
+ (nr) => nr.reference === er.reference && nr.reference_id === er.reference_id
246
+ )
247
+ ).map((er) => er.id);
248
+ try {
249
+ await updateCommissionRate({
250
+ name: values.name,
251
+ code: values.code,
252
+ type: values.type,
253
+ target: values.target,
254
+ value: values.value,
255
+ currency_code: values.currency_code || null,
256
+ min_amount: values.min_amount ?? null,
257
+ include_tax: values.include_tax,
258
+ priority: values.priority
259
+ });
260
+ if (toCreate.length > 0 || toDelete.length > 0) {
261
+ await batchRules({
262
+ ...toCreate.length > 0 ? { create: toCreate } : {},
263
+ ...toDelete.length > 0 ? { delete: toDelete } : {}
264
+ });
265
+ }
266
+ toast.success("Commission rate updated successfully");
267
+ handleSuccess();
268
+ } catch (e) {
269
+ toast.error(e.message);
270
+ }
271
+ });
272
+ const watchType = form.watch("type");
273
+ const watchCurrency = form.watch("currency_code");
274
+ const products = useFieldArray({
275
+ control: form.control,
276
+ name: "product" /* PRODUCT */
277
+ });
278
+ const productTypes = useFieldArray({
279
+ control: form.control,
280
+ name: "product_type" /* PRODUCT_TYPE */
281
+ });
282
+ const shippingOptions = useFieldArray({
283
+ control: form.control,
284
+ name: "shipping_option" /* SHIPPING_OPTION */
285
+ });
286
+ const getControls = (type) => {
287
+ switch (type) {
288
+ case "product" /* PRODUCT */:
289
+ return products;
290
+ case "product_type" /* PRODUCT_TYPE */:
291
+ return productTypes;
292
+ case "shipping_option" /* SHIPPING_OPTION */:
293
+ return shippingOptions;
294
+ }
295
+ };
296
+ const referenceTypeOptions = [
297
+ {
298
+ value: "product" /* PRODUCT */,
299
+ label: t("taxRegions.fields.targets.options.product")
300
+ },
301
+ {
302
+ value: "product_type" /* PRODUCT_TYPE */,
303
+ label: t("taxRegions.fields.targets.options.productType")
304
+ },
305
+ {
306
+ value: "shipping_option" /* SHIPPING_OPTION */,
307
+ label: t("taxRegions.fields.targets.options.shippingOption")
308
+ }
309
+ ];
310
+ const searchPlaceholders = {
311
+ ["product" /* PRODUCT */]: t(
312
+ "taxRegions.fields.targets.placeholders.product"
313
+ ),
314
+ ["product_type" /* PRODUCT_TYPE */]: t(
315
+ "taxRegions.fields.targets.placeholders.productType"
316
+ ),
317
+ ["shipping_option" /* SHIPPING_OPTION */]: t(
318
+ "taxRegions.fields.targets.placeholders.shippingOption"
319
+ )
320
+ };
321
+ const getFieldHandler = (type) => {
322
+ const { fields, remove, prepend } = getControls(type);
323
+ const modalId = getStackedModalId(type);
324
+ return (references) => {
325
+ if (!references.length) {
326
+ form.setValue(type, [], { shouldDirty: true });
327
+ setIsOpen(modalId, false);
328
+ return;
329
+ }
330
+ const newIds = references.map((reference) => reference.value);
331
+ const fieldsToAdd = references.filter(
332
+ (reference) => !fields.some((field) => field.value === reference.value)
333
+ );
334
+ for (const field of fields) {
335
+ if (!newIds.includes(field.value)) {
336
+ remove(fields.indexOf(field));
337
+ }
338
+ }
339
+ prepend(fieldsToAdd);
340
+ setIsOpen(modalId, false);
341
+ };
342
+ };
343
+ const displayOrder = new Set(
344
+ [
345
+ initialProducts.length > 0 ? "product" /* PRODUCT */ : null,
346
+ initialProductTypes.length > 0 ? "product_type" /* PRODUCT_TYPE */ : null,
347
+ initialShippingOptions.length > 0 ? "shipping_option" /* SHIPPING_OPTION */ : null
348
+ ].filter(Boolean)
349
+ );
350
+ const disableRule = (type) => {
351
+ form.setValue(type, [], { shouldDirty: true });
352
+ form.setValue(`enabled_rules.${type}`, false, { shouldDirty: true });
353
+ displayOrder.delete(type);
354
+ };
355
+ const enableRule = (type) => {
356
+ form.setValue(`enabled_rules.${type}`, true, { shouldDirty: true });
357
+ form.setValue(type, [], { shouldDirty: true });
358
+ displayOrder.add(type);
359
+ };
360
+ const watchedEnabledRules = useWatch({
361
+ control: form.control,
362
+ name: "enabled_rules"
363
+ });
364
+ const addRule = () => {
365
+ const firstDisabledRule = Object.keys(watchedEnabledRules).find(
366
+ (key) => !watchedEnabledRules[key]
367
+ );
368
+ if (firstDisabledRule) {
369
+ enableRule(firstDisabledRule);
370
+ }
371
+ };
372
+ const visibleRuleTypes = referenceTypeOptions.filter((option) => watchedEnabledRules[option.value]).sort((a, b) => {
373
+ const orderArray = Array.from(displayOrder);
374
+ return orderArray.indexOf(a.value) - orderArray.indexOf(b.value);
375
+ });
376
+ const getAvailableRuleTypes = (type) => {
377
+ return referenceTypeOptions.filter((option) => {
378
+ return !visibleRuleTypes.some(
379
+ (visibleOption) => visibleOption.value === option.value
380
+ ) || option.value === type;
381
+ });
382
+ };
383
+ const showAddButton = Object.values(watchedEnabledRules).some(
384
+ (value) => !value
385
+ );
386
+ const isPending = isUpdating || isBatching;
387
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
388
+ KeyboundForm,
389
+ {
390
+ className: "flex flex-1 flex-col overflow-hidden",
391
+ onSubmit: handleSubmit,
392
+ children: [
393
+ /* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-6 overflow-auto", children: [
394
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4", children: [
395
+ /* @__PURE__ */ jsx(
396
+ Form.Field,
397
+ {
398
+ control: form.control,
399
+ name: "name",
400
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
401
+ /* @__PURE__ */ jsx(Form.Label, { children: "Name" }),
402
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
403
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
404
+ ] })
405
+ }
406
+ ),
407
+ /* @__PURE__ */ jsx(
408
+ Form.Field,
409
+ {
410
+ control: form.control,
411
+ name: "code",
412
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
413
+ /* @__PURE__ */ jsx(Form.Label, { children: "Code" }),
414
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
415
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
416
+ ] })
417
+ }
418
+ ),
419
+ /* @__PURE__ */ jsx(
420
+ Form.Field,
421
+ {
422
+ control: form.control,
423
+ name: "type",
424
+ render: ({ field: { onChange, ref, ...field } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
425
+ /* @__PURE__ */ jsx(Form.Label, { children: "Type" }),
426
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(Select, { ...field, onValueChange: onChange, children: [
427
+ /* @__PURE__ */ jsx(Select.Trigger, { ref, children: /* @__PURE__ */ jsx(Select.Value, {}) }),
428
+ /* @__PURE__ */ jsxs(Select.Content, { children: [
429
+ /* @__PURE__ */ jsx(Select.Item, { value: "percentage", children: "Percentage" }),
430
+ /* @__PURE__ */ jsx(Select.Item, { value: "fixed", children: "Fixed" })
431
+ ] })
432
+ ] }) }),
433
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
434
+ ] })
435
+ }
436
+ ),
437
+ /* @__PURE__ */ jsx(
438
+ Form.Field,
439
+ {
440
+ control: form.control,
441
+ name: "target",
442
+ render: ({ field: { onChange, ref, ...field } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
443
+ /* @__PURE__ */ jsx(Form.Label, { children: "Target" }),
444
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(Select, { ...field, onValueChange: onChange, children: [
445
+ /* @__PURE__ */ jsx(Select.Trigger, { ref, children: /* @__PURE__ */ jsx(Select.Value, {}) }),
446
+ /* @__PURE__ */ jsxs(Select.Content, { children: [
447
+ /* @__PURE__ */ jsx(Select.Item, { value: "item", children: "Item" }),
448
+ /* @__PURE__ */ jsx(Select.Item, { value: "shipping", children: "Shipping" })
449
+ ] })
450
+ ] }) }),
451
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
452
+ ] })
453
+ }
454
+ ),
455
+ /* @__PURE__ */ jsx(
456
+ Form.Field,
457
+ {
458
+ control: form.control,
459
+ name: "currency_code",
460
+ render: ({ field: { onChange, ref, ...field } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
461
+ /* @__PURE__ */ jsx(Form.Label, { children: "Currency Code" }),
462
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(Select, { ...field, onValueChange: onChange, children: [
463
+ /* @__PURE__ */ jsx(Select.Trigger, { ref, children: /* @__PURE__ */ jsx(Select.Value, { placeholder: "Select currency" }) }),
464
+ /* @__PURE__ */ jsx(Select.Content, { children: storeCurrencies.map((currency) => /* @__PURE__ */ jsx(
465
+ Select.Item,
466
+ {
467
+ value: currency.code.toLowerCase(),
468
+ children: currency.name
469
+ },
470
+ currency.code
471
+ )) })
472
+ ] }) }),
473
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
474
+ ] })
475
+ }
476
+ ),
477
+ /* @__PURE__ */ jsx(
478
+ Form.Field,
479
+ {
480
+ control: form.control,
481
+ name: "value",
482
+ render: ({ field: { value, onChange, ...field } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
483
+ /* @__PURE__ */ jsx(Form.Label, { children: "Rate" }),
484
+ /* @__PURE__ */ jsx(Form.Control, { children: watchType === "percentage" ? /* @__PURE__ */ jsx(
485
+ PercentageInput,
486
+ {
487
+ ...field,
488
+ value,
489
+ decimalsLimit: 4,
490
+ onValueChange: (_value, _name, values) => onChange(values?.float ?? 0)
491
+ }
492
+ ) : /* @__PURE__ */ jsx(
493
+ CurrencyInput,
494
+ {
495
+ min: 0,
496
+ onValueChange: (value2) => onChange(value2 ? parseInt(value2) : ""),
497
+ code: watchCurrency ?? "",
498
+ symbol: watchCurrency ? getCurrencySymbol(watchCurrency) : "",
499
+ ...field,
500
+ value
501
+ }
502
+ ) }),
503
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
504
+ ] })
505
+ }
506
+ ),
507
+ /* @__PURE__ */ jsx(
508
+ Form.Field,
509
+ {
510
+ control: form.control,
511
+ name: "min_amount",
512
+ render: ({ field: { value, onChange, ...field } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
513
+ /* @__PURE__ */ jsx(Form.Label, { children: "Minimum Amount" }),
514
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
515
+ CurrencyInput,
516
+ {
517
+ min: 0,
518
+ onValueChange: (value2) => onChange(value2 ? parseInt(value2) : ""),
519
+ code: watchCurrency ?? "",
520
+ symbol: watchCurrency ? getCurrencySymbol(watchCurrency) : "",
521
+ ...field,
522
+ value
523
+ }
524
+ ) }),
525
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
526
+ ] })
527
+ }
528
+ ),
529
+ /* @__PURE__ */ jsx(
530
+ Form.Field,
531
+ {
532
+ control: form.control,
533
+ name: "priority",
534
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
535
+ /* @__PURE__ */ jsx(Form.Label, { children: "Priority" }),
536
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(Input, { type: "number", ...field }) }),
537
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
538
+ ] })
539
+ }
540
+ ),
541
+ /* @__PURE__ */ jsx(
542
+ Form.Field,
543
+ {
544
+ control: form.control,
545
+ name: "include_tax",
546
+ render: ({ field: { value, onChange, ...field } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
547
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between", children: [
548
+ /* @__PURE__ */ jsx(Form.Label, { children: "Include Tax" }),
549
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
550
+ Switch,
551
+ {
552
+ ...field,
553
+ checked: value,
554
+ onCheckedChange: onChange
555
+ }
556
+ ) })
557
+ ] }),
558
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
559
+ ] })
560
+ }
561
+ )
562
+ ] }),
563
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-3", children: [
564
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-x-4", children: [
565
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
566
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-1", children: [
567
+ /* @__PURE__ */ jsx(Label, { id: "commission_rules_label", htmlFor: "commission_rules", children: t("taxRegions.fields.targets.label") }),
568
+ /* @__PURE__ */ jsxs(
569
+ Text,
570
+ {
571
+ size: "small",
572
+ leading: "compact",
573
+ className: "text-ui-fg-muted",
574
+ children: [
575
+ "(",
576
+ t("fields.optional"),
577
+ ")"
578
+ ]
579
+ }
580
+ )
581
+ ] }),
582
+ /* @__PURE__ */ jsx(Hint, { id: "commission_rules_description", className: "text-pretty", children: t("taxRegions.fields.targets.hint") })
583
+ ] }),
584
+ showAddButton && /* @__PURE__ */ jsx(
585
+ Button,
586
+ {
587
+ onClick: addRule,
588
+ type: "button",
589
+ size: "small",
590
+ variant: "transparent",
591
+ className: "text-ui-fg-interactive hover:text-ui-fg-interactive-hover flex-shrink-0",
592
+ children: t("taxRegions.fields.targets.action")
593
+ }
594
+ )
595
+ ] }),
596
+ /* @__PURE__ */ jsx(
597
+ "div",
598
+ {
599
+ id: "commission_rules",
600
+ "aria-labelledby": "commission_rules_label",
601
+ "aria-describedby": "commission_rules_description",
602
+ role: "application",
603
+ className: "flex flex-col gap-y-3",
604
+ children: visibleRuleTypes.map((ruleType, index) => {
605
+ const type = ruleType.value;
606
+ const label = ruleType.label;
607
+ const isLast = index === visibleRuleTypes.length - 1;
608
+ const searchPlaceholder = searchPlaceholders[type];
609
+ const options = getAvailableRuleTypes(type);
610
+ const modalId = getStackedModalId(type);
611
+ const { fields, remove } = getControls(type);
612
+ const handler = getFieldHandler(type);
613
+ const handleChangeType = (value) => {
614
+ disableRule(type);
615
+ enableRule(value);
616
+ };
617
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
618
+ Form.Field,
619
+ {
620
+ control: form.control,
621
+ name: ruleType.value,
622
+ render: ({
623
+ field: { value: _value, onChange: _onChange, ...field }
624
+ }) => {
625
+ return /* @__PURE__ */ jsxs(Form.Item, { className: "space-y-0", children: [
626
+ /* @__PURE__ */ jsx(Form.Label, { className: "sr-only", children: label }),
627
+ /* @__PURE__ */ jsxs(
628
+ "div",
629
+ {
630
+ className: clx(
631
+ "bg-ui-bg-component shadow-elevation-card-rest transition-fg grid gap-1.5 rounded-xl py-1.5",
632
+ "aria-[invalid='true']:shadow-borders-error"
633
+ ),
634
+ role: "application",
635
+ ...field,
636
+ children: [
637
+ /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle grid gap-1.5 px-1.5 md:grid-cols-2", children: [
638
+ isLast ? /* @__PURE__ */ jsxs(
639
+ Select,
640
+ {
641
+ dir: direction,
642
+ value: type,
643
+ onValueChange: handleChangeType,
644
+ children: [
645
+ /* @__PURE__ */ jsx(Select.Trigger, { className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover", children: /* @__PURE__ */ jsx(Select.Value, {}) }),
646
+ /* @__PURE__ */ jsx(Select.Content, { children: options.map((option) => {
647
+ return /* @__PURE__ */ jsx(
648
+ Select.Item,
649
+ {
650
+ value: option.value,
651
+ children: option.label
652
+ },
653
+ option.value
654
+ );
655
+ }) })
656
+ ]
657
+ }
658
+ ) : /* @__PURE__ */ jsx("div", { className: "bg-ui-bg-field shadow-borders-base txt-compact-small rounded-md px-2 py-1.5", children: label }),
659
+ /* @__PURE__ */ jsx("div", { className: "bg-ui-bg-field shadow-borders-base txt-compact-small rounded-md px-2 py-1.5", children: t("taxRegions.fields.targets.operators.in") })
660
+ ] }),
661
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 px-1.5", children: [
662
+ /* @__PURE__ */ jsxs(StackedDrawer, { id: modalId, children: [
663
+ /* @__PURE__ */ jsx(StackedDrawer.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(
664
+ "button",
665
+ {
666
+ type: "button",
667
+ className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover shadow-borders-base txt-compact-small text-ui-fg-muted transition-fg focus-visible:shadow-borders-interactive-with-active flex flex-1 items-center gap-x-2 rounded-md px-2 py-1.5 outline-none",
668
+ children: [
669
+ /* @__PURE__ */ jsx(MagnifyingGlass, {}),
670
+ searchPlaceholder
671
+ ]
672
+ }
673
+ ) }),
674
+ /* @__PURE__ */ jsx(StackedDrawer.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "secondary", children: t("actions.browse") }) }),
675
+ /* @__PURE__ */ jsxs(StackedDrawer.Content, { children: [
676
+ /* @__PURE__ */ jsxs(StackedDrawer.Header, { children: [
677
+ /* @__PURE__ */ jsx(StackedDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: t(
678
+ "taxRegions.fields.targets.modal.header"
679
+ ) }) }),
680
+ /* @__PURE__ */ jsx(StackedDrawer.Description, { className: "sr-only", children: t("taxRegions.fields.targets.hint") })
681
+ ] }),
682
+ /* @__PURE__ */ jsx(
683
+ TargetForm,
684
+ {
685
+ type: "drawer",
686
+ referenceType: type,
687
+ state: fields,
688
+ setState: handler
689
+ }
690
+ )
691
+ ] })
692
+ ] }),
693
+ /* @__PURE__ */ jsx(
694
+ Button,
695
+ {
696
+ variant: "secondary",
697
+ onClick: () => disableRule(type),
698
+ type: "button",
699
+ children: t("actions.delete")
700
+ }
701
+ )
702
+ ] }),
703
+ fields.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-1.5", children: [
704
+ /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
705
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1.5 px-1.5", children: fields.map((field2, index2) => {
706
+ return /* @__PURE__ */ jsx(
707
+ TargetItem,
708
+ {
709
+ index: index2,
710
+ label: field2.label,
711
+ value: field2.value,
712
+ onRemove: remove
713
+ },
714
+ field2.id
715
+ );
716
+ }) })
717
+ ] }) : null
718
+ ]
719
+ }
720
+ ),
721
+ /* @__PURE__ */ jsx(Form.ErrorMessage, { className: "mt-2" })
722
+ ] });
723
+ }
724
+ }
725
+ ) }, type);
726
+ })
727
+ }
728
+ )
729
+ ] })
730
+ ] }),
731
+ /* @__PURE__ */ jsxs(RouteDrawer.Footer, { children: [
732
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: t("actions.cancel") }) }),
733
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: t("actions.save") })
734
+ ] })
735
+ ]
736
+ }
737
+ ) });
738
+ };
739
+
740
+ // src/pages/commission-rates/commission-rate-edit/commission-rate-edit.tsx
741
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
742
+ var CommissionRateEdit = () => {
743
+ const { id } = useParams();
744
+ const {
745
+ commission_rate,
746
+ isPending: isLoading,
747
+ isError,
748
+ error
749
+ } = useCommissionRate(id, { fields: "*rules" });
750
+ if (isError) {
751
+ throw error;
752
+ }
753
+ return /* @__PURE__ */ jsxs2(RouteDrawer, { children: [
754
+ /* @__PURE__ */ jsx2(RouteDrawer.Header, { children: /* @__PURE__ */ jsx2(Heading2, { children: "Edit Commission Rate" }) }),
755
+ !isLoading && commission_rate && /* @__PURE__ */ jsx2(EditCommissionRateForm, { commissionRate: commission_rate })
756
+ ] });
757
+ };
758
+ export {
759
+ CommissionRateEdit as Component
760
+ };