@translationstudio/translationstudio-strapi-extension 2.0.2 → 4.0.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.
Files changed (46) hide show
  1. package/README.md +1 -1
  2. package/dist/Types.d.ts +36 -0
  3. package/dist/_chunks/App-BR-y9Q87.js +331 -0
  4. package/dist/_chunks/App-Cc3EklWX.mjs +331 -0
  5. package/dist/_chunks/HistoryPage-BG_RchOk.js +1057 -0
  6. package/dist/_chunks/HistoryPage-CSMW8AED.mjs +1057 -0
  7. package/dist/_chunks/index-B9kFLfY3.js +834 -0
  8. package/dist/_chunks/index-ChM8Lw4L.mjs +835 -0
  9. package/dist/admin/index.js +2 -344
  10. package/dist/admin/index.mjs +2 -344
  11. package/dist/admin/src/components/BulkTranslationMenu.d.ts +3 -0
  12. package/dist/admin/src/components/BulkTranslationPanel.d.ts +3 -0
  13. package/dist/admin/src/components/EntryHistory.d.ts +3 -0
  14. package/dist/admin/src/components/HistoryIcon.d.ts +2 -0
  15. package/dist/admin/src/components/HistoryMenu.d.ts +2 -0
  16. package/dist/admin/src/components/LoadingSpinner.d.ts +4 -0
  17. package/dist/admin/src/components/SettingsIcon.d.ts +2 -0
  18. package/dist/admin/src/components/TranslationstudioLogo.d.ts +2 -0
  19. package/dist/admin/src/components/utils/alertUtils.d.ts +13 -0
  20. package/dist/admin/src/components/utils/dateUtils.d.ts +1 -0
  21. package/dist/admin/src/components/utils/emailUtils.d.ts +2 -0
  22. package/dist/admin/src/components/utils/entryUtils.d.ts +2 -0
  23. package/dist/admin/src/components/utils/filterAndTransformContentTypes.d.ts +2 -0
  24. package/dist/admin/src/components/utils/formatDate.d.ts +1 -0
  25. package/dist/admin/src/components/utils/getEntryHelper.d.ts +3 -0
  26. package/dist/admin/src/components/utils/handleHistoryResponse.d.ts +5 -0
  27. package/dist/admin/src/components/utils/historyDataUtils.d.ts +13 -0
  28. package/dist/admin/src/components/utils/historyStatusUtils.d.ts +7 -0
  29. package/dist/admin/src/components/utils/searchUtils.d.ts +2 -0
  30. package/dist/admin/src/components/utils/sortUtils.d.ts +9 -0
  31. package/dist/admin/src/components/utils/statusHelper.d.ts +6 -0
  32. package/dist/admin/src/components/utils/theme.d.ts +15 -0
  33. package/dist/admin/src/components/utils/translationUtils.d.ts +5 -0
  34. package/dist/admin/src/components/utils/useDebounce.d.ts +1 -0
  35. package/dist/admin/src/pages/HistoryPage.d.ts +2 -0
  36. package/dist/server/index.js +50 -29
  37. package/dist/server/index.mjs +50 -29
  38. package/dist/server/src/controllers/controller.d.ts +1 -1
  39. package/dist/server/src/controllers/index.d.ts +1 -1
  40. package/dist/server/src/index.d.ts +2 -4
  41. package/dist/server/src/services/functions/importData/transformFieldsToData.d.ts +1 -1
  42. package/dist/server/src/services/index.d.ts +1 -3
  43. package/dist/server/src/services/service.d.ts +1 -3
  44. package/package.json +23 -21
  45. package/dist/_chunks/App-C5dxwMbx.js +0 -342
  46. package/dist/_chunks/App-DxAbaDu8.mjs +0 -342
