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

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