@crowdin/app-project-module 0.70.1 → 0.71.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/out/index.js +3 -3
- package/out/middlewares/integration-credentials.js +92 -6
- package/out/modules/integration/handlers/integration-logout.js +28 -0
- package/out/modules/integration/handlers/main.js +26 -0
- package/out/modules/integration/util/defaults.js +35 -0
- package/out/modules/integration/util/webhooks.js +1 -7
- package/out/modules/uninstall.js +4 -0
- package/out/static/css/styles.css +5 -1
- package/out/static/js/form.js +1 -1
- package/out/util/connection.js +2 -0
- package/out/views/error.handlebars +28 -5
- package/out/views/main.handlebars +9 -2
- package/package.json +3 -3
package/out/util/connection.js
CHANGED
|
@@ -46,6 +46,7 @@ const axios_2 = require("./axios");
|
|
|
46
46
|
const logger_1 = require("./logger");
|
|
47
47
|
const os = __importStar(require("os"));
|
|
48
48
|
const defaults_1 = require("../modules/integration/util/defaults");
|
|
49
|
+
const crowdinAppFunctions = __importStar(require("@crowdin/crowdin-apps-functions"));
|
|
49
50
|
const axiosCustom = new axios_2.AxiosProvider().axios;
|
|
50
51
|
function prepareCrowdinClient({ config, credentials, autoRenew = false, context, }) {
|
|
51
52
|
var _a, _b;
|
|
@@ -220,6 +221,7 @@ function prepareIntegrationCredentials(config, integration, integrationCredentia
|
|
|
220
221
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
221
222
|
return __awaiter(this, void 0, void 0, function* () {
|
|
222
223
|
const credentials = JSON.parse((0, _1.decryptData)(config, integrationCredentials.credentials));
|
|
224
|
+
credentials.ownerId = crowdinAppFunctions.parseCrowdinId(integrationCredentials.id).userId;
|
|
223
225
|
const oauthLogin = integration.oauthLogin;
|
|
224
226
|
const integrationLogin = integration.loginForm;
|
|
225
227
|
if ((oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.refresh) || (integrationLogin === null || integrationLogin === void 0 ? void 0 : integrationLogin.refresh)) {
|
|
@@ -8,11 +8,28 @@
|
|
|
8
8
|
<div>
|
|
9
9
|
<div class="error-page-message">
|
|
10
10
|
<crowdin-h3>{{ message }}</crowdin-h3>
|
|
11
|
+
{{#if owners}}
|
|
12
|
+
<crowdin-h6>This integration allows only one connection per project to ensure consistent configuration and prevent file import or synchronization issues.</crowdin-h6>
|
|
13
|
+
{{#if owners.[1]}}
|
|
14
|
+
<crowdin-h5 class="mt-2">Managed by:</crowdin-h5>
|
|
15
|
+
<ul>
|
|
16
|
+
{{#each owners}}
|
|
17
|
+
<li><crowdin-a href="#" onclick="contactUser({{this.id}})">{{this.name}}</crowdin-a></li>
|
|
18
|
+
{{/each}}
|
|
19
|
+
</ul>
|
|
20
|
+
<crowdin-h6 class="mt-2">To request access, please contact one of the project members listed above.</crowdin-h6>
|
|
21
|
+
{{else}}
|
|
22
|
+
<crowdin-h5 class="mt-2">Managed by: <crowdin-a href="#" onclick="contactUser({{owners.[0].id}})">{{owners.[0].name}}</crowdin-a></crowdin-h5>
|
|
23
|
+
<crowdin-h6 class="mt-2">To request access, please contact the project member listed above.</crowdin-h6>
|
|
24
|
+
{{/if}}
|
|
25
|
+
{{/if}}
|
|
11
26
|
</div>
|
|
12
|
-
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
27
|
+
{{#unless hideActions}}
|
|
28
|
+
<div class="error-page-action">
|
|
29
|
+
<crowdin-button outlined onclick="integrationLogout()">Log out</crowdin-button>
|
|
30
|
+
<span> or <crowdin-a href="https://crowdin.com/contacts" target="_blank">contact us</crowdin-a> for help</span>
|
|
31
|
+
</div>
|
|
32
|
+
{{/unless}}
|
|
16
33
|
</div>
|
|
17
34
|
</div>
|
|
18
35
|
</div>
|
|
@@ -28,4 +45,10 @@
|
|
|
28
45
|
.then(localStorage.removeItem('revised_{{name}}'))
|
|
29
46
|
.catch(e => catchRejection(e, 'Looks like you are not logged in'));
|
|
30
47
|
}
|
|
31
|
-
|
|
48
|
+
|
|
49
|
+
function contactUser(userId) {
|
|
50
|
+
AP.getContext(function(context) {
|
|
51
|
+
AP.redirect(`${context.organization_id ? '/u' : ''}/messages/create/${userId}`);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
</script>
|
|
@@ -42,7 +42,14 @@
|
|
|
42
42
|
{{#if configurationFields}}
|
|
43
43
|
<crowdin-button icon-before="settings" onclick="openModal(settingsModal);fillSettingsForm();">Settings</crowdin-button>
|
|
44
44
|
{{/if}}
|
|
45
|
-
<crowdin-button
|
|
45
|
+
<crowdin-button
|
|
46
|
+
{{#unless isOwner}}
|
|
47
|
+
disabled
|
|
48
|
+
title="Only the owner can log out"
|
|
49
|
+
{{/unless}}
|
|
50
|
+
icon-before="account_circle"
|
|
51
|
+
onclick="integrationLogout()"
|
|
52
|
+
>Log out</crowdin-button>
|
|
46
53
|
</div>
|
|
47
54
|
</div>
|
|
48
55
|
<crowdin-simple-integration
|
|
@@ -388,7 +395,7 @@
|
|
|
388
395
|
.then(checkResponse)
|
|
389
396
|
.then(reloadLocation)
|
|
390
397
|
.then(localStorage.removeItem('revised_{{name}}'))
|
|
391
|
-
.catch(e => catchRejection(e, 'Looks like you are not logged in'));
|
|
398
|
+
.catch(e => catchRejection(e, e.error || 'Looks like you are not logged in'));
|
|
392
399
|
}
|
|
393
400
|
|
|
394
401
|
function getCrowdinData() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crowdin/app-project-module",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.71.0",
|
|
4
4
|
"description": "Module that generates for you all common endpoints for serving standalone Crowdin App",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"types": "out/index.d.ts",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@aws-sdk/client-s3": "^3.606.0",
|
|
23
23
|
"@aws-sdk/s3-request-presigner": "^3.682.0",
|
|
24
|
-
"@crowdin/crowdin-apps-functions": "0.
|
|
25
|
-
"@crowdin/logs-formatter": "^2.1.
|
|
24
|
+
"@crowdin/crowdin-apps-functions": "^0.10.0",
|
|
25
|
+
"@crowdin/logs-formatter": "^2.1.7",
|
|
26
26
|
"@godaddy/terminus": "^4.12.1",
|
|
27
27
|
"@monaco-editor/react": "^4.6.0",
|
|
28
28
|
"amqplib": "^0.10.4",
|