@@ -0,0 +1,835 @@
1
+ import { useRef, useEffect, useState, useMemo } from "react";
2
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
+ import { Cog, ChevronUp, ChevronDown, NumberList } from "@strapi/icons";
4
+ import { Box, Button, Typography, Table, Thead, Tr, Th, Tbody, Td, Badge, Alert, Radio, Checkbox, TextInput, DatePicker } from "@strapi/design-system";
5
+ import { getFetchClient, unstable_useContentManagerContext } from "@strapi/strapi/admin";
6
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
7
+ const v = glob[path];
8
+ if (v) {
9
+ return typeof v === "function" ? v() : Promise.resolve(v);
10
+ }
11
+ return new Promise((_, reject) => {
12
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
13
+ reject.bind(
14
+ null,
15
+ new Error(
16
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
17
+ )
18
+ )
19
+ );
20
+ });
21
+ };
22
+ const PLUGIN_ID = "translationstudio";
23
+ const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
24
+ const Initializer = ({ setPlugin }) => {
25
+ const ref = useRef(setPlugin);
26
+ useEffect(() => {
27
+ ref.current(PLUGIN_ID);
28
+ }, []);
29
+ return null;
30
+ };
31
+ const isDarkMode = () => {
32
+ if (typeof window === "undefined") {
33
+ return false;
34
+ }
35
+ try {
36
+ const strapiTheme = localStorage.getItem("STRAPI_THEME");
37
+ if (strapiTheme === "dark") {
38
+ return true;
39
+ } else if (strapiTheme === "light") {
40
+ return false;
41
+ }
42
+ } catch (error) {
43
+ console.warn("Could not access localStorage for theme detection:", error);
44
+ }
45
+ if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
46
+ return true;
47
+ }
48
+ return false;
49
+ };
50
+ const getThemeColors = () => {
51
+ const isDark = isDarkMode();
52
+ return {
53
+ // background
54
+ primaryBackground: isDark ? "#212134" : "#ffffff",
55
+ secondaryBackground: isDark ? "#32324d" : "#f6f6f9",
56
+ cardBackground: isDark ? "#212134" : "#ffffff",
57
+ // text
58
+ primaryText: isDark ? "#ffffff" : "#32324d",
59
+ secondaryText: isDark ? "#a5a5ba" : "#666687",
60
+ mutedText: isDark ? "#8e8ea9" : "#8e8ea9",
61
+ // border
62
+ border: isDark ? "#4a4a6a" : "#dcdce4",
63
+ success: "#5cb85c",
64
+ warning: "#f0ad4e",
65
+ danger: "#d9534f",
66
+ info: "#5bc0de"
67
+ };
68
+ };
69
+ const useThemeMode = () => {
70
+ const [isDark, setIsDark] = useState(isDarkMode());
71
+ useEffect(() => {
72
+ const handleStorageChange = (e) => {
73
+ if (e.key === "STRAPI_THEME") {
74
+ setIsDark(isDarkMode());
75
+ }
76
+ };
77
+ const handleSystemThemeChange = (e) => {
78
+ const strapiTheme = localStorage.getItem("STRAPI_THEME");
79
+ if (!strapiTheme || strapiTheme === "system") {
80
+ setIsDark(e.matches);
81
+ }
82
+ };
83
+ window.addEventListener("storage", handleStorageChange);
84
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
85
+ mediaQuery.addEventListener("change", handleSystemThemeChange);
86
+ return () => {
87
+ window.removeEventListener("storage", handleStorageChange);
88
+ mediaQuery.removeEventListener("change", handleSystemThemeChange);
89
+ };
90
+ }, []);
91
+ return isDark;
92
+ };
93
+ const logoSvg = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Ebene_1'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20447.49%20582.57'%3e%3cdefs%3e%3cstyle%3e.cls-1{fill:%23e94642;}.cls-2{fill:%23a51d78;}%3c/style%3e%3c/defs%3e%3cpath%20class='cls-2'%20d='M333.63,260.39c11.39,9.77,23.98,22.51,35.71,38.54,29.12,39.79,43.43,86.82,42.53,139.8-.42,24.59-5.02,44.98-13.68,60.58-.81,1.47-1.67,2.92-2.55,4.31-1.72,2.74-3.61,5.39-5.61,7.89-4.83,6.04-10.5,11.44-16.87,16.04-1.25,.9-2.54,1.78-3.84,2.63-2.59,1.68-5.33,3.26-8.14,4.7-4.19,2.15-8.65,4.05-13.26,5.65-3.06,1.06-6.24,2.01-9.46,2.81-9.67,2.42-19.9,3.64-30.38,3.64-28.34,0-54.1-9.14-72.52-25.72-21.07-18.97-31.75-46.53-31.75-81.93,0-44.1,17.26-79.22,46.16-93.95,22.18-11.3,43.5-23.09,60.57-42.86,10.64-12.33,18.32-26.29,23.09-42.13m-20.69-55.64c-4.76,0-8.97,2.99-8.97,8.16h0c1.43,61.87-32.34,81.5-70.16,100.77-38.88,19.82-65.58,64.35-65.58,125.65,0,98.01,69.45,143.23,139.85,143.23,13.2,0,26.35-1.54,39.01-4.7,4.22-1.05,8.38-2.29,12.47-3.7,6.14-2.13,12.11-4.66,17.87-7.62,3.84-1.97,7.58-4.13,11.21-6.48,1.82-1.17,3.6-2.4,5.36-3.66,8.78-6.35,16.81-13.89,23.83-22.67,2.81-3.51,5.45-7.22,7.91-11.13,1.23-1.96,2.42-3.96,3.56-6.02,11.41-20.57,17.61-46.2,18.14-77.24,2.4-140.84-91.02-211.84-129.3-233.29-1.46-.82-3.22-1.29-5.2-1.29h0Z'/%3e%3cpath%20class='cls-1'%20d='M139.41,35.58c28.34,0,54.1,9.14,72.52,25.72,21.07,18.97,31.75,46.53,31.75,81.93,0,44.1-17.26,79.22-46.16,93.95-22.18,11.3-43.5,23.09-60.57,42.86-10.64,12.33-18.32,26.29-23.09,42.13-11.39-9.77-23.98-22.51-35.71-38.54-29.12-39.79-43.43-86.82-42.53-139.8,.42-24.59,5.02-44.98,13.68-60.58,.81-1.46,1.67-2.91,2.55-4.31,1.72-2.74,3.61-5.4,5.61-7.89,4.83-6.04,10.5-11.44,16.87-16.04,1.25-.9,2.54-1.78,3.84-2.63,2.59-1.68,5.33-3.26,8.14-4.7,4.19-2.15,8.65-4.05,13.26-5.65,3.06-1.06,6.25-2.01,9.46-2.81,9.67-2.42,19.9-3.64,30.38-3.64m0-35.58c-13.2,0-26.35,1.54-39.01,4.7-4.22,1.05-8.38,2.29-12.47,3.7-6.14,2.13-12.11,4.66-17.87,7.62-3.84,1.97-7.58,4.13-11.21,6.48-1.82,1.17-3.6,2.4-5.36,3.66-8.78,6.35-16.81,13.89-23.83,22.67-2.81,3.51-5.45,7.22-7.91,11.13-1.23,1.96-2.42,3.96-3.56,6.02C6.78,86.56,.57,112.19,.05,143.23c-2.4,140.84,91.02,211.84,129.3,233.29,1.46,.82,3.22,1.29,5.2,1.29,4.76,0,8.97-2.99,8.97-8.16h0c-1.43-61.87,32.34-81.5,70.16-100.77,38.88-19.82,65.58-64.35,65.58-125.65C279.27,45.22,209.82,0,139.41,0h0Z'/%3e%3c/svg%3e";
94
+ const PluginIcon = () => /* @__PURE__ */ jsx("img", { src: logoSvg, alt: "Translation Studio Logo", width: 20, height: 20 });
95
+ const SettingsIcon = () => {
96
+ useThemeMode();
97
+ return /* @__PURE__ */ jsxs("span", { style: { position: "relative" }, children: [
98
+ /* @__PURE__ */ jsx(PluginIcon, {}),
99
+ /* @__PURE__ */ jsx(Cog, { style: {
100
+ position: "absolute",
101
+ right: "0px",
102
+ bottom: "0px",
103
+ width: "12px",
104
+ height: "12px"
105
+ } })
106
+ ] });
107
+ };
108
+ const formatDate = (utcTimestamp) => {
109
+ try {
110
+ const date = new Date(utcTimestamp);
111
+ const day = date.getDate().toString().padStart(2, "0");
112
+ const month = (date.getMonth() + 1).toString().padStart(2, "0");
113
+ const year = date.getFullYear();
114
+ return `${day}.${month}.${year}`;
115
+ } catch (error) {
116
+ return "";
117
+ }
118
+ };
119
+ const getHistoryStatus = (timeInTranslation, timeImported) => {
120
+ if (timeInTranslation < timeImported) {
121
+ return { text: "Translated", variant: "success" };
122
+ }
123
+ if (timeInTranslation > timeImported) {
124
+ return { text: "In translation", variant: "warning" };
125
+ }
126
+ return { text: "", variant: "neutral" };
127
+ };
128
+ const getCombinedStatus = (allStatuses) => {
129
+ if (allStatuses.some((s) => s.text === "In translation")) {
130
+ return { text: "In translation", variant: "warning" };
131
+ }
132
+ if (allStatuses.some((s) => s.text === "Translated")) {
133
+ return { text: "Translated", variant: "success" };
134
+ }
135
+ return { text: "", variant: "neutral" };
136
+ };
137
+ const groupHistoryData = (historyData) => {
138
+ if (!Array.isArray(historyData) || historyData.length === 0) return [];
139
+ const grouped = historyData.reduce(
140
+ (acc, item) => {
141
+ const key = item["element-uid"];
142
+ if (!acc[key]) {
143
+ acc[key] = {
144
+ ...item,
145
+ targetLanguages: [item["target-language"]],
146
+ allStatuses: [getHistoryStatus(item["time-intranslation"], item["time-imported"])],
147
+ latestTimeImported: item["time-imported"],
148
+ latestTimeInTranslation: item["time-intranslation"]
149
+ };
150
+ } else {
151
+ if (!acc[key].targetLanguages.includes(item["target-language"])) {
152
+ acc[key].targetLanguages.push(item["target-language"]);
153
+ }
154
+ acc[key].allStatuses.push(
155
+ getHistoryStatus(item["time-intranslation"], item["time-imported"])
156
+ );
157
+ if (item["time-imported"] > acc[key].latestTimeImported) {
158
+ acc[key].latestTimeImported = item["time-imported"];
159
+ acc[key]["time-imported"] = item["time-imported"];
160
+ }
161
+ if (item["time-intranslation"] > acc[key].latestTimeInTranslation) {
162
+ acc[key].latestTimeInTranslation = item["time-intranslation"];
163
+ acc[key]["time-intranslation"] = item["time-intranslation"];
164
+ }
165
+ }
166
+ return acc;
167
+ },
168
+ {}
169
+ );
170
+ return Object.values(grouped).map((item) => ({
171
+ ...item,
172
+ targetLanguages: item.targetLanguages.sort(),
173
+ combinedStatus: getCombinedStatus(item.allStatuses)
174
+ }));
175
+ };
176
+ const handleHistoryResponse = (data) => {
177
+ if (data && typeof data === "object" && data.message === "License cannot be used") {
178
+ return {
179
+ isError: true,
180
+ errorMessage: "License cannot be used. Please check your license configuration.",
181
+ historyData: []
182
+ };
183
+ }
184
+ return {
185
+ isError: false,
186
+ historyData: Array.isArray(data) ? data : []
187
+ };
188
+ };
189
+ const LoadingState = () => /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsx(Typography, { variant: "omega", children: "Loading entry history..." }) });
190
+ const EmptyState = () => /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsx(Typography, { variant: "omega", style: { color: "#666" }, children: "No translation history available for this entry." }) });
191
+ const HistoryTable = ({ data }) => /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Table, { colCount: 3, rowCount: data.length + 1, children: [
192
+ /* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
193
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", fontWeight: "bold", children: "Target" }) }),
194
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", fontWeight: "bold", children: "Date" }) }),
195
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", fontWeight: "bold", children: "Status" }) })
196
+ ] }) }),
197
+ /* @__PURE__ */ jsx(Tbody, { children: data.map((item, index2) => /* @__PURE__ */ jsx(HistoryRow, { item }, `${item["element-uid"]}-${index2}`)) })
198
+ ] }) });
199
+ const HistoryRow = ({ item }) => /* @__PURE__ */ jsxs(Tr, { children: [
200
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { variant: "omega", children: item.targetLanguages.map((lang) => lang.toUpperCase()).join(", ") }) }),
201
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { variant: "omega", children: formatDate(item["time-intranslation"]) }) }),
202
+ /* @__PURE__ */ jsx(Td, { children: item.combinedStatus.text && /* @__PURE__ */ jsx(Badge, { variant: item.combinedStatus.variant, children: item.combinedStatus.text }) })
203
+ ] });
204
+ const ToggleButton = ({
205
+ isExpanded,
206
+ isLoading,
207
+ onClick
208
+ }) => /* @__PURE__ */ jsx(
209
+ Button,
210
+ {
211
+ variant: "tertiary",
212
+ onClick,
213
+ startIcon: isExpanded ? /* @__PURE__ */ jsx(ChevronUp, {}) : /* @__PURE__ */ jsx(ChevronDown, {}),
214
+ loading: isLoading,
215
+ style: { width: "100%", justifyContent: "center" },
216
+ children: /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children: "View translation history" })
217
+ }
218
+ );
219
+ const EntryHistory = ({ entryUid }) => {
220
+ const [isExpanded, setIsExpanded] = useState(false);
221
+ const [historyData, setHistoryData] = useState([]);
222
+ const [isLoading, setIsLoading] = useState(false);
223
+ const [hasLoaded, setHasLoaded] = useState(false);
224
+ const [error, setError] = useState(null);
225
+ const { get } = getFetchClient();
226
+ const groupedHistoryData = useMemo(() => {
227
+ return groupHistoryData(historyData);
228
+ }, [historyData]);
229
+ const fetchHistory = async () => {
230
+ setIsLoading(true);
231
+ setError(null);
232
+ try {
233
+ const response = await get("/translationstudio/history");
234
+ const result = handleHistoryResponse(response.data);
235
+ if (result.isError) {
236
+ setError(result.errorMessage || "Failed to fetch translation history.");
237
+ setHistoryData([]);
238
+ } else {
239
+ setHistoryData(result.historyData);
240
+ setHasLoaded(true);
241
+ }
242
+ } catch (error2) {
243
+ console.error("Failed to fetch history:", error2);
244
+ setError("Failed to fetch translation history.");
245
+ setHistoryData([]);
246
+ } finally {
247
+ setIsLoading(false);
248
+ }
249
+ };
250
+ const handleToggle = async () => {
251
+ if (!isExpanded && !hasLoaded) {
252
+ await fetchHistory();
253
+ }
254
+ setIsExpanded(!isExpanded);
255
+ };
256
+ if (!entryUid) {
257
+ return null;
258
+ }
259
+ const renderContent = () => {
260
+ if (isLoading) {
261
+ return /* @__PURE__ */ jsx(LoadingState, {});
262
+ }
263
+ if (error) {
264
+ return /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsx(Typography, { variant: "beta", textColor: "danger600", children: error }) });
265
+ }
266
+ if (groupedHistoryData.length === 0) {
267
+ return /* @__PURE__ */ jsx(EmptyState, {});
268
+ }
269
+ return /* @__PURE__ */ jsx(HistoryTable, { data: groupedHistoryData });
270
+ };
271
+ return /* @__PURE__ */ jsxs(Box, { paddingTop: 4, style: { width: "100%" }, children: [
272
+ /* @__PURE__ */ jsx(ToggleButton, { isExpanded, isLoading, onClick: handleToggle }),
273
+ isExpanded && /* @__PURE__ */ jsx(Box, { paddingTop: 4, children: renderContent() })
274
+ ] });
275
+ };
276
+ const EMAIL_STORAGE_KEY = "translationstudio-email";
277
+ const getStoredEmail = () => {
278
+ return localStorage.getItem(EMAIL_STORAGE_KEY) || "";
279
+ };
280
+ const setStoredEmail = (email) => {
281
+ if (email) {
282
+ localStorage.setItem(EMAIL_STORAGE_KEY, email);
283
+ } else {
284
+ localStorage.removeItem(EMAIL_STORAGE_KEY);
285
+ }
286
+ };
287
+ const validateDueDate = (date) => {
288
+ const timestamp = date.getTime();
289
+ return timestamp < Date.now() ? 0 : timestamp;
290
+ };
291
+ const determineEntryName$1 = (fetchedEntryData, contentTypeDisplayName) => {
292
+ if (!fetchedEntryData) return "Untitled";
293
+ const commonTitleFields = ["title", "name", "headline"];
294
+ for (const field of commonTitleFields) {
295
+ const key = Object.keys(fetchedEntryData).find((k) => k.toLowerCase() === field);
296
+ if (key && typeof fetchedEntryData[key] === "string" && fetchedEntryData[key].trim()) {
297
+ return fetchedEntryData[key];
298
+ }
299
+ }
300
+ const excludedFields = [
301
+ "id",
302
+ "createdAt",
303
+ "updatedAt",
304
+ "publishedAt",
305
+ "locale",
306
+ "createdBy",
307
+ "updatedBy",
308
+ "documentId",
309
+ "provider",
310
+ "resetPasswordToken",
311
+ "confirmationToken",
312
+ "password",
313
+ "email",
314
+ "slug",
315
+ "link",
316
+ "url",
317
+ "image",
318
+ "file",
319
+ "media"
320
+ ];
321
+ for (const [key, value] of Object.entries(fetchedEntryData)) {
322
+ if (!excludedFields.includes(key) && typeof value === "string" && value.trim()) {
323
+ return value;
324
+ }
325
+ }
326
+ return `${contentTypeDisplayName} Entry`;
327
+ };
328
+ const createTranslationPayload = (selectedLang, dueDate, isEmail, isMachineTranslation, email, isUrgent, contentTypeDisplayName, entryUid, entryName) => {
329
+ const translationObjects = selectedLang.targets.map(
330
+ (targetLang) => ({
331
+ source: selectedLang.source,
332
+ target: targetLang,
333
+ connector: selectedLang.connector
334
+ })
335
+ );
336
+ return {
337
+ duedate: dueDate,
338
+ email: isEmail && !isMachineTranslation ? email : "",
339
+ urgent: isMachineTranslation ? true : isUrgent,
340
+ "project-name": contentTypeDisplayName,
341
+ translations: translationObjects,
342
+ entry: {
343
+ uid: entryUid,
344
+ name: entryName
345
+ }
346
+ };
347
+ };
348
+ const getSubmitLabel = (selectedEntriesCount, isUrgent, isMachineTranslation) => {
349
+ const entryText = selectedEntriesCount === 1 ? "entry" : "entries";
350
+ if (isMachineTranslation) return `Translate ${selectedEntriesCount} ${entryText} with AI`;
351
+ else if (isUrgent) return `Translate ${selectedEntriesCount} ${entryText} immediately`;
352
+ else return `Request translation for ${selectedEntriesCount} ${entryText}`;
353
+ };
354
+ const createEntryUid$1 = (contentType, entryId) => {
355
+ return contentType.kind === "collectionType" ? `${contentType.uid}#${entryId}` : contentType.uid;
356
+ };
357
+ const createSuccessMessage = (successCount, totalCount) => {
358
+ if (successCount === totalCount) {
359
+ return {
360
+ type: "success",
361
+ message: `Successfully requested translation for all ${successCount} entries`
362
+ };
363
+ } else {
364
+ const errorCount = totalCount - successCount;
365
+ return {
366
+ type: "success",
367
+ message: `Translation requested for ${successCount} entries. ${errorCount} failed.`
368
+ };
369
+ }
370
+ };
371
+ const createErrorMessage = (totalCount) => {
372
+ return {
373
+ type: "danger",
374
+ message: `Failed to request translation for all ${totalCount} entries`
375
+ };
376
+ };
377
+ const createGeneralErrorMessage = () => {
378
+ return {
379
+ type: "danger",
380
+ message: "Error processing bulk translation request"
381
+ };
382
+ };
383
+ const determineEntryName = (fetchedEntryData, contentTypeDisplayName, entryId) => {
384
+ if (!fetchedEntryData) return "Untitled";
385
+ const commonTitleFields = ["title", "name", "headline"];
386
+ for (const field of commonTitleFields) {
387
+ const key = Object.keys(fetchedEntryData).find((k) => k.toLowerCase() === field);
388
+ if (key && typeof fetchedEntryData[key] === "string" && fetchedEntryData[key].trim()) {
389
+ return fetchedEntryData[key];
390
+ }
391
+ }
392
+ const excludedFields = [
393
+ "id",
394
+ "createdAt",
395
+ "updatedAt",
396
+ "publishedAt",
397
+ "locale",
398
+ "createdBy",
399
+ "updatedBy",
400
+ "documentId",
401
+ "provider",
402
+ "resetPasswordToken",
403
+ "confirmationToken",
404
+ "password",
405
+ "email",
406
+ "slug",
407
+ "link",
408
+ "url",
409
+ "image",
410
+ "file",
411
+ "media"
412
+ ];
413
+ for (const [key, value] of Object.entries(fetchedEntryData)) {
414
+ if (!excludedFields.includes(key) && typeof value === "string" && value.trim()) {
415
+ return value;
416
+ }
417
+ }
418
+ return `${contentTypeDisplayName} #${entryId}`;
419
+ };
420
+ const createEntryUid = (isCollectionType, model, id) => {
421
+ return isCollectionType ? `${model}#${id}` : model;
422
+ };
423
+ const LoadingSpinner = () => /* @__PURE__ */ jsxs(Box, { paddingBottom: 4, style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
424
+ /* @__PURE__ */ jsx(
425
+ Box,
426
+ {
427
+ style: {
428
+ width: "16px",
429
+ height: "16px",
430
+ border: "2px solid #f3f3f3",
431
+ borderTop: "2px solid #3498db",
432
+ borderRadius: "50%",
433
+ animation: "spin 1s linear infinite"
434
+ }
435
+ }
436
+ ),
437
+ /* @__PURE__ */ jsx(Typography, { children: "Loading translation settings..." }),
438
+ /* @__PURE__ */ jsx("style", { children: `
439
+ @keyframes spin {
440
+ 0% { transform: rotate(0deg); }
441
+ 100% { transform: rotate(360deg); }
442
+ }
443
+ ` })
444
+ ] });
445
+ const ErrorMessage = ({ message }) => /* @__PURE__ */ jsx(Box, { paddingBottom: 4, children: /* @__PURE__ */ jsx(Typography, { children: message }) });
446
+ const translationstudioIcon = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Ebene_1'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201444.47%20635.72'%3e%3cdefs%3e%3cstyle%3e.cls-1{fill:%23e94642;}.cls-2{fill:%23231f20;}.cls-3{fill:%23a51d78;}%3c/style%3e%3c/defs%3e%3cpath%20class='cls-2'%20d='M1151.68,294.37c34.28,0,50.11,19.74,50.11,59.01v56.4c0,6.94-3.91,10.85-10.85,10.85h-2.6c-6.94,0-10.84-3.9-10.84-10.85v-54.45c0-27.12-10.41-39.91-33.41-39.91s-32.97,15.4-32.97,42.74v51.63c0,6.94-3.91,10.85-10.85,10.85h-2.6c-6.94,0-10.85-3.9-10.85-10.85v-102.39c0-6.94,3.91-10.85,10.85-10.85h2.6c6.94,0,10.85,3.91,10.85,10.85v12.34c5.64-14.39,19.73-25.36,40.56-25.36h0Z'/%3e%3cpath%20class='cls-2'%20d='M0,313.78v55.76c0,37.96,14.53,51.2,46.42,51.2h0c1.96,0,4.12-.03,6.29-.22,6.9-.65,9.8-4.45,9.11-11.07-.61-5.88-4.99-8.24-11.71-8.24-18.88,0-25.6-8.9-25.6-34.49v-52.94h25.81c6.94,0,10.85-3.47,10.85-9.54s-3.9-9.33-10.85-9.33H24.51v-15.83c0-7.59-4.34-11.28-11.93-9.55l-3.04,.65c-6.29,1.3-9.54,5.21-9.54,11.71v31.89Z'/%3e%3cpath%20class='cls-2'%20d='M139.49,295.02c7.38,0,11.06,4.77,10.2,11.71l-.22,1.74c-.65,6.94-4.77,9.54-11.93,9.54-20.39,.43-30.16,15.19-30.16,41.22v50.55c0,6.94-3.9,10.85-10.85,10.85h-2.6c-6.94,0-10.85-3.9-10.85-10.85v-102.39c0-6.94,3.9-10.85,10.85-10.85h2.6c6.94,0,10.85,3.69,10.85,10.41v10.41c3.91-11.07,13.89-22.34,32.1-22.34h0Z'/%3e%3cpath%20class='cls-2'%20d='M259.67,358.59c0-27.12-15.84-43.82-38.83-43.82s-38.4,16.49-38.4,43.82,15.62,44.04,38.83,44.04,38.4-16.7,38.4-44.04m-101.53,0c0-42.74,26.03-64.43,56.84-64.43,19.52,0,36.88,9.54,44.04,26.69v-13.45c0-6.94,3.9-10.85,10.85-10.85h2.6c6.94,0,10.85,3.9,10.85,10.85v102.18c0,6.94-3.9,10.85-10.85,10.85h-2.6c-6.94,0-10.85-3.9-10.85-10.85v-12.58c-6.94,16.7-24.51,26.47-43.82,26.47-30.81,0-57.06-21.91-57.06-64.87'/%3e%3cpath%20class='cls-2'%20d='M380.06,294.37c34.28,0,50.11,19.74,50.11,59.01v56.4c0,6.94-3.91,10.85-10.85,10.85h-2.6c-6.94,0-10.85-3.9-10.85-10.85v-54.45c0-27.12-10.41-39.91-33.41-39.91s-32.98,15.4-32.98,42.74v51.63c0,6.94-3.9,10.85-10.85,10.85h-2.6c-6.94,0-10.85-3.9-10.85-10.85v-102.39c0-6.94,3.91-10.85,10.85-10.85h2.6c6.94,0,10.85,3.91,10.85,10.85v12.34c5.64-14.39,19.73-25.36,40.57-25.36h0Z'/%3e%3cpath%20class='cls-2'%20d='M508.94,422.81c-20.8,0-42.78-8.33-53.19-21.48-4.44-5.61-2.26-11.49,4.99-13.67l2.17-.65c4.75-1.43,8.02-1.28,14.32,4.36,8.65,7.74,20.41,10.61,31.71,10.61,18.05,0,28.81-6.44,28.81-17.36,0-28.63-80.45-5.9-80.45-54.24,0-22.87,23.1-36.01,49.75-36.01,16.09,0,36.22,6.5,47,17.79,5.1,5.33,3.34,11.34-3.68,13.45l-2.17,.65c-5.86,1.76-8.85-.39-14.53-3.84-8.11-4.92-16.87-8.09-26.22-8.09-15.64,0-26.27,5.18-26.27,14.91,0,27.74,81.1,4.51,81.1,54.72,0,23.06-22.28,38.83-53.32,38.83h0Z'/%3e%3cpath%20class='cls-2'%20d='M585.05,409.79v-142.75c0-6.94,3.9-10.85,10.85-10.85h2.82c6.94,0,10.85,3.9,10.85,10.85v142.75c0,6.94-3.91,10.85-10.85,10.85h-2.82c-6.94,0-10.85-3.91-10.85-10.85'/%3e%3cpath%20class='cls-2'%20d='M737.56,358.59c0-27.12-15.84-43.82-38.84-43.82s-38.4,16.49-38.4,43.82,15.62,44.04,38.83,44.04,38.4-16.7,38.4-44.04m-101.53,0c0-42.74,26.03-64.43,56.84-64.43,19.52,0,36.88,9.54,44.04,26.69v-13.45c0-6.94,3.9-10.85,10.85-10.85h2.6c6.94,0,10.85,3.9,10.85,10.85v102.18c0,6.94-3.9,10.85-10.85,10.85h-2.6c-6.94,0-10.85-3.9-10.85-10.85v-12.58c-6.94,16.7-24.51,26.47-43.82,26.47-30.81,0-57.06-21.91-57.06-64.87'/%3e%3cpath%20class='cls-2'%20d='M800.25,315.42v55.76c0,37.96,14.53,51.2,46.42,51.2h0c1.95,0,4.12-.03,6.29-.22,6.89-.65,9.8-4.45,9.11-11.07-.61-5.88-4.99-8.24-11.71-8.24-18.87,0-25.6-8.9-25.6-34.49v-52.94h25.81c6.94,0,10.85-3.47,10.85-9.55s-3.91-9.33-10.85-9.33h-25.81v-15.83c0-7.59-4.34-11.28-11.93-9.54l-3.04,.65c-6.29,1.3-9.55,5.21-9.55,11.71v31.89Z'/%3e%3cpath%20class='cls-2'%20d='M883.72,409.79v-102.4c0-6.94,3.83-10.85,10.65-10.85h2.77c6.82,0,10.65,3.9,10.65,10.85v102.4c0,6.94-3.83,10.85-10.65,10.85h-2.77c-6.81,0-10.65-3.91-10.65-10.85m-2.05-142.96c0-8.24,6.08-13.02,14.32-13.02,7.59,0,14.32,4.77,14.32,13.02s-6.72,13.02-14.32,13.02c-8.24,0-14.32-4.77-14.32-13.02'/%3e%3cpath%20class='cls-2'%20d='M1036.06,358.59c0-27.12-15.62-43.82-38.62-43.82s-38.4,16.49-38.4,43.82,15.4,44.04,38.61,44.04,38.4-16.7,38.4-44.04m-101.31,0c0-44.69,31.02-64.43,62.69-64.43s62.91,19.74,62.91,64.43-31.02,64.87-62.7,64.87-62.91-19.74-62.91-64.87'/%3e%3cpath%20class='cls-2'%20d='M555.77,635.72c-20.98,0-43.14-8.4-53.65-21.66-4.48-5.66-2.27-11.59,5.03-13.78l2.19-.66c4.79-1.44,8.09-1.29,14.43,4.4,8.73,7.81,20.59,10.69,31.98,10.69,18.2,0,29.05-6.49,29.05-17.5,0-28.88-81.14-5.95-81.14-54.7,0-23.07,23.3-36.31,50.17-36.31,16.23,0,36.53,6.55,47.41,17.94,5.14,5.38,3.37,11.43-3.72,13.56l-2.19,.66c-5.91,1.77-8.92-.39-14.66-3.87-8.18-4.96-17.02-8.16-26.45-8.16-15.78,0-26.5,5.22-26.5,15.04,0,27.98,81.79,4.55,81.79,55.18,0,23.26-22.47,39.16-53.78,39.16h0Z'/%3e%3cpath%20class='cls-2'%20d='M639.98,526.42v56.23c0,38.29,14.66,51.63,46.82,51.63h0c1.97,0,4.16-.03,6.34-.22,6.96-.66,9.89-4.49,9.19-11.16-.61-5.93-5.03-8.31-11.81-8.31-19.03,0-25.82-8.97-25.82-34.79v-53.38h26.03c7,0,10.94-3.5,10.94-9.63s-3.94-9.41-10.94-9.41h-26.03v-15.97c0-7.66-4.38-11.38-12.03-9.63l-3.06,.66c-6.34,1.31-9.63,5.25-9.63,11.81v32.16Z'/%3e%3cpath%20class='cls-2'%20d='M826.59,508.39c7,0,10.94,3.94,10.94,10.94v103.27c0,7-3.94,10.94-10.94,10.94h-2.62c-7,0-10.94-3.94-10.94-10.94v-12.45c-5.69,14.51-19.9,25.57-40.91,25.57-34.57,0-50.54-19.91-50.54-59.51v-56.89c0-7,3.94-10.93,10.94-10.93h2.63c7,0,10.94,3.93,10.94,10.93v54.92c0,27.35,10.5,40.26,33.69,40.26s33.26-15.53,33.26-43.1v-52.07c0-7,3.94-10.93,10.94-10.93h2.62Z'/%3e%3cpath%20class='cls-2'%20d='M967.71,570.31c0-27.35-15.75-44.19-39.16-44.19s-38.72,16.63-38.72,44.19,15.75,44.41,39.16,44.41,38.72-16.85,38.72-44.41m-102.39,0c0-43.1,26.25-64.98,57.32-64.98,19.69,0,37.41,9.63,44.41,26.91v-54.26c0-7,3.94-10.94,10.94-10.94h2.62c7,0,10.94,3.94,10.94,10.94v143.74c0,7-3.94,10.94-10.94,10.94h-2.62c-7,0-10.94-3.94-10.94-10.94v-12.69c-7,16.85-24.72,26.69-44.19,26.69-31.07,0-57.54-22.09-57.54-65.41'/%3e%3cpath%20class='cls-2'%20d='M1023.66,623.38v-103.27c0-7,3.87-10.94,10.74-10.94h2.79c6.87,0,10.74,3.94,10.74,10.94v103.27c0,7-3.87,10.94-10.74,10.94h-2.79c-6.87,0-10.74-3.94-10.74-10.94m-2.07-144.18c0-8.31,6.13-13.13,14.44-13.13,7.66,0,14.44,4.81,14.44,13.13s-6.78,13.13-14.44,13.13c-8.31,0-14.44-4.81-14.44-13.13'/%3e%3cpath%20class='cls-2'%20d='M1177.29,570.31c0-27.35-15.75-44.19-38.94-44.19s-38.72,16.63-38.72,44.19,15.53,44.41,38.94,44.41,38.72-16.85,38.72-44.41m-102.17,0c0-45.07,31.29-64.98,63.23-64.98s63.45,19.91,63.45,64.98-31.29,65.41-63.23,65.41-63.45-19.91-63.45-65.41'/%3e%3cpath%20class='cls-3'%20d='M1366.99,177.21c7.75,6.65,16.32,15.32,24.3,26.23,19.82,27.08,29.56,59.09,28.94,95.13-.29,16.74-3.42,30.61-9.31,41.23-.55,1-1.14,1.99-1.74,2.94-1.17,1.86-2.46,3.67-3.82,5.37-3.28,4.11-7.15,7.78-11.48,10.91-.85,.61-1.73,1.21-2.61,1.79-1.77,1.14-3.63,2.22-5.54,3.2-2.85,1.46-5.89,2.76-9.03,3.84-2.08,.72-4.25,1.36-6.44,1.91-6.58,1.65-13.54,2.48-20.67,2.48-19.29,0-36.82-6.22-49.35-17.5-14.34-12.91-21.61-31.67-21.61-55.75,0-30.01,11.74-53.91,31.41-63.94,15.09-7.69,29.61-15.71,41.22-29.17,7.24-8.39,12.46-17.89,15.72-28.67m-14.08-37.87c-3.24,0-6.11,2.04-6.11,5.55h0c.97,42.1-22.01,55.46-47.74,68.58-26.46,13.49-44.63,43.79-44.63,85.51,0,66.7,47.26,97.47,95.17,97.47,8.98,0,17.93-1.05,26.54-3.2,2.87-.72,5.7-1.56,8.49-2.52,4.18-1.45,8.24-3.17,12.16-5.18,2.61-1.34,5.16-2.81,7.63-4.41,1.24-.8,2.45-1.63,3.65-2.49,5.98-4.32,11.44-9.45,16.21-15.43,1.91-2.39,3.71-4.92,5.39-7.58,.84-1.33,1.65-2.7,2.42-4.1,7.76-14,11.99-31.44,12.35-52.56,1.63-95.85-61.94-144.16-87.99-158.76-.99-.56-2.19-.88-3.54-.88h0Z'/%3e%3cpath%20class='cls-1'%20d='M1234.82,24.21c19.29,0,36.82,6.22,49.35,17.5,14.34,12.91,21.61,31.67,21.61,55.75,0,30.01-11.74,53.91-31.41,63.94-15.09,7.69-29.61,15.71-41.22,29.17-7.24,8.39-12.46,17.89-15.72,28.67-7.75-6.65-16.32-15.32-24.3-26.23-19.82-27.08-29.56-59.09-28.94-95.13,.29-16.74,3.42-30.61,9.31-41.23,.55-1,1.14-1.98,1.74-2.93,1.17-1.86,2.46-3.67,3.82-5.37,3.28-4.11,7.15-7.78,11.48-10.91,.85-.61,1.73-1.21,2.61-1.79,1.77-1.14,3.63-2.22,5.54-3.2,2.85-1.46,5.89-2.76,9.03-3.84,2.08-.72,4.25-1.36,6.44-1.91,6.58-1.65,13.54-2.48,20.67-2.48m0-24.21c-8.98,0-17.93,1.05-26.54,3.2-2.87,.72-5.7,1.56-8.49,2.52-4.18,1.45-8.24,3.17-12.16,5.18-2.61,1.34-5.16,2.81-7.63,4.41-1.24,.8-2.45,1.63-3.65,2.49-5.98,4.32-11.44,9.45-16.21,15.43-1.91,2.39-3.71,4.92-5.39,7.58-.84,1.33-1.65,2.7-2.42,4.1-7.76,14-11.99,31.44-12.35,52.56-1.63,95.85,61.94,144.16,87.99,158.76,.99,.56,2.19,.88,3.54,.88,3.24,0,6.11-2.04,6.11-5.55h0c-.97-42.1,22.01-55.46,47.74-68.58,26.46-13.49,44.63-43.79,44.63-85.51,0-66.7-47.26-97.47-95.17-97.47h0Z'/%3e%3c/svg%3e";
447
+ const translationstudioWhiteIcon = "data:image/svg+xml,%3csvg%20width='1444.47'%20height='635.72'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%3e%3ctitle%3eLayer%201%3c/title%3e%3cpath%20id='svg_1'%20fill='%23ffffff'%20d='m1151.68,294.37c34.28,0%2050.11,19.74%2050.11,59.01l0,56.4c0,6.94%20-3.91,10.85%20-10.85,10.85l-2.6,0c-6.94,0%20-10.84,-3.9%20-10.84,-10.85l0,-54.45c0,-27.12%20-10.41,-39.91%20-33.41,-39.91s-32.97,15.4%20-32.97,42.74l0,51.63c0,6.94%20-3.91,10.85%20-10.85,10.85l-2.6,0c-6.94,0%20-10.85,-3.9%20-10.85,-10.85l0,-102.39c0,-6.94%203.91,-10.85%2010.85,-10.85l2.6,0c6.94,0%2010.85,3.91%2010.85,10.85l0,12.34c5.64,-14.39%2019.73,-25.36%2040.56,-25.36l0,0l0,-0.01z'%20class='cls-2'/%3e%3cpath%20id='svg_2'%20fill='%23ffffff'%20d='m0,313.78l0,55.76c0,37.96%2014.53,51.2%2046.42,51.2l0,0c1.96,0%204.12,-0.03%206.29,-0.22c6.9,-0.65%209.8,-4.45%209.11,-11.07c-0.61,-5.88%20-4.99,-8.24%20-11.71,-8.24c-18.88,0%20-25.6,-8.9%20-25.6,-34.49l0,-52.94l25.81,0c6.94,0%2010.85,-3.47%2010.85,-9.54s-3.9,-9.33%20-10.85,-9.33l-25.81,0l0,-15.83c0,-7.59%20-4.34,-11.28%20-11.93,-9.55l-3.04,0.65c-6.29,1.3%20-9.54,5.21%20-9.54,11.71l0,31.89z'%20class='cls-2'/%3e%3cpath%20id='svg_3'%20fill='%23ffffff'%20d='m139.49,295.02c7.38,0%2011.06,4.77%2010.2,11.71l-0.22,1.74c-0.65,6.94%20-4.77,9.54%20-11.93,9.54c-20.39,0.43%20-30.16,15.19%20-30.16,41.22l0,50.55c0,6.94%20-3.9,10.85%20-10.85,10.85l-2.6,0c-6.94,0%20-10.85,-3.9%20-10.85,-10.85l0,-102.39c0,-6.94%203.9,-10.85%2010.85,-10.85l2.6,0c6.94,0%2010.85,3.69%2010.85,10.41l0,10.41c3.91,-11.07%2013.89,-22.34%2032.1,-22.34l0,0l0.01,0z'%20class='cls-2'/%3e%3cpath%20id='svg_4'%20fill='%23ffffff'%20d='m259.67,358.59c0,-27.12%20-15.84,-43.82%20-38.83,-43.82s-38.4,16.49%20-38.4,43.82s15.62,44.04%2038.83,44.04s38.4,-16.7%2038.4,-44.04m-101.53,0c0,-42.74%2026.03,-64.43%2056.84,-64.43c19.52,0%2036.88,9.54%2044.04,26.69l0,-13.45c0,-6.94%203.9,-10.85%2010.85,-10.85l2.6,0c6.94,0%2010.85,3.9%2010.85,10.85l0,102.18c0,6.94%20-3.9,10.85%20-10.85,10.85l-2.6,0c-6.94,0%20-10.85,-3.9%20-10.85,-10.85l0,-12.58c-6.94,16.7%20-24.51,26.47%20-43.82,26.47c-30.81,0%20-57.06,-21.91%20-57.06,-64.87'%20class='cls-2'/%3e%3cpath%20id='svg_5'%20fill='%23ffffff'%20d='m380.06,294.37c34.28,0%2050.11,19.74%2050.11,59.01l0,56.4c0,6.94%20-3.91,10.85%20-10.85,10.85l-2.6,0c-6.94,0%20-10.85,-3.9%20-10.85,-10.85l0,-54.45c0,-27.12%20-10.41,-39.91%20-33.41,-39.91s-32.98,15.4%20-32.98,42.74l0,51.63c0,6.94%20-3.9,10.85%20-10.85,10.85l-2.6,0c-6.94,0%20-10.85,-3.9%20-10.85,-10.85l0,-102.39c0,-6.94%203.91,-10.85%2010.85,-10.85l2.6,0c6.94,0%2010.85,3.91%2010.85,10.85l0,12.34c5.64,-14.39%2019.73,-25.36%2040.57,-25.36l0,0l0.01,-0.01z'%20class='cls-2'/%3e%3cpath%20id='svg_6'%20fill='%23ffffff'%20d='m508.94,422.81c-20.8,0%20-42.78,-8.33%20-53.19,-21.48c-4.44,-5.61%20-2.26,-11.49%204.99,-13.67l2.17,-0.65c4.75,-1.43%208.02,-1.28%2014.32,4.36c8.65,7.74%2020.41,10.61%2031.71,10.61c18.05,0%2028.81,-6.44%2028.81,-17.36c0,-28.63%20-80.45,-5.9%20-80.45,-54.24c0,-22.87%2023.1,-36.01%2049.75,-36.01c16.09,0%2036.22,6.5%2047,17.79c5.1,5.33%203.34,11.34%20-3.68,13.45l-2.17,0.65c-5.86,1.76%20-8.85,-0.39%20-14.53,-3.84c-8.11,-4.92%20-16.87,-8.09%20-26.22,-8.09c-15.64,0%20-26.27,5.18%20-26.27,14.91c0,27.74%2081.1,4.51%2081.1,54.72c0,23.06%20-22.28,38.83%20-53.32,38.83l0,0l-0.02,0.02z'%20class='cls-2'/%3e%3cpath%20id='svg_7'%20fill='%23ffffff'%20d='m585.05,409.79l0,-142.75c0,-6.94%203.9,-10.85%2010.85,-10.85l2.82,0c6.94,0%2010.85,3.9%2010.85,10.85l0,142.75c0,6.94%20-3.91,10.85%20-10.85,10.85l-2.82,0c-6.94,0%20-10.85,-3.91%20-10.85,-10.85'%20class='cls-2'/%3e%3cpath%20id='svg_8'%20fill='%23ffffff'%20d='m737.56,358.59c0,-27.12%20-15.84,-43.82%20-38.84,-43.82s-38.4,16.49%20-38.4,43.82s15.62,44.04%2038.83,44.04s38.4,-16.7%2038.4,-44.04m-101.53,0c0,-42.74%2026.03,-64.43%2056.84,-64.43c19.52,0%2036.88,9.54%2044.04,26.69l0,-13.45c0,-6.94%203.9,-10.85%2010.85,-10.85l2.6,0c6.94,0%2010.85,3.9%2010.85,10.85l0,102.18c0,6.94%20-3.9,10.85%20-10.85,10.85l-2.6,0c-6.94,0%20-10.85,-3.9%20-10.85,-10.85l0,-12.58c-6.94,16.7%20-24.51,26.47%20-43.82,26.47c-30.81,0%20-57.06,-21.91%20-57.06,-64.87'%20class='cls-2'/%3e%3cpath%20id='svg_9'%20fill='%23ffffff'%20d='m800.25,315.42l0,55.76c0,37.96%2014.53,51.2%2046.42,51.2l0,0c1.95,0%204.12,-0.03%206.29,-0.22c6.89,-0.65%209.8,-4.45%209.11,-11.07c-0.61,-5.88%20-4.99,-8.24%20-11.71,-8.24c-18.87,0%20-25.6,-8.9%20-25.6,-34.49l0,-52.94l25.81,0c6.94,0%2010.85,-3.47%2010.85,-9.55s-3.91,-9.33%20-10.85,-9.33l-25.81,0l0,-15.83c0,-7.59%20-4.34,-11.28%20-11.93,-9.54l-3.04,0.65c-6.29,1.3%20-9.55,5.21%20-9.55,11.71l0,31.89l0.01,0z'%20class='cls-2'/%3e%3cpath%20id='svg_10'%20fill='%23ffffff'%20d='m883.72,409.79l0,-102.4c0,-6.94%203.83,-10.85%2010.65,-10.85l2.77,0c6.82,0%2010.65,3.9%2010.65,10.85l0,102.4c0,6.94%20-3.83,10.85%20-10.65,10.85l-2.77,0c-6.81,0%20-10.65,-3.91%20-10.65,-10.85m-2.05,-142.96c0,-8.24%206.08,-13.02%2014.32,-13.02c7.59,0%2014.32,4.77%2014.32,13.02s-6.72,13.02%20-14.32,13.02c-8.24,0%20-14.32,-4.77%20-14.32,-13.02'%20class='cls-2'/%3e%3cpath%20id='svg_11'%20fill='%23ffffff'%20d='m1036.06,358.59c0,-27.12%20-15.62,-43.82%20-38.62,-43.82s-38.4,16.49%20-38.4,43.82s15.4,44.04%2038.61,44.04s38.4,-16.7%2038.4,-44.04m-101.31,0c0,-44.69%2031.02,-64.43%2062.69,-64.43s62.91,19.74%2062.91,64.43s-31.02,64.87%20-62.7,64.87s-62.91,-19.74%20-62.91,-64.87'%20class='cls-2'/%3e%3cpath%20id='svg_12'%20fill='%23ffffff'%20d='m555.77,635.72c-20.98,0%20-43.14,-8.4%20-53.65,-21.66c-4.48,-5.66%20-2.27,-11.59%205.03,-13.78l2.19,-0.66c4.79,-1.44%208.09,-1.29%2014.43,4.4c8.73,7.81%2020.59,10.69%2031.98,10.69c18.2,0%2029.05,-6.49%2029.05,-17.5c0,-28.88%20-81.14,-5.95%20-81.14,-54.7c0,-23.07%2023.3,-36.31%2050.17,-36.31c16.23,0%2036.53,6.55%2047.41,17.94c5.14,5.38%203.37,11.43%20-3.72,13.56l-2.19,0.66c-5.91,1.77%20-8.92,-0.39%20-14.66,-3.87c-8.18,-4.96%20-17.02,-8.16%20-26.45,-8.16c-15.78,0%20-26.5,5.22%20-26.5,15.04c0,27.98%2081.79,4.55%2081.79,55.18c0,23.26%20-22.47,39.16%20-53.78,39.16l0,0l0.04,0.01z'%20class='cls-2'/%3e%3cpath%20id='svg_13'%20fill='%23ffffff'%20d='m639.98,526.42l0,56.23c0,38.29%2014.66,51.63%2046.82,51.63l0,0c1.97,0%204.16,-0.03%206.34,-0.22c6.96,-0.66%209.89,-4.49%209.19,-11.16c-0.61,-5.93%20-5.03,-8.31%20-11.81,-8.31c-19.03,0%20-25.82,-8.97%20-25.82,-34.79l0,-53.38l26.03,0c7,0%2010.94,-3.5%2010.94,-9.63s-3.94,-9.41%20-10.94,-9.41l-26.03,0l0,-15.97c0,-7.66%20-4.38,-11.38%20-12.03,-9.63l-3.06,0.66c-6.34,1.31%20-9.63,5.25%20-9.63,11.81l0,32.16l0,0.01z'%20class='cls-2'/%3e%3cpath%20id='svg_14'%20fill='%23ffffff'%20d='m826.59,508.39c7,0%2010.94,3.94%2010.94,10.94l0,103.27c0,7%20-3.94,10.94%20-10.94,10.94l-2.62,0c-7,0%20-10.94,-3.94%20-10.94,-10.94l0,-12.45c-5.69,14.51%20-19.9,25.57%20-40.91,25.57c-34.57,0%20-50.54,-19.91%20-50.54,-59.51l0,-56.89c0,-7%203.94,-10.93%2010.94,-10.93l2.63,0c7,0%2010.94,3.93%2010.94,10.93l0,54.92c0,27.35%2010.5,40.26%2033.69,40.26s33.26,-15.53%2033.26,-43.1l0,-52.07c0,-7%203.94,-10.93%2010.94,-10.93l2.62,0l-0.01,-0.01z'%20class='cls-2'/%3e%3cpath%20id='svg_15'%20fill='%23ffffff'%20d='m967.71,570.31c0,-27.35%20-15.75,-44.19%20-39.16,-44.19s-38.72,16.63%20-38.72,44.19s15.75,44.41%2039.16,44.41s38.72,-16.85%2038.72,-44.41m-102.39,0c0,-43.1%2026.25,-64.98%2057.32,-64.98c19.69,0%2037.41,9.63%2044.41,26.91l0,-54.26c0,-7%203.94,-10.94%2010.94,-10.94l2.62,0c7,0%2010.94,3.94%2010.94,10.94l0,143.74c0,7%20-3.94,10.94%20-10.94,10.94l-2.62,0c-7,0%20-10.94,-3.94%20-10.94,-10.94l0,-12.69c-7,16.85%20-24.72,26.69%20-44.19,26.69c-31.07,0%20-57.54,-22.09%20-57.54,-65.41'%20class='cls-2'/%3e%3cpath%20id='svg_16'%20fill='%23ffffff'%20d='m1023.66,624.38l0,-103.27c0,-7%203.87,-10.94%2010.74,-10.94l2.79,0c6.87,0%2010.74,3.94%2010.74,10.94l0,103.27c0,7%20-3.87,10.94%20-10.74,10.94l-2.79,0c-6.87,0%20-10.74,-3.94%20-10.74,-10.94m-2.07,-144.18c0,-8.31%206.13,-13.13%2014.44,-13.13c7.66,0%2014.44,4.81%2014.44,13.13s-6.78,13.13%20-14.44,13.13c-8.31,0%20-14.44,-4.81%20-14.44,-13.13'%20class='cls-2'/%3e%3cpath%20id='svg_17'%20fill='%23ffffff'%20d='m1177.29,570.31c0,-27.35%20-15.75,-44.19%20-38.94,-44.19s-38.72,16.63%20-38.72,44.19s15.53,44.41%2038.94,44.41s38.72,-16.85%2038.72,-44.41m-102.17,0c0,-45.07%2031.29,-64.98%2063.23,-64.98s63.45,19.91%2063.45,64.98s-31.29,65.41%20-63.23,65.41s-63.45,-19.91%20-63.45,-65.41'%20class='cls-2'/%3e%3cpath%20id='svg_18'%20fill='%23a51d78'%20d='m1366.99,177.21c7.75,6.65%2016.32,15.32%2024.3,26.23c19.82,27.08%2029.56,59.09%2028.94,95.13c-0.29,16.74%20-3.42,30.61%20-9.31,41.23c-0.55,1%20-1.14,1.99%20-1.74,2.94c-1.17,1.86%20-2.46,3.67%20-3.82,5.37c-3.28,4.11%20-7.15,7.78%20-11.48,10.91c-0.85,0.61%20-1.73,1.21%20-2.61,1.79c-1.77,1.14%20-3.63,2.22%20-5.54,3.2c-2.85,1.46%20-5.89,2.76%20-9.03,3.84c-2.08,0.72%20-4.25,1.36%20-6.44,1.91c-6.58,1.65%20-13.54,2.48%20-20.67,2.48c-19.29,0%20-36.82,-6.22%20-49.35,-17.5c-14.34,-12.91%20-21.61,-31.67%20-21.61,-55.75c0,-30.01%2011.74,-53.91%2031.41,-63.94c15.09,-7.69%2029.61,-15.71%2041.22,-29.17c7.24,-8.39%2012.46,-17.89%2015.72,-28.67m-14.08,-37.87c-3.24,0%20-6.11,2.04%20-6.11,5.55l0,0c0.97,42.1%20-22.01,55.46%20-47.74,68.58c-26.46,13.49%20-44.63,43.79%20-44.63,85.51c0,66.7%2047.26,97.47%2095.17,97.47c8.98,0%2017.93,-1.05%2026.54,-3.2c2.87,-0.72%205.7,-1.56%208.49,-2.52c4.18,-1.45%208.24,-3.17%2012.16,-5.18c2.61,-1.34%205.16,-2.81%207.63,-4.41c1.24,-0.8%202.45,-1.63%203.65,-2.49c5.98,-4.32%2011.44,-9.45%2016.21,-15.43c1.91,-2.39%203.71,-4.92%205.39,-7.58c0.84,-1.33%201.65,-2.7%202.42,-4.1c7.76,-14%2011.99,-31.44%2012.35,-52.56c1.63,-95.85%20-61.94,-144.16%20-87.99,-158.76c-0.99,-0.56%20-2.19,-0.88%20-3.54,-0.88l0,0z'%20class='cls-3'/%3e%3cpath%20id='svg_19'%20fill='%23e94642'%20d='m1234.82,24.21c19.29,0%2036.82,6.22%2049.35,17.5c14.34,12.91%2021.61,31.67%2021.61,55.75c0,30.01%20-11.74,53.91%20-31.41,63.94c-15.09,7.69%20-29.61,15.71%20-41.22,29.17c-7.24,8.39%20-12.46,17.89%20-15.72,28.67c-7.75,-6.65%20-16.32,-15.32%20-24.3,-26.23c-19.82,-27.08%20-29.56,-59.09%20-28.94,-95.13c0.29,-16.74%203.42,-30.61%209.31,-41.23c0.55,-1%201.14,-1.98%201.74,-2.93c1.17,-1.86%202.46,-3.67%203.82,-5.37c3.28,-4.11%207.15,-7.78%2011.48,-10.91c0.85,-0.61%201.73,-1.21%202.61,-1.79c1.77,-1.14%203.63,-2.22%205.54,-3.2c2.85,-1.46%205.89,-2.76%209.03,-3.84c2.08,-0.72%204.25,-1.36%206.44,-1.91c6.58,-1.65%2013.54,-2.48%2020.67,-2.48m0,-24.21c-8.98,0%20-17.93,1.05%20-26.54,3.2c-2.87,0.72%20-5.7,1.56%20-8.49,2.52c-4.18,1.45%20-8.24,3.17%20-12.16,5.18c-2.61,1.34%20-5.16,2.81%20-7.63,4.41c-1.24,0.8%20-2.45,1.63%20-3.65,2.49c-5.98,4.32%20-11.44,9.45%20-16.21,15.43c-1.91,2.39%20-3.71,4.92%20-5.39,7.58c-0.84,1.33%20-1.65,2.7%20-2.42,4.1c-7.76,14%20-11.99,31.44%20-12.35,52.56c-1.63,95.85%2061.94,144.16%2087.99,158.76c0.99,0.56%202.19,0.88%203.54,0.88c3.24,0%206.11,-2.04%206.11,-5.55l0,0c-0.97,-42.1%2022.01,-55.46%2047.74,-68.58c26.46,-13.49%2044.63,-43.79%2044.63,-85.51c0,-66.7%20-47.26,-97.47%20-95.17,-97.47l0,0z'%20class='cls-1'/%3e%3c/g%3e%3c/svg%3e";
448
+ const TranslationstudioLogo = ({}) => {
449
+ const isDark = useThemeMode();
450
+ return /* @__PURE__ */ jsx(
451
+ "img",
452
+ {
453
+ src: isDark ? translationstudioWhiteIcon : translationstudioIcon,
454
+ alt: "Translation Studio"
455
+ }
456
+ );
457
+ };
458
+ const LanguageSelector = ({
459
+ languages,
460
+ onSelectionChange
461
+ }) => /* @__PURE__ */ jsx(Box, { paddingBottom: 4, children: /* @__PURE__ */ jsxs(
462
+ Radio.Group,
463
+ {
464
+ onValueChange: onSelectionChange,
465
+ name: "languages",
466
+ "aria-label": "translationstudio settings",
467
+ children: [
468
+ /* @__PURE__ */ jsx(Typography, { variant: "beta", tag: "label", id: "Sprachauswahl", children: "Translation Settings" }),
469
+ languages.map((lang) => /* @__PURE__ */ jsx(Radio.Item, { value: lang.name, children: lang.name }, lang.id))
470
+ ]
471
+ }
472
+ ) });
473
+ const AdditionalSettings = ({
474
+ isUrgent,
475
+ isEmail,
476
+ email,
477
+ dueDate,
478
+ onUrgentChange,
479
+ onEmailChange,
480
+ onEmailInputChange,
481
+ onDueDateChange
482
+ }) => /* @__PURE__ */ jsxs(Fragment, { children: [
483
+ /* @__PURE__ */ jsx(Box, { paddingBottom: 4, paddingTop: 4, children: /* @__PURE__ */ jsx(Typography, { variant: "beta", tag: "label", paddingBottom: 4, children: "Additional Settings" }) }),
484
+ /* @__PURE__ */ jsx(Box, { paddingBottom: 4, children: /* @__PURE__ */ jsx(Checkbox, { onCheckedChange: onUrgentChange, defaultChecked: isUrgent, children: /* @__PURE__ */ jsx(Typography, { children: "translate immediately (and ignore quotes)" }) }) }),
485
+ /* @__PURE__ */ jsx(Box, { paddingBottom: 4, children: /* @__PURE__ */ jsx(Checkbox, { onCheckedChange: onEmailChange, defaultChecked: isEmail, children: /* @__PURE__ */ jsx(Typography, { children: "Send email notifications on translation status updates" }) }) }),
486
+ isEmail && /* @__PURE__ */ jsx(Box, { paddingBottom: 4, children: /* @__PURE__ */ jsx(
487
+ TextInput,
488
+ {
489
+ label: "Email Address",
490
+ name: "email",
491
+ type: "email",
492
+ value: email,
493
+ onChange: onEmailInputChange,
494
+ placeholder: "Enter your email address"
495
+ }
496
+ ) }),
497
+ !isUrgent && /* @__PURE__ */ jsxs(Box, { paddingBottom: 8, paddingTop: 4, children: [
498
+ /* @__PURE__ */ jsx(Box, { paddingBottom: 4, children: /* @__PURE__ */ jsx(Typography, { variant: "beta", children: "Due Date" }) }),
499
+ /* @__PURE__ */ jsx(DatePicker, { onChange: onDueDateChange, selecteddate: dueDate ? new Date(dueDate) : null })
500
+ ] })
501
+ ] });
502
+ const AlertMessage = ({
503
+ show,
504
+ type,
505
+ message,
506
+ onClose
507
+ }) => {
508
+ if (!show) return null;
509
+ return /* @__PURE__ */ jsx(
510
+ Box,
511
+ {
512
+ style: {
513
+ position: "fixed",
514
+ top: "10%",
515
+ left: "50%",
516
+ transform: "translate(-50%, -50%)",
517
+ zIndex: 10,
518
+ minWidth: "400px",
519
+ maxWidth: "90%"
520
+ },
521
+ children: /* @__PURE__ */ jsx(Alert, { closeLabel: "Close", variant: type, onClose, children: message })
522
+ }
523
+ );
524
+ };
525
+ const TranslationMenu = () => {
526
+ const [languages, setLanguages] = useState([]);
527
+ const [selectedOption, setSelectedOption] = useState("");
528
+ const [source, setSource] = useState("");
529
+ const [email, setEmail] = useState("");
530
+ const [isEmail, setIsEmail] = useState(true);
531
+ const [isUrgent, setIsUrgent] = useState(false);
532
+ const [dueDate, setDueDate] = useState(0);
533
+ const [showAlert, setShowAlert] = useState(false);
534
+ const [alertType, setAlertType] = useState("success");
535
+ const [alertMessage, setAlertMessage] = useState("");
536
+ const [licenseValid, setLicenseValid] = useState(null);
537
+ const [tsIsAvailable, setTsIsAvailable] = useState(true);
538
+ const [isLoadingMappings, setIsLoadingMappings] = useState(false);
539
+ const [mappingsError, setMappingsError] = useState(false);
540
+ const { get, post } = getFetchClient();
541
+ const context = unstable_useContentManagerContext();
542
+ const { id, contentType, model } = context || {};
543
+ const isCollectionType = contentType?.kind === "collectionType";
544
+ const selectedLang = Array.isArray(languages) ? languages.find((lang) => lang.name === selectedOption) : void 0;
545
+ const isMachineTranslation = selectedLang?.machine ?? false;
546
+ useEffect(() => {
547
+ if (!model) return;
548
+ setIsLoadingMappings(true);
549
+ setMappingsError(false);
550
+ get("/translationstudio/getLicense").then((response) => {
551
+ if (typeof response.data.license !== "string") return false;
552
+ return response.data.license !== "";
553
+ }).then((hasLicense) => {
554
+ setLicenseValid(hasLicense);
555
+ if (!hasLicense) throw new Error("No license set");
556
+ setTsIsAvailable(true);
557
+ return get("/translationstudio/mappings");
558
+ }).then((langs) => {
559
+ if (langs.data && Array.isArray(langs.data) && langs.data.length > 0) {
560
+ setLanguages(langs.data);
561
+ setMappingsError(false);
562
+ } else {
563
+ setLanguages([]);
564
+ setMappingsError(true);
565
+ }
566
+ }).catch((err) => {
567
+ console.error(err);
568
+ setTsIsAvailable(false);
569
+ setMappingsError(true);
570
+ }).finally(() => {
571
+ setIsLoadingMappings(false);
572
+ });
573
+ }, [id, model, isCollectionType]);
574
+ useEffect(() => {
575
+ if (isEmail) {
576
+ const savedEmail = getStoredEmail();
577
+ if (savedEmail) {
578
+ setEmail(savedEmail);
579
+ }
580
+ }
581
+ }, [isEmail]);
582
+ const handleUrgentChange = () => {
583
+ if (isUrgent) {
584
+ setIsUrgent(false);
585
+ setDueDate(0);
586
+ } else {
587
+ setIsUrgent(true);
588
+ }
589
+ };
590
+ const handleEmailChange = () => {
591
+ const newEmailState = !isEmail;
592
+ setIsEmail(newEmailState);
593
+ if (newEmailState) {
594
+ const savedEmail = getStoredEmail();
595
+ if (savedEmail) {
596
+ setEmail(savedEmail);
597
+ }
598
+ } else {
599
+ setEmail("");
600
+ }
601
+ };
602
+ const handleEmailInputChange = (e) => {
603
+ const newEmail = e.target.value;
604
+ setEmail(newEmail);
605
+ setStoredEmail(newEmail);
606
+ };
607
+ const handleDueDateChange = (date) => {
608
+ const validatedDate = validateDueDate(date);
609
+ setDueDate(validatedDate);
610
+ setIsUrgent(false);
611
+ };
612
+ const handleRadioSelection = (value) => {
613
+ setSelectedOption(value);
614
+ const lang = languages.find((l) => l.name === value);
615
+ if (lang) {
616
+ setSource(lang.source);
617
+ if (lang.machine) {
618
+ setIsUrgent(false);
619
+ setDueDate(0);
620
+ }
621
+ }
622
+ };
623
+ const displayAlert = (variant, message) => {
624
+ setAlertType(variant);
625
+ setAlertMessage(message);
626
+ setShowAlert(true);
627
+ setTimeout(() => setShowAlert(false), 5e3);
628
+ };
629
+ const getEntryUid = () => {
630
+ if (!model || !id) return "";
631
+ return createEntryUid(isCollectionType || false, model, id);
632
+ };
633
+ const handleTranslationRequest = async () => {
634
+ if (!selectedLang || !contentType || !id) return;
635
+ const entryUid = getEntryUid();
636
+ try {
637
+ const entryResponse = await post("/translationstudio/entrydata", {
638
+ uid: entryUid,
639
+ locale: source
640
+ });
641
+ const fetchedEntryData = entryResponse.data;
642
+ const entryName = determineEntryName(
643
+ fetchedEntryData,
644
+ contentType.info?.displayName ?? "",
645
+ id
646
+ );
647
+ const payload = createTranslationPayload(
648
+ selectedLang,
649
+ dueDate,
650
+ isEmail,
651
+ isMachineTranslation,
652
+ email,
653
+ isUrgent,
654
+ contentType.info?.displayName ?? "",
655
+ entryUid,
656
+ entryName
657
+ );
658
+ const response = await post("/translationstudio/translate", payload);
659
+ const { type, message } = response.data === true ? createSuccessMessage(1, 1) : createErrorMessage(1);
660
+ displayAlert(
661
+ type,
662
+ response.data === true ? "Translation request sent successfully" : "Error requesting translation"
663
+ );
664
+ } catch (error) {
665
+ displayAlert("danger", `The entry does not exist in the selected source locale (${source}).`);
666
+ }
667
+ };
668
+ const renderNotAvailable = () => {
669
+ if (isLoadingMappings) {
670
+ return /* @__PURE__ */ jsx(LoadingSpinner, {});
671
+ }
672
+ if (!tsIsAvailable || mappingsError) {
673
+ return /* @__PURE__ */ jsx(ErrorMessage, { message: "Error fetching translation settings." });
674
+ }
675
+ if (licenseValid === false) {
676
+ return /* @__PURE__ */ jsx(ErrorMessage, { message: "Your translationstudio license is invalid. Please update your strapi configuration." });
677
+ }
678
+ if (languages.length === 0) {
679
+ return /* @__PURE__ */ jsx(ErrorMessage, { message: "No translation settings available. translationstudio has not been configured yet. Please add translation settings first." });
680
+ }
681
+ return null;
682
+ };
683
+ const renderPlugin = () => /* @__PURE__ */ jsxs(Fragment, { children: [
684
+ /* @__PURE__ */ jsx(LanguageSelector, { languages, onSelectionChange: handleRadioSelection }),
685
+ !isMachineTranslation && selectedOption !== "" && /* @__PURE__ */ jsx(
686
+ AdditionalSettings,
687
+ {
688
+ isUrgent,
689
+ isEmail,
690
+ email,
691
+ dueDate,
692
+ onUrgentChange: handleUrgentChange,
693
+ onEmailChange: handleEmailChange,
694
+ onEmailInputChange: handleEmailInputChange,
695
+ onDueDateChange: handleDueDateChange
696
+ }
697
+ ),
698
+ /* @__PURE__ */ jsx(
699
+ Button,
700
+ {
701
+ fullWidth: true,
702
+ onClick: handleTranslationRequest,
703
+ disabled: !selectedOption,
704
+ startIcon: /* @__PURE__ */ jsx(
705
+ "svg",
706
+ {
707
+ width: "20",
708
+ height: "20",
709
+ viewBox: "0 0 24 24",
710
+ fill: "none",
711
+ xmlns: "http://www.w3.org/2000/svg",
712
+ children: /* @__PURE__ */ jsx("path", { d: "M2,21L23,12L2,3V10L17,12L2,14V21Z", fill: "currentColor" })
713
+ }
714
+ ),
715
+ children: getSubmitLabel(1, isUrgent, isMachineTranslation)
716
+ }
717
+ )
718
+ ] });
719
+ const pluginIsAvailable = () => {
720
+ return !isLoadingMappings && licenseValid !== null && tsIsAvailable === true && !mappingsError;
721
+ };
722
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
723
+ /* @__PURE__ */ jsx(
724
+ AlertMessage,
725
+ {
726
+ show: showAlert,
727
+ type: alertType,
728
+ message: alertMessage,
729
+ onClose: () => setShowAlert(false)
730
+ }
731
+ ),
732
+ /* @__PURE__ */ jsx(Box, { padding: 4, style: { textAlign: "center", width: "100%", marginBottom: "20px" }, children: /* @__PURE__ */ jsx(
733
+ "picture",
734
+ {
735
+ style: {
736
+ width: "85%",
737
+ height: "auto",
738
+ display: "inline-block"
739
+ },
740
+ children: /* @__PURE__ */ jsx(TranslationstudioLogo, {})
741
+ }
742
+ ) }),
743
+ /* @__PURE__ */ jsx(Box, { padding: 4, style: { textAlign: "center", width: "100%" }, children: !pluginIsAvailable() ? renderNotAvailable() : renderPlugin() }),
744
+ /* @__PURE__ */ jsx(EntryHistory, { entryUid: getEntryUid() })
745
+ ] });
746
+ };
747
+ const HistoryIcon = () => {
748
+ useThemeMode();
749
+ return /* @__PURE__ */ jsxs("span", { style: { position: "relative" }, children: [
750
+ /* @__PURE__ */ jsx(PluginIcon, {}),
751
+ /* @__PURE__ */ jsx(NumberList, { style: {
752
+ position: "absolute",
753
+ right: "0px",
754
+ bottom: "0px",
755
+ width: "12px",
756
+ height: "12px"
757
+ } })
758
+ ] });
759
+ };
760
+ const index = {
761
+ register(app) {
762
+ app.addMenuLink({
763
+ to: `plugins/${PLUGIN_ID}`,
764
+ icon: SettingsIcon,
765
+ intlLabel: {
766
+ id: `${PLUGIN_ID}.plugin.name`,
767
+ defaultMessage: "translationstudio Settings"
768
+ },
769
+ Component: async () => {
770
+ const { App } = await import("./App-Cc3EklWX.mjs");
771
+ return App;
772
+ }
773
+ });
774
+ app.addMenuLink({
775
+ to: `/plugins/${PLUGIN_ID}/history`,
776
+ icon: HistoryIcon,
777
+ intlLabel: {
778
+ id: `${PLUGIN_ID}.plugin.history`,
779
+ defaultMessage: "translationstudio Dashboard"
780
+ },
781
+ Component: async () => {
782
+ const { HistoryPage } = await import("./HistoryPage-CSMW8AED.mjs");
783
+ return HistoryPage;
784
+ }
785
+ });
786
+ app.getPlugin("content-manager").injectComponent("editView", "right-links", {
787
+ name: "translation-menu",
788
+ Component: TranslationMenu
789
+ });
790
+ app.registerPlugin({
791
+ id: PLUGIN_ID,
792
+ initializer: Initializer,
793
+ isReady: false,
794
+ name: PLUGIN_ID
795
+ });
796
+ },
797
+ async registerTrads(app) {
798
+ const { locales } = app;
799
+ const importedTranslations = await Promise.all(
800
+ locales.map((locale) => {
801
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-Byx4XI2L.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
802
+ return {
803
+ data: getTranslation(data),
804
+ locale
805
+ };
806
+ }).catch(() => {
807
+ return {
808
+ data: {},
809
+ locale
810
+ };
811
+ });
812
+ })
813
+ );
814
+ return importedTranslations;
815
+ }
816
+ };
817
+ export {
818
+ TranslationstudioLogo as T,
819
+ getThemeColors as a,
820
+ getStoredEmail as b,
821
+ getSubmitLabel as c,
822
+ createEntryUid$1 as d,
823
+ determineEntryName$1 as e,
824
+ formatDate as f,
825
+ groupHistoryData as g,
826
+ handleHistoryResponse as h,
827
+ createTranslationPayload as i,
828
+ createSuccessMessage as j,
829
+ createErrorMessage as k,
830
+ createGeneralErrorMessage as l,
831
+ index as m,
832
+ setStoredEmail as s,
833
+ useThemeMode as u,
834
+ validateDueDate as v
835
+ };