@medusajs/dashboard 2.12.4-snapshot-20251219084848 → 2.12.4-snapshot-20251219090201
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-QDR2SYAM.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-J72MJXLT.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 -247
- package/dist/app.mjs +12 -12
- package/dist/{campaign-detail-XBZGUDCE.mjs → campaign-detail-L7USOSG7.mjs} +11 -11
- package/dist/{categories-metadata-XHVGJJB2.mjs → categories-metadata-3GYVMP6Q.mjs} +11 -11
- package/dist/{category-create-KHJZSC7G.mjs → category-create-G2JK5KDF.mjs} +3 -3
- package/dist/{category-detail-DUM6Y54A.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-QBYCSFSK.mjs → category-products-FJV2QX6O.mjs} +12 -12
- package/dist/{chunk-N5ZK7K5F.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-DBQ3GZQV.mjs → chunk-FDOVSLDC.mjs} +1 -1
- package/dist/{chunk-HTCYX4VD.mjs → chunk-FWRPGWPC.mjs} +1 -1
- package/dist/{chunk-DGGDH6B2.mjs → chunk-GRID7K27.mjs} +43 -182
- package/dist/{chunk-Y2YVTIJI.mjs → chunk-H65COXEW.mjs} +1 -1
- package/dist/{chunk-MINJ3Z3K.mjs → chunk-ITNDUP2W.mjs} +152 -152
- package/dist/{chunk-7JPS3BXZ.mjs → chunk-JPXDZWRN.mjs} +1 -1
- package/dist/{chunk-YOI66DFA.mjs → chunk-JSL6RQIX.mjs} +3 -3
- package/dist/{chunk-QKALAT7P.mjs → chunk-JUZ754L2.mjs} +1 -1
- package/dist/{chunk-E6A5UFG2.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-JSZX3OAS.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-IYB5JNZS.mjs → chunk-YBCCF4FO.mjs} +1 -1
- package/dist/{chunk-6P4Q4AAP.mjs → chunk-YOSHYW6O.mjs} +3 -3
- package/dist/{collection-add-products-POAHJE4K.mjs → collection-add-products-KDTKR543.mjs} +12 -12
- package/dist/{collection-create-GWKWVT7B.mjs → collection-create-PBAAYBMB.mjs} +3 -3
- package/dist/{collection-detail-TX6X36AK.mjs → collection-detail-6ZXVOL75.mjs} +12 -12
- package/dist/{collection-edit-EZIO2BR5.mjs → collection-edit-7GW5PA32.mjs} +3 -3
- package/dist/{collection-list-QGBGNKMP.mjs → collection-list-MSWHXF4U.mjs} +13 -13
- package/dist/{collection-metadata-YUCHVITZ.mjs → collection-metadata-TJQOWR5R.mjs} +11 -11
- package/dist/{customer-detail-DZTVA6YZ.mjs → customer-detail-3CT4TIOM.mjs} +12 -12
- package/dist/{customer-group-detail-7GTLRDFY.mjs → customer-group-detail-YSIYKTFF.mjs} +11 -11
- package/dist/{customer-group-list-ZHG4AKWS.mjs → customer-group-list-M3ZXYW3T.mjs} +11 -11
- package/dist/{customers-add-customer-group-ORD4E3CN.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-AHNAOANX.mjs → edit-rules-WSLQZ66N.mjs} +11 -11
- package/dist/{inventory-create-I2ZNKBWG.mjs → inventory-create-JE4Y7NIG.mjs} +11 -11
- package/dist/{inventory-detail-IG22JV77.mjs → inventory-detail-G26VODHQ.mjs} +11 -11
- package/dist/{inventory-list-RXJPSVZE.mjs → inventory-list-IPORNDO4.mjs} +2 -2
- package/dist/{inventory-metadata-4HG3QRRO.mjs → inventory-metadata-J5NVL5SV.mjs} +11 -11
- package/dist/{inventory-stock-627QHNTC.mjs → inventory-stock-M227HL6G.mjs} +11 -11
- package/dist/{location-detail-QVXPUHZ3.mjs → location-detail-NL2TN3V7.mjs} +11 -11
- package/dist/{location-fulfillment-providers-UVQ55LG2.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-JKJBGGXT.mjs → location-service-zone-shipping-option-create-PYRQ7BPE.mjs} +11 -11
- package/dist/{login-TXFQFYSS.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-TTYWHRKK.mjs → order-create-claim-YL7MD5XD.mjs} +13 -13
- package/dist/{order-create-edit-PW3LPQSQ.mjs → order-create-edit-XAWVTQD4.mjs} +12 -12
- package/dist/{order-create-exchange-XR7KDU3J.mjs → order-create-exchange-FJMXI6K5.mjs} +13 -13
- package/dist/{order-create-fulfillment-OFO7HTYO.mjs → order-create-fulfillment-FYURNIMY.mjs} +11 -11
- package/dist/{order-create-refund-WYWELU4D.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-GQGKBEZR.mjs → order-create-shipment-HABAVTEQ.mjs} +11 -11
- package/dist/{order-detail-V6JZ33J7.mjs → order-detail-DLFW35N5.mjs} +15 -15
- package/dist/{order-edit-billing-address-5NFC7JRC.mjs → order-edit-billing-address-7RBMI4U7.mjs} +11 -11
- package/dist/{order-edit-email-CYY7DRFA.mjs → order-edit-email-U7SUTU4P.mjs} +11 -11
- package/dist/{order-edit-shipping-address-RQA3GQEX.mjs → order-edit-shipping-address-I2WW7QC5.mjs} +11 -11
- package/dist/{order-export-2M2SNFEZ.mjs → order-export-VJXXQ7WN.mjs} +12 -12
- package/dist/{order-list-GRLQWN4L.mjs → order-list-3I4REXYI.mjs} +6 -6
- package/dist/{order-metadata-4EKWV7UP.mjs → order-metadata-TSZZQQTZ.mjs} +11 -11
- package/dist/{order-receive-return-T3L6K6JL.mjs → order-receive-return-2JBWHY4Z.mjs} +12 -12
- package/dist/{order-request-transfer-TC43EJCS.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-2RP4VAZS.mjs → price-list-create-ZGOKBAWP.mjs} +12 -12
- package/dist/{price-list-detail-ALC255ZY.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-BMRVZHSY.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-2SDLZI6N.mjs → product-attributes-VSFKRDLE.mjs} +12 -12
- package/dist/{product-create-YMY32Z2F.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-L5DFGBUY.mjs → product-create-variant-R6HXRAYY.mjs} +11 -11
- package/dist/{product-detail-L5M6SHFW.mjs → product-detail-LZP26A35.mjs} +12 -12
- package/dist/{product-edit-M5DJOGMY.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-OIO463FI.mjs → product-export-UX5DTA3Q.mjs} +13 -13
- package/dist/{product-image-variants-edit-3BMWUXHJ.mjs → product-image-variants-edit-L4RTIYTJ.mjs} +11 -11
- package/dist/{product-import-LHZP3326.mjs → product-import-PEOW5NN6.mjs} +11 -11
- package/dist/{product-list-DGLRFAMV.mjs → product-list-HYVJZLCR.mjs} +12 -12
- package/dist/{product-media-3VJ7KENL.mjs → product-media-CG4RFOTX.mjs} +2 -2
- package/dist/{product-metadata-SZQASX6F.mjs → product-metadata-THI2FNZW.mjs} +11 -11
- package/dist/{product-organization-KHSJ7TSC.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-MSSMLX2T.mjs → product-stock-LGNNLO7C.mjs} +11 -11
- package/dist/{product-tag-create-437MVJIH.mjs → product-tag-create-7SHCIBB3.mjs} +11 -11
- package/dist/{product-tag-detail-2YNQPPVB.mjs → product-tag-detail-GG7CO6BN.mjs} +14 -14
- package/dist/{product-tag-edit-GKYZVF7J.mjs → product-tag-edit-E2RW4EDQ.mjs} +11 -11
- package/dist/{product-tag-list-M6BWTWZB.mjs → product-tag-list-DCORIKKF.mjs} +14 -14
- package/dist/{product-tag-metadata-3GZAFSRG.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-TZY22BSF.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-TX4BUD2J.mjs → product-type-metadata-BBV4BL2F.mjs} +11 -11
- package/dist/{product-variant-detail-HLQK3H2U.mjs → product-variant-detail-27TBRV44.mjs} +11 -11
- package/dist/{product-variant-edit-OIRAPZG4.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-7EBL352J.mjs → product-variant-metadata-DJSINBPO.mjs} +11 -11
- package/dist/{promotion-create-SVIYZBXP.mjs → promotion-create-VGJCTHU3.mjs} +11 -11
- package/dist/{promotion-detail-EESBGZHX.mjs → promotion-detail-AWLQVJNN.mjs} +11 -11
- package/dist/{refund-reason-create-JMKZM3LY.mjs → refund-reason-create-EXAC2PMO.mjs} +11 -11
- package/dist/{refund-reason-edit-LLV7BPPK.mjs → refund-reason-edit-NEXHR2RT.mjs} +11 -11
- package/dist/{refund-reason-list-XBM3PY2R.mjs → refund-reason-list-2IXZQWFF.mjs} +11 -11
- package/dist/{region-metadata-B5DLN22C.mjs → region-metadata-VO2S34JP.mjs} +11 -11
- package/dist/{reservation-create-ZCIYM6JI.mjs → reservation-create-M3NKBTYW.mjs} +3 -3
- package/dist/{reservation-detail-VFJZZRU7.mjs → reservation-detail-VQJLWDL3.mjs} +11 -11
- package/dist/{reservation-list-B47DXTA7.mjs → reservation-list-HSF22GFZ.mjs} +3 -3
- package/dist/{reservation-metadata-DU7TSG7U.mjs → reservation-metadata-RRGKR7AK.mjs} +11 -11
- package/dist/{sales-channel-add-products-57FJF7LP.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-DVQG5CWO.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-HQTYWKUZ.mjs → sales-channel-list-JK7HQZM5.mjs} +11 -11
- package/dist/{sales-channel-metadata-5BJ5FN72.mjs → sales-channel-metadata-ZSXMTQ6L.mjs} +11 -11
- package/dist/{shipping-option-type-create-KGSZ2MIC.mjs → shipping-option-type-create-YLAEM4M6.mjs} +11 -11
- package/dist/{shipping-option-type-detail-E6RFFCCZ.mjs → shipping-option-type-detail-33A6BZMB.mjs} +12 -12
- package/dist/{shipping-option-type-edit-NNM3RIQM.mjs → shipping-option-type-edit-WBGIOJ3L.mjs} +11 -11
- package/dist/{shipping-option-type-list-SZ4H3JDR.mjs → shipping-option-type-list-SYE2CFWK.mjs} +12 -12
- package/dist/{shipping-profile-metadata-56R3BQBM.mjs → shipping-profile-metadata-6CIPN25L.mjs} +11 -11
- package/dist/{store-add-locales-JLTQ6KAT.mjs → store-add-locales-K5OOQ25D.mjs} +12 -12
- package/dist/{store-detail-UIQQ23G2.mjs → store-detail-RVGISZXQ.mjs} +11 -11
- package/dist/{store-metadata-VSUVJKUH.mjs → store-metadata-HPGZG23A.mjs} +11 -11
- package/dist/{tax-region-create-LGEZ5PJZ.mjs → tax-region-create-EOT7GTKU.mjs} +11 -11
- package/dist/{tax-region-detail-WPRAFQGO.mjs → tax-region-detail-E5ZNBHJY.mjs} +16 -16
- package/dist/{tax-region-edit-ECFWKLNO.mjs → tax-region-edit-5IM2XJZP.mjs} +11 -11
- package/dist/{tax-region-province-detail-NNF7XFKI.mjs → tax-region-province-detail-MNNQWTQ7.mjs} +16 -16
- package/dist/{tax-region-tax-override-create-76RQ5RAE.mjs → tax-region-tax-override-create-EYESRMIT.mjs} +14 -14
- package/dist/{tax-region-tax-override-edit-FHLGTVBO.mjs → tax-region-tax-override-edit-ULQESLZ2.mjs} +15 -15
- package/dist/{translation-list-4GJHDNW2.mjs → translation-list-GFZVEND6.mjs} +11 -11
- package/dist/{translations-edit-HD5GST33.mjs → translations-edit-YZ26SQEB.mjs} +17 -22
- package/dist/{user-detail-BJUXLZZQ.mjs → user-detail-3IEU4KU4.mjs} +2 -2
- package/dist/{user-metadata-AEKW7SMX.mjs → user-metadata-7P4OECLX.mjs} +11 -11
- package/dist/{workflow-execution-detail-KIP5L3OB.mjs → workflow-execution-detail-EAN7OEWP.mjs} +11 -11
- package/package.json +9 -9
- package/src/hooks/api/translations.tsx +64 -187
- 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,11 +175,6 @@ export const useTranslationSettings = (
|
|
|
293
175
|
return { ...data, ...rest }
|
|
294
176
|
}
|
|
295
177
|
|
|
296
|
-
const TRANSLATION_ENTITIES_QUERY_KEY = "translation_entities" as const
|
|
297
|
-
export const translationEntitiesQueryKeys = queryKeysFactory(
|
|
298
|
-
TRANSLATION_ENTITIES_QUERY_KEY
|
|
299
|
-
)
|
|
300
|
-
|
|
301
178
|
export const useTranslationEntities = (
|
|
302
179
|
query: HttpTypes.AdminTranslationEntitiesParams,
|
|
303
180
|
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
|
-
};
|