@crowdin/app-project-module 0.26.6 → 0.28.0-10
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/CONTRIBUTING.md +19 -1
- package/README.md +1 -855
- package/out/handlers/crowdin-file-progress.d.ts +2 -2
- package/out/handlers/crowdin-file-progress.js +9 -4
- package/out/handlers/crowdin-update.js +4 -3
- package/out/handlers/crowdin-webhook.d.ts +4 -0
- package/out/handlers/crowdin-webhook.js +43 -0
- package/out/handlers/form-data-display.d.ts +3 -0
- package/out/handlers/form-data-display.js +46 -0
- package/out/handlers/form-data-save.d.ts +3 -0
- package/out/handlers/form-data-save.js +56 -0
- package/out/handlers/integration-logout.js +4 -0
- package/out/handlers/integration-webhook.d.ts +4 -0
- package/out/handlers/integration-webhook.js +39 -0
- package/out/handlers/main.js +7 -1
- package/out/handlers/settings-save.d.ts +2 -2
- package/out/handlers/settings-save.js +8 -3
- package/out/handlers/uninstall.js +4 -0
- package/out/index.js +50 -10
- package/out/middlewares/render-ui-module.d.ts +4 -0
- package/out/middlewares/render-ui-module.js +33 -0
- package/out/models/index.d.ts +79 -7
- package/out/models/index.js +13 -1
- package/out/static/css/styles.css +96 -0
- package/out/static/js/dependent.js +307 -0
- package/out/static/js/form.js +115 -0
- package/out/static/js/main.js +11 -1
- package/out/util/cron.js +9 -10
- package/out/util/defaults.js +55 -12
- package/out/util/index.js +5 -1
- package/out/util/webhooks.d.ts +29 -0
- package/out/util/webhooks.js +308 -0
- package/out/views/form.handlebars +29 -0
- package/out/views/login.handlebars +84 -16
- package/out/views/main.handlebars +171 -88
- package/out/views/partials/head.handlebars +5 -4
- package/package.json +37 -23
|
@@ -52,20 +52,56 @@
|
|
|
52
52
|
{{/each}}
|
|
53
53
|
</crowdin-select>
|
|
54
54
|
{{else}}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
55
|
+
{{#ifeq type "textarea"}}
|
|
56
|
+
<crowdin-textarea
|
|
57
|
+
id="{{key}}"
|
|
58
|
+
label="{{label}}"
|
|
59
|
+
{{#if helpText}}
|
|
60
|
+
help-text="{{helpText}}"
|
|
61
|
+
{{/if}}
|
|
62
|
+
{{#if helpTextHtml}}
|
|
63
|
+
help-text-html="{{helpTextHtml}}"
|
|
64
|
+
{{/if}}
|
|
65
|
+
value="{{#if defaultValue}}{{defaultValue}}{{/if}}">
|
|
66
|
+
</crowdin-textarea>
|
|
67
|
+
{{else}}
|
|
68
|
+
{{#ifeq type "file"}}
|
|
69
|
+
<div class="file-field">
|
|
70
|
+
{{#if helpText}}<div class="help-text">{{helpText}}</div>{{/if}}
|
|
71
|
+
{{#if helpTextHtml}}<div class="help-text">{{helpTextHtml}}</div>{{/if}}
|
|
72
|
+
<div class="upload">
|
|
73
|
+
<crowdin-button outlined onclick="uploadFiles('{{key}}');">{{label}}</crowdin-button>
|
|
74
|
+
<textarea hidden id="{{key}}"></textarea>
|
|
75
|
+
<input
|
|
76
|
+
id="store_{{key}}"
|
|
77
|
+
data-id="{{key}}"
|
|
78
|
+
{{#if accept}}
|
|
79
|
+
accept="{{accept}}"
|
|
80
|
+
{{/if}}
|
|
81
|
+
onchange="readFileData(event)"
|
|
82
|
+
hidden
|
|
83
|
+
type="{{type}}"
|
|
84
|
+
>
|
|
85
|
+
<div class="uploaded-file"><i>No file</i></div>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
{{else}}
|
|
89
|
+
<crowdin-input
|
|
90
|
+
id="{{key}}"
|
|
91
|
+
label="{{label}}"
|
|
92
|
+
{{#if helpText}}
|
|
93
|
+
help-text="{{helpText}}"
|
|
94
|
+
{{/if}}
|
|
95
|
+
{{#if helpTextHtml}}
|
|
96
|
+
help-text-html="{{helpTextHtml}}"
|
|
97
|
+
{{/if}}
|
|
98
|
+
{{#if type}}
|
|
99
|
+
type="{{type}}"
|
|
100
|
+
{{/if}}
|
|
101
|
+
value="{{#if defaultValue}}{{defaultValue}}{{/if}}">
|
|
102
|
+
</crowdin-input>
|
|
103
|
+
{{/ifeq}}
|
|
104
|
+
{{/ifeq}}
|
|
69
105
|
{{/ifeq}}
|
|
70
106
|
{{/ifeq}}
|
|
71
107
|
{{else}}
|
|
@@ -75,6 +111,7 @@
|
|
|
75
111
|
{{/each}}
|
|
76
112
|
</div>
|
|
77
113
|
<crowdin-button
|
|
114
|
+
id="login-button"
|
|
78
115
|
outlined icon-after="arrow_forward"
|
|
79
116
|
{{#if oauthLogin}}
|
|
80
117
|
onclick="oauthLogin()"
|
|
@@ -90,7 +127,7 @@
|
|
|
90
127
|
<crowdin-toasts></crowdin-toasts>
|
|
91
128
|
</body>
|
|
92
129
|
<script type="text/javascript">
|
|
93
|
-
const loginButton = document.querySelector('
|
|
130
|
+
const loginButton = document.querySelector('#login-button');
|
|
94
131
|
|
|
95
132
|
function oauthLogin() {
|
|
96
133
|
{{#if oauthUrl}}
|
|
@@ -147,6 +184,7 @@
|
|
|
147
184
|
})
|
|
148
185
|
)
|
|
149
186
|
.then(checkResponse)
|
|
187
|
+
.then(localStorage.removeItem('revised_{{name}}'))
|
|
150
188
|
.then(reloadLocation)
|
|
151
189
|
.catch(e => {
|
|
152
190
|
loginButton.setAttribute('disabled', false);
|
|
@@ -162,12 +200,42 @@
|
|
|
162
200
|
{{#ifeq type "checkbox"}}
|
|
163
201
|
'{{key}}': !!document.querySelector('#{{key}}').checked,
|
|
164
202
|
{{else}}
|
|
165
|
-
'{{key}}': document.querySelector('#{{key}}').getAttribute('value'),
|
|
203
|
+
'{{key}}': document.querySelector('#{{key}}').getAttribute('value') || document.querySelector('#{{key}}').value,
|
|
166
204
|
{{/ifeq}}
|
|
167
205
|
{{/if}}
|
|
168
206
|
{{/each}}
|
|
169
207
|
};
|
|
170
208
|
}
|
|
209
|
+
|
|
210
|
+
function uploadFiles(id) {
|
|
211
|
+
const input = document.querySelector(`#store_${id}`);
|
|
212
|
+
input.value = '';
|
|
213
|
+
input.click();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function readFileData(event) {
|
|
217
|
+
const reader = new FileReader();
|
|
218
|
+
const identifier = event.target.getAttribute('data-id');
|
|
219
|
+
const fileName = document.querySelector('.uploaded-file');
|
|
220
|
+
const input = document.querySelector(`#${identifier}`);
|
|
221
|
+
const file = event.target.files[0];
|
|
222
|
+
fileName.innerText = file.name;
|
|
223
|
+
|
|
224
|
+
reader.onloadstart = function() {
|
|
225
|
+
loginButton.setAttribute('disabled', true);
|
|
226
|
+
loginButton.setAttribute('is-loading', true);
|
|
227
|
+
};
|
|
228
|
+
reader.onloadend = function() {
|
|
229
|
+
loginButton.setAttribute('disabled', false);
|
|
230
|
+
loginButton.setAttribute('is-loading', false);
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
reader.onload = () => {
|
|
234
|
+
input.value = reader.result;
|
|
235
|
+
};
|
|
236
|
+
reader.readAsText(file);
|
|
237
|
+
}
|
|
238
|
+
|
|
171
239
|
</script>
|
|
172
240
|
|
|
173
241
|
</html>
|
|
@@ -20,20 +20,26 @@
|
|
|
20
20
|
<crowdin-button icon-before="settings" onclick="settingsModal.open();fillSettingsForm();">Settings</crowdin-button>
|
|
21
21
|
{{/if}}
|
|
22
22
|
<crowdin-button icon-before="account_circle" onclick="integrationLogout()">Log out</crowdin-button>
|
|
23
|
+
{{#if uploadTranslations}}
|
|
24
|
+
<crowdin-alert id="translation-info" no-icon="true" style="display: none;">
|
|
25
|
+
<div class="box-center">
|
|
26
|
+
<p class="info-text">
|
|
27
|
+
We recommend importing existing translations into your Crowdin project for newly uploaded source content.
|
|
28
|
+
Please note that translations imported for non-key-value formats may require additional review.
|
|
29
|
+
Read more about <crowdin-a href="https://support.crowdin.com/uploading-translations/" target="_blank">Uploading Translations</crowdin-a>.
|
|
30
|
+
</p>
|
|
31
|
+
</div>
|
|
32
|
+
<crowdin-button onclick="closeAlert(this)" class="dismiss-alert" icon>close</crowdin-button>
|
|
33
|
+
</crowdin-alert>
|
|
34
|
+
{{/if}}
|
|
23
35
|
</div>
|
|
24
36
|
<crowdin-simple-integration
|
|
25
|
-
{{#
|
|
26
|
-
crowdin-sync="true"
|
|
27
|
-
{{/if}}
|
|
28
|
-
{{#if withWebhookSync.integration}}
|
|
29
|
-
integration-sync="true"
|
|
30
|
-
{{/if}}
|
|
31
|
-
{{#if withCronSync.crowdin}}
|
|
37
|
+
{{#or withCronSync.crowdin webhooks.crowdin}}
|
|
32
38
|
crowdin-schedule="true"
|
|
33
|
-
{{/
|
|
34
|
-
{{#
|
|
39
|
+
{{/or}}
|
|
40
|
+
{{#or withCronSync.integration webhooks.integration}}
|
|
35
41
|
integration-schedule="true"
|
|
36
|
-
{{/
|
|
42
|
+
{{/or}}
|
|
37
43
|
{{#if integrationOneLevelFetching}}
|
|
38
44
|
integration-one-level-fetching="true"
|
|
39
45
|
{{/if}}
|
|
@@ -45,6 +51,9 @@
|
|
|
45
51
|
{{/if}}
|
|
46
52
|
integration-name="{{name}}"
|
|
47
53
|
integration-logo="logo.png"
|
|
54
|
+
{{#if uploadTranslations}}
|
|
55
|
+
integration-button-menu-items='[{"label":"Upload Translations", "action":"uploadTranslations"}]'
|
|
56
|
+
{{/if}}
|
|
48
57
|
>
|
|
49
58
|
</crowdin-simple-integration>
|
|
50
59
|
</div>
|
|
@@ -74,67 +83,85 @@
|
|
|
74
83
|
modal-title="Settings"
|
|
75
84
|
close-button-title="Close"
|
|
76
85
|
>
|
|
86
|
+
<div class="loader hidden">
|
|
87
|
+
<crowdin-progress-indicator></crowdin-progress-indicator>
|
|
88
|
+
</div>
|
|
77
89
|
<div id="modal-content">
|
|
78
90
|
{{#each configurationFields}}
|
|
79
91
|
{{#if key}}
|
|
80
92
|
{{#ifeq type "checkbox"}}
|
|
81
|
-
|
|
93
|
+
<crowdin-checkbox
|
|
94
|
+
id="{{key}}-settings"
|
|
95
|
+
key="{{key}}"
|
|
96
|
+
label="{{label}}"
|
|
97
|
+
value="false"
|
|
98
|
+
use-switch
|
|
99
|
+
{{#if helpText}}
|
|
100
|
+
help-text="{{helpText}}"
|
|
101
|
+
{{/if}}
|
|
102
|
+
{{#if helpTextHtml}}
|
|
103
|
+
help-text-html="{{helpTextHtml}}"
|
|
104
|
+
{{/if}}
|
|
105
|
+
{{#ifeq defaultValue true}}
|
|
106
|
+
checked="{{defaultValue}}"
|
|
107
|
+
{{/ifeq}}
|
|
108
|
+
{{#if dependencySettings}}
|
|
109
|
+
data-dependency="{{dependencySettings}}"
|
|
110
|
+
{{/if}}
|
|
111
|
+
>
|
|
112
|
+
</crowdin-checkbox>
|
|
113
|
+
{{/ifeq}}
|
|
114
|
+
{{#ifeq type "select"}}
|
|
115
|
+
<crowdin-select
|
|
116
|
+
{{#if isMulti}}
|
|
117
|
+
is-multi
|
|
118
|
+
close-on-select="false"
|
|
119
|
+
{{/if}}
|
|
120
|
+
{{#if isSearchable}}
|
|
121
|
+
is-searchable
|
|
122
|
+
{{/if}}
|
|
82
123
|
id="{{key}}-settings"
|
|
83
124
|
key="{{key}}"
|
|
84
125
|
label="{{label}}"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
{{
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
{{
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
126
|
+
{{#if helpText}}
|
|
127
|
+
help-text="{{helpText}}"
|
|
128
|
+
{{/if}}
|
|
129
|
+
{{#if helpTextHtml}}
|
|
130
|
+
help-text-html="{{helpTextHtml}}"
|
|
131
|
+
{{/if}}
|
|
132
|
+
{{#if dependencySettings}}
|
|
133
|
+
data-dependency="{{dependencySettings}}"
|
|
134
|
+
{{/if}}
|
|
135
|
+
>
|
|
136
|
+
{{#each options}}
|
|
137
|
+
<option
|
|
138
|
+
{{#if ../defaultValue}}
|
|
139
|
+
{{#ifeq ../defaultValue value}} selected {{/ifeq}}
|
|
140
|
+
{{#in ../defaultValue value}} selected {{/in}}
|
|
141
|
+
{{/if}}
|
|
142
|
+
value="{{value}}">{{label}}
|
|
143
|
+
</option>
|
|
144
|
+
{{/each}}
|
|
145
|
+
</crowdin-select>
|
|
98
146
|
{{/ifeq}}
|
|
99
|
-
{{#ifeq type "
|
|
100
|
-
|
|
101
|
-
{{
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
{{#if isSearchable}}
|
|
106
|
-
is-searchable
|
|
107
|
-
{{/if}}
|
|
108
|
-
id="{{key}}-settings"
|
|
109
|
-
key="{{key}}"
|
|
110
|
-
label="{{label}}"
|
|
147
|
+
{{#ifeq type "text"}}
|
|
148
|
+
<crowdin-input
|
|
149
|
+
id="{{key}}-settings"
|
|
150
|
+
label="{{label}}"
|
|
151
|
+
key="{{key}}"
|
|
152
|
+
with-fixed-height
|
|
111
153
|
{{#if helpText}}
|
|
112
154
|
help-text="{{helpText}}"
|
|
113
155
|
{{/if}}
|
|
114
156
|
{{#if helpTextHtml}}
|
|
115
157
|
help-text-html="{{helpTextHtml}}"
|
|
116
158
|
{{/if}}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
{{/
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
{{#ifeq type "text"}}
|
|
124
|
-
<crowdin-input
|
|
125
|
-
id="{{key}}-settings"
|
|
126
|
-
label="{{label}}"
|
|
127
|
-
key="{{key}}"
|
|
128
|
-
with-fixed-height
|
|
129
|
-
{{#if helpText}}
|
|
130
|
-
help-text="{{helpText}}"
|
|
131
|
-
{{/if}}
|
|
132
|
-
{{#if helpTextHtml}}
|
|
133
|
-
help-text-html="{{helpTextHtml}}"
|
|
134
|
-
{{/if}}
|
|
135
|
-
value="{{#if defaultValue}}{{defaultValue}}{{/if}}"
|
|
136
|
-
>
|
|
137
|
-
</crowdin-input>
|
|
159
|
+
{{#if dependencySettings}}
|
|
160
|
+
data-dependency="{{dependencySettings}}"
|
|
161
|
+
{{/if}}
|
|
162
|
+
value="{{#if defaultValue}}{{defaultValue}}{{/if}}"
|
|
163
|
+
>
|
|
164
|
+
</crowdin-input>
|
|
138
165
|
{{/ifeq}}
|
|
139
166
|
{{else}}
|
|
140
167
|
<crowdin-p>{{label}}</crowdin-p>
|
|
@@ -191,6 +218,7 @@
|
|
|
191
218
|
.then(queryParams => fetch(`api/logout${queryParams}`, { method: 'POST' }))
|
|
192
219
|
.then(checkResponse)
|
|
193
220
|
.then(reloadLocation)
|
|
221
|
+
.then(localStorage.removeItem('revised_{{name}}'))
|
|
194
222
|
.catch(e => catchRejection(e, 'Looks like you are not logged in'));
|
|
195
223
|
}
|
|
196
224
|
|
|
@@ -225,9 +253,9 @@
|
|
|
225
253
|
project = res;
|
|
226
254
|
appComponent.setCrowdinLanguagesData(project.targetLanguages)
|
|
227
255
|
})
|
|
228
|
-
{{#
|
|
256
|
+
{{#or withCronSync webhooks}}
|
|
229
257
|
.then(() => getSyncSettings('crowdin'))
|
|
230
|
-
{{/
|
|
258
|
+
{{/or}}
|
|
231
259
|
.catch(e => catchRejection(e, 'Can\'t fetch Crowdin data'))
|
|
232
260
|
.finally(() => (appComponent.setAttribute('is-crowdin-loading', false)));
|
|
233
261
|
}
|
|
@@ -272,9 +300,9 @@
|
|
|
272
300
|
appComponent.setIntegrationOpenedFolders(openIds);
|
|
273
301
|
}
|
|
274
302
|
})
|
|
275
|
-
{{#
|
|
303
|
+
{{#or withCronSync webhooks}}
|
|
276
304
|
.then(() => getSyncSettings('integration'))
|
|
277
|
-
{{/
|
|
305
|
+
{{/or}}
|
|
278
306
|
.catch(e => catchRejection(e, 'Can\'t fetch {{name}} templates'))
|
|
279
307
|
.finally(() => (appComponent.setAttribute('is-integration-loading', false)));
|
|
280
308
|
}
|
|
@@ -301,26 +329,46 @@
|
|
|
301
329
|
.catch(e => catchRejection(e, 'Can\'t fetch file progress'));
|
|
302
330
|
}
|
|
303
331
|
|
|
304
|
-
function uploadFilesToCrowdin(
|
|
305
|
-
|
|
332
|
+
function uploadFilesToCrowdin(event) {
|
|
333
|
+
let files = [];
|
|
334
|
+
let uploadTranslations = false;
|
|
335
|
+
if (event.detail.action === 'uploadTranslations') {
|
|
336
|
+
files = event.detail.files;
|
|
337
|
+
uploadTranslations = true;
|
|
338
|
+
} else {
|
|
339
|
+
files = event.detail;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
if (event.detail.length === 0) {
|
|
306
343
|
showToast('Select templates which will be pushed to Crowdin');
|
|
307
344
|
return;
|
|
308
345
|
}
|
|
309
346
|
appComponent.setAttribute('is-to-crowdin-process', true);
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
347
|
+
let req;
|
|
348
|
+
{{#if integrationOneLevelFetching}}
|
|
349
|
+
req = files.map(f => ({
|
|
350
|
+
name: f.name,
|
|
351
|
+
id: f.id,
|
|
352
|
+
type: f.type,
|
|
353
|
+
parentId: f.parent_id,
|
|
354
|
+
nodeType: f.node_type
|
|
355
|
+
}));
|
|
356
|
+
{{else}}
|
|
357
|
+
req = files.filter(f => f.node_type !== folderType).map(f => ({
|
|
358
|
+
name: f.name,
|
|
359
|
+
id: f.id,
|
|
360
|
+
type: f.type,
|
|
361
|
+
parentId: f.parent_id
|
|
362
|
+
}));
|
|
363
|
+
{{/if}}
|
|
316
364
|
checkOrigin()
|
|
317
|
-
.then(restParams => fetch(
|
|
365
|
+
.then(restParams => fetch(`api/crowdin/update${restParams}&uploadTranslations=${uploadTranslations}`, {
|
|
318
366
|
method: 'POST',
|
|
319
367
|
headers: { 'Content-Type': 'application/json' },
|
|
320
368
|
body: JSON.stringify(req)
|
|
321
369
|
}))
|
|
322
370
|
.then(checkResponse)
|
|
323
|
-
.then(() => showToast(`File${
|
|
371
|
+
.then(() => showToast(`File${event.detail.length > 1 ? 's' : ''} imported successfully`))
|
|
324
372
|
.then(getCrowdinData)
|
|
325
373
|
.catch(e => catchRejection(e, 'Can\'t upload templates to Crowdin'))
|
|
326
374
|
.finally(() => (appComponent.setAttribute('is-to-crowdin-process', false)));
|
|
@@ -353,32 +401,37 @@
|
|
|
353
401
|
const settingsSaveBtn = document.getElementById('settings-save-btn');
|
|
354
402
|
let config = JSON.parse('{{{config}}}');
|
|
355
403
|
|
|
404
|
+
function triggerEvent(el, type) {
|
|
405
|
+
const e = document.createEvent('HTMLEvents');
|
|
406
|
+
e.initEvent(type, false, true);
|
|
407
|
+
el.dispatchEvent(e);
|
|
408
|
+
}
|
|
409
|
+
|
|
356
410
|
function fillSettingsForm() {
|
|
357
411
|
Object.entries(config).forEach(([key, value]) => {
|
|
358
412
|
if (value) {
|
|
359
413
|
const el = document.getElementById(`${key}-settings`);
|
|
360
|
-
if (el
|
|
361
|
-
if (el.
|
|
362
|
-
el.
|
|
414
|
+
if (el) {
|
|
415
|
+
if (el.tagName.toLowerCase() === 'crowdin-select') {
|
|
416
|
+
if (el.hasAttribute('is-multi')) {
|
|
417
|
+
el.value = JSON.stringify(value);
|
|
418
|
+
} else {
|
|
419
|
+
el.value = JSON.stringify([value]);
|
|
420
|
+
}
|
|
421
|
+
} else if (el.tagName.toLowerCase() === 'crowdin-checkbox') {
|
|
422
|
+
el.checked = !!value;
|
|
363
423
|
} else {
|
|
364
|
-
el.value =
|
|
424
|
+
el.value = value;
|
|
365
425
|
}
|
|
366
|
-
|
|
367
|
-
el
|
|
368
|
-
} else {
|
|
369
|
-
el.value = value;
|
|
426
|
+
|
|
427
|
+
triggerEvent(el, 'change');
|
|
370
428
|
}
|
|
371
429
|
}
|
|
372
430
|
});
|
|
373
|
-
{{#if withCronSync}}
|
|
374
|
-
const sheduleSettings = document.querySelector('#schedule-settings');
|
|
375
|
-
if (JSON.parse(sheduleSettings.value).length <= 0) {
|
|
376
|
-
sheduleSettings.value = JSON.stringify(["0"]);
|
|
377
|
-
}
|
|
378
|
-
{{/if}}
|
|
379
431
|
}
|
|
380
432
|
|
|
381
433
|
function saveSettings() {
|
|
434
|
+
setLoader();
|
|
382
435
|
const settingsElements = Array.from(document.getElementById('modal-content').children);
|
|
383
436
|
const tags = ['crowdin-checkbox', 'crowdin-select', 'crowdin-input'];
|
|
384
437
|
const configReq = {};
|
|
@@ -413,6 +466,7 @@
|
|
|
413
466
|
})
|
|
414
467
|
.catch(e => catchRejection(e, 'Can\'t save settings'))
|
|
415
468
|
.finally(() => {
|
|
469
|
+
unsetLoader();
|
|
416
470
|
settingsSaveBtn.removeAttribute('disabled');
|
|
417
471
|
settingsModal.close();
|
|
418
472
|
{{#if reloadOnConfigSave}}
|
|
@@ -421,6 +475,19 @@
|
|
|
421
475
|
{{/if}}
|
|
422
476
|
});
|
|
423
477
|
}
|
|
478
|
+
|
|
479
|
+
function setLoader() {
|
|
480
|
+
const loader = document.querySelector('#settings-modal .loader');
|
|
481
|
+
loader.classList.remove('hidden');
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
function unsetLoader() {
|
|
485
|
+
const loader = document.querySelector('#settings-modal .loader');
|
|
486
|
+
setTimeout(function() {
|
|
487
|
+
loader.classList.add('hidden');
|
|
488
|
+
}, 500)
|
|
489
|
+
}
|
|
490
|
+
|
|
424
491
|
{{else}}
|
|
425
492
|
const settingsModal = undefined;
|
|
426
493
|
{{/if}}
|
|
@@ -449,7 +516,7 @@
|
|
|
449
516
|
})
|
|
450
517
|
{{/if}}
|
|
451
518
|
|
|
452
|
-
{{#
|
|
519
|
+
{{#or withCronSync webhooks}}
|
|
453
520
|
document.body.addEventListener('integrationScheduleSync', setIntegrationScheduleSync);
|
|
454
521
|
document.body.addEventListener('crowdinScheduleSync', setCrowdinScheduleSync);
|
|
455
522
|
document.body.addEventListener('crowdinDisableSync', disableCrowdinSync);
|
|
@@ -510,7 +577,7 @@
|
|
|
510
577
|
.catch(e => catchRejection(e, 'Can\'t save schedule sync settings'))
|
|
511
578
|
.finally(() => (appComponent.setAttribute(`is-${provider}-loading`, false)));
|
|
512
579
|
}
|
|
513
|
-
{{/
|
|
580
|
+
{{/or}}
|
|
514
581
|
|
|
515
582
|
{{#if checkSubscription}}
|
|
516
583
|
const subscriptionInfo = document.getElementById('subscription-info');
|
|
@@ -530,6 +597,22 @@
|
|
|
530
597
|
|
|
531
598
|
getSubscriptionInfo();
|
|
532
599
|
{{/if}}
|
|
600
|
+
|
|
601
|
+
{{#if uploadTranslations}}
|
|
602
|
+
const translationInfo = document.getElementById('translation-info');
|
|
603
|
+
function checkAlert(alert) {
|
|
604
|
+
const revised = localStorage.getItem('revised_{{name}}') === '1';
|
|
605
|
+
if (!revised) {
|
|
606
|
+
alert.style.display = 'block';
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
function closeAlert(el) {
|
|
610
|
+
const alert = el.closest('crowdin-alert');
|
|
611
|
+
alert.style.display = 'none';
|
|
612
|
+
localStorage.setItem('revised_{{name}}', 1);
|
|
613
|
+
}
|
|
614
|
+
checkAlert(translationInfo);
|
|
615
|
+
{{/if}}
|
|
533
616
|
</script>
|
|
534
617
|
|
|
535
|
-
</html>
|
|
618
|
+
</html>
|
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
4
4
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
5
5
|
<title></title>
|
|
6
|
-
<link rel="stylesheet" href="assets/css/styles.css">
|
|
6
|
+
<link rel="stylesheet" href="/assets/css/styles.css">
|
|
7
7
|
<script type="module"
|
|
8
8
|
src="https://crowdin-web-components.s3.amazonaws.com/crowdin-web-components/crowdin-web-components.esm.js"></script>
|
|
9
9
|
<script nomodule=""
|
|
10
10
|
src="https://crowdin-web-components.s3.amazonaws.com/crowdin-web-components/crowdin-web-components.js"></script>
|
|
11
11
|
<script type="text/javascript" src="https://cdn.crowdin.com/apps/dist/iframe.js"></script>
|
|
12
|
-
<script type="text/javascript" src="assets/js/polyfills/promise.js"></script>
|
|
13
|
-
<script type="text/javascript" src="assets/js/polyfills/fetch.js"></script>
|
|
14
|
-
<script type="text/javascript" src="assets/js/main.js"></script>
|
|
12
|
+
<script type="text/javascript" src="/assets/js/polyfills/promise.js"></script>
|
|
13
|
+
<script type="text/javascript" src="/assets/js/polyfills/fetch.js"></script>
|
|
14
|
+
<script type="text/javascript" src="/assets/js/main.js"></script>
|
|
15
|
+
<script type="text/javascript" src="/assets/js/dependent.js"></script>
|
|
15
16
|
<style>
|
|
16
17
|
.ml-10 {
|
|
17
18
|
margin-left: 10px;
|
package/package.json
CHANGED
|
@@ -1,46 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crowdin/app-project-module",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0-10",
|
|
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",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "tsc -p ./ && cp -R views out && cp -R static out && cp logo.png out",
|
|
8
|
+
"build": "tsc -p ./ && cp -R views out && cp -R static out && cp logo.png out && rollup -c rollup.config.mjs",
|
|
9
9
|
"lint": "eslint --fix \"{src,tests}/**/*.{js,ts}\"",
|
|
10
10
|
"prettier": "prettier --config .prettierrc src/**/*.ts --write",
|
|
11
11
|
"lint-ci": "eslint \"{src,tests}/**/*.{js,ts}\"",
|
|
12
|
-
"test-coverage": "jest --
|
|
13
|
-
"test": "jest
|
|
12
|
+
"test-coverage": "jest --ci --reporters=jest-junit --reporters=default --coverage --coverageReporters=cobertura --coverageReporters=html",
|
|
13
|
+
"test": "jest"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@crowdin/crowdin-apps-functions": "0.
|
|
17
|
-
"@types/pg": "^8.6.
|
|
16
|
+
"@crowdin/crowdin-apps-functions": "0.4.0",
|
|
17
|
+
"@types/pg": "^8.6.6",
|
|
18
|
+
"amqplib": "^0.10.3",
|
|
18
19
|
"crypto-js": "^4.0.0",
|
|
19
|
-
"express": "4.
|
|
20
|
+
"express": "4.18.2",
|
|
20
21
|
"express-handlebars": "^5.3.4",
|
|
21
22
|
"mysql2": "^2.3.3",
|
|
22
|
-
"node-cron": "^3.0.
|
|
23
|
-
"pg": "^8.
|
|
24
|
-
"sqlite3": "^5.
|
|
23
|
+
"node-cron": "^3.0.2",
|
|
24
|
+
"pg": "^8.10.0",
|
|
25
|
+
"sqlite3": "^5.1.6",
|
|
25
26
|
"uuid": "^8.3.2"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
29
|
+
"@types/amqplib": "^0.10.1",
|
|
30
|
+
"@babel/preset-react": "^7.18.6",
|
|
31
|
+
"@emotion/react": "^11.10.6",
|
|
32
|
+
"@emotion/styled": "^11.10.6",
|
|
33
|
+
"@mui/icons-material": "^5.11.11",
|
|
34
|
+
"@mui/material": "^5.11.12",
|
|
35
|
+
"@rjsf/core": "^5.2.0",
|
|
36
|
+
"@rjsf/mui": "^5.2.0",
|
|
37
|
+
"@rjsf/utils": "^5.2.0",
|
|
38
|
+
"@rjsf/validator-ajv8": "^5.2.0",
|
|
39
|
+
"@rollup/plugin-babel": "^6.0.3",
|
|
40
|
+
"@rollup/plugin-commonjs": "^24.0.1",
|
|
41
|
+
"@rollup/plugin-json": "^6.0.0",
|
|
42
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
43
|
+
"@rollup/plugin-replace": "^5.0.2",
|
|
44
|
+
"@rollup/plugin-terser": "^0.4.0",
|
|
28
45
|
"@types/crypto-js": "^4.0.0",
|
|
29
|
-
"@types/express": "4.17.
|
|
46
|
+
"@types/express": "4.17.17",
|
|
30
47
|
"@types/express-handlebars": "^5.3.1",
|
|
31
|
-
"@types/jest": "^29.
|
|
32
|
-
"@types/node": "^12.
|
|
33
|
-
"@types/node-cron": "^3.0.
|
|
48
|
+
"@types/jest": "^29.5.0",
|
|
49
|
+
"@types/node": "^12.20.55",
|
|
50
|
+
"@types/node-cron": "^3.0.7",
|
|
34
51
|
"@typescript-eslint/eslint-plugin": "^2.3.1",
|
|
35
52
|
"@typescript-eslint/parser": "^2.3.1",
|
|
36
53
|
"eslint": "^6.4.0",
|
|
37
54
|
"eslint-config-prettier": "^6.3.0",
|
|
38
55
|
"eslint-plugin-prettier": "^3.1.1",
|
|
39
|
-
"jest": "^29.
|
|
56
|
+
"jest": "^29.5.0",
|
|
40
57
|
"jest-junit": "^15.0.0",
|
|
41
58
|
"prettier": "^2.8.1",
|
|
42
|
-
"
|
|
43
|
-
"
|
|
59
|
+
"react": "^18.2.0",
|
|
60
|
+
"react-dom": "^18.2.0",
|
|
61
|
+
"rollup": "^3.20.2",
|
|
62
|
+
"ts-jest": "^29.0.5",
|
|
63
|
+
"typescript": "^4.9.5"
|
|
44
64
|
},
|
|
45
65
|
"repository": {
|
|
46
66
|
"type": "git",
|
|
@@ -52,12 +72,6 @@
|
|
|
52
72
|
"Applications",
|
|
53
73
|
"App"
|
|
54
74
|
],
|
|
55
|
-
"jest": {
|
|
56
|
-
"coverageReporters": [
|
|
57
|
-
"text",
|
|
58
|
-
"cobertura"
|
|
59
|
-
]
|
|
60
|
-
},
|
|
61
75
|
"license": "MIT",
|
|
62
76
|
"bugs": {
|
|
63
77
|
"url": "https://github.com/crowdin/app-project-module/issues"
|