@crowdin/app-project-module 0.96.3 → 0.98.0-cf-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.
Files changed (79) hide show
  1. package/out/index.js +17 -6
  2. package/out/middlewares/integration-credentials.js +4 -1
  3. package/out/middlewares/render-ui-module.d.ts +3 -3
  4. package/out/middlewares/render-ui-module.js +9 -13
  5. package/out/middlewares/ui-module.js +4 -1
  6. package/out/modules/about.d.ts +1 -1
  7. package/out/modules/about.js +8 -2
  8. package/out/modules/ai-prompt-provider/index.js +4 -2
  9. package/out/modules/ai-provider/index.js +4 -2
  10. package/out/modules/ai-tools/index.js +1 -1
  11. package/out/modules/context-menu/index.js +2 -2
  12. package/out/modules/custom-mt/index.js +3 -1
  13. package/out/modules/custom-spell-check/index.js +4 -4
  14. package/out/modules/editor-right-panel/index.js +1 -1
  15. package/out/modules/external-qa-check/index.js +2 -2
  16. package/out/modules/integration/handlers/main.js +13 -1
  17. package/out/modules/integration/handlers/oauth-login.js +10 -2
  18. package/out/modules/integration/index.js +27 -21
  19. package/out/modules/integration/util/job.js +2 -4
  20. package/out/modules/integration/util/types.d.ts +2 -1
  21. package/out/modules/modal/index.js +2 -2
  22. package/out/modules/organization-menu/index.js +6 -4
  23. package/out/modules/organization-settings-menu/index.js +6 -4
  24. package/out/modules/profile-resources-menu/index.js +6 -4
  25. package/out/modules/profile-settings-menu/index.js +6 -4
  26. package/out/modules/project-menu/index.js +1 -1
  27. package/out/modules/project-menu-crowdsource/index.js +1 -1
  28. package/out/modules/project-reports/index.js +4 -2
  29. package/out/modules/project-tools/index.js +4 -2
  30. package/out/modules/workflow-step-type/index.js +3 -2
  31. package/out/storage/d1.d.ts +99 -0
  32. package/out/storage/d1.js +769 -0
  33. package/out/storage/index.d.ts +1 -0
  34. package/out/storage/index.js +8 -1
  35. package/out/storage/mysql.d.ts +1 -0
  36. package/out/storage/mysql.js +7 -1
  37. package/out/storage/postgre.d.ts +1 -0
  38. package/out/storage/postgre.js +2 -1
  39. package/out/storage/sqlite.d.ts +1 -0
  40. package/out/storage/sqlite.js +2 -1
  41. package/out/types.d.ts +10 -0
  42. package/out/util/index.d.ts +1 -0
  43. package/out/util/index.js +8 -2
  44. package/out/util/jsx-renderer.d.ts +6 -0
  45. package/out/util/jsx-renderer.js +13 -0
  46. package/out/util/static-files.d.ts +19 -0
  47. package/out/util/static-files.js +80 -0
  48. package/out/views/AboutPage.d.ts +9 -0
  49. package/out/views/AboutPage.js +79 -0
  50. package/out/views/ErrorPage.d.ts +18 -0
  51. package/out/views/ErrorPage.js +56 -0
  52. package/out/views/FormPage.d.ts +13 -0
  53. package/out/views/FormPage.js +27 -0
  54. package/out/views/InstallPage.d.ts +10 -0
  55. package/out/views/InstallPage.js +22 -0
  56. package/out/views/LoginPage.d.ts +33 -0
  57. package/out/views/LoginPage.js +199 -0
  58. package/out/views/MainPage.d.ts +79 -0
  59. package/out/views/MainPage.js +1613 -0
  60. package/out/views/OAuthPage.d.ts +7 -0
  61. package/out/views/OAuthPage.js +17 -0
  62. package/out/views/SubscriptionPage.d.ts +7 -0
  63. package/out/views/SubscriptionPage.js +26 -0
  64. package/out/views/index.d.ts +13 -0
  65. package/out/views/index.js +25 -0
  66. package/out/views/layout/Head.d.ts +9 -0
  67. package/out/views/layout/Head.js +54 -0
  68. package/package.json +12 -11
  69. package/out/util/handlebars.d.ts +0 -1
  70. package/out/util/handlebars.js +0 -46
  71. package/out/views/about.handlebars +0 -102
  72. package/out/views/error.handlebars +0 -54
  73. package/out/views/form.handlebars +0 -30
  74. package/out/views/install.handlebars +0 -16
  75. package/out/views/login.handlebars +0 -331
  76. package/out/views/main.handlebars +0 -1857
  77. package/out/views/oauth.handlebars +0 -11
  78. package/out/views/partials/head.handlebars +0 -53
  79. package/out/views/subscription.handlebars +0 -26
