@medusajs/dashboard 3.0.0-snapshot-20251215083939 → 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/{api-key-management-detail-7T6OT2S2.mjs → api-key-management-detail-NRGL7HHX.mjs} +1 -1
- package/dist/app.js +144 -155
- package/dist/app.mjs +2 -2
- package/dist/{campaign-detail-RT3BIGQA.mjs → campaign-detail-22Q6XWGL.mjs} +1 -1
- package/dist/{categories-metadata-QHA62GA3.mjs → categories-metadata-J7M3XWI7.mjs} +1 -1
- package/dist/{category-detail-TDB4GR5S.mjs → category-detail-RRKJPMEG.mjs} +2 -2
- package/dist/{category-products-KRSKJDWS.mjs → category-products-EFZRTCSF.mjs} +2 -2
- package/dist/{chunk-WJKYXU6P.mjs → chunk-DK7IWUMK.mjs} +1 -1
- package/dist/{chunk-7ESWXA2P.mjs → chunk-GRZSG4EP.mjs} +31 -9
- package/dist/{chunk-7ZJK3NWL.mjs → chunk-OHY2N2Q4.mjs} +2 -2
- package/dist/{chunk-QCRM6BTM.mjs → chunk-PHLCT2HA.mjs} +1 -1
- package/dist/{chunk-6EFHOMPL.mjs → chunk-RL5EYTP6.mjs} +1 -1
- package/dist/{chunk-P5TFUYGS.mjs → chunk-YTYDWNYA.mjs} +98 -98
- package/dist/{chunk-SKA4MWCK.mjs → chunk-YYOPBKME.mjs} +1 -1
- package/dist/{chunk-QBDKK5O4.mjs → chunk-ZMG5B4FG.mjs} +1 -1
- package/dist/{collection-add-products-4RJKJ7XJ.mjs → collection-add-products-XUMV6XR7.mjs} +2 -2
- package/dist/{collection-detail-IR23ZT2F.mjs → collection-detail-ONRBKJLN.mjs} +2 -2
- package/dist/{collection-list-J4OTLQQL.mjs → collection-list-XCC4SIPJ.mjs} +2 -2
- package/dist/{collection-metadata-6XWOWMBN.mjs → collection-metadata-QK7MI3D2.mjs} +1 -1
- package/dist/{customer-detail-ZHU4NN7E.mjs → customer-detail-FR6J37ZC.mjs} +1 -1
- package/dist/{customer-group-detail-NGJXBGGG.mjs → customer-group-detail-YSKSNETG.mjs} +1 -1
- package/dist/{customer-group-list-YLAMT3ZQ.mjs → customer-group-list-XBCD4FZH.mjs} +1 -1
- package/dist/{customers-add-customer-group-A2EPZW26.mjs → customers-add-customer-group-Q7FMR2Y5.mjs} +1 -1
- package/dist/{edit-rules-4UN6YMCZ.mjs → edit-rules-SMVRTCUP.mjs} +1 -1
- package/dist/{inventory-create-UB3TTWPQ.mjs → inventory-create-3XONKYMZ.mjs} +1 -1
- package/dist/{inventory-detail-FIC7BFZ7.mjs → inventory-detail-6A6GOLB6.mjs} +1 -1
- package/dist/{inventory-metadata-WP73FZBX.mjs → inventory-metadata-FNEJ3RAT.mjs} +1 -1
- package/dist/{inventory-stock-RR4F6HGF.mjs → inventory-stock-S3ZYYCMZ.mjs} +1 -1
- package/dist/{location-detail-MLYCXNYR.mjs → location-detail-N3GUZSY7.mjs} +1 -1
- package/dist/{location-fulfillment-providers-CAAUD5VG.mjs → location-fulfillment-providers-WM6DT252.mjs} +2 -2
- package/dist/{location-service-zone-shipping-option-create-HHEGEBVB.mjs → location-service-zone-shipping-option-create-MJPH3WKX.mjs} +1 -1
- package/dist/{login-C7GZL37K.mjs → login-VNOLI5YG.mjs} +1 -1
- package/dist/{order-create-claim-2RQ4SFKM.mjs → order-create-claim-GUYTLVPB.mjs} +1 -1
- package/dist/{order-create-edit-JL7FWVNC.mjs → order-create-edit-ODIN6GRW.mjs} +1 -1
- package/dist/{order-create-exchange-7EPUMDFZ.mjs → order-create-exchange-ZT5RBRKL.mjs} +1 -1
- package/dist/{order-create-fulfillment-5PUUSLCV.mjs → order-create-fulfillment-OWUVTZXW.mjs} +1 -1
- package/dist/{order-create-refund-3NYCD4UR.mjs → order-create-refund-Q6HQY42R.mjs} +1 -1
- package/dist/{order-create-shipment-PWT3BPP6.mjs → order-create-shipment-WAGGEPRW.mjs} +1 -1
- package/dist/{order-detail-CN7VCKHF.mjs → order-detail-HFJONELJ.mjs} +1 -1
- package/dist/{order-edit-billing-address-PLAKMBVH.mjs → order-edit-billing-address-UM76J4KX.mjs} +1 -1
- package/dist/{order-edit-email-UAP26F5X.mjs → order-edit-email-CL3KNOCM.mjs} +1 -1
- package/dist/{order-edit-shipping-address-HAC7UQZS.mjs → order-edit-shipping-address-PIESTGVL.mjs} +1 -1
- package/dist/{order-export-ZI4QK6OQ.mjs → order-export-4MZUPMGD.mjs} +1 -1
- package/dist/{order-metadata-VQJWKPQC.mjs → order-metadata-FHBB7MTG.mjs} +1 -1
- package/dist/{order-receive-return-VTHRRRAB.mjs → order-receive-return-PRVKP6J2.mjs} +1 -1
- package/dist/{order-request-transfer-MCWICULW.mjs → order-request-transfer-XSAGRUMT.mjs} +1 -1
- package/dist/{price-list-create-KF4BTDBF.mjs → price-list-create-YHXRQSC3.mjs} +2 -2
- package/dist/{price-list-detail-UHJWBRBT.mjs → price-list-detail-FR3FQR3H.mjs} +2 -2
- package/dist/{price-list-prices-add-YHPWWETC.mjs → price-list-prices-add-GJVI47OY.mjs} +2 -2
- package/dist/{product-attributes-CCRPVPA3.mjs → product-attributes-TKCE2M63.mjs} +2 -2
- package/dist/{product-create-TIJWWJEC.mjs → product-create-OLDZPMLW.mjs} +2 -2
- package/dist/{product-create-variant-EBVDKJA2.mjs → product-create-variant-KEBN5OR7.mjs} +1 -1
- package/dist/{product-detail-MFRDWD74.mjs → product-detail-O6QWJIKR.mjs} +2 -2
- package/dist/{product-edit-VRUDQ3JT.mjs → product-edit-56XDGDUN.mjs} +2 -2
- package/dist/{product-export-DZKMXMUX.mjs → product-export-WUZYHPS5.mjs} +2 -2
- package/dist/{product-image-variants-edit-NN76FX7Y.mjs → product-image-variants-edit-Y363J5NG.mjs} +1 -1
- package/dist/{product-import-24JJ73RO.mjs → product-import-V3KQN4TV.mjs} +1 -1
- package/dist/{product-list-YMCK3X7X.mjs → product-list-DNTS7WUN.mjs} +2 -2
- package/dist/{product-metadata-KFBUYD7A.mjs → product-metadata-GL2MVPDI.mjs} +1 -1
- package/dist/{product-organization-BYRWH4KK.mjs → product-organization-PNKWRNHC.mjs} +2 -2
- package/dist/{product-stock-YEHDIJQI.mjs → product-stock-NYUFMEVG.mjs} +1 -1
- package/dist/{product-tag-create-BPU54Y3F.mjs → product-tag-create-PQMDDKWH.mjs} +1 -1
- package/dist/{product-tag-detail-SYQWG3AL.mjs → product-tag-detail-EHBB3WUB.mjs} +3 -3
- package/dist/{product-tag-edit-5XEMIUW6.mjs → product-tag-edit-K3BBQLJR.mjs} +1 -1
- package/dist/{product-tag-list-7SQNKPJQ.mjs → product-tag-list-LSW5FFVN.mjs} +3 -3
- package/dist/{product-tag-metadata-ZB56PD4G.mjs → product-tag-metadata-MJH5LH7E.mjs} +1 -1
- package/dist/{product-type-detail-RMYDLMPI.mjs → product-type-detail-3VB6AWUW.mjs} +2 -2
- package/dist/{product-type-metadata-UKF26V3N.mjs → product-type-metadata-CDJDFFGQ.mjs} +1 -1
- package/dist/{product-variant-detail-56MJKJZQ.mjs → product-variant-detail-43T33AQP.mjs} +1 -1
- package/dist/{product-variant-edit-PVZNSIIQ.mjs → product-variant-edit-DEZEY2H2.mjs} +1 -1
- package/dist/{product-variant-metadata-PNFRS7SQ.mjs → product-variant-metadata-VTZDNWUT.mjs} +1 -1
- package/dist/{promotion-create-RGLB6D7K.mjs → promotion-create-HWFNUQXG.mjs} +1 -1
- package/dist/{promotion-detail-MCCRIT2M.mjs → promotion-detail-VJB55PJK.mjs} +1 -1
- package/dist/{refund-reason-create-JYY2USGC.mjs → refund-reason-create-YHCDEHGQ.mjs} +1 -1
- package/dist/{refund-reason-edit-5NFS4TQ7.mjs → refund-reason-edit-CZ5QZ2SZ.mjs} +1 -1
- package/dist/{refund-reason-list-SDLJWAV3.mjs → refund-reason-list-URYYYEK6.mjs} +1 -1
- package/dist/{region-metadata-YBOCBHWP.mjs → region-metadata-H6XXUQ4S.mjs} +1 -1
- package/dist/{reservation-detail-7MXAMP3C.mjs → reservation-detail-LZAQL4XA.mjs} +1 -1
- package/dist/{reservation-metadata-6NZUP64D.mjs → reservation-metadata-5HZSDDOK.mjs} +1 -1
- package/dist/{sales-channel-add-products-BELGXDPF.mjs → sales-channel-add-products-VH5T3GDA.mjs} +2 -2
- package/dist/{sales-channel-detail-FAGKAQK2.mjs → sales-channel-detail-I2ZHVXMG.mjs} +2 -2
- package/dist/{sales-channel-list-E5QO23E5.mjs → sales-channel-list-3FV4S2NN.mjs} +1 -1
- package/dist/{sales-channel-metadata-AXAQY4MY.mjs → sales-channel-metadata-M364R4RJ.mjs} +1 -1
- package/dist/{shipping-option-type-create-YTBF47L7.mjs → shipping-option-type-create-C5WUWON7.mjs} +1 -1
- package/dist/{shipping-option-type-detail-XJFVNP2V.mjs → shipping-option-type-detail-PENS2K73.mjs} +2 -2
- package/dist/{shipping-option-type-edit-DFXO32AG.mjs → shipping-option-type-edit-CIU5EHRP.mjs} +1 -1
- package/dist/{shipping-option-type-list-UI7ZTCO7.mjs → shipping-option-type-list-ZMZMXFME.mjs} +2 -2
- package/dist/{shipping-profile-metadata-FGZRQKNN.mjs → shipping-profile-metadata-75G2NNMA.mjs} +1 -1
- package/dist/{store-add-locales-3MSEBHQG.mjs → store-add-locales-IZOZP5C6.mjs} +1 -1
- package/dist/{store-detail-MLYFQGBC.mjs → store-detail-4IBAEVSD.mjs} +1 -1
- package/dist/{store-metadata-ITA6AL6H.mjs → store-metadata-CYXTVJUE.mjs} +1 -1
- package/dist/{tax-region-create-AXM2SE4T.mjs → tax-region-create-DWGL4EUT.mjs} +1 -1
- package/dist/{tax-region-detail-WFXSRH3U.mjs → tax-region-detail-O2T7BI3V.mjs} +5 -5
- package/dist/{tax-region-edit-CZ4EDU4K.mjs → tax-region-edit-EEVEEU2Q.mjs} +1 -1
- package/dist/{tax-region-province-detail-4B5GWCY7.mjs → tax-region-province-detail-2W7RXAM5.mjs} +5 -5
- package/dist/{tax-region-tax-override-create-GDDSUSHK.mjs → tax-region-tax-override-create-7IM4ZVPH.mjs} +3 -3
- package/dist/{tax-region-tax-override-edit-QXCSGDVG.mjs → tax-region-tax-override-edit-3ZT5IZYR.mjs} +4 -4
- package/dist/{translation-list-S4477JFR.mjs → translation-list-AFK5MGSH.mjs} +56 -68
- package/dist/{translations-edit-S3V7SSDA.mjs → translations-edit-EN47PWTO.mjs} +24 -26
- package/dist/{user-metadata-SILGZHTG.mjs → user-metadata-2WPJOEJA.mjs} +1 -1
- package/dist/{workflow-execution-detail-GJTST4GO.mjs → workflow-execution-detail-H2AKEZJX.mjs} +1 -1
- package/package.json +9 -9
- package/src/hooks/api/translations.tsx +61 -31
- 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 +4 -2
- package/src/routes/translations/translations-edit/translations-edit.tsx +27 -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
|
@@ -7,7 +7,10 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
TwoColumnPageSkeleton
|
|
9
9
|
} from "./chunk-LPEUYMRK.mjs";
|
|
10
|
-
import
|
|
10
|
+
import {
|
|
11
|
+
useTranslationSettings,
|
|
12
|
+
useTranslationStatistics
|
|
13
|
+
} from "./chunk-GRZSG4EP.mjs";
|
|
11
14
|
import "./chunk-I4OBEAOJ.mjs";
|
|
12
15
|
import "./chunk-HI6URQ7H.mjs";
|
|
13
16
|
import "./chunk-6CLQKVAU.mjs";
|
|
@@ -45,7 +48,6 @@ import "./chunk-QZ7TP4HQ.mjs";
|
|
|
45
48
|
// src/routes/translations/translation-list/translation-list.tsx
|
|
46
49
|
import { Container as Container4, Heading as Heading3, Text as Text4 } from "@medusajs/ui";
|
|
47
50
|
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
48
|
-
import { Buildings } from "@medusajs/icons";
|
|
49
51
|
|
|
50
52
|
// src/routes/translations/translation-list/components/active-locales-section/active-locales-section.tsx
|
|
51
53
|
import { PencilSquare, Language } from "@medusajs/icons";
|
|
@@ -124,10 +126,16 @@ import { Container as Container3, Heading as Heading2, Text as Text3 } from "@me
|
|
|
124
126
|
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
125
127
|
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
126
128
|
var TranslationsCompletionSection = ({
|
|
127
|
-
|
|
128
|
-
totalCount = 0
|
|
129
|
+
statistics
|
|
129
130
|
}) => {
|
|
130
131
|
const { t } = useTranslation2();
|
|
132
|
+
const { translatedCount, totalCount } = Object.values(statistics).reduce(
|
|
133
|
+
(acc, curr) => ({
|
|
134
|
+
translatedCount: acc.translatedCount + curr.translated,
|
|
135
|
+
totalCount: acc.totalCount + curr.expected
|
|
136
|
+
}),
|
|
137
|
+
{ totalCount: 0, translatedCount: 0 }
|
|
138
|
+
);
|
|
131
139
|
const percentage = totalCount > 0 ? translatedCount / totalCount * 100 : 0;
|
|
132
140
|
const remaining = Math.max(0, totalCount - translatedCount);
|
|
133
141
|
return /* @__PURE__ */ jsxs3(Container3, { className: "flex flex-col gap-y-3 px-6 py-4", children: [
|
|
@@ -187,76 +195,56 @@ var TranslationsCompletionSection = ({
|
|
|
187
195
|
};
|
|
188
196
|
|
|
189
197
|
// src/routes/translations/translation-list/translation-list.tsx
|
|
198
|
+
import { useMemo } from "react";
|
|
190
199
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
191
|
-
var TRANSLATABLE_ENTITIES = [
|
|
192
|
-
{
|
|
193
|
-
icon: /* @__PURE__ */ jsx4(Buildings, {}),
|
|
194
|
-
label: "Product",
|
|
195
|
-
reference: "product",
|
|
196
|
-
translatedCount: 4,
|
|
197
|
-
totalCount: 96
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
icon: /* @__PURE__ */ jsx4(Buildings, {}),
|
|
201
|
-
label: "Product Variants",
|
|
202
|
-
reference: "product_variant",
|
|
203
|
-
translatedCount: 4,
|
|
204
|
-
totalCount: 2e5
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
icon: /* @__PURE__ */ jsx4(Buildings, {}),
|
|
208
|
-
label: "Product Categories",
|
|
209
|
-
reference: "product_category",
|
|
210
|
-
translatedCount: 96,
|
|
211
|
-
totalCount: 96
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
icon: /* @__PURE__ */ jsx4(Buildings, {}),
|
|
215
|
-
label: "Product Collections",
|
|
216
|
-
reference: "product_collection",
|
|
217
|
-
translatedCount: 4,
|
|
218
|
-
totalCount: 96
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
icon: /* @__PURE__ */ jsx4(Buildings, {}),
|
|
222
|
-
label: "Product Types",
|
|
223
|
-
reference: "product_type",
|
|
224
|
-
translatedCount: 4,
|
|
225
|
-
totalCount: 96
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
icon: /* @__PURE__ */ jsx4(Buildings, {}),
|
|
229
|
-
label: "Product Tags",
|
|
230
|
-
reference: "product_tag",
|
|
231
|
-
translatedCount: 96,
|
|
232
|
-
totalCount: 96
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
icon: /* @__PURE__ */ jsx4(Buildings, {}),
|
|
236
|
-
label: "Product Options",
|
|
237
|
-
reference: "product_option",
|
|
238
|
-
translatedCount: 96,
|
|
239
|
-
totalCount: 96
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
icon: /* @__PURE__ */ jsx4(Buildings, {}),
|
|
243
|
-
label: "Product Option Values",
|
|
244
|
-
reference: "product_option_value",
|
|
245
|
-
translatedCount: 96,
|
|
246
|
-
totalCount: 96
|
|
247
|
-
}
|
|
248
|
-
];
|
|
249
200
|
var TranslationList = () => {
|
|
250
201
|
const { t } = useTranslation3();
|
|
251
202
|
const { store, isPending, isError, error } = useStore();
|
|
252
|
-
|
|
253
|
-
|
|
203
|
+
const {
|
|
204
|
+
translatable_fields,
|
|
205
|
+
isPending: isTranslationSettingsPending,
|
|
206
|
+
isError: isTranslationSettingsError,
|
|
207
|
+
error: translationSettingsError
|
|
208
|
+
} = useTranslationSettings();
|
|
209
|
+
const {
|
|
210
|
+
statistics,
|
|
211
|
+
isPending: isTranslationStatisticsPending,
|
|
212
|
+
isError: isTranslationStatisticsError,
|
|
213
|
+
error: translationStatisticsError
|
|
214
|
+
} = useTranslationStatistics(
|
|
215
|
+
{
|
|
216
|
+
locales: store?.supported_locales?.map(
|
|
217
|
+
(suportedLocale) => suportedLocale.locale_code
|
|
218
|
+
) ?? [],
|
|
219
|
+
entity_types: Object.keys(translatable_fields ?? {})
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
enabled: !!translatable_fields && !!store
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
if (isError || isTranslationSettingsError || isTranslationStatisticsError) {
|
|
226
|
+
throw error || translationSettingsError || translationStatisticsError;
|
|
254
227
|
}
|
|
255
|
-
const
|
|
228
|
+
const hasLocales = (store?.supported_locales ?? []).length > 0;
|
|
229
|
+
const translatableEntities = useMemo(() => {
|
|
230
|
+
if (!translatable_fields || !statistics) {
|
|
231
|
+
return [];
|
|
232
|
+
}
|
|
233
|
+
return Object.entries(translatable_fields).map(([entity, fields]) => {
|
|
234
|
+
const entityStatistics = statistics[entity];
|
|
235
|
+
return {
|
|
236
|
+
label: entity.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" "),
|
|
237
|
+
reference: entity,
|
|
238
|
+
translatableFields: fields,
|
|
239
|
+
translatedCount: entityStatistics.translated,
|
|
240
|
+
totalCount: entityStatistics.expected
|
|
241
|
+
};
|
|
242
|
+
});
|
|
243
|
+
}, [translatable_fields, statistics]);
|
|
244
|
+
const isReady = !!store && !isPending && !isTranslationSettingsPending && !isTranslationStatisticsPending && !!translatable_fields && !!statistics;
|
|
256
245
|
if (!isReady) {
|
|
257
246
|
return /* @__PURE__ */ jsx4(TwoColumnPageSkeleton, { sidebarSections: 2 });
|
|
258
247
|
}
|
|
259
|
-
const hasLocales = (store?.supported_locales ?? []).length > 0;
|
|
260
248
|
return /* @__PURE__ */ jsxs4(
|
|
261
249
|
TwoColumnPage,
|
|
262
250
|
{
|
|
@@ -278,7 +266,7 @@ var TranslationList = () => {
|
|
|
278
266
|
/* @__PURE__ */ jsx4(
|
|
279
267
|
TranslationListSection,
|
|
280
268
|
{
|
|
281
|
-
entities:
|
|
269
|
+
entities: translatableEntities,
|
|
282
270
|
hasLocales
|
|
283
271
|
}
|
|
284
272
|
)
|
|
@@ -292,7 +280,7 @@ var TranslationList = () => {
|
|
|
292
280
|
) ?? []
|
|
293
281
|
}
|
|
294
282
|
),
|
|
295
|
-
/* @__PURE__ */ jsx4(TranslationsCompletionSection, {})
|
|
283
|
+
statistics && /* @__PURE__ */ jsx4(TranslationsCompletionSection, { statistics })
|
|
296
284
|
] })
|
|
297
285
|
]
|
|
298
286
|
}
|
|
@@ -23,8 +23,9 @@ import {
|
|
|
23
23
|
import "./chunk-OBQI23QM.mjs";
|
|
24
24
|
import {
|
|
25
25
|
useBatchTranslations,
|
|
26
|
-
useReferenceTranslations
|
|
27
|
-
|
|
26
|
+
useReferenceTranslations,
|
|
27
|
+
useTranslationSettings
|
|
28
|
+
} from "./chunk-GRZSG4EP.mjs";
|
|
28
29
|
import "./chunk-I4OBEAOJ.mjs";
|
|
29
30
|
import "./chunk-HI6URQ7H.mjs";
|
|
30
31
|
import "./chunk-6CLQKVAU.mjs";
|
|
@@ -69,20 +70,6 @@ import { useMemo, useRef } from "react";
|
|
|
69
70
|
import { useForm } from "react-hook-form";
|
|
70
71
|
import { useTranslation } from "react-i18next";
|
|
71
72
|
import { z } from "zod";
|
|
72
|
-
|
|
73
|
-
// src/routes/translations/translations-edit/utils/reference-label-map.ts
|
|
74
|
-
var REFERENCE_LABEL_MAP = {
|
|
75
|
-
product: "Products",
|
|
76
|
-
product_variant: "Product Variants",
|
|
77
|
-
product_category: "Product Categories",
|
|
78
|
-
product_collection: "Product Collections",
|
|
79
|
-
product_type: "Product Types",
|
|
80
|
-
product_tag: "Product Tags",
|
|
81
|
-
product_option: "Product Options",
|
|
82
|
-
product_option_value: "Product Option Values"
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// src/routes/translations/translations-edit/components/translations-edit-form/translations-edit-form.tsx
|
|
86
73
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
87
74
|
var LocaleTranslationSchema = z.object({
|
|
88
75
|
id: z.string().nullish(),
|
|
@@ -361,7 +348,7 @@ var TranslationsEditForm = ({
|
|
|
361
348
|
defaultValue: entityType,
|
|
362
349
|
className: "flex h-full flex-col overflow-hidden",
|
|
363
350
|
children: [
|
|
364
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Header, { children: /* @__PURE__ */ jsx("div", { className: "-my-2 w-full border-l", children: /* @__PURE__ */ jsx(ProgressTabs.List, { className: "justify-start-start flex w-full items-center", children: /* @__PURE__ */ jsx(ProgressTabs.Trigger, { value: entityType, children:
|
|
351
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Header, { children: /* @__PURE__ */ jsx("div", { className: "-my-2 w-full border-l", children: /* @__PURE__ */ jsx(ProgressTabs.List, { className: "justify-start-start flex w-full items-center", children: /* @__PURE__ */ jsx(ProgressTabs.Trigger, { value: entityType, children: entityType.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ") }) }) }) }),
|
|
365
352
|
/* @__PURE__ */ jsx(RouteFocusModal.Body, { className: "size-full overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
366
353
|
ProgressTabs.Content,
|
|
367
354
|
{
|
|
@@ -412,10 +399,15 @@ var TranslationsEdit = () => {
|
|
|
412
399
|
return;
|
|
413
400
|
}
|
|
414
401
|
}, [reference, navigate, isTranslationsEnabled]);
|
|
402
|
+
const {
|
|
403
|
+
translatable_fields,
|
|
404
|
+
isPending: isTranslationSettingsPending,
|
|
405
|
+
isError: isTranslationSettingsError,
|
|
406
|
+
error: translationSettingsError
|
|
407
|
+
} = useTranslationSettings({ entity_type: reference });
|
|
415
408
|
const {
|
|
416
409
|
translations,
|
|
417
410
|
references,
|
|
418
|
-
translatableFields,
|
|
419
411
|
fetchNextPage,
|
|
420
412
|
count,
|
|
421
413
|
isFetchingNextPage,
|
|
@@ -423,18 +415,24 @@ var TranslationsEdit = () => {
|
|
|
423
415
|
isPending,
|
|
424
416
|
isError,
|
|
425
417
|
error
|
|
426
|
-
} = useReferenceTranslations(
|
|
427
|
-
|
|
428
|
-
|
|
418
|
+
} = useReferenceTranslations(
|
|
419
|
+
reference,
|
|
420
|
+
translatable_fields?.[reference] ?? [],
|
|
421
|
+
referenceIdParam,
|
|
422
|
+
{
|
|
423
|
+
enabled: !!translatable_fields && !!reference,
|
|
424
|
+
placeholderData: keepPreviousData
|
|
425
|
+
}
|
|
426
|
+
);
|
|
429
427
|
const {
|
|
430
428
|
store,
|
|
431
429
|
isPending: isStorePending,
|
|
432
430
|
isError: isStoreError,
|
|
433
431
|
error: storeError
|
|
434
432
|
} = useStore();
|
|
435
|
-
const ready = !isPending && !!translations && !!
|
|
436
|
-
if (isError || isStoreError) {
|
|
437
|
-
throw error || storeError;
|
|
433
|
+
const ready = !isPending && !!translations && !!translatable_fields && !isTranslationSettingsPending && !!references && !isStorePending && !!store;
|
|
434
|
+
if (isError || isStoreError || isTranslationSettingsError) {
|
|
435
|
+
throw error || storeError || translationSettingsError;
|
|
438
436
|
}
|
|
439
437
|
return /* @__PURE__ */ jsx2(RouteFocusModal, { prev: referenceIdParam.length ? -1 : "..", children: ready && /* @__PURE__ */ jsx2(
|
|
440
438
|
TranslationsEditForm,
|
|
@@ -443,8 +441,8 @@ var TranslationsEdit = () => {
|
|
|
443
441
|
references,
|
|
444
442
|
entityType: reference,
|
|
445
443
|
availableLocales: store?.supported_locales ?? [],
|
|
446
|
-
translatableFields,
|
|
447
|
-
modalFields:
|
|
444
|
+
translatableFields: translatable_fields[reference],
|
|
445
|
+
modalFields: translatable_fields[reference],
|
|
448
446
|
fetchNextPage,
|
|
449
447
|
hasNextPage,
|
|
450
448
|
isFetchingNextPage,
|
|
@@ -12,7 +12,7 @@ import "./chunk-LPEUYMRK.mjs";
|
|
|
12
12
|
import "./chunk-OC7BQLYI.mjs";
|
|
13
13
|
import "./chunk-S4DMV3ZT.mjs";
|
|
14
14
|
import "./chunk-OBQI23QM.mjs";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-GRZSG4EP.mjs";
|
|
16
16
|
import "./chunk-I4OBEAOJ.mjs";
|
|
17
17
|
import "./chunk-HI6URQ7H.mjs";
|
|
18
18
|
import "./chunk-6CLQKVAU.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/dashboard",
|
|
3
|
-
"version": "3.0.0-snapshot-
|
|
3
|
+
"version": "3.0.0-snapshot-20251215162333",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"generate:static": "node ./scripts/generate-currencies.js && prettier --write ./src/lib/currencies.ts",
|
|
6
6
|
"dev": "../../../node_modules/.bin/vite",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"@dnd-kit/utilities": "^3.2.2",
|
|
47
47
|
"@hookform/error-message": "^2.0.1",
|
|
48
48
|
"@hookform/resolvers": "3.4.2",
|
|
49
|
-
"@medusajs/admin-shared": "3.0.0-snapshot-
|
|
50
|
-
"@medusajs/icons": "3.0.0-snapshot-
|
|
51
|
-
"@medusajs/js-sdk": "3.0.0-snapshot-
|
|
52
|
-
"@medusajs/ui": "4.0.31-snapshot-
|
|
49
|
+
"@medusajs/admin-shared": "3.0.0-snapshot-20251215162333",
|
|
50
|
+
"@medusajs/icons": "3.0.0-snapshot-20251215162333",
|
|
51
|
+
"@medusajs/js-sdk": "3.0.0-snapshot-20251215162333",
|
|
52
|
+
"@medusajs/ui": "4.0.31-snapshot-20251215162333",
|
|
53
53
|
"@radix-ui/react-dialog": "1.1.4",
|
|
54
54
|
"@radix-ui/react-dismissable-layer": "1.1.4",
|
|
55
55
|
"@tanstack/react-query": "5.64.2",
|
|
@@ -80,10 +80,10 @@
|
|
|
80
80
|
"zod": "3.25.76"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@medusajs/admin-shared": "3.0.0-snapshot-
|
|
84
|
-
"@medusajs/admin-vite-plugin": "3.0.0-snapshot-
|
|
85
|
-
"@medusajs/types": "3.0.0-snapshot-
|
|
86
|
-
"@medusajs/ui-preset": "3.0.0-snapshot-
|
|
83
|
+
"@medusajs/admin-shared": "3.0.0-snapshot-20251215162333",
|
|
84
|
+
"@medusajs/admin-vite-plugin": "3.0.0-snapshot-20251215162333",
|
|
85
|
+
"@medusajs/types": "3.0.0-snapshot-20251215162333",
|
|
86
|
+
"@medusajs/ui-preset": "3.0.0-snapshot-20251215162333"
|
|
87
87
|
},
|
|
88
88
|
"packageManager": "yarn@3.2.1"
|
|
89
89
|
}
|
|
@@ -8,43 +8,36 @@ import {
|
|
|
8
8
|
UseMutationOptions,
|
|
9
9
|
useQuery,
|
|
10
10
|
UseQueryOptions,
|
|
11
|
-
UseQueryResult,
|
|
12
11
|
} from "@tanstack/react-query"
|
|
13
12
|
import { sdk } from "../../lib/client"
|
|
14
13
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
|
15
14
|
import { queryClient } from "../../lib/query-client"
|
|
16
|
-
import { productsQueryKeys, useInfiniteProducts
|
|
15
|
+
import { productsQueryKeys, useInfiniteProducts } from "./products"
|
|
17
16
|
import {
|
|
18
17
|
productVariantQueryKeys,
|
|
19
18
|
useInfiniteVariants,
|
|
20
|
-
useVariants,
|
|
21
19
|
} from "./product-variants"
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} from "./categories"
|
|
27
|
-
import {
|
|
28
|
-
collectionsQueryKeys,
|
|
29
|
-
useCollections,
|
|
30
|
-
useInfiniteCollections,
|
|
31
|
-
} from "./collections"
|
|
32
|
-
import {
|
|
33
|
-
productTagsQueryKeys,
|
|
34
|
-
useInfiniteProductTags,
|
|
35
|
-
useProductTags,
|
|
36
|
-
} from "./tags"
|
|
37
|
-
import {
|
|
38
|
-
productTypesQueryKeys,
|
|
39
|
-
useInfiniteProductTypes,
|
|
40
|
-
useProductTypes,
|
|
41
|
-
} from "./product-types"
|
|
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"
|
|
42
24
|
|
|
43
25
|
const TRANSLATIONS_QUERY_KEY = "translations" as const
|
|
44
26
|
export const translationsQueryKeys = queryKeysFactory(TRANSLATIONS_QUERY_KEY)
|
|
45
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
|
+
|
|
46
38
|
export const useReferenceTranslations = (
|
|
47
39
|
reference: string,
|
|
40
|
+
translatableFields: string[],
|
|
48
41
|
referenceId?: string | string[],
|
|
49
42
|
options?: Omit<
|
|
50
43
|
UseInfiniteQueryOptions<any, FetchError, any, any, QueryKey, number>,
|
|
@@ -57,7 +50,6 @@ export const useReferenceTranslations = (
|
|
|
57
50
|
data: {
|
|
58
51
|
translations: HttpTypes.AdminTranslation[]
|
|
59
52
|
references: (Record<string, any> & { id: string })[]
|
|
60
|
-
translatableFields: string[]
|
|
61
53
|
count: number
|
|
62
54
|
}
|
|
63
55
|
}
|
|
@@ -65,7 +57,6 @@ export const useReferenceTranslations = (
|
|
|
65
57
|
[
|
|
66
58
|
"product",
|
|
67
59
|
() => {
|
|
68
|
-
const translatableFields = ["title", "description"]
|
|
69
60
|
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
70
61
|
|
|
71
62
|
const { data, ...rest } = useInfiniteProducts(
|
|
@@ -80,7 +71,6 @@ export const useReferenceTranslations = (
|
|
|
80
71
|
translations:
|
|
81
72
|
products?.flatMap((product) => product.translations ?? []) ?? [],
|
|
82
73
|
references: products ?? [],
|
|
83
|
-
translatableFields,
|
|
84
74
|
count: data?.pages[0]?.count ?? 0,
|
|
85
75
|
},
|
|
86
76
|
}
|
|
@@ -89,7 +79,6 @@ export const useReferenceTranslations = (
|
|
|
89
79
|
[
|
|
90
80
|
"product_variant",
|
|
91
81
|
() => {
|
|
92
|
-
const translatableFields = ["title"]
|
|
93
82
|
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
94
83
|
|
|
95
84
|
const { data, ...rest } = useInfiniteVariants(
|
|
@@ -113,7 +102,6 @@ export const useReferenceTranslations = (
|
|
|
113
102
|
[
|
|
114
103
|
"product_category",
|
|
115
104
|
() => {
|
|
116
|
-
const translatableFields = ["name", "description"]
|
|
117
105
|
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
118
106
|
|
|
119
107
|
const { data, ...rest } = useInfiniteCategories(
|
|
@@ -139,7 +127,6 @@ export const useReferenceTranslations = (
|
|
|
139
127
|
[
|
|
140
128
|
"product_collection",
|
|
141
129
|
() => {
|
|
142
|
-
const translatableFields = ["title"]
|
|
143
130
|
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
144
131
|
|
|
145
132
|
const { data, ...rest } = useInfiniteCollections(
|
|
@@ -166,7 +153,6 @@ export const useReferenceTranslations = (
|
|
|
166
153
|
[
|
|
167
154
|
"product_type",
|
|
168
155
|
() => {
|
|
169
|
-
const translatableFields = ["value"]
|
|
170
156
|
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
171
157
|
|
|
172
158
|
const { data, ...rest } = useInfiniteProductTypes(
|
|
@@ -191,7 +177,6 @@ export const useReferenceTranslations = (
|
|
|
191
177
|
[
|
|
192
178
|
"product_tag",
|
|
193
179
|
() => {
|
|
194
|
-
const translatableFields = ["value"]
|
|
195
180
|
const fields = translatableFields.concat(["translations.*"]).join(",")
|
|
196
181
|
|
|
197
182
|
const { data, ...rest } = useInfiniteProductTags(
|
|
@@ -268,9 +253,54 @@ export const useBatchTranslations = (
|
|
|
268
253
|
queryClient.invalidateQueries({
|
|
269
254
|
queryKey: referenceInvalidationKeysMap.get(reference),
|
|
270
255
|
})
|
|
256
|
+
queryClient.invalidateQueries({
|
|
257
|
+
queryKey: translationStatisticsQueryKeys.lists(),
|
|
258
|
+
})
|
|
271
259
|
|
|
272
260
|
options?.onSuccess?.(data, variables, context)
|
|
273
261
|
},
|
|
274
262
|
...options,
|
|
275
263
|
})
|
|
276
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
|
+
}
|
|
@@ -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[]
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
+
import { AdminTranslationEntityStatistics } from "@medusajs/types"
|
|
1
2
|
import { Container, Heading, Text } from "@medusajs/ui"
|
|
2
3
|
import { useTranslation } from "react-i18next"
|
|
3
4
|
|
|
4
5
|
type TranslationsCompletionSectionProps = {
|
|
5
|
-
|
|
6
|
-
totalCount?: number
|
|
6
|
+
statistics: Record<string, AdminTranslationEntityStatistics>
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export const TranslationsCompletionSection = ({
|
|
10
|
-
|
|
11
|
-
totalCount = 0,
|
|
10
|
+
statistics,
|
|
12
11
|
}: TranslationsCompletionSectionProps) => {
|
|
13
12
|
const { t } = useTranslation()
|
|
13
|
+
const { translatedCount, totalCount } = Object.values(statistics).reduce(
|
|
14
|
+
(acc, curr) => ({
|
|
15
|
+
translatedCount: acc.translatedCount + curr.translated,
|
|
16
|
+
totalCount: acc.totalCount + curr.expected,
|
|
17
|
+
}),
|
|
18
|
+
{ totalCount: 0, translatedCount: 0 }
|
|
19
|
+
)
|
|
14
20
|
|
|
15
21
|
const percentage = totalCount > 0 ? (translatedCount / totalCount) * 100 : 0
|
|
16
22
|
const remaining = Math.max(0, totalCount - translatedCount)
|