@translationstudio/translationstudio-strapi-extension 1.1.1 → 2.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.
package/README.md CHANGED
@@ -22,7 +22,7 @@ Follow these steps:
22
22
 
23
23
  1. run `npm install -g yalc` in this folder
24
24
  2. run `npm install` (if there are errors, add `--legacy-peer-deps`)
25
- 3. run `npm run:watch link` in this folder
25
+ 3. run `npm run watch:link` in this folder
26
26
  4. Create a new strapi project and enter the folder
27
27
  5. run `npx yalc add --link _translationstudio-strapi-extension_`
28
28
  6. start strapi in development mode
package/dist/Types.d.ts CHANGED
@@ -6,11 +6,7 @@ export interface TranslationstudioTranslatable {
6
6
  type: 'text' | 'html';
7
7
  translatableValue: string[];
8
8
  realType: string;
9
- componentInfo?: {
10
- namePath: string[];
11
- id: number;
12
- schemaName: string;
13
- };
9
+ uuid?: string;
14
10
  }
15
11
  export interface StrapiLocale {
16
12
  id: number;
@@ -129,18 +125,21 @@ export type TranslationStatusData = {
129
125
  export interface OrganizedFields {
130
126
  regularFields: TranslationstudioTranslatable[];
131
127
  componentFieldsMap: Map<string, TranslationstudioTranslatable[]>;
132
- dynamicZoneFields: Map<number, TranslationstudioTranslatable[]>;
133
128
  }
134
129
  export interface ExportPayload {
135
130
  source: string;
136
131
  target: string;
137
132
  element: string;
138
133
  }
134
+ export interface TranslatedDocumentReplaceFields {
135
+ [name: string]: any;
136
+ }
139
137
  export interface ImportPayload {
140
138
  element: string;
141
139
  source: string;
142
140
  target: string;
143
- document: [{
144
- fields: [];
145
- }];
141
+ document: {
142
+ fields: TranslationstudioTranslatable[];
143
+ keep?: TranslatedDocumentReplaceFields;
144
+ }[];
146
145
  }
@@ -5,34 +5,73 @@ 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 icons = require("@strapi/icons");
8
9
  const TSlogoFarbig = "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";
10
+ async function loadLicense(fnGet) {
11
+ try {
12
+ const response = await fnGet("/translationstudio/getLicense");
13
+ if (typeof response.data?.license === "string")
14
+ return response.data.license;
15
+ } catch (err) {
16
+ console.error(err);
17
+ }
18
+ return "";
19
+ }
20
+ async function loadDevUrl(fnGet) {
21
+ try {
22
+ const response = await fnGet("/translationstudio/devurl");
23
+ if (typeof response.data?.url === "string")
24
+ return response.data.url;
25
+ } catch (err) {
26
+ console.error(err);
27
+ }
28
+ return "";
29
+ }
30
+ async function updateDevlUrl(fnPost, url) {
31
+ try {
32
+ const response = await fnPost("/translationstudio/devurl", { url });
33
+ if (typeof response.data?.success === "boolean")
34
+ return response.data.success;
35
+ } catch (err) {
36
+ console.error(err);
37
+ }
38
+ return false;
39
+ }
40
+ const TextareaStyle = {
41
+ color: "grey",
42
+ width: "100%",
43
+ display: "block",
44
+ backgroundColor: "#f6f6f6",
45
+ cursor: "default"
46
+ };
47
+ const BUttonStyle = { backgroundColor: "#e94642", border: "none", paddingTop: "0.6em", paddingBottom: "0.6em" };
9
48
  const SettingsPage = () => {
10
49
  const [licenseValue, setLicenseValue] = react.useState("");
11
50
  const [isLoading, setIsLoading] = react.useState(true);
12
51
  const [tokenValue, setTokenValue] = react.useState("");
13
52
  const [isLoadingToken, setIsLoadingToken] = react.useState(false);
53
+ const [showDevOptions, setShowDevOptions] = react.useState(false);
14
54
  const [showAlert, setShowAlert] = react.useState(false);
15
55
  const [alertType, setAlertType] = react.useState("success");
16
56
  const [alertMessage, setAlertMessage] = react.useState("");
57
+ const [devUrl, setDevUrl] = react.useState("");
17
58
  const { get, post } = admin.getFetchClient();
18
59
  react.useEffect(() => {
19
60
  const getLicense = async () => {
20
61
  setIsLoading(true);
21
- try {
22
- const response = await get("/translationstudio/getLicense");
23
- if (response.data.license) {
24
- setLicenseValue(response.data.license);
25
- } else {
26
- setLicenseValue("");
27
- }
28
- } catch (err) {
29
- console.error(err);
30
- } finally {
31
- setIsLoading(false);
62
+ const license = await loadLicense(get);
63
+ if (license)
64
+ setLicenseValue(license);
65
+ const dUrl = await loadDevUrl(get);
66
+ if (dUrl) {
67
+ console.log(dUrl);
68
+ setDevUrl(dUrl);
69
+ setShowDevOptions(true);
32
70
  }
71
+ setIsLoading(false);
33
72
  };
34
73
  getLicense();
35
- }, []);
74
+ }, [setLicenseValue, setDevUrl, setIsLoading, setShowDevOptions]);
36
75
  react.useEffect(() => {
37
76
  const fetchToken = async () => {
38
77
  setIsLoadingToken(true);
@@ -52,7 +91,14 @@ const SettingsPage = () => {
52
91
  fetchToken();
53
92
  }, []);
54
93
  const handleLicenseChange = (e) => {
55
- setLicenseValue(e.target.value);
94
+ setLicenseValue(e.target.value.trim());
95
+ };
96
+ const handleUpdateUrl = async function() {
97
+ setIsLoading(true);
98
+ updateDevlUrl(post, devUrl).then(() => {
99
+ if (devUrl === "")
100
+ setShowDevOptions(false);
101
+ }).finally(() => setIsLoading(false));
56
102
  };
57
103
  const handleSaveLicense = async () => {
58
104
  try {
@@ -88,6 +134,12 @@ const SettingsPage = () => {
88
134
  setIsLoadingToken(false);
89
135
  }
90
136
  };
137
+ const onChangeDevOptions = function(val) {
138
+ if (val)
139
+ setShowDevOptions(val);
140
+ else
141
+ updateDevlUrl(post, "").finally(() => setShowDevOptions(val));
142
+ };
91
143
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { children: [
92
144
  showAlert && /* @__PURE__ */ jsxRuntime.jsx(
93
145
  designSystem.Box,
@@ -108,27 +160,27 @@ const SettingsPage = () => {
108
160
  designSystem.Box,
109
161
  {
110
162
  padding: 10,
111
- paddingBottom: 0,
112
163
  style: {
113
- height: "90vh",
164
+ minHeight: "90vh",
114
165
  marginTop: "5vh",
115
166
  backgroundColor: "white",
116
167
  color: "grey"
117
168
  },
118
- children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 6, children: [
119
- /* @__PURE__ */ jsxRuntime.jsx(
169
+ children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { children: [
170
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { textAlign: "right", width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(
120
171
  "img",
121
172
  {
122
173
  src: TSlogoFarbig,
123
174
  alt: "Translation Studio Logo",
124
175
  style: {
125
- maxWidth: "300px",
126
- height: "auto"
176
+ width: "300px",
177
+ height: "auto",
178
+ display: "inline-block"
127
179
  }
128
180
  }
129
- ),
130
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", style: { textAlign: "left" }, children: "translationstudio License" }),
131
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "charlie", children: [
181
+ ) }) }),
182
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { xs: 12, style: { paddingTop: "2em" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", style: { width: "100%" }, children: "translationstudio License" }) }),
183
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { xs: 12, style: { paddingBottom: "1em" }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "charlie", style: { width: "100%" }, children: [
132
184
  "You can create or revoke a license at",
133
185
  " ",
134
186
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -137,14 +189,13 @@ const SettingsPage = () => {
137
189
  href: "https://account.translationstudio.tech/",
138
190
  target: "_blank",
139
191
  rel: "noopener noreferrer",
140
- style: { textDecoration: "none", color: "#e94642", textAlign: "left" },
192
+ style: { textDecoration: "none", color: "#e94642" },
141
193
  children: "account.translationstudio.tech"
142
194
  }
143
- ),
144
- " "
145
- ] }),
146
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
147
- designSystem.Textarea,
195
+ )
196
+ ] }) }),
197
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { xs: 10, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(
198
+ designSystem.TextInput,
148
199
  {
149
200
  name: "jwt-token",
150
201
  label: "JWT Token",
@@ -153,20 +204,16 @@ const SettingsPage = () => {
153
204
  value: licenseValue,
154
205
  onChange: handleLicenseChange,
155
206
  disabled: isLoading,
156
- style: {
157
- color: "grey",
158
- width: "25vw",
159
- textAlign: "left",
160
- backgroundColor: "#f6f6f6",
161
- cursor: "text"
162
- }
207
+ style: TextareaStyle
163
208
  }
164
- ) }),
165
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { minHeight: "40px" }, children: !isLoading && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
209
+ ) }) }),
210
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { xs: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
166
211
  designSystem.Button,
167
212
  {
168
213
  onClick: handleSaveLicense,
169
- style: { backgroundColor: "#e94642", border: "none" },
214
+ disabled: isLoading,
215
+ style: BUttonStyle,
216
+ size: "L",
170
217
  startIcon: /* @__PURE__ */ jsxRuntime.jsx(
171
218
  "svg",
172
219
  {
@@ -186,10 +233,11 @@ const SettingsPage = () => {
186
233
  ),
187
234
  children: "Save license"
188
235
  }
189
- ) }) }),
190
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", children: "Authorize incoming translationstudio connection against this access key" }),
191
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
192
- designSystem.Textarea,
236
+ ) }),
237
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { xs: 12, style: { paddingTop: "3em" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", children: "Authorize translationstudio requests" }) }),
238
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { xs: 12, style: { paddingBottom: "1em" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "charlie", style: { width: "100%" }, children: "When translationstudio connects with this plugin it will use the following access key to authorize itself." }) }),
239
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { xs: 10, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(
240
+ designSystem.TextInput,
193
241
  {
194
242
  name: "access-token",
195
243
  label: "Access Key",
@@ -199,69 +247,86 @@ const SettingsPage = () => {
199
247
  onChange: () => {
200
248
  },
201
249
  disabled: true,
202
- style: {
203
- color: "grey",
204
- width: "25vw",
205
- textAlign: "left",
206
- backgroundColor: "#f6f6f6",
207
- cursor: "default"
208
- }
250
+ style: TextareaStyle
209
251
  }
210
- ) }),
211
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { minHeight: "40px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
252
+ ) }) }),
253
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { xs: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
212
254
  designSystem.Button,
213
255
  {
214
256
  onClick: handleGenerateToken,
215
- style: { backgroundColor: "#e94642", border: "none" },
257
+ style: BUttonStyle,
216
258
  disabled: isLoadingToken,
217
259
  loading: isLoadingToken,
218
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(
219
- "svg",
220
- {
221
- width: "20",
222
- height: "20",
223
- viewBox: "0 0 24 24",
224
- fill: "none",
225
- xmlns: "http://www.w3.org/2000/svg",
226
- children: /* @__PURE__ */ jsxRuntime.jsx(
227
- "path",
228
- {
229
- d: "M19,11H13V5a1,1,0,0,0-2,0v6H5a1,1,0,0,0,0,2h6v6a1,1,0,0,0,2,0V13h6a1,1,0,0,0,0-2Z",
230
- fill: "currentColor"
231
- }
232
- )
233
- }
234
- ),
235
- children: isLoadingToken ? "Generating..." : tokenValue ? "Generate new access key" : "Generate access key"
260
+ size: "L",
261
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowClockwise, {}),
262
+ children: isLoadingToken ? "Generating..." : tokenValue ? "New access key" : "Create access key"
263
+ }
264
+ ) }),
265
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { xs: 12, style: { paddingTop: "5em" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", children: "Customization" }) }),
266
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { xs: 12, style: { paddingBottom: "1em" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "charlie", style: { width: "100%" }, children: "You will not need these settings, but you might want to customize your translationstudio instance." }) }),
267
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
268
+ designSystem.Switch,
269
+ {
270
+ checked: showDevOptions,
271
+ onCheckedChange: () => onChangeDevOptions(!showDevOptions),
272
+ onLabel: "Use custom translationstudio URL",
273
+ offLabel: "Custom translationstudio URL is currently disabled (default)",
274
+ visibleLabels: true
236
275
  }
