@medusajs/dashboard 2.12.2-snapshot-20251209184934 → 2.12.2
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-PHAHMGXP.mjs → add-campaign-promotions-JQKPED4U.mjs} +2 -2
- package/dist/{adjust-inventory-I5VYMAI4.mjs → adjust-inventory-2MFA656V.mjs} +2 -2
- package/dist/{api-key-management-create-CVRFY4PL.mjs → api-key-management-create-ZUVF3SLR.mjs} +2 -2
- package/dist/{api-key-management-detail-APCZDVLI.mjs → api-key-management-detail-AWFAZIS3.mjs} +4 -4
- package/dist/{api-key-management-edit-JMU3WEPX.mjs → api-key-management-edit-42HNUSXL.mjs} +2 -2
- package/dist/{api-key-management-sales-channels-4OU5VGIG.mjs → api-key-management-sales-channels-7FVABESO.mjs} +2 -2
- package/dist/app.css +0 -4
- package/dist/app.js +4811 -5729
- package/dist/app.mjs +4 -4
- package/dist/{campaign-budget-edit-B5MSE26J.mjs → campaign-budget-edit-6DMZGUCI.mjs} +2 -2
- package/dist/{campaign-configuration-QOE3D2BE.mjs → campaign-configuration-UNFRB5HR.mjs} +2 -2
- package/dist/{campaign-create-FJOECKGT.mjs → campaign-create-QXG7PD3S.mjs} +3 -3
- package/dist/{campaign-detail-ALXFJ4HV.mjs → campaign-detail-63VVZZRR.mjs} +3 -3
- package/dist/{campaign-edit-K2POQH7M.mjs → campaign-edit-HN4US7DV.mjs} +2 -2
- package/dist/{categories-metadata-JQP6TFX3.mjs → categories-metadata-MWCZ2DYL.mjs} +6 -6
- package/dist/{category-create-L2KJCHPO.mjs → category-create-FFIBWXAH.mjs} +2 -2
- package/dist/{category-detail-VGMUHRD2.mjs → category-detail-XL6NRY6P.mjs} +6 -22
- package/dist/{category-edit-U6SLZSAX.mjs → category-edit-74MZ6TXN.mjs} +2 -2
- package/dist/{category-list-W7JW4PWA.mjs → category-list-AH2EGTI7.mjs} +1 -16
- package/dist/{category-organize-LLSVAO3U.mjs → category-organize-B6EFBFKB.mjs} +2 -2
- package/dist/{category-products-26UAVYOO.mjs → category-products-STYU4DUG.mjs} +6 -6
- package/dist/{chunk-RKUXD6IZ.mjs → chunk-25UWYEJX.mjs} +1 -1
- package/dist/{chunk-BZKI5J2M.mjs → chunk-3YPRDSZ6.mjs} +1 -1
- package/dist/{chunk-D6UW7URG.mjs → chunk-42OOM4DJ.mjs} +6 -23
- package/dist/{chunk-7GJ5T4R3.mjs → chunk-4G2UHUXX.mjs} +2 -2
- package/dist/{chunk-ATP7TOOL.mjs → chunk-4YAPXPLM.mjs} +1 -1
- package/dist/{chunk-DCYB22MH.mjs → chunk-AMOGGDOW.mjs} +1 -1
- package/dist/{chunk-HPPR6PXK.mjs → chunk-CZFLKMYE.mjs} +1 -1
- package/dist/{chunk-N3SAXQVR.mjs → chunk-D4J3CEWH.mjs} +2 -2
- package/dist/{chunk-F5I264Q3.mjs → chunk-EQTBJSBZ.mjs} +0 -3
- package/dist/{chunk-UEJOY5PF.mjs → chunk-EXDBX4YX.mjs} +3 -3
- package/dist/{chunk-I6C52ARQ.mjs → chunk-HWKLNKOY.mjs} +1 -1
- package/dist/{chunk-3ESSTIV2.mjs → chunk-JUVGXLY5.mjs} +12 -187
- package/dist/{chunk-LCEKY54O.mjs → chunk-KF7ZWW4K.mjs} +2 -2
- package/dist/{chunk-YIOBBZUB.mjs → chunk-L4NOVTH5.mjs} +2 -2
- package/dist/{chunk-K43NZTDO.mjs → chunk-LHNU4DYZ.mjs} +2 -2
- package/dist/{chunk-MSBISMBI.mjs → chunk-PNPT4W2F.mjs} +1 -1
- package/dist/{chunk-6GLZIACV.mjs → chunk-Q6MSICBU.mjs} +1 -1
- package/dist/{chunk-AE6R7KDB.mjs → chunk-Q6ULXDU6.mjs} +180 -230
- package/dist/{chunk-PS5T2R6J.mjs → chunk-UKECZ5PA.mjs} +3 -3
- package/dist/{chunk-CFQNWTZV.mjs → chunk-UM4OIJZ3.mjs} +1 -1
- package/dist/{chunk-R2EBIESZ.mjs → chunk-XTQ7UFA3.mjs} +1 -1
- package/dist/{chunk-WVA4O7QS.mjs → chunk-XXBP2Z5M.mjs} +1 -1
- package/dist/{chunk-AFXODJBA.mjs → chunk-YV4ANEZF.mjs} +1 -1
- package/dist/{collection-add-products-42BUUEGQ.mjs → collection-add-products-ESZEWJ46.mjs} +6 -6
- package/dist/{collection-create-4JX4YE47.mjs → collection-create-DCRW344Z.mjs} +2 -2
- package/dist/{collection-detail-JLSDQPJA.mjs → collection-detail-K6IVWLIL.mjs} +5 -20
- package/dist/{collection-edit-MXL35GQQ.mjs → collection-edit-UNFEW6HT.mjs} +2 -2
- package/dist/{collection-list-CSUDRQPF.mjs → collection-list-BL7A7SEI.mjs} +5 -20
- package/dist/{collection-metadata-NHI7Q5PP.mjs → collection-metadata-4EYMP7BJ.mjs} +6 -6
- package/dist/{customer-create-IA56MXE6.mjs → customer-create-XCLZENJS.mjs} +2 -2
- package/dist/{customer-create-address-27M25HTO.mjs → customer-create-address-4HZUIAM7.mjs} +2 -2
- package/dist/{customer-detail-TQBDVGSS.mjs → customer-detail-KAS23VQF.mjs} +3 -3
- package/dist/{customer-edit-XQ5NWIVX.mjs → customer-edit-BW5GVTQI.mjs} +2 -2
- package/dist/{customer-group-add-customers-FRJP6RCY.mjs → customer-group-add-customers-HUGHHMU6.mjs} +2 -2
- package/dist/{customer-group-create-RY4FVEIW.mjs → customer-group-create-6YV7W6TI.mjs} +2 -2
- package/dist/{customer-group-detail-VZ2LCJTM.mjs → customer-group-detail-NDATWX3X.mjs} +3 -3
- package/dist/{customer-group-edit-MQWARIQZ.mjs → customer-group-edit-7NXU34BQ.mjs} +2 -2
- package/dist/{customer-group-list-TMPPZ5UL.mjs → customer-group-list-IASP3QHT.mjs} +3 -3
- package/dist/{customer-group-metadata-JQJRLLXG.mjs → customer-group-metadata-WK2BGEGO.mjs} +3 -3
- package/dist/{customer-metadata-HN2DYD5I.mjs → customer-metadata-ZUWCUTM7.mjs} +3 -3
- package/dist/{customers-add-customer-group-U6N2EYQP.mjs → customers-add-customer-group-UCCFXRXX.mjs} +5 -5
- package/dist/{edit-inventory-item-RATTNP2Y.mjs → edit-inventory-item-Y5W6VTHJ.mjs} +2 -2
- package/dist/{edit-inventory-item-attributes-JHH5GSNL.mjs → edit-inventory-item-attributes-NAAZDFEJ.mjs} +2 -2
- package/dist/{edit-reservation-UZCSNLHY.mjs → edit-reservation-2UD4RZJX.mjs} +2 -2
- package/dist/{edit-rules-7TPOBXFZ.mjs → edit-rules-P5A2TLLU.mjs} +5 -5
- package/dist/en.json +0 -12
- package/dist/{inventory-create-2Y5QC3OA.mjs → inventory-create-KXFY3TQL.mjs} +6 -6
- package/dist/{inventory-detail-ZQCVV4RJ.mjs → inventory-detail-ZAZCDL6E.mjs} +3 -3
- package/dist/{inventory-metadata-UVG65D5W.mjs → inventory-metadata-4HGPMO4B.mjs} +6 -6
- package/dist/{inventory-stock-2ERQRZLC.mjs → inventory-stock-KFPSSUND.mjs} +7 -7
- package/dist/{invite-WISVECE2.mjs → invite-VKHAAF4Z.mjs} +2 -3
- package/dist/{location-create-WZ43K3W7.mjs → location-create-RPLEXUZR.mjs} +2 -2
- package/dist/{location-detail-SFDVGAXL.mjs → location-detail-YFDGVGAX.mjs} +5 -7
- package/dist/{location-edit-VCS7GVWQ.mjs → location-edit-L4ISEQHX.mjs} +2 -2
- package/dist/{location-fulfillment-providers-P6H2RGA5.mjs → location-fulfillment-providers-EGPKJDEL.mjs} +6 -6
- package/dist/{location-list-UK3WRDL5.mjs → location-list-Z42ZYHUF.mjs} +2 -3
- package/dist/{location-sales-channels-NKNM5TQK.mjs → location-sales-channels-YMABMECM.mjs} +2 -2
- package/dist/{location-service-zone-create-3FWF3DG5.mjs → location-service-zone-create-NSMZCD5N.mjs} +3 -3
- package/dist/{location-service-zone-edit-KHHMSPXD.mjs → location-service-zone-edit-6OUAFEZD.mjs} +2 -2
- package/dist/{location-service-zone-manage-areas-YFEAZUUN.mjs → location-service-zone-manage-areas-SEC6LKCZ.mjs} +3 -3
- package/dist/{location-service-zone-shipping-option-create-5DDMRKOC.mjs → location-service-zone-shipping-option-create-LEPP6ZKF.mjs} +7 -7
- package/dist/{location-service-zone-shipping-option-edit-QCURIIGL.mjs → location-service-zone-shipping-option-edit-QS6HTWST.mjs} +2 -2
- package/dist/{location-service-zone-shipping-option-pricing-UPEPQWLW.mjs → location-service-zone-shipping-option-pricing-23QLNSBT.mjs} +4 -4
- package/dist/{login-7SC4ZVX5.mjs → login-IQH2HKVZ.mjs} +5 -6
- package/dist/{manage-locations-MLNMPQ5I.mjs → manage-locations-JD6FSBOT.mjs} +2 -2
- package/dist/{order-allocate-items-I5KMPZY5.mjs → order-allocate-items-3DDI4V3W.mjs} +2 -2
- package/dist/{order-create-claim-RNAQKT2N.mjs → order-create-claim-WHQYED4S.mjs} +5 -5
- package/dist/{order-create-edit-SNNGAEC3.mjs → order-create-edit-RAWEHXCU.mjs} +5 -5
- package/dist/{order-create-exchange-OGI2AOM3.mjs → order-create-exchange-P73XCSR7.mjs} +5 -5
- package/dist/{order-create-fulfillment-O77TLXZZ.mjs → order-create-fulfillment-YOL4SA4B.mjs} +5 -5
- package/dist/{order-create-refund-TA6UIOZ2.mjs → order-create-refund-NMP4UN7F.mjs} +5 -5
- package/dist/{order-create-return-LTGYASZZ.mjs → order-create-return-QGXWSPMP.mjs} +2 -2
- package/dist/{order-create-shipment-6WZM3GL3.mjs → order-create-shipment-UTNVNIGA.mjs} +5 -5
- package/dist/{order-detail-6E3BT4AZ.mjs → order-detail-4EFWM3R4.mjs} +3 -3
- package/dist/{order-edit-billing-address-6BPGH6UU.mjs → order-edit-billing-address-WBSP4RAG.mjs} +5 -5
- package/dist/{order-edit-email-WK6ROFAD.mjs → order-edit-email-CBAUBHW7.mjs} +5 -5
- package/dist/{order-edit-shipping-address-4V6MN24B.mjs → order-edit-shipping-address-2TEO4ZRQ.mjs} +5 -5
- package/dist/{order-metadata-LEMDXDSV.mjs → order-metadata-66OZ5ZMN.mjs} +6 -6
- package/dist/{order-receive-return-Q65ZRAPJ.mjs → order-receive-return-2LQFBB4G.mjs} +5 -5
- package/dist/{order-request-transfer-KODTTNE7.mjs → order-request-transfer-IH3PQCCL.mjs} +5 -5
- package/dist/{price-list-configuration-RDE5YPJK.mjs → price-list-configuration-OLIGCEN5.mjs} +3 -3
- package/dist/{price-list-create-GFB6ASPT.mjs → price-list-create-3DCACAZ4.mjs} +9 -9
- package/dist/{price-list-detail-VG7YTBLM.mjs → price-list-detail-2IW4SDOL.mjs} +4 -4
- package/dist/{price-list-edit-LDF52VQU.mjs → price-list-edit-B3LQZSW6.mjs} +2 -2
- package/dist/{price-list-prices-add-4QGLHLRI.mjs → price-list-prices-add-B5LQAR7J.mjs} +8 -8
- package/dist/{price-list-prices-edit-PROYTJF5.mjs → price-list-prices-edit-MAR2T4LM.mjs} +4 -4
- package/dist/{product-attributes-ADDY3FXA.mjs → product-attributes-DY4HDYTW.mjs} +6 -6
- package/dist/{product-create-FZOWZNUP.mjs → product-create-EMK2FPWY.mjs} +7 -7
- package/dist/{product-create-option-UMZKRNTC.mjs → product-create-option-GEGQNSMQ.mjs} +2 -2
- package/dist/{product-create-variant-TXLZHYFS.mjs → product-create-variant-UHUBSUIV.mjs} +6 -6
- package/dist/{product-detail-VXKYKOMR.mjs → product-detail-M3PFNUX7.mjs} +10 -52
- package/dist/{product-edit-52CPZNCH.mjs → product-edit-ULKEZHDA.mjs} +6 -6
- package/dist/{product-edit-option-ZMTSLRG5.mjs → product-edit-option-HBIOBQTS.mjs} +2 -2
- package/dist/{product-export-ZMWNVJL7.mjs → product-export-X7MNQLBY.mjs} +6 -6
- package/dist/{product-image-variants-edit-OB4NVQKS.mjs → product-image-variants-edit-RR5RXMSX.mjs} +5 -5
- package/dist/{product-import-X7YB4W4N.mjs → product-import-OJWU5AHL.mjs} +5 -5
- package/dist/{product-list-TIVHW3ZJ.mjs → product-list-FAVJ2A46.mjs} +5 -17
- package/dist/{product-media-ULNJ7JJY.mjs → product-media-EGK66SRX.mjs} +2 -2
- package/dist/{product-metadata-DPMEFUWJ.mjs → product-metadata-VRLBFMKG.mjs} +6 -6
- package/dist/{product-organization-3RJVV3K2.mjs → product-organization-4PH2ZOSM.mjs} +6 -6
- package/dist/{product-prices-OO7OYVO6.mjs → product-prices-WQDE4XYT.mjs} +3 -3
- package/dist/{product-sales-channels-2PN4L7II.mjs → product-sales-channels-ZICOOOKY.mjs} +2 -2
- package/dist/{product-shipping-profile-45XXB7FM.mjs → product-shipping-profile-KIDRTPWA.mjs} +2 -2
- package/dist/{product-stock-45QDRJSR.mjs → product-stock-EVY7L4ID.mjs} +7 -7
- package/dist/{product-tag-create-L4Y3ZJVU.mjs → product-tag-create-UOQUAMYT.mjs} +5 -5
- package/dist/{product-tag-detail-IE3W2UVN.mjs → product-tag-detail-L2J3IXMC.mjs} +6 -21
- package/dist/{product-tag-edit-OHJGEEDL.mjs → product-tag-edit-AKATEM3L.mjs} +5 -5
- package/dist/{product-tag-list-QWNKVQAP.mjs → product-tag-list-FUQN7YF5.mjs} +6 -21
- package/dist/{product-tag-metadata-PCA3HTLU.mjs → product-tag-metadata-UEOSDTSK.mjs} +6 -6
- package/dist/{product-type-create-KHSNCQCV.mjs → product-type-create-HBDROTGB.mjs} +2 -2
- package/dist/{product-type-detail-XZH6HETD.mjs → product-type-detail-2KUITRE3.mjs} +5 -20
- package/dist/{product-type-edit-3LRBWZ3S.mjs → product-type-edit-H3JCMVRV.mjs} +2 -2
- package/dist/{product-type-list-XU6DADMO.mjs → product-type-list-QX7QC6RI.mjs} +1 -16
- package/dist/{product-type-metadata-5BPLWPOK.mjs → product-type-metadata-7E66UACZ.mjs} +6 -6
- package/dist/{product-variant-detail-7MIRJILL.mjs → product-variant-detail-JHH3ICCS.mjs} +5 -21
- package/dist/{product-variant-edit-JWKDUIEU.mjs → product-variant-edit-IIT3QIHD.mjs} +5 -5
- package/dist/{product-variant-manage-inventory-items-OGM64KYP.mjs → product-variant-manage-inventory-items-BLHCH6QD.mjs} +2 -2
- package/dist/{product-variant-media-C3KCFODU.mjs → product-variant-media-KLSUISGH.mjs} +2 -2
- package/dist/{product-variant-metadata-3CZ67ORB.mjs → product-variant-metadata-UXHU6PFJ.mjs} +6 -6
- package/dist/{profile-edit-YZCUGEXF.mjs → profile-edit-5EEKOEO5.mjs} +2 -2
- package/dist/{promotion-add-campaign-DO67QK6M.mjs → promotion-add-campaign-JRTM7WBR.mjs} +3 -3
- package/dist/{promotion-create-MXMWVA5U.mjs → promotion-create-KPDZWJWC.mjs} +7 -7
- package/dist/{promotion-detail-TZIERYRJ.mjs → promotion-detail-SQARSSGK.mjs} +3 -3
- package/dist/{promotion-edit-details-6BSOOWQN.mjs → promotion-edit-details-AREFQ6O5.mjs} +2 -2
- package/dist/{refund-reason-create-FUW7HCCF.mjs → refund-reason-create-IPZKKRQM.mjs} +5 -5
- package/dist/{refund-reason-edit-N3PKOFRF.mjs → refund-reason-edit-LB66UGH7.mjs} +5 -5
- package/dist/{refund-reason-list-O5ZXIXE5.mjs → refund-reason-list-GOKBW63P.mjs} +3 -3
- package/dist/{region-add-countries-7U4J5RW6.mjs → region-add-countries-AFWXMQ6W.mjs} +2 -2
- package/dist/{region-create-IUGX33M5.mjs → region-create-YC4VZ4AS.mjs} +2 -2
- package/dist/{region-edit-WAU347DP.mjs → region-edit-5GO25GDF.mjs} +2 -2
- package/dist/{region-metadata-IADU5YNP.mjs → region-metadata-S7BUDXPD.mjs} +6 -6
- package/dist/{reservation-create-C6HTEF3R.mjs → reservation-create-Z2SUMBGT.mjs} +2 -2
- package/dist/{reservation-detail-RLP2F23R.mjs → reservation-detail-ZL4WMT4A.mjs} +3 -3
- package/dist/{reservation-metadata-2PRGO5QF.mjs → reservation-metadata-QVEVN2FO.mjs} +6 -6
- package/dist/{reset-password-XKX43KUT.mjs → reset-password-5TAYQEUV.mjs} +2 -3
- package/dist/{return-reason-create-HM54WRJY.mjs → return-reason-create-NXWDC6AC.mjs} +2 -2
- package/dist/{return-reason-edit-VSIRHVQ6.mjs → return-reason-edit-M6IKNNKB.mjs} +2 -2
- package/dist/{sales-channel-add-products-O6RKQB6J.mjs → sales-channel-add-products-LCB33I6H.mjs} +6 -6
- package/dist/{sales-channel-create-4XLJDVJO.mjs → sales-channel-create-E7BDTPWD.mjs} +2 -2
- package/dist/{sales-channel-detail-25VU2BIX.mjs → sales-channel-detail-RUULD6Q7.mjs} +4 -4
- package/dist/{sales-channel-edit-UZGSXD5X.mjs → sales-channel-edit-HMPA3Y3L.mjs} +2 -2
- package/dist/{sales-channel-list-UV44SKO6.mjs → sales-channel-list-5TFALQQS.mjs} +3 -3
- package/dist/{sales-channel-metadata-JODUF46V.mjs → sales-channel-metadata-6WSCB67B.mjs} +6 -6
- package/dist/{shipping-option-type-create-SDJBL6L4.mjs → shipping-option-type-create-IMF4RHSO.mjs} +5 -5
- package/dist/{shipping-option-type-detail-ZPUV6VUQ.mjs → shipping-option-type-detail-PHIHWW6G.mjs} +4 -4
- package/dist/{shipping-option-type-edit-J2LDCKOC.mjs → shipping-option-type-edit-SG4JQZGW.mjs} +5 -5
- package/dist/{shipping-option-type-list-DZY43TDW.mjs → shipping-option-type-list-RB2EKPWN.mjs} +4 -4
- package/dist/{shipping-profile-create-26R64I3Z.mjs → shipping-profile-create-752TMBBE.mjs} +2 -2
- package/dist/{shipping-profile-metadata-ZWYRX3I7.mjs → shipping-profile-metadata-M3DVX5KX.mjs} +6 -6
- package/dist/{store-add-currencies-ZFS3WZHG.mjs → store-add-currencies-3VMLZ6KB.mjs} +2 -2
- package/dist/{store-add-locales-ZUQOMLGE.mjs → store-add-locales-WAHERXN3.mjs} +4 -4
- package/dist/{store-detail-ZQW7H3CD.mjs → store-detail-EY2ZQKZO.mjs} +3 -3
- package/dist/{store-edit-AB5CDUTK.mjs → store-edit-EPAHLLKP.mjs} +2 -2
- package/dist/{store-metadata-VJRBOHHB.mjs → store-metadata-7UPGGK7F.mjs} +6 -6
- package/dist/{tax-region-create-X6TI7GS2.mjs → tax-region-create-LQZKNYTD.mjs} +5 -5
- package/dist/{tax-region-detail-RWVU53ZI.mjs → tax-region-detail-AVG3XLVL.mjs} +12 -13
- package/dist/{tax-region-edit-EAS5YZS4.mjs → tax-region-edit-XR3ABTNA.mjs} +5 -5
- package/dist/{tax-region-list-4MQMCMKY.mjs → tax-region-list-BXZBUXRJ.mjs} +3 -4
- package/dist/{tax-region-province-create-GKJ7WMRS.mjs → tax-region-province-create-5JP3PVID.mjs} +2 -2
- package/dist/{tax-region-province-detail-QAJFG3C4.mjs → tax-region-province-detail-I7FF7NBE.mjs} +11 -12
- package/dist/{tax-region-tax-override-create-UNHHY3TK.mjs → tax-region-tax-override-create-H6LWWOPU.mjs} +7 -7
- package/dist/{tax-region-tax-override-edit-EEOWMLFA.mjs → tax-region-tax-override-edit-SZWBWRCA.mjs} +8 -8
- package/dist/{tax-region-tax-rate-create-MECFGVPL.mjs → tax-region-tax-rate-create-O2SDSXCH.mjs} +2 -2
- package/dist/{tax-region-tax-rate-edit-7DYSPYOD.mjs → tax-region-tax-rate-edit-W62VEVKT.mjs} +2 -2
- package/dist/{user-edit-ZBB4RMTP.mjs → user-edit-LXQCTDGA.mjs} +2 -2
- package/dist/{user-invite-XB635N26.mjs → user-invite-2OKB7SCF.mjs} +2 -2
- package/dist/{user-metadata-EQIFAEGE.mjs → user-metadata-X36GKJ47.mjs} +6 -6
- package/dist/{workflow-execution-detail-XURIJZJ6.mjs → workflow-execution-detail-P6H5AUWI.mjs} +3 -3
- package/package.json +9 -9
- package/src/components/common/icon-avatar/icon-avatar.tsx +0 -4
- package/src/components/layout/settings-layout/settings-layout.tsx +1 -11
- package/src/components/modals/route-focus-modal/route-focus-modal.tsx +3 -8
- package/src/components/modals/route-modal-form/route-modal-form.tsx +1 -6
- package/src/components/modals/route-modal-provider/route-provider.tsx +4 -16
- package/src/dashboard-app/routes/get-route.map.tsx +0 -20
- package/src/hooks/api/index.ts +0 -1
- package/src/hooks/api/product-variants.tsx +1 -7
- package/src/i18n/translations/$schema.json +0 -36
- package/src/i18n/translations/en.json +0 -12
- package/src/i18n/translations/es.json +0 -12
- package/src/routes/categories/category-detail/components/category-general-section/category-general-section.tsx +1 -16
- package/src/routes/categories/category-list/components/category-list-table/category-list-table.tsx +1 -16
- package/src/routes/collections/collection-detail/components/collection-general-section/collection-general-section.tsx +1 -16
- package/src/routes/collections/collection-list/components/collection-list-table/collection-row-actions.tsx +1 -16
- package/src/routes/product-tags/product-tag-detail/components/product-tag-general-section/product-tag-general-section.tsx +1 -16
- package/src/routes/product-tags/product-tag-list/components/product-tag-list-table/product-tag-list-table.tsx +1 -16
- package/src/routes/product-types/product-type-detail/components/product-type-general-section/product-type-general-section.tsx +1 -16
- package/src/routes/product-types/product-type-list/components/product-type-list-table/product-table-row-actions.tsx +1 -16
- package/src/routes/product-variants/product-variant-detail/components/variant-general-section/variant-general-section.tsx +1 -16
- package/src/routes/products/product-detail/components/product-general-section/product-general-section.tsx +1 -16
- package/src/routes/products/product-detail/components/product-variant-section/product-variant-section.tsx +1 -32
- package/src/routes/products/product-list/components/product-list-table/product-list-table.tsx +1 -15
- package/dist/chunk-4Y2NYEXF.mjs +0 -0
- package/dist/chunk-JQBWAJQZ.mjs +0 -0
- package/dist/translation-list-5ZOAGLCT.mjs +0 -146
- package/dist/translations-edit-I6R5ZNFX.mjs +0 -374
- package/src/hooks/api/translations.tsx +0 -254
- package/src/routes/translations/translation-list/index.tsx +0 -1
- package/src/routes/translations/translation-list/translation-list.tsx +0 -131
- package/src/routes/translations/translations-edit/components/translations-edit-form/index.ts +0 -1
- package/src/routes/translations/translations-edit/components/translations-edit-form/translations-edit-form.tsx +0 -405
- package/src/routes/translations/translations-edit/index.ts +0 -1
- package/src/routes/translations/translations-edit/translations-edit.tsx +0 -66
- package/src/routes/translations/translations-edit/utils/index.ts +0 -1
- package/src/routes/translations/translations-edit/utils/reference-label-map.ts +0 -10
- /package/dist/{chunk-CTUJXJYA.mjs → chunk-6WKBBTKM.mjs} +0 -0
- /package/dist/{chunk-IPG3I3J7.mjs → chunk-W7SLPIO2.mjs} +0 -0
|
@@ -1,374 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DataGrid,
|
|
3
|
-
createDataGridHelper
|
|
4
|
-
} from "./chunk-IPG3I3J7.mjs";
|
|
5
|
-
import "./chunk-DK4WIVY6.mjs";
|
|
6
|
-
import "./chunk-IUCDCPJU.mjs";
|
|
7
|
-
import {
|
|
8
|
-
KeyboundForm
|
|
9
|
-
} from "./chunk-6HTZNHPT.mjs";
|
|
10
|
-
import "./chunk-WVA4O7QS.mjs";
|
|
11
|
-
import {
|
|
12
|
-
RouteFocusModal,
|
|
13
|
-
useRouteModal
|
|
14
|
-
} from "./chunk-D6UW7URG.mjs";
|
|
15
|
-
import {
|
|
16
|
-
useFeatureFlag
|
|
17
|
-
} from "./chunk-G4BWCU5P.mjs";
|
|
18
|
-
import "./chunk-LPEUYMRK.mjs";
|
|
19
|
-
import "./chunk-OC7BQLYI.mjs";
|
|
20
|
-
import {
|
|
21
|
-
useDocumentDirection
|
|
22
|
-
} from "./chunk-S4DMV3ZT.mjs";
|
|
23
|
-
import "./chunk-OBQI23QM.mjs";
|
|
24
|
-
import {
|
|
25
|
-
useBatchTranslations,
|
|
26
|
-
useReferenceTranslations
|
|
27
|
-
} from "./chunk-3ESSTIV2.mjs";
|
|
28
|
-
import "./chunk-I4OBEAOJ.mjs";
|
|
29
|
-
import "./chunk-XIVBRONM.mjs";
|
|
30
|
-
import "./chunk-HI6URQ7H.mjs";
|
|
31
|
-
import "./chunk-6CLQKVAU.mjs";
|
|
32
|
-
import "./chunk-KI7TOXBR.mjs";
|
|
33
|
-
import "./chunk-HKIF5HVL.mjs";
|
|
34
|
-
import "./chunk-WAXMT4IY.mjs";
|
|
35
|
-
import "./chunk-DYDGGABK.mjs";
|
|
36
|
-
import "./chunk-LGNTHZ5Y.mjs";
|
|
37
|
-
import "./chunk-CN7JXSGW.mjs";
|
|
38
|
-
import "./chunk-5BQQRHQS.mjs";
|
|
39
|
-
import "./chunk-EUF6RSI7.mjs";
|
|
40
|
-
import "./chunk-5AFMB7XQ.mjs";
|
|
41
|
-
import "./chunk-NHDFPGQ3.mjs";
|
|
42
|
-
import "./chunk-A63RZVX6.mjs";
|
|
43
|
-
import "./chunk-HBXV7ENS.mjs";
|
|
44
|
-
import "./chunk-CDORR33H.mjs";
|
|
45
|
-
import "./chunk-GN6OCHP4.mjs";
|
|
46
|
-
import "./chunk-N4O5FAUC.mjs";
|
|
47
|
-
import "./chunk-7AX6R6G6.mjs";
|
|
48
|
-
import "./chunk-N3FCYZV6.mjs";
|
|
49
|
-
import "./chunk-3BF5SC66.mjs";
|
|
50
|
-
import {
|
|
51
|
-
useStore
|
|
52
|
-
} from "./chunk-VCSSQVPD.mjs";
|
|
53
|
-
import "./chunk-HP2JH45P.mjs";
|
|
54
|
-
import "./chunk-SQDIZZDW.mjs";
|
|
55
|
-
import "./chunk-LEJUZW3P.mjs";
|
|
56
|
-
import "./chunk-FXYH54JP.mjs";
|
|
57
|
-
import "./chunk-774WSTCC.mjs";
|
|
58
|
-
import "./chunk-NFEK63OE.mjs";
|
|
59
|
-
import "./chunk-QZ7TP4HQ.mjs";
|
|
60
|
-
|
|
61
|
-
// src/routes/translations/translations-edit/translations-edit.tsx
|
|
62
|
-
import { useNavigate, useSearchParams } from "react-router-dom";
|
|
63
|
-
|
|
64
|
-
// src/routes/translations/translations-edit/components/translations-edit-form/translations-edit-form.tsx
|
|
65
|
-
import { zodResolver } from "@hookform/resolvers/zod";
|
|
66
|
-
import { Button, ProgressTabs, toast } from "@medusajs/ui";
|
|
67
|
-
import { useMemo, useRef } from "react";
|
|
68
|
-
import { useForm } from "react-hook-form";
|
|
69
|
-
import { useTranslation } from "react-i18next";
|
|
70
|
-
import { z } from "zod";
|
|
71
|
-
|
|
72
|
-
// src/routes/translations/translations-edit/utils/reference-label-map.ts
|
|
73
|
-
var REFERENCE_LABEL_MAP = {
|
|
74
|
-
product: "Products",
|
|
75
|
-
product_variant: "Product Variants",
|
|
76
|
-
product_category: "Product Categories",
|
|
77
|
-
product_collection: "Product Collections",
|
|
78
|
-
product_type: "Product Types",
|
|
79
|
-
product_tag: "Product Tags",
|
|
80
|
-
product_option: "Product Options",
|
|
81
|
-
product_option_value: "Product Option Values"
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
// src/routes/translations/translations-edit/components/translations-edit-form/translations-edit-form.tsx
|
|
85
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
86
|
-
var LocaleTranslationSchema = z.object({
|
|
87
|
-
id: z.string().nullish(),
|
|
88
|
-
locale_code: z.string(),
|
|
89
|
-
fields: z.record(z.string().optional())
|
|
90
|
-
});
|
|
91
|
-
var EntityTranslationsSchema = z.object({
|
|
92
|
-
locales: z.record(LocaleTranslationSchema)
|
|
93
|
-
});
|
|
94
|
-
var TranslationsFormSchema = z.object({
|
|
95
|
-
entities: z.record(EntityTranslationsSchema)
|
|
96
|
-
});
|
|
97
|
-
function isEntityRow(row) {
|
|
98
|
-
return row._type === "entity";
|
|
99
|
-
}
|
|
100
|
-
function initTranslationsFormState(translations, references, availableLocales, translatableFields) {
|
|
101
|
-
const existingMap = /* @__PURE__ */ new Map();
|
|
102
|
-
for (const t of translations) {
|
|
103
|
-
existingMap.set(`${t.reference_id}:${t.locale_code}`, t);
|
|
104
|
-
}
|
|
105
|
-
const entitiesTranslationState = {};
|
|
106
|
-
for (const reference of references) {
|
|
107
|
-
const locales = {};
|
|
108
|
-
for (const locale of availableLocales) {
|
|
109
|
-
const key = `${reference.id}:${locale.locale_code}`;
|
|
110
|
-
const existing = existingMap.get(key);
|
|
111
|
-
const isDefaultLocale = locale.is_default;
|
|
112
|
-
const fields = {};
|
|
113
|
-
for (const fieldName of translatableFields) {
|
|
114
|
-
const fieldValue = isDefaultLocale ? existing?.translations?.[fieldName] ?? reference[fieldName] : existing?.translations?.[fieldName] ?? "";
|
|
115
|
-
fields[fieldName] = fieldValue;
|
|
116
|
-
}
|
|
117
|
-
locales[locale.locale_code] = {
|
|
118
|
-
id: existing?.id ?? null,
|
|
119
|
-
locale_code: locale.locale_code,
|
|
120
|
-
fields
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
entitiesTranslationState[reference.id] = { locales };
|
|
124
|
-
}
|
|
125
|
-
return {
|
|
126
|
-
entities: entitiesTranslationState
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
function buildTranslationRows(references, availableLocales, translations) {
|
|
130
|
-
const existingMap = /* @__PURE__ */ new Map();
|
|
131
|
-
for (const t of translations) {
|
|
132
|
-
existingMap.set(`${t.reference_id}:${t.locale_code}`, t);
|
|
133
|
-
}
|
|
134
|
-
return references.map((reference) => ({
|
|
135
|
-
_type: "entity",
|
|
136
|
-
reference_id: reference.id,
|
|
137
|
-
subRows: availableLocales.map((locale) => {
|
|
138
|
-
const key = `${reference.id}:${locale.locale_code}`;
|
|
139
|
-
const existing = existingMap.get(key);
|
|
140
|
-
return {
|
|
141
|
-
_type: "locale",
|
|
142
|
-
reference_id: reference.id,
|
|
143
|
-
locale_code: locale.locale_code,
|
|
144
|
-
locale_name: locale.locale.name,
|
|
145
|
-
id: existing?.id
|
|
146
|
-
};
|
|
147
|
-
})
|
|
148
|
-
}));
|
|
149
|
-
}
|
|
150
|
-
function transformToBatchPayload(currentState, initialState, entityType) {
|
|
151
|
-
const payload = {
|
|
152
|
-
create: [],
|
|
153
|
-
update: [],
|
|
154
|
-
delete: []
|
|
155
|
-
};
|
|
156
|
-
for (const [entityId, entityData] of Object.entries(currentState.entities)) {
|
|
157
|
-
for (const [localeCode, localeTranslations] of Object.entries(
|
|
158
|
-
entityData.locales
|
|
159
|
-
)) {
|
|
160
|
-
const initial = initialState.entities[entityId]?.locales[localeCode];
|
|
161
|
-
const hasContent = Object.values(localeTranslations.fields).some(
|
|
162
|
-
(v) => v !== void 0 && v.trim() !== ""
|
|
163
|
-
);
|
|
164
|
-
const hadContent = initial && Object.values(initial.fields).some(
|
|
165
|
-
(v) => v !== void 0 && v.trim() !== ""
|
|
166
|
-
);
|
|
167
|
-
if (!localeTranslations.id && hasContent) {
|
|
168
|
-
payload.create.push({
|
|
169
|
-
reference_id: entityId,
|
|
170
|
-
reference: entityType,
|
|
171
|
-
locale_code: localeTranslations.locale_code,
|
|
172
|
-
translations: localeTranslations.fields
|
|
173
|
-
});
|
|
174
|
-
} else if (localeTranslations.id && hasContent) {
|
|
175
|
-
const hasChanged = !initial || JSON.stringify(localeTranslations.fields) !== JSON.stringify(initial.fields);
|
|
176
|
-
if (hasChanged) {
|
|
177
|
-
payload.update.push({
|
|
178
|
-
id: localeTranslations.id,
|
|
179
|
-
translations: localeTranslations.fields
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
} else if (localeTranslations.id && !hasContent && hadContent) {
|
|
183
|
-
payload.delete.push(localeTranslations.id);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
return payload;
|
|
188
|
-
}
|
|
189
|
-
var columnHelper = createDataGridHelper();
|
|
190
|
-
function useTranslationsGridColumns({
|
|
191
|
-
translatableFields
|
|
192
|
-
}) {
|
|
193
|
-
const { t } = useTranslation();
|
|
194
|
-
const columns = useMemo(() => {
|
|
195
|
-
return [
|
|
196
|
-
columnHelper.column({
|
|
197
|
-
id: "locale",
|
|
198
|
-
header: t("translations.bulk.mainColumn"),
|
|
199
|
-
cell: (context) => {
|
|
200
|
-
const row = context.row.original;
|
|
201
|
-
if (isEntityRow(row)) {
|
|
202
|
-
return /* @__PURE__ */ jsx(DataGrid.ReadonlyCell, { context });
|
|
203
|
-
}
|
|
204
|
-
return /* @__PURE__ */ jsx(DataGrid.ReadonlyCell, { context, color: "normal", children: /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center gap-x-2 overflow-hidden", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: row.locale_name }) }) });
|
|
205
|
-
},
|
|
206
|
-
disableHiding: true
|
|
207
|
-
}),
|
|
208
|
-
...translatableFields.map(
|
|
209
|
-
(fieldName) => columnHelper.column({
|
|
210
|
-
id: fieldName,
|
|
211
|
-
header: t(`fields.${fieldName}`, { defaultValue: fieldName }),
|
|
212
|
-
cell: (context) => {
|
|
213
|
-
const row = context.row.original;
|
|
214
|
-
if (isEntityRow(row)) {
|
|
215
|
-
return /* @__PURE__ */ jsx(DataGrid.ReadonlyCell, { context, children: /* @__PURE__ */ jsx("span", { className: "text-ui-fg-muted", children: "\u2014" }) });
|
|
216
|
-
}
|
|
217
|
-
return /* @__PURE__ */ jsx(DataGrid.TextCell, { context });
|
|
218
|
-
},
|
|
219
|
-
field: (context) => {
|
|
220
|
-
const row = context.row.original;
|
|
221
|
-
if (isEntityRow(row)) {
|
|
222
|
-
return null;
|
|
223
|
-
}
|
|
224
|
-
return `entities.${row.reference_id}.locales.${row.locale_code}.fields.${fieldName}`;
|
|
225
|
-
},
|
|
226
|
-
type: "text"
|
|
227
|
-
})
|
|
228
|
-
)
|
|
229
|
-
];
|
|
230
|
-
}, [t, translatableFields]);
|
|
231
|
-
return columns;
|
|
232
|
-
}
|
|
233
|
-
var TranslationsEditForm = ({
|
|
234
|
-
translations,
|
|
235
|
-
references,
|
|
236
|
-
entityType,
|
|
237
|
-
availableLocales,
|
|
238
|
-
translatableFields
|
|
239
|
-
}) => {
|
|
240
|
-
const { t } = useTranslation();
|
|
241
|
-
const { handleSuccess, setCloseOnEscape } = useRouteModal();
|
|
242
|
-
const direction = useDocumentDirection();
|
|
243
|
-
const entities = useMemo(() => references, [references]);
|
|
244
|
-
const initialState = useRef(
|
|
245
|
-
initTranslationsFormState(
|
|
246
|
-
translations,
|
|
247
|
-
entities,
|
|
248
|
-
availableLocales,
|
|
249
|
-
translatableFields
|
|
250
|
-
)
|
|
251
|
-
);
|
|
252
|
-
const form = useForm({
|
|
253
|
-
resolver: zodResolver(TranslationsFormSchema),
|
|
254
|
-
defaultValues: initialState.current
|
|
255
|
-
});
|
|
256
|
-
const rows = useMemo(
|
|
257
|
-
() => buildTranslationRows(entities, availableLocales, translations),
|
|
258
|
-
[entities, availableLocales, translations]
|
|
259
|
-
);
|
|
260
|
-
const { mutateAsync, isPending } = useBatchTranslations(entityType);
|
|
261
|
-
const handleSubmit = form.handleSubmit(async (values) => {
|
|
262
|
-
const payload = transformToBatchPayload(
|
|
263
|
-
values,
|
|
264
|
-
initialState.current,
|
|
265
|
-
entityType
|
|
266
|
-
);
|
|
267
|
-
if (payload.create.length === 0 && payload.update.length === 0 && payload.delete.length === 0) {
|
|
268
|
-
toast.info(
|
|
269
|
-
t("translations.noChanges", { defaultValue: "No changes to save" })
|
|
270
|
-
);
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
await mutateAsync(payload, {
|
|
274
|
-
onSuccess: () => {
|
|
275
|
-
toast.success(
|
|
276
|
-
t("translations.edit.successToast", {
|
|
277
|
-
defaultValue: "Translations updated successfully"
|
|
278
|
-
})
|
|
279
|
-
);
|
|
280
|
-
handleSuccess();
|
|
281
|
-
},
|
|
282
|
-
onError: (error) => {
|
|
283
|
-
toast.error(error.message);
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
});
|
|
287
|
-
const columns = useTranslationsGridColumns({ translatableFields });
|
|
288
|
-
return /* @__PURE__ */ jsx(RouteFocusModal.Form, { form, children: /* @__PURE__ */ jsx(KeyboundForm, { onSubmit: handleSubmit, className: "flex h-full flex-col", children: /* @__PURE__ */ jsxs(
|
|
289
|
-
ProgressTabs,
|
|
290
|
-
{
|
|
291
|
-
dir: direction,
|
|
292
|
-
defaultValue: entityType,
|
|
293
|
-
className: "flex h-full flex-col overflow-hidden",
|
|
294
|
-
children: [
|
|
295
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Header, { children: /* @__PURE__ */ jsx("div", { className: "-my-2 w-full border-l", children: /* @__PURE__ */ jsx(ProgressTabs.List, { className: "justify-start-start flex w-full items-center", children: /* @__PURE__ */ jsx(ProgressTabs.Trigger, { value: entityType, children: REFERENCE_LABEL_MAP[entityType] }) }) }) }),
|
|
296
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Body, { className: "size-full overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
297
|
-
ProgressTabs.Content,
|
|
298
|
-
{
|
|
299
|
-
value: entityType,
|
|
300
|
-
className: "size-full overflow-y-auto",
|
|
301
|
-
children: /* @__PURE__ */ jsx(
|
|
302
|
-
DataGrid,
|
|
303
|
-
{
|
|
304
|
-
columns,
|
|
305
|
-
data: rows,
|
|
306
|
-
getSubRows: (row) => {
|
|
307
|
-
if (isEntityRow(row)) {
|
|
308
|
-
return row.subRows;
|
|
309
|
-
}
|
|
310
|
-
},
|
|
311
|
-
state: form,
|
|
312
|
-
onEditingChange: (editing) => setCloseOnEscape(!editing)
|
|
313
|
-
}
|
|
314
|
-
)
|
|
315
|
-
}
|
|
316
|
-
) }),
|
|
317
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
318
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: t("actions.cancel") }) }),
|
|
319
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: t("actions.save") })
|
|
320
|
-
] }) })
|
|
321
|
-
]
|
|
322
|
-
}
|
|
323
|
-
) }) });
|
|
324
|
-
};
|
|
325
|
-
|
|
326
|
-
// src/routes/translations/translations-edit/translations-edit.tsx
|
|
327
|
-
import { useEffect } from "react";
|
|
328
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
329
|
-
var TranslationsEdit = () => {
|
|
330
|
-
const isTranslationsEnabled = useFeatureFlag("translation");
|
|
331
|
-
const navigate = useNavigate();
|
|
332
|
-
const [searchParams] = useSearchParams();
|
|
333
|
-
const reference = searchParams.get("reference");
|
|
334
|
-
const referenceIdParam = searchParams.getAll("reference_id");
|
|
335
|
-
useEffect(() => {
|
|
336
|
-
if (!reference || !isTranslationsEnabled) {
|
|
337
|
-
navigate(-1);
|
|
338
|
-
return;
|
|
339
|
-
}
|
|
340
|
-
}, [reference, navigate, isTranslationsEnabled]);
|
|
341
|
-
const {
|
|
342
|
-
translations,
|
|
343
|
-
references,
|
|
344
|
-
translatableFields,
|
|
345
|
-
isPending,
|
|
346
|
-
isError,
|
|
347
|
-
error
|
|
348
|
-
} = useReferenceTranslations(reference, referenceIdParam, {
|
|
349
|
-
enabled: !!reference
|
|
350
|
-
});
|
|
351
|
-
const {
|
|
352
|
-
store,
|
|
353
|
-
isPending: isStorePending,
|
|
354
|
-
isError: isStoreError,
|
|
355
|
-
error: storeError
|
|
356
|
-
} = useStore();
|
|
357
|
-
const ready = !isPending && !!translations && !!translatableFields && !!references && !isStorePending && !!store;
|
|
358
|
-
if (isError || isStoreError) {
|
|
359
|
-
throw error || storeError;
|
|
360
|
-
}
|
|
361
|
-
return /* @__PURE__ */ jsx2(RouteFocusModal, { prev: referenceIdParam.length ? -1 : "..", children: ready && /* @__PURE__ */ jsx2(
|
|
362
|
-
TranslationsEditForm,
|
|
363
|
-
{
|
|
364
|
-
translations,
|
|
365
|
-
references,
|
|
366
|
-
entityType: reference,
|
|
367
|
-
availableLocales: store?.supported_locales ?? [],
|
|
368
|
-
translatableFields
|
|
369
|
-
}
|
|
370
|
-
) });
|
|
371
|
-
};
|
|
372
|
-
export {
|
|
373
|
-
TranslationsEdit as Component
|
|
374
|
-
};
|
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
import { FetchError } from "@medusajs/js-sdk"
|
|
2
|
-
import { HttpTypes } from "@medusajs/types"
|
|
3
|
-
import {
|
|
4
|
-
QueryKey,
|
|
5
|
-
useMutation,
|
|
6
|
-
UseMutationOptions,
|
|
7
|
-
useQuery,
|
|
8
|
-
UseQueryOptions,
|
|
9
|
-
UseQueryResult,
|
|
10
|
-
} from "@tanstack/react-query"
|
|
11
|
-
import { sdk } from "../../lib/client"
|
|
12
|
-
import { queryKeysFactory } from "../../lib/query-key-factory"
|
|
13
|
-
import { queryClient } from "../../lib/query-client"
|
|
14
|
-
import { productsQueryKeys, useProducts } from "./products"
|
|
15
|
-
import { productVariantQueryKeys, useVariants } from "./product-variants"
|
|
16
|
-
import { categoriesQueryKeys, useProductCategories } from "./categories"
|
|
17
|
-
import { collectionsQueryKeys, useCollections } from "./collections"
|
|
18
|
-
import { productTagsQueryKeys, useProductTags } from "./tags"
|
|
19
|
-
import { productTypesQueryKeys, useProductTypes } from "./product-types"
|
|
20
|
-
|
|
21
|
-
const TRANSLATIONS_QUERY_KEY = "translations" as const
|
|
22
|
-
export const translationsQueryKeys = queryKeysFactory(TRANSLATIONS_QUERY_KEY)
|
|
23
|
-
|
|
24
|
-
export const useReferenceTranslations = (
|
|
25
|
-
reference: string,
|
|
26
|
-
referenceId?: string | string[],
|
|
27
|
-
options?: Omit<
|
|
28
|
-
UseQueryOptions<any, FetchError, any, QueryKey>,
|
|
29
|
-
"queryFn" | "queryKey"
|
|
30
|
-
>
|
|
31
|
-
) => {
|
|
32
|
-
const referenceHookMap = new Map<
|
|
33
|
-
string,
|
|
34
|
-
() => UseQueryResult<{
|
|
35
|
-
translations: HttpTypes.AdminTranslation[]
|
|
36
|
-
references: { id: string; [key: string]: string }[]
|
|
37
|
-
translatableFields: string[]
|
|
38
|
-
}>
|
|
39
|
-
>([
|
|
40
|
-
[
|
|
41
|
-
"product",
|
|
42
|
-
() => {
|
|
43
|
-
const translatableFields = ["title", "description"]
|
|
44
|
-
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
45
|
-
|
|
46
|
-
const { products, ...rest } = useProducts(
|
|
47
|
-
{ id: referenceId ?? [], fields },
|
|
48
|
-
options
|
|
49
|
-
)
|
|
50
|
-
return {
|
|
51
|
-
...rest,
|
|
52
|
-
data: {
|
|
53
|
-
translations:
|
|
54
|
-
products?.flatMap((product) => product.translations ?? []) ?? [],
|
|
55
|
-
references: products ?? [],
|
|
56
|
-
translatableFields,
|
|
57
|
-
},
|
|
58
|
-
} as unknown as UseQueryResult<{
|
|
59
|
-
translations: HttpTypes.AdminTranslation[]
|
|
60
|
-
references: { id: string; [key: string]: string }[]
|
|
61
|
-
translatableFields: string[]
|
|
62
|
-
}>
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
[
|
|
66
|
-
"product_variant",
|
|
67
|
-
() => {
|
|
68
|
-
const translatableFields = ["title"]
|
|
69
|
-
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
70
|
-
|
|
71
|
-
const { variants, ...rest } = useVariants(
|
|
72
|
-
{ id: referenceId ?? [], fields },
|
|
73
|
-
options
|
|
74
|
-
)
|
|
75
|
-
return {
|
|
76
|
-
...rest,
|
|
77
|
-
data: {
|
|
78
|
-
translations:
|
|
79
|
-
variants?.flatMap((variant) => variant.translations ?? []) ?? [],
|
|
80
|
-
references: variants ?? [],
|
|
81
|
-
translatableFields,
|
|
82
|
-
},
|
|
83
|
-
} as unknown as UseQueryResult<{
|
|
84
|
-
translations: HttpTypes.AdminTranslation[]
|
|
85
|
-
references: { id: string; [key: string]: string }[]
|
|
86
|
-
translatableFields: string[]
|
|
87
|
-
}>
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
[
|
|
91
|
-
"product_category",
|
|
92
|
-
() => {
|
|
93
|
-
const translatableFields = ["name", "description"]
|
|
94
|
-
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
95
|
-
|
|
96
|
-
const { product_categories, ...rest } = useProductCategories(
|
|
97
|
-
{ id: referenceId ?? [], fields },
|
|
98
|
-
options
|
|
99
|
-
)
|
|
100
|
-
return {
|
|
101
|
-
...rest,
|
|
102
|
-
data: {
|
|
103
|
-
translations:
|
|
104
|
-
product_categories?.flatMap(
|
|
105
|
-
(category) => category.translations ?? []
|
|
106
|
-
) ?? [],
|
|
107
|
-
references: product_categories ?? [],
|
|
108
|
-
translatableFields,
|
|
109
|
-
},
|
|
110
|
-
} as unknown as UseQueryResult<{
|
|
111
|
-
translations: HttpTypes.AdminTranslation[]
|
|
112
|
-
references: { id: string; [key: string]: string }[]
|
|
113
|
-
translatableFields: string[]
|
|
114
|
-
}>
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
[
|
|
118
|
-
"product_collection",
|
|
119
|
-
() => {
|
|
120
|
-
const translatableFields = ["title"]
|
|
121
|
-
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
122
|
-
|
|
123
|
-
const { collections, ...rest } = useCollections(
|
|
124
|
-
{ id: referenceId ?? [], fields },
|
|
125
|
-
options
|
|
126
|
-
)
|
|
127
|
-
return {
|
|
128
|
-
...rest,
|
|
129
|
-
data: {
|
|
130
|
-
translations:
|
|
131
|
-
collections?.flatMap(
|
|
132
|
-
(collection) => collection.translations ?? []
|
|
133
|
-
) ?? [],
|
|
134
|
-
references: collections ?? [],
|
|
135
|
-
translatableFields,
|
|
136
|
-
},
|
|
137
|
-
} as unknown as UseQueryResult<{
|
|
138
|
-
translations: HttpTypes.AdminTranslation[]
|
|
139
|
-
references: { id: string; [key: string]: string }[]
|
|
140
|
-
translatableFields: string[]
|
|
141
|
-
}>
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
[
|
|
145
|
-
"product_type",
|
|
146
|
-
() => {
|
|
147
|
-
const translatableFields = ["value"]
|
|
148
|
-
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
149
|
-
|
|
150
|
-
const { product_types, ...rest } = useProductTypes(
|
|
151
|
-
{ id: referenceId ?? [], fields },
|
|
152
|
-
options
|
|
153
|
-
)
|
|
154
|
-
return {
|
|
155
|
-
...rest,
|
|
156
|
-
data: {
|
|
157
|
-
translations:
|
|
158
|
-
product_types?.flatMap((type) => type.translations ?? []) ?? [],
|
|
159
|
-
references: product_types ?? [],
|
|
160
|
-
translatableFields,
|
|
161
|
-
},
|
|
162
|
-
} as unknown as UseQueryResult<{
|
|
163
|
-
translations: HttpTypes.AdminTranslation[]
|
|
164
|
-
references: { id: string; [key: string]: string }[]
|
|
165
|
-
translatableFields: string[]
|
|
166
|
-
}>
|
|
167
|
-
},
|
|
168
|
-
],
|
|
169
|
-
[
|
|
170
|
-
"product_tag",
|
|
171
|
-
() => {
|
|
172
|
-
const translatableFields = ["value"]
|
|
173
|
-
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
174
|
-
|
|
175
|
-
const { product_tags, ...rest } = useProductTags(
|
|
176
|
-
{ id: referenceId ?? [], fields },
|
|
177
|
-
options
|
|
178
|
-
)
|
|
179
|
-
return {
|
|
180
|
-
...rest,
|
|
181
|
-
data: {
|
|
182
|
-
translations:
|
|
183
|
-
product_tags?.flatMap((tag) => tag.translations ?? []) ?? [],
|
|
184
|
-
references: product_tags ?? [],
|
|
185
|
-
translatableFields,
|
|
186
|
-
},
|
|
187
|
-
} as unknown as UseQueryResult<{
|
|
188
|
-
translations: HttpTypes.AdminTranslation[]
|
|
189
|
-
references: { id: string; [key: string]: string }[]
|
|
190
|
-
translatableFields: string[]
|
|
191
|
-
}>
|
|
192
|
-
},
|
|
193
|
-
],
|
|
194
|
-
// TODO: product option and option values
|
|
195
|
-
])
|
|
196
|
-
const referenceHook = referenceHookMap.get(reference)
|
|
197
|
-
if (!referenceHook) {
|
|
198
|
-
throw new Error(`No hook found for reference type: ${reference}`)
|
|
199
|
-
}
|
|
200
|
-
const { data, ...rest } = referenceHook()
|
|
201
|
-
return { ...data, ...rest }
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
export const useTranslations = (
|
|
205
|
-
query?: HttpTypes.AdminTranslationsListParams,
|
|
206
|
-
options?: Omit<
|
|
207
|
-
UseQueryOptions<
|
|
208
|
-
HttpTypes.AdminTranslationsListResponse,
|
|
209
|
-
FetchError,
|
|
210
|
-
HttpTypes.AdminTranslationsListResponse,
|
|
211
|
-
QueryKey
|
|
212
|
-
>,
|
|
213
|
-
"queryFn" | "queryKey"
|
|
214
|
-
>
|
|
215
|
-
) => {
|
|
216
|
-
const { data, ...rest } = useQuery({
|
|
217
|
-
queryKey: translationsQueryKeys.list(query),
|
|
218
|
-
queryFn: () => sdk.admin.translation.list(query),
|
|
219
|
-
...options,
|
|
220
|
-
})
|
|
221
|
-
|
|
222
|
-
return { ...data, ...rest }
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
export const useBatchTranslations = (
|
|
226
|
-
reference: string,
|
|
227
|
-
options?: UseMutationOptions<
|
|
228
|
-
HttpTypes.AdminTranslationsBatchResponse,
|
|
229
|
-
FetchError,
|
|
230
|
-
HttpTypes.AdminBatchTranslations
|
|
231
|
-
>
|
|
232
|
-
) => {
|
|
233
|
-
const referenceInvalidationKeysMap = new Map<string, QueryKey>([
|
|
234
|
-
["product", productsQueryKeys.lists()],
|
|
235
|
-
["product_variant", productVariantQueryKeys.lists()],
|
|
236
|
-
["product_category", categoriesQueryKeys.lists()],
|
|
237
|
-
["product_collection", collectionsQueryKeys.lists()],
|
|
238
|
-
["product_type", productTypesQueryKeys.lists()],
|
|
239
|
-
["product_tag", productTagsQueryKeys.lists()],
|
|
240
|
-
])
|
|
241
|
-
|
|
242
|
-
return useMutation({
|
|
243
|
-
mutationFn: (payload: HttpTypes.AdminBatchTranslations) =>
|
|
244
|
-
sdk.admin.translation.batch(payload),
|
|
245
|
-
onSuccess: (data, variables, context) => {
|
|
246
|
-
queryClient.invalidateQueries({
|
|
247
|
-
queryKey: referenceInvalidationKeysMap.get(reference),
|
|
248
|
-
})
|
|
249
|
-
|
|
250
|
-
options?.onSuccess?.(data, variables, context)
|
|
251
|
-
},
|
|
252
|
-
...options,
|
|
253
|
-
})
|
|
254
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TranslationList as Component } from "./translation-list"
|