@mercurjs/admin 2.0.0-canary.100
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-CQDZBX3V.js +266 -0
- package/dist/adjust-inventory-3GPDYI3V.js +266 -0
- package/dist/api-key-management-create-GUNLFGNT.js +283 -0
- package/dist/api-key-management-detail-4IL3BQJW.js +87 -0
- package/dist/api-key-management-edit-SIXXFLNP.js +107 -0
- package/dist/api-key-management-list-XLRD4ASE.js +34 -0
- package/dist/api-key-management-sales-channels-GCUMV6YA.js +202 -0
- package/dist/campaign-budget-edit-GAP5KUI3.js +148 -0
- package/dist/campaign-configuration-LTHPZGYC.js +155 -0
- package/dist/campaign-create-TRNE6L26.js +30 -0
- package/dist/campaign-detail-GYMMDRUV.js +106 -0
- package/dist/campaign-edit-CRQCVEFT.js +207 -0
- package/dist/campaign-list-WEKSY62X.js +32 -0
- package/dist/categories-metadata-GESU3DEU.js +87 -0
- package/dist/category-create-PSAN6SA2.js +23 -0
- package/dist/category-detail-67ZTYE5M.js +106 -0
- package/dist/category-edit-QYKE3GAC.js +221 -0
- package/dist/category-list-ZRDWHPEI.js +33 -0
- package/dist/category-organize-D26G234L.js +112 -0
- package/dist/category-products-XMIZ2KRR.js +285 -0
- package/dist/chunk-25DQRKFS.js +102 -0
- package/dist/chunk-25LYVP3C.js +37 -0
- package/dist/chunk-26OOAKQ6.js +18 -0
- package/dist/chunk-2TDFXWGC.js +742 -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-35NDMIYZ.js +8 -0
- package/dist/chunk-3B6MTW5G.js +64 -0
- package/dist/chunk-3CKTAFTR.js +143 -0
- package/dist/chunk-3EF54XFY.js +64 -0
- package/dist/chunk-3GCRM6UM.js +1155 -0
- package/dist/chunk-3KOTDGC2.js +18 -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-4JYZU65L.js +2144 -0
- package/dist/chunk-4ZIQGDNH.js +184 -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-5A4JNOK3.js +109 -0
- package/dist/chunk-5HZT54X7.js +374 -0
- package/dist/chunk-5LI2P5VT.js +433 -0
- package/dist/chunk-5N24A4CX.js +296 -0
- package/dist/chunk-64B6RWZI.js +159 -0
- package/dist/chunk-64XMEZ5A.js +50 -0
- package/dist/chunk-6ERRELWD.js +3892 -0
- package/dist/chunk-6HJINLUB.js +94 -0
- package/dist/chunk-6IJMSVC6.js +16 -0
- package/dist/chunk-6S72GJRI.js +142 -0
- package/dist/chunk-77R2QD4O.js +337 -0
- package/dist/chunk-7AV5EJJ5.js +29 -0
- package/dist/chunk-7H2I3TA2.js +420 -0
- package/dist/chunk-7ITJ4725.js +185 -0
- package/dist/chunk-7JZMCLD3.js +165 -0
- package/dist/chunk-7KMDLRLG.js +248 -0
- package/dist/chunk-7NNA33IY.js +600 -0
- package/dist/chunk-7OSCNHHQ.js +69 -0
- package/dist/chunk-7RPRNVBS.js +45 -0
- package/dist/chunk-7SQW55FI.js +470 -0
- package/dist/chunk-7SVLKK6Q.js +31 -0
- package/dist/chunk-A2F5MDPU.js +79 -0
- package/dist/chunk-AEFDAU3Y.js +110 -0
- package/dist/chunk-AFQS6E4N.js +61 -0
- package/dist/chunk-AJQ6EVLE.js +501 -0
- package/dist/chunk-AW77UWCZ.js +363 -0
- package/dist/chunk-AYVH6Q5O.js +31 -0
- package/dist/chunk-AZVAL5E5.js +303 -0
- package/dist/chunk-BBZ6YISG.js +371 -0
- package/dist/chunk-BDGZ4EQO.js +86 -0
- package/dist/chunk-BLHFWBK3.js +199 -0
- package/dist/chunk-BPTVQM72.js +9496 -0
- package/dist/chunk-BYKTBURG.js +250 -0
- package/dist/chunk-C6OVKRMH.js +294 -0
- package/dist/chunk-C6SUTRP2.js +13 -0
- package/dist/chunk-CARSKIPW.js +87 -0
- package/dist/chunk-CJQRZEZU.js +614 -0
- package/dist/chunk-CMHI2RPL.js +20 -0
- package/dist/chunk-CP5IL4P6.js +98 -0
- package/dist/chunk-DB6ANJBO.js +35 -0
- package/dist/chunk-DBYUB2YI.js +174 -0
- package/dist/chunk-DPH3FG5H.js +528 -0
- package/dist/chunk-DY3XQPHC.js +31 -0
- package/dist/chunk-EEOEIXDA.js +112 -0
- package/dist/chunk-EF47ASFU.js +39 -0
- package/dist/chunk-EJY35WBK.js +60 -0
- package/dist/chunk-EOZUAYQL.js +6 -0
- package/dist/chunk-EWFOFSF7.js +78 -0
- package/dist/chunk-FD7OJEGQ.js +345 -0
- package/dist/chunk-FI474ADU.js +0 -0
- package/dist/chunk-FIVW6L2I.js +269 -0
- package/dist/chunk-FIYO3KTR.js +710 -0
- package/dist/chunk-FMFVTERD.js +0 -0
- package/dist/chunk-FQERBIVS.js +0 -0
- package/dist/chunk-FWPGOIFA.js +22 -0
- package/dist/chunk-G2N27VIE.js +164 -0
- package/dist/chunk-G4MIA23Y.js +100 -0
- package/dist/chunk-G5OVX555.js +26 -0
- package/dist/chunk-GCEOEV6P.js +241 -0
- package/dist/chunk-GR6JUIRU.js +32 -0
- package/dist/chunk-GVXAFQDF.js +170 -0
- package/dist/chunk-GYRTURN7.js +29 -0
- package/dist/chunk-HC25LNX7.js +45 -0
- package/dist/chunk-HDUVTTOW.js +396 -0
- package/dist/chunk-HGHJRKUC.js +223 -0
- package/dist/chunk-HINXQTCW.js +97 -0
- package/dist/chunk-HLL6GLZO.js +109 -0
- package/dist/chunk-HPQG3PEA.js +67 -0
- package/dist/chunk-I5LLMPI2.js +108 -0
- package/dist/chunk-I6GNV6QA.js +175 -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-IUB4C2WJ.js +420 -0
- package/dist/chunk-J54BZXZX.js +83 -0
- package/dist/chunk-J5SOBS7K.js +298 -0
- package/dist/chunk-JAJMMPOF.js +1260 -0
- package/dist/chunk-JHIMVLB2.js +42 -0
- package/dist/chunk-JI7HMGMO.js +79 -0
- package/dist/chunk-JJ4XUGHZ.js +312 -0
- package/dist/chunk-JOX3ZSRT.js +50 -0
- package/dist/chunk-JQV7CXEC.js +37 -0
- package/dist/chunk-JRTZWK77.js +1764 -0
- package/dist/chunk-K6RZE3F7.js +39 -0
- package/dist/chunk-KAZ5BYTQ.js +132 -0
- package/dist/chunk-KBYZLKI4.js +1093 -0
- package/dist/chunk-KHXRL3BH.js +85 -0
- package/dist/chunk-KWW4RDRS.js +199 -0
- package/dist/chunk-L74EVHCU.js +176 -0
- package/dist/chunk-L7DIEO5B.js +33 -0
- package/dist/chunk-LAVHRER2.js +17 -0
- package/dist/chunk-LFKTHNWI.js +83 -0
- package/dist/chunk-LGVVX4I6.js +422 -0
- package/dist/chunk-LQAAVRET.js +88 -0
- package/dist/chunk-LTBX54CI.js +11 -0
- package/dist/chunk-LXSBG6LK.js +18 -0
- package/dist/chunk-LXZXXOJ3.js +64 -0
- package/dist/chunk-LZO7MWH7.js +102 -0
- package/dist/chunk-MAEP2UCK.js +110 -0
- package/dist/chunk-MG4GKUJW.js +31 -0
- package/dist/chunk-MMDRMNPE.js +424 -0
- package/dist/chunk-MO7TNIVQ.js +23 -0
- package/dist/chunk-MZCJZRR6.js +381 -0
- package/dist/chunk-N2TQXB44.js +1280 -0
- package/dist/chunk-N3WRPCPT.js +94 -0
- package/dist/chunk-N5IUYCUZ.js +31 -0
- package/dist/chunk-N5XVXV47.js +530 -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-NHGR2OFE.js +292 -0
- package/dist/chunk-NOWUEJ74.js +44 -0
- package/dist/chunk-NQ2RDSI3.js +43 -0
- package/dist/chunk-NXDFDEKP.js +0 -0
- package/dist/chunk-NYWESQ6J.js +86705 -0
- package/dist/chunk-NZN7PFPB.js +169 -0
- package/dist/chunk-O4LSCHTC.js +245 -0
- package/dist/chunk-O5VKW5FL.js +41 -0
- package/dist/chunk-O5ZOACVV.js +593 -0
- package/dist/chunk-OEDISQ2O.js +98 -0
- package/dist/chunk-OJI3SRZ3.js +373 -0
- package/dist/chunk-OSI3M4M2.js +473 -0
- package/dist/chunk-OT5X3VOQ.js +42 -0
- package/dist/chunk-OZMCKYJL.js +204 -0
- package/dist/chunk-P52JGPUG.js +135 -0
- package/dist/chunk-PHOCVOZ5.js +9 -0
- package/dist/chunk-PJTR2MBS.js +459 -0
- package/dist/chunk-PUQSQBZW.js +49 -0
- package/dist/chunk-PVZBDWLK.js +41 -0
- package/dist/chunk-PWMB7ITO.js +344 -0
- package/dist/chunk-PXYDR7WQ.js +48 -0
- package/dist/chunk-PYF5EER5.js +32 -0
- package/dist/chunk-Q6GUA5VE.js +92 -0
- package/dist/chunk-QDIPFZLV.js +113 -0
- package/dist/chunk-QDPLZDMX.js +17 -0
- package/dist/chunk-QG6PLWNH.js +106 -0
- package/dist/chunk-QLTN2DIY.js +119 -0
- package/dist/chunk-QSGR43JM.js +30 -0
- package/dist/chunk-QUNCQMFH.js +219 -0
- package/dist/chunk-QUTZUW55.js +163 -0
- package/dist/chunk-QVLL4MKH.js +245 -0
- package/dist/chunk-R325CPYC.js +88 -0
- package/dist/chunk-R4O667NT.js +80 -0
- package/dist/chunk-R55Q5LAH.js +47 -0
- package/dist/chunk-RF7BE47J.js +685 -0
- package/dist/chunk-RHKRREUU.js +15 -0
- package/dist/chunk-RHYS2TFP.js +266 -0
- package/dist/chunk-RK5N3XIX.js +56 -0
- package/dist/chunk-RQQ53CQJ.js +87 -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-S3L6CIN2.js +459 -0
- package/dist/chunk-S4SVK5DE.js +39 -0
- package/dist/chunk-SBH4E5NY.js +129 -0
- package/dist/chunk-SDNGZDNK.js +170 -0
- package/dist/chunk-SJQ4QAFK.js +471 -0
- package/dist/chunk-SMQT3ZNO.js +8 -0
- package/dist/chunk-STSW4GDV.js +325 -0
- package/dist/chunk-SWL7ZCP3.js +11 -0
- package/dist/chunk-THHRRYRS.js +16 -0
- package/dist/chunk-THYWJQI4.js +635 -0
- package/dist/chunk-TK3XKN2P.js +357 -0
- package/dist/chunk-TKEAOWBZ.js +178 -0
- package/dist/chunk-TKFMOTJK.js +297 -0
- package/dist/chunk-TKGWSUEI.js +0 -0
- package/dist/chunk-TKSKCH3S.js +199 -0
- package/dist/chunk-TLE6YHGH.js +26 -0
- package/dist/chunk-TN4TIT7O.js +116 -0
- package/dist/chunk-TOUMBTYI.js +41 -0
- package/dist/chunk-TP7M43SI.js +189 -0
- package/dist/chunk-TUJIAA5O.js +101 -0
- package/dist/chunk-TZSOL34K.js +106 -0
- package/dist/chunk-U2EI2ZLM.js +32 -0
- package/dist/chunk-U2L77ZDR.js +17 -0
- package/dist/chunk-U2ZFCAPX.js +34 -0
- package/dist/chunk-U3OWJE7V.js +4113 -0
- package/dist/chunk-U5MJIHLY.js +87 -0
- package/dist/chunk-U5QDMLTR.js +294 -0
- package/dist/chunk-UI2BJVP5.js +170 -0
- package/dist/chunk-ULJ3OMWU.js +467 -0
- package/dist/chunk-UM7ZR3VU.js +14 -0
- package/dist/chunk-UQITHKTH.js +342 -0
- package/dist/chunk-UXD3VNBO.js +53 -0
- package/dist/chunk-UZWFZMOX.js +40 -0
- package/dist/chunk-V5J73NPW.js +117 -0
- package/dist/chunk-V6LO4BXB.js +460 -0
- package/dist/chunk-V74Y5NIV.js +49 -0
- package/dist/chunk-V7Y7WBGF.js +112 -0
- package/dist/chunk-VEW7PQ3X.js +209 -0
- package/dist/chunk-VHCDSNXF.js +89 -0
- package/dist/chunk-VKOE5J66.js +31 -0
- package/dist/chunk-VOHEQ7B5.js +31 -0
- package/dist/chunk-VRGXUUPH.js +772 -0
- package/dist/chunk-VVWB3GIK.js +70 -0
- package/dist/chunk-VW56KWO2.js +9 -0
- package/dist/chunk-VXW3BCN2.js +171 -0
- package/dist/chunk-VZEMURY7.js +35 -0
- package/dist/chunk-W6Y3PPU5.js +73 -0
- package/dist/chunk-WBNGBRBK.js +482 -0
- package/dist/chunk-WCEMRNW4.js +6 -0
- package/dist/chunk-WEVK4TBV.js +257 -0
- package/dist/chunk-WIYFXWRI.js +30 -0
- package/dist/chunk-WMA3WTCM.js +117 -0
- package/dist/chunk-WW7VLWKJ.js +360 -0
- package/dist/chunk-X6HEEFUW.js +1104 -0
- package/dist/chunk-XBFWFGZH.js +249 -0
- package/dist/chunk-XFKRBJLK.js +104 -0
- package/dist/chunk-XFR5JLNF.js +44 -0
- package/dist/chunk-XIZLPYEE.js +261 -0
- package/dist/chunk-XQNVC4Q7.js +212 -0
- package/dist/chunk-XR2UEF6U.js +433 -0
- package/dist/chunk-XSEF6KRY.js +335 -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-YAMNPEPW.js +345 -0
- package/dist/chunk-YBZWO4ZV.js +57 -0
- package/dist/chunk-YDAJI7WF.js +389 -0
- package/dist/chunk-YMKZS2HK.js +82 -0
- package/dist/chunk-YQYGAFCS.js +119 -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-ZA2KFUFR.js +19 -0
- package/dist/chunk-ZGEMSYN7.js +61 -0
- package/dist/chunk-ZJO4DDOP.js +454 -0
- package/dist/chunk-ZNA2XOGX.js +675 -0
- package/dist/chunk-ZQZHFMD7.js +19 -0
- package/dist/collection-add-products-4TTEF6QV.js +288 -0
- package/dist/collection-create-SD4GKHFC.js +134 -0
- package/dist/collection-detail-64YVMLBU.js +97 -0
- package/dist/collection-edit-Z474HXCJ.js +122 -0
- package/dist/collection-list-OTSGOEBC.js +79 -0
- package/dist/collection-metadata-FFHA6CQ3.js +84 -0
- package/dist/commission-rate-create-7BBUGS2I.js +779 -0
- package/dist/commission-rate-detail-FORKXXJY.js +83 -0
- package/dist/commission-rate-edit-SAX2DAND.js +762 -0
- package/dist/commission-rate-list-EESTCCRP.js +28 -0
- package/dist/constants-CAwtRicB.d.ts +42 -0
- package/dist/customer-create-WA4GYGVD.js +184 -0
- package/dist/customer-create-address-YBI4KWWH.js +300 -0
- package/dist/customer-detail-SDE4TDZD.js +107 -0
- package/dist/customer-edit-TFR6PVJJ.js +193 -0
- package/dist/customer-group-add-customers-77BVWLTN.js +247 -0
- package/dist/customer-group-create-32UIUO46.js +114 -0
- package/dist/customer-group-detail-QRY6BHGI.js +106 -0
- package/dist/customer-group-edit-HFL7LZZZ.js +109 -0
- package/dist/customer-group-list-Q3T72VH2.js +57 -0
- package/dist/customer-group-metadata-FXI3J6DB.js +85 -0
- package/dist/customer-list-CXTUBLCK.js +33 -0
- package/dist/customer-metadata-BV4CHHWI.js +85 -0
- package/dist/customers-add-customer-group-SUE2KKJR.js +312 -0
- package/dist/edit-inventory-item-DDRUGVSK.js +156 -0
- package/dist/edit-inventory-item-attributes-MDL7FSLR.js +327 -0
- package/dist/edit-reservation-JWABBNJ6.js +247 -0
- package/dist/edit-rules-ECNFIPUC.js +320 -0
- package/dist/home-I3OILW5Z.js +16 -0
- package/dist/index.css +6 -0
- package/dist/index.d.ts +255 -0
- package/dist/index.js +4989 -0
- package/dist/inventory-create-S6CB4JYN.js +56 -0
- package/dist/inventory-detail-OIKNOS5A.js +107 -0
- package/dist/inventory-list-XSHWCPO4.js +30 -0
- package/dist/inventory-metadata-MHGDNLXT.js +87 -0
- package/dist/inventory-stock-JG5CZWZA.js +292 -0
- package/dist/invite-25CGHT4W.js +373 -0
- package/dist/location-create-G3MNWQWB.js +239 -0
- package/dist/location-detail-5CGAZMBR.js +100 -0
- package/dist/location-edit-UI6AWCZS.js +254 -0
- package/dist/location-fulfillment-providers-BA2VMZHX.js +293 -0
- package/dist/location-list-656DEW7L.js +53 -0
- package/dist/location-sales-channels-WXBK4EJO.js +216 -0
- package/dist/location-service-zone-create-647O67PU.js +174 -0
- package/dist/location-service-zone-edit-BUY6HNZM.js +135 -0
- package/dist/location-service-zone-manage-areas-X2ZGRHHA.js +155 -0
- package/dist/location-service-zone-shipping-option-create-IASFWJ2Z.js +57 -0
- package/dist/location-service-zone-shipping-option-edit-IJDU5PTW.js +363 -0
- package/dist/location-service-zone-shipping-option-pricing-3T7HLKJC.js +363 -0
- package/dist/login-WU5VB5LW.js +264 -0
- package/dist/manage-locations-IJIPCYAY.js +250 -0
- package/dist/marketplace-add-currencies-RXLEQ6MZ.js +305 -0
- package/dist/marketplace-detail-23KSAJVI.js +75 -0
- package/dist/marketplace-edit-XPIEDQYD.js +247 -0
- package/dist/marketplace-metadata-5GEWGH2M.js +89 -0
- package/dist/no-match-JLVLPCRH.js +33 -0
- package/dist/order-allocate-items-GYGER65Z.js +559 -0
- package/dist/order-create-claim-RNUFU2MP.js +2207 -0
- package/dist/order-create-edit-DLH76B2Q.js +936 -0
- package/dist/order-create-exchange-FA27FZU7.js +2194 -0
- package/dist/order-create-fulfillment-4F5JAUOX.js +625 -0
- package/dist/order-create-refund-3LCTQXFD.js +407 -0
- package/dist/order-create-return-EO2C5RAA.js +1293 -0
- package/dist/order-create-shipment-PIQ43ZSG.js +212 -0
- package/dist/order-detail-2U26JNU2.js +123 -0
- package/dist/order-edit-billing-address-PRXCLUNR.js +404 -0
- package/dist/order-edit-email-GVKVQESG.js +175 -0
- package/dist/order-edit-shipping-address-UDNHXO2V.js +401 -0
- package/dist/order-list-U2HL7VBX.js +49 -0
- package/dist/order-metadata-HPXIR6KI.js +86 -0
- package/dist/order-receive-return-FMM74XYM.js +553 -0
- package/dist/order-request-transfer-SI5PSOKA.js +575 -0
- package/dist/pages/index.d.ts +3165 -0
- package/dist/pages/index.js +447 -0
- package/dist/payout-detail-L4VYAP53.js +52 -0
- package/dist/payout-list-4S6MAU4R.js +30 -0
- package/dist/price-list-configuration-F2BZC6QX.js +357 -0
- package/dist/price-list-create-ZJTDGJSS.js +76 -0
- package/dist/price-list-detail-IUJXNM6Y.js +103 -0
- package/dist/price-list-edit-CERYYMC5.js +228 -0
- package/dist/price-list-list-RBD2MEZ5.js +36 -0
- package/dist/price-list-prices-add-AJJ76VMY.js +71 -0
- package/dist/price-list-prices-edit-2NYN6WVJ.js +332 -0
- package/dist/product-attributes-EUDG25XA.js +362 -0
- package/dist/product-create-XA7UOISW.js +68 -0
- package/dist/product-create-option-BG2ZKSFN.js +148 -0
- package/dist/product-create-variant-4Z6HSHRE.js +54 -0
- package/dist/product-detail-F67SLUIA.js +103 -0
- package/dist/product-edit-HFWSBQQI.js +401 -0
- package/dist/product-edit-option-Y46SNVHN.js +156 -0
- package/dist/product-export-ABNA6ZTY.js +132 -0
- package/dist/product-import-SQSXBPK5.js +265 -0
- package/dist/product-list-NWHRQHVJ.js +86 -0
- package/dist/product-media-YIQCVDCC.js +883 -0
- package/dist/product-metadata-2Z5DIXJH.js +87 -0
- package/dist/product-organization-L666C2EQ.js +316 -0
- package/dist/product-prices-DPGO4KHT.js +267 -0
- package/dist/product-sales-channels-6IS6T3EC.js +161 -0
- package/dist/product-shipping-profile-LMLRMJ36.js +150 -0
- package/dist/product-stock-AQKD6EQO.js +542 -0
- package/dist/product-tag-create-5CF7JLN5.js +126 -0
- package/dist/product-tag-detail-2RJNUUT7.js +136 -0
- package/dist/product-tag-edit-KGT54WP5.js +138 -0
- package/dist/product-tag-list-PJG7ICZE.js +130 -0
- package/dist/product-tag-metadata-WU7DVJUM.js +84 -0
- package/dist/product-type-create-WHYGTCYX.js +102 -0
- package/dist/product-type-detail-MZ3MAV2B.js +98 -0
- package/dist/product-type-edit-A4IE6BSF.js +114 -0
- package/dist/product-type-list-ND2IIR6O.js +35 -0
- package/dist/product-type-metadata-KX4ETP3Y.js +84 -0
- package/dist/product-variant-detail-USZXPSVX.js +112 -0
- package/dist/product-variant-edit-5L2GWAHB.js +545 -0
- package/dist/product-variant-manage-inventory-items-54V2HTA6.js +341 -0
- package/dist/product-variant-metadata-SBYZTEIH.js +90 -0
- package/dist/profile-detail-OAQD5VJC.js +18 -0
- package/dist/profile-edit-DSZCGRY7.js +177 -0
- package/dist/promotion-add-campaign-JC4B53LS.js +44 -0
- package/dist/promotion-create-A6FMNECA.js +54 -0
- package/dist/promotion-detail-XOQTYXTV.js +88 -0
- package/dist/promotion-edit-details-KFZ2VVVQ.js +513 -0
- package/dist/promotion-list-EH7CW4JZ.js +58 -0
- package/dist/refund-reason-create-EMGCAW5S.js +196 -0
- package/dist/refund-reason-edit-3D25LGKM.js +196 -0
- package/dist/refund-reason-list-V7HDVFS2.js +102 -0
- package/dist/region-add-countries-ZAQBBXIL.js +227 -0
- package/dist/region-create-IMSMEASB.js +508 -0
- package/dist/region-detail-RASFBR5O.js +74 -0
- package/dist/region-edit-HGSLB3RU.js +381 -0
- package/dist/region-list-WEILXVMS.js +35 -0
- package/dist/region-metadata-4COKDRZH.js +87 -0
- package/dist/reservation-create-CIYW3ZKU.js +310 -0
- package/dist/reservation-detail-2ARWTBE6.js +83 -0
- package/dist/reservation-list-W6IOXQZK.js +31 -0
- package/dist/reservation-metadata-3ZJ2C5BM.js +87 -0
- package/dist/reset-password-YQ6HMFFZ.js +458 -0
- package/dist/return-reason-create-HHZ3EMCC.js +166 -0
- package/dist/return-reason-edit-5P43JRYC.js +169 -0
- package/dist/return-reason-list-32MCIQMK.js +81 -0
- package/dist/sales-channel-add-products-U2UTBUKE.js +278 -0
- package/dist/sales-channel-create-TMRTMLIX.js +155 -0
- package/dist/sales-channel-detail-FRBKGP4X.js +98 -0
- package/dist/sales-channel-edit-4LE2N6EV.js +164 -0
- package/dist/sales-channel-list-36UHU63C.js +50 -0
- package/dist/sales-channel-metadata-OKKVLC7G.js +92 -0
- package/dist/seller-address-edit-VH4X5OIO.js +223 -0
- package/dist/seller-details-52PG56BK.js +104 -0
- package/dist/seller-edit-TU72D5QS.js +331 -0
- package/dist/seller-list-CYNCPXYT.js +80 -0
- package/dist/settings-AVE3VCCM.js +19 -0
- package/dist/shipping-option-type-create-ZHRADP5E.js +199 -0
- package/dist/shipping-option-type-detail-ZDEEU3P5.js +82 -0
- package/dist/shipping-option-type-edit-2FCNVHNE.js +195 -0
- package/dist/shipping-option-type-list-OCCZ4DNS.js +60 -0
- package/dist/shipping-profile-create-WLHDFQ4Q.js +124 -0
- package/dist/shipping-profile-detail-AUWRGYYL.js +57 -0
- package/dist/shipping-profile-metadata-W7CND3IQ.js +88 -0
- package/dist/shipping-profiles-list-RZT6HIZV.js +27 -0
- package/dist/tax-region-create-U5JWJUX4.js +304 -0
- package/dist/tax-region-detail-UNGDO64V.js +68 -0
- package/dist/tax-region-edit-5DOYTPEF.js +166 -0
- package/dist/tax-region-list-MRQ63BL3.js +27 -0
- package/dist/tax-region-metadata-WN3XSWGA.js +87 -0
- package/dist/tax-region-province-create-3GZUYVBY.js +316 -0
- package/dist/tax-region-province-detail-QTBP47GV.js +99 -0
- package/dist/tax-region-tax-override-create-PRZ3DEZE.js +688 -0
- package/dist/tax-region-tax-override-edit-YAA6TB6A.js +797 -0
- package/dist/tax-region-tax-rate-create-KHNADBCN.js +194 -0
- package/dist/tax-region-tax-rate-edit-JR5262VW.js +193 -0
- package/dist/user-detail-I66RREWP.js +55 -0
- package/dist/user-edit-LBJOZ4LG.js +116 -0
- package/dist/user-invite-EUNVBT5W.js +398 -0
- package/dist/user-list-BDJJI33F.js +28 -0
- package/dist/user-metadata-4RXAMVDT.js +87 -0
- package/package.json +87 -0
|
@@ -0,0 +1,1293 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ReturnShippingPlaceholder
|
|
3
|
+
} from "./chunk-S4SVK5DE.js";
|
|
4
|
+
import {
|
|
5
|
+
useReturnReasons
|
|
6
|
+
} from "./chunk-RQQ53CQJ.js";
|
|
7
|
+
import {
|
|
8
|
+
getReturnableQuantity
|
|
9
|
+
} from "./chunk-UM7ZR3VU.js";
|
|
10
|
+
import {
|
|
11
|
+
MoneyAmountCell
|
|
12
|
+
} from "./chunk-2Y3WMGN6.js";
|
|
13
|
+
import {
|
|
14
|
+
DEFAULT_FIELDS
|
|
15
|
+
} from "./chunk-Y2M536WR.js";
|
|
16
|
+
import {
|
|
17
|
+
useAddReturnItem,
|
|
18
|
+
useAddReturnShipping,
|
|
19
|
+
useCancelReturnRequest,
|
|
20
|
+
useConfirmReturnRequest,
|
|
21
|
+
useDeleteReturnShipping,
|
|
22
|
+
useInitiateReturn,
|
|
23
|
+
useRemoveReturnItem,
|
|
24
|
+
useReturn,
|
|
25
|
+
useUpdateReturn,
|
|
26
|
+
useUpdateReturnItem,
|
|
27
|
+
useUpdateReturnShipping
|
|
28
|
+
} from "./chunk-PJTR2MBS.js";
|
|
29
|
+
import {
|
|
30
|
+
getStylizedAmount
|
|
31
|
+
} from "./chunk-PXYDR7WQ.js";
|
|
32
|
+
import {
|
|
33
|
+
ProductCell,
|
|
34
|
+
ProductHeader
|
|
35
|
+
} from "./chunk-FWPGOIFA.js";
|
|
36
|
+
import "./chunk-PHOCVOZ5.js";
|
|
37
|
+
import {
|
|
38
|
+
Thumbnail
|
|
39
|
+
} from "./chunk-WIYFXWRI.js";
|
|
40
|
+
import "./chunk-FQERBIVS.js";
|
|
41
|
+
import {
|
|
42
|
+
_DataTable,
|
|
43
|
+
useDataTable
|
|
44
|
+
} from "./chunk-ULJ3OMWU.js";
|
|
45
|
+
import "./chunk-YBZWO4ZV.js";
|
|
46
|
+
import "./chunk-KAZ5BYTQ.js";
|
|
47
|
+
import "./chunk-3EF54XFY.js";
|
|
48
|
+
import {
|
|
49
|
+
currencies
|
|
50
|
+
} from "./chunk-IQPN4PZJ.js";
|
|
51
|
+
import {
|
|
52
|
+
Combobox
|
|
53
|
+
} from "./chunk-AW77UWCZ.js";
|
|
54
|
+
import "./chunk-TKGWSUEI.js";
|
|
55
|
+
import {
|
|
56
|
+
KeyboundForm
|
|
57
|
+
} from "./chunk-U2ZFCAPX.js";
|
|
58
|
+
import "./chunk-INNFZYX2.js";
|
|
59
|
+
import {
|
|
60
|
+
ActionMenu
|
|
61
|
+
} from "./chunk-BDGZ4EQO.js";
|
|
62
|
+
import "./chunk-LAVHRER2.js";
|
|
63
|
+
import "./chunk-Y7QKP6QU.js";
|
|
64
|
+
import "./chunk-KBYZLKI4.js";
|
|
65
|
+
import "./chunk-YWWUOGJA.js";
|
|
66
|
+
import {
|
|
67
|
+
useQueryParams
|
|
68
|
+
} from "./chunk-THHRRYRS.js";
|
|
69
|
+
import "./chunk-UZWFZMOX.js";
|
|
70
|
+
import "./chunk-XQNVC4Q7.js";
|
|
71
|
+
import {
|
|
72
|
+
RouteFocusModal,
|
|
73
|
+
StackedFocusModal,
|
|
74
|
+
useRouteModal,
|
|
75
|
+
useStackedModal
|
|
76
|
+
} from "./chunk-V6LO4BXB.js";
|
|
77
|
+
import {
|
|
78
|
+
Form
|
|
79
|
+
} from "./chunk-3QSRE5LS.js";
|
|
80
|
+
import {
|
|
81
|
+
useShippingOptions
|
|
82
|
+
} from "./chunk-Q6GUA5VE.js";
|
|
83
|
+
import {
|
|
84
|
+
useOrder,
|
|
85
|
+
useOrderPreview
|
|
86
|
+
} from "./chunk-QVLL4MKH.js";
|
|
87
|
+
import "./chunk-I5LLMPI2.js";
|
|
88
|
+
import {
|
|
89
|
+
useStockLocations
|
|
90
|
+
} from "./chunk-VXW3BCN2.js";
|
|
91
|
+
import "./chunk-WBNGBRBK.js";
|
|
92
|
+
import "./chunk-RHKRREUU.js";
|
|
93
|
+
import "./chunk-ZA2KFUFR.js";
|
|
94
|
+
import {
|
|
95
|
+
sdk
|
|
96
|
+
} from "./chunk-LXZXXOJ3.js";
|
|
97
|
+
import "./chunk-NBMM2TZK.js";
|
|
98
|
+
|
|
99
|
+
// src/pages/orders/order-create-return/return-create.tsx
|
|
100
|
+
import { useNavigate, useParams } from "react-router-dom";
|
|
101
|
+
import { useEffect as useEffect2, useState as useState3 } from "react";
|
|
102
|
+
import { useTranslation as useTranslation6 } from "react-i18next";
|
|
103
|
+
import { toast as toast2 } from "@medusajs/ui";
|
|
104
|
+
|
|
105
|
+
// src/pages/orders/order-create-return/components/return-create-form/return-create-form.tsx
|
|
106
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
107
|
+
import { PencilSquare } from "@medusajs/icons";
|
|
108
|
+
import {
|
|
109
|
+
Alert,
|
|
110
|
+
Button,
|
|
111
|
+
CurrencyInput,
|
|
112
|
+
Heading,
|
|
113
|
+
IconButton as IconButton2,
|
|
114
|
+
Switch,
|
|
115
|
+
Text as Text2,
|
|
116
|
+
toast,
|
|
117
|
+
usePrompt
|
|
118
|
+
} from "@medusajs/ui";
|
|
119
|
+
import { useEffect, useMemo as useMemo3, useState as useState2 } from "react";
|
|
120
|
+
import { useFieldArray, useForm } from "react-hook-form";
|
|
121
|
+
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
122
|
+
|
|
123
|
+
// src/pages/orders/order-create-return/components/add-return-items-table/add-return-items-table.tsx
|
|
124
|
+
import { useMemo as useMemo2, useState } from "react";
|
|
125
|
+
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
126
|
+
|
|
127
|
+
// src/pages/orders/order-create-return/components/add-return-items-table/use-return-item-table-columns.tsx
|
|
128
|
+
import { useMemo } from "react";
|
|
129
|
+
import { Checkbox } from "@medusajs/ui";
|
|
130
|
+
import { createColumnHelper } from "@tanstack/react-table";
|
|
131
|
+
import { useTranslation } from "react-i18next";
|
|
132
|
+
import { jsx } from "react/jsx-runtime";
|
|
133
|
+
var columnHelper = createColumnHelper();
|
|
134
|
+
var useReturnItemTableColumns = (currencyCode) => {
|
|
135
|
+
const { t } = useTranslation();
|
|
136
|
+
return useMemo(
|
|
137
|
+
() => [
|
|
138
|
+
columnHelper.display({
|
|
139
|
+
id: "select",
|
|
140
|
+
header: ({ table }) => {
|
|
141
|
+
return /* @__PURE__ */ jsx(
|
|
142
|
+
Checkbox,
|
|
143
|
+
{
|
|
144
|
+
checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
|
|
145
|
+
onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value)
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
},
|
|
149
|
+
cell: ({ row }) => {
|
|
150
|
+
const isSelectable = row.getCanSelect();
|
|
151
|
+
return /* @__PURE__ */ jsx(
|
|
152
|
+
Checkbox,
|
|
153
|
+
{
|
|
154
|
+
disabled: !isSelectable,
|
|
155
|
+
checked: row.getIsSelected(),
|
|
156
|
+
onCheckedChange: (value) => row.toggleSelected(!!value),
|
|
157
|
+
onClick: (e) => {
|
|
158
|
+
e.stopPropagation();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
}),
|
|
164
|
+
columnHelper.display({
|
|
165
|
+
id: "product",
|
|
166
|
+
header: () => /* @__PURE__ */ jsx(ProductHeader, {}),
|
|
167
|
+
cell: ({ row }) => /* @__PURE__ */ jsx(
|
|
168
|
+
ProductCell,
|
|
169
|
+
{
|
|
170
|
+
product: {
|
|
171
|
+
thumbnail: row.original.thumbnail,
|
|
172
|
+
title: row.original.product_title
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
}),
|
|
177
|
+
columnHelper.accessor("variant.sku", {
|
|
178
|
+
header: t("fields.sku"),
|
|
179
|
+
cell: ({ getValue }) => {
|
|
180
|
+
return getValue() || "-";
|
|
181
|
+
}
|
|
182
|
+
}),
|
|
183
|
+
columnHelper.accessor("variant.title", {
|
|
184
|
+
header: t("fields.variant")
|
|
185
|
+
}),
|
|
186
|
+
columnHelper.accessor("quantity", {
|
|
187
|
+
header: () => /* @__PURE__ */ jsx("div", { className: "flex size-full items-center overflow-hidden text-right", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: t("fields.quantity") }) }),
|
|
188
|
+
cell: ({ row }) => {
|
|
189
|
+
return getReturnableQuantity(row.original);
|
|
190
|
+
}
|
|
191
|
+
}),
|
|
192
|
+
columnHelper.accessor("refundable_total", {
|
|
193
|
+
header: () => /* @__PURE__ */ jsx("div", { className: "flex size-full items-center justify-end overflow-hidden text-right", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: t("fields.price") }) }),
|
|
194
|
+
cell: ({ getValue }) => {
|
|
195
|
+
const amount = getValue() || 0;
|
|
196
|
+
const stylized = getStylizedAmount(amount, currencyCode);
|
|
197
|
+
return /* @__PURE__ */ jsx("div", { className: "flex size-full items-center justify-end overflow-hidden text-right", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: stylized }) });
|
|
198
|
+
}
|
|
199
|
+
})
|
|
200
|
+
],
|
|
201
|
+
[t, currencyCode]
|
|
202
|
+
);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
// src/pages/orders/order-create-return/components/add-return-items-table/use-return-item-table-filters.tsx
|
|
206
|
+
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
207
|
+
var useReturnItemTableFilters = () => {
|
|
208
|
+
const { t } = useTranslation2();
|
|
209
|
+
const filters = [
|
|
210
|
+
{
|
|
211
|
+
key: "returnable_quantity",
|
|
212
|
+
label: t("orders.returns.returnableQuantityLabel"),
|
|
213
|
+
type: "number"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
key: "refundable_amount",
|
|
217
|
+
label: t("orders.returns.refundableAmountLabel"),
|
|
218
|
+
type: "number"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
key: "created_at",
|
|
222
|
+
label: t("fields.createdAt"),
|
|
223
|
+
type: "date"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
key: "updated_at",
|
|
227
|
+
label: t("fields.updatedAt"),
|
|
228
|
+
type: "date"
|
|
229
|
+
}
|
|
230
|
+
];
|
|
231
|
+
return filters;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
// src/pages/orders/order-create-return/components/add-return-items-table/use-return-item-table-query.tsx
|
|
235
|
+
var useReturnItemTableQuery = ({
|
|
236
|
+
pageSize = 50,
|
|
237
|
+
prefix
|
|
238
|
+
}) => {
|
|
239
|
+
const raw = useQueryParams(
|
|
240
|
+
[
|
|
241
|
+
"q",
|
|
242
|
+
"offset",
|
|
243
|
+
"order",
|
|
244
|
+
"created_at",
|
|
245
|
+
"updated_at",
|
|
246
|
+
"returnable_quantity",
|
|
247
|
+
"refundable_amount"
|
|
248
|
+
],
|
|
249
|
+
prefix
|
|
250
|
+
);
|
|
251
|
+
const {
|
|
252
|
+
offset,
|
|
253
|
+
created_at,
|
|
254
|
+
updated_at,
|
|
255
|
+
refundable_amount,
|
|
256
|
+
returnable_quantity,
|
|
257
|
+
...rest
|
|
258
|
+
} = raw;
|
|
259
|
+
const searchParams = {
|
|
260
|
+
...rest,
|
|
261
|
+
limit: pageSize,
|
|
262
|
+
offset: offset ? Number(offset) : 0,
|
|
263
|
+
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
264
|
+
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
265
|
+
refundable_amount: refundable_amount ? JSON.parse(refundable_amount) : void 0,
|
|
266
|
+
returnable_quantity: returnable_quantity ? JSON.parse(returnable_quantity) : void 0
|
|
267
|
+
};
|
|
268
|
+
return { searchParams, raw };
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
// src/pages/orders/order-create-return/components/add-return-items-table/add-return-items-table.tsx
|
|
272
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
273
|
+
var PAGE_SIZE = 50;
|
|
274
|
+
var PREFIX = "rit";
|
|
275
|
+
var AddReturnItemsTable = ({
|
|
276
|
+
onSelectionChange,
|
|
277
|
+
selectedItems: selectedItems2,
|
|
278
|
+
items,
|
|
279
|
+
currencyCode
|
|
280
|
+
}) => {
|
|
281
|
+
const { t } = useTranslation3();
|
|
282
|
+
const [rowSelection, setRowSelection] = useState(
|
|
283
|
+
selectedItems2.reduce((acc, id) => {
|
|
284
|
+
acc[id] = true;
|
|
285
|
+
return acc;
|
|
286
|
+
}, {})
|
|
287
|
+
);
|
|
288
|
+
const updater = (fn) => {
|
|
289
|
+
const newState = typeof fn === "function" ? fn(rowSelection) : fn;
|
|
290
|
+
setRowSelection(newState);
|
|
291
|
+
onSelectionChange(Object.keys(newState));
|
|
292
|
+
};
|
|
293
|
+
const { searchParams, raw } = useReturnItemTableQuery({
|
|
294
|
+
pageSize: PAGE_SIZE,
|
|
295
|
+
prefix: PREFIX
|
|
296
|
+
});
|
|
297
|
+
const queriedItems = useMemo2(() => {
|
|
298
|
+
const {
|
|
299
|
+
order,
|
|
300
|
+
offset,
|
|
301
|
+
limit,
|
|
302
|
+
q,
|
|
303
|
+
created_at,
|
|
304
|
+
updated_at,
|
|
305
|
+
refundable_amount,
|
|
306
|
+
returnable_quantity
|
|
307
|
+
} = searchParams;
|
|
308
|
+
let results = items;
|
|
309
|
+
if (q) {
|
|
310
|
+
results = results.filter((i) => {
|
|
311
|
+
return i.product_title?.toLowerCase().includes(q.toLowerCase()) || i.variant_title?.toLowerCase().includes(q.toLowerCase()) || i.variant_sku?.toLowerCase().includes(q.toLowerCase());
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
if (order) {
|
|
315
|
+
const direction = order[0] === "-" ? "desc" : "asc";
|
|
316
|
+
const field = order.replace("-", "");
|
|
317
|
+
results = sortItems(results, field, direction);
|
|
318
|
+
}
|
|
319
|
+
if (created_at) {
|
|
320
|
+
results = filterByDate(results, created_at, "created_at");
|
|
321
|
+
}
|
|
322
|
+
if (updated_at) {
|
|
323
|
+
results = filterByDate(results, updated_at, "updated_at");
|
|
324
|
+
}
|
|
325
|
+
if (returnable_quantity) {
|
|
326
|
+
results = filterByNumber(
|
|
327
|
+
results,
|
|
328
|
+
returnable_quantity,
|
|
329
|
+
"returnable_quantity",
|
|
330
|
+
currencyCode
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
if (refundable_amount) {
|
|
334
|
+
results = filterByNumber(
|
|
335
|
+
results,
|
|
336
|
+
refundable_amount,
|
|
337
|
+
"refundable_amount",
|
|
338
|
+
currencyCode
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
return results.slice(offset, offset + limit);
|
|
342
|
+
}, [items, currencyCode, searchParams]);
|
|
343
|
+
const columns = useReturnItemTableColumns(currencyCode);
|
|
344
|
+
const filters = useReturnItemTableFilters();
|
|
345
|
+
const { table } = useDataTable({
|
|
346
|
+
data: queriedItems,
|
|
347
|
+
columns,
|
|
348
|
+
count: queriedItems.length,
|
|
349
|
+
enablePagination: true,
|
|
350
|
+
getRowId: (row) => row.id,
|
|
351
|
+
pageSize: PAGE_SIZE,
|
|
352
|
+
enableRowSelection: (row) => {
|
|
353
|
+
return getReturnableQuantity(row.original) > 0;
|
|
354
|
+
},
|
|
355
|
+
rowSelection: {
|
|
356
|
+
state: rowSelection,
|
|
357
|
+
updater
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
return /* @__PURE__ */ jsx2("div", { className: "flex size-full flex-col overflow-hidden", children: /* @__PURE__ */ jsx2(
|
|
361
|
+
_DataTable,
|
|
362
|
+
{
|
|
363
|
+
table,
|
|
364
|
+
columns,
|
|
365
|
+
pageSize: PAGE_SIZE,
|
|
366
|
+
count: queriedItems.length,
|
|
367
|
+
filters,
|
|
368
|
+
pagination: true,
|
|
369
|
+
layout: "fill",
|
|
370
|
+
search: true,
|
|
371
|
+
orderBy: [
|
|
372
|
+
{ key: "product_title", label: t("fields.product") },
|
|
373
|
+
{ key: "variant_title", label: t("fields.variant") },
|
|
374
|
+
{ key: "sku", label: t("fields.sku") },
|
|
375
|
+
{
|
|
376
|
+
key: "returnable_quantity",
|
|
377
|
+
label: t("orders.fields.returnableQuantity")
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
key: "refundable_amount",
|
|
381
|
+
label: t("orders.fields.refundableAmount")
|
|
382
|
+
}
|
|
383
|
+
],
|
|
384
|
+
prefix: PREFIX,
|
|
385
|
+
queryObject: raw
|
|
386
|
+
}
|
|
387
|
+
) });
|
|
388
|
+
};
|
|
389
|
+
var sortItems = (items, field, direction) => {
|
|
390
|
+
return items.sort((a, b) => {
|
|
391
|
+
let aValue;
|
|
392
|
+
let bValue;
|
|
393
|
+
if (field === "product_title") {
|
|
394
|
+
aValue = a.product_title;
|
|
395
|
+
bValue = b.product_title;
|
|
396
|
+
} else if (field === "variant_title") {
|
|
397
|
+
aValue = a.variant_title;
|
|
398
|
+
bValue = b.variant_title;
|
|
399
|
+
} else if (field === "sku") {
|
|
400
|
+
aValue = a.variant_sku;
|
|
401
|
+
bValue = b.variant_sku;
|
|
402
|
+
} else if (field === "returnable_quantity") {
|
|
403
|
+
aValue = a.quantity - (a.returned_quantity || 0);
|
|
404
|
+
bValue = b.quantity - (b.returned_quantity || 0);
|
|
405
|
+
} else if (field === "refundable_amount") {
|
|
406
|
+
aValue = a.refundable || 0;
|
|
407
|
+
bValue = b.refundable || 0;
|
|
408
|
+
}
|
|
409
|
+
if (aValue < bValue) {
|
|
410
|
+
return direction === "asc" ? -1 : 1;
|
|
411
|
+
}
|
|
412
|
+
if (aValue > bValue) {
|
|
413
|
+
return direction === "asc" ? 1 : -1;
|
|
414
|
+
}
|
|
415
|
+
return 0;
|
|
416
|
+
});
|
|
417
|
+
};
|
|
418
|
+
var filterByDate = (items, date, field) => {
|
|
419
|
+
const { gt, gte, lt, lte } = date;
|
|
420
|
+
return items.filter((i) => {
|
|
421
|
+
const itemDate = new Date(i[field]);
|
|
422
|
+
let isValid = true;
|
|
423
|
+
if (gt) {
|
|
424
|
+
isValid = isValid && itemDate > new Date(gt);
|
|
425
|
+
}
|
|
426
|
+
if (gte) {
|
|
427
|
+
isValid = isValid && itemDate >= new Date(gte);
|
|
428
|
+
}
|
|
429
|
+
if (lt) {
|
|
430
|
+
isValid = isValid && itemDate < new Date(lt);
|
|
431
|
+
}
|
|
432
|
+
if (lte) {
|
|
433
|
+
isValid = isValid && itemDate <= new Date(lte);
|
|
434
|
+
}
|
|
435
|
+
return isValid;
|
|
436
|
+
});
|
|
437
|
+
};
|
|
438
|
+
var defaultOperators = {
|
|
439
|
+
eq: void 0,
|
|
440
|
+
gt: void 0,
|
|
441
|
+
gte: void 0,
|
|
442
|
+
lt: void 0,
|
|
443
|
+
lte: void 0
|
|
444
|
+
};
|
|
445
|
+
var filterByNumber = (items, value, field, currency_code) => {
|
|
446
|
+
const { eq, gt, lt, gte, lte } = typeof value === "object" ? { ...defaultOperators, ...value } : { ...defaultOperators, eq: value };
|
|
447
|
+
return items.filter((i) => {
|
|
448
|
+
const returnableQuantity = i.quantity - (i.returned_quantity || 0);
|
|
449
|
+
const refundableAmount = getStylizedAmount(i.refundable || 0, currency_code);
|
|
450
|
+
const itemValue = field === "returnable_quantity" ? returnableQuantity : refundableAmount;
|
|
451
|
+
if (eq) {
|
|
452
|
+
return itemValue === eq;
|
|
453
|
+
}
|
|
454
|
+
let isValid = true;
|
|
455
|
+
if (gt) {
|
|
456
|
+
isValid = isValid && itemValue > gt;
|
|
457
|
+
}
|
|
458
|
+
if (gte) {
|
|
459
|
+
isValid = isValid && itemValue >= gte;
|
|
460
|
+
}
|
|
461
|
+
if (lt) {
|
|
462
|
+
isValid = isValid && itemValue < lt;
|
|
463
|
+
}
|
|
464
|
+
if (lte) {
|
|
465
|
+
isValid = isValid && itemValue <= lte;
|
|
466
|
+
}
|
|
467
|
+
return isValid;
|
|
468
|
+
});
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
// src/pages/orders/order-create-return/components/return-create-form/return-item.tsx
|
|
472
|
+
import { useTranslation as useTranslation4 } from "react-i18next";
|
|
473
|
+
import { IconButton, Input, Text } from "@medusajs/ui";
|
|
474
|
+
import { ChatBubble, DocumentText, XCircle, XMark } from "@medusajs/icons";
|
|
475
|
+
import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
476
|
+
function ReturnItem({
|
|
477
|
+
item,
|
|
478
|
+
previewItem,
|
|
479
|
+
currencyCode,
|
|
480
|
+
form,
|
|
481
|
+
onRemove,
|
|
482
|
+
onUpdate,
|
|
483
|
+
index
|
|
484
|
+
}) {
|
|
485
|
+
const { t } = useTranslation4();
|
|
486
|
+
const { return_reasons = [] } = useReturnReasons({ fields: "+label" });
|
|
487
|
+
const formItem = form.watch(`items.${index}`);
|
|
488
|
+
const showReturnReason = typeof formItem.reason_id === "string";
|
|
489
|
+
const showNote = typeof formItem.note === "string";
|
|
490
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle shadow-elevation-card-rest my-2 rounded-xl ", children: [
|
|
491
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-x-2 gap-y-2 border-b p-3 text-sm md:flex-row", children: [
|
|
492
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center gap-x-3", children: [
|
|
493
|
+
/* @__PURE__ */ jsx3(Thumbnail, { src: item.thumbnail }),
|
|
494
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
495
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
496
|
+
/* @__PURE__ */ jsxs(Text, { className: "txt-small", as: "span", weight: "plus", children: [
|
|
497
|
+
item.title,
|
|
498
|
+
" "
|
|
499
|
+
] }),
|
|
500
|
+
item.variant_sku && /* @__PURE__ */ jsxs("span", { children: [
|
|
501
|
+
"(",
|
|
502
|
+
item.variant_sku,
|
|
503
|
+
")"
|
|
504
|
+
] })
|
|
505
|
+
] }),
|
|
506
|
+
/* @__PURE__ */ jsx3(Text, { as: "div", className: "text-ui-fg-subtle txt-small", children: item.product_title })
|
|
507
|
+
] })
|
|
508
|
+
] }),
|
|
509
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 justify-between", children: [
|
|
510
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-grow items-center gap-2", children: [
|
|
511
|
+
/* @__PURE__ */ jsx3(
|
|
512
|
+
Form.Field,
|
|
513
|
+
{
|
|
514
|
+
control: form.control,
|
|
515
|
+
name: `items.${index}.quantity`,
|
|
516
|
+
render: ({ field }) => {
|
|
517
|
+
return /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
518
|
+
/* @__PURE__ */ jsx3(Form.Control, { children: /* @__PURE__ */ jsx3(
|
|
519
|
+
Input,
|
|
520
|
+
{
|
|
521
|
+
className: "bg-ui-bg-base txt-small w-[67px] rounded-lg",
|
|
522
|
+
min: 1,
|
|
523
|
+
max: item.quantity,
|
|
524
|
+
type: "number",
|
|
525
|
+
...field,
|
|
526
|
+
onChange: (e) => {
|
|
527
|
+
const val = e.target.value;
|
|
528
|
+
const payload = val === "" ? null : Number(val);
|
|
529
|
+
field.onChange(payload);
|
|
530
|
+
if (payload) {
|
|
531
|
+
onUpdate({ quantity: payload });
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
) }),
|
|
536
|
+
/* @__PURE__ */ jsx3(Form.ErrorMessage, {})
|
|
537
|
+
] });
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
),
|
|
541
|
+
/* @__PURE__ */ jsx3(Text, { className: "txt-small text-ui-fg-subtle", children: t("fields.qty") })
|
|
542
|
+
] }),
|
|
543
|
+
/* @__PURE__ */ jsx3("div", { className: "text-ui-fg-subtle txt-small mr-2 flex flex-shrink-0", children: /* @__PURE__ */ jsx3(
|
|
544
|
+
MoneyAmountCell,
|
|
545
|
+
{
|
|
546
|
+
currencyCode,
|
|
547
|
+
amount: previewItem.return_requested_total
|
|
548
|
+
}
|
|
549
|
+
) }),
|
|
550
|
+
/* @__PURE__ */ jsx3(
|
|
551
|
+
ActionMenu,
|
|
552
|
+
{
|
|
553
|
+
groups: [
|
|
554
|
+
{
|
|
555
|
+
actions: [
|
|
556
|
+
!showReturnReason && {
|
|
557
|
+
label: t("actions.addReason"),
|
|
558
|
+
onClick: () => form.setValue(`items.${index}.reason_id`, ""),
|
|
559
|
+
icon: /* @__PURE__ */ jsx3(ChatBubble, {})
|
|
560
|
+
},
|
|
561
|
+
!showNote && {
|
|
562
|
+
label: t("actions.addNote"),
|
|
563
|
+
onClick: () => form.setValue(`items.${index}.note`, ""),
|
|
564
|
+
icon: /* @__PURE__ */ jsx3(DocumentText, {})
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
label: t("actions.remove"),
|
|
568
|
+
onClick: onRemove,
|
|
569
|
+
icon: /* @__PURE__ */ jsx3(XCircle, {})
|
|
570
|
+
}
|
|
571
|
+
].filter(Boolean)
|
|
572
|
+
}
|
|
573
|
+
]
|
|
574
|
+
}
|
|
575
|
+
)
|
|
576
|
+
] })
|
|
577
|
+
] }),
|
|
578
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
579
|
+
showReturnReason && /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-2 p-3 md:grid-cols-2", children: [
|
|
580
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
581
|
+
/* @__PURE__ */ jsx3(Form.Label, { children: t("orders.returns.reason") }),
|
|
582
|
+
/* @__PURE__ */ jsx3(Form.Hint, { className: "!mt-1", children: t("orders.returns.reasonHint") })
|
|
583
|
+
] }),
|
|
584
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
585
|
+
/* @__PURE__ */ jsx3("div", { className: "flex-grow", children: /* @__PURE__ */ jsx3(
|
|
586
|
+
Form.Field,
|
|
587
|
+
{
|
|
588
|
+
control: form.control,
|
|
589
|
+
name: `items.${index}.reason_id`,
|
|
590
|
+
render: ({ field: { ref, value, onChange, ...field } }) => {
|
|
591
|
+
return /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
592
|
+
/* @__PURE__ */ jsx3(Form.Control, { children: /* @__PURE__ */ jsx3(
|
|
593
|
+
Combobox,
|
|
594
|
+
{
|
|
595
|
+
className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover",
|
|
596
|
+
value,
|
|
597
|
+
onChange: (v) => {
|
|
598
|
+
onUpdate({ reason_id: v });
|
|
599
|
+
onChange(v);
|
|
600
|
+
},
|
|
601
|
+
...field,
|
|
602
|
+
options: return_reasons.map((reason) => ({
|
|
603
|
+
label: reason.label,
|
|
604
|
+
value: reason.id
|
|
605
|
+
}))
|
|
606
|
+
}
|
|
607
|
+
) }),
|
|
608
|
+
/* @__PURE__ */ jsx3(Form.ErrorMessage, {})
|
|
609
|
+
] });
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
) }),
|
|
613
|
+
/* @__PURE__ */ jsx3(
|
|
614
|
+
IconButton,
|
|
615
|
+
{
|
|
616
|
+
type: "button",
|
|
617
|
+
className: "flex-shrink",
|
|
618
|
+
variant: "transparent",
|
|
619
|
+
onClick: () => {
|
|
620
|
+
onUpdate({ reason_id: null });
|
|
621
|
+
form.setValue(`items.${index}.reason_id`, null);
|
|
622
|
+
},
|
|
623
|
+
children: /* @__PURE__ */ jsx3(XMark, { className: "text-ui-fg-muted" })
|
|
624
|
+
}
|
|
625
|
+
)
|
|
626
|
+
] })
|
|
627
|
+
] }),
|
|
628
|
+
showNote && /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-2 p-3 md:grid-cols-2", children: [
|
|
629
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
630
|
+
/* @__PURE__ */ jsx3(Form.Label, { children: t("orders.returns.note") }),
|
|
631
|
+
/* @__PURE__ */ jsx3(Form.Hint, { className: "!mt-1", children: t("orders.returns.noteHint") })
|
|
632
|
+
] }),
|
|
633
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
634
|
+
/* @__PURE__ */ jsx3("div", { className: "flex-grow", children: /* @__PURE__ */ jsx3(
|
|
635
|
+
Form.Field,
|
|
636
|
+
{
|
|
637
|
+
control: form.control,
|
|
638
|
+
name: `items.${index}.note`,
|
|
639
|
+
render: ({ field: { ref, onChange, ...field } }) => {
|
|
640
|
+
return /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
641
|
+
/* @__PURE__ */ jsx3(Form.Control, { children: /* @__PURE__ */ jsx3(
|
|
642
|
+
Input,
|
|
643
|
+
{
|
|
644
|
+
onChange,
|
|
645
|
+
...field,
|
|
646
|
+
onBlur: () => onUpdate({ internal_note: field.value }),
|
|
647
|
+
className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover"
|
|
648
|
+
}
|
|
649
|
+
) }),
|
|
650
|
+
/* @__PURE__ */ jsx3(Form.ErrorMessage, {})
|
|
651
|
+
] });
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
) }),
|
|
655
|
+
/* @__PURE__ */ jsx3(
|
|
656
|
+
IconButton,
|
|
657
|
+
{
|
|
658
|
+
type: "button",
|
|
659
|
+
className: "flex-shrink",
|
|
660
|
+
variant: "transparent",
|
|
661
|
+
onClick: () => {
|
|
662
|
+
form.setValue(`items.${index}.note`, {
|
|
663
|
+
shouldDirty: true,
|
|
664
|
+
shouldTouch: true
|
|
665
|
+
});
|
|
666
|
+
onUpdate({ internal_note: null });
|
|
667
|
+
},
|
|
668
|
+
children: /* @__PURE__ */ jsx3(XMark, { className: "text-ui-fg-muted" })
|
|
669
|
+
}
|
|
670
|
+
)
|
|
671
|
+
] })
|
|
672
|
+
] })
|
|
673
|
+
] })
|
|
674
|
+
] });
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// src/pages/orders/order-create-return/components/return-create-form/schema.ts
|
|
678
|
+
import { z } from "zod";
|
|
679
|
+
var ReturnCreateSchema = z.object({
|
|
680
|
+
items: z.array(
|
|
681
|
+
z.object({
|
|
682
|
+
item_id: z.string(),
|
|
683
|
+
quantity: z.number(),
|
|
684
|
+
reason_id: z.string().optional().nullable(),
|
|
685
|
+
note: z.string().optional().nullable()
|
|
686
|
+
})
|
|
687
|
+
),
|
|
688
|
+
location_id: z.string().optional(),
|
|
689
|
+
option_id: z.string(),
|
|
690
|
+
send_notification: z.boolean().optional(),
|
|
691
|
+
// TODO: implement this
|
|
692
|
+
receive_now: z.boolean().optional()
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
// src/pages/orders/order-create-return/components/return-create-form/return-create-form.tsx
|
|
696
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
697
|
+
var selectedItems = [];
|
|
698
|
+
var ReturnCreateForm = ({
|
|
699
|
+
order,
|
|
700
|
+
preview,
|
|
701
|
+
activeReturn
|
|
702
|
+
}) => {
|
|
703
|
+
const { t } = useTranslation5();
|
|
704
|
+
const { handleSuccess } = useRouteModal();
|
|
705
|
+
const itemsMap = useMemo3(
|
|
706
|
+
() => new Map((order.items || []).map((i) => [i.id, i])),
|
|
707
|
+
[order.items]
|
|
708
|
+
);
|
|
709
|
+
const previewItems = useMemo3(
|
|
710
|
+
() => preview.items.filter(
|
|
711
|
+
(i) => !!i.actions?.find((a) => a.return_id === activeReturn.id)
|
|
712
|
+
),
|
|
713
|
+
[preview.items]
|
|
714
|
+
);
|
|
715
|
+
const previewItemsMap = useMemo3(
|
|
716
|
+
() => new Map(previewItems.map((i) => [i.id, i])),
|
|
717
|
+
[previewItems]
|
|
718
|
+
);
|
|
719
|
+
const { setIsOpen } = useStackedModal();
|
|
720
|
+
const [isShippingPriceEdit, setIsShippingPriceEdit] = useState2(false);
|
|
721
|
+
const [customShippingAmount, setCustomShippingAmount] = useState2({
|
|
722
|
+
value: "0",
|
|
723
|
+
float: 0
|
|
724
|
+
});
|
|
725
|
+
const [inventoryMap, setInventoryMap] = useState2({});
|
|
726
|
+
const { stock_locations = [] } = useStockLocations({ limit: 999 });
|
|
727
|
+
const { shipping_options = [] } = useShippingOptions({
|
|
728
|
+
limit: 999,
|
|
729
|
+
fields: "*prices,+service_zone.fulfillment_set.location.id"
|
|
730
|
+
/**
|
|
731
|
+
* TODO: this should accept filter for location_id
|
|
732
|
+
*/
|
|
733
|
+
});
|
|
734
|
+
const { mutateAsync: confirmReturnRequest, isPending: isConfirming } = useConfirmReturnRequest(activeReturn.id, order.id);
|
|
735
|
+
const { mutateAsync: cancelReturnRequest, isPending: isCanceling } = useCancelReturnRequest(activeReturn.id, order.id);
|
|
736
|
+
const { mutateAsync: updateReturnRequest, isPending: isUpdating } = useUpdateReturn(activeReturn.id, order.id);
|
|
737
|
+
const { mutateAsync: addReturnShipping, isPending: isAddingReturnShipping } = useAddReturnShipping(activeReturn.id, order.id);
|
|
738
|
+
const {
|
|
739
|
+
mutateAsync: updateReturnShipping,
|
|
740
|
+
isPending: isUpdatingReturnShipping
|
|
741
|
+
} = useUpdateReturnShipping(activeReturn.id, order.id);
|
|
742
|
+
const {
|
|
743
|
+
mutateAsync: deleteReturnShipping,
|
|
744
|
+
isPending: isDeletingReturnShipping
|
|
745
|
+
} = useDeleteReturnShipping(activeReturn.id, order.id);
|
|
746
|
+
const { mutateAsync: addReturnItem, isPending: isAddingReturnItem } = useAddReturnItem(activeReturn.id, order.id);
|
|
747
|
+
const { mutateAsync: removeReturnItem, isPending: isRemovingReturnItem } = useRemoveReturnItem(activeReturn.id, order.id);
|
|
748
|
+
const { mutateAsync: updateReturnItem, isPending: isUpdatingReturnItem } = useUpdateReturnItem(activeReturn.id, order.id);
|
|
749
|
+
const isRequestLoading = isConfirming || isCanceling || isAddingReturnShipping || isUpdatingReturnShipping || isDeletingReturnShipping || isAddingReturnItem || isRemovingReturnItem || isUpdatingReturnItem || isUpdating;
|
|
750
|
+
const form = useForm({
|
|
751
|
+
/**
|
|
752
|
+
* TODO: reason selection once Return reason settings are added
|
|
753
|
+
*/
|
|
754
|
+
defaultValues: () => {
|
|
755
|
+
const method = preview.shipping_methods.find(
|
|
756
|
+
(s) => !!s.actions?.find((a) => a.action === "SHIPPING_ADD")
|
|
757
|
+
);
|
|
758
|
+
return Promise.resolve({
|
|
759
|
+
items: previewItems.map((i) => ({
|
|
760
|
+
item_id: i.id,
|
|
761
|
+
quantity: i.detail.return_requested_quantity,
|
|
762
|
+
note: i.actions?.find((a) => a.action === "RETURN_ITEM")?.internal_note,
|
|
763
|
+
reason_id: i.actions?.find((a) => a.action === "RETURN_ITEM")?.details?.reason_id
|
|
764
|
+
})),
|
|
765
|
+
option_id: method ? method.shipping_option_id : "",
|
|
766
|
+
location_id: activeReturn?.location_id,
|
|
767
|
+
send_notification: false
|
|
768
|
+
});
|
|
769
|
+
},
|
|
770
|
+
resolver: zodResolver(ReturnCreateSchema)
|
|
771
|
+
});
|
|
772
|
+
const {
|
|
773
|
+
fields: items,
|
|
774
|
+
append,
|
|
775
|
+
remove,
|
|
776
|
+
update
|
|
777
|
+
} = useFieldArray({
|
|
778
|
+
name: "items",
|
|
779
|
+
control: form.control
|
|
780
|
+
});
|
|
781
|
+
useEffect(() => {
|
|
782
|
+
const existingItemsMap = {};
|
|
783
|
+
previewItems.forEach((i) => {
|
|
784
|
+
const ind = items.findIndex((field) => field.item_id === i.id);
|
|
785
|
+
if (!i.detail.return_requested_quantity) {
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
existingItemsMap[i.id] = true;
|
|
789
|
+
if (ind > -1) {
|
|
790
|
+
if (items[ind].quantity !== i.detail.return_requested_quantity) {
|
|
791
|
+
const returnItemAction = i.actions?.find(
|
|
792
|
+
(a) => a.action === "RETURN_ITEM"
|
|
793
|
+
);
|
|
794
|
+
update(ind, {
|
|
795
|
+
...items[ind],
|
|
796
|
+
quantity: i.detail.return_requested_quantity,
|
|
797
|
+
note: returnItemAction?.internal_note,
|
|
798
|
+
reason_id: returnItemAction?.details?.reason_id
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
} else {
|
|
802
|
+
append({ item_id: i.id, quantity: i.detail.return_requested_quantity });
|
|
803
|
+
}
|
|
804
|
+
});
|
|
805
|
+
items.forEach((i, ind) => {
|
|
806
|
+
if (!(i.item_id in existingItemsMap)) {
|
|
807
|
+
remove(ind);
|
|
808
|
+
}
|
|
809
|
+
});
|
|
810
|
+
}, [previewItems]);
|
|
811
|
+
useEffect(() => {
|
|
812
|
+
const method = preview.shipping_methods?.find(
|
|
813
|
+
(s) => !!s.actions?.find((a) => a.action === "SHIPPING_ADD")
|
|
814
|
+
);
|
|
815
|
+
if (method) {
|
|
816
|
+
form.setValue("option_id", method.shipping_option_id);
|
|
817
|
+
} else {
|
|
818
|
+
form.setValue("option_id", "");
|
|
819
|
+
}
|
|
820
|
+
}, [preview.shipping_methods]);
|
|
821
|
+
const showPlaceholder = !items.length;
|
|
822
|
+
const locationId = form.watch("location_id");
|
|
823
|
+
const shippingOptionId = form.watch("option_id");
|
|
824
|
+
const prompt = usePrompt();
|
|
825
|
+
const handleSubmit = form.handleSubmit(async (data) => {
|
|
826
|
+
try {
|
|
827
|
+
const res = await prompt({
|
|
828
|
+
title: t("general.areYouSure"),
|
|
829
|
+
description: t("orders.returns.confirmText"),
|
|
830
|
+
confirmText: t("actions.continue"),
|
|
831
|
+
cancelText: t("actions.cancel"),
|
|
832
|
+
variant: "confirmation"
|
|
833
|
+
});
|
|
834
|
+
if (!res) {
|
|
835
|
+
return;
|
|
836
|
+
}
|
|
837
|
+
await confirmReturnRequest({ no_notification: !data.send_notification });
|
|
838
|
+
handleSuccess();
|
|
839
|
+
} catch (e) {
|
|
840
|
+
toast.error(t("general.error"), {
|
|
841
|
+
description: e.message,
|
|
842
|
+
dismissLabel: t("actions.close")
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
});
|
|
846
|
+
const onItemsSelected = () => {
|
|
847
|
+
addReturnItem({
|
|
848
|
+
items: selectedItems.map((id) => ({
|
|
849
|
+
id,
|
|
850
|
+
quantity: 1
|
|
851
|
+
}))
|
|
852
|
+
});
|
|
853
|
+
setIsOpen("items", false);
|
|
854
|
+
};
|
|
855
|
+
const onLocationChange = async (selectedLocationId) => {
|
|
856
|
+
await updateReturnRequest({ location_id: selectedLocationId });
|
|
857
|
+
};
|
|
858
|
+
const onShippingOptionChange = async (selectedOptionId) => {
|
|
859
|
+
const promises = preview.shipping_methods.map((s) => s.actions?.find((a) => a.action === "SHIPPING_ADD")?.id).filter(Boolean).map(deleteReturnShipping);
|
|
860
|
+
await Promise.all(promises);
|
|
861
|
+
if (selectedOptionId) {
|
|
862
|
+
await addReturnShipping({ shipping_option_id: selectedOptionId });
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
useEffect(() => {
|
|
866
|
+
if (isShippingPriceEdit) {
|
|
867
|
+
document.getElementById("js-shipping-input").focus();
|
|
868
|
+
}
|
|
869
|
+
}, [isShippingPriceEdit]);
|
|
870
|
+
useEffect(() => {
|
|
871
|
+
form.setValue("location_id", activeReturn?.location_id || "");
|
|
872
|
+
}, [activeReturn]);
|
|
873
|
+
const showLevelsWarning = useMemo3(() => {
|
|
874
|
+
if (!locationId) {
|
|
875
|
+
return false;
|
|
876
|
+
}
|
|
877
|
+
const allItemsHaveLocation = items.map((_i) => {
|
|
878
|
+
const item = itemsMap.get(_i.item_id);
|
|
879
|
+
if (!item?.variant_id) {
|
|
880
|
+
return true;
|
|
881
|
+
}
|
|
882
|
+
if (!item.variant?.manage_inventory) {
|
|
883
|
+
return true;
|
|
884
|
+
}
|
|
885
|
+
return inventoryMap[item.variant_id]?.find(
|
|
886
|
+
(l) => l.location_id === locationId
|
|
887
|
+
);
|
|
888
|
+
}).every(Boolean);
|
|
889
|
+
return !allItemsHaveLocation;
|
|
890
|
+
}, [items, inventoryMap, locationId]);
|
|
891
|
+
useEffect(() => {
|
|
892
|
+
const getInventoryMap = async () => {
|
|
893
|
+
const ret = {};
|
|
894
|
+
if (!items.length) {
|
|
895
|
+
return ret;
|
|
896
|
+
}
|
|
897
|
+
(await Promise.all(
|
|
898
|
+
items.map(async (_i) => {
|
|
899
|
+
const item = itemsMap.get(_i.item_id);
|
|
900
|
+
if (!item.variant_id) {
|
|
901
|
+
return void 0;
|
|
902
|
+
}
|
|
903
|
+
return await sdk.admin.product.retrieveVariant(
|
|
904
|
+
item.product_id,
|
|
905
|
+
item.variant_id,
|
|
906
|
+
{ fields: "*inventory,*inventory.location_levels" }
|
|
907
|
+
);
|
|
908
|
+
})
|
|
909
|
+
)).filter((it) => it?.variant).forEach((item) => {
|
|
910
|
+
const { variant } = item;
|
|
911
|
+
const levels = variant.inventory[0]?.location_levels;
|
|
912
|
+
if (!levels) {
|
|
913
|
+
return;
|
|
914
|
+
}
|
|
915
|
+
ret[variant.id] = levels;
|
|
916
|
+
});
|
|
917
|
+
return ret;
|
|
918
|
+
};
|
|
919
|
+
getInventoryMap().then((map) => {
|
|
920
|
+
setInventoryMap(map);
|
|
921
|
+
});
|
|
922
|
+
}, [items]);
|
|
923
|
+
const returnTotal = preview.return_requested_total;
|
|
924
|
+
const shippingTotal = useMemo3(() => {
|
|
925
|
+
const method = preview.shipping_methods.find(
|
|
926
|
+
(sm) => !!sm.actions?.find((a) => a.action === "SHIPPING_ADD")
|
|
927
|
+
);
|
|
928
|
+
return method?.total || 0;
|
|
929
|
+
}, [preview.shipping_methods]);
|
|
930
|
+
return /* @__PURE__ */ jsx4(
|
|
931
|
+
RouteFocusModal.Form,
|
|
932
|
+
{
|
|
933
|
+
form,
|
|
934
|
+
onClose: (isSubmitSuccessful) => {
|
|
935
|
+
if (!isSubmitSuccessful) {
|
|
936
|
+
cancelReturnRequest();
|
|
937
|
+
}
|
|
938
|
+
},
|
|
939
|
+
"data-testid": "order-create-return-form",
|
|
940
|
+
children: /* @__PURE__ */ jsxs2(KeyboundForm, { onSubmit: handleSubmit, className: "flex h-full flex-col", children: [
|
|
941
|
+
/* @__PURE__ */ jsx4(RouteFocusModal.Header, { "data-testid": "order-create-return-header" }),
|
|
942
|
+
/* @__PURE__ */ jsx4(RouteFocusModal.Body, { className: "flex size-full justify-center overflow-y-auto", "data-testid": "order-create-return-body", children: /* @__PURE__ */ jsxs2("div", { className: "mt-16 w-[720px] max-w-[100%] px-4 md:p-0", children: [
|
|
943
|
+
/* @__PURE__ */ jsx4(Heading, { level: "h1", "data-testid": "order-create-return-heading", children: t("orders.returns.create") }),
|
|
944
|
+
/* @__PURE__ */ jsxs2("div", { className: "mt-8 flex items-center justify-between", "data-testid": "order-create-return-inbound-header", children: [
|
|
945
|
+
/* @__PURE__ */ jsx4(Heading, { level: "h2", "data-testid": "order-create-return-inbound-heading", children: t("orders.returns.inbound") }),
|
|
946
|
+
/* @__PURE__ */ jsxs2(StackedFocusModal, { id: "items", "data-testid": "order-create-return-add-items-modal", children: [
|
|
947
|
+
/* @__PURE__ */ jsx4(StackedFocusModal.Trigger, { asChild: true, children: /* @__PURE__ */ jsx4("a", { className: "focus-visible:shadow-borders-focus transition-fg txt-compact-small-plus cursor-pointer text-blue-500 outline-none hover:text-blue-400", "data-testid": "order-create-return-add-items-button", children: t("actions.addItems") }) }),
|
|
948
|
+
/* @__PURE__ */ jsxs2(StackedFocusModal.Content, { children: [
|
|
949
|
+
/* @__PURE__ */ jsx4(StackedFocusModal.Header, {}),
|
|
950
|
+
/* @__PURE__ */ jsx4(
|
|
951
|
+
AddReturnItemsTable,
|
|
952
|
+
{
|
|
953
|
+
items: order.items,
|
|
954
|
+
selectedItems: items.map((i) => i.item_id),
|
|
955
|
+
currencyCode: order.currency_code,
|
|
956
|
+
onSelectionChange: (s) => selectedItems = s
|
|
957
|
+
}
|
|
958
|
+
),
|
|
959
|
+
/* @__PURE__ */ jsx4(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsx4("div", { className: "flex w-full items-center justify-end gap-x-4", children: /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
960
|
+
/* @__PURE__ */ jsx4(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx4(
|
|
961
|
+
Button,
|
|
962
|
+
{
|
|
963
|
+
type: "button",
|
|
964
|
+
variant: "secondary",
|
|
965
|
+
size: "small",
|
|
966
|
+
children: t("actions.cancel")
|
|
967
|
+
}
|
|
968
|
+
) }),
|
|
969
|
+
/* @__PURE__ */ jsx4(
|
|
970
|
+
Button,
|
|
971
|
+
{
|
|
972
|
+
type: "submit",
|
|
973
|
+
variant: "primary",
|
|
974
|
+
size: "small",
|
|
975
|
+
role: "button",
|
|
976
|
+
onClick: () => onItemsSelected(),
|
|
977
|
+
children: t("actions.save")
|
|
978
|
+
},
|
|
979
|
+
"submit-button"
|
|
980
|
+
)
|
|
981
|
+
] }) }) })
|
|
982
|
+
] })
|
|
983
|
+
] })
|
|
984
|
+
] }),
|
|
985
|
+
showPlaceholder && /* @__PURE__ */ jsx4(
|
|
986
|
+
"div",
|
|
987
|
+
{
|
|
988
|
+
style: {
|
|
989
|
+
background: "repeating-linear-gradient(-45deg, rgb(212, 212, 216, 0.15), rgb(212, 212, 216,.15) 10px, transparent 10px, transparent 20px)"
|
|
990
|
+
},
|
|
991
|
+
className: "bg-ui-bg-field mt-4 block h-[56px] w-full rounded-lg border border-dashed"
|
|
992
|
+
}
|
|
993
|
+
),
|
|
994
|
+
items.filter((item) => !!previewItemsMap.get(item.item_id)).map((item, index) => /* @__PURE__ */ jsx4(
|
|
995
|
+
ReturnItem,
|
|
996
|
+
{
|
|
997
|
+
item: itemsMap.get(item.item_id),
|
|
998
|
+
previewItem: previewItemsMap.get(item.item_id),
|
|
999
|
+
currencyCode: order.currency_code,
|
|
1000
|
+
form,
|
|
1001
|
+
onRemove: () => {
|
|
1002
|
+
const actionId = previewItems.find((i) => i.id === item.item_id)?.actions?.find((a) => a.action === "RETURN_ITEM")?.id;
|
|
1003
|
+
if (actionId) {
|
|
1004
|
+
removeReturnItem(actionId);
|
|
1005
|
+
}
|
|
1006
|
+
},
|
|
1007
|
+
onUpdate: (payload) => {
|
|
1008
|
+
const action = previewItems.find((i) => i.id === item.item_id)?.actions?.find((a) => a.action === "RETURN_ITEM");
|
|
1009
|
+
if (action) {
|
|
1010
|
+
updateReturnItem(
|
|
1011
|
+
{ ...payload, actionId: action.id },
|
|
1012
|
+
{
|
|
1013
|
+
onError: (error) => {
|
|
1014
|
+
if (action.details?.quantity && payload.quantity) {
|
|
1015
|
+
form.setValue(
|
|
1016
|
+
`items.${index}.quantity`,
|
|
1017
|
+
action.details?.quantity
|
|
1018
|
+
);
|
|
1019
|
+
}
|
|
1020
|
+
toast.error(error.message);
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
);
|
|
1024
|
+
}
|
|
1025
|
+
},
|
|
1026
|
+
index
|
|
1027
|
+
},
|
|
1028
|
+
item.id
|
|
1029
|
+
)),
|
|
1030
|
+
!showPlaceholder && /* @__PURE__ */ jsxs2("div", { className: "mt-8 flex flex-col gap-y-4", children: [
|
|
1031
|
+
/* @__PURE__ */ jsxs2("div", { className: "grid grid-cols-1 gap-2 md:grid-cols-2", "data-testid": "order-create-return-location-section", children: [
|
|
1032
|
+
/* @__PURE__ */ jsxs2("div", { children: [
|
|
1033
|
+
/* @__PURE__ */ jsx4(Form.Label, { "data-testid": "order-create-return-location-label", children: t("orders.returns.location") }),
|
|
1034
|
+
/* @__PURE__ */ jsx4(Form.Hint, { className: "!mt-1", "data-testid": "order-create-return-location-hint", children: t("orders.returns.locationHint") })
|
|
1035
|
+
] }),
|
|
1036
|
+
/* @__PURE__ */ jsx4(
|
|
1037
|
+
Form.Field,
|
|
1038
|
+
{
|
|
1039
|
+
control: form.control,
|
|
1040
|
+
name: "location_id",
|
|
1041
|
+
render: ({ field: { value, onChange, ...field } }) => {
|
|
1042
|
+
return /* @__PURE__ */ jsx4(Form.Item, { "data-testid": "order-create-return-location-item", children: /* @__PURE__ */ jsx4(Form.Control, { "data-testid": "order-create-return-location-control", children: /* @__PURE__ */ jsx4(
|
|
1043
|
+
Combobox,
|
|
1044
|
+
{
|
|
1045
|
+
value,
|
|
1046
|
+
onChange: (v) => {
|
|
1047
|
+
onChange(v);
|
|
1048
|
+
onLocationChange(v);
|
|
1049
|
+
},
|
|
1050
|
+
...field,
|
|
1051
|
+
options: (stock_locations ?? []).map(
|
|
1052
|
+
(stockLocation) => ({
|
|
1053
|
+
label: stockLocation.name,
|
|
1054
|
+
value: stockLocation.id
|
|
1055
|
+
})
|
|
1056
|
+
),
|
|
1057
|
+
"data-testid": "order-create-return-location-combobox"
|
|
1058
|
+
}
|
|
1059
|
+
) }) });
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
)
|
|
1063
|
+
] }),
|
|
1064
|
+
/* @__PURE__ */ jsxs2("div", { className: "grid grid-cols-1 gap-2 md:grid-cols-2", "data-testid": "order-create-return-shipping-section", children: [
|
|
1065
|
+
/* @__PURE__ */ jsxs2("div", { children: [
|
|
1066
|
+
/* @__PURE__ */ jsxs2(Form.Label, { "data-testid": "order-create-return-shipping-label", children: [
|
|
1067
|
+
t("orders.returns.inboundShipping"),
|
|
1068
|
+
/* @__PURE__ */ jsxs2(
|
|
1069
|
+
Text2,
|
|
1070
|
+
{
|
|
1071
|
+
size: "small",
|
|
1072
|
+
leading: "compact",
|
|
1073
|
+
className: "text-ui-fg-muted ml-1 inline",
|
|
1074
|
+
children: [
|
|
1075
|
+
"(",
|
|
1076
|
+
t("fields.optional"),
|
|
1077
|
+
")"
|
|
1078
|
+
]
|
|
1079
|
+
}
|
|
1080
|
+
)
|
|
1081
|
+
] }),
|
|
1082
|
+
/* @__PURE__ */ jsx4(Form.Hint, { className: "!mt-1", "data-testid": "order-create-return-shipping-hint", children: t("orders.returns.inboundShippingHint") })
|
|
1083
|
+
] }),
|
|
1084
|
+
/* @__PURE__ */ jsx4(
|
|
1085
|
+
Form.Field,
|
|
1086
|
+
{
|
|
1087
|
+
control: form.control,
|
|
1088
|
+
name: "option_id",
|
|
1089
|
+
render: ({ field: { value, onChange, ...field } }) => {
|
|
1090
|
+
return /* @__PURE__ */ jsx4(Form.Item, { "data-testid": "order-create-return-shipping-item", children: /* @__PURE__ */ jsx4(Form.Control, { "data-testid": "order-create-return-shipping-control", children: /* @__PURE__ */ jsx4(
|
|
1091
|
+
Combobox,
|
|
1092
|
+
{
|
|
1093
|
+
allowClear: true,
|
|
1094
|
+
value,
|
|
1095
|
+
onChange: (v) => {
|
|
1096
|
+
onChange(v);
|
|
1097
|
+
onShippingOptionChange(v);
|
|
1098
|
+
},
|
|
1099
|
+
...field,
|
|
1100
|
+
options: (shipping_options ?? []).filter(
|
|
1101
|
+
(so) => (locationId ? so.service_zone.fulfillment_set.location.id === locationId : true) && !!so.rules.find(
|
|
1102
|
+
(r) => r.attribute === "is_return" && r.value === "true"
|
|
1103
|
+
)
|
|
1104
|
+
).map((so) => ({
|
|
1105
|
+
label: so.name,
|
|
1106
|
+
value: so.id
|
|
1107
|
+
})),
|
|
1108
|
+
disabled: !locationId,
|
|
1109
|
+
noResultsPlaceholder: /* @__PURE__ */ jsx4(ReturnShippingPlaceholder, {}),
|
|
1110
|
+
"data-testid": "order-create-return-shipping-combobox"
|
|
1111
|
+
}
|
|
1112
|
+
) }) });
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
)
|
|
1116
|
+
] })
|
|
1117
|
+
] }),
|
|
1118
|
+
showLevelsWarning && /* @__PURE__ */ jsxs2(Alert, { variant: "warning", dismissible: true, className: "mt-4 p-5", children: [
|
|
1119
|
+
/* @__PURE__ */ jsx4("div", { className: "text-ui-fg-subtle txt-small pb-2 font-medium leading-[20px]", children: t("orders.returns.noInventoryLevel") }),
|
|
1120
|
+
/* @__PURE__ */ jsx4(Text2, { className: "text-ui-fg-subtle txt-small leading-normal", children: t("orders.returns.noInventoryLevelDesc") })
|
|
1121
|
+
] }),
|
|
1122
|
+
/* @__PURE__ */ jsxs2("div", { className: "mt-8 border-y border-dotted py-4", "data-testid": "order-create-return-totals", children: [
|
|
1123
|
+
/* @__PURE__ */ jsxs2("div", { className: "mb-2 flex items-center justify-between", "data-testid": "order-create-return-total-row", children: [
|
|
1124
|
+
/* @__PURE__ */ jsx4("span", { className: "txt-small text-ui-fg-subtle", children: t("orders.returns.returnTotal") }),
|
|
1125
|
+
/* @__PURE__ */ jsx4("span", { className: "txt-small text-ui-fg-subtle", children: getStylizedAmount(
|
|
1126
|
+
returnTotal ? -1 * returnTotal : returnTotal,
|
|
1127
|
+
order.currency_code
|
|
1128
|
+
) })
|
|
1129
|
+
] }),
|
|
1130
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between", "data-testid": "order-create-return-shipping-total-row", children: [
|
|
1131
|
+
/* @__PURE__ */ jsx4("span", { className: "txt-small text-ui-fg-subtle", children: t("orders.returns.inboundShipping") }),
|
|
1132
|
+
/* @__PURE__ */ jsxs2("span", { className: "txt-small text-ui-fg-subtle flex items-center", children: [
|
|
1133
|
+
!isShippingPriceEdit && /* @__PURE__ */ jsx4(
|
|
1134
|
+
IconButton2,
|
|
1135
|
+
{
|
|
1136
|
+
onClick: () => setIsShippingPriceEdit(true),
|
|
1137
|
+
variant: "transparent",
|
|
1138
|
+
className: "text-ui-fg-muted",
|
|
1139
|
+
disabled: showPlaceholder || !shippingOptionId,
|
|
1140
|
+
"data-testid": "order-create-return-shipping-edit-button",
|
|
1141
|
+
children: /* @__PURE__ */ jsx4(PencilSquare, {})
|
|
1142
|
+
}
|
|
1143
|
+
),
|
|
1144
|
+
isShippingPriceEdit ? /* @__PURE__ */ jsx4(
|
|
1145
|
+
CurrencyInput,
|
|
1146
|
+
{
|
|
1147
|
+
id: "js-shipping-input",
|
|
1148
|
+
onBlur: () => {
|
|
1149
|
+
let actionId;
|
|
1150
|
+
preview.shipping_methods.forEach((s) => {
|
|
1151
|
+
if (s.actions) {
|
|
1152
|
+
for (const a of s.actions) {
|
|
1153
|
+
if (a.action === "SHIPPING_ADD") {
|
|
1154
|
+
actionId = a.id;
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
});
|
|
1159
|
+
if (actionId) {
|
|
1160
|
+
updateReturnShipping({
|
|
1161
|
+
actionId,
|
|
1162
|
+
custom_amount: customShippingAmount.float
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1165
|
+
setIsShippingPriceEdit(false);
|
|
1166
|
+
},
|
|
1167
|
+
symbol: currencies[order.currency_code.toUpperCase()].symbol_native,
|
|
1168
|
+
code: order.currency_code,
|
|
1169
|
+
onValueChange: (_value, _name, values) => setCustomShippingAmount({
|
|
1170
|
+
value: values?.value ?? "",
|
|
1171
|
+
float: values?.float ?? null
|
|
1172
|
+
}),
|
|
1173
|
+
value: customShippingAmount.value,
|
|
1174
|
+
disabled: showPlaceholder,
|
|
1175
|
+
"data-testid": "order-create-return-shipping-amount-input"
|
|
1176
|
+
}
|
|
1177
|
+
) : getStylizedAmount(shippingTotal, order.currency_code)
|
|
1178
|
+
] })
|
|
1179
|
+
] }),
|
|
1180
|
+
/* @__PURE__ */ jsxs2("div", { className: "mt-4 flex items-center justify-between border-t border-dotted pt-4", "data-testid": "order-create-return-difference-row", children: [
|
|
1181
|
+
/* @__PURE__ */ jsx4("span", { className: "txt-small font-medium", children: t("orders.returns.estDifference") }),
|
|
1182
|
+
/* @__PURE__ */ jsx4("span", { className: "txt-small font-medium", children: getStylizedAmount(
|
|
1183
|
+
preview.summary.pending_difference,
|
|
1184
|
+
order.currency_code
|
|
1185
|
+
) })
|
|
1186
|
+
] })
|
|
1187
|
+
] }),
|
|
1188
|
+
/* @__PURE__ */ jsx4("div", { className: "bg-ui-bg-field mt-8 rounded-lg border py-2 pl-2 pr-4", "data-testid": "order-create-return-notification", children: /* @__PURE__ */ jsx4(
|
|
1189
|
+
Form.Field,
|
|
1190
|
+
{
|
|
1191
|
+
control: form.control,
|
|
1192
|
+
name: "send_notification",
|
|
1193
|
+
render: ({ field: { onChange, value, ...field } }) => {
|
|
1194
|
+
return /* @__PURE__ */ jsxs2(Form.Item, { "data-testid": "order-create-return-notification-item", children: [
|
|
1195
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center", children: [
|
|
1196
|
+
/* @__PURE__ */ jsx4(Form.Control, { className: "mr-4 self-start", "data-testid": "order-create-return-notification-control", children: /* @__PURE__ */ jsx4(
|
|
1197
|
+
Switch,
|
|
1198
|
+
{
|
|
1199
|
+
dir: "ltr",
|
|
1200
|
+
className: "mt-[2px] rtl:rotate-180",
|
|
1201
|
+
checked: !!value,
|
|
1202
|
+
onCheckedChange: onChange,
|
|
1203
|
+
...field,
|
|
1204
|
+
"data-testid": "order-create-return-notification-switch"
|
|
1205
|
+
}
|
|
1206
|
+
) }),
|
|
1207
|
+
/* @__PURE__ */ jsxs2("div", { className: "block", children: [
|
|
1208
|
+
/* @__PURE__ */ jsx4(Form.Label, { "data-testid": "order-create-return-notification-label", children: t("orders.returns.sendNotification") }),
|
|
1209
|
+
/* @__PURE__ */ jsx4(Form.Hint, { className: "!mt-1", "data-testid": "order-create-return-notification-hint", children: t("orders.returns.sendNotificationHint") })
|
|
1210
|
+
] })
|
|
1211
|
+
] }),
|
|
1212
|
+
/* @__PURE__ */ jsx4(Form.ErrorMessage, { "data-testid": "order-create-return-notification-error" })
|
|
1213
|
+
] });
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
) }),
|
|
1217
|
+
/* @__PURE__ */ jsx4("div", { className: "p-8" })
|
|
1218
|
+
] }) }),
|
|
1219
|
+
/* @__PURE__ */ jsx4(RouteFocusModal.Footer, { "data-testid": "order-create-return-footer", children: /* @__PURE__ */ jsx4("div", { className: "flex w-full items-center justify-end gap-x-4", children: /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
1220
|
+
/* @__PURE__ */ jsx4(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx4(Button, { type: "button", variant: "secondary", size: "small", "data-testid": "order-create-return-cancel-button", children: t("orders.returns.cancel.title") }) }),
|
|
1221
|
+
/* @__PURE__ */ jsx4(
|
|
1222
|
+
Button,
|
|
1223
|
+
{
|
|
1224
|
+
type: "submit",
|
|
1225
|
+
variant: "primary",
|
|
1226
|
+
size: "small",
|
|
1227
|
+
isLoading: isRequestLoading,
|
|
1228
|
+
"data-testid": "order-create-return-confirm-button",
|
|
1229
|
+
children: t("orders.returns.confirm")
|
|
1230
|
+
},
|
|
1231
|
+
"submit-button"
|
|
1232
|
+
)
|
|
1233
|
+
] }) }) })
|
|
1234
|
+
] })
|
|
1235
|
+
}
|
|
1236
|
+
);
|
|
1237
|
+
};
|
|
1238
|
+
|
|
1239
|
+
// src/pages/orders/order-create-return/return-create.tsx
|
|
1240
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1241
|
+
var IS_REQUEST_RUNNING = false;
|
|
1242
|
+
var ReturnCreate = () => {
|
|
1243
|
+
const { id } = useParams();
|
|
1244
|
+
const navigate = useNavigate();
|
|
1245
|
+
const { t } = useTranslation6();
|
|
1246
|
+
const { order } = useOrder(id, {
|
|
1247
|
+
fields: DEFAULT_FIELDS
|
|
1248
|
+
});
|
|
1249
|
+
const { order: preview } = useOrderPreview(id, void 0, {});
|
|
1250
|
+
const [activeReturnId, setActiveReturnId] = useState3();
|
|
1251
|
+
const { mutateAsync: initiateReturn } = useInitiateReturn(order.id);
|
|
1252
|
+
const { return: activeReturn } = useReturn(activeReturnId, void 0, {
|
|
1253
|
+
enabled: !!activeReturnId
|
|
1254
|
+
});
|
|
1255
|
+
useEffect2(() => {
|
|
1256
|
+
async function run() {
|
|
1257
|
+
if (IS_REQUEST_RUNNING || !preview) {
|
|
1258
|
+
return;
|
|
1259
|
+
}
|
|
1260
|
+
if (preview.order_change) {
|
|
1261
|
+
if (preview.order_change.change_type === "return_request") {
|
|
1262
|
+
setActiveReturnId(preview.order_change.return_id);
|
|
1263
|
+
} else {
|
|
1264
|
+
navigate(`/orders/${order.id}`, { replace: true });
|
|
1265
|
+
toast2.error(t("orders.returns.activeChangeError"));
|
|
1266
|
+
}
|
|
1267
|
+
return;
|
|
1268
|
+
}
|
|
1269
|
+
IS_REQUEST_RUNNING = true;
|
|
1270
|
+
try {
|
|
1271
|
+
const orderReturn = await initiateReturn({ order_id: order.id });
|
|
1272
|
+
setActiveReturnId(orderReturn.id);
|
|
1273
|
+
} catch (e) {
|
|
1274
|
+
navigate(`/orders/${order.id}`, { replace: true });
|
|
1275
|
+
toast2.error(e.message);
|
|
1276
|
+
} finally {
|
|
1277
|
+
IS_REQUEST_RUNNING = false;
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
run();
|
|
1281
|
+
}, [preview]);
|
|
1282
|
+
return /* @__PURE__ */ jsx5(RouteFocusModal, { "data-testid": "order-create-return-modal", children: activeReturn && preview && order && /* @__PURE__ */ jsx5(
|
|
1283
|
+
ReturnCreateForm,
|
|
1284
|
+
{
|
|
1285
|
+
order,
|
|
1286
|
+
activeReturn,
|
|
1287
|
+
preview
|
|
1288
|
+
}
|
|
1289
|
+
) });
|
|
1290
|
+
};
|
|
1291
|
+
export {
|
|
1292
|
+
ReturnCreate as Component
|
|
1293
|
+
};
|