@mercurjs/admin 2.0.0-canary.24
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.
- package/dist/add-campaign-promotions-JDC36EOE.js +265 -0
- package/dist/adjust-inventory-2YLC4O4I.js +262 -0
- package/dist/api-key-management-create-KERROZ6Z.js +282 -0
- package/dist/api-key-management-detail-PXY2ZH4V.js +481 -0
- package/dist/api-key-management-edit-7IPPTW37.js +106 -0
- package/dist/api-key-management-list-QQHOCVV4.js +350 -0
- package/dist/api-key-management-sales-channels-AO6SRCAW.js +201 -0
- package/dist/campaign-budget-edit-C5PCVES3.js +147 -0
- package/dist/campaign-configuration-ONC2CL7Q.js +154 -0
- package/dist/campaign-create-J2PN77A6.js +29 -0
- package/dist/campaign-detail-2XJ7PXOQ.js +666 -0
- package/dist/campaign-edit-MU4TVOEC.js +206 -0
- package/dist/campaign-list-BWYHTJL2.js +187 -0
- package/dist/categories-metadata-UC3N6YSC.js +83 -0
- package/dist/category-create-DRJZI3EM.js +427 -0
- package/dist/category-detail-DEGYVUXB.js +544 -0
- package/dist/category-edit-PTYOK7VV.js +220 -0
- package/dist/category-list-T4GPTLOA.js +286 -0
- package/dist/category-organize-MLBY54BT.js +110 -0
- package/dist/category-products-W7U2VZTZ.js +281 -0
- package/dist/chunk-25LYVP3C.js +37 -0
- package/dist/chunk-26OOAKQ6.js +18 -0
- package/dist/chunk-2I3BDP2Z.js +61 -0
- package/dist/chunk-2KCF3ZIB.js +32 -0
- package/dist/chunk-2MKZ4HD4.js +175 -0
- package/dist/chunk-2PZGY332.js +88 -0
- package/dist/chunk-2QKPRGNK.js +107 -0
- package/dist/chunk-2Y3WMGN6.js +39 -0
- package/dist/chunk-2ZFELO2L.js +13 -0
- package/dist/chunk-33XUAKRP.js +6 -0
- package/dist/chunk-362QMJZM.js +77 -0
- package/dist/chunk-3CKTAFTR.js +143 -0
- package/dist/chunk-3EF54XFY.js +64 -0
- package/dist/chunk-3KOTDGC2.js +18 -0
- package/dist/chunk-3LDJURK5.js +296 -0
- package/dist/chunk-3QSRE5LS.js +161 -0
- package/dist/chunk-3XPXUIK3.js +34 -0
- package/dist/chunk-4F5GP7J7.js +45 -0
- package/dist/chunk-4GPAS5GW.js +36 -0
- package/dist/chunk-54EPH67T.js +34 -0
- package/dist/chunk-54RTJBYO.js +153 -0
- package/dist/chunk-54TMLQH3.js +9 -0
- package/dist/chunk-5LZ2G4ZX.js +422 -0
- package/dist/chunk-5S6J5PG5.js +182 -0
- package/dist/chunk-6IJMSVC6.js +16 -0
- package/dist/chunk-6KI3GDYH.js +46 -0
- package/dist/chunk-7AV5EJJ5.js +29 -0
- package/dist/chunk-7RPRNVBS.js +45 -0
- package/dist/chunk-7SVLKK6Q.js +31 -0
- package/dist/chunk-AW77UWCZ.js +363 -0
- package/dist/chunk-AWZFIP25.js +117 -0
- package/dist/chunk-AYVH6Q5O.js +31 -0
- package/dist/chunk-BDGZ4EQO.js +86 -0
- package/dist/chunk-BMNW3AEU.js +373 -0
- package/dist/chunk-BRUOBAPY.js +234 -0
- package/dist/chunk-BYZIWSBB.js +185 -0
- package/dist/chunk-C6SUTRP2.js +13 -0
- package/dist/chunk-CBRSGM3X.js +342 -0
- package/dist/chunk-CI5Z6FGV.js +87 -0
- package/dist/chunk-CMHI2RPL.js +20 -0
- package/dist/chunk-CP5IL4P6.js +98 -0
- package/dist/chunk-D3KDXELJ.js +110 -0
- package/dist/chunk-D6IERBVW.js +43 -0
- package/dist/chunk-DB6ANJBO.js +35 -0
- package/dist/chunk-DLKKSPFE.js +50 -0
- package/dist/chunk-DV73MHTN.js +457 -0
- package/dist/chunk-DXZOR4AG.js +69 -0
- package/dist/chunk-DY3XQPHC.js +31 -0
- package/dist/chunk-EOZUAYQL.js +6 -0
- package/dist/chunk-ERTSYQAI.js +121 -0
- package/dist/chunk-EZIB4NST.js +94 -0
- package/dist/chunk-FGZCSG7T.js +232 -0
- package/dist/chunk-FI474ADU.js +0 -0
- package/dist/chunk-FLCYR7E5.js +467 -0
- package/dist/chunk-FMFVTERD.js +0 -0
- package/dist/chunk-FODCCP6C.js +76 -0
- package/dist/chunk-FQERBIVS.js +0 -0
- package/dist/chunk-FWPGOIFA.js +22 -0
- package/dist/chunk-G5OVX555.js +26 -0
- package/dist/chunk-GUIDZSDY.js +41 -0
- package/dist/chunk-H22XDSXD.js +47 -0
- package/dist/chunk-HC25LNX7.js +45 -0
- package/dist/chunk-HINXQTCW.js +97 -0
- package/dist/chunk-HYUGYB23.js +161 -0
- package/dist/chunk-I43SCBL3.js +106 -0
- package/dist/chunk-IGTRIAUC.js +84 -0
- package/dist/chunk-INNFZYX2.js +183 -0
- package/dist/chunk-IQPN4PZJ.js +749 -0
- package/dist/chunk-IZ5RG5XI.js +72 -0
- package/dist/chunk-JDGE23BZ.js +332 -0
- package/dist/chunk-JHIMVLB2.js +42 -0
- package/dist/chunk-JISYRXUS.js +389 -0
- package/dist/chunk-JJVGCTKT.js +243 -0
- package/dist/chunk-JQV7CXEC.js +37 -0
- package/dist/chunk-JRTZWK77.js +1764 -0
- package/dist/chunk-KAZ5BYTQ.js +132 -0
- package/dist/chunk-KBYZLKI4.js +1093 -0
- package/dist/chunk-KTKL7M34.js +90 -0
- package/dist/chunk-KUWNYCGL.js +4113 -0
- package/dist/chunk-KW56S7WF.js +67 -0
- package/dist/chunk-LAVHRER2.js +17 -0
- package/dist/chunk-LCZXAT4Q.js +58 -0
- package/dist/chunk-LFKTHNWI.js +83 -0
- package/dist/chunk-LGJWR5LX.js +164 -0
- package/dist/chunk-LLWK3OR6.js +169 -0
- package/dist/chunk-LQSLDDPT.js +67 -0
- package/dist/chunk-LR4ACD6E.js +86676 -0
- package/dist/chunk-LTBX54CI.js +11 -0
- package/dist/chunk-LXP7K6HL.js +817 -0
- package/dist/chunk-LXSBG6LK.js +18 -0
- package/dist/chunk-LZALOVO3.js +372 -0
- package/dist/chunk-M6SOYQJ6.js +39 -0
- package/dist/chunk-MAEP2UCK.js +110 -0
- package/dist/chunk-MG4GKUJW.js +31 -0
- package/dist/chunk-MWOKFNRO.js +446 -0
- package/dist/chunk-N2TQXB44.js +1280 -0
- package/dist/chunk-N5IUYCUZ.js +31 -0
- package/dist/chunk-NBMM2TZK.js +33 -0
- package/dist/chunk-NCMUZ6BQ.js +0 -0
- package/dist/chunk-NCYTM57J.js +160 -0
- package/dist/chunk-NIRWGTM3.js +1104 -0
- package/dist/chunk-NS5CHWOH.js +80 -0
- package/dist/chunk-NWQRHWE5.js +9461 -0
- package/dist/chunk-NXDFDEKP.js +0 -0
- package/dist/chunk-NZJGUN67.js +266 -0
- package/dist/chunk-NZN7PFPB.js +169 -0
- package/dist/chunk-O5HZRJPB.js +55 -0
- package/dist/chunk-O5VKW5FL.js +41 -0
- package/dist/chunk-O67KME6D.js +110 -0
- package/dist/chunk-ODBDAABQ.js +88 -0
- package/dist/chunk-OGYWOPHZ.js +96 -0
- package/dist/chunk-ORW4HNX5.js +357 -0
- package/dist/chunk-P3IZB24Y.js +109 -0
- package/dist/chunk-PHOCVOZ5.js +9 -0
- package/dist/chunk-PVZBDWLK.js +41 -0
- package/dist/chunk-PX675AEP.js +129 -0
- package/dist/chunk-PXYDR7WQ.js +48 -0
- package/dist/chunk-QDPLZDMX.js +17 -0
- package/dist/chunk-QG6PLWNH.js +106 -0
- package/dist/chunk-QSGR43JM.js +30 -0
- package/dist/chunk-RK5N3XIX.js +56 -0
- package/dist/chunk-RLMLYJDI.js +38 -0
- package/dist/chunk-RMXYSYK4.js +50 -0
- package/dist/chunk-RPIJY6TT.js +637 -0
- package/dist/chunk-RSBZREKG.js +144 -0
- package/dist/chunk-RXM4B6HR.js +8 -0
- package/dist/chunk-S2WEYEQR.js +14 -0
- package/dist/chunk-S4SVK5DE.js +39 -0
- package/dist/chunk-S6LPCNXQ.js +29 -0
- package/dist/chunk-SMQT3ZNO.js +8 -0
- package/dist/chunk-T435NFHC.js +490 -0
- package/dist/chunk-THHRRYRS.js +16 -0
- package/dist/chunk-TKGWSUEI.js +0 -0
- package/dist/chunk-TLE6YHGH.js +26 -0
- package/dist/chunk-TN4TIT7O.js +116 -0
- package/dist/chunk-TUJIAA5O.js +101 -0
- package/dist/chunk-U2EI2ZLM.js +32 -0
- package/dist/chunk-U2L77ZDR.js +17 -0
- package/dist/chunk-U2UCL2VG.js +369 -0
- package/dist/chunk-U2ZFCAPX.js +34 -0
- package/dist/chunk-U5MJIHLY.js +87 -0
- package/dist/chunk-U62GYN4A.js +227 -0
- package/dist/chunk-UM7ZR3VU.js +14 -0
- package/dist/chunk-UQITHKTH.js +342 -0
- package/dist/chunk-UZJ2NQSN.js +257 -0
- package/dist/chunk-UZWFZMOX.js +40 -0
- package/dist/chunk-V74Y5NIV.js +49 -0
- package/dist/chunk-VBMMWVB5.js +49 -0
- package/dist/chunk-VKOE5J66.js +31 -0
- package/dist/chunk-VOHEQ7B5.js +31 -0
- package/dist/chunk-VVTSF42Z.js +52 -0
- package/dist/chunk-VW56KWO2.js +9 -0
- package/dist/chunk-VWGKHDZ6.js +528 -0
- package/dist/chunk-W6Y3PPU5.js +73 -0
- package/dist/chunk-WCEMRNW4.js +6 -0
- package/dist/chunk-WDZFLCSQ.js +77 -0
- package/dist/chunk-WIYFXWRI.js +30 -0
- package/dist/chunk-WMA3WTCM.js +117 -0
- package/dist/chunk-WWANSDFM.js +175 -0
- package/dist/chunk-XBMLI2YI.js +85 -0
- package/dist/chunk-XBVIP2BA.js +609 -0
- package/dist/chunk-XCMR2HTV.js +102 -0
- package/dist/chunk-XFR5JLNF.js +44 -0
- package/dist/chunk-XL52SYWY.js +23 -0
- package/dist/chunk-XQNVC4Q7.js +212 -0
- package/dist/chunk-XSX255FK.js +12 -0
- package/dist/chunk-Y2M536WR.js +67 -0
- package/dist/chunk-Y456KVIN.js +116 -0
- package/dist/chunk-Y7QKP6QU.js +35 -0
- package/dist/chunk-YBZWO4ZV.js +57 -0
- package/dist/chunk-YGQUBTKR.js +81 -0
- package/dist/chunk-YGSM5PVN.js +170 -0
- package/dist/chunk-YVCBMOJG.js +50 -0
- package/dist/chunk-YWWUOGJA.js +62 -0
- package/dist/chunk-YXFG3M2D.js +792 -0
- package/dist/chunk-ZAUMHCIL.js +42 -0
- package/dist/chunk-ZDJWCSZ4.js +85 -0
- package/dist/chunk-ZQZHFMD7.js +19 -0
- package/dist/chunk-ZYNBKBY3.js +14 -0
- package/dist/collection-add-products-IUDEIUM5.js +284 -0
- package/dist/collection-create-AQ3GUG3G.js +133 -0
- package/dist/collection-detail-SDFALX6M.js +444 -0
- package/dist/collection-edit-AAHL2WFH.js +121 -0
- package/dist/collection-list-JGKC5EVM.js +228 -0
- package/dist/collection-metadata-YQWA2JTU.js +80 -0
- package/dist/customer-create-5VT2TB6S.js +183 -0
- package/dist/customer-create-address-ICEFEFD2.js +299 -0
- package/dist/customer-detail-CDELSJ77.js +695 -0
- package/dist/customer-edit-DZAD53JC.js +192 -0
- package/dist/customer-list-EIQP23FQ.js +152 -0
- package/dist/customer-metadata-ATAORBRN.js +81 -0
- package/dist/customers-add-customer-group-542PUCCT.js +308 -0
- package/dist/edit-inventory-item-P2HVULPA.js +152 -0
- package/dist/edit-inventory-item-attributes-V2HK3WTQ.js +323 -0
- package/dist/edit-reservation-LX2Z6KVD.js +246 -0
- package/dist/edit-rules-Q5UNWAUD.js +316 -0
- package/dist/home-I3OILW5Z.js +16 -0
- package/dist/index.css +6 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +4824 -0
- package/dist/inventory-create-FT7GL4RK.js +616 -0
- package/dist/inventory-detail-LNZ5QC67.js +771 -0
- package/dist/inventory-list-UXY7PU3N.js +432 -0
- package/dist/inventory-metadata-OYETRH5X.js +83 -0
- package/dist/inventory-stock-3MBERL3K.js +288 -0
- package/dist/invite-HJ7BRO6H.js +372 -0
- package/dist/location-create-ZVVQT2KP.js +238 -0
- package/dist/location-detail-A5SHPUQN.js +823 -0
- package/dist/location-edit-QSRHHDQ2.js +253 -0
- package/dist/location-fulfillment-providers-4HMT5L7L.js +289 -0
- package/dist/location-list-TC5FEN5R.js +346 -0
- package/dist/location-sales-channels-STDHWQSC.js +215 -0
- package/dist/location-service-zone-create-63LUYCJI.js +173 -0
- package/dist/location-service-zone-edit-UNXI5BQV.js +134 -0
- package/dist/location-service-zone-manage-areas-UMD6CZDZ.js +154 -0
- package/dist/location-service-zone-shipping-option-create-5L73SAGE.js +807 -0
- package/dist/location-service-zone-shipping-option-edit-2FEWQD6Y.js +362 -0
- package/dist/location-service-zone-shipping-option-pricing-QSB56QZD.js +362 -0
- package/dist/login-V4HZQTCQ.js +254 -0
- package/dist/manage-locations-NVHONEZE.js +249 -0
- package/dist/no-match-JLVLPCRH.js +33 -0
- package/dist/order-allocate-items-F7CXZQGX.js +558 -0
- package/dist/order-create-claim-GDVWGZJA.js +2203 -0
- package/dist/order-create-edit-6YYKYT66.js +936 -0
- package/dist/order-create-exchange-NLDIMGBG.js +2190 -0
- package/dist/order-create-fulfillment-EIYGSKXP.js +621 -0
- package/dist/order-create-refund-BBXEZNWA.js +403 -0
- package/dist/order-create-return-6TA5J3AW.js +1292 -0
- package/dist/order-create-shipment-T4C6UE2K.js +208 -0
- package/dist/order-detail-Y4EG3P5F.js +3846 -0
- package/dist/order-edit-billing-address-NNIFUC5C.js +400 -0
- package/dist/order-edit-email-VXOX62P6.js +171 -0
- package/dist/order-edit-shipping-address-WDKCQRRG.js +397 -0
- package/dist/order-list-XDOAXZXN.js +231 -0
- package/dist/order-metadata-S6N3GDOA.js +82 -0
- package/dist/order-receive-return-5VWUPWZJ.js +549 -0
- package/dist/order-request-transfer-VFSY5IFF.js +571 -0
- package/dist/price-list-configuration-GH67LL2N.js +356 -0
- package/dist/price-list-create-INX5HG7G.js +973 -0
- package/dist/price-list-detail-5LGPE67O.js +540 -0
- package/dist/price-list-edit-HRWPEIZI.js +227 -0
- package/dist/price-list-list-IXZVTXU5.js +228 -0
- package/dist/price-list-prices-add-QHE3TUTV.js +614 -0
- package/dist/price-list-prices-edit-TMVJ7S7J.js +326 -0
- package/dist/product-attributes-P7WFH4I2.js +358 -0
- package/dist/product-create-YC6MCJ2M.js +2305 -0
- package/dist/product-create-option-BNF2KKJM.js +144 -0
- package/dist/product-create-variant-SIJX7AE3.js +837 -0
- package/dist/product-detail-2GJ3PGHW.js +1638 -0
- package/dist/product-edit-YOGTWZ4I.js +397 -0
- package/dist/product-edit-option-4MUSMFS7.js +152 -0
- package/dist/product-export-5L4HNM3W.js +127 -0
- package/dist/product-import-Y54VG4AC.js +261 -0
- package/dist/product-list-EV2TS3Y4.js +313 -0
- package/dist/product-media-ZSMGHCNP.js +879 -0
- package/dist/product-metadata-572YVJH3.js +80 -0
- package/dist/product-organization-LVKRBJOQ.js +312 -0
- package/dist/product-prices-K5YM2TL6.js +266 -0
- package/dist/product-sales-channels-J3OH4NWX.js +157 -0
- package/dist/product-shipping-profile-NOOFEUBZ.js +146 -0
- package/dist/product-stock-J4LTIX64.js +540 -0
- package/dist/product-tag-create-5JJPPELP.js +122 -0
- package/dist/product-tag-detail-CGLCH3BJ.js +281 -0
- package/dist/product-tag-edit-OR7KSC7I.js +134 -0
- package/dist/product-tag-list-DY7GJUJQ.js +259 -0
- package/dist/product-tag-metadata-BFGPRMME.js +80 -0
- package/dist/product-type-create-FPVSGIKL.js +101 -0
- package/dist/product-type-detail-JYW2DAM4.js +242 -0
- package/dist/product-type-edit-FBT4Z4ZJ.js +113 -0
- package/dist/product-type-list-FK237DSQ.js +175 -0
- package/dist/product-type-metadata-SFJR5OQN.js +80 -0
- package/dist/product-variant-detail-6KPB3HL7.js +485 -0
- package/dist/product-variant-edit-QFHGNDW7.js +538 -0
- package/dist/product-variant-manage-inventory-items-ZEX2IW53.js +340 -0
- package/dist/product-variant-metadata-F45CSWU6.js +86 -0
- package/dist/profile-detail-LLXUNQOT.js +89 -0
- package/dist/profile-edit-UDYMDQLT.js +176 -0
- package/dist/promotion-add-campaign-U6X2FNWZ.js +43 -0
- package/dist/promotion-create-QB7E277L.js +1258 -0
- package/dist/promotion-detail-7D6D6PQ7.js +486 -0
- package/dist/promotion-edit-details-HYQJAZDF.js +512 -0
- package/dist/promotion-list-HTJ5GIWG.js +206 -0
- package/dist/refund-reason-create-LZCL6QJI.js +192 -0
- package/dist/refund-reason-edit-QNGFKZMN.js +192 -0
- package/dist/refund-reason-list-ZEKWYQ45.js +233 -0
- package/dist/region-add-countries-CWJ62VPK.js +226 -0
- package/dist/region-create-Z3JQFIKN.js +507 -0
- package/dist/region-detail-46R3HACJ.js +508 -0
- package/dist/region-edit-W5IVVP7Z.js +380 -0
- package/dist/region-list-DCU6NQFA.js +205 -0
- package/dist/region-metadata-VG5DLCOK.js +83 -0
- package/dist/reservation-create-VG5FSV3F.js +309 -0
- package/dist/reservation-detail-36BA3V2F.js +221 -0
- package/dist/reservation-list-R5UBPNI4.js +298 -0
- package/dist/reservation-metadata-KR4HOHTH.js +83 -0
- package/dist/reset-password-VZPICVMM.js +458 -0
- package/dist/return-reason-create-KTKI6NJE.js +165 -0
- package/dist/return-reason-edit-5KU7WKJF.js +168 -0
- package/dist/return-reason-list-HBSKNIMW.js +240 -0
- package/dist/sales-channel-add-products-6TUDLE4D.js +274 -0
- package/dist/sales-channel-create-2BTWSYIK.js +154 -0
- package/dist/sales-channel-detail-IQIQDN3L.js +437 -0
- package/dist/sales-channel-edit-YBNPALFT.js +163 -0
- package/dist/sales-channel-list-5KNN734B.js +193 -0
- package/dist/sales-channel-metadata-SVW6FYSV.js +88 -0
- package/dist/seller-details-HBVN4GGD.js +77 -0
- package/dist/seller-edit-OXDARXYJ.js +387 -0
- package/dist/seller-list-HG2VXA6V.js +192 -0
- package/dist/settings-D43GVDOO.js +19 -0
- package/dist/shipping-option-type-create-7KYU5NNF.js +195 -0
- package/dist/shipping-option-type-detail-4CNTT3MO.js +169 -0
- package/dist/shipping-option-type-edit-AN6IPVI6.js +191 -0
- package/dist/shipping-option-type-list-36ZS2QZO.js +266 -0
- package/dist/shipping-profile-create-3OWHNAOB.js +123 -0
- package/dist/shipping-profile-detail-WW7IVUVV.js +157 -0
- package/dist/shipping-profile-metadata-AD3DSZLR.js +84 -0
- package/dist/shipping-profiles-list-WOGGP7IT.js +241 -0
- package/dist/store-add-currencies-PIGEOZ4G.js +304 -0
- package/dist/store-detail-MFHPXBIN.js +525 -0
- package/dist/store-edit-WBF6EL5N.js +246 -0
- package/dist/store-metadata-LSK7UVSC.js +85 -0
- package/dist/tax-region-create-XTX4YWRA.js +300 -0
- package/dist/tax-region-detail-XUYJHBHI.js +320 -0
- package/dist/tax-region-edit-AC64YA64.js +162 -0
- package/dist/tax-region-list-XRAYDYK3.js +91 -0
- package/dist/tax-region-metadata-YDQX3Y4X.js +83 -0
- package/dist/tax-region-province-create-GDL65SQF.js +315 -0
- package/dist/tax-region-province-detail-QMPIKT7K.js +215 -0
- package/dist/tax-region-tax-override-create-X2QWOHSU.js +679 -0
- package/dist/tax-region-tax-override-edit-VZJ6EPSU.js +788 -0
- package/dist/tax-region-tax-rate-create-VC2WDVJJ.js +193 -0
- package/dist/tax-region-tax-rate-edit-SDW36H6I.js +192 -0
- package/dist/user-detail-IEIX24PZ.js +163 -0
- package/dist/user-edit-CJ7TNY3H.js +115 -0
- package/dist/user-invite-OTBYWV4L.js +389 -0
- package/dist/user-list-BJXFPTJ7.js +341 -0
- package/dist/user-metadata-ZLC6T6XH.js +83 -0
- package/package.json +87 -0
|
@@ -0,0 +1,807 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConditionalPriceForm,
|
|
3
|
+
ConditionalPriceSchema,
|
|
4
|
+
ShippingOptionPriceProvider,
|
|
5
|
+
buildShippingOptionPriceRules,
|
|
6
|
+
useShippingOptionPriceColumns
|
|
7
|
+
} from "./chunk-NIRWGTM3.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
|
+
SwitchBox
|
|
18
|
+
} from "./chunk-YVCBMOJG.js";
|
|
19
|
+
import {
|
|
20
|
+
useComboboxData
|
|
21
|
+
} from "./chunk-O67KME6D.js";
|
|
22
|
+
import {
|
|
23
|
+
Combobox
|
|
24
|
+
} from "./chunk-AW77UWCZ.js";
|
|
25
|
+
import {
|
|
26
|
+
DataGrid
|
|
27
|
+
} from "./chunk-KUWNYCGL.js";
|
|
28
|
+
import "./chunk-IQPN4PZJ.js";
|
|
29
|
+
import {
|
|
30
|
+
castNumber
|
|
31
|
+
} from "./chunk-SMQT3ZNO.js";
|
|
32
|
+
import "./chunk-TKGWSUEI.js";
|
|
33
|
+
import {
|
|
34
|
+
KeyboundForm
|
|
35
|
+
} from "./chunk-U2ZFCAPX.js";
|
|
36
|
+
import {
|
|
37
|
+
RouteFocusModal,
|
|
38
|
+
StackedFocusModal,
|
|
39
|
+
useRouteModal,
|
|
40
|
+
useStackedModal
|
|
41
|
+
} from "./chunk-MWOKFNRO.js";
|
|
42
|
+
import {
|
|
43
|
+
Form
|
|
44
|
+
} from "./chunk-3QSRE5LS.js";
|
|
45
|
+
import "./chunk-INNFZYX2.js";
|
|
46
|
+
import "./chunk-LAVHRER2.js";
|
|
47
|
+
import {
|
|
48
|
+
useDocumentDirection
|
|
49
|
+
} from "./chunk-Y7QKP6QU.js";
|
|
50
|
+
import "./chunk-ORW4HNX5.js";
|
|
51
|
+
import "./chunk-ODBDAABQ.js";
|
|
52
|
+
import "./chunk-YGQUBTKR.js";
|
|
53
|
+
import "./chunk-362QMJZM.js";
|
|
54
|
+
import "./chunk-FODCCP6C.js";
|
|
55
|
+
import "./chunk-AWZFIP25.js";
|
|
56
|
+
import "./chunk-2QKPRGNK.js";
|
|
57
|
+
import "./chunk-XBMLI2YI.js";
|
|
58
|
+
import "./chunk-XL52SYWY.js";
|
|
59
|
+
import "./chunk-NS5CHWOH.js";
|
|
60
|
+
import "./chunk-WDZFLCSQ.js";
|
|
61
|
+
import "./chunk-VVTSF42Z.js";
|
|
62
|
+
import "./chunk-D3KDXELJ.js";
|
|
63
|
+
import "./chunk-2MKZ4HD4.js";
|
|
64
|
+
import "./chunk-OGYWOPHZ.js";
|
|
65
|
+
import "./chunk-U62GYN4A.js";
|
|
66
|
+
import {
|
|
67
|
+
useCreateShippingOptions
|
|
68
|
+
} from "./chunk-KTKL7M34.js";
|
|
69
|
+
import "./chunk-JJVGCTKT.js";
|
|
70
|
+
import "./chunk-I43SCBL3.js";
|
|
71
|
+
import {
|
|
72
|
+
useFulfillmentProviderOptions,
|
|
73
|
+
useStockLocation
|
|
74
|
+
} from "./chunk-LLWK3OR6.js";
|
|
75
|
+
import "./chunk-HYUGYB23.js";
|
|
76
|
+
import "./chunk-XCMR2HTV.js";
|
|
77
|
+
import {
|
|
78
|
+
useRegions
|
|
79
|
+
} from "./chunk-CI5Z6FGV.js";
|
|
80
|
+
import {
|
|
81
|
+
useStore
|
|
82
|
+
} from "./chunk-LCZXAT4Q.js";
|
|
83
|
+
import {
|
|
84
|
+
usePricePreferences
|
|
85
|
+
} from "./chunk-S6LPCNXQ.js";
|
|
86
|
+
import "./chunk-T435NFHC.js";
|
|
87
|
+
import "./chunk-2KCF3ZIB.js";
|
|
88
|
+
import {
|
|
89
|
+
sdk
|
|
90
|
+
} from "./chunk-ZYNBKBY3.js";
|
|
91
|
+
import "./chunk-NBMM2TZK.js";
|
|
92
|
+
|
|
93
|
+
// src/pages/locations/location-service-zone-shipping-option-create/location-service-zone-shipping-option-create.tsx
|
|
94
|
+
import { useParams, useSearchParams } from "react-router-dom";
|
|
95
|
+
|
|
96
|
+
// src/pages/locations/location-service-zone-shipping-option-create/components/create-shipping-options-form/create-shipping-options-form.tsx
|
|
97
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
98
|
+
import { Button, ProgressTabs, toast } from "@medusajs/ui";
|
|
99
|
+
import { useForm, useWatch as useWatch2 } from "react-hook-form";
|
|
100
|
+
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
101
|
+
import { useState as useState2 } from "react";
|
|
102
|
+
|
|
103
|
+
// src/pages/locations/location-service-zone-shipping-option-create/components/create-shipping-options-form/create-shipping-option-details-form.tsx
|
|
104
|
+
import { Divider, Heading, Input, RadioGroup, Select, Text } from "@medusajs/ui";
|
|
105
|
+
import { useTranslation } from "react-i18next";
|
|
106
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
107
|
+
import { createElement } from "react";
|
|
108
|
+
var CreateShippingOptionDetailsForm = ({
|
|
109
|
+
form,
|
|
110
|
+
isReturn = false,
|
|
111
|
+
zone,
|
|
112
|
+
locationId,
|
|
113
|
+
fulfillmentProviderOptions,
|
|
114
|
+
selectedProviderId,
|
|
115
|
+
type
|
|
116
|
+
}) => {
|
|
117
|
+
const { t } = useTranslation();
|
|
118
|
+
const direction = useDocumentDirection();
|
|
119
|
+
const isPickup = type === "pickup" /* Pickup */;
|
|
120
|
+
const shippingProfiles = useComboboxData({
|
|
121
|
+
queryFn: (params) => sdk.admin.shippingProfile.list(params),
|
|
122
|
+
queryKey: ["shipping_profiles"],
|
|
123
|
+
getOptions: (data) => data.shipping_profiles.map((profile) => ({
|
|
124
|
+
label: profile.name,
|
|
125
|
+
value: profile.id
|
|
126
|
+
}))
|
|
127
|
+
});
|
|
128
|
+
const shippingOptionTypes = useComboboxData({
|
|
129
|
+
queryFn: (params) => sdk.admin.shippingOptionType.list(params),
|
|
130
|
+
queryKey: ["shipping_option_types"],
|
|
131
|
+
getOptions: (data) => data.shipping_option_types.map((type2) => ({
|
|
132
|
+
label: type2.label,
|
|
133
|
+
value: type2.id
|
|
134
|
+
}))
|
|
135
|
+
});
|
|
136
|
+
const fulfillmentProviders = useComboboxData({
|
|
137
|
+
queryFn: (params) => sdk.admin.fulfillmentProvider.list({
|
|
138
|
+
...params,
|
|
139
|
+
stock_location_id: locationId
|
|
140
|
+
}),
|
|
141
|
+
queryKey: ["fulfillment_providers"],
|
|
142
|
+
getOptions: (data) => data.fulfillment_providers.map((provider) => ({
|
|
143
|
+
label: formatProvider(provider.id),
|
|
144
|
+
value: provider.id
|
|
145
|
+
}))
|
|
146
|
+
});
|
|
147
|
+
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: [
|
|
148
|
+
/* @__PURE__ */ jsxs("div", { "data-testid": "location-shipping-option-create-details-form-header-section", children: [
|
|
149
|
+
/* @__PURE__ */ jsx(Heading, { "data-testid": "location-shipping-option-create-details-form-heading", children: t(
|
|
150
|
+
`stockLocations.shippingOptions.create.${isPickup ? "pickup" : isReturn ? "returns" : "shipping"}.header`,
|
|
151
|
+
{
|
|
152
|
+
zone: zone.name
|
|
153
|
+
}
|
|
154
|
+
) }),
|
|
155
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", "data-testid": "location-shipping-option-create-details-form-hint", children: t(
|
|
156
|
+
`stockLocations.shippingOptions.create.${isReturn ? "returns" : isPickup ? "pickup" : "shipping"}.hint`
|
|
157
|
+
) })
|
|
158
|
+
] }),
|
|
159
|
+
!isPickup && /* @__PURE__ */ jsx(
|
|
160
|
+
Form.Field,
|
|
161
|
+
{
|
|
162
|
+
control: form.control,
|
|
163
|
+
name: "price_type",
|
|
164
|
+
render: ({ field }) => {
|
|
165
|
+
return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "location-shipping-option-create-details-form-price-type-item", children: [
|
|
166
|
+
/* @__PURE__ */ jsx(Form.Label, { "data-testid": "location-shipping-option-create-details-form-price-type-label", children: t("stockLocations.shippingOptions.fields.priceType.label") }),
|
|
167
|
+
/* @__PURE__ */ jsx(Form.Control, { "data-testid": "location-shipping-option-create-details-form-price-type-control", children: /* @__PURE__ */ jsxs(
|
|
168
|
+
RadioGroup,
|
|
169
|
+
{
|
|
170
|
+
dir: direction,
|
|
171
|
+
className: "grid grid-cols-1 gap-4 md:grid-cols-2",
|
|
172
|
+
...field,
|
|
173
|
+
onValueChange: field.onChange,
|
|
174
|
+
"data-testid": "location-shipping-option-create-details-form-price-type-radio-group",
|
|
175
|
+
children: [
|
|
176
|
+
/* @__PURE__ */ jsx(
|
|
177
|
+
RadioGroup.ChoiceBox,
|
|
178
|
+
{
|
|
179
|
+
className: "flex-1",
|
|
180
|
+
value: "flat" /* FlatRate */,
|
|
181
|
+
label: t(
|
|
182
|
+
"stockLocations.shippingOptions.fields.priceType.options.fixed.label"
|
|
183
|
+
),
|
|
184
|
+
description: t(
|
|
185
|
+
"stockLocations.shippingOptions.fields.priceType.options.fixed.hint"
|
|
186
|
+
),
|
|
187
|
+
"data-testid": "location-shipping-option-create-details-form-price-type-flat-rate"
|
|
188
|
+
}
|
|
189
|
+
),
|
|
190
|
+
/* @__PURE__ */ jsx(
|
|
191
|
+
RadioGroup.ChoiceBox,
|
|
192
|
+
{
|
|
193
|
+
className: "flex-1",
|
|
194
|
+
value: "calculated" /* Calculated */,
|
|
195
|
+
label: t(
|
|
196
|
+
"stockLocations.shippingOptions.fields.priceType.options.calculated.label"
|
|
197
|
+
),
|
|
198
|
+
description: t(
|
|
199
|
+
"stockLocations.shippingOptions.fields.priceType.options.calculated.hint"
|
|
200
|
+
),
|
|
201
|
+
"data-testid": "location-shipping-option-create-details-form-price-type-calculated"
|
|
202
|
+
}
|
|
203
|
+
)
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
) }),
|
|
207
|
+
/* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "location-shipping-option-create-details-form-price-type-error" })
|
|
208
|
+
] });
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
213
|
+
/* @__PURE__ */ jsx(
|
|
214
|
+
Form.Field,
|
|
215
|
+
{
|
|
216
|
+
control: form.control,
|
|
217
|
+
name: "name",
|
|
218
|
+
render: ({ field }) => {
|
|
219
|
+
return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "location-shipping-option-create-details-form-name-item", children: [
|
|
220
|
+
/* @__PURE__ */ jsx(Form.Label, { "data-testid": "location-shipping-option-create-details-form-name-label", children: t("fields.name") }),
|
|
221
|
+
/* @__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" }) }),
|
|
222
|
+
/* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "location-shipping-option-create-details-form-name-error" })
|
|
223
|
+
] });
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
),
|
|
227
|
+
/* @__PURE__ */ jsx(
|
|
228
|
+
Form.Field,
|
|
229
|
+
{
|
|
230
|
+
control: form.control,
|
|
231
|
+
name: "shipping_profile_id",
|
|
232
|
+
render: ({ field }) => {
|
|
233
|
+
return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "location-shipping-option-create-details-form-shipping-profile-item", children: [
|
|
234
|
+
/* @__PURE__ */ jsx(Form.Label, { "data-testid": "location-shipping-option-create-details-form-shipping-profile-label", children: t("stockLocations.shippingOptions.fields.profile") }),
|
|
235
|
+
/* @__PURE__ */ jsx(Form.Control, { "data-testid": "location-shipping-option-create-details-form-shipping-profile-control", children: /* @__PURE__ */ jsx(
|
|
236
|
+
Combobox,
|
|
237
|
+
{
|
|
238
|
+
...field,
|
|
239
|
+
options: shippingProfiles.options,
|
|
240
|
+
searchValue: shippingProfiles.searchValue,
|
|
241
|
+
onSearchValueChange: shippingProfiles.onSearchValueChange,
|
|
242
|
+
disabled: shippingProfiles.disabled,
|
|
243
|
+
"data-testid": "location-shipping-option-create-details-form-shipping-profile-combobox"
|
|
244
|
+
}
|
|
245
|
+
) }),
|
|
246
|
+
/* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "location-shipping-option-create-details-form-shipping-profile-error" })
|
|
247
|
+
] });
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
),
|
|
251
|
+
/* @__PURE__ */ jsx(
|
|
252
|
+
Form.Field,
|
|
253
|
+
{
|
|
254
|
+
control: form.control,
|
|
255
|
+
name: "shipping_option_type_id",
|
|
256
|
+
render: ({ field }) => {
|
|
257
|
+
return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "location-shipping-option-create-details-form-shipping-option-type-item", children: [
|
|
258
|
+
/* @__PURE__ */ jsx(Form.Label, { "data-testid": "location-shipping-option-create-details-form-shipping-option-type-label", children: t("stockLocations.shippingOptions.fields.type") }),
|
|
259
|
+
/* @__PURE__ */ jsx(Form.Control, { "data-testid": "location-shipping-option-create-details-form-shipping-option-type-control", children: /* @__PURE__ */ jsx(
|
|
260
|
+
Combobox,
|
|
261
|
+
{
|
|
262
|
+
...field,
|
|
263
|
+
options: shippingOptionTypes.options,
|
|
264
|
+
searchValue: shippingOptionTypes.searchValue,
|
|
265
|
+
onSearchValueChange: shippingOptionTypes.onSearchValueChange,
|
|
266
|
+
disabled: shippingOptionTypes.disabled,
|
|
267
|
+
"data-testid": "location-shipping-option-create-details-form-shipping-option-type-combobox"
|
|
268
|
+
}
|
|
269
|
+
) }),
|
|
270
|
+
/* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "location-shipping-option-create-details-form-shipping-option-type-error" })
|
|
271
|
+
] });
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
)
|
|
275
|
+
] }),
|
|
276
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
277
|
+
/* @__PURE__ */ jsx(
|
|
278
|
+
Form.Field,
|
|
279
|
+
{
|
|
280
|
+
control: form.control,
|
|
281
|
+
name: "provider_id",
|
|
282
|
+
render: ({ field }) => {
|
|
283
|
+
return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "location-shipping-option-create-details-form-provider-item", children: [
|
|
284
|
+
/* @__PURE__ */ jsx(
|
|
285
|
+
Form.Label,
|
|
286
|
+
{
|
|
287
|
+
tooltip: t(
|
|
288
|
+
"stockLocations.fulfillmentProviders.shippingOptionsTooltip"
|
|
289
|
+
),
|
|
290
|
+
"data-testid": "location-shipping-option-create-details-form-provider-label",
|
|
291
|
+
children: t("stockLocations.shippingOptions.fields.provider")
|
|
292
|
+
}
|
|
293
|
+
),
|
|
294
|
+
/* @__PURE__ */ jsx(Form.Control, { "data-testid": "location-shipping-option-create-details-form-provider-control", children: /* @__PURE__ */ jsx(
|
|
295
|
+
Combobox,
|
|
296
|
+
{
|
|
297
|
+
...field,
|
|
298
|
+
onChange: (e) => {
|
|
299
|
+
field.onChange(e);
|
|
300
|
+
form.setValue("fulfillment_option_id", "");
|
|
301
|
+
},
|
|
302
|
+
options: fulfillmentProviders.options,
|
|
303
|
+
searchValue: fulfillmentProviders.searchValue,
|
|
304
|
+
onSearchValueChange: fulfillmentProviders.onSearchValueChange,
|
|
305
|
+
disabled: fulfillmentProviders.disabled,
|
|
306
|
+
"data-testid": "location-shipping-option-create-details-form-provider-combobox"
|
|
307
|
+
}
|
|
308
|
+
) }),
|
|
309
|
+
/* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "location-shipping-option-create-details-form-provider-error" })
|
|
310
|
+
] });
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
),
|
|
314
|
+
/* @__PURE__ */ jsx(
|
|
315
|
+
Form.Field,
|
|
316
|
+
{
|
|
317
|
+
control: form.control,
|
|
318
|
+
name: "fulfillment_option_id",
|
|
319
|
+
render: ({ field }) => {
|
|
320
|
+
return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "location-shipping-option-create-details-form-fulfillment-option-item", children: [
|
|
321
|
+
/* @__PURE__ */ jsx(Form.Label, { "data-testid": "location-shipping-option-create-details-form-fulfillment-option-label", children: t(
|
|
322
|
+
"stockLocations.shippingOptions.fields.fulfillmentOption"
|
|
323
|
+
) }),
|
|
324
|
+
/* @__PURE__ */ jsx(Form.Control, { "data-testid": "location-shipping-option-create-details-form-fulfillment-option-control", children: /* @__PURE__ */ createElement(
|
|
325
|
+
Select,
|
|
326
|
+
{
|
|
327
|
+
dir: direction,
|
|
328
|
+
...field,
|
|
329
|
+
onValueChange: field.onChange,
|
|
330
|
+
disabled: !selectedProviderId,
|
|
331
|
+
key: selectedProviderId,
|
|
332
|
+
"data-testid": "location-shipping-option-create-details-form-fulfillment-option-select"
|
|
333
|
+
},
|
|
334
|
+
/* @__PURE__ */ jsx(Select.Trigger, { ref: field.ref, "data-testid": "location-shipping-option-create-details-form-fulfillment-option-trigger", children: /* @__PURE__ */ jsx(Select.Value, {}) }),
|
|
335
|
+
/* @__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)) })
|
|
336
|
+
) }),
|
|
337
|
+
/* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "location-shipping-option-create-details-form-fulfillment-option-error" })
|
|
338
|
+
] });
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
)
|
|
342
|
+
] }),
|
|
343
|
+
/* @__PURE__ */ jsx(Divider, {}),
|
|
344
|
+
/* @__PURE__ */ jsx(
|
|
345
|
+
SwitchBox,
|
|
346
|
+
{
|
|
347
|
+
control: form.control,
|
|
348
|
+
name: "enabled_in_store",
|
|
349
|
+
label: t("stockLocations.shippingOptions.fields.enableInStore.label"),
|
|
350
|
+
description: t(
|
|
351
|
+
"stockLocations.shippingOptions.fields.enableInStore.hint"
|
|
352
|
+
),
|
|
353
|
+
"data-testid": "location-shipping-option-create-details-form-enabled-in-store"
|
|
354
|
+
}
|
|
355
|
+
)
|
|
356
|
+
] }) });
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
// src/pages/locations/location-service-zone-shipping-option-create/components/create-shipping-options-form/create-shipping-options-prices-form.tsx
|
|
360
|
+
import { useEffect, useMemo, useState } from "react";
|
|
361
|
+
import { useWatch } from "react-hook-form";
|
|
362
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
363
|
+
var CreateShippingOptionsPricesForm = ({
|
|
364
|
+
form,
|
|
365
|
+
type
|
|
366
|
+
}) => {
|
|
367
|
+
const isPickup = type === "pickup" /* Pickup */;
|
|
368
|
+
const { getIsOpen, setIsOpen } = useStackedModal();
|
|
369
|
+
const [selectedPrice, setSelectedPrice] = useState(null);
|
|
370
|
+
const onOpenConditionalPricesModal = (info) => {
|
|
371
|
+
setIsOpen(CONDITIONAL_PRICES_STACKED_MODAL_ID, true);
|
|
372
|
+
setSelectedPrice(info);
|
|
373
|
+
};
|
|
374
|
+
const onCloseConditionalPricesModal = () => {
|
|
375
|
+
setIsOpen(CONDITIONAL_PRICES_STACKED_MODAL_ID, false);
|
|
376
|
+
setSelectedPrice(null);
|
|
377
|
+
};
|
|
378
|
+
const {
|
|
379
|
+
store,
|
|
380
|
+
isLoading: isStoreLoading,
|
|
381
|
+
isError: isStoreError,
|
|
382
|
+
error: storeError
|
|
383
|
+
} = useStore();
|
|
384
|
+
const currencies = useMemo(
|
|
385
|
+
() => store?.supported_currencies?.map((c) => c.currency_code) || [],
|
|
386
|
+
[store]
|
|
387
|
+
);
|
|
388
|
+
const {
|
|
389
|
+
regions,
|
|
390
|
+
isLoading: isRegionsLoading,
|
|
391
|
+
isError: isRegionsError,
|
|
392
|
+
error: regionsError
|
|
393
|
+
} = useRegions({
|
|
394
|
+
fields: "id,name,currency_code",
|
|
395
|
+
limit: 999
|
|
396
|
+
});
|
|
397
|
+
const { price_preferences: pricePreferences } = usePricePreferences({});
|
|
398
|
+
const { setCloseOnEscape } = useRouteModal();
|
|
399
|
+
const name = useWatch({ control: form.control, name: "name" });
|
|
400
|
+
const columns = useShippingOptionPriceColumns({
|
|
401
|
+
name,
|
|
402
|
+
currencies,
|
|
403
|
+
regions,
|
|
404
|
+
pricePreferences
|
|
405
|
+
});
|
|
406
|
+
const isLoading = isStoreLoading || !store || isRegionsLoading || !regions;
|
|
407
|
+
const data = useMemo(
|
|
408
|
+
() => [[...currencies || [], ...regions || []]],
|
|
409
|
+
[currencies, regions]
|
|
410
|
+
);
|
|
411
|
+
useEffect(() => {
|
|
412
|
+
if (!isLoading && isPickup) {
|
|
413
|
+
if (currencies.length > 0) {
|
|
414
|
+
currencies.forEach((currency) => {
|
|
415
|
+
form.setValue(`currency_prices.${currency}`, "0");
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
if (regions.length > 0) {
|
|
419
|
+
regions.forEach((region) => {
|
|
420
|
+
form.setValue(`region_prices.${region.id}`, "0");
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}, [isLoading, isPickup]);
|
|
425
|
+
if (isStoreError) {
|
|
426
|
+
throw storeError;
|
|
427
|
+
}
|
|
428
|
+
if (isRegionsError) {
|
|
429
|
+
throw regionsError;
|
|
430
|
+
}
|
|
431
|
+
return /* @__PURE__ */ jsx2(
|
|
432
|
+
StackedFocusModal,
|
|
433
|
+
{
|
|
434
|
+
id: CONDITIONAL_PRICES_STACKED_MODAL_ID,
|
|
435
|
+
onOpenChangeCallback: (open) => {
|
|
436
|
+
if (!open) {
|
|
437
|
+
setSelectedPrice(null);
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
"data-testid": "location-shipping-option-create-prices-form",
|
|
441
|
+
children: /* @__PURE__ */ jsx2(
|
|
442
|
+
ShippingOptionPriceProvider,
|
|
443
|
+
{
|
|
444
|
+
onOpenConditionalPricesModal,
|
|
445
|
+
onCloseConditionalPricesModal,
|
|
446
|
+
children: /* @__PURE__ */ jsxs2("div", { className: "flex size-full flex-col divide-y overflow-hidden", "data-testid": "location-shipping-option-create-prices-form-container", children: [
|
|
447
|
+
/* @__PURE__ */ jsx2(
|
|
448
|
+
DataGrid,
|
|
449
|
+
{
|
|
450
|
+
isLoading,
|
|
451
|
+
data,
|
|
452
|
+
columns,
|
|
453
|
+
state: form,
|
|
454
|
+
onEditingChange: (editing) => setCloseOnEscape(!editing),
|
|
455
|
+
disableInteractions: getIsOpen(CONDITIONAL_PRICES_STACKED_MODAL_ID),
|
|
456
|
+
"data-testid": "location-shipping-option-create-prices-form-data-grid"
|
|
457
|
+
}
|
|
458
|
+
),
|
|
459
|
+
selectedPrice && /* @__PURE__ */ jsx2(ConditionalPriceForm, { info: selectedPrice, variant: "create" })
|
|
460
|
+
] })
|
|
461
|
+
}
|
|
462
|
+
)
|
|
463
|
+
}
|
|
464
|
+
);
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
// src/pages/locations/location-service-zone-shipping-option-create/components/create-shipping-options-form/schema.ts
|
|
468
|
+
import { z } from "zod";
|
|
469
|
+
var CreateShippingOptionDetailsSchema = z.object({
|
|
470
|
+
name: z.string().min(1),
|
|
471
|
+
price_type: z.nativeEnum(ShippingOptionPriceType),
|
|
472
|
+
enabled_in_store: z.boolean(),
|
|
473
|
+
shipping_profile_id: z.string().min(1),
|
|
474
|
+
provider_id: z.string().min(1),
|
|
475
|
+
fulfillment_option_id: z.string().min(1),
|
|
476
|
+
shipping_option_type_id: z.string().min(1)
|
|
477
|
+
});
|
|
478
|
+
var ShippingOptionConditionalPriceSchema = z.object({
|
|
479
|
+
conditional_region_prices: z.record(
|
|
480
|
+
z.string(),
|
|
481
|
+
z.array(ConditionalPriceSchema).optional()
|
|
482
|
+
),
|
|
483
|
+
conditional_currency_prices: z.record(
|
|
484
|
+
z.string(),
|
|
485
|
+
z.array(ConditionalPriceSchema).optional()
|
|
486
|
+
)
|
|
487
|
+
});
|
|
488
|
+
var CreateShippingOptionSchema = z.object({
|
|
489
|
+
region_prices: z.record(z.string(), z.string().optional()),
|
|
490
|
+
currency_prices: z.record(z.string(), z.string().optional())
|
|
491
|
+
}).merge(CreateShippingOptionDetailsSchema).merge(ShippingOptionConditionalPriceSchema);
|
|
492
|
+
|
|
493
|
+
// src/pages/locations/location-service-zone-shipping-option-create/components/create-shipping-options-form/create-shipping-options-form.tsx
|
|
494
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
495
|
+
function CreateShippingOptionsForm({
|
|
496
|
+
zone,
|
|
497
|
+
isReturn,
|
|
498
|
+
locationId,
|
|
499
|
+
type
|
|
500
|
+
}) {
|
|
501
|
+
const [activeTab, setActiveTab] = useState2("details" /* DETAILS */);
|
|
502
|
+
const [validDetails, setValidDetails] = useState2(false);
|
|
503
|
+
const { t } = useTranslation2();
|
|
504
|
+
const { handleSuccess } = useRouteModal();
|
|
505
|
+
const direction = useDocumentDirection();
|
|
506
|
+
const form = useForm({
|
|
507
|
+
defaultValues: {
|
|
508
|
+
name: "",
|
|
509
|
+
price_type: "flat" /* FlatRate */,
|
|
510
|
+
enabled_in_store: true,
|
|
511
|
+
shipping_profile_id: "",
|
|
512
|
+
provider_id: "",
|
|
513
|
+
fulfillment_option_id: "",
|
|
514
|
+
region_prices: {},
|
|
515
|
+
currency_prices: {},
|
|
516
|
+
conditional_region_prices: {},
|
|
517
|
+
conditional_currency_prices: {}
|
|
518
|
+
},
|
|
519
|
+
resolver: zodResolver(CreateShippingOptionSchema)
|
|
520
|
+
});
|
|
521
|
+
const selectedProviderId = useWatch2({
|
|
522
|
+
control: form.control,
|
|
523
|
+
name: "provider_id"
|
|
524
|
+
});
|
|
525
|
+
const { fulfillment_options: fulfillmentProviderOptions } = useFulfillmentProviderOptions(selectedProviderId, {
|
|
526
|
+
enabled: !!selectedProviderId
|
|
527
|
+
});
|
|
528
|
+
const isCalculatedPriceType = form.watch("price_type") === "calculated" /* Calculated */;
|
|
529
|
+
const { mutateAsync, isPending: isLoading } = useCreateShippingOptions();
|
|
530
|
+
const handleSubmit = form.handleSubmit(async (data) => {
|
|
531
|
+
const currencyPrices = Object.entries(data.currency_prices).map(([code, value]) => {
|
|
532
|
+
if (!value) {
|
|
533
|
+
return void 0;
|
|
534
|
+
}
|
|
535
|
+
return {
|
|
536
|
+
currency_code: code,
|
|
537
|
+
amount: castNumber(value)
|
|
538
|
+
};
|
|
539
|
+
}).filter((p) => !!p);
|
|
540
|
+
const regionPrices = Object.entries(data.region_prices).map(([region_id, value]) => {
|
|
541
|
+
if (!value) {
|
|
542
|
+
return void 0;
|
|
543
|
+
}
|
|
544
|
+
return {
|
|
545
|
+
region_id,
|
|
546
|
+
amount: castNumber(value)
|
|
547
|
+
};
|
|
548
|
+
}).filter((p) => !!p);
|
|
549
|
+
const conditionalRegionPrices = Object.entries(
|
|
550
|
+
data.conditional_region_prices
|
|
551
|
+
).flatMap(([region_id, value]) => {
|
|
552
|
+
const prices = value?.map((rule) => ({
|
|
553
|
+
region_id,
|
|
554
|
+
amount: castNumber(rule.amount),
|
|
555
|
+
rules: buildShippingOptionPriceRules(rule)
|
|
556
|
+
})) || [];
|
|
557
|
+
return prices?.filter(Boolean);
|
|
558
|
+
});
|
|
559
|
+
const conditionalCurrencyPrices = Object.entries(
|
|
560
|
+
data.conditional_currency_prices
|
|
561
|
+
).flatMap(([currency_code, value]) => {
|
|
562
|
+
const prices = value?.map((rule) => ({
|
|
563
|
+
currency_code,
|
|
564
|
+
amount: castNumber(rule.amount),
|
|
565
|
+
rules: buildShippingOptionPriceRules(rule)
|
|
566
|
+
})) || [];
|
|
567
|
+
return prices?.filter(Boolean);
|
|
568
|
+
});
|
|
569
|
+
const allPrices = [
|
|
570
|
+
...currencyPrices,
|
|
571
|
+
...conditionalCurrencyPrices,
|
|
572
|
+
...regionPrices,
|
|
573
|
+
...conditionalRegionPrices
|
|
574
|
+
];
|
|
575
|
+
const fulfillmentOptionData = fulfillmentProviderOptions?.find(
|
|
576
|
+
(fo) => fo.id === data.fulfillment_option_id
|
|
577
|
+
);
|
|
578
|
+
await mutateAsync(
|
|
579
|
+
{
|
|
580
|
+
name: data.name,
|
|
581
|
+
price_type: data.price_type,
|
|
582
|
+
service_zone_id: zone.id,
|
|
583
|
+
shipping_profile_id: data.shipping_profile_id,
|
|
584
|
+
provider_id: data.provider_id,
|
|
585
|
+
prices: allPrices,
|
|
586
|
+
data: fulfillmentOptionData,
|
|
587
|
+
rules: [
|
|
588
|
+
{
|
|
589
|
+
// eslint-disable-next-line
|
|
590
|
+
value: isReturn ? "true" : "false",
|
|
591
|
+
attribute: "is_return",
|
|
592
|
+
operator: "eq"
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
// eslint-disable-next-line
|
|
596
|
+
value: data.enabled_in_store ? "true" : "false",
|
|
597
|
+
attribute: "enabled_in_store",
|
|
598
|
+
operator: "eq"
|
|
599
|
+
}
|
|
600
|
+
],
|
|
601
|
+
type_id: data.shipping_option_type_id
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
onSuccess: ({ shipping_option }) => {
|
|
605
|
+
toast.success(
|
|
606
|
+
t(
|
|
607
|
+
`stockLocations.shippingOptions.create.${isReturn ? "returns" : "shipping"}.successToast`,
|
|
608
|
+
{ name: shipping_option.name }
|
|
609
|
+
)
|
|
610
|
+
);
|
|
611
|
+
handleSuccess(`/settings/locations/${locationId}`);
|
|
612
|
+
},
|
|
613
|
+
onError: (e) => {
|
|
614
|
+
toast.error(e.message);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
);
|
|
618
|
+
});
|
|
619
|
+
const onTabChange = (tab) => {
|
|
620
|
+
if (tab === "pricing" /* PRICING */) {
|
|
621
|
+
form.clearErrors();
|
|
622
|
+
const result = CreateShippingOptionDetailsSchema.safeParse({
|
|
623
|
+
...form.getValues()
|
|
624
|
+
});
|
|
625
|
+
if (!result.success) {
|
|
626
|
+
const [firstError, ...rest] = result.error.errors;
|
|
627
|
+
for (const error of rest) {
|
|
628
|
+
const _path = error.path.join(".");
|
|
629
|
+
form.setError(_path, {
|
|
630
|
+
message: error.message,
|
|
631
|
+
type: error.code
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
form.setError(
|
|
635
|
+
firstError.path.join("."),
|
|
636
|
+
{
|
|
637
|
+
message: firstError.message,
|
|
638
|
+
type: firstError.code
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
shouldFocus: true
|
|
642
|
+
}
|
|
643
|
+
);
|
|
644
|
+
setValidDetails(false);
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
setValidDetails(true);
|
|
648
|
+
}
|
|
649
|
+
setActiveTab(tab);
|
|
650
|
+
};
|
|
651
|
+
const pricesStatus = form.getFieldState("currency_prices")?.isDirty || form.getFieldState("region_prices")?.isDirty || activeTab === "pricing" /* PRICING */ ? "in-progress" : "not-started";
|
|
652
|
+
const detailsStatus = validDetails ? "completed" : "in-progress";
|
|
653
|
+
return /* @__PURE__ */ jsx3(RouteFocusModal.Form, { form, "data-testid": "location-shipping-option-create-form", children: /* @__PURE__ */ jsx3(
|
|
654
|
+
KeyboundForm,
|
|
655
|
+
{
|
|
656
|
+
className: "flex h-full flex-col",
|
|
657
|
+
onSubmit: handleSubmit,
|
|
658
|
+
onKeyDown: (e) => {
|
|
659
|
+
const isEnterKey = e.key === "Enter";
|
|
660
|
+
const isModifierPressed = e.metaKey || e.ctrlKey;
|
|
661
|
+
const shouldContinueToPricing = activeTab !== "pricing" /* PRICING */ && !isCalculatedPriceType;
|
|
662
|
+
if (!isEnterKey) {
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
e.preventDefault();
|
|
666
|
+
if (!isModifierPressed) {
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
if (shouldContinueToPricing) {
|
|
670
|
+
e.stopPropagation();
|
|
671
|
+
onTabChange("pricing" /* PRICING */);
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
handleSubmit();
|
|
675
|
+
},
|
|
676
|
+
children: /* @__PURE__ */ jsxs3(
|
|
677
|
+
ProgressTabs,
|
|
678
|
+
{
|
|
679
|
+
dir: direction,
|
|
680
|
+
value: activeTab,
|
|
681
|
+
className: "flex h-full flex-col overflow-hidden",
|
|
682
|
+
onValueChange: (tab) => onTabChange(tab),
|
|
683
|
+
"data-testid": "location-shipping-option-create-progress-tabs",
|
|
684
|
+
children: [
|
|
685
|
+
/* @__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: [
|
|
686
|
+
/* @__PURE__ */ jsx3(
|
|
687
|
+
ProgressTabs.Trigger,
|
|
688
|
+
{
|
|
689
|
+
value: "details" /* DETAILS */,
|
|
690
|
+
status: detailsStatus,
|
|
691
|
+
className: "w-full max-w-[200px]",
|
|
692
|
+
"data-testid": "location-shipping-option-create-details-tab",
|
|
693
|
+
children: /* @__PURE__ */ jsx3("span", { className: "w-full cursor-auto overflow-hidden text-ellipsis whitespace-nowrap", children: t("stockLocations.shippingOptions.create.tabs.details") })
|
|
694
|
+
}
|
|
695
|
+
),
|
|
696
|
+
!isCalculatedPriceType && /* @__PURE__ */ jsx3(
|
|
697
|
+
ProgressTabs.Trigger,
|
|
698
|
+
{
|
|
699
|
+
value: "pricing" /* PRICING */,
|
|
700
|
+
status: pricesStatus,
|
|
701
|
+
className: "w-full max-w-[200px]",
|
|
702
|
+
"data-testid": "location-shipping-option-create-pricing-tab",
|
|
703
|
+
children: /* @__PURE__ */ jsx3("span", { className: "w-full overflow-hidden text-ellipsis whitespace-nowrap", children: t("stockLocations.shippingOptions.create.tabs.prices") })
|
|
704
|
+
}
|
|
705
|
+
)
|
|
706
|
+
] }) }),
|
|
707
|
+
/* @__PURE__ */ jsxs3(RouteFocusModal.Body, { className: "size-full overflow-hidden", "data-testid": "location-shipping-option-create-form-body", children: [
|
|
708
|
+
/* @__PURE__ */ jsx3(
|
|
709
|
+
ProgressTabs.Content,
|
|
710
|
+
{
|
|
711
|
+
value: "details" /* DETAILS */,
|
|
712
|
+
className: "size-full overflow-y-auto",
|
|
713
|
+
"data-testid": "location-shipping-option-create-details-tab-content",
|
|
714
|
+
children: /* @__PURE__ */ jsx3(
|
|
715
|
+
CreateShippingOptionDetailsForm,
|
|
716
|
+
{
|
|
717
|
+
form,
|
|
718
|
+
zone,
|
|
719
|
+
isReturn,
|
|
720
|
+
type,
|
|
721
|
+
locationId,
|
|
722
|
+
fulfillmentProviderOptions: fulfillmentProviderOptions || [],
|
|
723
|
+
selectedProviderId
|
|
724
|
+
}
|
|
725
|
+
)
|
|
726
|
+
}
|
|
727
|
+
),
|
|
728
|
+
/* @__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 }) })
|
|
729
|
+
] }),
|
|
730
|
+
/* @__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: [
|
|
731
|
+
/* @__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") }) }),
|
|
732
|
+
activeTab === "pricing" /* PRICING */ || isCalculatedPriceType ? /* @__PURE__ */ jsx3(
|
|
733
|
+
Button,
|
|
734
|
+
{
|
|
735
|
+
size: "small",
|
|
736
|
+
className: "whitespace-nowrap",
|
|
737
|
+
isLoading,
|
|
738
|
+
type: "submit",
|
|
739
|
+
"data-testid": "location-shipping-option-create-form-save-button",
|
|
740
|
+
children: t("actions.save")
|
|
741
|
+
},
|
|
742
|
+
"submit-btn"
|
|
743
|
+
) : /* @__PURE__ */ jsx3(
|
|
744
|
+
Button,
|
|
745
|
+
{
|
|
746
|
+
size: "small",
|
|
747
|
+
className: "whitespace-nowrap",
|
|
748
|
+
isLoading,
|
|
749
|
+
onClick: () => onTabChange("pricing" /* PRICING */),
|
|
750
|
+
type: "button",
|
|
751
|
+
"data-testid": "location-shipping-option-create-form-continue-button",
|
|
752
|
+
children: t("actions.continue")
|
|
753
|
+
},
|
|
754
|
+
"continue-btn"
|
|
755
|
+
)
|
|
756
|
+
] }) })
|
|
757
|
+
]
|
|
758
|
+
}
|
|
759
|
+
)
|
|
760
|
+
}
|
|
761
|
+
) });
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
// src/pages/locations/location-service-zone-shipping-option-create/constants.ts
|
|
765
|
+
var LOC_CREATE_SHIPPING_OPTION_FIELDS = "*fulfillment_sets,*fulfillment_sets.service_zones,*fulfillment_sets.service_zones.shipping_options";
|
|
766
|
+
|
|
767
|
+
// src/pages/locations/location-service-zone-shipping-option-create/location-service-zone-shipping-option-create.tsx
|
|
768
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
769
|
+
function LocationServiceZoneShippingOptionCreate() {
|
|
770
|
+
const { location_id, fset_id, zone_id } = useParams();
|
|
771
|
+
const [searchParams] = useSearchParams();
|
|
772
|
+
const isReturn = searchParams.has("is_return");
|
|
773
|
+
const { stock_location, isPending, isFetching, isError, error } = useStockLocation(location_id, {
|
|
774
|
+
fields: LOC_CREATE_SHIPPING_OPTION_FIELDS
|
|
775
|
+
});
|
|
776
|
+
const fulfillmentSet = stock_location?.fulfillment_sets?.find(
|
|
777
|
+
(f) => f.id === fset_id
|
|
778
|
+
);
|
|
779
|
+
if (!isPending && !isFetching && !fulfillmentSet) {
|
|
780
|
+
throw new Response(
|
|
781
|
+
JSON.stringify({ message: `Fulfillment set with ID ${fset_id} was not found` }),
|
|
782
|
+
{ status: 404, headers: { "Content-Type": "application/json" } }
|
|
783
|
+
);
|
|
784
|
+
}
|
|
785
|
+
const zone = fulfillmentSet?.service_zones?.find((z2) => z2.id === zone_id);
|
|
786
|
+
if (!isPending && !isFetching && !zone) {
|
|
787
|
+
throw new Response(
|
|
788
|
+
JSON.stringify({ message: `Service zone with ID ${zone_id} was not found` }),
|
|
789
|
+
{ status: 404, headers: { "Content-Type": "application/json" } }
|
|
790
|
+
);
|
|
791
|
+
}
|
|
792
|
+
if (isError) {
|
|
793
|
+
throw error;
|
|
794
|
+
}
|
|
795
|
+
return /* @__PURE__ */ jsx4(RouteFocusModal, { prev: `/settings/locations/${location_id}`, "data-testid": "location-shipping-option-create-modal", children: zone && /* @__PURE__ */ jsx4(
|
|
796
|
+
CreateShippingOptionsForm,
|
|
797
|
+
{
|
|
798
|
+
zone,
|
|
799
|
+
isReturn,
|
|
800
|
+
locationId: location_id,
|
|
801
|
+
type: fulfillmentSet.type
|
|
802
|
+
}
|
|
803
|
+
) });
|
|
804
|
+
}
|
|
805
|
+
export {
|
|
806
|
+
LocationServiceZoneShippingOptionCreate as Component
|
|
807
|
+
};
|