237
276
  ) }),
238
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "delta", children: [
239
- "If you do not have a",
277
+ showDevOptions && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
278
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { xs: 12, style: { paddingTop: "2em" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", children: "Use custom translationstudio URL." }) }),
279
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { xs: 12, style: { paddingBottom: "1em" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", children: "This is usually only necessary for development purposes." }) }),
280
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { xs: 10, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(
281
+ designSystem.TextInput,
282
+ {
283
+ onChange: (e) => setDevUrl(e.target.value.trim()),
284
+ name: "devurl",
285
+ label: "Custom translationstudio url",
286
+ placeholder: "Paste your custom translationstudio url here",
287
+ "aria-label": "translationstudio custom url",
288
+ value: devUrl,
289
+ style: TextareaStyle
290
+ }
291
+ ) }) }),
292
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { xs: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
293
+ designSystem.Button,
294
+ {
295
+ onClick: handleUpdateUrl,
296
+ style: BUttonStyle,
297
+ disabled: isLoadingToken,
298
+ loading: isLoadingToken,
299
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Play, {}),
300
+ size: "L",
301
+ children: "Update URL"
302
+ }
303
+ ) })
304
+ ] }),
305
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { xs: 12, style: { paddingTop: "4em" }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "sigma", style: { width: "100%", textAlign: "right" }, children: [
306
+ "If you do not have a translationstudio account, please create one at",
240
307
  " ",
241
308
  /* @__PURE__ */ jsxRuntime.jsx(
242
309
  "a",
243
310
  {
244
- href: "https://www.translationstudio.tech/",
311
+ href: "https://account.translationstudio.tech/",
245
312
  target: "_blank",
246
313
  rel: "noopener noreferrer",
247
314
  style: { textDecoration: "none", color: "#e94642" },
248
- children: "translationstudio"
315
+ children: "account.translationstudio.tech"
249
316
  }
250
317
  ),
251
- " ",
252
- "account, please create one at",
253
- " ",
318
+ ". You can find further information at ",
254
319
  /* @__PURE__ */ jsxRuntime.jsx(
255
320
  "a",
256
321
  {
257
- href: "https://account.translationstudio.tech/",
322
+ href: "https://www.translationstudio.tech/",
258
323
  target: "_blank",
259
324
  rel: "noopener noreferrer",
260
325
  style: { textDecoration: "none", color: "#e94642" },
261
- children: "account.translationstudio.tech"
326
+ children: "translationstudio.tech"
262
327
  }
263
328
  ),
264
- "."
329
+ " "
265
330
  ] }) })
266
331
  ] })
267
332
  }