@medusajs/dashboard 3.0.0-snapshot-20251216135612 → 3.0.0-snapshot-20251216145629
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/app.css +13 -0
- package/dist/app.js +227 -68
- package/dist/app.mjs +1 -1
- package/dist/{chunk-YKYVCQRS.mjs → chunk-UULAOAFM.mjs} +34 -10
- package/dist/en.json +13 -1
- package/dist/{product-attributes-EFIRUBRO.mjs → product-attributes-K4FGFORS.mjs} +1 -1
- package/dist/{product-create-K6EWZHIT.mjs → product-create-7YTRHZQQ.mjs} +1 -1
- package/dist/{product-detail-DKPZDEIY.mjs → product-detail-32ZXNWOP.mjs} +1 -1
- package/dist/{product-edit-55YXTIGO.mjs → product-edit-FBAKONMR.mjs} +1 -1
- package/dist/{product-organization-N3VBRXF4.mjs → product-organization-IUSVX22S.mjs} +1 -1
- package/dist/{translation-list-S5Z6PG2R.mjs → translation-list-UF7FLXOW.mjs} +151 -5
- package/dist/{translations-edit-HUNKY7CO.mjs → translations-edit-KECSHYZY.mjs} +7 -18
- package/package.json +9 -9
- package/src/i18n/translations/$schema.json +47 -2
- package/src/i18n/translations/en.json +13 -1
- package/src/i18n/translations/es.json +13 -1
- package/src/routes/translations/translation-list/components/translations-completion-section/translations-completion-section.tsx +153 -2
- package/src/routes/translations/translation-list/translation-list.tsx +8 -2
- package/src/routes/translations/translations-edit/components/translations-edit-form/translations-edit-form.tsx +7 -19
package/dist/app.js
CHANGED
|
@@ -9480,7 +9480,9 @@ var init_en = __esm({
|
|
|
9480
9480
|
},
|
|
9481
9481
|
actions: {
|
|
9482
9482
|
save: "Save",
|
|
9483
|
+
saveChanges: "Save changes",
|
|
9483
9484
|
saveAsDraft: "Save as draft",
|
|
9485
|
+
saveAndClose: "Save and close",
|
|
9484
9486
|
copy: "Copy",
|
|
9485
9487
|
copied: "Copied",
|
|
9486
9488
|
duplicate: "Duplicate",
|
|
@@ -11896,6 +11898,13 @@ var init_en = __esm({
|
|
|
11896
11898
|
list: {
|
|
11897
11899
|
metrics: "{{translated}} of {{total}} fields translated"
|
|
11898
11900
|
},
|
|
11901
|
+
edit: {
|
|
11902
|
+
successToast: "Translations updated successfully",
|
|
11903
|
+
unsavedChanges: {
|
|
11904
|
+
title: "Unsaved translations",
|
|
11905
|
+
description: "Don't lose your work. You have changes that haven't been saved yet"
|
|
11906
|
+
}
|
|
11907
|
+
},
|
|
11899
11908
|
bulk: {
|
|
11900
11909
|
header: "Translations Bulk Editor",
|
|
11901
11910
|
mainColumn: "Locale"
|
|
@@ -11906,7 +11915,10 @@ var init_en = __esm({
|
|
|
11906
11915
|
noLocalesTip: "Configure at least one locale to start translating your data"
|
|
11907
11916
|
},
|
|
11908
11917
|
completion: {
|
|
11909
|
-
heading: "Translated
|
|
11918
|
+
heading: "Translated fields",
|
|
11919
|
+
translated: "Translated",
|
|
11920
|
+
toTranslate: "To be translated",
|
|
11921
|
+
footer: "Languages"
|
|
11910
11922
|
}
|
|
11911
11923
|
},
|
|
11912
11924
|
store: {
|
|
@@ -12782,7 +12794,9 @@ var init_es = __esm({
|
|
|
12782
12794
|
},
|
|
12783
12795
|
actions: {
|
|
12784
12796
|
save: "Guardar",
|
|
12797
|
+
saveChanges: "Guardar cambios",
|
|
12785
12798
|
saveAsDraft: "Guardar como borrador",
|
|
12799
|
+
saveAndClose: "Guardar y cerrar",
|
|
12786
12800
|
copy: "Copiar",
|
|
12787
12801
|
copied: "Copiado",
|
|
12788
12802
|
duplicate: "Duplicar",
|
|
@@ -15120,13 +15134,23 @@ var init_es = __esm({
|
|
|
15120
15134
|
header: "Editor de Traducciones en Masa",
|
|
15121
15135
|
locale: "Idioma"
|
|
15122
15136
|
},
|
|
15137
|
+
edit: {
|
|
15138
|
+
successToast: "Traducciones actualizadas exitosamente",
|
|
15139
|
+
unsavedChanges: {
|
|
15140
|
+
title: "Traducciones sin guardar",
|
|
15141
|
+
description: "No pierdas tu trabajo. Tienes cambios que no han sido guardados a\xFAn"
|
|
15142
|
+
}
|
|
15143
|
+
},
|
|
15123
15144
|
activeLocales: {
|
|
15124
15145
|
heading: "Idiomas",
|
|
15125
15146
|
subtitle: "Traducciones activas",
|
|
15126
15147
|
noLocalesTip: "Configura al menos un idioma para empezar a traducir tu informaci\xF3n"
|
|
15127
15148
|
},
|
|
15128
15149
|
completion: {
|
|
15129
|
-
heading: "Textos traducidos"
|
|
15150
|
+
heading: "Textos traducidos",
|
|
15151
|
+
translated: "Traducidos",
|
|
15152
|
+
toTranslate: "Por traducir",
|
|
15153
|
+
footer: "Idiomas"
|
|
15130
15154
|
}
|
|
15131
15155
|
},
|
|
15132
15156
|
store: {
|
|
@@ -190704,17 +190728,20 @@ var init_translation_list_section = __esm({
|
|
|
190704
190728
|
});
|
|
190705
190729
|
|
|
190706
190730
|
// src/routes/translations/translation-list/components/translations-completion-section/translations-completion-section.tsx
|
|
190707
|
-
var import_ui451, import_react_i18next485, import_jsx_runtime687, TranslationsCompletionSection;
|
|
190731
|
+
var import_ui451, import_react304, import_react_i18next485, import_jsx_runtime687, TranslationsCompletionSection;
|
|
190708
190732
|
var init_translations_completion_section = __esm({
|
|
190709
190733
|
"src/routes/translations/translation-list/components/translations-completion-section/translations-completion-section.tsx"() {
|
|
190710
190734
|
"use strict";
|
|
190711
190735
|
import_ui451 = require("@medusajs/ui");
|
|
190736
|
+
import_react304 = require("react");
|
|
190712
190737
|
import_react_i18next485 = require("react-i18next");
|
|
190713
190738
|
import_jsx_runtime687 = require("react/jsx-runtime");
|
|
190714
190739
|
TranslationsCompletionSection = ({
|
|
190715
|
-
statistics
|
|
190740
|
+
statistics,
|
|
190741
|
+
locales
|
|
190716
190742
|
}) => {
|
|
190717
190743
|
const { t: t5 } = (0, import_react_i18next485.useTranslation)();
|
|
190744
|
+
const [hoveredLocale, setHoveredLocale] = (0, import_react304.useState)(null);
|
|
190718
190745
|
const { translatedCount, totalCount } = Object.values(statistics).reduce(
|
|
190719
190746
|
(acc, curr) => ({
|
|
190720
190747
|
translatedCount: acc.translatedCount + curr.translated,
|
|
@@ -190724,6 +190751,39 @@ var init_translations_completion_section = __esm({
|
|
|
190724
190751
|
);
|
|
190725
190752
|
const percentage = totalCount > 0 ? translatedCount / totalCount * 100 : 0;
|
|
190726
190753
|
const remaining = Math.max(0, totalCount - translatedCount);
|
|
190754
|
+
const localeStats = (0, import_react304.useMemo)(() => {
|
|
190755
|
+
const localeMap = /* @__PURE__ */ new Map();
|
|
190756
|
+
locales.forEach((locale) => {
|
|
190757
|
+
localeMap.set(locale.code, { translated: 0, expected: 0 });
|
|
190758
|
+
});
|
|
190759
|
+
Object.values(statistics).forEach((entityStats) => {
|
|
190760
|
+
if (entityStats.by_locale) {
|
|
190761
|
+
Object.entries(entityStats.by_locale).forEach(
|
|
190762
|
+
([localeCode, localeData]) => {
|
|
190763
|
+
const existing = localeMap.get(localeCode);
|
|
190764
|
+
if (existing) {
|
|
190765
|
+
existing.translated += localeData.translated;
|
|
190766
|
+
existing.expected += localeData.expected;
|
|
190767
|
+
}
|
|
190768
|
+
}
|
|
190769
|
+
);
|
|
190770
|
+
}
|
|
190771
|
+
});
|
|
190772
|
+
return locales.map((locale) => {
|
|
190773
|
+
const stats = localeMap.get(locale.code) || { translated: 0, expected: 0 };
|
|
190774
|
+
return {
|
|
190775
|
+
code: locale.code,
|
|
190776
|
+
name: locale.name,
|
|
190777
|
+
translated: stats.translated,
|
|
190778
|
+
toTranslate: Math.max(0, stats.expected - stats.translated),
|
|
190779
|
+
total: stats.expected
|
|
190780
|
+
};
|
|
190781
|
+
});
|
|
190782
|
+
}, [statistics, locales]);
|
|
190783
|
+
const maxTotal = (0, import_react304.useMemo)(
|
|
190784
|
+
() => Math.max(...localeStats.map((s) => s.total), 1),
|
|
190785
|
+
[localeStats]
|
|
190786
|
+
);
|
|
190727
190787
|
return /* @__PURE__ */ (0, import_jsx_runtime687.jsxs)(import_ui451.Container, { className: "flex flex-col gap-y-3 px-6 py-4", children: [
|
|
190728
190788
|
/* @__PURE__ */ (0, import_jsx_runtime687.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
190729
190789
|
/* @__PURE__ */ (0, import_jsx_runtime687.jsx)(import_ui451.Heading, { children: t5("translations.completion.heading") }),
|
|
@@ -190776,6 +190836,108 @@ var init_translations_completion_section = __esm({
|
|
|
190776
190836
|
" ",
|
|
190777
190837
|
t5("general.remaining").toLowerCase()
|
|
190778
190838
|
] })
|
|
190839
|
+
] }),
|
|
190840
|
+
localeStats.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime687.jsxs)("div", { className: "mt-4 flex flex-col gap-y-2", children: [
|
|
190841
|
+
/* @__PURE__ */ (0, import_jsx_runtime687.jsx)("div", { className: "flex h-32 w-full items-end gap-1", children: localeStats.map((locale) => {
|
|
190842
|
+
const heightPercent = locale.total / maxTotal * 100;
|
|
190843
|
+
const translatedPercent = locale.total > 0 ? locale.translated / locale.total * 100 : 0;
|
|
190844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime687.jsx)(
|
|
190845
|
+
import_ui451.Tooltip,
|
|
190846
|
+
{
|
|
190847
|
+
open: hoveredLocale === locale.code,
|
|
190848
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime687.jsxs)("div", { className: "flex flex-col gap-y-1 p-1", children: [
|
|
190849
|
+
/* @__PURE__ */ (0, import_jsx_runtime687.jsx)(import_ui451.Text, { size: "small", weight: "plus", children: locale.name }),
|
|
190850
|
+
/* @__PURE__ */ (0, import_jsx_runtime687.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
190851
|
+
/* @__PURE__ */ (0, import_jsx_runtime687.jsxs)("div", { className: "flex items-center gap-x-2", children: [
|
|
190852
|
+
/* @__PURE__ */ (0, import_jsx_runtime687.jsx)(
|
|
190853
|
+
"div",
|
|
190854
|
+
{
|
|
190855
|
+
className: "h-2 w-2 rounded-full",
|
|
190856
|
+
style: { backgroundColor: "var(--bg-interactive)" }
|
|
190857
|
+
}
|
|
190858
|
+
),
|
|
190859
|
+
/* @__PURE__ */ (0, import_jsx_runtime687.jsx)(
|
|
190860
|
+
import_ui451.Text,
|
|
190861
|
+
{
|
|
190862
|
+
size: "small",
|
|
190863
|
+
weight: "plus",
|
|
190864
|
+
className: "text-ui-fg-subtle",
|
|
190865
|
+
children: t5("translations.completion.translated")
|
|
190866
|
+
}
|
|
190867
|
+
)
|
|
190868
|
+
] }),
|
|
190869
|
+
/* @__PURE__ */ (0, import_jsx_runtime687.jsx)(import_ui451.Text, { size: "small", weight: "plus", children: locale.translated })
|
|
190870
|
+
] }),
|
|
190871
|
+
/* @__PURE__ */ (0, import_jsx_runtime687.jsxs)("div", { className: "flex items-center gap-x-2", children: [
|
|
190872
|
+
/* @__PURE__ */ (0, import_jsx_runtime687.jsx)(
|
|
190873
|
+
"div",
|
|
190874
|
+
{
|
|
190875
|
+
className: "h-2 w-2 rounded-full",
|
|
190876
|
+
style: {
|
|
190877
|
+
backgroundColor: "var(--bg-interactive)",
|
|
190878
|
+
opacity: 0.3
|
|
190879
|
+
}
|
|
190880
|
+
}
|
|
190881
|
+
),
|
|
190882
|
+
/* @__PURE__ */ (0, import_jsx_runtime687.jsx)(
|
|
190883
|
+
import_ui451.Text,
|
|
190884
|
+
{
|
|
190885
|
+
size: "small",
|
|
190886
|
+
weight: "plus",
|
|
190887
|
+
className: "text-ui-fg-subtle",
|
|
190888
|
+
children: t5("translations.completion.toTranslate")
|
|
190889
|
+
}
|
|
190890
|
+
),
|
|
190891
|
+
/* @__PURE__ */ (0, import_jsx_runtime687.jsx)(import_ui451.Text, { size: "small", weight: "plus", children: locale.toTranslate })
|
|
190892
|
+
] })
|
|
190893
|
+
] }),
|
|
190894
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime687.jsxs)(
|
|
190895
|
+
"div",
|
|
190896
|
+
{
|
|
190897
|
+
className: "flex min-w-2 flex-1 cursor-pointer flex-col justify-end overflow-hidden rounded-t-sm transition-opacity",
|
|
190898
|
+
style: { height: `${heightPercent}%` },
|
|
190899
|
+
onMouseEnter: () => setHoveredLocale(locale.code),
|
|
190900
|
+
onMouseLeave: () => setHoveredLocale(null),
|
|
190901
|
+
children: [
|
|
190902
|
+
/* @__PURE__ */ (0, import_jsx_runtime687.jsx)(
|
|
190903
|
+
"div",
|
|
190904
|
+
{
|
|
190905
|
+
className: "w-full rounded-t-sm",
|
|
190906
|
+
style: {
|
|
190907
|
+
height: `${100 - translatedPercent}%`,
|
|
190908
|
+
backgroundColor: "var(--bg-interactive)",
|
|
190909
|
+
opacity: 0.3,
|
|
190910
|
+
minHeight: locale.toTranslate > 0 ? "2px" : "0"
|
|
190911
|
+
}
|
|
190912
|
+
}
|
|
190913
|
+
),
|
|
190914
|
+
translatedPercent > 0 && /* @__PURE__ */ (0, import_jsx_runtime687.jsx)(
|
|
190915
|
+
"div",
|
|
190916
|
+
{
|
|
190917
|
+
className: "mt-0.5 w-full rounded-sm",
|
|
190918
|
+
style: {
|
|
190919
|
+
height: `${translatedPercent}%`,
|
|
190920
|
+
backgroundColor: "var(--bg-interactive)",
|
|
190921
|
+
minHeight: locale.translated > 0 ? "2px" : "0"
|
|
190922
|
+
}
|
|
190923
|
+
}
|
|
190924
|
+
)
|
|
190925
|
+
]
|
|
190926
|
+
}
|
|
190927
|
+
)
|
|
190928
|
+
},
|
|
190929
|
+
locale.code
|
|
190930
|
+
);
|
|
190931
|
+
}) }),
|
|
190932
|
+
/* @__PURE__ */ (0, import_jsx_runtime687.jsx)(
|
|
190933
|
+
import_ui451.Text,
|
|
190934
|
+
{
|
|
190935
|
+
size: "small",
|
|
190936
|
+
weight: "plus",
|
|
190937
|
+
className: "text-ui-fg-muted text-center",
|
|
190938
|
+
children: t5("translations.completion.footer")
|
|
190939
|
+
}
|
|
190940
|
+
)
|
|
190779
190941
|
] })
|
|
190780
190942
|
] });
|
|
190781
190943
|
};
|
|
@@ -190783,7 +190945,7 @@ var init_translations_completion_section = __esm({
|
|
|
190783
190945
|
});
|
|
190784
190946
|
|
|
190785
190947
|
// src/routes/translations/translation-list/translation-list.tsx
|
|
190786
|
-
var import_ui452, import_react_i18next486,
|
|
190948
|
+
var import_ui452, import_react_i18next486, import_react305, import_jsx_runtime688, TranslationList;
|
|
190787
190949
|
var init_translation_list = __esm({
|
|
190788
190950
|
"src/routes/translations/translation-list/translation-list.tsx"() {
|
|
190789
190951
|
"use strict";
|
|
@@ -190795,7 +190957,7 @@ var init_translation_list = __esm({
|
|
|
190795
190957
|
init_translation_list_section();
|
|
190796
190958
|
init_translations_completion_section();
|
|
190797
190959
|
init_skeleton2();
|
|
190798
|
-
|
|
190960
|
+
import_react305 = require("react");
|
|
190799
190961
|
import_jsx_runtime688 = require("react/jsx-runtime");
|
|
190800
190962
|
TranslationList = () => {
|
|
190801
190963
|
const { t: t5 } = (0, import_react_i18next486.useTranslation)();
|
|
@@ -190826,7 +190988,7 @@ var init_translation_list = __esm({
|
|
|
190826
190988
|
throw error || translationSettingsError || translationStatisticsError;
|
|
190827
190989
|
}
|
|
190828
190990
|
const hasLocales = (store?.supported_locales ?? []).length > 0;
|
|
190829
|
-
const translatableEntities = (0,
|
|
190991
|
+
const translatableEntities = (0, import_react305.useMemo)(() => {
|
|
190830
190992
|
if (!translatable_fields) {
|
|
190831
190993
|
return [];
|
|
190832
190994
|
}
|
|
@@ -190885,7 +191047,15 @@ var init_translation_list = __esm({
|
|
|
190885
191047
|
) ?? []
|
|
190886
191048
|
}
|
|
190887
191049
|
),
|
|
190888
|
-
/* @__PURE__ */ (0, import_jsx_runtime688.jsx)(
|
|
191050
|
+
/* @__PURE__ */ (0, import_jsx_runtime688.jsx)(
|
|
191051
|
+
TranslationsCompletionSection,
|
|
191052
|
+
{
|
|
191053
|
+
statistics: statistics ?? {},
|
|
191054
|
+
locales: store?.supported_locales?.map(
|
|
191055
|
+
(supportedLocale) => supportedLocale.locale
|
|
191056
|
+
) ?? []
|
|
191057
|
+
}
|
|
191058
|
+
)
|
|
190889
191059
|
] })
|
|
190890
191060
|
]
|
|
190891
191061
|
}
|
|
@@ -191052,7 +191222,7 @@ function useTranslationsGridColumns({
|
|
|
191052
191222
|
dynamicColumnWidth
|
|
191053
191223
|
}) {
|
|
191054
191224
|
const { t: t5 } = (0, import_react_i18next487.useTranslation)();
|
|
191055
|
-
const columns = (0,
|
|
191225
|
+
const columns = (0, import_react306.useMemo)(() => {
|
|
191056
191226
|
const selectedLocaleData = availableLocales.find(
|
|
191057
191227
|
(l) => l.locale_code === selectedLocale
|
|
191058
191228
|
);
|
|
@@ -191130,13 +191300,13 @@ function useTranslationsGridColumns({
|
|
|
191130
191300
|
]);
|
|
191131
191301
|
return columns;
|
|
191132
191302
|
}
|
|
191133
|
-
var import_zod166, import_ui453,
|
|
191303
|
+
var import_zod166, import_ui453, import_react306, import_react_hook_form144, import_react_i18next487, import_zod167, import_jsx_runtime689, LocaleTranslationSchema, EntityTranslationsSchema, TranslationsFormSchema, columnHelper93, FIELD_COLUMN_WIDTH, TranslationsEditForm;
|
|
191134
191304
|
var init_translations_edit_form = __esm({
|
|
191135
191305
|
"src/routes/translations/translations-edit/components/translations-edit-form/translations-edit-form.tsx"() {
|
|
191136
191306
|
"use strict";
|
|
191137
191307
|
import_zod166 = require("@hookform/resolvers/zod");
|
|
191138
191308
|
import_ui453 = require("@medusajs/ui");
|
|
191139
|
-
|
|
191309
|
+
import_react306 = require("react");
|
|
191140
191310
|
import_react_hook_form144 = require("react-hook-form");
|
|
191141
191311
|
import_react_i18next487 = require("react-i18next");
|
|
191142
191312
|
import_zod167 = require("zod");
|
|
@@ -191171,13 +191341,13 @@ var init_translations_edit_form = __esm({
|
|
|
191171
191341
|
}) => {
|
|
191172
191342
|
const { t: t5 } = (0, import_react_i18next487.useTranslation)();
|
|
191173
191343
|
const { handleSuccess, setCloseOnEscape } = useRouteModal();
|
|
191174
|
-
const containerRef = (0,
|
|
191175
|
-
const [dynamicColumnWidth, setDynamicColumnWidth] = (0,
|
|
191176
|
-
(0,
|
|
191344
|
+
const containerRef = (0, import_react306.useRef)(null);
|
|
191345
|
+
const [dynamicColumnWidth, setDynamicColumnWidth] = (0, import_react306.useState)(400);
|
|
191346
|
+
(0, import_react306.useEffect)(() => {
|
|
191177
191347
|
const calculateColumnWidth = () => {
|
|
191178
191348
|
if (containerRef.current) {
|
|
191179
191349
|
const containerWidth = containerRef.current.offsetWidth;
|
|
191180
|
-
const availableWidth = containerWidth - FIELD_COLUMN_WIDTH -
|
|
191350
|
+
const availableWidth = containerWidth - FIELD_COLUMN_WIDTH - 16;
|
|
191181
191351
|
const columnWidth = Math.max(300, Math.floor(availableWidth / 2));
|
|
191182
191352
|
setDynamicColumnWidth(columnWidth);
|
|
191183
191353
|
}
|
|
@@ -191189,17 +191359,17 @@ var init_translations_edit_form = __esm({
|
|
|
191189
191359
|
}
|
|
191190
191360
|
return () => resizeObserver.disconnect();
|
|
191191
191361
|
}, []);
|
|
191192
|
-
const [selectedLocale, setSelectedLocale] = (0,
|
|
191362
|
+
const [selectedLocale, setSelectedLocale] = (0, import_react306.useState)(
|
|
191193
191363
|
availableLocales[0]?.locale_code ?? ""
|
|
191194
191364
|
);
|
|
191195
|
-
const [showUnsavedPrompt, setShowUnsavedPrompt] = (0,
|
|
191196
|
-
const [pendingLocale, setPendingLocale] = (0,
|
|
191197
|
-
const entities = (0,
|
|
191198
|
-
const totalCount = (0,
|
|
191365
|
+
const [showUnsavedPrompt, setShowUnsavedPrompt] = (0, import_react306.useState)(false);
|
|
191366
|
+
const [pendingLocale, setPendingLocale] = (0, import_react306.useState)(null);
|
|
191367
|
+
const entities = (0, import_react306.useMemo)(() => references, [references]);
|
|
191368
|
+
const totalCount = (0, import_react306.useMemo)(
|
|
191199
191369
|
() => referenceCount * (translatableFields.length + 1),
|
|
191200
191370
|
[referenceCount, translatableFields]
|
|
191201
191371
|
);
|
|
191202
|
-
const initialState = (0,
|
|
191372
|
+
const initialState = (0, import_react306.useRef)(
|
|
191203
191373
|
initTranslationsFormState(
|
|
191204
191374
|
translations,
|
|
191205
191375
|
entities,
|
|
@@ -191211,12 +191381,12 @@ var init_translations_edit_form = __esm({
|
|
|
191211
191381
|
resolver: (0, import_zod166.zodResolver)(TranslationsFormSchema),
|
|
191212
191382
|
defaultValues: initialState.current
|
|
191213
191383
|
});
|
|
191214
|
-
const rows = (0,
|
|
191384
|
+
const rows = (0, import_react306.useMemo)(
|
|
191215
191385
|
() => buildTranslationRows(entities, translatableFields),
|
|
191216
191386
|
[entities, translatableFields]
|
|
191217
191387
|
);
|
|
191218
191388
|
const { mutateAsync, isPending } = useBatchTranslations(entityType);
|
|
191219
|
-
const handleLocaleChange = (0,
|
|
191389
|
+
const handleLocaleChange = (0, import_react306.useCallback)(
|
|
191220
191390
|
(newLocale) => {
|
|
191221
191391
|
if (newLocale === selectedLocale) {
|
|
191222
191392
|
return;
|
|
@@ -191236,7 +191406,7 @@ var init_translations_edit_form = __esm({
|
|
|
191236
191406
|
},
|
|
191237
191407
|
[selectedLocale, form]
|
|
191238
191408
|
);
|
|
191239
|
-
const saveCurrentLocale = (0,
|
|
191409
|
+
const saveCurrentLocale = (0, import_react306.useCallback)(async () => {
|
|
191240
191410
|
const currentValues = form.getValues();
|
|
191241
191411
|
const payload = transformSingleLocaleToBatchPayload(
|
|
191242
191412
|
currentValues,
|
|
@@ -191290,7 +191460,7 @@ var init_translations_edit_form = __esm({
|
|
|
191290
191460
|
return false;
|
|
191291
191461
|
}
|
|
191292
191462
|
}, [form, entityType, selectedLocale, mutateAsync]);
|
|
191293
|
-
const handleSaveAndSwitch = (0,
|
|
191463
|
+
const handleSaveAndSwitch = (0, import_react306.useCallback)(async () => {
|
|
191294
191464
|
const success = await saveCurrentLocale();
|
|
191295
191465
|
if (success && pendingLocale) {
|
|
191296
191466
|
import_ui453.toast.success(
|
|
@@ -191303,19 +191473,15 @@ var init_translations_edit_form = __esm({
|
|
|
191303
191473
|
setShowUnsavedPrompt(false);
|
|
191304
191474
|
setPendingLocale(null);
|
|
191305
191475
|
}, [saveCurrentLocale, pendingLocale, t5]);
|
|
191306
|
-
const handleCancelSwitch = (0,
|
|
191476
|
+
const handleCancelSwitch = (0, import_react306.useCallback)(() => {
|
|
191307
191477
|
setShowUnsavedPrompt(false);
|
|
191308
191478
|
setPendingLocale(null);
|
|
191309
191479
|
}, []);
|
|
191310
|
-
const handleSave = (0,
|
|
191480
|
+
const handleSave = (0, import_react306.useCallback)(
|
|
191311
191481
|
async (closeOnSuccess = false) => {
|
|
191312
191482
|
const success = await saveCurrentLocale();
|
|
191313
191483
|
if (success) {
|
|
191314
|
-
import_ui453.toast.success(
|
|
191315
|
-
t5("translations.edit.successToast", {
|
|
191316
|
-
defaultValue: "Translations updated successfully"
|
|
191317
|
-
})
|
|
191318
|
-
);
|
|
191484
|
+
import_ui453.toast.success(t5("translations.edit.successToast"));
|
|
191319
191485
|
if (closeOnSuccess) {
|
|
191320
191486
|
handleSuccess();
|
|
191321
191487
|
}
|
|
@@ -191330,9 +191496,6 @@ var init_translations_edit_form = __esm({
|
|
|
191330
191496
|
entityType
|
|
191331
191497
|
);
|
|
191332
191498
|
if (payload.create.length === 0 && payload.update.length === 0 && payload.delete.length === 0) {
|
|
191333
|
-
import_ui453.toast.info(
|
|
191334
|
-
t5("translations.noChanges", { defaultValue: "No changes to save" })
|
|
191335
|
-
);
|
|
191336
191499
|
return;
|
|
191337
191500
|
}
|
|
191338
191501
|
const BATCH_SIZE = 150;
|
|
@@ -191438,7 +191601,7 @@ var init_translations_edit_form = __esm({
|
|
|
191438
191601
|
variant: "secondary",
|
|
191439
191602
|
onClick: () => handleSave(false),
|
|
191440
191603
|
isLoading: isPending,
|
|
191441
|
-
children: t5("actions.saveChanges"
|
|
191604
|
+
children: t5("actions.saveChanges")
|
|
191442
191605
|
}
|
|
191443
191606
|
),
|
|
191444
191607
|
/* @__PURE__ */ (0, import_jsx_runtime689.jsx)(
|
|
@@ -191448,7 +191611,7 @@ var init_translations_edit_form = __esm({
|
|
|
191448
191611
|
type: "button",
|
|
191449
191612
|
onClick: () => handleSave(true),
|
|
191450
191613
|
isLoading: isPending,
|
|
191451
|
-
children: t5("actions.saveAndClose"
|
|
191614
|
+
children: t5("actions.saveAndClose")
|
|
191452
191615
|
}
|
|
191453
191616
|
)
|
|
191454
191617
|
] }) })
|
|
@@ -191457,12 +191620,8 @@ var init_translations_edit_form = __esm({
|
|
|
191457
191620
|
),
|
|
191458
191621
|
/* @__PURE__ */ (0, import_jsx_runtime689.jsx)(import_ui453.Prompt, { open: showUnsavedPrompt, variant: "confirmation", children: /* @__PURE__ */ (0, import_jsx_runtime689.jsxs)(import_ui453.Prompt.Content, { children: [
|
|
191459
191622
|
/* @__PURE__ */ (0, import_jsx_runtime689.jsxs)(import_ui453.Prompt.Header, { children: [
|
|
191460
|
-
/* @__PURE__ */ (0, import_jsx_runtime689.jsx)(import_ui453.Prompt.Title, { children: t5("translations.unsavedChanges.title",
|
|
191461
|
-
|
|
191462
|
-
}) }),
|
|
191463
|
-
/* @__PURE__ */ (0, import_jsx_runtime689.jsx)(import_ui453.Prompt.Description, { children: t5("translations.unsavedChanges.description", {
|
|
191464
|
-
defaultValue: "You have unsaved changes for this locale. Save them before switching?"
|
|
191465
|
-
}) })
|
|
191623
|
+
/* @__PURE__ */ (0, import_jsx_runtime689.jsx)(import_ui453.Prompt.Title, { children: t5("translations.edit.unsavedChanges.title") }),
|
|
191624
|
+
/* @__PURE__ */ (0, import_jsx_runtime689.jsx)(import_ui453.Prompt.Description, { children: t5("translations.edit.unsavedChanges.description") })
|
|
191466
191625
|
] }),
|
|
191467
191626
|
/* @__PURE__ */ (0, import_jsx_runtime689.jsxs)(import_ui453.Prompt.Footer, { children: [
|
|
191468
191627
|
/* @__PURE__ */ (0, import_jsx_runtime689.jsx)(
|
|
@@ -191482,7 +191641,7 @@ var init_translations_edit_form = __esm({
|
|
|
191482
191641
|
onClick: handleSaveAndSwitch,
|
|
191483
191642
|
type: "button",
|
|
191484
191643
|
isLoading: isPending,
|
|
191485
|
-
children: t5("actions.saveChanges"
|
|
191644
|
+
children: t5("actions.saveChanges")
|
|
191486
191645
|
}
|
|
191487
191646
|
)
|
|
191488
191647
|
] })
|
|
@@ -191501,14 +191660,14 @@ var init_translations_edit_form2 = __esm({
|
|
|
191501
191660
|
});
|
|
191502
191661
|
|
|
191503
191662
|
// src/routes/translations/translations-edit/translations-edit.tsx
|
|
191504
|
-
var import_react_router_dom247,
|
|
191663
|
+
var import_react_router_dom247, import_react307, import_react_query105, import_jsx_runtime690, TranslationsEdit;
|
|
191505
191664
|
var init_translations_edit = __esm({
|
|
191506
191665
|
"src/routes/translations/translations-edit/translations-edit.tsx"() {
|
|
191507
191666
|
"use strict";
|
|
191508
191667
|
import_react_router_dom247 = require("react-router-dom");
|
|
191509
191668
|
init_api();
|
|
191510
191669
|
init_translations_edit_form2();
|
|
191511
|
-
|
|
191670
|
+
import_react307 = require("react");
|
|
191512
191671
|
init_modals();
|
|
191513
191672
|
init_feature_flag_provider();
|
|
191514
191673
|
import_react_query105 = require("@tanstack/react-query");
|
|
@@ -191519,7 +191678,7 @@ var init_translations_edit = __esm({
|
|
|
191519
191678
|
const [searchParams] = (0, import_react_router_dom247.useSearchParams)();
|
|
191520
191679
|
const reference = searchParams.get("reference");
|
|
191521
191680
|
const referenceIdParam = searchParams.getAll("reference_id");
|
|
191522
|
-
(0,
|
|
191681
|
+
(0, import_react307.useEffect)(() => {
|
|
191523
191682
|
if (!reference || !isTranslationsEnabled) {
|
|
191524
191683
|
navigate(-1);
|
|
191525
191684
|
return;
|
|
@@ -191599,7 +191758,7 @@ function AvatarBox({ checked }) {
|
|
|
191599
191758
|
className: "bg-ui-button-neutral shadow-buttons-neutral after:button-neutral-gradient relative mb-4 flex h-[50px] w-[50px] items-center justify-center rounded-xl after:inset-0 after:content-['']",
|
|
191600
191759
|
children: [
|
|
191601
191760
|
checked && /* @__PURE__ */ (0, import_jsx_runtime691.jsx)(
|
|
191602
|
-
|
|
191761
|
+
import_react308.motion.div,
|
|
191603
191762
|
{
|
|
191604
191763
|
className: "absolute -right-[5px] -top-1 flex size-5 items-center justify-center rounded-full border-[0.5px] border-[rgba(3,7,18,0.2)] bg-[#3B82F6] bg-gradient-to-b from-white/0 to-white/20 shadow-[0px_1px_2px_0px_rgba(3,7,18,0.12),0px_1px_2px_0px_rgba(255,255,255,0.10)_inset,0px_-1px_5px_0px_rgba(255,255,255,0.10)_inset,0px_0px_0px_0px_rgba(3,7,18,0.06)_inset]",
|
|
191605
191764
|
initial: { opacity: 0, scale: 0.5 },
|
|
@@ -191618,7 +191777,7 @@ function AvatarBox({ checked }) {
|
|
|
191618
191777
|
viewBox: "0 0 20 20",
|
|
191619
191778
|
fill: "none",
|
|
191620
191779
|
children: /* @__PURE__ */ (0, import_jsx_runtime691.jsx)(
|
|
191621
|
-
|
|
191780
|
+
import_react308.motion.path,
|
|
191622
191781
|
{
|
|
191623
191782
|
d: "M5.8335 10.4167L9.16683 13.75L14.1668 6.25",
|
|
191624
191783
|
stroke: "white",
|
|
@@ -191696,11 +191855,11 @@ function AvatarBox({ checked }) {
|
|
|
191696
191855
|
}
|
|
191697
191856
|
);
|
|
191698
191857
|
}
|
|
191699
|
-
var
|
|
191858
|
+
var import_react308, import_jsx_runtime691;
|
|
191700
191859
|
var init_avatar_box = __esm({
|
|
191701
191860
|
"src/components/common/logo-box/avatar-box.tsx"() {
|
|
191702
191861
|
"use strict";
|
|
191703
|
-
|
|
191862
|
+
import_react308 = require("motion/react");
|
|
191704
191863
|
init_icon_avatar2();
|
|
191705
191864
|
import_jsx_runtime691 = require("react/jsx-runtime");
|
|
191706
191865
|
}
|
|
@@ -191881,12 +192040,12 @@ var init_login2 = __esm({
|
|
|
191881
192040
|
});
|
|
191882
192041
|
|
|
191883
192042
|
// src/components/common/logo-box/logo-box.tsx
|
|
191884
|
-
var import_ui455,
|
|
192043
|
+
var import_ui455, import_react309, import_jsx_runtime693, LogoBox;
|
|
191885
192044
|
var init_logo_box = __esm({
|
|
191886
192045
|
"src/components/common/logo-box/logo-box.tsx"() {
|
|
191887
192046
|
"use strict";
|
|
191888
192047
|
import_ui455 = require("@medusajs/ui");
|
|
191889
|
-
|
|
192048
|
+
import_react309 = require("motion/react");
|
|
191890
192049
|
import_jsx_runtime693 = require("react/jsx-runtime");
|
|
191891
192050
|
LogoBox = ({
|
|
191892
192051
|
className,
|
|
@@ -191912,7 +192071,7 @@ var init_logo_box = __esm({
|
|
|
191912
192071
|
),
|
|
191913
192072
|
children: [
|
|
191914
192073
|
checked && /* @__PURE__ */ (0, import_jsx_runtime693.jsx)(
|
|
191915
|
-
|
|
192074
|
+
import_react309.motion.div,
|
|
191916
192075
|
{
|
|
191917
192076
|
className: "size-5 absolute -right-[5px] -top-1 flex items-center justify-center rounded-full border-[0.5px] border-[rgba(3,7,18,0.2)] bg-[#3B82F6] bg-gradient-to-b from-white/0 to-white/20 shadow-[0px_1px_2px_0px_rgba(3,7,18,0.12),0px_1px_2px_0px_rgba(255,255,255,0.10)_inset,0px_-1px_5px_0px_rgba(255,255,255,0.10)_inset,0px_0px_0px_0px_rgba(3,7,18,0.06)_inset]",
|
|
191918
192077
|
initial: { opacity: 0, scale: 0.5 },
|
|
@@ -191927,7 +192086,7 @@ var init_logo_box = __esm({
|
|
|
191927
192086
|
viewBox: "0 0 20 20",
|
|
191928
192087
|
fill: "none",
|
|
191929
192088
|
children: /* @__PURE__ */ (0, import_jsx_runtime693.jsx)(
|
|
191930
|
-
|
|
192089
|
+
import_react309.motion.path,
|
|
191931
192090
|
{
|
|
191932
192091
|
d: "M5.8335 10.4167L9.16683 13.75L14.1668 6.25",
|
|
191933
192092
|
stroke: "white",
|
|
@@ -191977,7 +192136,7 @@ var init_logo_box2 = __esm({
|
|
|
191977
192136
|
});
|
|
191978
192137
|
|
|
191979
192138
|
// src/routes/reset-password/reset-password.tsx
|
|
191980
|
-
var import_zod169, import_ui456, import_react_hook_form146, import_react_i18next489, import_react_router_dom249, z65,
|
|
192139
|
+
var import_zod169, import_ui456, import_react_hook_form146, import_react_i18next489, import_react_router_dom249, z65, import_react310, import_react_jwt, import_jsx_runtime694, ResetPasswordInstructionsSchema, ResetPasswordSchema, ResetPasswordTokenSchema, validateDecodedResetPasswordToken, InvalidResetToken, ChooseNewPassword, ResetPassword;
|
|
191981
192140
|
var init_reset_password = __esm({
|
|
191982
192141
|
"src/routes/reset-password/reset-password.tsx"() {
|
|
191983
192142
|
"use strict";
|
|
@@ -191987,7 +192146,7 @@ var init_reset_password = __esm({
|
|
|
191987
192146
|
import_react_i18next489 = require("react-i18next");
|
|
191988
192147
|
import_react_router_dom249 = require("react-router-dom");
|
|
191989
192148
|
z65 = __toESM(require("zod"));
|
|
191990
|
-
|
|
192149
|
+
import_react310 = require("react");
|
|
191991
192150
|
import_react_jwt = require("react-jwt");
|
|
191992
192151
|
init_form2();
|
|
191993
192152
|
init_logo_box2();
|
|
@@ -192056,7 +192215,7 @@ var init_reset_password = __esm({
|
|
|
192056
192215
|
};
|
|
192057
192216
|
ChooseNewPassword = ({ token }) => {
|
|
192058
192217
|
const { t: t5 } = (0, import_react_i18next489.useTranslation)();
|
|
192059
|
-
const [showAlert, setShowAlert] = (0,
|
|
192218
|
+
const [showAlert, setShowAlert] = (0, import_react310.useState)(false);
|
|
192060
192219
|
const invite = token ? (0, import_react_jwt.decodeToken)(token) : null;
|
|
192061
192220
|
const isValidResetPasswordToken = invite && validateDecodedResetPasswordToken(invite);
|
|
192062
192221
|
const form = (0, import_react_hook_form146.useForm)({
|
|
@@ -192176,7 +192335,7 @@ var init_reset_password = __esm({
|
|
|
192176
192335
|
ResetPassword = () => {
|
|
192177
192336
|
const { t: t5 } = (0, import_react_i18next489.useTranslation)();
|
|
192178
192337
|
const [searchParams] = (0, import_react_router_dom249.useSearchParams)();
|
|
192179
|
-
const [showAlert, setShowAlert] = (0,
|
|
192338
|
+
const [showAlert, setShowAlert] = (0, import_react310.useState)(false);
|
|
192180
192339
|
const token = searchParams.get("token");
|
|
192181
192340
|
const form = (0, import_react_hook_form146.useForm)({
|
|
192182
192341
|
resolver: (0, import_zod169.zodResolver)(ResetPasswordInstructionsSchema),
|
|
@@ -192278,15 +192437,15 @@ var init_reset_password2 = __esm({
|
|
|
192278
192437
|
});
|
|
192279
192438
|
|
|
192280
192439
|
// src/routes/invite/invite.tsx
|
|
192281
|
-
var import_zod170, import_ui457, import_i18next8,
|
|
192440
|
+
var import_zod170, import_ui457, import_i18next8, import_react311, import_react312, import_react_hook_form147, import_react_i18next490, import_react_jwt2, import_react_router_dom250, z66, import_jsx_runtime695, CreateAccountSchema, Invite, LoginLink, InvalidView, CreateView, SuccessView, InviteSchema, validateDecodedInvite;
|
|
192282
192441
|
var init_invite = __esm({
|
|
192283
192442
|
"src/routes/invite/invite.tsx"() {
|
|
192284
192443
|
"use strict";
|
|
192285
192444
|
import_zod170 = require("@hookform/resolvers/zod");
|
|
192286
192445
|
import_ui457 = require("@medusajs/ui");
|
|
192287
192446
|
import_i18next8 = __toESM(require("i18next"));
|
|
192288
|
-
|
|
192289
|
-
|
|
192447
|
+
import_react311 = require("motion/react");
|
|
192448
|
+
import_react312 = require("react");
|
|
192290
192449
|
import_react_hook_form147 = require("react-hook-form");
|
|
192291
192450
|
import_react_i18next490 = require("react-i18next");
|
|
192292
192451
|
import_react_jwt2 = require("react-jwt");
|
|
@@ -192315,14 +192474,14 @@ var init_invite = __esm({
|
|
|
192315
192474
|
});
|
|
192316
192475
|
Invite = () => {
|
|
192317
192476
|
const [searchParams] = (0, import_react_router_dom250.useSearchParams)();
|
|
192318
|
-
const [success, setSuccess] = (0,
|
|
192477
|
+
const [success, setSuccess] = (0, import_react312.useState)(false);
|
|
192319
192478
|
const token = searchParams.get("token");
|
|
192320
192479
|
const invite = token ? (0, import_react_jwt2.decodeToken)(token) : null;
|
|
192321
192480
|
const isValidInvite = invite && validateDecodedInvite(invite);
|
|
192322
192481
|
return /* @__PURE__ */ (0, import_jsx_runtime695.jsx)("div", { className: "bg-ui-bg-subtle relative flex min-h-dvh w-dvw items-center justify-center p-4", children: /* @__PURE__ */ (0, import_jsx_runtime695.jsxs)("div", { className: "flex w-full max-w-[360px] flex-col items-center", children: [
|
|
192323
192482
|
/* @__PURE__ */ (0, import_jsx_runtime695.jsx)(AvatarBox, { checked: success }),
|
|
192324
|
-
/* @__PURE__ */ (0, import_jsx_runtime695.jsx)("div", { className: "max-h-[557px] w-full will-change-contents", children: isValidInvite ? /* @__PURE__ */ (0, import_jsx_runtime695.jsx)(
|
|
192325
|
-
|
|
192483
|
+
/* @__PURE__ */ (0, import_jsx_runtime695.jsx)("div", { className: "max-h-[557px] w-full will-change-contents", children: isValidInvite ? /* @__PURE__ */ (0, import_jsx_runtime695.jsx)(import_react311.AnimatePresence, { children: !success ? /* @__PURE__ */ (0, import_jsx_runtime695.jsx)(
|
|
192484
|
+
import_react311.motion.div,
|
|
192326
192485
|
{
|
|
192327
192486
|
initial: false,
|
|
192328
192487
|
animate: {
|
|
@@ -192340,7 +192499,7 @@ var init_invite = __esm({
|
|
|
192340
192499
|
},
|
|
192341
192500
|
className: "w-full will-change-transform",
|
|
192342
192501
|
children: /* @__PURE__ */ (0, import_jsx_runtime695.jsx)(
|
|
192343
|
-
|
|
192502
|
+
import_react311.motion.div,
|
|
192344
192503
|
{
|
|
192345
192504
|
initial: false,
|
|
192346
192505
|
animate: {
|
|
@@ -192370,7 +192529,7 @@ var init_invite = __esm({
|
|
|
192370
192529
|
},
|
|
192371
192530
|
"create-account"
|
|
192372
192531
|
) : /* @__PURE__ */ (0, import_jsx_runtime695.jsx)(
|
|
192373
|
-
|
|
192532
|
+
import_react311.motion.div,
|
|
192374
192533
|
{
|
|
192375
192534
|
initial: {
|
|
192376
192535
|
opacity: 0,
|
|
@@ -192423,7 +192582,7 @@ var init_invite = __esm({
|
|
|
192423
192582
|
invite
|
|
192424
192583
|
}) => {
|
|
192425
192584
|
const { t: t5 } = (0, import_react_i18next490.useTranslation)();
|
|
192426
|
-
const [invalid, setInvalid] = (0,
|
|
192585
|
+
const [invalid, setInvalid] = (0, import_react312.useState)(false);
|
|
192427
192586
|
const [params2] = (0, import_react_router_dom250.useSearchParams)();
|
|
192428
192587
|
const isFirstRun = params2.get("first_run") === "true";
|
|
192429
192588
|
const form = (0, import_react_hook_form147.useForm)({
|