@crowdin/app-project-module 0.108.0 → 1.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/out/app-test/integration/get-integration-files.js +16 -4
- package/out/app-test/integration/types.d.ts +1 -1
- package/out/app-test/integration/update-crowdin.js +2 -2
- package/out/app-test/integration/update-integration.js +2 -2
- package/out/index.d.ts +2 -1
- package/out/index.js +73 -30
- package/out/middlewares/auto-credentials-masker.d.ts +4 -0
- package/out/middlewares/auto-credentials-masker.js +45 -0
- package/out/middlewares/crowdin-client.d.ts +1 -1
- package/out/middlewares/integration-credentials.d.ts +2 -2
- package/out/middlewares/integration-credentials.js +7 -4
- package/out/middlewares/render-ui-module.d.ts +3 -3
- package/out/middlewares/render-ui-module.js +10 -13
- package/out/middlewares/ui-module.d.ts +1 -1
- package/out/middlewares/ui-module.js +11 -1
- package/out/modules/about.d.ts +2 -1
- package/out/modules/about.js +10 -3
- package/out/modules/ai-prompt-provider/handlers/compile.d.ts +1 -1
- package/out/modules/ai-prompt-provider/handlers/compile.js +7 -1
- package/out/modules/ai-prompt-provider/index.js +2 -2
- package/out/modules/ai-prompt-provider/types.d.ts +7 -1
- package/out/modules/ai-provider/handlers/chat-completions.d.ts +1 -1
- package/out/modules/ai-provider/handlers/chat-completions.js +1 -1
- package/out/modules/ai-provider/handlers/get-model-list.d.ts +1 -1
- package/out/modules/ai-provider/index.js +2 -2
- package/out/modules/ai-provider/types.d.ts +4 -4
- package/out/modules/ai-request-processors/handler.d.ts +1 -1
- package/out/modules/ai-request-processors/handler.js +12 -2
- package/out/modules/ai-request-processors/types.d.ts +12 -2
- package/out/modules/ai-tools/handlers/tool-calls.d.ts +1 -1
- package/out/modules/ai-tools/handlers/tool-calls.js +1 -1
- package/out/modules/ai-tools/index.js +1 -1
- package/out/modules/ai-tools/types.d.ts +1 -1
- package/out/modules/auth-guard/handlers/verify.d.ts +1 -1
- package/out/modules/auth-guard/index.js +1 -1
- package/out/modules/automation-action/handlers/execute.d.ts +1 -1
- package/out/modules/automation-action/handlers/execute.js +1 -1
- package/out/modules/automation-action/handlers/input-schema.d.ts +1 -1
- package/out/modules/automation-action/handlers/output-schema.d.ts +1 -1
- package/out/modules/automation-action/handlers/validate-settings.d.ts +1 -1
- package/out/modules/automation-action/handlers/validate-settings.js +1 -1
- package/out/modules/automation-action/index.js +1 -1
- package/out/modules/automation-action/types.d.ts +4 -4
- package/out/modules/automation-action/util/index.js +2 -5
- package/out/modules/context-menu/index.js +2 -2
- package/out/modules/custom-mt/handlers/translate.d.ts +1 -1
- package/out/modules/custom-mt/handlers/translate.js +25 -9
- package/out/modules/custom-mt/index.js +3 -3
- package/out/modules/custom-mt/types.d.ts +10 -2
- package/out/modules/custom-spell-check/handlers/get-languages-list.d.ts +1 -1
- package/out/modules/custom-spell-check/handlers/spell-check.d.ts +1 -1
- package/out/modules/custom-spell-check/index.js +4 -4
- package/out/modules/editor-right-panel/index.js +1 -1
- package/out/modules/external-qa-check/handlers/validate.d.ts +1 -1
- package/out/modules/external-qa-check/index.js +2 -2
- package/out/modules/file-processing/handlers/custom-file-format.d.ts +7 -2
- package/out/modules/file-processing/handlers/custom-file-format.js +62 -22
- package/out/modules/file-processing/handlers/file-download.d.ts +1 -1
- package/out/modules/file-processing/handlers/file-download.js +5 -0
- package/out/modules/file-processing/handlers/pre-post-process.d.ts +1 -1
- package/out/modules/file-processing/handlers/pre-post-process.js +41 -15
- package/out/modules/file-processing/handlers/translations-alignment.d.ts +1 -1
- package/out/modules/file-processing/handlers/translations-alignment.js +10 -4
- package/out/modules/file-processing/index.js +12 -2
- package/out/modules/file-processing/types.d.ts +36 -5
- package/out/modules/file-processing/util/defaults.js +50 -6
- package/out/modules/file-processing/util/files.js +2 -1
- package/out/modules/form-data-display.d.ts +1 -1
- package/out/modules/form-data-save.d.ts +1 -1
- package/out/modules/install.d.ts +1 -1
- package/out/modules/integration/handlers/crowdin-file-progress.d.ts +1 -1
- package/out/modules/integration/handlers/crowdin-file-progress.js +5 -1
- package/out/modules/integration/handlers/crowdin-files-target-languages.d.ts +5 -0
- package/out/modules/integration/handlers/crowdin-files-target-languages.js +103 -0
- package/out/modules/integration/handlers/crowdin-files.d.ts +1 -1
- package/out/modules/integration/handlers/crowdin-files.js +7 -1
- package/out/modules/integration/handlers/crowdin-project.d.ts +1 -1
- package/out/modules/integration/handlers/crowdin-update.d.ts +1 -1
- package/out/modules/integration/handlers/crowdin-update.js +59 -18
- package/out/modules/integration/handlers/crowdin-webhook.d.ts +1 -1
- package/out/modules/integration/handlers/crowdin-webhook.js +15 -8
- package/out/modules/integration/handlers/integration-data.d.ts +1 -1
- package/out/modules/integration/handlers/integration-data.js +13 -6
- package/out/modules/integration/handlers/integration-login.d.ts +1 -1
- package/out/modules/integration/handlers/integration-logout.d.ts +1 -1
- package/out/modules/integration/handlers/integration-logout.js +8 -3
- package/out/modules/integration/handlers/integration-update.d.ts +1 -1
- package/out/modules/integration/handlers/integration-update.js +44 -6
- package/out/modules/integration/handlers/integration-webhook.d.ts +1 -1
- package/out/modules/integration/handlers/invite-users.d.ts +1 -1
- package/out/modules/integration/handlers/job-cancel.d.ts +1 -1
- package/out/modules/integration/handlers/job-info-deprecated.d.ts +1 -1
- package/out/modules/integration/handlers/job-info-deprecated.js +3 -2
- package/out/modules/integration/handlers/job-info.d.ts +1 -1
- package/out/modules/integration/handlers/job-list.d.ts +1 -1
- package/out/modules/integration/handlers/main.d.ts +1 -1
- package/out/modules/integration/handlers/main.js +32 -2
- package/out/modules/integration/handlers/oauth-login.d.ts +1 -1
- package/out/modules/integration/handlers/oauth-login.js +28 -6
- package/out/modules/integration/handlers/oauth-polling.d.ts +1 -1
- package/out/modules/integration/handlers/oauth-url.d.ts +1 -1
- package/out/modules/integration/handlers/settings-save.d.ts +1 -1
- package/out/modules/integration/handlers/settings-save.js +9 -9
- package/out/modules/integration/handlers/settings.d.ts +1 -1
- package/out/modules/integration/handlers/sync-settings-save.d.ts +1 -1
- package/out/modules/integration/handlers/sync-settings-save.js +5 -9
- package/out/modules/integration/handlers/sync-settings.d.ts +1 -1
- package/out/modules/integration/handlers/user-errors.d.ts +1 -1
- package/out/modules/integration/handlers/users.d.ts +1 -1
- package/out/modules/integration/index.js +19 -33
- package/out/modules/integration/types.d.ts +133 -29
- package/out/modules/integration/types.js +1 -0
- package/out/modules/integration/util/cron.d.ts +2 -2
- package/out/modules/integration/util/cron.js +40 -24
- package/out/modules/integration/util/defaults.d.ts +4 -0
- package/out/modules/integration/util/defaults.js +175 -15
- package/out/modules/integration/util/files.d.ts +2 -1
- package/out/modules/integration/util/files.js +19 -8
- package/out/modules/integration/util/job.js +4 -3
- package/out/modules/integration/util/snapshot.js +19 -3
- package/out/modules/integration/util/types.d.ts +1 -0
- package/out/modules/integration/util/types.js +1 -0
- package/out/modules/integration/util/webhooks.d.ts +8 -8
- package/out/modules/integration/util/webhooks.js +34 -17
- package/out/modules/manifest.js +12 -12
- package/out/modules/modal/index.js +2 -2
- package/out/modules/organization-menu/index.js +5 -4
- package/out/modules/organization-settings-menu/index.js +5 -4
- package/out/modules/profile-resources-menu/index.js +5 -4
- package/out/modules/profile-settings-menu/index.js +5 -4
- package/out/modules/project-menu/index.js +1 -1
- package/out/modules/project-menu-crowdsource/index.js +1 -1
- package/out/modules/project-reports/index.js +3 -2
- package/out/modules/project-tools/index.js +3 -2
- package/out/modules/status.d.ts +1 -1
- package/out/modules/status.js +12 -3
- package/out/modules/subscription-paid.d.ts +1 -1
- package/out/modules/uninstall.d.ts +1 -1
- package/out/modules/uninstall.js +1 -1
- package/out/modules/webhooks/handlers/webhook-handler.d.ts +2 -2
- package/out/modules/webhooks/handlers/webhook-handler.js +33 -22
- package/out/modules/webhooks/types.d.ts +7 -0
- package/out/modules/workflow-step-type/handlers/delete-step.d.ts +1 -1
- package/out/modules/workflow-step-type/handlers/step-settings-save.d.ts +1 -1
- package/out/modules/workflow-step-type/index.js +2 -2
- package/out/modules/workflow-step-type/util/index.js +3 -6
- package/out/static/js/dependent.js +16 -7
- package/out/static/ui/error.bundle.js +474 -0
- package/out/static/ui/error.bundle.js.map +1 -0
- package/out/static/ui/install.bundle.js +459 -0
- package/out/static/ui/install.bundle.js.map +1 -0
- package/out/static/ui/login.bundle.js +630 -0
- package/out/static/ui/login.bundle.js.map +1 -0
- package/out/static/ui/main.bundle.js +2109 -0
- package/out/static/ui/main.bundle.js.map +1 -0
- package/out/static/ui/oauth.bundle.js +467 -0
- package/out/static/ui/oauth.bundle.js.map +1 -0
- package/out/storage/d1.d.ts +107 -0
- package/out/storage/d1.js +831 -0
- package/out/storage/index.js +8 -1
- package/out/storage/mysql.js +22 -19
- package/out/storage/postgre.d.ts +0 -1
- package/out/storage/postgre.js +20 -30
- package/out/storage/sqlite.d.ts +2 -5
- package/out/storage/sqlite.js +29 -69
- package/out/types.d.ts +78 -18
- package/out/util/connection.js +1 -1
- package/out/util/credentials-masker.d.ts +3 -3
- package/out/util/credentials-masker.js +14 -20
- package/out/util/cron.d.ts +29 -0
- package/out/util/cron.js +87 -0
- package/out/util/index.d.ts +14 -1
- package/out/util/index.js +121 -10
- package/out/util/jsx-renderer.d.ts +14 -0
- package/out/util/jsx-renderer.js +35 -0
- package/out/util/logger.d.ts +1 -0
- package/out/util/logger.js +2 -2
- package/out/util/static-files.d.ts +19 -0
- package/out/util/static-files.js +87 -0
- package/out/util/subscription.js +1 -1
- package/out/views/AboutPage.d.ts +10 -0
- package/out/views/AboutPage.js +76 -0
- package/out/views/FormPage.d.ts +14 -0
- package/out/views/FormPage.js +28 -0
- package/out/views/SubscriptionPage.d.ts +7 -0
- package/out/views/SubscriptionPage.js +26 -0
- package/out/views/index.d.ts +8 -0
- package/out/views/index.js +15 -0
- package/out/views/layout/Head.d.ts +9 -0
- package/out/views/layout/Head.js +54 -0
- package/package.json +43 -41
- package/out/util/handlebars.d.ts +0 -1
- package/out/util/handlebars.js +0 -46
- package/out/views/about.handlebars +0 -102
- package/out/views/error.handlebars +0 -54
- package/out/views/form.handlebars +0 -31
- package/out/views/install.handlebars +0 -16
- package/out/views/login.handlebars +0 -332
- package/out/views/main.handlebars +0 -2042
- package/out/views/oauth.handlebars +0 -11
- package/out/views/partials/head.handlebars +0 -53
- package/out/views/subscription.handlebars +0 -26
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
{{> head}}
|
|
4
|
-
|
|
5
|
-
<body>
|
|
6
|
-
<div class="i_w center">
|
|
7
|
-
<div>
|
|
8
|
-
<h1>Looks like {{ name }} is not installed yet!</h1>
|
|
9
|
-
<p>Contact your organization administrator to install it. More info on <a
|
|
10
|
-
href='https://support.crowdin.com'>Link
|
|
11
|
-
to how to install</a></p>
|
|
12
|
-
</div>
|
|
13
|
-
</div>
|
|
14
|
-
</body>
|
|
15
|
-
|
|
16
|
-
</html>
|
|
@@ -1,332 +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
|
-
const errorMessage = e.message || 'Credentials are not stored';
|
|
281
|
-
loginButton.setAttribute('disabled', false);
|
|
282
|
-
loginButton.setAttribute('is-loading', false);
|
|
283
|
-
catchRejection(e, errorMessage);
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
function getLoginForm() {
|
|
288
|
-
return {
|
|
289
|
-
{{#each loginFields}}
|
|
290
|
-
{{#if key}}
|
|
291
|
-
{{#ifeq type "checkbox"}}
|
|
292
|
-
'{{key}}': !!document.querySelector('#{{key}}').checked,
|
|
293
|
-
{{else}}
|
|
294
|
-
'{{key}}': document.querySelector('#{{key}}').getAttribute('value') || document.querySelector('#{{key}}').value,
|
|
295
|
-
{{/ifeq}}
|
|
296
|
-
{{/if}}
|
|
297
|
-
{{/each}}
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
function uploadFiles(id) {
|
|
302
|
-
const input = document.querySelector(`#store_${id}`);
|
|
303
|
-
input.value = '';
|
|
304
|
-
input.click();
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
function readFileData(event) {
|
|
308
|
-
const reader = new FileReader();
|
|
309
|
-
const identifier = event.target.getAttribute('data-id');
|
|
310
|
-
const fileName = document.querySelector('.uploaded-file');
|
|
311
|
-
const input = document.querySelector(`#${identifier}`);
|
|
312
|
-
const file = event.target.files[0];
|
|
313
|
-
fileName.innerText = file.name;
|
|
314
|
-
|
|
315
|
-
reader.onloadstart = function() {
|
|
316
|
-
loginButton.setAttribute('disabled', true);
|
|
317
|
-
loginButton.setAttribute('is-loading', true);
|
|
318
|
-
};
|
|
319
|
-
reader.onloadend = function() {
|
|
320
|
-
loginButton.setAttribute('disabled', false);
|
|
321
|
-
loginButton.setAttribute('is-loading', false);
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
reader.onload = () => {
|
|
325
|
-
input.value = reader.result;
|
|
326
|
-
};
|
|
327
|
-
reader.readAsText(file);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
</script>
|
|
331
|
-
|
|
332
|
-
</html>
|