@mercurjs/admin 2.0.0-canary.40 → 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 +1 -1
  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
@@ -0,0 +1,685 @@
1
+ import {
2
+ ConditionalPriceForm,
3
+ ConditionalPriceSchema,
4
+ ShippingOptionPriceProvider,
5
+ buildShippingOptionPriceRules,
6
+ useShippingOptionPriceColumns
7
+ } from "./chunk-ZZEAWVFX.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 {
16
+ DataGrid
17
+ } from "./chunk-U3OWJE7V.js";
18
+ import {
19
+ useComboboxData
20
+ } from "./chunk-AEFDAU3Y.js";
21
+ import {
22
+ Combobox
23
+ } from "./chunk-AW77UWCZ.js";
24
+ import {
25
+ castNumber
26
+ } from "./chunk-SMQT3ZNO.js";
27
+ import {
28
+ TabbedForm,
29
+ defineTabMeta,
30
+ useTabbedForm
31
+ } from "./chunk-5GG65TKV.js";
32
+ import {
33
+ SwitchBox
34
+ } from "./chunk-YVCBMOJG.js";
35
+ import {
36
+ useDocumentDirection
37
+ } from "./chunk-Y7QKP6QU.js";
38
+ import {
39
+ RouteFocusModal,
40
+ StackedFocusModal,
41
+ useRouteModal,
42
+ useStackedModal
43
+ } from "./chunk-MWOKFNRO.js";
44
+ import {
45
+ Form
46
+ } from "./chunk-3QSRE5LS.js";
47
+ import {
48
+ useCreateShippingOptions
49
+ } from "./chunk-YOIARITB.js";
50
+ import {
51
+ useFulfillmentProviderOptions,
52
+ useStockLocation
53
+ } from "./chunk-4YF3GAKE.js";
54
+ import {
55
+ useRegions
56
+ } from "./chunk-QSM56ZOP.js";
57
+ import {
58
+ useStore
59
+ } from "./chunk-MIHEJ6Y6.js";
60
+ import {
61
+ usePricePreferences
62
+ } from "./chunk-3VZV6SJQ.js";
63
+ import {
64
+ sdk
65
+ } from "./chunk-ZYNBKBY3.js";
66
+
67
+ // src/pages/locations/location-service-zone-shipping-option-create/components/create-shipping-options-form/schema.ts
68
+ import { z } from "zod";
69
+ var CreateShippingOptionDetailsSchema = z.object({
70
+ name: z.string().min(1),
71
+ price_type: z.nativeEnum(ShippingOptionPriceType),
72
+ enabled_in_store: z.boolean(),
73
+ shipping_profile_id: z.string().min(1),
74
+ provider_id: z.string().min(1),
75
+ fulfillment_option_id: z.string().min(1),
76
+ shipping_option_type_id: z.string().min(1)
77
+ });
78
+ var ShippingOptionConditionalPriceSchema = z.object({
79
+ conditional_region_prices: z.record(
80
+ z.string(),
81
+ z.array(ConditionalPriceSchema).optional()
82
+ ),
83
+ conditional_currency_prices: z.record(
84
+ z.string(),
85
+ z.array(ConditionalPriceSchema).optional()
86
+ )
87
+ });
88
+ var CreateShippingOptionSchema = z.object({
89
+ region_prices: z.record(z.string(), z.string().optional()),
90
+ currency_prices: z.record(z.string(), z.string().optional())
91
+ }).merge(CreateShippingOptionDetailsSchema).merge(ShippingOptionConditionalPriceSchema);
92
+
93
+ // src/pages/locations/location-service-zone-shipping-option-create/location-service-zone-shipping-option-create.tsx
94
+ import { Children as Children2 } from "react";
95
+ import { useParams, useSearchParams } from "react-router-dom";
96
+
97
+ // src/pages/locations/location-service-zone-shipping-option-create/components/create-shipping-options-form/create-shipping-options-form.tsx
98
+ import { zodResolver } from "@hookform/resolvers/zod";
99
+ import { toast } from "@medusajs/ui";
100
+ import { Children, useCallback, useMemo as useMemo2 } from "react";
101
+ import { useForm, useWatch as useWatch2 } from "react-hook-form";
102
+ import { useTranslation as useTranslation2 } from "react-i18next";
103
+
104
+ // src/pages/locations/location-service-zone-shipping-option-create/components/create-shipping-options-form/create-shipping-option-details-form.tsx
105
+ import { Divider, Heading, Input, RadioGroup, Select, Text } from "@medusajs/ui";
106
+ import { useTranslation } from "react-i18next";
107
+ import { jsx, jsxs } from "react/jsx-runtime";
108
+ import { createElement } from "react";
109
+ var Root = ({
110
+ isReturn = false,
111
+ zone,
112
+ locationId,
113
+ fulfillmentProviderOptions,
114
+ selectedProviderId,
115
+ type
116
+ }) => {
117
+ const { t } = useTranslation();
118
+ const form = useTabbedForm();
119
+ const direction = useDocumentDirection();
120
+ const isPickup = type === "pickup" /* Pickup */;
121
+ const shippingProfiles = useComboboxData({
122
+ queryFn: (params) => sdk.admin.shippingProfile.list(params),
123
+ queryKey: ["shipping_profiles"],
124
+ getOptions: (data) => data.shipping_profiles.map((profile) => ({
125
+ label: profile.name,
126
+ value: profile.id
127
+ }))
128
+ });
129
+ const shippingOptionTypes = useComboboxData({
130
+ queryFn: (params) => sdk.admin.shippingOptionType.list(params),
131
+ queryKey: ["shipping_option_types"],
132
+ getOptions: (data) => data.shipping_option_types.map((type2) => ({
133
+ label: type2.label,
134
+ value: type2.id
135
+ }))
136
+ });
137
+ const fulfillmentProviders = useComboboxData({
138
+ queryFn: (params) => sdk.admin.fulfillmentProvider.list({
139
+ ...params,
140
+ stock_location_id: locationId
141
+ }),
142
+ queryKey: ["fulfillment_providers"],
143
+ getOptions: (data) => data.fulfillment_providers.map((provider) => ({
144
+ label: formatProvider(provider.id),
145
+ value: provider.id
146
+ }))
147
+ });
148
+ 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: [
149
+ /* @__PURE__ */ jsxs("div", { "data-testid": "location-shipping-option-create-details-form-header-section", children: [
150
+ /* @__PURE__ */ jsx(Heading, { "data-testid": "location-shipping-option-create-details-form-heading", children: t(
151
+ `stockLocations.shippingOptions.create.${isPickup ? "pickup" : isReturn ? "returns" : "shipping"}.header`,
152
+ { zone: zone.name }
153
+ ) }),
154
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", "data-testid": "location-shipping-option-create-details-form-hint", children: t(
155
+ `stockLocations.shippingOptions.create.${isReturn ? "returns" : isPickup ? "pickup" : "shipping"}.hint`
156
+ ) })
157
+ ] }),
158
+ !isPickup && /* @__PURE__ */ jsx(
159
+ Form.Field,
160
+ {
161
+ control: form.control,
162
+ name: "price_type",
163
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "location-shipping-option-create-details-form-price-type-item", children: [
164
+ /* @__PURE__ */ jsx(Form.Label, { "data-testid": "location-shipping-option-create-details-form-price-type-label", children: t("stockLocations.shippingOptions.fields.priceType.label") }),
165
+ /* @__PURE__ */ jsx(Form.Control, { "data-testid": "location-shipping-option-create-details-form-price-type-control", children: /* @__PURE__ */ jsxs(
166
+ RadioGroup,
167
+ {
168
+ dir: direction,
169
+ className: "grid grid-cols-1 gap-4 md:grid-cols-2",
170
+ ...field,
171
+ onValueChange: field.onChange,
172
+ "data-testid": "location-shipping-option-create-details-form-price-type-radio-group",
173
+ children: [
174
+ /* @__PURE__ */ jsx(
175
+ RadioGroup.ChoiceBox,
176
+ {
177
+ className: "flex-1",
178
+ value: "flat" /* FlatRate */,
179
+ label: t("stockLocations.shippingOptions.fields.priceType.options.fixed.label"),
180
+ description: t("stockLocations.shippingOptions.fields.priceType.options.fixed.hint"),
181
+ "data-testid": "location-shipping-option-create-details-form-price-type-flat-rate"
182
+ }
183
+ ),
184
+ /* @__PURE__ */ jsx(
185
+ RadioGroup.ChoiceBox,
186
+ {
187
+ className: "flex-1",
188
+ value: "calculated" /* Calculated */,
189
+ label: t("stockLocations.shippingOptions.fields.priceType.options.calculated.label"),
190
+ description: t("stockLocations.shippingOptions.fields.priceType.options.calculated.hint"),
191
+ "data-testid": "location-shipping-option-create-details-form-price-type-calculated"
192
+ }
193
+ )
194
+ ]
195
+ }
196
+ ) }),
197
+ /* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "location-shipping-option-create-details-form-price-type-error" })
198
+ ] })
199
+ }
200
+ ),
201
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
202
+ /* @__PURE__ */ jsx(
203
+ Form.Field,
204
+ {
205
+ control: form.control,
206
+ name: "name",
207
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "location-shipping-option-create-details-form-name-item", children: [
208
+ /* @__PURE__ */ jsx(Form.Label, { "data-testid": "location-shipping-option-create-details-form-name-label", children: t("fields.name") }),
209
+ /* @__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" }) }),
210
+ /* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "location-shipping-option-create-details-form-name-error" })
211
+ ] })
212
+ }
213
+ ),
214
+ /* @__PURE__ */ jsx(
215
+ Form.Field,
216
+ {
217
+ control: form.control,
218
+ name: "shipping_profile_id",
219
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "location-shipping-option-create-details-form-shipping-profile-item", children: [
220
+ /* @__PURE__ */ jsx(Form.Label, { "data-testid": "location-shipping-option-create-details-form-shipping-profile-label", children: t("stockLocations.shippingOptions.fields.profile") }),
221
+ /* @__PURE__ */ jsx(Form.Control, { "data-testid": "location-shipping-option-create-details-form-shipping-profile-control", children: /* @__PURE__ */ jsx(
222
+ Combobox,
223
+ {
224
+ ...field,
225
+ options: shippingProfiles.options,
226
+ searchValue: shippingProfiles.searchValue,
227
+ onSearchValueChange: shippingProfiles.onSearchValueChange,
228
+ disabled: shippingProfiles.disabled,
229
+ "data-testid": "location-shipping-option-create-details-form-shipping-profile-combobox"
230
+ }
231
+ ) }),
232
+ /* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "location-shipping-option-create-details-form-shipping-profile-error" })
233
+ ] })
234
+ }
235
+ ),
236
+ /* @__PURE__ */ jsx(
237
+ Form.Field,
238
+ {
239
+ control: form.control,
240
+ name: "shipping_option_type_id",
241
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "location-shipping-option-create-details-form-shipping-option-type-item", children: [
242
+ /* @__PURE__ */ jsx(Form.Label, { "data-testid": "location-shipping-option-create-details-form-shipping-option-type-label", children: t("stockLocations.shippingOptions.fields.type") }),
243
+ /* @__PURE__ */ jsx(Form.Control, { "data-testid": "location-shipping-option-create-details-form-shipping-option-type-control", children: /* @__PURE__ */ jsx(
244
+ Combobox,
245
+ {
246
+ ...field,
247
+ options: shippingOptionTypes.options,
248
+ searchValue: shippingOptionTypes.searchValue,
249
+ onSearchValueChange: shippingOptionTypes.onSearchValueChange,
250
+ disabled: shippingOptionTypes.disabled,
251
+ "data-testid": "location-shipping-option-create-details-form-shipping-option-type-combobox"
252
+ }
253
+ ) }),
254
+ /* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "location-shipping-option-create-details-form-shipping-option-type-error" })
255
+ ] })
256
+ }
257
+ )
258
+ ] }),
259
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
260
+ /* @__PURE__ */ jsx(
261
+ Form.Field,
262
+ {
263
+ control: form.control,
264
+ name: "provider_id",
265
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "location-shipping-option-create-details-form-provider-item", children: [
266
+ /* @__PURE__ */ jsx(
267
+ Form.Label,
268
+ {
269
+ tooltip: t("stockLocations.fulfillmentProviders.shippingOptionsTooltip"),
270
+ "data-testid": "location-shipping-option-create-details-form-provider-label",
271
+ children: t("stockLocations.shippingOptions.fields.provider")
272
+ }
273
+ ),
274
+ /* @__PURE__ */ jsx(Form.Control, { "data-testid": "location-shipping-option-create-details-form-provider-control", children: /* @__PURE__ */ jsx(
275
+ Combobox,
276
+ {
277
+ ...field,
278
+ onChange: (e) => {
279
+ field.onChange(e);
280
+ form.setValue("fulfillment_option_id", "");
281
+ },
282
+ options: fulfillmentProviders.options,
283
+ searchValue: fulfillmentProviders.searchValue,
284
+ onSearchValueChange: fulfillmentProviders.onSearchValueChange,
285
+ disabled: fulfillmentProviders.disabled,
286
+ "data-testid": "location-shipping-option-create-details-form-provider-combobox"
287
+ }
288
+ ) }),
289
+ /* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "location-shipping-option-create-details-form-provider-error" })
290
+ ] })
291
+ }
292
+ ),
293
+ /* @__PURE__ */ jsx(
294
+ Form.Field,
295
+ {
296
+ control: form.control,
297
+ name: "fulfillment_option_id",
298
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "location-shipping-option-create-details-form-fulfillment-option-item", children: [
299
+ /* @__PURE__ */ jsx(Form.Label, { "data-testid": "location-shipping-option-create-details-form-fulfillment-option-label", children: t("stockLocations.shippingOptions.fields.fulfillmentOption") }),
300
+ /* @__PURE__ */ jsx(Form.Control, { "data-testid": "location-shipping-option-create-details-form-fulfillment-option-control", children: /* @__PURE__ */ createElement(
301
+ Select,
302
+ {
303
+ dir: direction,
304
+ ...field,
305
+ onValueChange: field.onChange,
306
+ disabled: !selectedProviderId,
307
+ key: selectedProviderId,
308
+ "data-testid": "location-shipping-option-create-details-form-fulfillment-option-select"
309
+ },
310
+ /* @__PURE__ */ jsx(Select.Trigger, { ref: field.ref, "data-testid": "location-shipping-option-create-details-form-fulfillment-option-trigger", children: /* @__PURE__ */ jsx(Select.Value, {}) }),
311
+ /* @__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)) })
312
+ ) }),
313
+ /* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "location-shipping-option-create-details-form-fulfillment-option-error" })
314
+ ] })
315
+ }
316
+ )
317
+ ] }),
318
+ /* @__PURE__ */ jsx(Divider, {}),
319
+ /* @__PURE__ */ jsx(
320
+ SwitchBox,
321
+ {
322
+ control: form.control,
323
+ name: "enabled_in_store",
324
+ label: t("stockLocations.shippingOptions.fields.enableInStore.label"),
325
+ description: t("stockLocations.shippingOptions.fields.enableInStore.hint"),
326
+ "data-testid": "location-shipping-option-create-details-form-enabled-in-store"
327
+ }
328
+ )
329
+ ] }) });
330
+ };
331
+ Root._tabMeta = defineTabMeta({
332
+ id: "details",
333
+ labelKey: "stockLocations.shippingOptions.create.tabs.details",
334
+ validationFields: [
335
+ "name",
336
+ "price_type",
337
+ "enabled_in_store",
338
+ "shipping_profile_id",
339
+ "provider_id",
340
+ "fulfillment_option_id",
341
+ "shipping_option_type_id"
342
+ ]
343
+ });
344
+ var CreateShippingOptionDetailsForm = Root;
345
+
346
+ // src/pages/locations/location-service-zone-shipping-option-create/components/create-shipping-options-form/create-shipping-options-prices-form.tsx
347
+ import { useEffect, useMemo, useState } from "react";
348
+ import { useWatch } from "react-hook-form";
349
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
350
+ var Root2 = ({ type }) => {
351
+ const isPickup = type === "pickup" /* Pickup */;
352
+ const form = useTabbedForm();
353
+ const { getIsOpen, setIsOpen } = useStackedModal();
354
+ const [selectedPrice, setSelectedPrice] = useState(null);
355
+ const onOpenConditionalPricesModal = (info) => {
356
+ setIsOpen(CONDITIONAL_PRICES_STACKED_MODAL_ID, true);
357
+ setSelectedPrice(info);
358
+ };
359
+ const onCloseConditionalPricesModal = () => {
360
+ setIsOpen(CONDITIONAL_PRICES_STACKED_MODAL_ID, false);
361
+ setSelectedPrice(null);
362
+ };
363
+ const {
364
+ store,
365
+ isLoading: isStoreLoading,
366
+ isError: isStoreError,
367
+ error: storeError
368
+ } = useStore();
369
+ const currencies = useMemo(
370
+ () => store?.supported_currencies?.map((c) => c.currency_code) || [],
371
+ [store]
372
+ );
373
+ const {
374
+ regions,
375
+ isLoading: isRegionsLoading,
376
+ isError: isRegionsError,
377
+ error: regionsError
378
+ } = useRegions({
379
+ fields: "id,name,currency_code",
380
+ limit: 999
381
+ });
382
+ const { price_preferences: pricePreferences } = usePricePreferences({});
383
+ const { setCloseOnEscape } = useRouteModal();
384
+ const name = useWatch({ control: form.control, name: "name" });
385
+ const columns = useShippingOptionPriceColumns({
386
+ name,
387
+ currencies,
388
+ regions,
389
+ pricePreferences
390
+ });
391
+ const isLoading = isStoreLoading || !store || isRegionsLoading || !regions;
392
+ const data = useMemo(
393
+ () => [[...currencies || [], ...regions || []]],
394
+ [currencies, regions]
395
+ );
396
+ useEffect(() => {
397
+ if (!isLoading && isPickup) {
398
+ if (currencies.length > 0) {
399
+ currencies.forEach((currency) => {
400
+ form.setValue(`currency_prices.${currency}`, "0");
401
+ });
402
+ }
403
+ if (regions.length > 0) {
404
+ regions.forEach((region) => {
405
+ form.setValue(`region_prices.${region.id}`, "0");
406
+ });
407
+ }
408
+ }
409
+ }, [isLoading, isPickup]);
410
+ if (isStoreError) {
411
+ throw storeError;
412
+ }
413
+ if (isRegionsError) {
414
+ throw regionsError;
415
+ }
416
+ return /* @__PURE__ */ jsx2(
417
+ StackedFocusModal,
418
+ {
419
+ id: CONDITIONAL_PRICES_STACKED_MODAL_ID,
420
+ onOpenChangeCallback: (open) => {
421
+ if (!open) {
422
+ setSelectedPrice(null);
423
+ }
424
+ },
425
+ "data-testid": "location-shipping-option-create-prices-form",
426
+ children: /* @__PURE__ */ jsx2(
427
+ ShippingOptionPriceProvider,
428
+ {
429
+ onOpenConditionalPricesModal,
430
+ onCloseConditionalPricesModal,
431
+ children: /* @__PURE__ */ jsxs2("div", { className: "flex size-full flex-col divide-y overflow-hidden", "data-testid": "location-shipping-option-create-prices-form-container", children: [
432
+ /* @__PURE__ */ jsx2(
433
+ DataGrid,
434
+ {
435
+ isLoading,
436
+ data,
437
+ columns,
438
+ state: form,
439
+ onEditingChange: (editing) => setCloseOnEscape(!editing),
440
+ disableInteractions: getIsOpen(CONDITIONAL_PRICES_STACKED_MODAL_ID),
441
+ "data-testid": "location-shipping-option-create-prices-form-data-grid"
442
+ }
443
+ ),
444
+ selectedPrice && /* @__PURE__ */ jsx2(ConditionalPriceForm, { info: selectedPrice, variant: "create" })
445
+ ] })
446
+ }
447
+ )
448
+ }
449
+ );
450
+ };
451
+ Root2._tabMeta = defineTabMeta({
452
+ id: "pricing",
453
+ labelKey: "stockLocations.shippingOptions.create.tabs.prices",
454
+ validationFields: ["region_prices", "currency_prices", "conditional_region_prices", "conditional_currency_prices"]
455
+ });
456
+ var CreateShippingOptionsPricesForm = Root2;
457
+
458
+ // src/pages/locations/location-service-zone-shipping-option-create/components/create-shipping-options-form/create-shipping-options-form.tsx
459
+ import { jsx as jsx3 } from "react/jsx-runtime";
460
+ function CreateShippingOptionsForm({
461
+ zone,
462
+ isReturn,
463
+ locationId,
464
+ type,
465
+ children,
466
+ schema,
467
+ defaultValues: extraDefaults
468
+ }) {
469
+ const { t } = useTranslation2();
470
+ const { handleSuccess } = useRouteModal();
471
+ const form = useForm({
472
+ defaultValues: {
473
+ name: "",
474
+ price_type: "flat" /* FlatRate */,
475
+ enabled_in_store: true,
476
+ shipping_profile_id: "",
477
+ provider_id: "",
478
+ fulfillment_option_id: "",
479
+ region_prices: {},
480
+ currency_prices: {},
481
+ conditional_region_prices: {},
482
+ conditional_currency_prices: {},
483
+ ...extraDefaults
484
+ },
485
+ resolver: zodResolver(schema ?? CreateShippingOptionSchema)
486
+ });
487
+ const selectedProviderId = useWatch2({
488
+ control: form.control,
489
+ name: "provider_id"
490
+ });
491
+ const { fulfillment_options: fulfillmentProviderOptions } = useFulfillmentProviderOptions(selectedProviderId, {
492
+ enabled: !!selectedProviderId
493
+ });
494
+ const watchedPriceType = useWatch2({
495
+ control: form.control,
496
+ name: "price_type"
497
+ });
498
+ const isCalculatedPriceType = watchedPriceType === "calculated" /* Calculated */;
499
+ const { mutateAsync, isPending: isLoading } = useCreateShippingOptions();
500
+ const handleSubmit = form.handleSubmit(async (data) => {
501
+ const currencyPrices = Object.entries(data.currency_prices).map(([code, value]) => {
502
+ if (!value) {
503
+ return void 0;
504
+ }
505
+ return {
506
+ currency_code: code,
507
+ amount: castNumber(value)
508
+ };
509
+ }).filter((p) => !!p);
510
+ const regionPrices = Object.entries(data.region_prices).map(([region_id, value]) => {
511
+ if (!value) {
512
+ return void 0;
513
+ }
514
+ return {
515
+ region_id,
516
+ amount: castNumber(value)
517
+ };
518
+ }).filter((p) => !!p);
519
+ const conditionalRegionPrices = Object.entries(
520
+ data.conditional_region_prices
521
+ ).flatMap(([region_id, value]) => {
522
+ const prices = value?.map((rule) => ({
523
+ region_id,
524
+ amount: castNumber(rule.amount),
525
+ rules: buildShippingOptionPriceRules(rule)
526
+ })) || [];
527
+ return prices?.filter(Boolean);
528
+ });
529
+ const conditionalCurrencyPrices = Object.entries(
530
+ data.conditional_currency_prices
531
+ ).flatMap(([currency_code, value]) => {
532
+ const prices = value?.map((rule) => ({
533
+ currency_code,
534
+ amount: castNumber(rule.amount),
535
+ rules: buildShippingOptionPriceRules(rule)
536
+ })) || [];
537
+ return prices?.filter(Boolean);
538
+ });
539
+ const allPrices = [
540
+ ...currencyPrices,
541
+ ...conditionalCurrencyPrices,
542
+ ...regionPrices,
543
+ ...conditionalRegionPrices
544
+ ];
545
+ const fulfillmentOptionData = fulfillmentProviderOptions?.find(
546
+ (fo) => fo.id === data.fulfillment_option_id
547
+ );
548
+ await mutateAsync(
549
+ {
550
+ name: data.name,
551
+ price_type: data.price_type,
552
+ service_zone_id: zone.id,
553
+ shipping_profile_id: data.shipping_profile_id,
554
+ provider_id: data.provider_id,
555
+ prices: allPrices,
556
+ data: fulfillmentOptionData,
557
+ rules: [
558
+ {
559
+ value: isReturn ? "true" : "false",
560
+ attribute: "is_return",
561
+ operator: "eq"
562
+ },
563
+ {
564
+ value: data.enabled_in_store ? "true" : "false",
565
+ attribute: "enabled_in_store",
566
+ operator: "eq"
567
+ }
568
+ ],
569
+ type_id: data.shipping_option_type_id
570
+ },
571
+ {
572
+ onSuccess: ({ shipping_option }) => {
573
+ toast.success(
574
+ t(
575
+ `stockLocations.shippingOptions.create.${isReturn ? "returns" : "shipping"}.successToast`,
576
+ { name: shipping_option.name }
577
+ )
578
+ );
579
+ handleSuccess(`/settings/locations/${locationId}`);
580
+ },
581
+ onError: (e) => {
582
+ toast.error(e.message);
583
+ }
584
+ }
585
+ );
586
+ });
587
+ const transformTabs = useCallback(
588
+ (tabs) => {
589
+ return tabs.map((tab) => {
590
+ if (tab.id === "pricing") {
591
+ return {
592
+ ...tab,
593
+ isVisible: () => !isCalculatedPriceType
594
+ };
595
+ }
596
+ return tab;
597
+ });
598
+ },
599
+ [isCalculatedPriceType]
600
+ );
601
+ const defaultTabs = useMemo2(
602
+ () => [
603
+ /* @__PURE__ */ jsx3(
604
+ CreateShippingOptionDetailsForm,
605
+ {
606
+ zone,
607
+ isReturn,
608
+ type,
609
+ locationId,
610
+ fulfillmentProviderOptions: fulfillmentProviderOptions || [],
611
+ selectedProviderId
612
+ },
613
+ "details"
614
+ ),
615
+ /* @__PURE__ */ jsx3(CreateShippingOptionsPricesForm, { type }, "pricing")
616
+ ],
617
+ [zone, isReturn, type, locationId, fulfillmentProviderOptions, selectedProviderId]
618
+ );
619
+ const hasCustomChildren = Children.count(children) > 0;
620
+ return /* @__PURE__ */ jsx3(
621
+ TabbedForm,
622
+ {
623
+ form,
624
+ onSubmit: handleSubmit,
625
+ isLoading,
626
+ transformTabs,
627
+ children: hasCustomChildren ? children : defaultTabs
628
+ }
629
+ );
630
+ }
631
+
632
+ // src/pages/locations/location-service-zone-shipping-option-create/constants.ts
633
+ var LOC_CREATE_SHIPPING_OPTION_FIELDS = "*fulfillment_sets,*fulfillment_sets.service_zones,*fulfillment_sets.service_zones.shipping_options";
634
+
635
+ // src/pages/locations/location-service-zone-shipping-option-create/location-service-zone-shipping-option-create.tsx
636
+ import { jsx as jsx4 } from "react/jsx-runtime";
637
+ var Root3 = ({ children }) => {
638
+ const { location_id, fset_id, zone_id } = useParams();
639
+ const [searchParams] = useSearchParams();
640
+ const isReturn = searchParams.has("is_return");
641
+ const { stock_location, isPending, isFetching, isError, error } = useStockLocation(location_id, {
642
+ fields: LOC_CREATE_SHIPPING_OPTION_FIELDS
643
+ });
644
+ const fulfillmentSet = stock_location?.fulfillment_sets?.find(
645
+ (f) => f.id === fset_id
646
+ );
647
+ if (!isPending && !isFetching && !fulfillmentSet) {
648
+ throw new Response(
649
+ JSON.stringify({ message: `Fulfillment set with ID ${fset_id} was not found` }),
650
+ { status: 404, headers: { "Content-Type": "application/json" } }
651
+ );
652
+ }
653
+ const zone = fulfillmentSet?.service_zones?.find((z2) => z2.id === zone_id);
654
+ if (!isPending && !isFetching && !zone) {
655
+ throw new Response(
656
+ JSON.stringify({ message: `Service zone with ID ${zone_id} was not found` }),
657
+ { status: 404, headers: { "Content-Type": "application/json" } }
658
+ );
659
+ }
660
+ if (isError) {
661
+ throw error;
662
+ }
663
+ return /* @__PURE__ */ jsx4(RouteFocusModal, { prev: `/settings/locations/${location_id}`, "data-testid": "location-shipping-option-create-modal", children: zone && (Children2.count(children) > 0 ? children : /* @__PURE__ */ jsx4(
664
+ CreateShippingOptionsForm,
665
+ {
666
+ zone,
667
+ isReturn,
668
+ locationId: location_id,
669
+ type: fulfillmentSet.type
670
+ }
671
+ )) });
672
+ };
673
+ var ShippingOptionCreatePage = Object.assign(Root3, {
674
+ Form: CreateShippingOptionsForm,
675
+ DetailsTab: CreateShippingOptionDetailsForm,
676
+ PricingTab: CreateShippingOptionsPricesForm,
677
+ Tab: TabbedForm.Tab
678
+ });
679
+ var LocationServiceZoneShippingOptionCreate = Root3;
680
+
681
+ export {
682
+ CreateShippingOptionSchema,
683
+ ShippingOptionCreatePage,
684
+ LocationServiceZoneShippingOptionCreate
685
+ };