@@ -1,331 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- {{> head}}
4
-
5
- <body>
6
- <div class="i_w center">
7
- <div>
8
- <crowdin-card is-shadowed is-padding-lg class="login">
9
- <img alt='{{ name }} logo' src='logo.png' />
10
- <crowdin-h4 id="integration-name">{{ name }}</crowdin-h4>
11
- <div class="inputs">
12
- {{#each loginFields}}
13
- {{#if key}}
14
- {{#in type "checkbox select textarea file notice"}}
15
- {{#ifeq type "checkbox"}}
16
- <crowdin-checkbox
17
- id="{{key}}"
18
- label="{{label}}"
19
- value="false"
20
- use-switch
21
- {{#if helpText}}
22
- help-text="{{helpText}}"
23
- {{/if}}
24
- {{#if helpTextHtml}}
25
- help-text-html="{{helpTextHtml}}"
26
- {{/if}}
27
- {{#ifeq defaultValue true}}
28
- checked="{{defaultValue}}"
29
- {{/ifeq}}
30
- {{#if dependencySettings}}
31
- data-dependency="{{dependencySettings}}"
32
- {{/if}}
33
- >
34
- </crowdin-checkbox>
35
- {{/ifeq}}
36
- {{#ifeq type "select"}}
37
- <crowdin-select
38
- {{#if isMulti}}
39
- is-multi
40
- close-on-select="false"
41
- {{/if}}
42
- {{#if isSearchable}}
43
- is-searchable
44
- {{/if}}
45
- id="{{key}}"
46
- label="{{label}}"
47
- {{#if helpText}}
48
- help-text="{{helpText}}"
49
- {{/if}}
50
- {{#if helpTextHtml}}
51
- help-text-html="{{helpTextHtml}}"
52
- {{/if}}
53
- {{#if dependencySettings}}
54
- data-dependency="{{dependencySettings}}"
55
- {{/if}}
56
- >
57
- {{#each options}}
58
- <option {{#ifeq ../defaultValue value}} selected {{/ifeq}} value="{{value}}">{{label}}</option>
59
- {{/each}}
60
- </crowdin-select>
61
- {{/ifeq}}
62
- {{#ifeq type "textarea"}}
63
- <crowdin-textarea
64
- id="{{key}}"
65
- label="{{label}}"
66
- {{#if helpText}}
67
- help-text="{{helpText}}"
68
- {{/if}}
69
- {{#if helpTextHtml}}
70
- help-text-html="{{helpTextHtml}}"
71
- {{/if}}
72
- {{#if dependencySettings}}
73
- data-dependency="{{dependencySettings}}"
74
- {{/if}}
75
- value="{{#if defaultValue}}{{defaultValue}}{{/if}}">
76
- </crowdin-textarea>
77
- {{/ifeq}}
78
- {{#ifeq type "notice"}}
79
- <crowdin-alert
80
- {{#if noticeType}}
81
- type="{{noticeType}}"
82
- {{/if}}
83
- {{#if label}}
84
- title="{{label}}"
85
- {{/if}}
86
- {{#if noIcon}}
87
- no-icon="{{noIcon}}"
88
- {{/if}}
89
- {{#if dependencySettings}}
90
- data-dependency="{{dependencySettings}}"
91
- {{/if}}
92
- >
93
- {{{helpText}}}
94
- </crowdin-alert>
95
- {{/ifeq}}
96
- {{#ifeq type "file"}}
97
- <div class="file-field">
98
- {{#if helpText}}<div class="help-text">{{helpText}}</div>{{/if}}
99
- {{#if helpTextHtml}}<div class="help-text">{{helpTextHtml}}</div>{{/if}}
100
- <div class="upload">
101
- <crowdin-button outlined onclick="uploadFiles('{{key}}');">{{label}}</crowdin-button>
102
- <textarea hidden id="{{key}}"></textarea>
103
- <input
104
- id="store_{{key}}"
105
- data-id="{{key}}"
106
- {{#if accept}}
107
- accept="{{accept}}"
108
- {{/if}}
109
- onchange="readFileData(event)"
110
- hidden
111
- type="{{type}}"
112
- >
113
- <div class="uploaded-file"><i>No file</i></div>
114
- </div>
115
- </div>
116
- {{/ifeq}}
117
- {{else}}
118
- <crowdin-input
119
- id="{{key}}"
120
- label="{{label}}"
121
- {{#if helpText}}
122
- help-text="{{helpText}}"
123
- {{/if}}
124
- {{#if helpTextHtml}}
125
- help-text-html="{{helpTextHtml}}"
126
- {{/if}}
127
- {{#if type}}
128
- type="{{type}}"
129
- {{/if}}
130
- {{#if dependencySettings}}
131
- data-dependency="{{dependencySettings}}"
132
- {{/if}}
133
- value="{{#if defaultValue}}{{defaultValue}}{{/if}}">
134
- </crowdin-input>
135
- {{/in}}
136
- {{else}}
137
- {{#if labelHtml}}
138
- <crowdin-p
139
- {{#if dependencySettings}}
140
- data-dependency="{{dependencySettings}}"
141
- {{/if}}
142
- >
143
- {{{labelHtml}}}
144
- </crowdin-p>
145
- {{else}}
146
- <crowdin-p
147
- {{#if dependencySettings}}
148
- data-dependency="{{dependencySettings}}"
149
- {{/if}}
150
- >
151
- {{label}}
152
- </crowdin-p>
153
- {{/if}}
154
- {{/if}}
155
- <div
156
- style="padding: 8px"
157
- {{#if dependencySettings}}
158
- data-dependency="{{dependencySettings}}"
159
- {{/if}}
160
- ></div>
161
- {{/each}}
162
- </div>
163
- <crowdin-button
164
- id="login-button"
165
- outlined icon-after="arrow_forward"
166
- {{#if oauthLogin}}
167
- onclick="oauthLogin()"
168
- {{else}}
169
- onclick="integrationLogin()"
170
- {{/if}}
171
- >
172
- Log In With {{ name }}
173
- </crowdin-button>
174
- </crowdin-card>
175
- </div>
176
- </div>
177
- <crowdin-toasts></crowdin-toasts>
178
- </body>
179
- <script type="text/javascript">
180
- const loginButton = document.querySelector('#login-button');
181
- let refreshIntervalId;
182
-
183
- function oauthLogin() {
184
- {{#if oauthUrl}}
185
- const url = '{{{ oauthUrl }}}';
186
- {{else}}
187
- const url = undefined;
188
- {{/if}}
189
- if (url) {
190
- openOAuthPopup(url);
191
- return;
192
- }
193
- loginButton.setAttribute('disabled', true);
194
- loginButton.setAttribute('is-loading', true);
195
- checkOrigin()
196
- .then(queryParams =>
197
- fetch(`api/oauth-url${queryParams}`, {
198
- method: 'POST',
199
- headers: { 'Content-Type': 'application/json' },
200
- body: JSON.stringify({ loginForm: getLoginForm() })
201
- })
202
- )
203
- .then(checkResponse)
204
- .then(res => openOAuthPopup(res.url))
205
- .catch(e => {
206
- loginButton.setAttribute('disabled', false);
207
- loginButton.setAttribute('is-loading', false);
208
- catchRejection(e, 'Can\'t get oauth token');
209
- });
210
- }
211
-
212
- function openOAuthPopup(url) {
213
- {{#if oauthMode}}
214
- const oauthMode = '{{{ oauthMode }}}';
215
- {{else}}
216
- const oauthMode = undefined;
217
- {{/if}}
218
- const oauthWindow = window.open(url, '{{ name }}', 'location=0,status=0,width=800,height=400');
219
-
220
- if (oauthMode === 'polling') {
221
- if (refreshIntervalId) {
222
- clearInterval(refreshIntervalId);
223
- }
224
- refreshIntervalId = setInterval(() =>
225
- checkOrigin()
226
- .then(queryParams =>
227
- fetch(`api/oauth-polling${queryParams}`, {
228
- method: 'POST',
229
- })
230
- )
231
- .then(checkResponse)
232
- .then(res => {
233
- if (res.oauthCreds) {
234
- integrationLogin({
235
- refreshToken: res.oauthCreds.refreshToken,
236
- accessToken: res.oauthCreds.accessToken,
237
- expireIn: res.oauthCreds.expireIn,
238
- timestamp: res.oauthCreds.timestamp
239
- });
240
- if (refreshIntervalId) {
241
- clearInterval(refreshIntervalId);
242
- }
243
- }
244
- }), 2000);
245
- return;
246
- }
247
-
248
- postPromises['oauth_popup'] = {
249
- resolve: (data) => {
250
- if (data.error) {
251
- showToast(data.error);
252
- return;
253
- }
254
- integrationLogin({
255
- refreshToken: data.refreshToken,
256
- accessToken: data.accessToken,
257
- expireIn: data.expireIn,
258
- timestamp: data.timestamp
259
- });
260
- }
261
- }
262
- }
263
-
264
- function integrationLogin(oauthCredentials) {
265
- const credentials = oauthCredentials || getLoginForm();
266
- loginButton.setAttribute('disabled', true);
267
- loginButton.setAttribute('is-loading', true);
268
- checkOrigin()
269
- .then(queryParams =>
270
- fetch(`api/login${queryParams}`, {
271
- method: 'POST',
272
- headers: { 'Content-Type': 'application/json' },
273
- body: JSON.stringify({ credentials })
274
- })
275
- )
276
- .then(checkResponse)
277
- .then(localStorage.removeItem('revised_{{name}}'))
278
- .then(reloadLocation)
279
- .catch(e => {
280
- loginButton.setAttribute('disabled', false);
281
- loginButton.setAttribute('is-loading', false);
282
- catchRejection(e, 'Credentials are not stored');
283
- });
284
- }
285
-
286
- function getLoginForm() {
287
- return {
288
- {{#each loginFields}}
289
- {{#if key}}
290
- {{#ifeq type "checkbox"}}
291
- '{{key}}': !!document.querySelector('#{{key}}').checked,
292
- {{else}}
293
- '{{key}}': document.querySelector('#{{key}}').getAttribute('value') || document.querySelector('#{{key}}').value,
294
- {{/ifeq}}
295
- {{/if}}
296
- {{/each}}
297
- };
298
- }
299
-
300
- function uploadFiles(id) {
301
- const input = document.querySelector(`#store_${id}`);
302
- input.value = '';
303
- input.click();
304
- }
305
-
306
- function readFileData(event) {
307
- const reader = new FileReader();
308
- const identifier = event.target.getAttribute('data-id');
309
- const fileName = document.querySelector('.uploaded-file');
310
- const input = document.querySelector(`#${identifier}`);
311
- const file = event.target.files[0];
312
- fileName.innerText = file.name;
313
-
314
- reader.onloadstart = function() {
315
- loginButton.setAttribute('disabled', true);
316
- loginButton.setAttribute('is-loading', true);
317
- };
318
- reader.onloadend = function() {
319
- loginButton.setAttribute('disabled', false);
320
- loginButton.setAttribute('is-loading', false);
321
- };
322
-
323
- reader.onload = () => {
324
- input.value = reader.result;
325
- };
326
- reader.readAsText(file);
327
- }
328
-
329
- </script>
330
-
331
- </html>