@translationstudio/translationstudio-strapi-extension 1.0.1 → 1.0.2
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
|
@@ -16,26 +16,36 @@ const SettingsPage = () => {
|
|
|
16
16
|
useEffect(() => {
|
|
17
17
|
const getLicense = async () => {
|
|
18
18
|
setIsLoading(true);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
try {
|
|
20
|
+
const response = await get("/translationstudio-strapi-extension/getLicense");
|
|
21
|
+
if (response.data.license) {
|
|
22
|
+
setLicenseValue(response.data.license);
|
|
23
|
+
} else {
|
|
24
|
+
setLicenseValue("");
|
|
25
|
+
}
|
|
26
|
+
} catch (err) {
|
|
27
|
+
console.error(err);
|
|
28
|
+
} finally {
|
|
29
|
+
setIsLoading(false);
|
|
24
30
|
}
|
|
25
|
-
setIsLoading(false);
|
|
26
31
|
};
|
|
27
32
|
getLicense();
|
|
28
33
|
}, []);
|
|
29
34
|
useEffect(() => {
|
|
30
35
|
const fetchToken = async () => {
|
|
31
36
|
setIsLoadingToken(true);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
try {
|
|
38
|
+
const response = await get("/translationstudio-strapi-extension/getToken");
|
|
39
|
+
if (response.data.token) {
|
|
40
|
+
setTokenValue(response.data.token);
|
|
41
|
+
} else {
|
|
42
|
+
setTokenValue("");
|
|
43
|
+
}
|
|
44
|
+
} catch (err) {
|
|
45
|
+
console.error(err);
|
|
46
|
+
} finally {
|
|
47
|
+
setIsLoadingToken(false);
|
|
37
48
|
}
|
|
38
|
-
setIsLoadingToken(false);
|
|
39
49
|
};
|
|
40
50
|
fetchToken();
|
|
41
51
|
}, []);
|
|
@@ -43,12 +53,16 @@ const SettingsPage = () => {
|
|
|
43
53
|
setLicenseValue(e.target.value);
|
|
44
54
|
};
|
|
45
55
|
const handleSaveLicense = async () => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
try {
|
|
57
|
+
const response = await post("/translationstudio-strapi-extension/setLicense", { license: licenseValue });
|
|
58
|
+
if (response) {
|
|
59
|
+
displayAlert("success");
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
} catch (err) {
|
|
63
|
+
console.error(err);
|
|
51
64
|
}
|
|
65
|
+
displayAlert("danger");
|
|
52
66
|
};
|
|
53
67
|
const displayAlert = (variant) => {
|
|
54
68
|
let message = variant === "success" ? "License saved" : "Error saving license";
|
|
@@ -61,9 +75,14 @@ const SettingsPage = () => {
|
|
|
61
75
|
};
|
|
62
76
|
const handleGenerateToken = async () => {
|
|
63
77
|
setIsLoadingToken(true);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
78
|
+
try {
|
|
79
|
+
const response = await post("/translationstudio-strapi-extension/generateToken");
|
|
80
|
+
if (response.data?.token) {
|
|
81
|
+
setTokenValue(response.data.token);
|
|
82
|
+
}
|
|
83
|
+
} catch (err) {
|
|
84
|
+
console.error(err);
|
|
85
|
+
} finally {
|
|
67
86
|
setIsLoadingToken(false);
|
|
68
87
|
}
|
|
69
88
|
};
|
|
@@ -18,26 +18,36 @@ const SettingsPage = () => {
|
|
|
18
18
|
react.useEffect(() => {
|
|
19
19
|
const getLicense = async () => {
|
|
20
20
|
setIsLoading(true);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
try {
|
|
22
|
+
const response = await get("/translationstudio-strapi-extension/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);
|
|
26
32
|
}
|
|
27
|
-
setIsLoading(false);
|
|
28
33
|
};
|
|
29
34
|
getLicense();
|
|
30
35
|
}, []);
|
|
31
36
|
react.useEffect(() => {
|
|
32
37
|
const fetchToken = async () => {
|
|
33
38
|
setIsLoadingToken(true);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
try {
|
|
40
|
+
const response = await get("/translationstudio-strapi-extension/getToken");
|
|
41
|
+
if (response.data.token) {
|
|
42
|
+
setTokenValue(response.data.token);
|
|
43
|
+
} else {
|
|
44
|
+
setTokenValue("");
|
|
45
|
+
}
|
|
46
|
+
} catch (err) {
|
|
47
|
+
console.error(err);
|
|
48
|
+
} finally {
|
|
49
|
+
setIsLoadingToken(false);
|
|
39
50
|
}
|
|
40
|
-
setIsLoadingToken(false);
|
|
41
51
|
};
|
|
42
52
|
fetchToken();
|
|
43
53
|
}, []);
|
|
@@ -45,12 +55,16 @@ const SettingsPage = () => {
|
|
|
45
55
|
setLicenseValue(e.target.value);
|
|
46
56
|
};
|
|
47
57
|
const handleSaveLicense = async () => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
try {
|
|
59
|
+
const response = await post("/translationstudio-strapi-extension/setLicense", { license: licenseValue });
|
|
60
|
+
if (response) {
|
|
61
|
+
displayAlert("success");
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
} catch (err) {
|
|
65
|
+
console.error(err);
|
|
53
66
|
}
|
|
67
|
+
displayAlert("danger");
|
|
54
68
|
};
|
|
55
69
|
const displayAlert = (variant) => {
|
|
56
70
|
let message = variant === "success" ? "License saved" : "Error saving license";
|
|
@@ -63,9 +77,14 @@ const SettingsPage = () => {
|
|
|
63
77
|
};
|
|
64
78
|
const handleGenerateToken = async () => {
|
|
65
79
|
setIsLoadingToken(true);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
80
|
+
try {
|
|
81
|
+
const response = await post("/translationstudio-strapi-extension/generateToken");
|
|
82
|
+
if (response.data?.token) {
|
|
83
|
+
setTokenValue(response.data.token);
|
|
84
|
+
}
|
|
85
|
+
} catch (err) {
|
|
86
|
+
console.error(err);
|
|
87
|
+
} finally {
|
|
69
88
|
setIsLoadingToken(false);
|
|
70
89
|
}
|
|
71
90
|
};
|
package/dist/admin/index.js
CHANGED
|
@@ -49,8 +49,12 @@ const TranslationMenu = () => {
|
|
|
49
49
|
const selectedLang = Array.isArray(languages) ? languages.find((lang) => lang.name === selectedOption) : void 0;
|
|
50
50
|
const isMachineTranslation = selectedLang?.machine ?? false;
|
|
51
51
|
async function fetchEmail() {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
try {
|
|
53
|
+
const response = await get("/translationstudio-strapi-extension/email");
|
|
54
|
+
setEmail(response.data.email ?? "");
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error(error);
|
|
57
|
+
}
|
|
54
58
|
}
|
|
55
59
|
react.useEffect(() => {
|
|
56
60
|
fetchEmail();
|
|
@@ -59,7 +63,7 @@ const TranslationMenu = () => {
|
|
|
59
63
|
if (!model || !id && isCollectionType) return;
|
|
60
64
|
const fetchLanguages = async () => {
|
|
61
65
|
try {
|
|
62
|
-
const response = await get("/translationstudio/mappings");
|
|
66
|
+
const response = await get("/translationstudio-strapi-extension/mappings");
|
|
63
67
|
setLanguages(response.data);
|
|
64
68
|
} catch (error) {
|
|
65
69
|
console.error("Error fetching languages:", error);
|
|
@@ -141,7 +145,7 @@ const TranslationMenu = () => {
|
|
|
141
145
|
const handleTranslationRequest = async () => {
|
|
142
146
|
const entryUid = isCollectionType ? `${model}#${id}` : model;
|
|
143
147
|
try {
|
|
144
|
-
const entryResponse = await post("/translationstudio/entrydata", {
|
|
148
|
+
const entryResponse = await post("/translationstudio-strapi-extension/entrydata", {
|
|
145
149
|
uid: entryUid,
|
|
146
150
|
locale: source
|
|
147
151
|
});
|
|
@@ -167,7 +171,7 @@ const TranslationMenu = () => {
|
|
|
167
171
|
name: determineEntryName(fetchedEntryData)
|
|
168
172
|
}
|
|
169
173
|
};
|
|
170
|
-
const response = await post("/translationstudio/translate", payload);
|
|
174
|
+
const response = await post("/translationstudio-strapi-extension/translate", payload);
|
|
171
175
|
displayAlert(
|
|
172
176
|
response.data === true ? "success" : "danger",
|
|
173
177
|
response.data === true ? "Translation request sent successfully" : "Error requesting translation"
|
|
@@ -281,7 +285,7 @@ const index = {
|
|
|
281
285
|
defaultMessage: PLUGIN_ID
|
|
282
286
|
},
|
|
283
287
|
Component: async () => {
|
|
284
|
-
const { App } = await Promise.resolve().then(() => require("../_chunks/App-
|
|
288
|
+
const { App } = await Promise.resolve().then(() => require("../_chunks/App-CUOeu4IU.js"));
|
|
285
289
|
return App;
|
|
286
290
|
}
|
|
287
291
|
});
|
package/dist/admin/index.mjs
CHANGED
|
@@ -48,8 +48,12 @@ const TranslationMenu = () => {
|
|
|
48
48
|
const selectedLang = Array.isArray(languages) ? languages.find((lang) => lang.name === selectedOption) : void 0;
|
|
49
49
|
const isMachineTranslation = selectedLang?.machine ?? false;
|
|
50
50
|
async function fetchEmail() {
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
try {
|
|
52
|
+
const response = await get("/translationstudio-strapi-extension/email");
|
|
53
|
+
setEmail(response.data.email ?? "");
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.error(error);
|
|
56
|
+
}
|
|
53
57
|
}
|
|
54
58
|
useEffect(() => {
|
|
55
59
|
fetchEmail();
|
|
@@ -58,7 +62,7 @@ const TranslationMenu = () => {
|
|
|
58
62
|
if (!model || !id && isCollectionType) return;
|
|
59
63
|
const fetchLanguages = async () => {
|
|
60
64
|
try {
|
|
61
|
-
const response = await get("/translationstudio/mappings");
|
|
65
|
+
const response = await get("/translationstudio-strapi-extension/mappings");
|
|
62
66
|
setLanguages(response.data);
|
|
63
67
|
} catch (error) {
|
|
64
68
|
console.error("Error fetching languages:", error);
|
|
@@ -140,7 +144,7 @@ const TranslationMenu = () => {
|
|
|
140
144
|
const handleTranslationRequest = async () => {
|
|
141
145
|
const entryUid = isCollectionType ? `${model}#${id}` : model;
|
|
142
146
|
try {
|
|
143
|
-
const entryResponse = await post("/translationstudio/entrydata", {
|
|
147
|
+
const entryResponse = await post("/translationstudio-strapi-extension/entrydata", {
|
|
144
148
|
uid: entryUid,
|
|
145
149
|
locale: source
|
|
146
150
|
});
|
|
@@ -166,7 +170,7 @@ const TranslationMenu = () => {
|
|
|
166
170
|
name: determineEntryName(fetchedEntryData)
|
|
167
171
|
}
|
|
168
172
|
};
|
|
169
|
-
const response = await post("/translationstudio/translate", payload);
|
|
173
|
+
const response = await post("/translationstudio-strapi-extension/translate", payload);
|
|
170
174
|
displayAlert(
|
|
171
175
|
response.data === true ? "success" : "danger",
|
|
172
176
|
response.data === true ? "Translation request sent successfully" : "Error requesting translation"
|
|
@@ -280,7 +284,7 @@ const index = {
|
|
|
280
284
|
defaultMessage: PLUGIN_ID
|
|
281
285
|
},
|
|
282
286
|
Component: async () => {
|
|
283
|
-
const { App } = await import("../_chunks/App-
|
|
287
|
+
const { App } = await import("../_chunks/App-Bw7t0TMJ.mjs");
|
|
284
288
|
return App;
|
|
285
289
|
}
|
|
286
290
|
});
|
package/package.json
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
"description": "translationstudio extension for strapi",
|
|
4
4
|
"license": "GPL-2.0-only",
|
|
5
5
|
"author": "Duncan Leininger <duncan.leininger@idmedia.com>",
|
|
6
|
-
"
|
|
6
|
+
"homepage": "https://translationstudio.tech",
|
|
7
|
+
"version": "1.0.2",
|
|
7
8
|
"keywords": [
|
|
8
9
|
"translationstudio",
|
|
9
10
|
"strapi",
|
|
@@ -40,7 +41,8 @@
|
|
|
40
41
|
"watch:link": "strapi-plugin watch:link",
|
|
41
42
|
"verify": "strapi-plugin verify",
|
|
42
43
|
"test:ts:front": "run -T tsc -p admin/tsconfig.json",
|
|
43
|
-
"test:ts:back": "run -T tsc -p server/tsconfig.json"
|
|
44
|
+
"test:ts:back": "run -T tsc -p server/tsconfig.json",
|
|
45
|
+
"publish": "npm publish --access public"
|
|
44
46
|
},
|
|
45
47
|
"dependencies": {
|
|
46
48
|
"@strapi/design-system": "^2.0.0-rc.14",
|