@mercurjs/admin 2.0.0-canary.27 → 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,777 @@
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
+ RouteFocusModal,
71
+ StackedFocusModal,
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
+ useCreateCommissionRate
99
+ } from "./chunk-A4X5VP3G.js";
100
+ import "./chunk-NNZP4PYP.js";
101
+ import "./chunk-GF4QHVX3.js";
102
+ import "./chunk-JOQ3RTF5.js";
103
+ import "./chunk-V534K7G4.js";
104
+ import "./chunk-A5XOYSDC.js";
105
+ import "./chunk-TQI3DOQ5.js";
106
+ import "./chunk-5PB7KCTF.js";
107
+ import "./chunk-YOIARITB.js";
108
+ import "./chunk-W7G64ULL.js";
109
+ import "./chunk-6C7TCU42.js";
110
+ import "./chunk-4YF3GAKE.js";
111
+ import "./chunk-LORVU5II.js";
112
+ import "./chunk-36ORDF7W.js";
113
+ import "./chunk-QSM56ZOP.js";
114
+ import {
115
+ useStore
116
+ } from "./chunk-MIHEJ6Y6.js";
117
+ import "./chunk-3VZV6SJQ.js";
118
+ import "./chunk-K357FGGP.js";
119
+ import "./chunk-RHKRREUU.js";
120
+ import "./chunk-ZA2KFUFR.js";
121
+ import "./chunk-ZYNBKBY3.js";
122
+ import "./chunk-NBMM2TZK.js";
123
+
124
+ // src/pages/commission-rates/commission-rate-create/components/create-commission-rate-form/create-commission-rate-form.tsx
125
+ import { zodResolver } from "@hookform/resolvers/zod";
126
+ import {
127
+ Button,
128
+ CurrencyInput,
129
+ Divider,
130
+ Heading,
131
+ Hint,
132
+ Input,
133
+ Label,
134
+ Select,
135
+ Text,
136
+ clx,
137
+ toast,
138
+ Switch
139
+ } from "@medusajs/ui";
140
+ import { MagnifyingGlass } from "@medusajs/icons";
141
+ import { useEffect } from "react";
142
+ import { useFieldArray, useForm, useWatch } from "react-hook-form";
143
+ import { useTranslation } from "react-i18next";
144
+ import * as zod from "zod";
145
+ import { jsx, jsxs } from "react/jsx-runtime";
146
+ var STACKED_MODAL_ID = "cr";
147
+ var getStackedModalId = (type) => `${STACKED_MODAL_ID}-${type}`;
148
+ var CreateCommissionRateSchema = zod.object({
149
+ name: zod.string().min(1),
150
+ code: zod.string().min(1),
151
+ type: zod.enum(["fixed", "percentage"]),
152
+ target: zod.enum(["item", "shipping"]),
153
+ value: zod.coerce.number().min(0),
154
+ currency_code: zod.string().optional(),
155
+ min_amount: zod.coerce.number().optional(),
156
+ include_tax: zod.boolean(),
157
+ is_enabled: zod.boolean(),
158
+ priority: zod.coerce.number().int().min(0),
159
+ enabled_rules: zod.object({
160
+ product: zod.boolean(),
161
+ product_type: zod.boolean(),
162
+ shipping_option: zod.boolean()
163
+ }),
164
+ product: zod.array(TaxRateRuleReferenceSchema).optional(),
165
+ product_type: zod.array(TaxRateRuleReferenceSchema).optional(),
166
+ shipping_option: zod.array(TaxRateRuleReferenceSchema).optional()
167
+ });
168
+ var CreateCommissionRateForm = ({
169
+ store
170
+ }) => {
171
+ const { t } = useTranslation();
172
+ const { handleSuccess } = useRouteModal();
173
+ const { setIsOpen } = useStackedModal();
174
+ const direction = useDocumentDirection();
175
+ const form = useForm({
176
+ defaultValues: {
177
+ name: "",
178
+ code: "",
179
+ type: "percentage",
180
+ target: "item",
181
+ value: 0,
182
+ currency_code: "",
183
+ min_amount: void 0,
184
+ include_tax: false,
185
+ is_enabled: true,
186
+ priority: 0,
187
+ enabled_rules: {
188
+ product: false,
189
+ product_type: false,
190
+ shipping_option: false
191
+ },
192
+ product: [],
193
+ product_type: [],
194
+ shipping_option: []
195
+ },
196
+ resolver: zodResolver(CreateCommissionRateSchema)
197
+ });
198
+ const storeCurrencies = (store?.supported_currencies ?? []).map(
199
+ (c) => currencies[c.currency_code.toUpperCase()]
200
+ );
201
+ const defaultCurrencyCode = store?.supported_currencies?.[0]?.currency_code ?? "";
202
+ useEffect(() => {
203
+ if (defaultCurrencyCode && !form.getValues("currency_code")) {
204
+ form.setValue("currency_code", defaultCurrencyCode);
205
+ }
206
+ }, [defaultCurrencyCode, form]);
207
+ const { mutateAsync: createCommissionRate, isPending } = useCreateCommissionRate();
208
+ const handleSubmit = form.handleSubmit(async (values) => {
209
+ const rules = [
210
+ ...(values.product || []).map((ref) => ({
211
+ reference: "product" /* PRODUCT */,
212
+ reference_id: ref.value
213
+ })),
214
+ ...(values.product_type || []).map((ref) => ({
215
+ reference: "product_type" /* PRODUCT_TYPE */,
216
+ reference_id: ref.value
217
+ })),
218
+ ...(values.shipping_option || []).map((ref) => ({
219
+ reference: "shipping_option" /* SHIPPING_OPTION */,
220
+ reference_id: ref.value
221
+ }))
222
+ ];
223
+ await createCommissionRate(
224
+ {
225
+ name: values.name,
226
+ code: values.code,
227
+ type: values.type,
228
+ target: values.target,
229
+ value: values.value,
230
+ currency_code: values.currency_code || null,
231
+ min_amount: values.min_amount ?? null,
232
+ include_tax: values.include_tax,
233
+ is_enabled: values.is_enabled,
234
+ priority: values.priority,
235
+ ...rules.length > 0 ? { rules } : {}
236
+ },
237
+ {
238
+ onSuccess: ({ commission_rate }) => {
239
+ toast.success("Commission rate created successfully");
240
+ handleSuccess(`../${commission_rate.id}`);
241
+ },
242
+ onError: (e) => {
243
+ toast.error(e.message);
244
+ }
245
+ }
246
+ );
247
+ });
248
+ const watchType = form.watch("type");
249
+ const watchCurrency = form.watch("currency_code");
250
+ const products = useFieldArray({
251
+ control: form.control,
252
+ name: "product" /* PRODUCT */
253
+ });
254
+ const productTypes = useFieldArray({
255
+ control: form.control,
256
+ name: "product_type" /* PRODUCT_TYPE */
257
+ });
258
+ const shippingOptions = useFieldArray({
259
+ control: form.control,
260
+ name: "shipping_option" /* SHIPPING_OPTION */
261
+ });
262
+ const getControls = (type) => {
263
+ switch (type) {
264
+ case "product" /* PRODUCT */:
265
+ return products;
266
+ case "product_type" /* PRODUCT_TYPE */:
267
+ return productTypes;
268
+ case "shipping_option" /* SHIPPING_OPTION */:
269
+ return shippingOptions;
270
+ }
271
+ };
272
+ const referenceTypeOptions = [
273
+ {
274
+ value: "product" /* PRODUCT */,
275
+ label: t("taxRegions.fields.targets.options.product")
276
+ },
277
+ {
278
+ value: "product_type" /* PRODUCT_TYPE */,
279
+ label: t("taxRegions.fields.targets.options.productType")
280
+ },
281
+ {
282
+ value: "shipping_option" /* SHIPPING_OPTION */,
283
+ label: t("taxRegions.fields.targets.options.shippingOption")
284
+ }
285
+ ];
286
+ const searchPlaceholders = {
287
+ ["product" /* PRODUCT */]: t(
288
+ "taxRegions.fields.targets.placeholders.product"
289
+ ),
290
+ ["product_type" /* PRODUCT_TYPE */]: t(
291
+ "taxRegions.fields.targets.placeholders.productType"
292
+ ),
293
+ ["shipping_option" /* SHIPPING_OPTION */]: t(
294
+ "taxRegions.fields.targets.placeholders.shippingOption"
295
+ )
296
+ };
297
+ const getFieldHandler = (type) => {
298
+ const { fields, remove, append } = getControls(type);
299
+ const modalId = getStackedModalId(type);
300
+ return (references) => {
301
+ if (!references.length) {
302
+ form.setValue(type, [], { shouldDirty: true });
303
+ setIsOpen(modalId, false);
304
+ return;
305
+ }
306
+ const newIds = references.map((reference) => reference.value);
307
+ const fieldsToAdd = references.filter(
308
+ (reference) => !fields.some((field) => field.value === reference.value)
309
+ );
310
+ for (const field of fields) {
311
+ if (!newIds.includes(field.value)) {
312
+ remove(fields.indexOf(field));
313
+ }
314
+ }
315
+ append(fieldsToAdd);
316
+ setIsOpen(modalId, false);
317
+ };
318
+ };
319
+ const displayOrder = /* @__PURE__ */ new Set();
320
+ const disableRule = (type) => {
321
+ form.setValue(type, [], { shouldDirty: true });
322
+ form.setValue(`enabled_rules.${type}`, false, { shouldDirty: true });
323
+ displayOrder.delete(type);
324
+ };
325
+ const enableRule = (type) => {
326
+ form.setValue(`enabled_rules.${type}`, true, { shouldDirty: true });
327
+ form.setValue(type, [], { shouldDirty: true });
328
+ displayOrder.add(type);
329
+ };
330
+ const watchedEnabledRules = useWatch({
331
+ control: form.control,
332
+ name: "enabled_rules"
333
+ });
334
+ const addRule = () => {
335
+ const firstDisabledRule = Object.keys(watchedEnabledRules).find(
336
+ (key) => !watchedEnabledRules[key]
337
+ );
338
+ if (firstDisabledRule) {
339
+ enableRule(firstDisabledRule);
340
+ }
341
+ };
342
+ const visibleRuleTypes = referenceTypeOptions.filter((option) => watchedEnabledRules[option.value]).sort((a, b) => {
343
+ const orderArray = Array.from(displayOrder);
344
+ return orderArray.indexOf(b.value) - orderArray.indexOf(a.value);
345
+ });
346
+ const getAvailableRuleTypes = (type) => {
347
+ return referenceTypeOptions.filter((option) => {
348
+ return !visibleRuleTypes.some(
349
+ (visibleOption) => visibleOption.value === option.value
350
+ ) || option.value === type;
351
+ });
352
+ };
353
+ const showAddButton = Object.values(watchedEnabledRules).some(
354
+ (value) => !value
355
+ );
356
+ return /* @__PURE__ */ jsx(RouteFocusModal.Form, { form, children: /* @__PURE__ */ jsxs(
357
+ KeyboundForm,
358
+ {
359
+ className: "flex h-full flex-col overflow-hidden",
360
+ onSubmit: handleSubmit,
361
+ children: [
362
+ /* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
363
+ /* @__PURE__ */ jsx(RouteFocusModal.Body, { className: "flex overflow-hidden", children: /* @__PURE__ */ jsx(
364
+ "div",
365
+ {
366
+ className: clx(
367
+ "flex h-full w-full flex-col items-center overflow-y-auto p-16"
368
+ ),
369
+ children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8", children: [
370
+ /* @__PURE__ */ jsxs("div", { children: [
371
+ /* @__PURE__ */ jsx(Heading, { children: "Create Commission Rate" }),
372
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Configure a new commission rate for your marketplace." })
373
+ ] }),
374
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
375
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
376
+ /* @__PURE__ */ jsx(
377
+ Form.Field,
378
+ {
379
+ control: form.control,
380
+ name: "name",
381
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
382
+ /* @__PURE__ */ jsx(Form.Label, { children: "Name" }),
383
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
384
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
385
+ ] })
386
+ }
387
+ ),
388
+ /* @__PURE__ */ jsx(
389
+ Form.Field,
390
+ {
391
+ control: form.control,
392
+ name: "code",
393
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
394
+ /* @__PURE__ */ jsx(Form.Label, { children: "Code" }),
395
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
396
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
397
+ ] })
398
+ }
399
+ )
400
+ ] }),
401
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
402
+ /* @__PURE__ */ jsx(
403
+ Form.Field,
404
+ {
405
+ control: form.control,
406
+ name: "type",
407
+ render: ({ field: { onChange, ref, ...field } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
408
+ /* @__PURE__ */ jsx(Form.Label, { children: "Type" }),
409
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(Select, { ...field, onValueChange: onChange, children: [
410
+ /* @__PURE__ */ jsx(Select.Trigger, { ref, children: /* @__PURE__ */ jsx(Select.Value, {}) }),
411
+ /* @__PURE__ */ jsxs(Select.Content, { children: [
412
+ /* @__PURE__ */ jsx(Select.Item, { value: "percentage", children: "Percentage" }),
413
+ /* @__PURE__ */ jsx(Select.Item, { value: "fixed", children: "Fixed" })
414
+ ] })
415
+ ] }) }),
416
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
417
+ ] })
418
+ }
419
+ ),
420
+ /* @__PURE__ */ jsx(
421
+ Form.Field,
422
+ {
423
+ control: form.control,
424
+ name: "target",
425
+ render: ({ field: { onChange, ref, ...field } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
426
+ /* @__PURE__ */ jsx(Form.Label, { children: "Target" }),
427
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(Select, { ...field, onValueChange: onChange, children: [
428
+ /* @__PURE__ */ jsx(Select.Trigger, { ref, children: /* @__PURE__ */ jsx(Select.Value, {}) }),
429
+ /* @__PURE__ */ jsxs(Select.Content, { children: [
430
+ /* @__PURE__ */ jsx(Select.Item, { value: "item", children: "Item" }),
431
+ /* @__PURE__ */ jsx(Select.Item, { value: "shipping", children: "Shipping" })
432
+ ] })
433
+ ] }) }),
434
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
435
+ ] })
436
+ }
437
+ )
438
+ ] }),
439
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
440
+ /* @__PURE__ */ jsx(
441
+ Form.Field,
442
+ {
443
+ control: form.control,
444
+ name: "currency_code",
445
+ render: ({ field: { onChange, ref, ...field } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
446
+ /* @__PURE__ */ jsx(Form.Label, { children: "Currency Code" }),
447
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(Select, { ...field, onValueChange: onChange, children: [
448
+ /* @__PURE__ */ jsx(Select.Trigger, { ref, children: /* @__PURE__ */ jsx(Select.Value, { placeholder: "Select currency" }) }),
449
+ /* @__PURE__ */ jsx(Select.Content, { children: storeCurrencies.map((currency) => /* @__PURE__ */ jsx(
450
+ Select.Item,
451
+ {
452
+ value: currency.code.toLowerCase(),
453
+ children: currency.name
454
+ },
455
+ currency.code
456
+ )) })
457
+ ] }) }),
458
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
459
+ ] })
460
+ }
461
+ ),
462
+ /* @__PURE__ */ jsx(
463
+ Form.Field,
464
+ {
465
+ control: form.control,
466
+ name: "value",
467
+ render: ({ field: { value, onChange, ...field } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
468
+ /* @__PURE__ */ jsx(Form.Label, { children: "Rate" }),
469
+ /* @__PURE__ */ jsx(Form.Control, { children: watchType === "percentage" ? /* @__PURE__ */ jsx(
470
+ PercentageInput,
471
+ {
472
+ ...field,
473
+ value,
474
+ decimalsLimit: 4,
475
+ onValueChange: (_value, _name, values) => onChange(values?.float ?? 0)
476
+ }
477
+ ) : /* @__PURE__ */ jsx(
478
+ CurrencyInput,
479
+ {
480
+ min: 0,
481
+ onValueChange: (value2) => onChange(value2 ? parseInt(value2) : ""),
482
+ code: watchCurrency,
483
+ symbol: watchCurrency ? getCurrencySymbol(watchCurrency) : "",
484
+ ...field,
485
+ value
486
+ }
487
+ ) }),
488
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
489
+ ] })
490
+ }
491
+ )
492
+ ] }),
493
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
494
+ /* @__PURE__ */ jsx(
495
+ Form.Field,
496
+ {
497
+ control: form.control,
498
+ name: "min_amount",
499
+ render: ({ field: { value, onChange, ...field } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
500
+ /* @__PURE__ */ jsx(Form.Label, { children: "Minimum Amount" }),
501
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
502
+ CurrencyInput,
503
+ {
504
+ min: 0,
505
+ onValueChange: (value2) => onChange(value2 ? parseInt(value2) : ""),
506
+ code: watchCurrency,
507
+ symbol: watchCurrency ? getCurrencySymbol(watchCurrency) : "",
508
+ ...field,
509
+ value
510
+ }
511
+ ) }),
512
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
513
+ ] })
514
+ }
515
+ ),
516
+ /* @__PURE__ */ jsx(
517
+ Form.Field,
518
+ {
519
+ control: form.control,
520
+ name: "priority",
521
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
522
+ /* @__PURE__ */ jsx(Form.Label, { children: "Priority" }),
523
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(Input, { type: "number", ...field }) }),
524
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
525
+ ] })
526
+ }
527
+ )
528
+ ] })
529
+ ] }),
530
+ /* @__PURE__ */ jsx(
531
+ Form.Field,
532
+ {
533
+ control: form.control,
534
+ name: "is_enabled",
535
+ render: ({ field: { value, onChange, ...field } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
536
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between", children: [
537
+ /* @__PURE__ */ jsx(Form.Label, { children: "Enabled" }),
538
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
539
+ Switch,
540
+ {
541
+ ...field,
542
+ checked: value,
543
+ onCheckedChange: onChange
544
+ }
545
+ ) })
546
+ ] }),
547
+ /* @__PURE__ */ jsx(Form.Hint, { children: "Enable or disable this commission rate." }),
548
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
549
+ ] })
550
+ }
551
+ ),
552
+ /* @__PURE__ */ jsx(
553
+ Form.Field,
554
+ {
555
+ control: form.control,
556
+ name: "include_tax",
557
+ render: ({ field: { value, onChange, ...field } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
558
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between", children: [
559
+ /* @__PURE__ */ jsx(Form.Label, { children: "Include Tax" }),
560
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
561
+ Switch,
562
+ {
563
+ ...field,
564
+ checked: value,
565
+ onCheckedChange: onChange
566
+ }
567
+ ) })
568
+ ] }),
569
+ /* @__PURE__ */ jsx(Form.Hint, { children: "Include tax in the commission calculation." }),
570
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
571
+ ] })
572
+ }
573
+ ),
574
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-3", children: [
575
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-x-4", children: [
576
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
577
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-1", children: [
578
+ /* @__PURE__ */ jsx(
579
+ Label,
580
+ {
581
+ id: "commission_rules_label",
582
+ htmlFor: "commission_rules",
583
+ children: t("taxRegions.fields.targets.label")
584
+ }
585
+ ),
586
+ /* @__PURE__ */ jsxs(
587
+ Text,
588
+ {
589
+ size: "small",
590
+ leading: "compact",
591
+ className: "text-ui-fg-muted",
592
+ children: [
593
+ "(",
594
+ t("fields.optional"),
595
+ ")"
596
+ ]
597
+ }
598
+ )
599
+ ] }),
600
+ /* @__PURE__ */ jsx(
601
+ Hint,
602
+ {
603
+ id: "commission_rules_description",
604
+ className: "text-pretty",
605
+ children: t("taxRegions.fields.targets.hint")
606
+ }
607
+ )
608
+ ] }),
609
+ showAddButton && /* @__PURE__ */ jsx(
610
+ Button,
611
+ {
612
+ onClick: addRule,
613
+ type: "button",
614
+ size: "small",
615
+ variant: "transparent",
616
+ className: "text-ui-fg-interactive hover:text-ui-fg-interactive-hover flex-shrink-0",
617
+ children: t("taxRegions.fields.targets.action")
618
+ }
619
+ )
620
+ ] }),
621
+ /* @__PURE__ */ jsx(
622
+ "div",
623
+ {
624
+ id: "commission_rules",
625
+ "aria-labelledby": "commission_rules_label",
626
+ "aria-describedby": "commission_rules_description",
627
+ role: "application",
628
+ className: "flex flex-col gap-y-3",
629
+ children: visibleRuleTypes.map((ruleType, index) => {
630
+ const type = ruleType.value;
631
+ const label = ruleType.label;
632
+ const isLast = index === visibleRuleTypes.length - 1;
633
+ const searchPlaceholder = searchPlaceholders[type];
634
+ const options = getAvailableRuleTypes(type);
635
+ const { fields, remove } = getControls(type);
636
+ const handler = getFieldHandler(type);
637
+ const modalId = getStackedModalId(type);
638
+ const handleChangeType = (value) => {
639
+ disableRule(type);
640
+ enableRule(value);
641
+ };
642
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
643
+ Form.Field,
644
+ {
645
+ control: form.control,
646
+ name: ruleType.value,
647
+ render: ({ field }) => {
648
+ return /* @__PURE__ */ jsxs(Form.Item, { className: "space-y-0", children: [
649
+ /* @__PURE__ */ jsx(Form.Label, { className: "sr-only", children: label }),
650
+ /* @__PURE__ */ jsxs(
651
+ "div",
652
+ {
653
+ className: clx(
654
+ "bg-ui-bg-component shadow-elevation-card-rest transition-fg grid gap-1.5 rounded-xl py-1.5",
655
+ "aria-[invalid='true']:shadow-borders-error"
656
+ ),
657
+ role: "application",
658
+ ...field,
659
+ children: [
660
+ /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle grid gap-1.5 px-1.5 md:grid-cols-2", children: [
661
+ isLast ? /* @__PURE__ */ jsxs(
662
+ Select,
663
+ {
664
+ dir: direction,
665
+ value: type,
666
+ onValueChange: handleChangeType,
667
+ children: [
668
+ /* @__PURE__ */ jsx(Select.Trigger, { className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover", children: /* @__PURE__ */ jsx(Select.Value, {}) }),
669
+ /* @__PURE__ */ jsx(Select.Content, { children: options.map((option) => {
670
+ return /* @__PURE__ */ jsx(
671
+ Select.Item,
672
+ {
673
+ value: option.value,
674
+ children: option.label
675
+ },
676
+ option.value
677
+ );
678
+ }) })
679
+ ]
680
+ }
681
+ ) : /* @__PURE__ */ jsx("div", { className: "bg-ui-bg-field shadow-borders-base txt-compact-small rounded-md px-2 py-1.5", children: label }),
682
+ /* @__PURE__ */ jsx("div", { className: "bg-ui-bg-field shadow-borders-base txt-compact-small rounded-md px-2 py-1.5", children: t(
683
+ "taxRegions.fields.targets.operators.in"
684
+ ) })
685
+ ] }),
686
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 px-1.5", children: [
687
+ /* @__PURE__ */ jsxs(StackedFocusModal, { id: modalId, children: [
688
+ /* @__PURE__ */ jsx(StackedFocusModal.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(
689
+ "button",
690
+ {
691
+ type: "button",
692
+ 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",
693
+ children: [
694
+ /* @__PURE__ */ jsx(MagnifyingGlass, {}),
695
+ searchPlaceholder
696
+ ]
697
+ }
698
+ ) }),
699
+ /* @__PURE__ */ jsx(StackedFocusModal.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "secondary", children: t("actions.browse") }) }),
700
+ /* @__PURE__ */ jsxs(StackedFocusModal.Content, { children: [
701
+ /* @__PURE__ */ jsxs(StackedFocusModal.Header, { children: [
702
+ /* @__PURE__ */ jsx(StackedFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { className: "sr-only", children: t(
703
+ "taxRegions.fields.targets.modal.header"
704
+ ) }) }),
705
+ /* @__PURE__ */ jsx(StackedFocusModal.Description, { className: "sr-only", children: t(
706
+ "taxRegions.fields.targets.hint"
707
+ ) })
708
+ ] }),
709
+ /* @__PURE__ */ jsx(
710
+ TargetForm,
711
+ {
712
+ type: "focus",
713
+ referenceType: type,
714
+ state: fields,
715
+ setState: handler
716
+ }
717
+ )
718
+ ] })
719
+ ] }),
720
+ /* @__PURE__ */ jsx(
721
+ Button,
722
+ {
723
+ variant: "secondary",
724
+ onClick: () => disableRule(type),
725
+ type: "button",
726
+ children: t("actions.delete")
727
+ }
728
+ )
729
+ ] }),
730
+ fields.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-1.5", children: [
731
+ /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
732
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1.5 px-1.5", children: fields.map((field2, index2) => {
733
+ return /* @__PURE__ */ jsx(
734
+ TargetItem,
735
+ {
736
+ index: index2,
737
+ label: field2.label,
738
+ onRemove: remove,
739
+ value: field2.value
740
+ },
741
+ field2.id
742
+ );
743
+ }) })
744
+ ] }) : null
745
+ ]
746
+ }
747
+ ),
748
+ /* @__PURE__ */ jsx(Form.ErrorMessage, { className: "mt-2" })
749
+ ] });
750
+ }
751
+ }
752
+ ) }, type);
753
+ })
754
+ }
755
+ )
756
+ ] })
757
+ ] })
758
+ }
759
+ ) }),
760
+ /* @__PURE__ */ jsxs(RouteFocusModal.Footer, { children: [
761
+ /* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: t("actions.cancel") }) }),
762
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: t("actions.save") })
763
+ ] })
764
+ ]
765
+ }
766
+ ) });
767
+ };
768
+
769
+ // src/pages/commission-rates/commission-rate-create/commission-rate-create.tsx
770
+ import { jsx as jsx2 } from "react/jsx-runtime";
771
+ var CommissionRateCreate = () => {
772
+ const { isLoading, store } = useStore();
773
+ return /* @__PURE__ */ jsx2(RouteFocusModal, { children: !isLoading && store && /* @__PURE__ */ jsx2(CreateCommissionRateForm, { store }) });
774
+ };
775
+ export {
776
+ CommissionRateCreate as Component
777
+ };