@medusajs/dashboard 3.0.0-snapshot-20251214110905 → 3.0.0-snapshot-20251215162333
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/{adjust-inventory-I5VYMAI4.mjs → adjust-inventory-26YXAXQL.mjs} +2 -1
- package/dist/{api-key-management-create-CVRFY4PL.mjs → api-key-management-create-EMP32G2D.mjs} +4 -3
- package/dist/{api-key-management-detail-HRVP6HRC.mjs → api-key-management-detail-NRGL7HHX.mjs} +11 -10
- package/dist/{api-key-management-edit-JMU3WEPX.mjs → api-key-management-edit-IBM3ZXHK.mjs} +4 -3
- package/dist/{api-key-management-list-RGLZMUCB.mjs → api-key-management-list-LJSWRAGE.mjs} +4 -3
- package/dist/{api-key-management-sales-channels-4OU5VGIG.mjs → api-key-management-sales-channels-3GRNDBZ4.mjs} +4 -3
- package/dist/app.css +3 -0
- package/dist/app.js +1085 -835
- package/dist/app.mjs +12 -11
- package/dist/{campaign-detail-BDI3P2SF.mjs → campaign-detail-22Q6XWGL.mjs} +11 -10
- package/dist/{categories-metadata-BARTITD5.mjs → categories-metadata-J7M3XWI7.mjs} +11 -10
- package/dist/{category-create-L2KJCHPO.mjs → category-create-KHJZSC7G.mjs} +3 -2
- package/dist/{category-detail-CUMEBNXU.mjs → category-detail-RRKJPMEG.mjs} +13 -12
- package/dist/{category-edit-U6SLZSAX.mjs → category-edit-CTA2EPDG.mjs} +3 -2
- package/dist/{category-list-W7JW4PWA.mjs → category-list-4HZP4FRE.mjs} +4 -3
- package/dist/{category-organize-LLSVAO3U.mjs → category-organize-SXP33XET.mjs} +3 -2
- package/dist/{category-products-GYXTDDBQ.mjs → category-products-EFZRTCSF.mjs} +12 -11
- package/dist/{chunk-XIVBRONM.mjs → chunk-23GTCEOV.mjs} +1 -1
- package/dist/{chunk-N3FCYZV6.mjs → chunk-2XTBDCGE.mjs} +1 -1
- package/dist/{chunk-DS5IRNJY.mjs → chunk-32FPYJ3S.mjs} +1 -1
- package/dist/{chunk-FPBKWWSI.mjs → chunk-43X7ZR3P.mjs} +1 -1
- package/dist/{chunk-RU4ZS47V.mjs → chunk-4JQR6QNW.mjs} +2 -2
- package/dist/{chunk-Z6NHG5LQ.mjs → chunk-6P4Q4AAP.mjs} +3 -3
- package/dist/{chunk-F5NZDW7L.mjs → chunk-A2WBKOXJ.mjs} +2 -2
- package/dist/{chunk-F63F3FIT.mjs → chunk-A4XYK3MY.mjs} +2 -2
- package/dist/{chunk-NT6C7CHT.mjs → chunk-AWRCV3ME.mjs} +1 -1
- package/dist/{chunk-5X6SKB2P.mjs → chunk-BMS2QLJY.mjs} +1 -1
- package/dist/{chunk-67KHYLIQ.mjs → chunk-DK7IWUMK.mjs} +3 -3
- package/dist/{chunk-FEB3ZGTL.mjs → chunk-DNUVCBN7.mjs} +159 -5
- package/dist/{chunk-N4O5FAUC.mjs → chunk-FYWHE3W5.mjs} +1 -1
- package/dist/{chunk-HKKZJTRO.mjs → chunk-GRZSG4EP.mjs} +89 -34
- package/dist/chunk-HGRIOEAR.mjs +32 -0
- package/dist/{chunk-Y5UO73CH.mjs → chunk-HTCYX4VD.mjs} +1 -1
- package/dist/{chunk-34KFHPN6.mjs → chunk-IAV7IKJ6.mjs} +1 -1
- package/dist/{chunk-3BJLNORD.mjs → chunk-KQ4LC2YV.mjs} +1 -1
- package/dist/{chunk-GC3QXC6D.mjs → chunk-OHY2N2Q4.mjs} +4 -4
- package/dist/{chunk-7AX6R6G6.mjs → chunk-OSHH5GAS.mjs} +13 -1
- package/dist/{chunk-PXZEQZ6Q.mjs → chunk-PHLCT2HA.mjs} +1 -1
- package/dist/{chunk-35LSPN2U.mjs → chunk-QKALAT7P.mjs} +1 -1
- package/dist/{chunk-BBTE6VKD.mjs → chunk-RL5EYTP6.mjs} +1 -1
- package/dist/{chunk-B3AOQW2B.mjs → chunk-U6G4M5LP.mjs} +1 -1
- package/dist/{chunk-HKIF5HVL.mjs → chunk-UJ2TMPV4.mjs} +12 -0
- package/dist/{chunk-NHDFPGQ3.mjs → chunk-UWY5ZV66.mjs} +13 -1
- package/dist/{chunk-AH4DORIW.mjs → chunk-XY7A7GZJ.mjs} +1 -1
- package/dist/{chunk-FQDPOKEK.mjs → chunk-Y2YVTIJI.mjs} +1 -1
- package/dist/{chunk-Q4AXBDFH.mjs → chunk-YTYDWNYA.mjs} +155 -153
- package/dist/{chunk-2HDKZN4Q.mjs → chunk-YYOPBKME.mjs} +3 -3
- package/dist/{chunk-LEJUZW3P.mjs → chunk-Z6BFNHEO.mjs} +12 -0
- package/dist/{chunk-AIZ6W4QI.mjs → chunk-ZMG5B4FG.mjs} +1 -1
- package/dist/{collection-add-products-4WBPS6PY.mjs → collection-add-products-XUMV6XR7.mjs} +12 -11
- package/dist/{collection-create-4JX4YE47.mjs → collection-create-GWKWVT7B.mjs} +3 -2
- package/dist/{collection-detail-HT4SSV32.mjs → collection-detail-ONRBKJLN.mjs} +12 -11
- package/dist/{collection-edit-MXL35GQQ.mjs → collection-edit-EZIO2BR5.mjs} +3 -2
- package/dist/{collection-list-FYONEBDN.mjs → collection-list-XCC4SIPJ.mjs} +13 -12
- package/dist/{collection-metadata-YEZ2TBRX.mjs → collection-metadata-QK7MI3D2.mjs} +11 -10
- package/dist/{customer-detail-MB7CS7OG.mjs → customer-detail-FR6J37ZC.mjs} +12 -11
- package/dist/{customer-group-detail-U5UAP7QS.mjs → customer-group-detail-YSKSNETG.mjs} +11 -10
- package/dist/{customer-group-list-KAS6JSCQ.mjs → customer-group-list-XBCD4FZH.mjs} +11 -10
- package/dist/{customers-add-customer-group-UKLSPYEU.mjs → customers-add-customer-group-Q7FMR2Y5.mjs} +11 -10
- package/dist/{edit-inventory-item-RATTNP2Y.mjs → edit-inventory-item-H7DAZWIT.mjs} +2 -1
- package/dist/{edit-inventory-item-attributes-JHH5GSNL.mjs → edit-inventory-item-attributes-7HTXXPGZ.mjs} +2 -1
- package/dist/{edit-reservation-UZCSNLHY.mjs → edit-reservation-OVTRZHJR.mjs} +3 -2
- package/dist/{edit-rules-VMEHCXYQ.mjs → edit-rules-SMVRTCUP.mjs} +11 -10
- package/dist/en.json +1 -0
- package/dist/{inventory-create-KN72V2KK.mjs → inventory-create-3XONKYMZ.mjs} +12 -11
- package/dist/{inventory-detail-7OHCFAJO.mjs → inventory-detail-6A6GOLB6.mjs} +11 -10
- package/dist/{inventory-list-BQPHK3FV.mjs → inventory-list-2CJLAK3X.mjs} +2 -1
- package/dist/{inventory-metadata-I3IRRMLH.mjs → inventory-metadata-FNEJ3RAT.mjs} +11 -10
- package/dist/{inventory-stock-5IUICNEH.mjs → inventory-stock-S3ZYYCMZ.mjs} +13 -12
- package/dist/{location-detail-3MSUGB4W.mjs → location-detail-N3GUZSY7.mjs} +11 -10
- package/dist/{location-fulfillment-providers-ZVZMLCIC.mjs → location-fulfillment-providers-WM6DT252.mjs} +13 -12
- package/dist/{location-sales-channels-NKNM5TQK.mjs → location-sales-channels-WLVTMU4Z.mjs} +3 -2
- package/dist/{location-service-zone-shipping-option-create-CZWEHKVJ.mjs → location-service-zone-shipping-option-create-MJPH3WKX.mjs} +13 -12
- package/dist/{location-service-zone-shipping-option-pricing-Z5IFOLFJ.mjs → location-service-zone-shipping-option-pricing-6IRNPWJY.mjs} +2 -2
- package/dist/{login-OCYZM7SI.mjs → login-VNOLI5YG.mjs} +11 -10
- package/dist/{manage-locations-MLNMPQ5I.mjs → manage-locations-7HH6R4UP.mjs} +2 -1
- package/dist/{order-allocate-items-VRPPVPP3.mjs → order-allocate-items-HZGGYJ42.mjs} +4 -3
- package/dist/{order-create-claim-O3ZYTAIC.mjs → order-create-claim-GUYTLVPB.mjs} +13 -12
- package/dist/{order-create-edit-HUS7IRS3.mjs → order-create-edit-ODIN6GRW.mjs} +12 -11
- package/dist/{order-create-exchange-TUP4NHHX.mjs → order-create-exchange-ZT5RBRKL.mjs} +13 -12
- package/dist/{order-create-fulfillment-4BGDYHBB.mjs → order-create-fulfillment-OWUVTZXW.mjs} +11 -10
- package/dist/{order-create-refund-FA5ERI7M.mjs → order-create-refund-Q6HQY42R.mjs} +11 -10
- package/dist/{order-create-return-7GPHJ2WU.mjs → order-create-return-E2KILJX2.mjs} +5 -4
- package/dist/{order-create-shipment-27UBYPKT.mjs → order-create-shipment-WAGGEPRW.mjs} +11 -10
- package/dist/{order-detail-2J7KDTKG.mjs → order-detail-HFJONELJ.mjs} +15 -14
- package/dist/{order-edit-billing-address-E7CD5FBQ.mjs → order-edit-billing-address-UM76J4KX.mjs} +11 -10
- package/dist/{order-edit-email-ELRIQYVN.mjs → order-edit-email-CL3KNOCM.mjs} +11 -10
- package/dist/{order-edit-shipping-address-HVNAJUZI.mjs → order-edit-shipping-address-PIESTGVL.mjs} +11 -10
- package/dist/{order-export-TRMFVBFO.mjs → order-export-4MZUPMGD.mjs} +12 -11
- package/dist/{order-list-Y4FET3XV.mjs → order-list-ACSFGIPD.mjs} +6 -5
- package/dist/{order-metadata-THARHEJC.mjs → order-metadata-FHBB7MTG.mjs} +11 -10
- package/dist/{order-receive-return-X5ASB7DL.mjs → order-receive-return-PRVKP6J2.mjs} +12 -11
- package/dist/{order-request-transfer-PKF4ULJY.mjs → order-request-transfer-XSAGRUMT.mjs} +11 -10
- package/dist/{price-list-configuration-SZRY7CXO.mjs → price-list-configuration-IHPSUNZJ.mjs} +3 -2
- package/dist/{price-list-create-TYNSJDDM.mjs → price-list-create-YHXRQSC3.mjs} +14 -13
- package/dist/{price-list-detail-ORYFRNB6.mjs → price-list-detail-FR3FQR3H.mjs} +13 -12
- package/dist/{price-list-edit-I5QNCWJP.mjs → price-list-edit-53UW35L3.mjs} +3 -2
- package/dist/{price-list-list-AZOGEZAS.mjs → price-list-list-YSEM6IAI.mjs} +4 -3
- package/dist/{price-list-prices-add-MWAUNUBF.mjs → price-list-prices-add-GJVI47OY.mjs} +14 -13
- package/dist/{price-list-prices-edit-Z4YJ4YBY.mjs → price-list-prices-edit-E4Q5TQPM.mjs} +5 -4
- package/dist/{product-attributes-5QW6ZEYB.mjs → product-attributes-TKCE2M63.mjs} +12 -11
- package/dist/{product-create-YQ76CEF3.mjs → product-create-OLDZPMLW.mjs} +14 -13
- package/dist/{product-create-option-UMZKRNTC.mjs → product-create-option-7AOXAA4S.mjs} +2 -1
- package/dist/{product-create-variant-IASRY2JX.mjs → product-create-variant-KEBN5OR7.mjs} +12 -11
- package/dist/{product-detail-NVLJQGGK.mjs → product-detail-O6QWJIKR.mjs} +12 -11
- package/dist/{product-edit-DP42G3EU.mjs → product-edit-56XDGDUN.mjs} +12 -11
- package/dist/{product-edit-option-ZMTSLRG5.mjs → product-edit-option-LWJT3CYJ.mjs} +2 -1
- package/dist/{product-export-OK5FCD42.mjs → product-export-WUZYHPS5.mjs} +13 -12
- package/dist/{product-image-variants-edit-VEWNL52X.mjs → product-image-variants-edit-Y363J5NG.mjs} +11 -10
- package/dist/{product-import-LX625CIX.mjs → product-import-V3KQN4TV.mjs} +11 -10
- package/dist/{product-list-TXEPE6NL.mjs → product-list-DNTS7WUN.mjs} +12 -11
- package/dist/{product-media-ULNJ7JJY.mjs → product-media-3VJ7KENL.mjs} +2 -1
- package/dist/{product-metadata-ZKKBE6GG.mjs → product-metadata-GL2MVPDI.mjs} +11 -10
- package/dist/{product-organization-NMA2WJNT.mjs → product-organization-PNKWRNHC.mjs} +13 -12
- package/dist/{product-prices-5WCCQDS6.mjs → product-prices-JOG6IIQ7.mjs} +3 -2
- package/dist/{product-sales-channels-2PN4L7II.mjs → product-sales-channels-ANCFZZ5S.mjs} +3 -2
- package/dist/{product-shipping-profile-45XXB7FM.mjs → product-shipping-profile-ETQFZ7DC.mjs} +2 -1
- package/dist/{product-stock-KUHH6MFA.mjs → product-stock-NYUFMEVG.mjs} +13 -12
- package/dist/{product-tag-create-7EVRE5BL.mjs → product-tag-create-PQMDDKWH.mjs} +11 -10
- package/dist/{product-tag-detail-WULO55NT.mjs → product-tag-detail-EHBB3WUB.mjs} +14 -13
- package/dist/{product-tag-edit-J4ODRLXN.mjs → product-tag-edit-K3BBQLJR.mjs} +11 -10
- package/dist/{product-tag-list-V4CCQTL6.mjs → product-tag-list-LSW5FFVN.mjs} +14 -13
- package/dist/{product-tag-metadata-KHDYQMSG.mjs → product-tag-metadata-MJH5LH7E.mjs} +11 -10
- package/dist/{product-type-create-KHSNCQCV.mjs → product-type-create-DRFXTL5O.mjs} +2 -1
- package/dist/{product-type-detail-F35MUSLD.mjs → product-type-detail-3VB6AWUW.mjs} +13 -12
- package/dist/{product-type-edit-3LRBWZ3S.mjs → product-type-edit-SRHCZDK7.mjs} +2 -1
- package/dist/{product-type-list-K2GULUPF.mjs → product-type-list-FD3TGPNP.mjs} +3 -2
- package/dist/{product-type-metadata-CGXFFEJO.mjs → product-type-metadata-CDJDFFGQ.mjs} +11 -10
- package/dist/{product-variant-detail-NT2MB3Z4.mjs → product-variant-detail-43T33AQP.mjs} +11 -10
- package/dist/{product-variant-edit-KZ6D5CSA.mjs → product-variant-edit-DEZEY2H2.mjs} +11 -10
- package/dist/{product-variant-manage-inventory-items-OGM64KYP.mjs → product-variant-manage-inventory-items-Y2VEOHP7.mjs} +2 -1
- package/dist/{product-variant-media-C3KCFODU.mjs → product-variant-media-2WLVNGI4.mjs} +2 -1
- package/dist/{product-variant-metadata-I2PN64TH.mjs → product-variant-metadata-VTZDNWUT.mjs} +11 -10
- package/dist/{promotion-create-4KVSXYAI.mjs → promotion-create-HWFNUQXG.mjs} +11 -10
- package/dist/{promotion-detail-NGNVELME.mjs → promotion-detail-VJB55PJK.mjs} +11 -10
- package/dist/{refund-reason-create-CTAPBK3X.mjs → refund-reason-create-YHCDEHGQ.mjs} +11 -10
- package/dist/{refund-reason-edit-B6HRNXGE.mjs → refund-reason-edit-CZ5QZ2SZ.mjs} +11 -10
- package/dist/{refund-reason-list-7OUHUORB.mjs → refund-reason-list-URYYYEK6.mjs} +11 -10
- package/dist/{region-metadata-GRG3QSJY.mjs → region-metadata-H6XXUQ4S.mjs} +11 -10
- package/dist/{reservation-create-C6HTEF3R.mjs → reservation-create-ZCIYM6JI.mjs} +3 -2
- package/dist/{reservation-detail-KAI7N5UP.mjs → reservation-detail-LZAQL4XA.mjs} +11 -10
- package/dist/{reservation-list-SOJRN5RI.mjs → reservation-list-2DN3YHIJ.mjs} +3 -2
- package/dist/{reservation-metadata-TWV7KLOB.mjs → reservation-metadata-5HZSDDOK.mjs} +11 -10
- package/dist/{sales-channel-add-products-CBECZU46.mjs → sales-channel-add-products-VH5T3GDA.mjs} +12 -11
- package/dist/{sales-channel-create-4XLJDVJO.mjs → sales-channel-create-MI7HHZYE.mjs} +3 -2
- package/dist/{sales-channel-detail-NQSBPPIE.mjs → sales-channel-detail-I2ZHVXMG.mjs} +12 -11
- package/dist/{sales-channel-edit-UZGSXD5X.mjs → sales-channel-edit-VSHOIR37.mjs} +3 -2
- package/dist/{sales-channel-list-UYN2OCBR.mjs → sales-channel-list-3FV4S2NN.mjs} +11 -10
- package/dist/{sales-channel-metadata-4XWXYN2E.mjs → sales-channel-metadata-M364R4RJ.mjs} +11 -10
- package/dist/{shipping-option-type-create-U7PIKVMV.mjs → shipping-option-type-create-C5WUWON7.mjs} +11 -10
- package/dist/{shipping-option-type-detail-QNZLQGI6.mjs → shipping-option-type-detail-PENS2K73.mjs} +12 -11
- package/dist/{shipping-option-type-edit-BP6HLZ7B.mjs → shipping-option-type-edit-CIU5EHRP.mjs} +11 -10
- package/dist/{shipping-option-type-list-L274RM6A.mjs → shipping-option-type-list-ZMZMXFME.mjs} +12 -11
- package/dist/{shipping-profile-metadata-BZKPLXHO.mjs → shipping-profile-metadata-75G2NNMA.mjs} +11 -10
- package/dist/{store-add-locales-EXR3NLOM.mjs → store-add-locales-IZOZP5C6.mjs} +12 -18
- package/dist/{store-detail-T4YY5NHG.mjs → store-detail-4IBAEVSD.mjs} +16 -28
- package/dist/{store-edit-AB5CDUTK.mjs → store-edit-5ZS562ZO.mjs} +1 -42
- package/dist/{store-metadata-FN3WZLXA.mjs → store-metadata-CYXTVJUE.mjs} +11 -10
- package/dist/{tax-region-create-PWXTFE3Q.mjs → tax-region-create-DWGL4EUT.mjs} +11 -10
- package/dist/{tax-region-detail-GJW63AMV.mjs → tax-region-detail-O2T7BI3V.mjs} +16 -15
- package/dist/{tax-region-edit-WOUO7TPQ.mjs → tax-region-edit-EEVEEU2Q.mjs} +11 -10
- package/dist/{tax-region-province-detail-FCHPIRXW.mjs → tax-region-province-detail-2W7RXAM5.mjs} +16 -15
- package/dist/{tax-region-tax-override-create-ZLWXRNLN.mjs → tax-region-tax-override-create-7IM4ZVPH.mjs} +14 -13
- package/dist/{tax-region-tax-override-edit-ZM2JUFNJ.mjs → tax-region-tax-override-edit-3ZT5IZYR.mjs} +15 -14
- package/dist/{translation-list-Y2GWTRGW.mjs → translation-list-AFK5MGSH.mjs} +68 -79
- package/dist/{translations-edit-PM4PSMRF.mjs → translations-edit-EN47PWTO.mjs} +146 -81
- package/dist/{user-detail-KEDJ7N3Q.mjs → user-detail-BJUXLZZQ.mjs} +2 -1
- package/dist/{user-metadata-LNADHFTW.mjs → user-metadata-2WPJOEJA.mjs} +11 -10
- package/dist/{workflow-execution-detail-POTSURJX.mjs → workflow-execution-detail-H2AKEZJX.mjs} +11 -10
- package/package.json +9 -9
- package/src/components/data-grid/components/data-grid-root.tsx +184 -5
- package/src/components/data-grid/data-grid.tsx +12 -1
- package/src/components/data-grid/helpers/create-data-grid-column-helper.ts +18 -0
- package/src/components/data-grid/hooks/use-data-grid-cell.tsx +1 -1
- package/src/hooks/api/categories.tsx +32 -0
- package/src/hooks/api/collections.tsx +31 -0
- package/src/hooks/api/product-types.tsx +32 -0
- package/src/hooks/api/product-variants.tsx +40 -2
- package/src/hooks/api/products.tsx +29 -0
- package/src/hooks/api/tags.tsx +32 -0
- package/src/hooks/api/translations.tsx +114 -62
- package/src/hooks/use-infinite-list.tsx +92 -0
- package/src/i18n/translations/$schema.json +4 -0
- package/src/i18n/translations/en.json +1 -0
- package/src/i18n/translations/es.json +1 -0
- package/src/routes/store/store-add-locales/components/add-locales-form/add-locales-form.tsx +0 -9
- package/src/routes/store/store-detail/components/store-general-section/store-general-section.tsx +0 -24
- package/src/routes/store/store-detail/components/store-locale-section/store-locale-section.tsx +1 -9
- package/src/routes/store/store-edit/components/edit-store-form/edit-store-form.tsx +1 -45
- package/src/routes/translations/translation-list/components/active-locales-section/active-locales-section.tsx +2 -2
- package/src/routes/translations/translation-list/components/translation-list-section/translation-list-section.tsx +1 -8
- package/src/routes/translations/translation-list/components/translations-completion-section/translations-completion-section.tsx +10 -4
- package/src/routes/translations/translation-list/translation-list.tsx +66 -68
- package/src/routes/translations/translations-edit/components/translations-edit-form/translations-edit-form.tsx +131 -65
- package/src/routes/translations/translations-edit/translations-edit.tsx +36 -12
- package/src/routes/translations/translations-edit/utils/index.ts +0 -1
- package/src/routes/translations/translations-edit/utils/reference-label-map.ts +0 -10
|
@@ -2,76 +2,91 @@ import { FetchError } from "@medusajs/js-sdk"
|
|
|
2
2
|
import { HttpTypes } from "@medusajs/types"
|
|
3
3
|
import {
|
|
4
4
|
QueryKey,
|
|
5
|
+
UseInfiniteQueryOptions,
|
|
6
|
+
UseInfiniteQueryResult,
|
|
5
7
|
useMutation,
|
|
6
8
|
UseMutationOptions,
|
|
7
9
|
useQuery,
|
|
8
10
|
UseQueryOptions,
|
|
9
|
-
UseQueryResult,
|
|
10
11
|
} from "@tanstack/react-query"
|
|
11
12
|
import { sdk } from "../../lib/client"
|
|
12
13
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
|
13
14
|
import { queryClient } from "../../lib/query-client"
|
|
14
|
-
import { productsQueryKeys,
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
import {
|
|
15
|
+
import { productsQueryKeys, useInfiniteProducts } from "./products"
|
|
16
|
+
import {
|
|
17
|
+
productVariantQueryKeys,
|
|
18
|
+
useInfiniteVariants,
|
|
19
|
+
} from "./product-variants"
|
|
20
|
+
import { categoriesQueryKeys, useInfiniteCategories } from "./categories"
|
|
21
|
+
import { collectionsQueryKeys, useInfiniteCollections } from "./collections"
|
|
22
|
+
import { productTagsQueryKeys, useInfiniteProductTags } from "./tags"
|
|
23
|
+
import { productTypesQueryKeys, useInfiniteProductTypes } from "./product-types"
|
|
20
24
|
|
|
21
25
|
const TRANSLATIONS_QUERY_KEY = "translations" as const
|
|
22
26
|
export const translationsQueryKeys = queryKeysFactory(TRANSLATIONS_QUERY_KEY)
|
|
23
27
|
|
|
28
|
+
const TRANSLATION_SETTINGS_QUERY_KEY = "translation_settings" as const
|
|
29
|
+
export const translationSettingsQueryKeys = queryKeysFactory(
|
|
30
|
+
TRANSLATION_SETTINGS_QUERY_KEY
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
const TRANSLATION_STATISTICS_QUERY_KEY = "translation_statistics" as const
|
|
34
|
+
export const translationStatisticsQueryKeys = queryKeysFactory(
|
|
35
|
+
TRANSLATION_STATISTICS_QUERY_KEY
|
|
36
|
+
)
|
|
37
|
+
|
|
24
38
|
export const useReferenceTranslations = (
|
|
25
39
|
reference: string,
|
|
40
|
+
translatableFields: string[],
|
|
26
41
|
referenceId?: string | string[],
|
|
27
42
|
options?: Omit<
|
|
28
|
-
|
|
29
|
-
"queryFn" | "queryKey"
|
|
43
|
+
UseInfiniteQueryOptions<any, FetchError, any, any, QueryKey, number>,
|
|
44
|
+
"queryFn" | "queryKey" | "initialPageParam" | "getNextPageParam"
|
|
30
45
|
>
|
|
31
46
|
) => {
|
|
32
47
|
const referenceHookMap = new Map<
|
|
33
48
|
string,
|
|
34
|
-
() =>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
49
|
+
() => Omit<UseInfiniteQueryResult<any, FetchError>, "data"> & {
|
|
50
|
+
data: {
|
|
51
|
+
translations: HttpTypes.AdminTranslation[]
|
|
52
|
+
references: (Record<string, any> & { id: string })[]
|
|
53
|
+
count: number
|
|
54
|
+
}
|
|
55
|
+
}
|
|
39
56
|
>([
|
|
40
57
|
[
|
|
41
58
|
"product",
|
|
42
59
|
() => {
|
|
43
|
-
const translatableFields = ["title", "description"]
|
|
44
60
|
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
45
61
|
|
|
46
|
-
const {
|
|
47
|
-
{ id: referenceId ?? []
|
|
62
|
+
const { data, ...rest } = useInfiniteProducts(
|
|
63
|
+
{ fields, id: referenceId ?? [] },
|
|
48
64
|
options
|
|
49
65
|
)
|
|
66
|
+
const products = data?.pages.flatMap((page) => page.products) ?? []
|
|
67
|
+
|
|
50
68
|
return {
|
|
51
69
|
...rest,
|
|
52
70
|
data: {
|
|
53
71
|
translations:
|
|
54
72
|
products?.flatMap((product) => product.translations ?? []) ?? [],
|
|
55
73
|
references: products ?? [],
|
|
56
|
-
|
|
74
|
+
count: data?.pages[0]?.count ?? 0,
|
|
57
75
|
},
|
|
58
|
-
}
|
|
59
|
-
translations: HttpTypes.AdminTranslation[]
|
|
60
|
-
references: { id: string; [key: string]: string }[]
|
|
61
|
-
translatableFields: string[]
|
|
62
|
-
}>
|
|
76
|
+
}
|
|
63
77
|
},
|
|
64
78
|
],
|
|
65
79
|
[
|
|
66
80
|
"product_variant",
|
|
67
81
|
() => {
|
|
68
|
-
const translatableFields = ["title"]
|
|
69
82
|
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
70
83
|
|
|
71
|
-
const {
|
|
84
|
+
const { data, ...rest } = useInfiniteVariants(
|
|
72
85
|
{ id: referenceId ?? [], fields },
|
|
73
86
|
options
|
|
74
87
|
)
|
|
88
|
+
const variants = data?.pages.flatMap((page) => page.variants) ?? []
|
|
89
|
+
|
|
75
90
|
return {
|
|
76
91
|
...rest,
|
|
77
92
|
data: {
|
|
@@ -79,51 +94,48 @@ export const useReferenceTranslations = (
|
|
|
79
94
|
variants?.flatMap((variant) => variant.translations ?? []) ?? [],
|
|
80
95
|
references: variants ?? [],
|
|
81
96
|
translatableFields,
|
|
97
|
+
count: data?.pages[0]?.count ?? 0,
|
|
82
98
|
},
|
|
83
|
-
}
|
|
84
|
-
translations: HttpTypes.AdminTranslation[]
|
|
85
|
-
references: { id: string; [key: string]: string }[]
|
|
86
|
-
translatableFields: string[]
|
|
87
|
-
}>
|
|
99
|
+
}
|
|
88
100
|
},
|
|
89
101
|
],
|
|
90
102
|
[
|
|
91
103
|
"product_category",
|
|
92
104
|
() => {
|
|
93
|
-
const translatableFields = ["name", "description"]
|
|
94
105
|
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
95
106
|
|
|
96
|
-
const {
|
|
107
|
+
const { data, ...rest } = useInfiniteCategories(
|
|
97
108
|
{ id: referenceId ?? [], fields },
|
|
98
109
|
options
|
|
99
110
|
)
|
|
111
|
+
const categories =
|
|
112
|
+
data?.pages.flatMap((page) => page.product_categories) ?? []
|
|
113
|
+
|
|
100
114
|
return {
|
|
101
115
|
...rest,
|
|
102
116
|
data: {
|
|
103
117
|
translations:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
references: product_categories ?? [],
|
|
118
|
+
categories?.flatMap((category) => category.translations ?? []) ??
|
|
119
|
+
[],
|
|
120
|
+
references: categories ?? [],
|
|
108
121
|
translatableFields,
|
|
122
|
+
count: data?.pages[0]?.count ?? 0,
|
|
109
123
|
},
|
|
110
|
-
}
|
|
111
|
-
translations: HttpTypes.AdminTranslation[]
|
|
112
|
-
references: { id: string; [key: string]: string }[]
|
|
113
|
-
translatableFields: string[]
|
|
114
|
-
}>
|
|
124
|
+
}
|
|
115
125
|
},
|
|
116
126
|
],
|
|
117
127
|
[
|
|
118
128
|
"product_collection",
|
|
119
129
|
() => {
|
|
120
|
-
const translatableFields = ["title"]
|
|
121
130
|
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
122
131
|
|
|
123
|
-
const {
|
|
132
|
+
const { data, ...rest } = useInfiniteCollections(
|
|
124
133
|
{ id: referenceId ?? [], fields },
|
|
125
134
|
options
|
|
126
135
|
)
|
|
136
|
+
const collections =
|
|
137
|
+
data?.pages.flatMap((page) => page.collections) ?? []
|
|
138
|
+
|
|
127
139
|
return {
|
|
128
140
|
...rest,
|
|
129
141
|
data: {
|
|
@@ -133,49 +145,47 @@ export const useReferenceTranslations = (
|
|
|
133
145
|
) ?? [],
|
|
134
146
|
references: collections ?? [],
|
|
135
147
|
translatableFields,
|
|
148
|
+
count: data?.pages[0]?.count ?? 0,
|
|
136
149
|
},
|
|
137
|
-
}
|
|
138
|
-
translations: HttpTypes.AdminTranslation[]
|
|
139
|
-
references: { id: string; [key: string]: string }[]
|
|
140
|
-
translatableFields: string[]
|
|
141
|
-
}>
|
|
150
|
+
}
|
|
142
151
|
},
|
|
143
152
|
],
|
|
144
153
|
[
|
|
145
154
|
"product_type",
|
|
146
155
|
() => {
|
|
147
|
-
const translatableFields = ["value"]
|
|
148
156
|
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
149
157
|
|
|
150
|
-
const {
|
|
158
|
+
const { data, ...rest } = useInfiniteProductTypes(
|
|
151
159
|
{ id: referenceId ?? [], fields },
|
|
152
160
|
options
|
|
153
161
|
)
|
|
162
|
+
const product_types =
|
|
163
|
+
data?.pages.flatMap((page) => page.product_types) ?? []
|
|
164
|
+
|
|
154
165
|
return {
|
|
155
166
|
...rest,
|
|
156
167
|
data: {
|
|
157
168
|
translations:
|
|
158
169
|
product_types?.flatMap((type) => type.translations ?? []) ?? [],
|
|
159
170
|
references: product_types ?? [],
|
|
171
|
+
count: data?.pages[0]?.count ?? 0,
|
|
160
172
|
translatableFields,
|
|
161
173
|
},
|
|
162
|
-
}
|
|
163
|
-
translations: HttpTypes.AdminTranslation[]
|
|
164
|
-
references: { id: string; [key: string]: string }[]
|
|
165
|
-
translatableFields: string[]
|
|
166
|
-
}>
|
|
174
|
+
}
|
|
167
175
|
},
|
|
168
176
|
],
|
|
169
177
|
[
|
|
170
178
|
"product_tag",
|
|
171
179
|
() => {
|
|
172
|
-
const translatableFields = ["value"]
|
|
173
180
|
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
174
181
|
|
|
175
|
-
const {
|
|
182
|
+
const { data, ...rest } = useInfiniteProductTags(
|
|
176
183
|
{ id: referenceId ?? [], fields },
|
|
177
184
|
options
|
|
178
185
|
)
|
|
186
|
+
const product_tags =
|
|
187
|
+
data?.pages.flatMap((page) => page.product_tags) ?? []
|
|
188
|
+
|
|
179
189
|
return {
|
|
180
190
|
...rest,
|
|
181
191
|
data: {
|
|
@@ -183,12 +193,9 @@ export const useReferenceTranslations = (
|
|
|
183
193
|
product_tags?.flatMap((tag) => tag.translations ?? []) ?? [],
|
|
184
194
|
references: product_tags ?? [],
|
|
185
195
|
translatableFields,
|
|
196
|
+
count: data?.pages[0]?.count ?? 0,
|
|
186
197
|
},
|
|
187
|
-
}
|
|
188
|
-
translations: HttpTypes.AdminTranslation[]
|
|
189
|
-
references: { id: string; [key: string]: string }[]
|
|
190
|
-
translatableFields: string[]
|
|
191
|
-
}>
|
|
198
|
+
}
|
|
192
199
|
},
|
|
193
200
|
],
|
|
194
201
|
// TODO: product option and option values
|
|
@@ -246,9 +253,54 @@ export const useBatchTranslations = (
|
|
|
246
253
|
queryClient.invalidateQueries({
|
|
247
254
|
queryKey: referenceInvalidationKeysMap.get(reference),
|
|
248
255
|
})
|
|
256
|
+
queryClient.invalidateQueries({
|
|
257
|
+
queryKey: translationStatisticsQueryKeys.lists(),
|
|
258
|
+
})
|
|
249
259
|
|
|
250
260
|
options?.onSuccess?.(data, variables, context)
|
|
251
261
|
},
|
|
252
262
|
...options,
|
|
253
263
|
})
|
|
254
264
|
}
|
|
265
|
+
|
|
266
|
+
export const useTranslationSettings = (
|
|
267
|
+
query?: HttpTypes.AdminTranslationSettingsParams,
|
|
268
|
+
options?: Omit<
|
|
269
|
+
UseQueryOptions<
|
|
270
|
+
HttpTypes.AdminTranslationSettingsResponse,
|
|
271
|
+
FetchError,
|
|
272
|
+
HttpTypes.AdminTranslationSettingsResponse,
|
|
273
|
+
QueryKey
|
|
274
|
+
>,
|
|
275
|
+
"queryFn" | "queryKey"
|
|
276
|
+
>
|
|
277
|
+
) => {
|
|
278
|
+
const { data, ...rest } = useQuery({
|
|
279
|
+
queryKey: translationSettingsQueryKeys.list(query),
|
|
280
|
+
queryFn: () => sdk.admin.translation.settings(query),
|
|
281
|
+
...options,
|
|
282
|
+
})
|
|
283
|
+
|
|
284
|
+
return { ...data, ...rest }
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export const useTranslationStatistics = (
|
|
288
|
+
query?: HttpTypes.AdminTranslationStatisticsParams,
|
|
289
|
+
options?: Omit<
|
|
290
|
+
UseQueryOptions<
|
|
291
|
+
HttpTypes.AdminTranslationStatisticsResponse,
|
|
292
|
+
FetchError,
|
|
293
|
+
HttpTypes.AdminTranslationStatisticsResponse,
|
|
294
|
+
QueryKey
|
|
295
|
+
>,
|
|
296
|
+
"queryFn" | "queryKey"
|
|
297
|
+
>
|
|
298
|
+
) => {
|
|
299
|
+
const { data, ...rest } = useQuery({
|
|
300
|
+
queryKey: translationStatisticsQueryKeys.list(query),
|
|
301
|
+
queryFn: () => sdk.admin.translation.statistics(query),
|
|
302
|
+
...options,
|
|
303
|
+
})
|
|
304
|
+
|
|
305
|
+
return { ...data, ...rest }
|
|
306
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { FetchError } from "@medusajs/js-sdk"
|
|
2
|
+
import { PaginatedResponse } from "@medusajs/types"
|
|
3
|
+
import {
|
|
4
|
+
QueryKey,
|
|
5
|
+
UseInfiniteQueryOptions,
|
|
6
|
+
InfiniteData,
|
|
7
|
+
useInfiniteQuery,
|
|
8
|
+
} from "@tanstack/react-query"
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Generic hook for infinite queries with pagination support.
|
|
12
|
+
*
|
|
13
|
+
* @template TResponse - The response type that must include count, offset, and limit
|
|
14
|
+
* @template TParams - The query parameters type (offset and limit will be handled internally)
|
|
15
|
+
* @template TError - The error type (defaults to FetchError)
|
|
16
|
+
* @template TQueryKey - The query key type (defaults to QueryKey)
|
|
17
|
+
*
|
|
18
|
+
* @param config - Configuration object
|
|
19
|
+
* @param config.queryKey - Function or array that generates the query key
|
|
20
|
+
* @param config.queryFn - Function that fetches data with offset and limit
|
|
21
|
+
* @param config.query - Query parameters (offset is ignored, limit is optional)
|
|
22
|
+
* @param config.options - Additional options for useInfiniteQuery
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const { data, fetchNextPage, hasNextPage } = useInfiniteList({
|
|
27
|
+
* queryKey: (params) => productVariantQueryKeys.list(params),
|
|
28
|
+
* queryFn: async (params) => sdk.admin.productVariant.list(params),
|
|
29
|
+
* query: { status: "published" },
|
|
30
|
+
* })
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export const useInfiniteList = <
|
|
34
|
+
TResponse extends PaginatedResponse<unknown>,
|
|
35
|
+
TParams extends { offset?: number; limit?: number } = {
|
|
36
|
+
offset?: number
|
|
37
|
+
limit?: number
|
|
38
|
+
},
|
|
39
|
+
TError = FetchError,
|
|
40
|
+
TQueryKey extends QueryKey = QueryKey
|
|
41
|
+
>({
|
|
42
|
+
queryKey,
|
|
43
|
+
queryFn,
|
|
44
|
+
query,
|
|
45
|
+
options,
|
|
46
|
+
}: {
|
|
47
|
+
queryKey: ((params: Omit<TParams, "limit">) => TQueryKey) | TQueryKey
|
|
48
|
+
queryFn: (params: TParams) => Promise<TResponse>
|
|
49
|
+
query?: TParams
|
|
50
|
+
options?: Omit<
|
|
51
|
+
UseInfiniteQueryOptions<
|
|
52
|
+
TResponse,
|
|
53
|
+
TError,
|
|
54
|
+
InfiniteData<TResponse, number>,
|
|
55
|
+
TResponse,
|
|
56
|
+
TQueryKey,
|
|
57
|
+
number
|
|
58
|
+
>,
|
|
59
|
+
"queryKey" | "queryFn" | "initialPageParam" | "getNextPageParam"
|
|
60
|
+
>
|
|
61
|
+
}) => {
|
|
62
|
+
const { limit = 50, offset: _, ..._query } = query ?? {}
|
|
63
|
+
const resolvedQueryKey =
|
|
64
|
+
typeof queryKey === "function"
|
|
65
|
+
? queryKey(_query as Omit<TParams, "limit">)
|
|
66
|
+
: queryKey
|
|
67
|
+
const infiniteQueryKey =
|
|
68
|
+
resolvedQueryKey[resolvedQueryKey.length - 1] === "__infinite"
|
|
69
|
+
? resolvedQueryKey
|
|
70
|
+
: ([...resolvedQueryKey, "__infinite"] as unknown as TQueryKey)
|
|
71
|
+
|
|
72
|
+
return useInfiniteQuery<
|
|
73
|
+
TResponse,
|
|
74
|
+
TError,
|
|
75
|
+
InfiniteData<TResponse, number>,
|
|
76
|
+
TQueryKey,
|
|
77
|
+
number
|
|
78
|
+
>({
|
|
79
|
+
// Infinite queries must not share the exact same queryKey as non-infinite queries,
|
|
80
|
+
// since the cached data shape differs (InfiniteData<T> vs T).
|
|
81
|
+
queryKey: infiniteQueryKey,
|
|
82
|
+
queryFn: ({ pageParam = 0 }) => {
|
|
83
|
+
return queryFn({ ..._query, limit, offset: pageParam } as TParams)
|
|
84
|
+
},
|
|
85
|
+
initialPageParam: 0,
|
|
86
|
+
getNextPageParam: (lastPage) => {
|
|
87
|
+
const moreItemsExist = lastPage.count > lastPage.offset + lastPage.limit
|
|
88
|
+
return moreItemsExist ? lastPage.offset + lastPage.limit : undefined
|
|
89
|
+
},
|
|
90
|
+
...options,
|
|
91
|
+
})
|
|
92
|
+
}
|
|
@@ -38,6 +38,9 @@
|
|
|
38
38
|
"search": {
|
|
39
39
|
"type": "string"
|
|
40
40
|
},
|
|
41
|
+
"original": {
|
|
42
|
+
"type": "string"
|
|
43
|
+
},
|
|
41
44
|
"of": {
|
|
42
45
|
"type": "string"
|
|
43
46
|
},
|
|
@@ -194,6 +197,7 @@
|
|
|
194
197
|
"apply",
|
|
195
198
|
"range",
|
|
196
199
|
"search",
|
|
200
|
+
"original",
|
|
197
201
|
"of",
|
|
198
202
|
"results",
|
|
199
203
|
"pages",
|
|
@@ -100,19 +100,10 @@ export const AddLocalesForm = ({ store }: AddLocalesFormProps) => {
|
|
|
100
100
|
new Set([...data.locales, ...preSelectedRows])
|
|
101
101
|
) as string[]
|
|
102
102
|
|
|
103
|
-
let defaultLocale = store.supported_locales?.find(
|
|
104
|
-
(l) => l.is_default
|
|
105
|
-
)?.locale_code
|
|
106
|
-
|
|
107
|
-
if (!locales.includes(defaultLocale ?? "")) {
|
|
108
|
-
defaultLocale = locales?.[0]
|
|
109
|
-
}
|
|
110
|
-
|
|
111
103
|
await mutateAsync(
|
|
112
104
|
{
|
|
113
105
|
supported_locales: locales.map((l) => ({
|
|
114
106
|
locale_code: l,
|
|
115
|
-
is_default: l === defaultLocale,
|
|
116
107
|
})),
|
|
117
108
|
},
|
|
118
109
|
{
|
package/src/routes/store/store-detail/components/store-general-section/store-general-section.tsx
CHANGED
|
@@ -7,7 +7,6 @@ import { Link } from "react-router-dom"
|
|
|
7
7
|
import { ActionMenu } from "../../../../../components/common/action-menu"
|
|
8
8
|
import { useSalesChannel, useStockLocation } from "../../../../../hooks/api"
|
|
9
9
|
import { useRegion } from "../../../../../hooks/api/regions"
|
|
10
|
-
import { useFeatureFlag } from "../../../../../providers/feature-flag-provider"
|
|
11
10
|
|
|
12
11
|
type StoreGeneralSectionProps = {
|
|
13
12
|
store: AdminStore
|
|
@@ -15,14 +14,12 @@ type StoreGeneralSectionProps = {
|
|
|
15
14
|
|
|
16
15
|
export const StoreGeneralSection = ({ store }: StoreGeneralSectionProps) => {
|
|
17
16
|
const { t } = useTranslation()
|
|
18
|
-
const isTranslationsEnabled = useFeatureFlag("translation")
|
|
19
17
|
|
|
20
18
|
const { region } = useRegion(store.default_region_id!, undefined, {
|
|
21
19
|
enabled: !!store.default_region_id,
|
|
22
20
|
})
|
|
23
21
|
|
|
24
22
|
const defaultCurrency = store.supported_currencies?.find((c) => c.is_default)
|
|
25
|
-
const defaultLocale = store.supported_locales?.find((l) => l.is_default)
|
|
26
23
|
|
|
27
24
|
const { sales_channel } = useSalesChannel(store.default_sales_channel_id!, {
|
|
28
25
|
enabled: !!store.default_sales_channel_id,
|
|
@@ -88,27 +85,6 @@ export const StoreGeneralSection = ({ store }: StoreGeneralSectionProps) => {
|
|
|
88
85
|
</Text>
|
|
89
86
|
)}
|
|
90
87
|
</div>
|
|
91
|
-
{isTranslationsEnabled && (
|
|
92
|
-
<div className="text-ui-fg-subtle grid grid-cols-2 px-6 py-4">
|
|
93
|
-
<Text size="small" leading="compact" weight="plus">
|
|
94
|
-
{t("store.defaultLocale")}
|
|
95
|
-
</Text>
|
|
96
|
-
{defaultLocale ? (
|
|
97
|
-
<div className="flex items-center gap-x-2">
|
|
98
|
-
<Badge size="2xsmall">
|
|
99
|
-
{defaultLocale.locale_code?.toUpperCase()}
|
|
100
|
-
</Badge>
|
|
101
|
-
<Text size="small" leading="compact">
|
|
102
|
-
{defaultLocale.locale?.name}
|
|
103
|
-
</Text>
|
|
104
|
-
</div>
|
|
105
|
-
) : (
|
|
106
|
-
<Text size="small" leading="compact">
|
|
107
|
-
-
|
|
108
|
-
</Text>
|
|
109
|
-
)}
|
|
110
|
-
</div>
|
|
111
|
-
)}
|
|
112
88
|
<div className="text-ui-fg-subtle grid grid-cols-2 px-6 py-4">
|
|
113
89
|
<Text size="small" leading="compact" weight="plus">
|
|
114
90
|
{t("store.defaultRegion")}
|
package/src/routes/store/store-detail/components/store-locale-section/store-locale-section.tsx
CHANGED
|
@@ -60,8 +60,6 @@ export const StoreLocaleSection = ({ store }: StoreLocaleSectionProps) => {
|
|
|
60
60
|
meta: {
|
|
61
61
|
storeId: store.id,
|
|
62
62
|
supportedLocales: store.supported_locales,
|
|
63
|
-
defaultLocaleCode: store.supported_locales?.find((l) => l.is_default)
|
|
64
|
-
?.locale_code,
|
|
65
63
|
},
|
|
66
64
|
})
|
|
67
65
|
|
|
@@ -165,12 +163,10 @@ const LocaleActions = ({
|
|
|
165
163
|
storeId,
|
|
166
164
|
locale,
|
|
167
165
|
supportedLocales,
|
|
168
|
-
defaultLocaleCode,
|
|
169
166
|
}: {
|
|
170
167
|
storeId: string
|
|
171
168
|
locale: HttpTypes.AdminLocale
|
|
172
169
|
supportedLocales: HttpTypes.AdminStoreLocale[]
|
|
173
|
-
defaultLocaleCode: string
|
|
174
170
|
}) => {
|
|
175
171
|
const { mutateAsync } = useUpdateStore(storeId)
|
|
176
172
|
const { t } = useTranslation()
|
|
@@ -218,7 +214,6 @@ const LocaleActions = ({
|
|
|
218
214
|
icon: <Trash />,
|
|
219
215
|
label: t("actions.remove"),
|
|
220
216
|
onClick: handleRemove,
|
|
221
|
-
disabled: locale.code === defaultLocaleCode,
|
|
222
217
|
},
|
|
223
218
|
],
|
|
224
219
|
},
|
|
@@ -267,9 +262,7 @@ const useColumns = () => {
|
|
|
267
262
|
columnHelper.display({
|
|
268
263
|
id: "actions",
|
|
269
264
|
cell: ({ row, table }) => {
|
|
270
|
-
const { supportedLocales, storeId
|
|
271
|
-
.meta as {
|
|
272
|
-
defaultLocaleCode: string
|
|
265
|
+
const { supportedLocales, storeId } = table.options.meta as {
|
|
273
266
|
supportedLocales: HttpTypes.AdminStoreLocale[]
|
|
274
267
|
storeId: string
|
|
275
268
|
}
|
|
@@ -279,7 +272,6 @@ const useColumns = () => {
|
|
|
279
272
|
storeId={storeId}
|
|
280
273
|
locale={row.original}
|
|
281
274
|
supportedLocales={supportedLocales}
|
|
282
|
-
defaultLocaleCode={defaultLocaleCode}
|
|
283
275
|
/>
|
|
284
276
|
)
|
|
285
277
|
},
|
|
@@ -13,7 +13,6 @@ import { useUpdateStore } from "../../../../../hooks/api/store"
|
|
|
13
13
|
import { useComboboxData } from "../../../../../hooks/use-combobox-data"
|
|
14
14
|
import { sdk } from "../../../../../lib/client"
|
|
15
15
|
import { useDocumentDirection } from "../../../../../hooks/use-document-direction"
|
|
16
|
-
import { useFeatureFlag } from "../../../../../providers/feature-flag-provider"
|
|
17
16
|
|
|
18
17
|
type EditStoreFormProps = {
|
|
19
18
|
store: HttpTypes.AdminStore
|
|
@@ -22,7 +21,6 @@ type EditStoreFormProps = {
|
|
|
22
21
|
const EditStoreSchema = z.object({
|
|
23
22
|
name: z.string().min(1),
|
|
24
23
|
default_currency_code: z.string().optional(),
|
|
25
|
-
default_locale_code: z.string().optional(),
|
|
26
24
|
default_region_id: z.string().optional(),
|
|
27
25
|
default_sales_channel_id: z.string().optional(),
|
|
28
26
|
default_location_id: z.string().optional(),
|
|
@@ -30,16 +28,12 @@ const EditStoreSchema = z.object({
|
|
|
30
28
|
|
|
31
29
|
export const EditStoreForm = ({ store }: EditStoreFormProps) => {
|
|
32
30
|
const { t } = useTranslation()
|
|
33
|
-
const isTranslationsEnabled = useFeatureFlag("translation")
|
|
34
31
|
const { handleSuccess } = useRouteModal()
|
|
35
32
|
const direction = useDocumentDirection()
|
|
36
33
|
const form = useForm<z.infer<typeof EditStoreSchema>>({
|
|
37
34
|
defaultValues: {
|
|
38
35
|
name: store.name,
|
|
39
36
|
default_region_id: store.default_region_id || undefined,
|
|
40
|
-
default_locale_code:
|
|
41
|
-
store.supported_locales?.find((l) => l.is_default)?.locale_code ||
|
|
42
|
-
undefined,
|
|
43
37
|
default_currency_code:
|
|
44
38
|
store.supported_currencies?.find((c) => c.is_default)?.currency_code ||
|
|
45
39
|
undefined,
|
|
@@ -79,14 +73,10 @@ export const EditStoreForm = ({ store }: EditStoreFormProps) => {
|
|
|
79
73
|
})
|
|
80
74
|
|
|
81
75
|
const handleSubmit = form.handleSubmit(async (values) => {
|
|
82
|
-
const { default_currency_code,
|
|
76
|
+
const { default_currency_code, ...rest } = values
|
|
83
77
|
|
|
84
78
|
const normalizedMutation: HttpTypes.AdminUpdateStore = {
|
|
85
79
|
...rest,
|
|
86
|
-
supported_locales: store.supported_locales?.map((l) => ({
|
|
87
|
-
...l,
|
|
88
|
-
is_default: l.locale_code === default_locale_code,
|
|
89
|
-
})),
|
|
90
80
|
supported_currencies: store.supported_currencies?.map((c) => ({
|
|
91
81
|
...c,
|
|
92
82
|
is_default: c.currency_code === default_currency_code,
|
|
@@ -156,40 +146,6 @@ export const EditStoreForm = ({ store }: EditStoreFormProps) => {
|
|
|
156
146
|
)
|
|
157
147
|
}}
|
|
158
148
|
/>
|
|
159
|
-
{isTranslationsEnabled && (
|
|
160
|
-
<Form.Field
|
|
161
|
-
control={form.control}
|
|
162
|
-
name="default_locale_code"
|
|
163
|
-
render={({ field: { onChange, ...field } }) => {
|
|
164
|
-
return (
|
|
165
|
-
<Form.Item>
|
|
166
|
-
<Form.Label>{t("store.defaultLocale")}</Form.Label>
|
|
167
|
-
<Form.Control>
|
|
168
|
-
<Select
|
|
169
|
-
dir={direction}
|
|
170
|
-
{...field}
|
|
171
|
-
onValueChange={onChange}
|
|
172
|
-
>
|
|
173
|
-
<Select.Trigger ref={field.ref}>
|
|
174
|
-
<Select.Value />
|
|
175
|
-
</Select.Trigger>
|
|
176
|
-
<Select.Content>
|
|
177
|
-
{store.supported_locales?.map((locale) => (
|
|
178
|
-
<Select.Item
|
|
179
|
-
key={locale.locale_code}
|
|
180
|
-
value={locale.locale_code}
|
|
181
|
-
>
|
|
182
|
-
{locale.locale_code}
|
|
183
|
-
</Select.Item>
|
|
184
|
-
))}
|
|
185
|
-
</Select.Content>
|
|
186
|
-
</Select>
|
|
187
|
-
</Form.Control>
|
|
188
|
-
</Form.Item>
|
|
189
|
-
)
|
|
190
|
-
}}
|
|
191
|
-
/>
|
|
192
|
-
)}
|
|
193
149
|
<Form.Field
|
|
194
150
|
control={form.control}
|
|
195
151
|
name="default_region_id"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PencilSquare,
|
|
1
|
+
import { PencilSquare, Language } from "@medusajs/icons"
|
|
2
2
|
import { Container, Heading, IconButton, InlineTip, Text } from "@medusajs/ui"
|
|
3
3
|
import { useTranslation } from "react-i18next"
|
|
4
4
|
import { IconAvatar } from "../../../../../components/common/icon-avatar"
|
|
@@ -46,7 +46,7 @@ export const ActiveLocalesSection = ({
|
|
|
46
46
|
{hasLocales ? (
|
|
47
47
|
<Container className="bg-ui-bg-component flex items-center gap-x-4 px-6 py-2">
|
|
48
48
|
<IconAvatar>
|
|
49
|
-
<
|
|
49
|
+
<Language />
|
|
50
50
|
</IconAvatar>
|
|
51
51
|
<div className="flex flex-col">
|
|
52
52
|
<Text size="small" weight="plus">
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { Button, Container, Text } from "@medusajs/ui"
|
|
2
2
|
import { Link } from "react-router-dom"
|
|
3
|
-
|
|
4
|
-
type TranslatableEntity = {
|
|
5
|
-
icon: React.ReactNode
|
|
6
|
-
label: string
|
|
7
|
-
reference: string
|
|
8
|
-
translatedCount?: number
|
|
9
|
-
totalCount?: number
|
|
10
|
-
}
|
|
3
|
+
import { TranslatableEntity } from "../../translation-list"
|
|
11
4
|
|
|
12
5
|
type TranslationListSectionProps = {
|
|
13
6
|
entities: TranslatableEntity[]
|