@translationstudio/translationstudio-strapi-extension 5.0.0 → 5.0.1

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.
@@ -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-rTLjDSHt.js");
8
+ const index = require("./index-CgX-X1nF.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, Badge, TextInput, Switch, Button } from "@strapi/design-system";
5
5
  import { useState, useCallback, useEffect } from "react";
6
- import { T as TranslationstudioLogo } from "./index-DZinmQcT.mjs";
6
+ import { T as TranslationstudioLogo } from "./index-DKeIuEy_.mjs";
7
7
  const apiService = {
8
8
  async loadLicense(get) {
9
9
  try {
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { Modal, Typography, Button, Box, Alert, TextInput, Table, Thead, Tr, Th, Tbody, Td, Badge, SimpleMenu, IconButton, MenuItem, Radio, Checkbox, DatePicker, ProgressBar, 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 getThemeColors, G as GetStatusColor, a as GetStatusText, f as formatDate, b as getStoredEmail, c as getSubmitLabel, s as setStoredEmail, v as validateDueDate, d as createEntryUid, e as determineEntryName, h as createTranslationPayload, i as createSuccessMessage, j as createErrorMessage, k as createGeneralErrorMessage, T as TranslationstudioLogo, l as handleHistoryResponse, m as groupHistoryData } from "./index-DZinmQcT.mjs";
5
+ import { g as getThemeColors, G as GetStatusColor, a as GetStatusText, f as formatDate, b as getStoredEmail, c as getSubmitLabel, s as setStoredEmail, v as validateDueDate, d as createEntryUid, e as determineEntryName, h as createTranslationPayload, i as createSuccessMessage, j as createErrorMessage, k as createGeneralErrorMessage, T as TranslationstudioLogo, l as handleHistoryResponse, m as groupHistoryData } from "./index-DKeIuEy_.mjs";
6
6
  import { Trash, More, Bell, PaperPlane, Earth } from "@strapi/icons";
7
7
  const getSearchableText = (item) => {
8
8
  return `${item["project-name"]} ${item["element-name"]} ${item["element-uid"]} ${item.targetLanguages.join(" ")} ${item.combinedStatus.text}`.toLowerCase();
@@ -802,6 +802,43 @@ const fetchContentEntriesData = async function(selectedContentType) {
802
802
  }
803
803
  return [];
804
804
  };
805
+ const extractDocumentId = function(id) {
806
+ const pos = id.lastIndexOf("#");
807
+ return pos === -1 ? id : id.substring(pos + 1);
808
+ };
809
+ const groupHistory = function(history) {
810
+ const map = {};
811
+ for (const e of history) {
812
+ const id = extractDocumentId(e["element-uid"]);
813
+ if (!map[id]) {
814
+ const data = {
815
+ queued: [],
816
+ intranslation: [],
817
+ translated: []
818
+ };
819
+ map[id] = data;
820
+ }
821
+ const entry = map[id];
822
+ switch (e.status) {
823
+ case "intranslation":
824
+ entry.intranslation.push(e.targetLanguage);
825
+ break;
826
+ case "translated":
827
+ entry.translated.push(e.targetLanguage);
828
+ break;
829
+ default:
830
+ entry.queued.push(e.targetLanguage);
831
+ break;
832
+ }
833
+ }
834
+ for (const key in map) {
835
+ const data = map[key];
836
+ data.intranslation.sort();
837
+ data.queued.sort();
838
+ data.translated.sort();
839
+ }
840
+ return map;
841
+ };
805
842
  const BulkTranslationMenu = ({
806
843
  groupedHistoryData,
807
844
  isLoadingHistory,
@@ -815,32 +852,7 @@ const BulkTranslationMenu = ({
815
852
  const [isLoadingEntries, setIsLoadingEntries] = useState(false);
816
853
  const [showTranslation, setShowTranslation] = useState(false);
817
854
  const themeColors = getThemeColors();
818
- const historyItemMap = useMemo(() => {
819
- const map = {};
820
- for (const e of groupedHistoryData) {
821
- if (!map[e["element-uid"]]) {
822
- const data = {
823
- queued: [],
824
- intranslation: [],
825
- translated: []
826
- };
827
- map[e["element-uid"]] = data;
828
- }
829
- const entry = map[e["element-uid"]];
830
- switch (e.status) {
831
- case "intranslation":
832
- entry.intranslation.push(e.targetLanguage);
833
- break;
834
- case "translated":
835
- entry.translated.push(e.targetLanguage);
836
- break;
837
- default:
838
- entry.queued.push(e.targetLanguage);
839
- break;
840
- }
841
- }
842
- return map;
843
- }, [groupedHistoryData]);
855
+ const historyItemMap = useMemo(() => groupHistory(groupedHistoryData), [groupedHistoryData]);
844
856
  const { get } = getFetchClient();
845
857
  useEffect(() => {
846
858
  const fetchContentTypes = async () => {
@@ -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-rTLjDSHt.js");
7
+ const index = require("./index-CgX-X1nF.js");
8
8
  const icons = require("@strapi/icons");
9
9
  const getSearchableText = (item) => {
10
10
  return `${item["project-name"]} ${item["element-name"]} ${item["element-uid"]} ${item.targetLanguages.join(" ")} ${item.combinedStatus.text}`.toLowerCase();
@@ -804,6 +804,43 @@ const fetchContentEntriesData = async function(selectedContentType) {
804
804
  }
805
805
  return [];
806
806
  };
807
+ const extractDocumentId = function(id) {
808
+ const pos = id.lastIndexOf("#");
809
+ return pos === -1 ? id : id.substring(pos + 1);
810
+ };
811
+ const groupHistory = function(history) {
812
+ const map = {};
813
+ for (const e of history) {
814
+ const id = extractDocumentId(e["element-uid"]);
815
+ if (!map[id]) {
816
+ const data = {
817
+ queued: [],
818
+ intranslation: [],
819
+ translated: []
820
+ };
821
+ map[id] = data;
822
+ }
823
+ const entry = map[id];
824
+ switch (e.status) {
825
+ case "intranslation":
826
+ entry.intranslation.push(e.targetLanguage);
827
+ break;
828
+ case "translated":
829
+ entry.translated.push(e.targetLanguage);
830
+ break;
831
+ default:
832
+ entry.queued.push(e.targetLanguage);
833
+ break;
834
+ }
835
+ }
836
+ for (const key in map) {
837
+ const data = map[key];
838
+ data.intranslation.sort();
839
+ data.queued.sort();
840
+ data.translated.sort();
841
+ }
842
+ return map;
843
+ };
807
844
  const BulkTranslationMenu = ({
808
845
  groupedHistoryData,
809
846
  isLoadingHistory,
@@ -817,32 +854,7 @@ const BulkTranslationMenu = ({
817
854
  const [isLoadingEntries, setIsLoadingEntries] = react.useState(false);
818
855
  const [showTranslation, setShowTranslation] = react.useState(false);
819
856
  const themeColors = index.getThemeColors();
820
- const historyItemMap = react.useMemo(() => {
821
- const map = {};
822
- for (const e of groupedHistoryData) {
823
- if (!map[e["element-uid"]]) {
824
- const data = {
825
- queued: [],
826
- intranslation: [],
827
- translated: []
828
- };
829
- map[e["element-uid"]] = data;
830
- }
831
- const entry = map[e["element-uid"]];
832
- switch (e.status) {
833
- case "intranslation":
834
- entry.intranslation.push(e.targetLanguage);
835
- break;
836
- case "translated":
837
- entry.translated.push(e.targetLanguage);
838
- break;
839
- default:
840
- entry.queued.push(e.targetLanguage);
841
- break;
842
- }
843
- }
844
- return map;
845
- }, [groupedHistoryData]);
857
+ const historyItemMap = react.useMemo(() => groupHistory(groupedHistoryData), [groupedHistoryData]);
846
858
  const { get } = admin.getFetchClient();
847
859
  react.useEffect(() => {
848
860
  const fetchContentTypes = async () => {
@@ -750,7 +750,7 @@ const index = {
750
750
  defaultMessage: "translationstudio Settings"
751
751
  },
752
752
  Component: async () => {
753
- const { App } = await Promise.resolve().then(() => require("./App-C-MElCqg.js"));
753
+ const { App } = await Promise.resolve().then(() => require("./App-CDI8iUHL.js"));
754
754
  return App;
755
755
  }
756
756
  });
@@ -762,7 +762,7 @@ const index = {
762
762
  defaultMessage: "translationstudio Dashboard"
763
763
  },
764
764
  Component: async () => {
765
- const { HistoryPage } = await Promise.resolve().then(() => require("./HistoryPage-BXQm-01z.js"));
765
+ const { HistoryPage } = await Promise.resolve().then(() => require("./HistoryPage-VqkbaIHn.js"));
766
766
  return HistoryPage;
767
767
  }
768
768
  });
@@ -749,7 +749,7 @@ const index = {
749
749
  defaultMessage: "translationstudio Settings"
750
750
  },
751
751
  Component: async () => {
752
- const { App } = await import("./App-CpTByl7h.mjs");
752
+ const { App } = await import("./App-Dw8LkiAx.mjs");
753
753
  return App;
754
754
  }
755
755
  });
@@ -761,7 +761,7 @@ const index = {
761
761
  defaultMessage: "translationstudio Dashboard"
762
762
  },
763
763
  Component: async () => {
764
- const { HistoryPage } = await import("./HistoryPage-BwYOK1la.mjs");
764
+ const { HistoryPage } = await import("./HistoryPage-Do_yIUdx.mjs");
765
765
  return HistoryPage;
766
766
  }
767
767
  });
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-rTLjDSHt.js");
2
+ const index = require("../_chunks/index-CgX-X1nF.js");
3
3
  module.exports = index.index;
@@ -1,4 +1,4 @@
1
- import { n } from "../_chunks/index-DZinmQcT.mjs";
1
+ import { n } from "../_chunks/index-DKeIuEy_.mjs";
2
2
  export {
3
3
  n as default
4
4
  };
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  }
11
11
  ],
12
12
  "homepage": "https://translationstudio.tech",
13
- "version": "5.0.0",
13
+ "version": "5.0.1",
14
14
  "keywords": [
15
15
  "translationstudio",
16
16
  "strapi",