@translationstudio/translationstudio-strapi-extension 4.0.0 → 4.1.0
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/_chunks/{App-BR-y9Q87.js → App-5ldte7Ku.js} +1 -1
- package/dist/_chunks/{App-Cc3EklWX.mjs → App-DQUxEmfa.mjs} +1 -1
- package/dist/_chunks/{HistoryPage-BG_RchOk.js → HistoryPage-C1EG7XIt.js} +49 -24
- package/dist/_chunks/{HistoryPage-CSMW8AED.mjs → HistoryPage-Cwm3HJc9.mjs} +49 -24
- package/dist/_chunks/{index-ChM8Lw4L.mjs → index-DF5d8Feh.mjs} +2 -2
- package/dist/_chunks/{index-B9kFLfY3.js → index-DkASHLO0.js} +2 -2
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/utils/statusHelper.d.ts +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ const admin = require("@strapi/strapi/admin");
|
|
|
5
5
|
const reactRouterDom = require("react-router-dom");
|
|
6
6
|
const designSystem = require("@strapi/design-system");
|
|
7
7
|
const react = require("react");
|
|
8
|
-
const index = require("./index-
|
|
8
|
+
const index = require("./index-DkASHLO0.js");
|
|
9
9
|
const apiService = {
|
|
10
10
|
async loadLicense(get) {
|
|
11
11
|
try {
|
|
@@ -3,7 +3,7 @@ import { getFetchClient, Page } from "@strapi/strapi/admin";
|
|
|
3
3
|
import { Routes, Route } from "react-router-dom";
|
|
4
4
|
import { Main, Box, Alert, Grid, Typography, TextInput, Switch, Button } from "@strapi/design-system";
|
|
5
5
|
import { useState, useCallback, useEffect } from "react";
|
|
6
|
-
import { T as TranslationstudioLogo } from "./index-
|
|
6
|
+
import { T as TranslationstudioLogo } from "./index-DF5d8Feh.mjs";
|
|
7
7
|
const apiService = {
|
|
8
8
|
async loadLicense(get) {
|
|
9
9
|
try {
|
|
@@ -4,7 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const designSystem = require("@strapi/design-system");
|
|
5
5
|
const react = require("react");
|
|
6
6
|
const admin = require("@strapi/strapi/admin");
|
|
7
|
-
const index = require("./index-
|
|
7
|
+
const index = require("./index-DkASHLO0.js");
|
|
8
8
|
const getSearchableText = (item) => {
|
|
9
9
|
return `${item["project-name"]} ${item["element-name"]} ${item["element-uid"]} ${item.targetLanguages.join(" ")} ${item.combinedStatus.text}`.toLowerCase();
|
|
10
10
|
};
|
|
@@ -576,7 +576,7 @@ const getEntryId = (entry) => {
|
|
|
576
576
|
};
|
|
577
577
|
const getTranslationStatus = (entryId, historyData) => {
|
|
578
578
|
if (!Array.isArray(historyData) || historyData.length === 0) {
|
|
579
|
-
return "
|
|
579
|
+
return "";
|
|
580
580
|
}
|
|
581
581
|
const matchingItems = historyData.filter((h) => h["element-uid"].includes(entryId));
|
|
582
582
|
if (matchingItems.length === 0) {
|
|
@@ -612,22 +612,26 @@ const getTranslationDate = (entryId, historyData) => {
|
|
|
612
612
|
return latestImportTime > 0 ? index.formatDate(latestImportTime) : "";
|
|
613
613
|
};
|
|
614
614
|
const getStatusBadgeVariant = (status) => {
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
615
|
+
switch (status) {
|
|
616
|
+
case "translated":
|
|
617
|
+
return "success";
|
|
618
|
+
case "in_translation":
|
|
619
|
+
return "secondary";
|
|
620
|
+
default:
|
|
621
|
+
return "neutral";
|
|
622
|
+
}
|
|
622
623
|
};
|
|
623
624
|
const getStatusDisplayText = (status) => {
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
625
|
+
switch (status) {
|
|
626
|
+
case "translated":
|
|
627
|
+
return "Translated";
|
|
628
|
+
case "in_translation":
|
|
629
|
+
return "In Translation";
|
|
630
|
+
case "not_translated":
|
|
631
|
+
return "Not translated";
|
|
632
|
+
default:
|
|
633
|
+
return "n.a.";
|
|
634
|
+
}
|
|
631
635
|
};
|
|
632
636
|
const ContentTypesList = ({
|
|
633
637
|
contentTypes,
|
|
@@ -725,6 +729,8 @@ const EntriesTable = ({
|
|
|
725
729
|
}
|
|
726
730
|
);
|
|
727
731
|
}
|
|
732
|
+
const hasSelectedAll = selectedEntries.size === entries.length && entries.length > 0;
|
|
733
|
+
const checkedType = hasSelectedAll || selectedEntries.size === 0 ? hasSelectedAll : "indeterminate";
|
|
728
734
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
729
735
|
designSystem.Box,
|
|
730
736
|
{
|
|
@@ -741,8 +747,7 @@ const EntriesTable = ({
|
|
|
741
747
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { style: { width: "50px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
742
748
|
designSystem.Checkbox,
|
|
743
749
|
{
|
|
744
|
-
checked:
|
|
745
|
-
indeterminate: selectedEntries.size > 0 && selectedEntries.size < entries.length,
|
|
750
|
+
checked: checkedType,
|
|
746
751
|
onCheckedChange: onSelectAll
|
|
747
752
|
}
|
|
748
753
|
) }),
|
|
@@ -842,6 +847,20 @@ const EntryRow = ({
|
|
|
842
847
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", style: { color: themeColors.primaryText }, children: date }) })
|
|
843
848
|
] });
|
|
844
849
|
};
|
|
850
|
+
const fetchContentEntriesData = async function(selectedContentType) {
|
|
851
|
+
if (!selectedContentType) {
|
|
852
|
+
return [];
|
|
853
|
+
}
|
|
854
|
+
try {
|
|
855
|
+
const { get } = admin.getFetchClient();
|
|
856
|
+
const response = await get(`/content-manager/collection-types/${selectedContentType}`);
|
|
857
|
+
if (response.data?.results && Array.isArray(response.data.results))
|
|
858
|
+
return response.data.results;
|
|
859
|
+
} catch (error) {
|
|
860
|
+
console.error("Failed to fetch entries:", error);
|
|
861
|
+
}
|
|
862
|
+
return [];
|
|
863
|
+
};
|
|
845
864
|
const BulkTranslationMenu = ({
|
|
846
865
|
historyData,
|
|
847
866
|
isLoadingHistory,
|
|
@@ -862,6 +881,12 @@ const BulkTranslationMenu = ({
|
|
|
862
881
|
const response = await get("/content-manager/content-types");
|
|
863
882
|
const types = filterAndTransformContentTypes(response.data.data);
|
|
864
883
|
setContentTypes(types);
|
|
884
|
+
if (types.length > 0) {
|
|
885
|
+
setSelectedEntries(/* @__PURE__ */ new Set());
|
|
886
|
+
setSelectedContentType(types[0].uid);
|
|
887
|
+
const data = await fetchContentEntriesData(types[0].uid);
|
|
888
|
+
setEntries(data);
|
|
889
|
+
}
|
|
865
890
|
} catch (error) {
|
|
866
891
|
console.error("Failed to fetch content types:", error);
|
|
867
892
|
} finally {
|
|
@@ -869,18 +894,15 @@ const BulkTranslationMenu = ({
|
|
|
869
894
|
}
|
|
870
895
|
};
|
|
871
896
|
fetchContentTypes();
|
|
872
|
-
}, [setIsLoadingContentTypes, setContentTypes]);
|
|
897
|
+
}, [setIsLoadingContentTypes, setContentTypes, setSelectedContentType, setEntries, setSelectedEntries]);
|
|
873
898
|
const fetchContentEntries = function(selectedContentType2) {
|
|
874
899
|
if (!selectedContentType2) {
|
|
875
900
|
return;
|
|
876
901
|
}
|
|
877
902
|
setIsLoadingEntries(true);
|
|
878
|
-
|
|
879
|
-
setEntries(
|
|
903
|
+
fetchContentEntriesData(selectedContentType2).then((data) => {
|
|
904
|
+
setEntries(data);
|
|
880
905
|
setSelectedEntries(/* @__PURE__ */ new Set());
|
|
881
|
-
}).catch((error) => {
|
|
882
|
-
console.error("Failed to fetch entries:", error);
|
|
883
|
-
setEntries([]);
|
|
884
906
|
}).finally(() => setIsLoadingEntries(false));
|
|
885
907
|
};
|
|
886
908
|
const selectedContentTypeData = react.useMemo(
|
|
@@ -913,6 +935,9 @@ const BulkTranslationMenu = ({
|
|
|
913
935
|
setSelectedEntries(/* @__PURE__ */ new Set());
|
|
914
936
|
onTranslationComplete?.();
|
|
915
937
|
};
|
|
938
|
+
if (contentTypes.length === 0) {
|
|
939
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, paddingBottom: 4, style: { overflow: "hidden", display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", paddingBottom: 3, style: { fontWeight: "bold" }, children: "No content types available." }) });
|
|
940
|
+
}
|
|
916
941
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, paddingBottom: 4, style: { overflow: "hidden", display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: 1, display: "flex", gap: "16px", overflow: "hidden" }, children: [
|
|
917
942
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
918
943
|
ContentTypesList,
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { Box, Typography, TextInput, Table, Thead, Tr, Tbody, Td, Badge, Th, Button, Radio, Checkbox, DatePicker, ProgressBar, Alert, Main, Grid, Flex } from "@strapi/design-system";
|
|
3
3
|
import { useState, useEffect, useMemo } from "react";
|
|
4
4
|
import { getFetchClient } from "@strapi/strapi/admin";
|
|
5
|
-
import { g as groupHistoryData, f as formatDate, h as handleHistoryResponse, a as getThemeColors, u as useThemeMode, b as getStoredEmail, c as getSubmitLabel, s as setStoredEmail, v as validateDueDate, d as createEntryUid, e as determineEntryName, i as createTranslationPayload, j as createSuccessMessage, k as createErrorMessage, l as createGeneralErrorMessage, T as TranslationstudioLogo } from "./index-
|
|
5
|
+
import { g as groupHistoryData, f as formatDate, h as handleHistoryResponse, a as getThemeColors, u as useThemeMode, b as getStoredEmail, c as getSubmitLabel, s as setStoredEmail, v as validateDueDate, d as createEntryUid, e as determineEntryName, i as createTranslationPayload, j as createSuccessMessage, k as createErrorMessage, l as createGeneralErrorMessage, T as TranslationstudioLogo } from "./index-DF5d8Feh.mjs";
|
|
6
6
|
const getSearchableText = (item) => {
|
|
7
7
|
return `${item["project-name"]} ${item["element-name"]} ${item["element-uid"]} ${item.targetLanguages.join(" ")} ${item.combinedStatus.text}`.toLowerCase();
|
|
8
8
|
};
|
|
@@ -574,7 +574,7 @@ const getEntryId = (entry) => {
|
|
|
574
574
|
};
|
|
575
575
|
const getTranslationStatus = (entryId, historyData) => {
|
|
576
576
|
if (!Array.isArray(historyData) || historyData.length === 0) {
|
|
577
|
-
return "
|
|
577
|
+
return "";
|
|
578
578
|
}
|
|
579
579
|
const matchingItems = historyData.filter((h) => h["element-uid"].includes(entryId));
|
|
580
580
|
if (matchingItems.length === 0) {
|
|
@@ -610,22 +610,26 @@ const getTranslationDate = (entryId, historyData) => {
|
|
|
610
610
|
return latestImportTime > 0 ? formatDate(latestImportTime) : "";
|
|
611
611
|
};
|
|
612
612
|
const getStatusBadgeVariant = (status) => {
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
613
|
+
switch (status) {
|
|
614
|
+
case "translated":
|
|
615
|
+
return "success";
|
|
616
|
+
case "in_translation":
|
|
617
|
+
return "secondary";
|
|
618
|
+
default:
|
|
619
|
+
return "neutral";
|
|
620
|
+
}
|
|
620
621
|
};
|
|
621
622
|
const getStatusDisplayText = (status) => {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
623
|
+
switch (status) {
|
|
624
|
+
case "translated":
|
|
625
|
+
return "Translated";
|
|
626
|
+
case "in_translation":
|
|
627
|
+
return "In Translation";
|
|
628
|
+
case "not_translated":
|
|
629
|
+
return "Not translated";
|
|
630
|
+
default:
|
|
631
|
+
return "n.a.";
|
|
632
|
+
}
|
|
629
633
|
};
|
|
630
634
|
const ContentTypesList = ({
|
|
631
635
|
contentTypes,
|
|
@@ -723,6 +727,8 @@ const EntriesTable = ({
|
|
|
723
727
|
}
|
|
724
728
|
);
|
|
725
729
|
}
|
|
730
|
+
const hasSelectedAll = selectedEntries.size === entries.length && entries.length > 0;
|
|
731
|
+
const checkedType = hasSelectedAll || selectedEntries.size === 0 ? hasSelectedAll : "indeterminate";
|
|
726
732
|
return /* @__PURE__ */ jsx(
|
|
727
733
|
Box,
|
|
728
734
|
{
|
|
@@ -739,8 +745,7 @@ const EntriesTable = ({
|
|
|
739
745
|
/* @__PURE__ */ jsx(Th, { style: { width: "50px" }, children: /* @__PURE__ */ jsx(
|
|
740
746
|
Checkbox,
|
|
741
747
|
{
|
|
742
|
-
checked:
|
|
743
|
-
indeterminate: selectedEntries.size > 0 && selectedEntries.size < entries.length,
|
|
748
|
+
checked: checkedType,
|
|
744
749
|
onCheckedChange: onSelectAll
|
|
745
750
|
}
|
|
746
751
|
) }),
|
|
@@ -840,6 +845,20 @@ const EntryRow = ({
|
|
|
840
845
|
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { variant: "omega", style: { color: themeColors.primaryText }, children: date }) })
|
|
841
846
|
] });
|
|
842
847
|
};
|
|
848
|
+
const fetchContentEntriesData = async function(selectedContentType) {
|
|
849
|
+
if (!selectedContentType) {
|
|
850
|
+
return [];
|
|
851
|
+
}
|
|
852
|
+
try {
|
|
853
|
+
const { get } = getFetchClient();
|
|
854
|
+
const response = await get(`/content-manager/collection-types/${selectedContentType}`);
|
|
855
|
+
if (response.data?.results && Array.isArray(response.data.results))
|
|
856
|
+
return response.data.results;
|
|
857
|
+
} catch (error) {
|
|
858
|
+
console.error("Failed to fetch entries:", error);
|
|
859
|
+
}
|
|
860
|
+
return [];
|
|
861
|
+
};
|
|
843
862
|
const BulkTranslationMenu = ({
|
|
844
863
|
historyData,
|
|
845
864
|
isLoadingHistory,
|
|
@@ -860,6 +879,12 @@ const BulkTranslationMenu = ({
|
|
|
860
879
|
const response = await get("/content-manager/content-types");
|
|
861
880
|
const types = filterAndTransformContentTypes(response.data.data);
|
|
862
881
|
setContentTypes(types);
|
|
882
|
+
if (types.length > 0) {
|
|
883
|
+
setSelectedEntries(/* @__PURE__ */ new Set());
|
|
884
|
+
setSelectedContentType(types[0].uid);
|
|
885
|
+
const data = await fetchContentEntriesData(types[0].uid);
|
|
886
|
+
setEntries(data);
|
|
887
|
+
}
|
|
863
888
|
} catch (error) {
|
|
864
889
|
console.error("Failed to fetch content types:", error);
|
|
865
890
|
} finally {
|
|
@@ -867,18 +892,15 @@ const BulkTranslationMenu = ({
|
|
|
867
892
|
}
|
|
868
893
|
};
|
|
869
894
|
fetchContentTypes();
|
|
870
|
-
}, [setIsLoadingContentTypes, setContentTypes]);
|
|
895
|
+
}, [setIsLoadingContentTypes, setContentTypes, setSelectedContentType, setEntries, setSelectedEntries]);
|
|
871
896
|
const fetchContentEntries = function(selectedContentType2) {
|
|
872
897
|
if (!selectedContentType2) {
|
|
873
898
|
return;
|
|
874
899
|
}
|
|
875
900
|
setIsLoadingEntries(true);
|
|
876
|
-
|
|
877
|
-
setEntries(
|
|
901
|
+
fetchContentEntriesData(selectedContentType2).then((data) => {
|
|
902
|
+
setEntries(data);
|
|
878
903
|
setSelectedEntries(/* @__PURE__ */ new Set());
|
|
879
|
-
}).catch((error) => {
|
|
880
|
-
console.error("Failed to fetch entries:", error);
|
|
881
|
-
setEntries([]);
|
|
882
904
|
}).finally(() => setIsLoadingEntries(false));
|
|
883
905
|
};
|
|
884
906
|
const selectedContentTypeData = useMemo(
|
|
@@ -911,6 +933,9 @@ const BulkTranslationMenu = ({
|
|
|
911
933
|
setSelectedEntries(/* @__PURE__ */ new Set());
|
|
912
934
|
onTranslationComplete?.();
|
|
913
935
|
};
|
|
936
|
+
if (contentTypes.length === 0) {
|
|
937
|
+
return /* @__PURE__ */ jsx(Box, { paddingTop: 4, paddingBottom: 4, style: { overflow: "hidden", display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ jsx(Typography, { variant: "omega", paddingBottom: 3, style: { fontWeight: "bold" }, children: "No content types available." }) });
|
|
938
|
+
}
|
|
914
939
|
return /* @__PURE__ */ jsx(Box, { paddingTop: 4, paddingBottom: 4, style: { overflow: "hidden", display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ jsxs(Box, { style: { flex: 1, display: "flex", gap: "16px", overflow: "hidden" }, children: [
|
|
915
940
|
/* @__PURE__ */ jsx(
|
|
916
941
|
ContentTypesList,
|
|
@@ -767,7 +767,7 @@ const index = {
|
|
|
767
767
|
defaultMessage: "translationstudio Settings"
|
|
768
768
|
},
|
|
769
769
|
Component: async () => {
|
|
770
|
-
const { App } = await import("./App-
|
|
770
|
+
const { App } = await import("./App-DQUxEmfa.mjs");
|
|
771
771
|
return App;
|
|
772
772
|
}
|
|
773
773
|
});
|
|
@@ -779,7 +779,7 @@ const index = {
|
|
|
779
779
|
defaultMessage: "translationstudio Dashboard"
|
|
780
780
|
},
|
|
781
781
|
Component: async () => {
|
|
782
|
-
const { HistoryPage } = await import("./HistoryPage-
|
|
782
|
+
const { HistoryPage } = await import("./HistoryPage-Cwm3HJc9.mjs");
|
|
783
783
|
return HistoryPage;
|
|
784
784
|
}
|
|
785
785
|
});
|
|
@@ -768,7 +768,7 @@ const index = {
|
|
|
768
768
|
defaultMessage: "translationstudio Settings"
|
|
769
769
|
},
|
|
770
770
|
Component: async () => {
|
|
771
|
-
const { App } = await Promise.resolve().then(() => require("./App-
|
|
771
|
+
const { App } = await Promise.resolve().then(() => require("./App-5ldte7Ku.js"));
|
|
772
772
|
return App;
|
|
773
773
|
}
|
|
774
774
|
});
|
|
@@ -780,7 +780,7 @@ const index = {
|
|
|
780
780
|
defaultMessage: "translationstudio Dashboard"
|
|
781
781
|
},
|
|
782
782
|
Component: async () => {
|
|
783
|
-
const { HistoryPage } = await Promise.resolve().then(() => require("./HistoryPage-
|
|
783
|
+
const { HistoryPage } = await Promise.resolve().then(() => require("./HistoryPage-C1EG7XIt.js"));
|
|
784
784
|
return HistoryPage;
|
|
785
785
|
}
|
|
786
786
|
});
|
package/dist/admin/index.js
CHANGED
package/dist/admin/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type TranslationStatus = 'translated' | 'in_translation' | 'not_translated' | '
|
|
1
|
+
export type TranslationStatus = 'translated' | 'in_translation' | 'not_translated' | '';
|
|
2
2
|
export declare const getTranslationStatus: (entryId: string, historyData: any[]) => TranslationStatus;
|
|
3
3
|
export declare const getTargetLanguages: (entryId: string, historyData: any[]) => string[];
|
|
4
4
|
export declare const getTranslationDate: (entryId: string, historyData: any[]) => string;
|