@mercurjs/admin 2.0.0-canary.39 → 2.0.0-canary.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/dist/{add-campaign-promotions-ZUXBF5G3.js → add-campaign-promotions-7TPECJOT.js} +4 -4
  2. package/dist/{api-key-management-detail-SKJNAZ5L.js → api-key-management-detail-2EFDWJSF.js} +7 -7
  3. package/dist/{api-key-management-list-2D4WKI6Y.js → api-key-management-list-UZLHSM2R.js} +6 -5
  4. package/dist/{api-key-management-sales-channels-C7EWPHC2.js → api-key-management-sales-channels-ER5ZINL7.js} +6 -7
  5. package/dist/{campaign-create-B7XM2FZM.js → campaign-create-AFR3V7P4.js} +3 -3
  6. package/dist/{campaign-detail-7U4CQHU5.js → campaign-detail-UUNEZUY7.js} +9 -8
  7. package/dist/{campaign-list-SC7FLTRM.js → campaign-list-2AAGWYEG.js} +6 -5
  8. package/dist/category-create-LY45Z7YB.js +23 -0
  9. package/dist/{category-detail-HGHR3R2R.js → category-detail-AGTIMI6P.js} +7 -6
  10. package/dist/{category-list-QBBFGHQM.js → category-list-ROM7UTA4.js} +6 -5
  11. package/dist/{chunk-ENMRRG4N.js → chunk-2AWQ4FPA.js} +6 -6
  12. package/dist/{chunk-VBAAYYCS.js → chunk-2HPZJCAF.js} +6 -6
  13. package/dist/{chunk-SFG7JTBH.js → chunk-2LAANNMF.js} +111 -48
  14. package/dist/{chunk-KYUXTS2L.js → chunk-2UN7CNBG.js} +7 -7
  15. package/dist/chunk-3LTXCGNM.js +204 -0
  16. package/dist/{chunk-EDQBUWY7.js → chunk-3NIWL75F.js} +6 -6
  17. package/dist/{product-create-variant-CJPECBV4.js → chunk-4UTK7DZN.js} +63 -69
  18. package/dist/{chunk-5VEYNZSW.js → chunk-5322X23U.js} +9 -4
  19. package/dist/{chunk-U3SFHLUA.js → chunk-53IISBJZ.js} +1 -0
  20. package/dist/{chunk-DGCPYCHU.js → chunk-54RTJBYO.js} +63 -8
  21. package/dist/{chunk-E2AAYIHS.js → chunk-5EFOVNK2.js} +3 -3
  22. package/dist/{chunk-NQPAEBSZ.js → chunk-6E3T6CGY.js} +15 -7
  23. package/dist/{chunk-V2DXJ75C.js → chunk-6OA7JZ5E.js} +1 -1
  24. package/dist/chunk-72IQIAGX.js +245 -0
  25. package/dist/{chunk-3IYIS5UZ.js → chunk-7DOPC5GY.js} +4 -4
  26. package/dist/{chunk-Q6XCCONH.js → chunk-AI6RJGRQ.js} +9 -9
  27. package/dist/{price-list-create-OK7YYLAB.js → chunk-AJZQBGE4.js} +193 -428
  28. package/dist/{chunk-XDVS4B7W.js → chunk-BAV6Y7RC.js} +8 -7
  29. package/dist/{chunk-4WYBW3HK.js → chunk-BCAT7P6B.js} +3 -3
  30. package/dist/{chunk-LYT3RI4O.js → chunk-BHYDGWZ6.js} +18 -9
  31. package/dist/{chunk-DK3U2SRA.js → chunk-BIEYPCHL.js} +5 -5
  32. package/dist/{product-create-NVBKO426.js → chunk-BLG726FI.js} +36 -68
  33. package/dist/chunk-BVRI7YAR.js +100 -0
  34. package/dist/{chunk-2IGCU3KP.js → chunk-DOMRLXOI.js} +2 -2
  35. package/dist/{chunk-K6FXWZ2M.js → chunk-F55UXYYA.js} +10 -0
  36. package/dist/{chunk-AOVEX4EM.js → chunk-FNXSMFGL.js} +5 -5
  37. package/dist/{chunk-IXGP2EEN.js → chunk-FYAYHOCN.js} +2 -3
  38. package/dist/{chunk-QBOXELB5.js → chunk-GJHAVFXL.js} +4 -4
  39. package/dist/{price-list-prices-add-7PGUONDK.js → chunk-GOVOSXUU.js} +90 -290
  40. package/dist/{chunk-66IHH2HG.js → chunk-H6W6Q6YE.js} +3 -3
  41. package/dist/{seller-details-KROISMQC.js → chunk-HVLQFQGD.js} +74 -146
  42. package/dist/{chunk-QD6KYDYH.js → chunk-I6R4I7EF.js} +6 -6
  43. package/dist/{chunk-RIMR3ULR.js → chunk-ISYWL6RZ.js} +64 -33
  44. package/dist/{chunk-HHNJNKCB.js → chunk-KMUEJ3IE.js} +59 -20
  45. package/dist/{chunk-GJTIHFXG.js → chunk-KOILMFJX.js} +29 -31
  46. package/dist/{chunk-3SAH3NUS.js → chunk-LIXRNUG5.js} +1 -1
  47. package/dist/chunk-LOJD5572.js +433 -0
  48. package/dist/{chunk-T25UE7SS.js → chunk-MD56QRKC.js} +6 -6
  49. package/dist/{chunk-S4QUEQQK.js → chunk-MSFNMGFD.js} +48 -48
  50. package/dist/{chunk-YH4VQBAA.js → chunk-MX52GGQO.js} +81 -52
  51. package/dist/{chunk-O6O22BN4.js → chunk-N7BCAAJC.js} +113 -48
  52. package/dist/{chunk-JA2XIIIZ.js → chunk-NXKCVD5F.js} +6 -5
  53. package/dist/{chunk-G4QMLQF2.js → chunk-NZN7PFPB.js} +2 -4
  54. package/dist/{chunk-KUDLPUWR.js → chunk-OFWYMU6K.js} +8 -8
  55. package/dist/chunk-OOAY7PAK.js +1155 -0
  56. package/dist/chunk-PAQH5QQH.js +685 -0
  57. package/dist/{chunk-3H74EI2D.js → chunk-POCHIWE2.js} +100 -40
  58. package/dist/chunk-PXBCTPQO.js +248 -0
  59. package/dist/chunk-QSZ2FIM2.js +223 -0
  60. package/dist/{chunk-23663A2W.js → chunk-R5VKVG6S.js} +1 -1
  61. package/dist/{chunk-DP5U3GQU.js → chunk-RXUUBJSZ.js} +1 -1
  62. package/dist/{chunk-FYB5MS4F.js → chunk-S2GARTQU.js} +6 -6
  63. package/dist/{chunk-7TLEUIAL.js → chunk-SO6PXIPV.js} +21 -16
  64. package/dist/{category-create-UWBJGIED.js → chunk-ST74PSEZ.js} +78 -149
  65. package/dist/{chunk-33FUPXJL.js → chunk-T3OYE2MH.js} +4 -4
  66. package/dist/{chunk-JRWB7VWP.js → chunk-U4RMXPGI.js} +8 -8
  67. package/dist/{chunk-YGSM5PVN.js → chunk-UI2BJVP5.js} +1 -1
  68. package/dist/{chunk-FXU7SL6M.js → chunk-UOIUQC3P.js} +25 -15
  69. package/dist/{chunk-ZU2RNSCP.js → chunk-UONTDHRH.js} +4 -2
  70. package/dist/{chunk-J7SR4GW5.js → chunk-V3SHSLK4.js} +4 -4
  71. package/dist/{chunk-TE5VQBCL.js → chunk-V42ZR4XW.js} +8 -9
  72. package/dist/chunk-V5J73NPW.js +117 -0
  73. package/dist/{chunk-QP6XXG6A.js → chunk-VOFAM7HJ.js} +74 -42
  74. package/dist/{chunk-CR4E2DCR.js → chunk-VT3RBTYK.js} +3 -3
  75. package/dist/{chunk-AOVJTW7M.js → chunk-VWQYMOBM.js} +9 -9
  76. package/dist/{chunk-6L2LSIPR.js → chunk-VXAQZ2ZZ.js} +4 -4
  77. package/dist/{chunk-OSHCUDYY.js → chunk-X3KBQBGW.js} +6 -6
  78. package/dist/{chunk-WZADCDDE.js → chunk-X56THFPA.js} +2 -1
  79. package/dist/{chunk-HZKW7HRU.js → chunk-X7NWBH7T.js} +64 -35
  80. package/dist/{chunk-OFRQZHVQ.js → chunk-XE5ZMNUN.js} +6 -6
  81. package/dist/{chunk-4GVHNYZR.js → chunk-XHVYNMTA.js} +2 -2
  82. package/dist/{chunk-U2UCL2VG.js → chunk-XIZLPYEE.js} +3 -111
  83. package/dist/{chunk-KXPCEVFB.js → chunk-XOKRMMVP.js} +6 -6
  84. package/dist/{chunk-XVKRTPVM.js → chunk-Y5N26ZC3.js} +41 -15
  85. package/dist/{chunk-A6Z2Q7D5.js → chunk-Z2MDPTF2.js} +4 -2
  86. package/dist/{chunk-TKGZBTOS.js → chunk-ZFSZTRZ6.js} +54 -32
  87. package/dist/{chunk-RV6NZTNP.js → chunk-ZZEAWVFX.js} +27 -27
  88. package/dist/{collection-detail-YJ3FV2C6.js → collection-detail-SRR3HSIV.js} +7 -6
  89. package/dist/{collection-list-WDQOBHQN.js → collection-list-MKISW5S4.js} +6 -5
  90. package/dist/{commission-rate-detail-UQDIIMIK.js → commission-rate-detail-GLB733F3.js} +5 -4
  91. package/dist/{commission-rate-list-WTDZLKUR.js → commission-rate-list-5V3FQROA.js} +6 -5
  92. package/dist/{customer-detail-N7CS4IJU.js → customer-detail-SBQF232S.js} +4 -3
  93. package/dist/customer-group-add-customers-LCNDTLXR.js +1 -1
  94. package/dist/{customer-group-detail-UCTY4FF7.js → customer-group-detail-QQSNRM2K.js} +6 -5
  95. package/dist/{customer-group-list-XOQ64CVR.js → customer-group-list-IO7SVK3F.js} +15 -6
  96. package/dist/{customer-list-BUUO6OF7.js → customer-list-TXBAME4V.js} +4 -3
  97. package/dist/customers-add-customer-group-BKEV24N2.js +1 -1
  98. package/dist/index.d.ts +225 -16
  99. package/dist/index.js +581 -387
  100. package/dist/inventory-create-Q4JIXZTT.js +56 -0
  101. package/dist/{inventory-detail-BJT5WEV5.js → inventory-detail-3D37JWQT.js} +7 -6
  102. package/dist/{inventory-list-3LWBPWVK.js → inventory-list-WH42ADNB.js} +6 -5
  103. package/dist/{inventory-stock-G3GP4FZX.js → inventory-stock-DTKOGYT7.js} +6 -6
  104. package/dist/{location-detail-N7J6PEAP.js → location-detail-2SSHXSKL.js} +5 -4
  105. package/dist/location-fulfillment-providers-BHCY2MYC.js +1 -1
  106. package/dist/{location-list-UG6B47NP.js → location-list-LPISOSQI.js} +5 -4
  107. package/dist/{location-sales-channels-3IGHCJEN.js → location-sales-channels-PPH53OHD.js} +6 -7
  108. package/dist/location-service-zone-shipping-option-create-GSXLVEGO.js +57 -0
  109. package/dist/{location-service-zone-shipping-option-pricing-7VMPXDWX.js → location-service-zone-shipping-option-pricing-4CTGXBP3.js} +6 -6
  110. package/dist/marketplace-add-currencies-CIGOPBO6.js +1 -1
  111. package/dist/{marketplace-detail-7KJMXXAJ.js → marketplace-detail-3CBLIYVK.js} +6 -5
  112. package/dist/{order-detail-C25NQSZN.js → order-detail-AJV2PE7J.js} +7 -6
  113. package/dist/{order-edit-billing-address-NVRMPZEU.js → order-edit-billing-address-QQUPIC2H.js} +6 -6
  114. package/dist/{order-list-7NH7LROU.js → order-list-VPQOG5WE.js} +6 -5
  115. package/dist/pages/index.d.ts +2608 -82
  116. package/dist/pages/index.js +238 -156
  117. package/dist/{payout-detail-MDD5SRK5.js → payout-detail-PMR26YQI.js} +5 -4
  118. package/dist/{payout-list-XY2A5KYS.js → payout-list-DMG7MQM7.js} +6 -4
  119. package/dist/price-list-configuration-XK3IZLLX.js +1 -1
  120. package/dist/price-list-create-QS6CVEWS.js +76 -0
  121. package/dist/{price-list-detail-IGFSM77P.js → price-list-detail-IO5ZURVW.js} +7 -6
  122. package/dist/{price-list-list-TBXQ5DOS.js → price-list-list-B3FKB46L.js} +6 -5
  123. package/dist/price-list-prices-add-NSAQWBT6.js +71 -0
  124. package/dist/{price-list-prices-edit-QVGBT6AI.js → price-list-prices-edit-UOAIOS5X.js} +6 -6
  125. package/dist/product-create-UVKMOKRF.js +68 -0
  126. package/dist/product-create-variant-TCXDJ425.js +53 -0
  127. package/dist/{product-detail-ZC37BGPC.js → product-detail-273ME23P.js} +4 -4
  128. package/dist/{product-list-635ZXM2D.js → product-list-2ZHLFSBI.js} +5 -4
  129. package/dist/{product-media-ZMDAVPGI.js → product-media-YMFP6Q6A.js} +3 -3
  130. package/dist/{product-prices-WMRIC7WM.js → product-prices-X6JO3Y5A.js} +5 -5
  131. package/dist/{product-sales-channels-LSN5DVWZ.js → product-sales-channels-2PVBPK6W.js} +2 -3
  132. package/dist/{product-stock-HF42WRSC.js → product-stock-ARRFHDSU.js} +6 -6
  133. package/dist/{product-tag-detail-OJLYO3Q5.js → product-tag-detail-545AVFGA.js} +7 -6
  134. package/dist/{product-tag-list-XFHGJBRF.js → product-tag-list-2Y2Q7K3A.js} +7 -6
  135. package/dist/{product-type-detail-J4UA4AEM.js → product-type-detail-PBP572AM.js} +7 -6
  136. package/dist/{product-type-list-H5EQHCXS.js → product-type-list-XWNUKETZ.js} +6 -5
  137. package/dist/{product-variant-detail-5WKYURFA.js → product-variant-detail-RJUQWBYH.js} +4 -3
  138. package/dist/{profile-detail-EYNXOHGZ.js → profile-detail-H22ZBNOB.js} +5 -4
  139. package/dist/{promotion-add-campaign-B5SF72KC.js → promotion-add-campaign-5LCKEU6H.js} +3 -3
  140. package/dist/promotion-create-KXBEHXPK.js +54 -0
  141. package/dist/{promotion-detail-MVFOMS4E.js → promotion-detail-NZZ2HII7.js} +7 -6
  142. package/dist/{promotion-list-IN4VWEQN.js → promotion-list-KARWNOAQ.js} +9 -8
  143. package/dist/{refund-reason-list-DJZZC7KK.js → refund-reason-list-GTZQBZ7R.js} +3 -2
  144. package/dist/{region-detail-OFZHX57G.js → region-detail-3OPMLS4V.js} +5 -4
  145. package/dist/{region-list-L4FKHVJJ.js → region-list-542EMW5C.js} +6 -5
  146. package/dist/{reservation-detail-LZYEM5NW.js → reservation-detail-IPGIBQW4.js} +5 -4
  147. package/dist/{reservation-list-OGPDB7WG.js → reservation-list-CEFKMB2G.js} +6 -5
  148. package/dist/{reset-password-Q7Y4FWRE.js → reset-password-R5ULRWEM.js} +1 -1
  149. package/dist/{return-reason-list-6ICMSVKF.js → return-reason-list-S7LU655M.js} +5 -4
  150. package/dist/{sales-channel-detail-RRJG7U7R.js → sales-channel-detail-QCJ6OC3H.js} +7 -6
  151. package/dist/{sales-channel-list-LUZ4ZXCY.js → sales-channel-list-KYNBWXUD.js} +7 -7
  152. package/dist/seller-details-A7TYGP67.js +104 -0
  153. package/dist/{seller-list-664H4SI5.js → seller-list-5KPNNC2B.js} +7 -6
  154. package/dist/{shipping-option-type-detail-2RY3NHRO.js → shipping-option-type-detail-OBYOZZWS.js} +5 -4
  155. package/dist/{shipping-option-type-list-IOSOE33S.js → shipping-option-type-list-UGVMQ3DC.js} +6 -5
  156. package/dist/{shipping-profile-detail-RIIAX7VE.js → shipping-profile-detail-RYOFRMLH.js} +5 -4
  157. package/dist/{shipping-profiles-list-AL4EJSJY.js → shipping-profiles-list-XJGQ7AVX.js} +5 -4
  158. package/dist/{tax-region-create-UOTLTCOP.js → tax-region-create-AR2LNF2G.js} +6 -6
  159. package/dist/{tax-region-detail-CA2W5W6A.js → tax-region-detail-PIGY5JQ7.js} +7 -6
  160. package/dist/{tax-region-list-JTZ7KZCX.js → tax-region-list-AMGZWUAI.js} +6 -5
  161. package/dist/{tax-region-province-detail-ZHLX4FF4.js → tax-region-province-detail-D3R4FJT4.js} +6 -5
  162. package/dist/types-DUhfb5tH.d.ts +30 -0
  163. package/dist/{user-detail-YNPBC5MN.js → user-detail-H66ZAR7W.js} +5 -4
  164. package/dist/{user-list-LNTZNT3D.js → user-list-HIUXLIJV.js} +5 -4
  165. package/package.json +3 -3
  166. package/dist/chunk-62ZRA6BZ.js +0 -216
  167. package/dist/chunk-6PNMR6XP.js +0 -192
  168. package/dist/chunk-7COSFMM7.js +0 -163
  169. package/dist/chunk-A2KURGQO.js +0 -151
  170. package/dist/chunk-BHID7W3U.js +0 -78
  171. package/dist/chunk-UKLRBS4W.js +0 -61
  172. package/dist/inventory-create-QLEIHESO.js +0 -620
  173. package/dist/location-service-zone-shipping-option-create-GYPW6SSN.js +0 -811
  174. package/dist/promotion-create-D77SANLX.js +0 -1262
  175. package/dist/{adjust-inventory-HZCWL6SC.js → adjust-inventory-WL7D7TQR.js} +3 -3
  176. package/dist/{campaign-budget-edit-AIXCDGG3.js → campaign-budget-edit-722ECPRI.js} +3 -3
  177. package/dist/{category-products-XLCG2JR7.js → category-products-H3VFYGOU.js} +2 -2
  178. package/dist/{chunk-DEKJJ7NG.js → chunk-OFCUTNGV.js} +3 -3
  179. package/dist/{chunk-KUWNYCGL.js → chunk-U3OWJE7V.js} +0 -0
  180. package/dist/{collection-add-products-IQ7M63BA.js → collection-add-products-BQ2FZKR4.js} +1 -1
  181. package/dist/{commission-rate-create-VC72GTV4.js → commission-rate-create-GFQNADQS.js} +9 -9
  182. package/dist/{commission-rate-edit-AXJKJNFY.js → commission-rate-edit-A2BFZUEI.js} +9 -9
  183. package/dist/{location-service-zone-shipping-option-edit-E3GN4ZF5.js → location-service-zone-shipping-option-edit-KPECMUYB.js} +3 -3
  184. package/dist/{order-create-claim-7WW6MXTT.js → order-create-claim-IWTV2HKL.js} +6 -6
  185. package/dist/{order-create-edit-KAH6ZPLX.js → order-create-edit-H2MHZFIW.js} +5 -5
  186. package/dist/{order-create-exchange-ELLWF3IY.js → order-create-exchange-PPMRSGLD.js} +6 -6
  187. package/dist/{order-create-refund-5QZBOSCA.js → order-create-refund-LZOHRL7T.js} +3 -3
  188. package/dist/{order-create-return-L6DEDPJK.js → order-create-return-WY6R4QMN.js} +6 -6
  189. package/dist/{order-edit-shipping-address-BPU7OL2N.js → order-edit-shipping-address-XQCSN4YO.js} +3 -3
  190. package/dist/{order-receive-return-FW5QZJBM.js → order-receive-return-GKMHYD4G.js} +1 -1
  191. package/dist/{product-edit-LQJDUUVX.js → product-edit-QGRKGJ3H.js} +1 -1
  192. package/dist/{product-variant-edit-66ZUIIMP.js → product-variant-edit-IQLBIHDE.js} +1 -1
  193. package/dist/{product-variant-manage-inventory-items-CV2CC2PV.js → product-variant-manage-inventory-items-C77QHYRT.js} +3 -3
  194. package/dist/{promotion-edit-details-YKS24GBD.js → promotion-edit-details-BFXPUEE6.js} +4 -4
  195. package/dist/{region-create-UMJK3VGL.js → region-create-ZPY6V77Q.js} +3 -3
  196. package/dist/{region-edit-ODVSNJHM.js → region-edit-Q2CBVPR2.js} +3 -3
  197. package/dist/{sales-channel-add-products-EOWFSO35.js → sales-channel-add-products-PIY4PUIW.js} +2 -2
  198. package/dist/{tax-region-province-create-RFYCUDER.js → tax-region-province-create-7BMYABJ6.js} +3 -3
  199. package/dist/{tax-region-tax-override-create-WIWUNXW6.js → tax-region-tax-override-create-EBDKSAXG.js} +6 -6
  200. package/dist/{tax-region-tax-override-edit-SWROFQTP.js → tax-region-tax-override-edit-55ODL7KC.js} +6 -6
