@medusajs/dashboard 2.12.4-preview-20251219120148 → 2.12.4-preview-20251219180140
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-locales-GGNZCABB.mjs → add-locales-QBVJ5Q2A.mjs} +12 -12
- package/dist/{adjust-inventory-26YXAXQL.mjs → adjust-inventory-O6XSKODS.mjs} +2 -2
- package/dist/{api-key-management-create-EMP32G2D.mjs → api-key-management-create-PHBRTKUI.mjs} +4 -4
- package/dist/{api-key-management-detail-FRUN2KFK.mjs → api-key-management-detail-USGXO5H2.mjs} +11 -11
- package/dist/{api-key-management-edit-IBM3ZXHK.mjs → api-key-management-edit-KYBWESGG.mjs} +4 -4
- package/dist/{api-key-management-list-KC5GOWAU.mjs → api-key-management-list-2T35G3KT.mjs} +4 -4
- package/dist/{api-key-management-sales-channels-LUB5G6RC.mjs → api-key-management-sales-channels-WZAGFYC5.mjs} +4 -4
- package/dist/app.js +59 -243
- package/dist/app.mjs +12 -12
- package/dist/{campaign-detail-HM3GQJLQ.mjs → campaign-detail-L7USOSG7.mjs} +11 -11
- package/dist/{categories-metadata-WKL3MGD7.mjs → categories-metadata-3GYVMP6Q.mjs} +11 -11
- package/dist/{category-create-KHJZSC7G.mjs → category-create-G2JK5KDF.mjs} +3 -3
- package/dist/{category-detail-UTWWDKFP.mjs → category-detail-6YJNXJZI.mjs} +13 -13
- package/dist/{category-edit-CTA2EPDG.mjs → category-edit-4V4SHFZL.mjs} +3 -3
- package/dist/{category-list-QBYJ4T3R.mjs → category-list-WHGMREI2.mjs} +4 -4
- package/dist/{category-organize-SXP33XET.mjs → category-organize-B4I6TDK4.mjs} +3 -3
- package/dist/{category-products-XXBTCXFF.mjs → category-products-FJV2QX6O.mjs} +12 -12
- package/dist/{chunk-DTCIBQO2.mjs → chunk-2BF4242O.mjs} +3 -3
- package/dist/{chunk-A2WBKOXJ.mjs → chunk-2WYSM6OA.mjs} +2 -2
- package/dist/{chunk-Z6BFNHEO.mjs → chunk-3TPUO6MD.mjs} +0 -12
- package/dist/{chunk-A4XYK3MY.mjs → chunk-3XBFXGEA.mjs} +2 -2
- package/dist/{chunk-U6G4M5LP.mjs → chunk-43TDMTAG.mjs} +1 -1
- package/dist/{chunk-XY7A7GZJ.mjs → chunk-5FMYPGTX.mjs} +1 -1
- package/dist/{chunk-UWY5ZV66.mjs → chunk-6F74MBBU.mjs} +1 -13
- package/dist/{chunk-OSHH5GAS.mjs → chunk-6X2UTJF3.mjs} +1 -13
- package/dist/{chunk-4JQR6QNW.mjs → chunk-73OGFYCU.mjs} +2 -2
- package/dist/chunk-7AXHHXCX.mjs +4 -0
- package/dist/{chunk-BMS2QLJY.mjs → chunk-BMJ5RYIO.mjs} +1 -1
- package/dist/{chunk-23GTCEOV.mjs → chunk-C32SLRTC.mjs} +1 -1
- package/dist/{chunk-OK6NZN2A.mjs → chunk-FDOVSLDC.mjs} +1 -1
- package/dist/{chunk-HTCYX4VD.mjs → chunk-FWRPGWPC.mjs} +1 -1
- package/dist/{chunk-GLBHPDR4.mjs → chunk-GRID7K27.mjs} +43 -178
- package/dist/{chunk-Y2YVTIJI.mjs → chunk-H65COXEW.mjs} +1 -1
- package/dist/{chunk-LWYKUORZ.mjs → chunk-ITNDUP2W.mjs} +152 -152
- package/dist/{chunk-SG2JZPTG.mjs → chunk-JPXDZWRN.mjs} +1 -1
- package/dist/{chunk-HNJ65IND.mjs → chunk-JSL6RQIX.mjs} +3 -3
- package/dist/{chunk-QKALAT7P.mjs → chunk-JUZ754L2.mjs} +1 -1
- package/dist/{chunk-IKTGFXWR.mjs → chunk-ML4BEONO.mjs} +1 -1
- package/dist/{chunk-UJ2TMPV4.mjs → chunk-QBIQEVTU.mjs} +0 -12
- package/dist/{chunk-FYWHE3W5.mjs → chunk-R3FD2XEU.mjs} +1 -1
- package/dist/{chunk-2XTBDCGE.mjs → chunk-RNV5E7NV.mjs} +1 -1
- package/dist/{chunk-5F427YCP.mjs → chunk-RUXFTSJR.mjs} +4 -4
- package/dist/{chunk-IAV7IKJ6.mjs → chunk-SR45O6K3.mjs} +1 -1
- package/dist/{chunk-AWRCV3ME.mjs → chunk-XGSMYYUJ.mjs} +1 -1
- package/dist/{chunk-UMCJYHAD.mjs → chunk-YBCCF4FO.mjs} +1 -1
- package/dist/{chunk-6P4Q4AAP.mjs → chunk-YOSHYW6O.mjs} +3 -3
- package/dist/{collection-add-products-42F7H77E.mjs → collection-add-products-KDTKR543.mjs} +12 -12
- package/dist/{collection-create-GWKWVT7B.mjs → collection-create-PBAAYBMB.mjs} +3 -3
- package/dist/{collection-detail-PXIS3G64.mjs → collection-detail-6ZXVOL75.mjs} +12 -12
- package/dist/{collection-edit-EZIO2BR5.mjs → collection-edit-7GW5PA32.mjs} +3 -3
- package/dist/{collection-list-O74CGY24.mjs → collection-list-MSWHXF4U.mjs} +13 -13
- package/dist/{collection-metadata-U6FMA4IC.mjs → collection-metadata-TJQOWR5R.mjs} +11 -11
- package/dist/{customer-detail-OMTFJ6CE.mjs → customer-detail-3CT4TIOM.mjs} +12 -12
- package/dist/{customer-group-detail-ADK3M5LG.mjs → customer-group-detail-YSIYKTFF.mjs} +11 -11
- package/dist/{customer-group-list-7ZRQ2HWU.mjs → customer-group-list-M3ZXYW3T.mjs} +11 -11
- package/dist/{customers-add-customer-group-5U27WHJB.mjs → customers-add-customer-group-J737AKRI.mjs} +11 -11
- package/dist/{edit-inventory-item-H7DAZWIT.mjs → edit-inventory-item-ELQTABU4.mjs} +2 -2
- package/dist/{edit-inventory-item-attributes-7HTXXPGZ.mjs → edit-inventory-item-attributes-P4WS4UTE.mjs} +2 -2
- package/dist/{edit-reservation-OVTRZHJR.mjs → edit-reservation-77DUKBGX.mjs} +3 -3
- package/dist/{edit-rules-BM2ERGVJ.mjs → edit-rules-WSLQZ66N.mjs} +11 -11
- package/dist/{inventory-create-7MA7B5N2.mjs → inventory-create-JE4Y7NIG.mjs} +11 -11
- package/dist/{inventory-detail-B4PRHZK3.mjs → inventory-detail-G26VODHQ.mjs} +11 -11
- package/dist/{inventory-list-RXJPSVZE.mjs → inventory-list-IPORNDO4.mjs} +2 -2
- package/dist/{inventory-metadata-C7MJ3GY5.mjs → inventory-metadata-J5NVL5SV.mjs} +11 -11
- package/dist/{inventory-stock-WVTYPJTX.mjs → inventory-stock-M227HL6G.mjs} +11 -11
- package/dist/{location-detail-KO6EBDK5.mjs → location-detail-NL2TN3V7.mjs} +11 -11
- package/dist/{location-fulfillment-providers-IORBE3E3.mjs → location-fulfillment-providers-E4PCYUKY.mjs} +13 -13
- package/dist/{location-sales-channels-P3QJTFDT.mjs → location-sales-channels-P6O7KJAO.mjs} +3 -3
- package/dist/{location-service-zone-shipping-option-create-2R3ZFLVK.mjs → location-service-zone-shipping-option-create-PYRQ7BPE.mjs} +11 -11
- package/dist/{login-XKB6OR7I.mjs → login-4CLCYYEA.mjs} +11 -11
- package/dist/{manage-locations-7HH6R4UP.mjs → manage-locations-PWHIZBEM.mjs} +2 -2
- package/dist/{order-allocate-items-HZGGYJ42.mjs → order-allocate-items-PL4YRRG4.mjs} +4 -4
- package/dist/{order-create-claim-NKCOGF4A.mjs → order-create-claim-YL7MD5XD.mjs} +13 -13
- package/dist/{order-create-edit-UNQYXGLL.mjs → order-create-edit-XAWVTQD4.mjs} +12 -12
- package/dist/{order-create-exchange-WI7OA2WO.mjs → order-create-exchange-FJMXI6K5.mjs} +13 -13
- package/dist/{order-create-fulfillment-2LJTEWDY.mjs → order-create-fulfillment-FYURNIMY.mjs} +11 -11
- package/dist/{order-create-refund-7K6UJXGP.mjs → order-create-refund-AABCH2MP.mjs} +11 -11
- package/dist/{order-create-return-52GHGW5Z.mjs → order-create-return-W3KT5LKU.mjs} +5 -5
- package/dist/{order-create-shipment-ZTDLLUBY.mjs → order-create-shipment-HABAVTEQ.mjs} +11 -11
- package/dist/{order-detail-JTRUMRLO.mjs → order-detail-DLFW35N5.mjs} +15 -15
- package/dist/{order-edit-billing-address-YHYNVLOE.mjs → order-edit-billing-address-7RBMI4U7.mjs} +11 -11
- package/dist/{order-edit-email-TCQPEVZY.mjs → order-edit-email-U7SUTU4P.mjs} +11 -11
- package/dist/{order-edit-shipping-address-CFSYQLKD.mjs → order-edit-shipping-address-I2WW7QC5.mjs} +11 -11
- package/dist/{order-export-G4SBNEJ7.mjs → order-export-VJXXQ7WN.mjs} +12 -12
- package/dist/{order-list-GRLQWN4L.mjs → order-list-3I4REXYI.mjs} +6 -6
- package/dist/{order-metadata-KGPB37VL.mjs → order-metadata-TSZZQQTZ.mjs} +11 -11
- package/dist/{order-receive-return-JER24SEV.mjs → order-receive-return-2JBWHY4Z.mjs} +12 -12
- package/dist/{order-request-transfer-3FBUYZNT.mjs → order-request-transfer-2WNT5G27.mjs} +11 -11
- package/dist/{price-list-configuration-6S3MLNXQ.mjs → price-list-configuration-OH3KGRDN.mjs} +3 -3
- package/dist/{price-list-create-CXZCFFTP.mjs → price-list-create-ZGOKBAWP.mjs} +12 -12
- package/dist/{price-list-detail-XOMU6U5J.mjs → price-list-detail-JIS454OY.mjs} +13 -13
- package/dist/{price-list-edit-53UW35L3.mjs → price-list-edit-WMWJFW7S.mjs} +3 -3
- package/dist/{price-list-list-DG5YEZ44.mjs → price-list-list-JJXWBCTJ.mjs} +4 -4
- package/dist/{price-list-prices-add-SDX5CQME.mjs → price-list-prices-add-QJWBPI5A.mjs} +12 -12
- package/dist/{price-list-prices-edit-EKB6NI5D.mjs → price-list-prices-edit-ICTQBHHM.mjs} +3 -3
- package/dist/{product-attributes-STD47BGC.mjs → product-attributes-VSFKRDLE.mjs} +12 -12
- package/dist/{product-create-LVGWVQAT.mjs → product-create-7R5YXGU2.mjs} +13 -13
- package/dist/{product-create-option-7AOXAA4S.mjs → product-create-option-FWBTGNZG.mjs} +2 -2
- package/dist/{product-create-variant-OTJKT6WI.mjs → product-create-variant-R6HXRAYY.mjs} +11 -11
- package/dist/{product-detail-OYVHJH3D.mjs → product-detail-LZP26A35.mjs} +12 -12
- package/dist/{product-edit-3SIUUIW4.mjs → product-edit-K25SVTO3.mjs} +12 -12
- package/dist/{product-edit-option-LWJT3CYJ.mjs → product-edit-option-FIDTMKUN.mjs} +2 -2
- package/dist/{product-export-57UUAGXF.mjs → product-export-UX5DTA3Q.mjs} +13 -13
- package/dist/{product-image-variants-edit-2BW5BJON.mjs → product-image-variants-edit-L4RTIYTJ.mjs} +11 -11
- package/dist/{product-import-6EM4VUXP.mjs → product-import-PEOW5NN6.mjs} +11 -11
- package/dist/{product-list-5V5GEH5K.mjs → product-list-HYVJZLCR.mjs} +12 -12
- package/dist/{product-media-3VJ7KENL.mjs → product-media-CG4RFOTX.mjs} +2 -2
- package/dist/{product-metadata-JZLHBLZQ.mjs → product-metadata-THI2FNZW.mjs} +11 -11
- package/dist/{product-organization-3PQ45C4B.mjs → product-organization-RYZELVUL.mjs} +13 -13
- package/dist/{product-prices-5ZL2RP7A.mjs → product-prices-LAVS64HJ.mjs} +2 -2
- package/dist/{product-sales-channels-PPXUG4KT.mjs → product-sales-channels-XBALPVAL.mjs} +3 -3
- package/dist/{product-shipping-profile-ETQFZ7DC.mjs → product-shipping-profile-KKDCYD3N.mjs} +2 -2
- package/dist/{product-stock-SJJABF6I.mjs → product-stock-LGNNLO7C.mjs} +11 -11
- package/dist/{product-tag-create-XXO4AQEC.mjs → product-tag-create-7SHCIBB3.mjs} +11 -11
- package/dist/{product-tag-detail-BSK64HXL.mjs → product-tag-detail-GG7CO6BN.mjs} +14 -14
- package/dist/{product-tag-edit-ENCGDT7E.mjs → product-tag-edit-E2RW4EDQ.mjs} +11 -11
- package/dist/{product-tag-list-SLQGCNDZ.mjs → product-tag-list-DCORIKKF.mjs} +14 -14
- package/dist/{product-tag-metadata-EPXHMU2K.mjs → product-tag-metadata-LDYF45YH.mjs} +11 -11
- package/dist/{product-type-create-DRFXTL5O.mjs → product-type-create-NRLNMABQ.mjs} +2 -2
- package/dist/{product-type-detail-4CRRU7YK.mjs → product-type-detail-AJ54QEZ7.mjs} +13 -13
- package/dist/{product-type-edit-SRHCZDK7.mjs → product-type-edit-BHTPMMVI.mjs} +2 -2
- package/dist/{product-type-list-QQKAHBJ3.mjs → product-type-list-MQ2PW2IE.mjs} +3 -3
- package/dist/{product-type-metadata-73OKOGPP.mjs → product-type-metadata-BBV4BL2F.mjs} +11 -11
- package/dist/{product-variant-detail-RPHLG4HU.mjs → product-variant-detail-27TBRV44.mjs} +11 -11
- package/dist/{product-variant-edit-JF7NN64Y.mjs → product-variant-edit-M3EFPB7I.mjs} +11 -11
- package/dist/{product-variant-manage-inventory-items-Y2VEOHP7.mjs → product-variant-manage-inventory-items-QK7Z4KHF.mjs} +2 -2
- package/dist/{product-variant-media-2WLVNGI4.mjs → product-variant-media-IOAZGVL2.mjs} +2 -2
- package/dist/{product-variant-metadata-HU2CXGPO.mjs → product-variant-metadata-DJSINBPO.mjs} +11 -11
- package/dist/{promotion-create-BHA3FQG2.mjs → promotion-create-VGJCTHU3.mjs} +11 -11
- package/dist/{promotion-detail-F3QSR52W.mjs → promotion-detail-AWLQVJNN.mjs} +11 -11
- package/dist/{refund-reason-create-ZA5TKW2Z.mjs → refund-reason-create-EXAC2PMO.mjs} +11 -11
- package/dist/{refund-reason-edit-N2CRCLKZ.mjs → refund-reason-edit-NEXHR2RT.mjs} +11 -11
- package/dist/{refund-reason-list-SE4TMGMT.mjs → refund-reason-list-2IXZQWFF.mjs} +11 -11
- package/dist/{region-metadata-O5NZBWXP.mjs → region-metadata-VO2S34JP.mjs} +11 -11
- package/dist/{reservation-create-ZCIYM6JI.mjs → reservation-create-M3NKBTYW.mjs} +3 -3
- package/dist/{reservation-detail-UFK6XIXE.mjs → reservation-detail-VQJLWDL3.mjs} +11 -11
- package/dist/{reservation-list-B47DXTA7.mjs → reservation-list-HSF22GFZ.mjs} +3 -3
- package/dist/{reservation-metadata-AEJEKGLV.mjs → reservation-metadata-RRGKR7AK.mjs} +11 -11
- package/dist/{sales-channel-add-products-2LMB7EF5.mjs → sales-channel-add-products-ZZE7LM4K.mjs} +12 -12
- package/dist/{sales-channel-create-MI7HHZYE.mjs → sales-channel-create-BW5VCR34.mjs} +3 -3
- package/dist/{sales-channel-detail-EUQ4STQI.mjs → sales-channel-detail-27FFRS5I.mjs} +12 -12
- package/dist/{sales-channel-edit-VSHOIR37.mjs → sales-channel-edit-NCWKYFYJ.mjs} +3 -3
- package/dist/{sales-channel-list-JXKGHX4G.mjs → sales-channel-list-JK7HQZM5.mjs} +11 -11
- package/dist/{sales-channel-metadata-AJMQ5SQ2.mjs → sales-channel-metadata-ZSXMTQ6L.mjs} +11 -11
- package/dist/{shipping-option-type-create-YVVIA2XC.mjs → shipping-option-type-create-YLAEM4M6.mjs} +11 -11
- package/dist/{shipping-option-type-detail-ZZW36XLK.mjs → shipping-option-type-detail-33A6BZMB.mjs} +12 -12
- package/dist/{shipping-option-type-edit-O6F74T3A.mjs → shipping-option-type-edit-WBGIOJ3L.mjs} +11 -11
- package/dist/{shipping-option-type-list-SPTE7MT6.mjs → shipping-option-type-list-SYE2CFWK.mjs} +12 -12
- package/dist/{shipping-profile-metadata-7WFE55VG.mjs → shipping-profile-metadata-6CIPN25L.mjs} +11 -11
- package/dist/{store-add-locales-GWCGIXHU.mjs → store-add-locales-K5OOQ25D.mjs} +12 -12
- package/dist/{store-detail-YLJLBBZE.mjs → store-detail-RVGISZXQ.mjs} +11 -11
- package/dist/{store-metadata-BZ57I2E6.mjs → store-metadata-HPGZG23A.mjs} +11 -11
- package/dist/{tax-region-create-FGTV7VJL.mjs → tax-region-create-EOT7GTKU.mjs} +11 -11
- package/dist/{tax-region-detail-PPIMD7OX.mjs → tax-region-detail-E5ZNBHJY.mjs} +16 -16
- package/dist/{tax-region-edit-ELZKA7YH.mjs → tax-region-edit-5IM2XJZP.mjs} +11 -11
- package/dist/{tax-region-province-detail-FV2NDT3E.mjs → tax-region-province-detail-MNNQWTQ7.mjs} +16 -16
- package/dist/{tax-region-tax-override-create-N572MQPZ.mjs → tax-region-tax-override-create-EYESRMIT.mjs} +14 -14
- package/dist/{tax-region-tax-override-edit-5DCSJW6D.mjs → tax-region-tax-override-edit-ULQESLZ2.mjs} +15 -15
- package/dist/{translation-list-FK7XYLHX.mjs → translation-list-GFZVEND6.mjs} +11 -11
- package/dist/{translations-edit-VRXZI5KW.mjs → translations-edit-YZ26SQEB.mjs} +17 -22
- package/dist/{user-detail-BJUXLZZQ.mjs → user-detail-3IEU4KU4.mjs} +2 -2
- package/dist/{user-metadata-GRJZZ524.mjs → user-metadata-7P4OECLX.mjs} +11 -11
- package/dist/{workflow-execution-detail-HXTFWGKG.mjs → workflow-execution-detail-EAN7OEWP.mjs} +11 -11
- package/package.json +9 -9
- package/src/hooks/api/translations.tsx +85 -182
- package/src/routes/translations/translations-edit/translations-edit.tsx +8 -13
- package/dist/chunk-HGRIOEAR.mjs +0 -32
|
@@ -2,25 +2,16 @@ import { FetchError } from "@medusajs/js-sdk"
|
|
|
2
2
|
import { HttpTypes } from "@medusajs/types"
|
|
3
3
|
import {
|
|
4
4
|
QueryKey,
|
|
5
|
+
useInfiniteQuery,
|
|
5
6
|
UseInfiniteQueryOptions,
|
|
6
|
-
UseInfiniteQueryResult,
|
|
7
7
|
useMutation,
|
|
8
8
|
UseMutationOptions,
|
|
9
9
|
useQuery,
|
|
10
10
|
UseQueryOptions,
|
|
11
11
|
} from "@tanstack/react-query"
|
|
12
12
|
import { sdk } from "../../lib/client"
|
|
13
|
-
import { queryKeysFactory } from "../../lib/query-key-factory"
|
|
14
13
|
import { queryClient } from "../../lib/query-client"
|
|
15
|
-
import {
|
|
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"
|
|
14
|
+
import { queryKeysFactory } from "../../lib/query-key-factory"
|
|
24
15
|
|
|
25
16
|
const TRANSLATIONS_QUERY_KEY = "translations" as const
|
|
26
17
|
export const translationsQueryKeys = queryKeysFactory(TRANSLATIONS_QUERY_KEY)
|
|
@@ -35,177 +26,77 @@ export const translationStatisticsQueryKeys = queryKeysFactory(
|
|
|
35
26
|
TRANSLATION_STATISTICS_QUERY_KEY
|
|
36
27
|
)
|
|
37
28
|
|
|
29
|
+
const TRANSLATION_ENTITIES_QUERY_KEY = "translation_entities" as const
|
|
30
|
+
export const translationEntitiesQueryKeys = queryKeysFactory(
|
|
31
|
+
TRANSLATION_ENTITIES_QUERY_KEY
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
const DEFAULT_PAGE_SIZE = 20
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Hook to fetch entities with their translatable fields and all translations.
|
|
38
|
+
* Uses the /admin/translations/entities endpoint which returns entities
|
|
39
|
+
* with all their translations for all locales.
|
|
40
|
+
*
|
|
41
|
+
* @param reference - The entity type (e.g., "product", "product_variant")
|
|
42
|
+
* @param referenceId - Optional ID(s) to filter specific entities
|
|
43
|
+
* @param options - React Query options
|
|
44
|
+
*/
|
|
38
45
|
export const useReferenceTranslations = (
|
|
39
46
|
reference: string,
|
|
40
|
-
translatableFields: string[],
|
|
41
47
|
referenceId?: string | string[],
|
|
42
48
|
options?: Omit<
|
|
43
|
-
UseInfiniteQueryOptions<
|
|
49
|
+
UseInfiniteQueryOptions<
|
|
50
|
+
HttpTypes.AdminTranslationEntitiesResponse,
|
|
51
|
+
FetchError,
|
|
52
|
+
{
|
|
53
|
+
pages: HttpTypes.AdminTranslationEntitiesResponse[]
|
|
54
|
+
pageParams: number[]
|
|
55
|
+
},
|
|
56
|
+
HttpTypes.AdminTranslationEntitiesResponse,
|
|
57
|
+
QueryKey,
|
|
58
|
+
number
|
|
59
|
+
>,
|
|
44
60
|
"queryFn" | "queryKey" | "initialPageParam" | "getNextPageParam"
|
|
45
61
|
>
|
|
46
62
|
) => {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return {
|
|
69
|
-
...rest,
|
|
70
|
-
data: {
|
|
71
|
-
translations:
|
|
72
|
-
products?.flatMap((product) => product.translations ?? []) ?? [],
|
|
73
|
-
references: products ?? [],
|
|
74
|
-
count: data?.pages[0]?.count ?? 0,
|
|
75
|
-
},
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
[
|
|
80
|
-
"product_variant",
|
|
81
|
-
() => {
|
|
82
|
-
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
83
|
-
|
|
84
|
-
const { data, ...rest } = useInfiniteVariants(
|
|
85
|
-
{ id: referenceId ?? [], fields },
|
|
86
|
-
options
|
|
87
|
-
)
|
|
88
|
-
const variants = data?.pages.flatMap((page) => page.variants) ?? []
|
|
89
|
-
|
|
90
|
-
return {
|
|
91
|
-
...rest,
|
|
92
|
-
data: {
|
|
93
|
-
translations:
|
|
94
|
-
variants?.flatMap((variant) => variant.translations ?? []) ?? [],
|
|
95
|
-
references: variants ?? [],
|
|
96
|
-
translatableFields,
|
|
97
|
-
count: data?.pages[0]?.count ?? 0,
|
|
98
|
-
},
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
[
|
|
103
|
-
"product_category",
|
|
104
|
-
() => {
|
|
105
|
-
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
106
|
-
|
|
107
|
-
const { data, ...rest } = useInfiniteCategories(
|
|
108
|
-
{ id: referenceId ?? [], fields },
|
|
109
|
-
options
|
|
110
|
-
)
|
|
111
|
-
const categories =
|
|
112
|
-
data?.pages.flatMap((page) => page.product_categories) ?? []
|
|
113
|
-
|
|
114
|
-
return {
|
|
115
|
-
...rest,
|
|
116
|
-
data: {
|
|
117
|
-
translations:
|
|
118
|
-
categories?.flatMap((category) => category.translations ?? []) ??
|
|
119
|
-
[],
|
|
120
|
-
references: categories ?? [],
|
|
121
|
-
translatableFields,
|
|
122
|
-
count: data?.pages[0]?.count ?? 0,
|
|
123
|
-
},
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
],
|
|
127
|
-
[
|
|
128
|
-
"product_collection",
|
|
129
|
-
() => {
|
|
130
|
-
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
131
|
-
|
|
132
|
-
const { data, ...rest } = useInfiniteCollections(
|
|
133
|
-
{ id: referenceId ?? [], fields },
|
|
134
|
-
options
|
|
135
|
-
)
|
|
136
|
-
const collections =
|
|
137
|
-
data?.pages.flatMap((page) => page.collections) ?? []
|
|
138
|
-
|
|
139
|
-
return {
|
|
140
|
-
...rest,
|
|
141
|
-
data: {
|
|
142
|
-
translations:
|
|
143
|
-
collections?.flatMap(
|
|
144
|
-
(collection) => collection.translations ?? []
|
|
145
|
-
) ?? [],
|
|
146
|
-
references: collections ?? [],
|
|
147
|
-
translatableFields,
|
|
148
|
-
count: data?.pages[0]?.count ?? 0,
|
|
149
|
-
},
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
],
|
|
153
|
-
[
|
|
154
|
-
"product_type",
|
|
155
|
-
() => {
|
|
156
|
-
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
157
|
-
|
|
158
|
-
const { data, ...rest } = useInfiniteProductTypes(
|
|
159
|
-
{ id: referenceId ?? [], fields },
|
|
160
|
-
options
|
|
161
|
-
)
|
|
162
|
-
const product_types =
|
|
163
|
-
data?.pages.flatMap((page) => page.product_types) ?? []
|
|
164
|
-
|
|
165
|
-
return {
|
|
166
|
-
...rest,
|
|
167
|
-
data: {
|
|
168
|
-
translations:
|
|
169
|
-
product_types?.flatMap((type) => type.translations ?? []) ?? [],
|
|
170
|
-
references: product_types ?? [],
|
|
171
|
-
count: data?.pages[0]?.count ?? 0,
|
|
172
|
-
translatableFields,
|
|
173
|
-
},
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
],
|
|
177
|
-
[
|
|
178
|
-
"product_tag",
|
|
179
|
-
() => {
|
|
180
|
-
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
63
|
+
const { data, ...rest } = useInfiniteQuery({
|
|
64
|
+
queryKey: translationEntitiesQueryKeys.list({
|
|
65
|
+
type: reference,
|
|
66
|
+
id: referenceId,
|
|
67
|
+
}),
|
|
68
|
+
queryFn: async ({ pageParam = 0 }) => {
|
|
69
|
+
return sdk.admin.translation.entities({
|
|
70
|
+
type: reference,
|
|
71
|
+
id: referenceId,
|
|
72
|
+
limit: DEFAULT_PAGE_SIZE,
|
|
73
|
+
offset: pageParam,
|
|
74
|
+
})
|
|
75
|
+
},
|
|
76
|
+
initialPageParam: 0,
|
|
77
|
+
getNextPageParam: (lastPage) => {
|
|
78
|
+
const nextOffset = lastPage.offset + lastPage.limit
|
|
79
|
+
return nextOffset < lastPage.count ? nextOffset : undefined
|
|
80
|
+
},
|
|
81
|
+
...options,
|
|
82
|
+
})
|
|
181
83
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
84
|
+
const entitiesWithTranslations =
|
|
85
|
+
data?.pages.flatMap((page) => page.data) ?? []
|
|
86
|
+
const translations = entitiesWithTranslations.flatMap(
|
|
87
|
+
(entity) => entity.translations ?? []
|
|
88
|
+
)
|
|
89
|
+
const references = entitiesWithTranslations.map(
|
|
90
|
+
({ translations: _, ...entity }) => entity
|
|
91
|
+
)
|
|
92
|
+
const count = data?.pages[0]?.count ?? 0
|
|
188
93
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
references: product_tags ?? [],
|
|
195
|
-
translatableFields,
|
|
196
|
-
count: data?.pages[0]?.count ?? 0,
|
|
197
|
-
},
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
],
|
|
201
|
-
// TODO: product option and option values
|
|
202
|
-
])
|
|
203
|
-
const referenceHook = referenceHookMap.get(reference)
|
|
204
|
-
if (!referenceHook) {
|
|
205
|
-
throw new Error(`No hook found for reference type: ${reference}`)
|
|
94
|
+
return {
|
|
95
|
+
references,
|
|
96
|
+
translations,
|
|
97
|
+
count,
|
|
98
|
+
...rest,
|
|
206
99
|
}
|
|
207
|
-
const { data, ...rest } = referenceHook()
|
|
208
|
-
return { ...data, ...rest }
|
|
209
100
|
}
|
|
210
101
|
|
|
211
102
|
export const useTranslations = (
|
|
@@ -229,15 +120,6 @@ export const useTranslations = (
|
|
|
229
120
|
return { ...data, ...rest }
|
|
230
121
|
}
|
|
231
122
|
|
|
232
|
-
const referenceInvalidationKeysMap = new Map<string, QueryKey>([
|
|
233
|
-
["product", productsQueryKeys.lists()],
|
|
234
|
-
["product_variant", productVariantQueryKeys.lists()],
|
|
235
|
-
["product_category", categoriesQueryKeys.lists()],
|
|
236
|
-
["product_collection", collectionsQueryKeys.lists()],
|
|
237
|
-
["product_type", productTypesQueryKeys.lists()],
|
|
238
|
-
["product_tag", productTagsQueryKeys.lists()],
|
|
239
|
-
])
|
|
240
|
-
|
|
241
123
|
export const useBatchTranslations = (
|
|
242
124
|
reference: string,
|
|
243
125
|
options?: UseMutationOptions<
|
|
@@ -258,7 +140,7 @@ export const useBatchTranslations = (
|
|
|
258
140
|
const invalidateQueries = async () => {
|
|
259
141
|
await Promise.all([
|
|
260
142
|
queryClient.invalidateQueries({
|
|
261
|
-
queryKey:
|
|
143
|
+
queryKey: translationEntitiesQueryKeys.list({ type: reference }),
|
|
262
144
|
}),
|
|
263
145
|
queryClient.invalidateQueries({
|
|
264
146
|
queryKey: translationStatisticsQueryKeys.lists(),
|
|
@@ -293,6 +175,27 @@ export const useTranslationSettings = (
|
|
|
293
175
|
return { ...data, ...rest }
|
|
294
176
|
}
|
|
295
177
|
|
|
178
|
+
export const useTranslationEntities = (
|
|
179
|
+
query: HttpTypes.AdminTranslationEntitiesParams,
|
|
180
|
+
options?: Omit<
|
|
181
|
+
UseQueryOptions<
|
|
182
|
+
HttpTypes.AdminTranslationEntitiesResponse,
|
|
183
|
+
FetchError,
|
|
184
|
+
HttpTypes.AdminTranslationEntitiesResponse,
|
|
185
|
+
QueryKey
|
|
186
|
+
>,
|
|
187
|
+
"queryFn" | "queryKey"
|
|
188
|
+
>
|
|
189
|
+
) => {
|
|
190
|
+
const { data, ...rest } = useQuery({
|
|
191
|
+
queryKey: translationEntitiesQueryKeys.list(query),
|
|
192
|
+
queryFn: () => sdk.admin.translation.entities(query),
|
|
193
|
+
...options,
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
return { ...data, ...rest }
|
|
197
|
+
}
|
|
198
|
+
|
|
296
199
|
export const useTranslationStatistics = (
|
|
297
200
|
query?: HttpTypes.AdminTranslationStatisticsParams,
|
|
298
201
|
options?: Omit<
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { keepPreviousData } from "@tanstack/react-query"
|
|
2
|
+
import { useEffect } from "react"
|
|
1
3
|
import { useNavigate, useSearchParams } from "react-router-dom"
|
|
4
|
+
import { RouteFocusModal } from "../../../components/modals"
|
|
2
5
|
import {
|
|
3
6
|
useReferenceTranslations,
|
|
4
7
|
useStore,
|
|
5
8
|
useTranslationSettings,
|
|
6
9
|
} from "../../../hooks/api"
|
|
7
|
-
import { TranslationsEditForm } from "./components/translations-edit-form"
|
|
8
|
-
import { useEffect } from "react"
|
|
9
|
-
import { RouteFocusModal } from "../../../components/modals"
|
|
10
10
|
import { useFeatureFlag } from "../../../providers/feature-flag-provider"
|
|
11
|
-
import {
|
|
11
|
+
import { TranslationsEditForm } from "./components/translations-edit-form"
|
|
12
12
|
|
|
13
13
|
export const TranslationsEdit = () => {
|
|
14
14
|
const isTranslationsEnabled = useFeatureFlag("translation")
|
|
@@ -41,15 +41,10 @@ export const TranslationsEdit = () => {
|
|
|
41
41
|
isPending,
|
|
42
42
|
isError,
|
|
43
43
|
error,
|
|
44
|
-
} = useReferenceTranslations(
|
|
45
|
-
reference
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
{
|
|
49
|
-
enabled: !!translatable_fields && !!reference,
|
|
50
|
-
placeholderData: keepPreviousData,
|
|
51
|
-
}
|
|
52
|
-
)
|
|
44
|
+
} = useReferenceTranslations(reference!, referenceIdParam, {
|
|
45
|
+
enabled: !!reference,
|
|
46
|
+
placeholderData: keepPreviousData,
|
|
47
|
+
})
|
|
53
48
|
const {
|
|
54
49
|
store,
|
|
55
50
|
isPending: isStorePending,
|
package/dist/chunk-HGRIOEAR.mjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// src/hooks/use-infinite-list.tsx
|
|
2
|
-
import {
|
|
3
|
-
useInfiniteQuery
|
|
4
|
-
} from "@tanstack/react-query";
|
|
5
|
-
var useInfiniteList = ({
|
|
6
|
-
queryKey,
|
|
7
|
-
queryFn,
|
|
8
|
-
query,
|
|
9
|
-
options
|
|
10
|
-
}) => {
|
|
11
|
-
const { limit = 50, offset: _, ..._query } = query ?? {};
|
|
12
|
-
const resolvedQueryKey = typeof queryKey === "function" ? queryKey(_query) : queryKey;
|
|
13
|
-
const infiniteQueryKey = resolvedQueryKey[resolvedQueryKey.length - 1] === "__infinite" ? resolvedQueryKey : [...resolvedQueryKey, "__infinite"];
|
|
14
|
-
return useInfiniteQuery({
|
|
15
|
-
// Infinite queries must not share the exact same queryKey as non-infinite queries,
|
|
16
|
-
// since the cached data shape differs (InfiniteData<T> vs T).
|
|
17
|
-
queryKey: infiniteQueryKey,
|
|
18
|
-
queryFn: ({ pageParam = 0 }) => {
|
|
19
|
-
return queryFn({ ..._query, limit, offset: pageParam });
|
|
20
|
-
},
|
|
21
|
-
initialPageParam: 0,
|
|
22
|
-
getNextPageParam: (lastPage) => {
|
|
23
|
-
const moreItemsExist = lastPage.count > lastPage.offset + lastPage.limit;
|
|
24
|
-
return moreItemsExist ? lastPage.offset + lastPage.limit : void 0;
|
|
25
|
-
},
|
|
26
|
-
...options
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export {
|
|
31
|
-
useInfiniteList
|
|
32
|
-
};
|