@@ -1,811 +0,0 @@
1
- import {
2
- ConditionalPriceForm,
3
- ConditionalPriceSchema,
4
- ShippingOptionPriceProvider,
5
- buildShippingOptionPriceRules,
6
- useShippingOptionPriceColumns
7
- } from "./chunk-RV6NZTNP.js";
8
- import {
9
- CONDITIONAL_PRICES_STACKED_MODAL_ID,
10
- ShippingOptionPriceType
11
- } from "./chunk-LXSBG6LK.js";
12
- import {
13
- formatProvider
14
- } from "./chunk-VW56KWO2.js";
15
- import "./chunk-PXYDR7WQ.js";
16
- import {
17
- DataGrid
18
- } from "./chunk-KUWNYCGL.js";
19
- import {
20
- SwitchBox
21
- } from "./chunk-YVCBMOJG.js";
22
- import {
23
- useComboboxData
24
- } from "./chunk-AEFDAU3Y.js";
25
- import {
26
- Combobox
27
- } from "./chunk-AW77UWCZ.js";
28
- import "./chunk-TKGWSUEI.js";
29
- import {
30
- KeyboundForm
31
- } from "./chunk-U2ZFCAPX.js";
32
- import "./chunk-IQPN4PZJ.js";
33
- import {
34
- castNumber
35
- } from "./chunk-SMQT3ZNO.js";
36
- import "./chunk-INNFZYX2.js";
37
- import "./chunk-LAVHRER2.js";
38
- import {
39
- useDocumentDirection
40
- } from "./chunk-Y7QKP6QU.js";
41
- import {
42
- RouteFocusModal,
43
- StackedFocusModal,
44
- useRouteModal,
45
- useStackedModal
46
- } from "./chunk-MWOKFNRO.js";
47
- import {
48
- Form
49
- } from "./chunk-3QSRE5LS.js";
50
- import "./chunk-XM6GCWNF.js";
51
- import "./chunk-ODBDAABQ.js";
52
- import "./chunk-CDQJKJMX.js";
53
- import "./chunk-JLATVDLM.js";
54
- import "./chunk-E7ZBQO6E.js";
55
- import "./chunk-GPRBBA7S.js";
56
- import "./chunk-XGHM75N2.js";
57
- import "./chunk-U2GCSKW3.js";
58
- import "./chunk-A4X5VP3G.js";
59
- import "./chunk-RTAIDSDS.js";
60
- import "./chunk-LW3UWYZU.js";
61
- import "./chunk-NNZP4PYP.js";
62
- import "./chunk-JOQ3RTF5.js";
63
- import "./chunk-V534K7G4.js";
64
- import "./chunk-TQI3DOQ5.js";
65
- import "./chunk-5PB7KCTF.js";
66
- import "./chunk-LU72QEQC.js";
67
- import "./chunk-GF4QHVX3.js";
68
- import "./chunk-A5XOYSDC.js";
69
- import {
70
- useCreateShippingOptions
71
- } from "./chunk-YOIARITB.js";
72
- import "./chunk-W7G64ULL.js";
73
- import "./chunk-6C7TCU42.js";
74
- import {
75
- useFulfillmentProviderOptions,
76
- useStockLocation
77
- } from "./chunk-4YF3GAKE.js";
78
- import {
79
- useRegions
80
- } from "./chunk-QSM56ZOP.js";
81
- import {
82
- useStore
83
- } from "./chunk-MIHEJ6Y6.js";
84
- import {
85
- usePricePreferences
86
- } from "./chunk-3VZV6SJQ.js";
87
- import "./chunk-LORVU5II.js";
88
- import "./chunk-36ORDF7W.js";
89
- import "./chunk-K357FGGP.js";
90
- import "./chunk-RHKRREUU.js";
91
- import "./chunk-ZA2KFUFR.js";
92
- import {
93
- sdk
94
- } from "./chunk-ZYNBKBY3.js";
95
- import "./chunk-NBMM2TZK.js";
96
-
97
- // src/pages/locations/location-service-zone-shipping-option-create/location-service-zone-shipping-option-create.tsx
98
- import { useParams, useSearchParams } from "react-router-dom";
99
-
100
- // src/pages/locations/location-service-zone-shipping-option-create/components/create-shipping-options-form/create-shipping-options-form.tsx
101
- import { zodResolver } from "@hookform/resolvers/zod";
102
- import { Button, ProgressTabs, toast } from "@medusajs/ui";
103
- import { useForm, useWatch as useWatch2 } from "react-hook-form";
104
- import { useTranslation as useTranslation2 } from "react-i18next";
105
- import { useState as useState2 } from "react";
106
-
107
- // src/pages/locations/location-service-zone-shipping-option-create/components/create-shipping-options-form/create-shipping-option-details-form.tsx
108
- import { Divider, Heading, Input, RadioGroup, Select, Text } from "@medusajs/ui";
109
- import { useTranslation } from "react-i18next";
110
- import { jsx, jsxs } from "react/jsx-runtime";
111
- import { createElement } from "react";
112
- var CreateShippingOptionDetailsForm = ({
113
- form,
114
- isReturn = false,
115
- zone,
116
- locationId,
117
- fulfillmentProviderOptions,
118
- selectedProviderId,
119
- type
120
- }) => {
121
- const { t } = useTranslation();
122
- const direction = useDocumentDirection();
123
- const isPickup = type === "pickup" /* Pickup */;
124
- const shippingProfiles = useComboboxData({
125
- queryFn: (params) => sdk.admin.shippingProfile.list(params),
126
- queryKey: ["shipping_profiles"],
127
- getOptions: (data) => data.shipping_profiles.map((profile) => ({
128
- label: profile.name,
129
- value: profile.id
130
- }))
131
- });
132
- const shippingOptionTypes = useComboboxData({
133
- queryFn: (params) => sdk.admin.shippingOptionType.list(params),
134
- queryKey: ["shipping_option_types"],
135
- getOptions: (data) => data.shipping_option_types.map((type2) => ({
136
- label: type2.label,
137
- value: type2.id
138
- }))
139
- });
140
- const fulfillmentProviders = useComboboxData({
141
- queryFn: (params) => sdk.admin.fulfillmentProvider.list({
142
- ...params,
143
- stock_location_id: locationId
144
- }),
145
- queryKey: ["fulfillment_providers"],
146
- getOptions: (data) => data.fulfillment_providers.map((provider) => ({
147
- label: formatProvider(provider.id),
148
- value: provider.id
149
- }))
150
- });
151
- return /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", "data-testid": "location-shipping-option-create-details-form", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8 px-6 py-16", children: [
152
- /* @__PURE__ */ jsxs("div", { "data-testid": "location-shipping-option-create-details-form-header-section", children: [
153
- /* @__PURE__ */ jsx(Heading, { "data-testid": "location-shipping-option-create-details-form-heading", children: t(
154
- `stockLocations.shippingOptions.create.${isPickup ? "pickup" : isReturn ? "returns" : "shipping"}.header`,
155
- {
156
- zone: zone.name
157
- }
158
- ) }),
159
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", "data-testid": "location-shipping-option-create-details-form-hint", children: t(
160
- `stockLocations.shippingOptions.create.${isReturn ? "returns" : isPickup ? "pickup" : "shipping"}.hint`
161
- ) })
162
- ] }),
163
- !isPickup && /* @__PURE__ */ jsx(
164
- Form.Field,
165
- {
166
- control: form.control,
167
- name: "price_type",
168
- render: ({ field }) => {
169
- return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "location-shipping-option-create-details-form-price-type-item", children: [
170
- /* @__PURE__ */ jsx(Form.Label, { "data-testid": "location-shipping-option-create-details-form-price-type-label", children: t("stockLocations.shippingOptions.fields.priceType.label") }),
171
- /* @__PURE__ */ jsx(Form.Control, { "data-testid": "location-shipping-option-create-details-form-price-type-control", children: /* @__PURE__ */ jsxs(
172
- RadioGroup,
173
- {
174
- dir: direction,
175
- className: "grid grid-cols-1 gap-4 md:grid-cols-2",
176
- ...field,
177
- onValueChange: field.onChange,
178
- "data-testid": "location-shipping-option-create-details-form-price-type-radio-group",
179
- children: [
180
- /* @__PURE__ */ jsx(
181
- RadioGroup.ChoiceBox,
182
- {
183
- className: "flex-1",
184
- value: "flat" /* FlatRate */,
185
- label: t(
186
- "stockLocations.shippingOptions.fields.priceType.options.fixed.label"
187
- ),
188
- description: t(
189
- "stockLocations.shippingOptions.fields.priceType.options.fixed.hint"
190
- ),
191
- "data-testid": "location-shipping-option-create-details-form-price-type-flat-rate"
192
- }
193
- ),
194
- /* @__PURE__ */ jsx(
195
- RadioGroup.ChoiceBox,
196
- {
197
- className: "flex-1",
198
- value: "calculated" /* Calculated */,
199
- label: t(
200
- "stockLocations.shippingOptions.fields.priceType.options.calculated.label"
201
- ),
202
- description: t(
203
- "stockLocations.shippingOptions.fields.priceType.options.calculated.hint"
204
- ),
205
- "data-testid": "location-shipping-option-create-details-form-price-type-calculated"
206
- }
207
- )
208
- ]
209
- }
210
- ) }),
211
- /* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "location-shipping-option-create-details-form-price-type-error" })
212
- ] });
213
- }
214
- }
215
- ),
216
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
217
- /* @__PURE__ */ jsx(
218
- Form.Field,
219
- {
220
- control: form.control,
221
- name: "name",
222
- render: ({ field }) => {
223
- return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "location-shipping-option-create-details-form-name-item", children: [
224
- /* @__PURE__ */ jsx(Form.Label, { "data-testid": "location-shipping-option-create-details-form-name-label", children: t("fields.name") }),
225
- /* @__PURE__ */ jsx(Form.Control, { "data-testid": "location-shipping-option-create-details-form-name-control", children: /* @__PURE__ */ jsx(Input, { ...field, "data-testid": "location-shipping-option-create-details-form-name-input" }) }),
226
- /* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "location-shipping-option-create-details-form-name-error" })
227
- ] });
228
- }
229
- }
230
- ),
231
- /* @__PURE__ */ jsx(
232
- Form.Field,
233
- {
234
- control: form.control,
235
- name: "shipping_profile_id",
236
- render: ({ field }) => {
237
- return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "location-shipping-option-create-details-form-shipping-profile-item", children: [
238
- /* @__PURE__ */ jsx(Form.Label, { "data-testid": "location-shipping-option-create-details-form-shipping-profile-label", children: t("stockLocations.shippingOptions.fields.profile") }),
239
- /* @__PURE__ */ jsx(Form.Control, { "data-testid": "location-shipping-option-create-details-form-shipping-profile-control", children: /* @__PURE__ */ jsx(
240
- Combobox,
241
- {
242
- ...field,
243
- options: shippingProfiles.options,
244
- searchValue: shippingProfiles.searchValue,
245
- onSearchValueChange: shippingProfiles.onSearchValueChange,
246
- disabled: shippingProfiles.disabled,
247
- "data-testid": "location-shipping-option-create-details-form-shipping-profile-combobox"
248
- }
249
- ) }),
250
- /* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "location-shipping-option-create-details-form-shipping-profile-error" })
251
- ] });
252
- }
253
- }
254
- ),
255
- /* @__PURE__ */ jsx(
256
- Form.Field,
257
- {
258
- control: form.control,
259
- name: "shipping_option_type_id",
260
- render: ({ field }) => {
261
- return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "location-shipping-option-create-details-form-shipping-option-type-item", children: [
262
- /* @__PURE__ */ jsx(Form.Label, { "data-testid": "location-shipping-option-create-details-form-shipping-option-type-label", children: t("stockLocations.shippingOptions.fields.type") }),
263
- /* @__PURE__ */ jsx(Form.Control, { "data-testid": "location-shipping-option-create-details-form-shipping-option-type-control", children: /* @__PURE__ */ jsx(
264
- Combobox,
265
- {
266
- ...field,
267
- options: shippingOptionTypes.options,
268
- searchValue: shippingOptionTypes.searchValue,
269
- onSearchValueChange: shippingOptionTypes.onSearchValueChange,
270
- disabled: shippingOptionTypes.disabled,
271
- "data-testid": "location-shipping-option-create-details-form-shipping-option-type-combobox"
272
- }
273
- ) }),
274
- /* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "location-shipping-option-create-details-form-shipping-option-type-error" })
275
- ] });
276
- }
277
- }
278
- )
279
- ] }),
280
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
281
- /* @__PURE__ */ jsx(
282
- Form.Field,
283
- {
284
- control: form.control,
285
- name: "provider_id",
286
- render: ({ field }) => {
287
- return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "location-shipping-option-create-details-form-provider-item", children: [
288
- /* @__PURE__ */ jsx(
289
- Form.Label,
290
- {
291
- tooltip: t(
292
- "stockLocations.fulfillmentProviders.shippingOptionsTooltip"
293
- ),
294
- "data-testid": "location-shipping-option-create-details-form-provider-label",
295
- children: t("stockLocations.shippingOptions.fields.provider")
296
- }
297
- ),
298
- /* @__PURE__ */ jsx(Form.Control, { "data-testid": "location-shipping-option-create-details-form-provider-control", children: /* @__PURE__ */ jsx(
299
- Combobox,
300
- {
301
- ...field,
302
- onChange: (e) => {
303
- field.onChange(e);
304
- form.setValue("fulfillment_option_id", "");
305
- },
306
- options: fulfillmentProviders.options,
307
- searchValue: fulfillmentProviders.searchValue,
308
- onSearchValueChange: fulfillmentProviders.onSearchValueChange,
309
- disabled: fulfillmentProviders.disabled,
310
- "data-testid": "location-shipping-option-create-details-form-provider-combobox"
311
- }
312
- ) }),
313
- /* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "location-shipping-option-create-details-form-provider-error" })
314
- ] });
315
- }
316
- }
317
- ),
318
- /* @__PURE__ */ jsx(
319
- Form.Field,
320
- {
321
- control: form.control,
322
- name: "fulfillment_option_id",
323
- render: ({ field }) => {
324
- return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "location-shipping-option-create-details-form-fulfillment-option-item", children: [
325
- /* @__PURE__ */ jsx(Form.Label, { "data-testid": "location-shipping-option-create-details-form-fulfillment-option-label", children: t(
326
- "stockLocations.shippingOptions.fields.fulfillmentOption"
327
- ) }),
328
- /* @__PURE__ */ jsx(Form.Control, { "data-testid": "location-shipping-option-create-details-form-fulfillment-option-control", children: /* @__PURE__ */ createElement(
329
- Select,
330
- {
331
- dir: direction,
332
- ...field,
333
- onValueChange: field.onChange,
334
- disabled: !selectedProviderId,
335
- key: selectedProviderId,
336
- "data-testid": "location-shipping-option-create-details-form-fulfillment-option-select"
337
- },
338
- /* @__PURE__ */ jsx(Select.Trigger, { ref: field.ref, "data-testid": "location-shipping-option-create-details-form-fulfillment-option-trigger", children: /* @__PURE__ */ jsx(Select.Value, {}) }),
339
- /* @__PURE__ */ jsx(Select.Content, { "data-testid": "location-shipping-option-create-details-form-fulfillment-option-content", children: fulfillmentProviderOptions?.filter((fo) => !!fo.is_return === isReturn).map((option) => /* @__PURE__ */ jsx(Select.Item, { value: option.id, "data-testid": `location-shipping-option-create-details-form-fulfillment-option-option-${option.id}`, children: option.name || option.id }, option.id)) })
340
- ) }),
341
- /* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "location-shipping-option-create-details-form-fulfillment-option-error" })
342
- ] });
343
- }
344
- }
345
- )
346
- ] }),
347
- /* @__PURE__ */ jsx(Divider, {}),
348
- /* @__PURE__ */ jsx(
349
- SwitchBox,
350
- {
351
- control: form.control,
352
- name: "enabled_in_store",
353
- label: t("stockLocations.shippingOptions.fields.enableInStore.label"),
354
- description: t(
355
- "stockLocations.shippingOptions.fields.enableInStore.hint"
356
- ),
357
- "data-testid": "location-shipping-option-create-details-form-enabled-in-store"
358
- }
359
- )
360
- ] }) });
361
- };
362
-
363
- // src/pages/locations/location-service-zone-shipping-option-create/components/create-shipping-options-form/create-shipping-options-prices-form.tsx
364
- import { useEffect, useMemo, useState } from "react";
365
- import { useWatch } from "react-hook-form";
366
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
367
- var CreateShippingOptionsPricesForm = ({
368
- form,
369
- type
370
- }) => {
371
- const isPickup = type === "pickup" /* Pickup */;
372
- const { getIsOpen, setIsOpen } = useStackedModal();
373
- const [selectedPrice, setSelectedPrice] = useState(null);
374
- const onOpenConditionalPricesModal = (info) => {
375
- setIsOpen(CONDITIONAL_PRICES_STACKED_MODAL_ID, true);
376
- setSelectedPrice(info);
377
- };
378
- const onCloseConditionalPricesModal = () => {
379
- setIsOpen(CONDITIONAL_PRICES_STACKED_MODAL_ID, false);
380
- setSelectedPrice(null);
381
- };
382
- const {
383
- store,
384
- isLoading: isStoreLoading,
385
- isError: isStoreError,
386
- error: storeError
387
- } = useStore();
388
- const currencies = useMemo(
389
- () => store?.supported_currencies?.map((c) => c.currency_code) || [],
390
- [store]
391
- );
392
- const {
393
- regions,
394
- isLoading: isRegionsLoading,
395
- isError: isRegionsError,
396
- error: regionsError
397
- } = useRegions({
398
- fields: "id,name,currency_code",
399
- limit: 999
400
- });
401
- const { price_preferences: pricePreferences } = usePricePreferences({});
402
- const { setCloseOnEscape } = useRouteModal();
403
- const name = useWatch({ control: form.control, name: "name" });
404
- const columns = useShippingOptionPriceColumns({
405
- name,
406
- currencies,
407
- regions,
408
- pricePreferences
409
- });
410
- const isLoading = isStoreLoading || !store || isRegionsLoading || !regions;
411
- const data = useMemo(
412
- () => [[...currencies || [], ...regions || []]],
413
- [currencies, regions]
414
- );
415
- useEffect(() => {
416
- if (!isLoading && isPickup) {
417
- if (currencies.length > 0) {
418
- currencies.forEach((currency) => {
419
- form.setValue(`currency_prices.${currency}`, "0");
420
- });
421
- }
422
- if (regions.length > 0) {
423
- regions.forEach((region) => {
424
- form.setValue(`region_prices.${region.id}`, "0");
425
- });
426
- }
427
- }
428
- }, [isLoading, isPickup]);
429
- if (isStoreError) {
430
- throw storeError;
431
- }
432
- if (isRegionsError) {
433
- throw regionsError;
434
- }
435
- return /* @__PURE__ */ jsx2(
436
- StackedFocusModal,
437
- {
438
- id: CONDITIONAL_PRICES_STACKED_MODAL_ID,
439
- onOpenChangeCallback: (open) => {
440
- if (!open) {
441
- setSelectedPrice(null);
442
- }
443
- },
444
- "data-testid": "location-shipping-option-create-prices-form",
445
- children: /* @__PURE__ */ jsx2(
446
- ShippingOptionPriceProvider,
447
- {
448
- onOpenConditionalPricesModal,
449
- onCloseConditionalPricesModal,
450
- children: /* @__PURE__ */ jsxs2("div", { className: "flex size-full flex-col divide-y overflow-hidden", "data-testid": "location-shipping-option-create-prices-form-container", children: [
451
- /* @__PURE__ */ jsx2(
452
- DataGrid,
453
- {
454
- isLoading,
455
- data,
456
- columns,
457
- state: form,
458
- onEditingChange: (editing) => setCloseOnEscape(!editing),
459
- disableInteractions: getIsOpen(CONDITIONAL_PRICES_STACKED_MODAL_ID),
460
- "data-testid": "location-shipping-option-create-prices-form-data-grid"
461
- }
462
- ),
463
- selectedPrice && /* @__PURE__ */ jsx2(ConditionalPriceForm, { info: selectedPrice, variant: "create" })
464
- ] })
465
- }
466
- )
467
- }
468
- );
469
- };
470
-
471
- // src/pages/locations/location-service-zone-shipping-option-create/components/create-shipping-options-form/schema.ts
472
- import { z } from "zod";
473
- var CreateShippingOptionDetailsSchema = z.object({
474
- name: z.string().min(1),
475
- price_type: z.nativeEnum(ShippingOptionPriceType),
476
- enabled_in_store: z.boolean(),
477
- shipping_profile_id: z.string().min(1),
478
- provider_id: z.string().min(1),
479
- fulfillment_option_id: z.string().min(1),
480
- shipping_option_type_id: z.string().min(1)
481
- });
482
- var ShippingOptionConditionalPriceSchema = z.object({
483
- conditional_region_prices: z.record(
484
- z.string(),
485
- z.array(ConditionalPriceSchema).optional()
486
- ),
487
- conditional_currency_prices: z.record(
488
- z.string(),
489
- z.array(ConditionalPriceSchema).optional()
490
- )
491
- });
492
- var CreateShippingOptionSchema = z.object({
493
- region_prices: z.record(z.string(), z.string().optional()),
494
- currency_prices: z.record(z.string(), z.string().optional())
495
- }).merge(CreateShippingOptionDetailsSchema).merge(ShippingOptionConditionalPriceSchema);
496
-
497
- // src/pages/locations/location-service-zone-shipping-option-create/components/create-shipping-options-form/create-shipping-options-form.tsx
498
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
499
- function CreateShippingOptionsForm({
500
- zone,
501
- isReturn,
502
- locationId,
503
- type
504
- }) {
505
- const [activeTab, setActiveTab] = useState2("details" /* DETAILS */);
506
- const [validDetails, setValidDetails] = useState2(false);
507
- const { t } = useTranslation2();
508
- const { handleSuccess } = useRouteModal();
509
- const direction = useDocumentDirection();
510
- const form = useForm({
511
- defaultValues: {
512
- name: "",
513
- price_type: "flat" /* FlatRate */,
514
- enabled_in_store: true,
515
- shipping_profile_id: "",
516
- provider_id: "",
517
- fulfillment_option_id: "",
518
- region_prices: {},
519
- currency_prices: {},
520
- conditional_region_prices: {},
521
- conditional_currency_prices: {}
522
- },
523
- resolver: zodResolver(CreateShippingOptionSchema)
524
- });
525
- const selectedProviderId = useWatch2({
526
- control: form.control,
527
- name: "provider_id"
528
- });
529
- const { fulfillment_options: fulfillmentProviderOptions } = useFulfillmentProviderOptions(selectedProviderId, {
530
- enabled: !!selectedProviderId
531
- });
532
- const isCalculatedPriceType = form.watch("price_type") === "calculated" /* Calculated */;
533
- const { mutateAsync, isPending: isLoading } = useCreateShippingOptions();
534
- const handleSubmit = form.handleSubmit(async (data) => {
535
- const currencyPrices = Object.entries(data.currency_prices).map(([code, value]) => {
536
- if (!value) {
537
- return void 0;
538
- }
539
- return {
540
- currency_code: code,
541
- amount: castNumber(value)
542
- };
543
- }).filter((p) => !!p);
544
- const regionPrices = Object.entries(data.region_prices).map(([region_id, value]) => {
545
- if (!value) {
546
- return void 0;
547
- }
548
- return {
549
- region_id,
550
- amount: castNumber(value)
551
- };
552
- }).filter((p) => !!p);
553
- const conditionalRegionPrices = Object.entries(
554
- data.conditional_region_prices
555
- ).flatMap(([region_id, value]) => {
556
- const prices = value?.map((rule) => ({
557
- region_id,
558
- amount: castNumber(rule.amount),
559
- rules: buildShippingOptionPriceRules(rule)
560
- })) || [];
561
- return prices?.filter(Boolean);
562
- });
563
- const conditionalCurrencyPrices = Object.entries(
564
- data.conditional_currency_prices
565
- ).flatMap(([currency_code, value]) => {
566
- const prices = value?.map((rule) => ({
567
- currency_code,
568
- amount: castNumber(rule.amount),
569
- rules: buildShippingOptionPriceRules(rule)
570
- })) || [];
571
- return prices?.filter(Boolean);
572
- });
573
- const allPrices = [
574
- ...currencyPrices,
575
- ...conditionalCurrencyPrices,
576
- ...regionPrices,
577
- ...conditionalRegionPrices
578
- ];
579
- const fulfillmentOptionData = fulfillmentProviderOptions?.find(
580
- (fo) => fo.id === data.fulfillment_option_id
581
- );
582
- await mutateAsync(
583
- {
584
- name: data.name,
585
- price_type: data.price_type,
586
- service_zone_id: zone.id,
587
- shipping_profile_id: data.shipping_profile_id,
588
- provider_id: data.provider_id,
589
- prices: allPrices,
590
- data: fulfillmentOptionData,
591
- rules: [
592
- {
593
- // eslint-disable-next-line
594
- value: isReturn ? "true" : "false",
595
- attribute: "is_return",
596
- operator: "eq"
597
- },
598
- {
599
- // eslint-disable-next-line
600
- value: data.enabled_in_store ? "true" : "false",
601
- attribute: "enabled_in_store",
602
- operator: "eq"
603
- }
604
- ],
605
- type_id: data.shipping_option_type_id
606
- },
607
- {
608
- onSuccess: ({ shipping_option }) => {
609
- toast.success(
610
- t(
611
- `stockLocations.shippingOptions.create.${isReturn ? "returns" : "shipping"}.successToast`,
612
- { name: shipping_option.name }
613
- )
614
- );
615
- handleSuccess(`/settings/locations/${locationId}`);
616
- },
617
- onError: (e) => {
618
- toast.error(e.message);
619
- }
620
- }
621
- );
622
- });
623
- const onTabChange = (tab) => {
624
- if (tab === "pricing" /* PRICING */) {
625
- form.clearErrors();
626
- const result = CreateShippingOptionDetailsSchema.safeParse({
627
- ...form.getValues()
628
- });
629
- if (!result.success) {
630
- const [firstError, ...rest] = result.error.errors;
631
- for (const error of rest) {
632
- const _path = error.path.join(".");
633
- form.setError(_path, {
634
- message: error.message,
635
- type: error.code
636
- });
637
- }
638
- form.setError(
639
- firstError.path.join("."),
640
- {
641
- message: firstError.message,
642
- type: firstError.code
643
- },
644
- {
645
- shouldFocus: true
646
- }
647
- );
648
- setValidDetails(false);
649
- return;
650
- }
651
- setValidDetails(true);
652
- }
653
- setActiveTab(tab);
654
- };
655
- const pricesStatus = form.getFieldState("currency_prices")?.isDirty || form.getFieldState("region_prices")?.isDirty || activeTab === "pricing" /* PRICING */ ? "in-progress" : "not-started";
656
- const detailsStatus = validDetails ? "completed" : "in-progress";
657
- return /* @__PURE__ */ jsx3(RouteFocusModal.Form, { form, "data-testid": "location-shipping-option-create-form", children: /* @__PURE__ */ jsx3(
658
- KeyboundForm,
659
- {
660
- className: "flex h-full flex-col",
661
- onSubmit: handleSubmit,
662
- onKeyDown: (e) => {
663
- const isEnterKey = e.key === "Enter";
664
- const isModifierPressed = e.metaKey || e.ctrlKey;
665
- const shouldContinueToPricing = activeTab !== "pricing" /* PRICING */ && !isCalculatedPriceType;
666
- if (!isEnterKey) {
667
- return;
668
- }
669
- e.preventDefault();
670
- if (!isModifierPressed) {
671
- return;
672
- }
673
- if (shouldContinueToPricing) {
674
- e.stopPropagation();
675
- onTabChange("pricing" /* PRICING */);
676
- return;
677
- }
678
- handleSubmit();
679
- },
680
- children: /* @__PURE__ */ jsxs3(
681
- ProgressTabs,
682
- {
683
- dir: direction,
684
- value: activeTab,
685
- className: "flex h-full flex-col overflow-hidden",
686
- onValueChange: (tab) => onTabChange(tab),
687
- "data-testid": "location-shipping-option-create-progress-tabs",
688
- children: [
689
- /* @__PURE__ */ jsx3(RouteFocusModal.Header, { "data-testid": "location-shipping-option-create-form-header", children: /* @__PURE__ */ jsxs3(ProgressTabs.List, { className: "border-ui-border-base -my-2 ml-2 min-w-0 flex-1 border-l", "data-testid": "location-shipping-option-create-progress-tabs-list", children: [
690
- /* @__PURE__ */ jsx3(
691
- ProgressTabs.Trigger,
692
- {
693
- value: "details" /* DETAILS */,
694
- status: detailsStatus,
695
- className: "w-full max-w-[200px]",
696
- "data-testid": "location-shipping-option-create-details-tab",
697
- children: /* @__PURE__ */ jsx3("span", { className: "w-full cursor-auto overflow-hidden text-ellipsis whitespace-nowrap", children: t("stockLocations.shippingOptions.create.tabs.details") })
698
- }
699
- ),
700
- !isCalculatedPriceType && /* @__PURE__ */ jsx3(
701
- ProgressTabs.Trigger,
702
- {
703
- value: "pricing" /* PRICING */,
704
- status: pricesStatus,
705
- className: "w-full max-w-[200px]",
706
- "data-testid": "location-shipping-option-create-pricing-tab",
707
- children: /* @__PURE__ */ jsx3("span", { className: "w-full overflow-hidden text-ellipsis whitespace-nowrap", children: t("stockLocations.shippingOptions.create.tabs.prices") })
708
- }
709
- )
710
- ] }) }),
711
- /* @__PURE__ */ jsxs3(RouteFocusModal.Body, { className: "size-full overflow-hidden", "data-testid": "location-shipping-option-create-form-body", children: [
712
- /* @__PURE__ */ jsx3(
713
- ProgressTabs.Content,
714
- {
715
- value: "details" /* DETAILS */,
716
- className: "size-full overflow-y-auto",
717
- "data-testid": "location-shipping-option-create-details-tab-content",
718
- children: /* @__PURE__ */ jsx3(
719
- CreateShippingOptionDetailsForm,
720
- {
721
- form,
722
- zone,
723
- isReturn,
724
- type,
725
- locationId,
726
- fulfillmentProviderOptions: fulfillmentProviderOptions || [],
727
- selectedProviderId
728
- }
729
- )
730
- }
731
- ),
732
- /* @__PURE__ */ jsx3(ProgressTabs.Content, { value: "pricing" /* PRICING */, className: "size-full", "data-testid": "location-shipping-option-create-pricing-tab-content", children: /* @__PURE__ */ jsx3(CreateShippingOptionsPricesForm, { form, type }) })
733
- ] }),
734
- /* @__PURE__ */ jsx3(RouteFocusModal.Footer, { "data-testid": "location-shipping-option-create-form-footer", children: /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-end gap-x-2", children: [
735
- /* @__PURE__ */ jsx3(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx3(Button, { variant: "secondary", size: "small", "data-testid": "location-shipping-option-create-form-cancel-button", children: t("actions.cancel") }) }),
736
- activeTab === "pricing" /* PRICING */ || isCalculatedPriceType ? /* @__PURE__ */ jsx3(
737
- Button,
738
- {
739
- size: "small",
740
- className: "whitespace-nowrap",
741
- isLoading,
742
- type: "submit",
743
- "data-testid": "location-shipping-option-create-form-save-button",
744
- children: t("actions.save")
745
- },
746
- "submit-btn"
747
- ) : /* @__PURE__ */ jsx3(
748
- Button,
749
- {
750
- size: "small",
751
- className: "whitespace-nowrap",
752
- isLoading,
753
- onClick: () => onTabChange("pricing" /* PRICING */),
754
- type: "button",
755
- "data-testid": "location-shipping-option-create-form-continue-button",
756
- children: t("actions.continue")
757
- },
758
- "continue-btn"
759
- )
760
- ] }) })
761
- ]
762
- }
763
- )
764
- }
765
- ) });
766
- }
767
-
768
- // src/pages/locations/location-service-zone-shipping-option-create/constants.ts
769
- var LOC_CREATE_SHIPPING_OPTION_FIELDS = "*fulfillment_sets,*fulfillment_sets.service_zones,*fulfillment_sets.service_zones.shipping_options";
770
-
771
- // src/pages/locations/location-service-zone-shipping-option-create/location-service-zone-shipping-option-create.tsx
772
- import { jsx as jsx4 } from "react/jsx-runtime";
773
- function LocationServiceZoneShippingOptionCreate() {
774
- const { location_id, fset_id, zone_id } = useParams();
775
- const [searchParams] = useSearchParams();
776
- const isReturn = searchParams.has("is_return");
777
- const { stock_location, isPending, isFetching, isError, error } = useStockLocation(location_id, {
778
- fields: LOC_CREATE_SHIPPING_OPTION_FIELDS
779
- });
780
- const fulfillmentSet = stock_location?.fulfillment_sets?.find(
781
- (f) => f.id === fset_id
782
- );
783
- if (!isPending && !isFetching && !fulfillmentSet) {
784
- throw new Response(
785
- JSON.stringify({ message: `Fulfillment set with ID ${fset_id} was not found` }),
786
- { status: 404, headers: { "Content-Type": "application/json" } }
787
- );
788
- }
789
- const zone = fulfillmentSet?.service_zones?.find((z2) => z2.id === zone_id);
790
- if (!isPending && !isFetching && !zone) {
791
- throw new Response(
792
- JSON.stringify({ message: `Service zone with ID ${zone_id} was not found` }),
793
- { status: 404, headers: { "Content-Type": "application/json" } }
794
- );
795
- }
796
- if (isError) {
797
- throw error;
798
- }
799
- return /* @__PURE__ */ jsx4(RouteFocusModal, { prev: `/settings/locations/${location_id}`, "data-testid": "location-shipping-option-create-modal", children: zone && /* @__PURE__ */ jsx4(
800
- CreateShippingOptionsForm,
801
- {
802
- zone,
803
- isReturn,
804
- locationId: location_id,
805
- type: fulfillmentSet.type
806
- }
807
- ) });
808
- }
809
- export {
810
- LocationServiceZoneShippingOptionCreate as Component
811
- };