@crowdin/app-project-module 0.107.0-cf-0 → 0.108.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 (151) hide show
  1. package/out/index.d.ts +0 -1
  2. package/out/index.js +12 -30
  3. package/out/middlewares/crowdin-client.d.ts +1 -1
  4. package/out/middlewares/integration-credentials.d.ts +1 -1
  5. package/out/middlewares/integration-credentials.js +1 -4
  6. package/out/middlewares/render-ui-module.d.ts +3 -3
  7. package/out/middlewares/render-ui-module.js +13 -9
  8. package/out/middlewares/ui-module.d.ts +1 -1
  9. package/out/middlewares/ui-module.js +1 -10
  10. package/out/modules/about.d.ts +1 -2
  11. package/out/modules/about.js +3 -10
  12. package/out/modules/ai-prompt-provider/handlers/compile.d.ts +1 -1
  13. package/out/modules/ai-prompt-provider/index.js +2 -2
  14. package/out/modules/ai-provider/handlers/chat-completions.d.ts +1 -1
  15. package/out/modules/ai-provider/handlers/get-model-list.d.ts +1 -1
  16. package/out/modules/ai-provider/index.js +2 -2
  17. package/out/modules/ai-provider/types.d.ts +2 -2
  18. package/out/modules/ai-request-processors/handler.d.ts +1 -1
  19. package/out/modules/ai-tools/handlers/tool-calls.d.ts +1 -1
  20. package/out/modules/ai-tools/index.js +1 -1
  21. package/out/modules/api/api.js +58 -7
  22. package/out/modules/api/base.d.ts +1 -0
  23. package/out/modules/api/base.js +1 -0
  24. package/out/modules/api/components.d.ts +251 -27
  25. package/out/modules/api/components.js +251 -27
  26. package/out/modules/auth-guard/handlers/verify.d.ts +1 -1
  27. package/out/modules/auth-guard/index.js +1 -1
  28. package/out/modules/automation-action/handlers/execute.d.ts +1 -1
  29. package/out/modules/automation-action/handlers/input-schema.d.ts +1 -1
  30. package/out/modules/automation-action/handlers/output-schema.d.ts +1 -1
  31. package/out/modules/automation-action/handlers/validate-settings.d.ts +1 -1
  32. package/out/modules/automation-action/index.js +1 -1
  33. package/out/modules/context-menu/index.js +2 -2
  34. package/out/modules/custom-mt/handlers/translate.d.ts +1 -1
  35. package/out/modules/custom-mt/handlers/translate.js +8 -17
  36. package/out/modules/custom-mt/index.js +3 -3
  37. package/out/modules/custom-mt/types.d.ts +1 -2
  38. package/out/modules/custom-spell-check/handlers/get-languages-list.d.ts +1 -1
  39. package/out/modules/custom-spell-check/handlers/spell-check.d.ts +1 -1
  40. package/out/modules/custom-spell-check/index.js +4 -4
  41. package/out/modules/editor-right-panel/index.js +1 -1
  42. package/out/modules/external-qa-check/handlers/validate.d.ts +1 -1
  43. package/out/modules/external-qa-check/index.js +2 -2
  44. package/out/modules/file-processing/handlers/custom-file-format.d.ts +2 -7
  45. package/out/modules/file-processing/handlers/custom-file-format.js +19 -59
  46. package/out/modules/file-processing/handlers/file-download.d.ts +1 -1
  47. package/out/modules/file-processing/handlers/file-download.js +0 -5
  48. package/out/modules/file-processing/handlers/pre-post-process.d.ts +1 -1
  49. package/out/modules/file-processing/handlers/pre-post-process.js +14 -34
  50. package/out/modules/file-processing/handlers/translations-alignment.d.ts +1 -1
  51. package/out/modules/file-processing/index.js +2 -12
  52. package/out/modules/file-processing/util/defaults.js +6 -50
  53. package/out/modules/file-processing/util/files.js +1 -2
  54. package/out/modules/form-data-display.d.ts +1 -1
  55. package/out/modules/form-data-save.d.ts +1 -1
  56. package/out/modules/install.d.ts +1 -1
  57. package/out/modules/integration/handlers/crowdin-file-progress.d.ts +1 -1
  58. package/out/modules/integration/handlers/crowdin-files.d.ts +1 -1
  59. package/out/modules/integration/handlers/crowdin-project.d.ts +1 -1
  60. package/out/modules/integration/handlers/crowdin-update.d.ts +1 -1
  61. package/out/modules/integration/handlers/crowdin-webhook.d.ts +1 -1
  62. package/out/modules/integration/handlers/integration-data.d.ts +1 -1
  63. package/out/modules/integration/handlers/integration-login.d.ts +1 -1
  64. package/out/modules/integration/handlers/integration-logout.d.ts +1 -1
  65. package/out/modules/integration/handlers/integration-update.d.ts +1 -1
  66. package/out/modules/integration/handlers/integration-webhook.d.ts +1 -1
  67. package/out/modules/integration/handlers/invite-users.d.ts +1 -1
  68. package/out/modules/integration/handlers/job-cancel.d.ts +1 -1
  69. package/out/modules/integration/handlers/job-info-deprecated.d.ts +1 -1
  70. package/out/modules/integration/handlers/job-info.d.ts +1 -1
  71. package/out/modules/integration/handlers/job-list.d.ts +1 -1
  72. package/out/modules/integration/handlers/main.d.ts +1 -1
  73. package/out/modules/integration/handlers/main.js +1 -13
  74. package/out/modules/integration/handlers/oauth-login.d.ts +1 -1
  75. package/out/modules/integration/handlers/oauth-login.js +2 -10
  76. package/out/modules/integration/handlers/oauth-polling.d.ts +1 -1
  77. package/out/modules/integration/handlers/oauth-url.d.ts +1 -1
  78. package/out/modules/integration/handlers/settings-save.d.ts +1 -1
  79. package/out/modules/integration/handlers/settings.d.ts +1 -1
  80. package/out/modules/integration/handlers/sync-settings-save.d.ts +1 -1
  81. package/out/modules/integration/handlers/sync-settings.d.ts +1 -1
  82. package/out/modules/integration/handlers/user-errors.d.ts +1 -1
  83. package/out/modules/integration/handlers/users.d.ts +1 -1
  84. package/out/modules/integration/index.js +33 -12
  85. package/out/modules/manifest.js +12 -12
  86. package/out/modules/modal/index.js +2 -2
  87. package/out/modules/organization-menu/index.js +4 -5
  88. package/out/modules/organization-settings-menu/index.js +4 -5
  89. package/out/modules/profile-resources-menu/index.js +4 -5
  90. package/out/modules/profile-settings-menu/index.js +4 -5
  91. package/out/modules/project-menu/index.js +1 -1
  92. package/out/modules/project-menu-crowdsource/index.js +1 -1
  93. package/out/modules/project-reports/index.js +2 -3
  94. package/out/modules/project-tools/index.js +2 -3
  95. package/out/modules/status.d.ts +1 -1
  96. package/out/modules/status.js +3 -12
  97. package/out/modules/subscription-paid.d.ts +1 -1
  98. package/out/modules/uninstall.d.ts +1 -1
  99. package/out/modules/webhooks/handlers/webhook-handler.d.ts +1 -1
  100. package/out/modules/webhooks/handlers/webhook-handler.js +15 -30
  101. package/out/modules/webhooks/types.d.ts +0 -7
  102. package/out/modules/workflow-step-type/handlers/delete-step.d.ts +1 -1
  103. package/out/modules/workflow-step-type/handlers/step-settings-save.d.ts +1 -1
  104. package/out/modules/workflow-step-type/index.js +2 -2
  105. package/out/modules/workflow-step-type/types.d.ts +1 -1
  106. package/out/storage/index.js +1 -8
  107. package/out/types.d.ts +4 -41
  108. package/out/util/connection.js +15 -4
  109. package/out/util/credentials-masker.d.ts +1 -1
  110. package/out/util/handlebars.d.ts +1 -0
  111. package/out/util/handlebars.js +46 -0
  112. package/out/util/index.d.ts +1 -11
  113. package/out/util/index.js +6 -50
  114. package/out/views/about.handlebars +102 -0
  115. package/out/views/error.handlebars +54 -0
  116. package/out/views/form.handlebars +31 -0
  117. package/out/views/install.handlebars +16 -0
  118. package/out/views/login.handlebars +332 -0
  119. package/out/views/main.handlebars +2042 -0
  120. package/out/views/oauth.handlebars +11 -0
  121. package/out/views/partials/head.handlebars +53 -0
  122. package/out/views/subscription.handlebars +26 -0
  123. package/package.json +12 -25
  124. package/out/storage/d1.d.ts +0 -107
  125. package/out/storage/d1.js +0 -829
  126. package/out/util/cron.d.ts +0 -29
  127. package/out/util/cron.js +0 -87
  128. package/out/util/jsx-renderer.d.ts +0 -6
  129. package/out/util/jsx-renderer.js +0 -13
  130. package/out/util/static-files.d.ts +0 -19
  131. package/out/util/static-files.js +0 -87
  132. package/out/views/AboutPage.d.ts +0 -10
  133. package/out/views/AboutPage.js +0 -76
  134. package/out/views/ErrorPage.d.ts +0 -18
  135. package/out/views/ErrorPage.js +0 -56
  136. package/out/views/FormPage.d.ts +0 -14
  137. package/out/views/FormPage.js +0 -28
  138. package/out/views/InstallPage.d.ts +0 -10
  139. package/out/views/InstallPage.js +0 -22
  140. package/out/views/LoginPage.d.ts +0 -33
  141. package/out/views/LoginPage.js +0 -200
  142. package/out/views/MainPage.d.ts +0 -81
  143. package/out/views/MainPage.js +0 -1784
  144. package/out/views/OAuthPage.d.ts +0 -7
  145. package/out/views/OAuthPage.js +0 -17
  146. package/out/views/SubscriptionPage.d.ts +0 -7
  147. package/out/views/SubscriptionPage.js +0 -26
  148. package/out/views/index.d.ts +0 -13
  149. package/out/views/index.js +0 -25
  150. package/out/views/layout/Head.d.ts +0 -9
  151. package/out/views/layout/Head.js +0 -54
@@ -1,200 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.LoginPage = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const Head_1 = require("./layout/Head");
9
- const renderField = (field, name) => {
10
- var _a;
11
- if (!field.key) {
12
- // Label-only field
13
- return field.labelHtml ? (react_1.default.createElement("crowdin-p", Object.assign({}, (field.dependencySettings ? { 'data-dependency': field.dependencySettings } : {}), { dangerouslySetInnerHTML: { __html: field.labelHtml } }))) : (react_1.default.createElement("crowdin-p", Object.assign({}, (field.dependencySettings ? { 'data-dependency': field.dependencySettings } : {})), field.label));
14
- }
15
- const commonProps = Object.assign(Object.assign(Object.assign({ id: field.key, label: field.label }, (field.helpText ? { 'help-text': field.helpText } : {})), (field.helpTextHtml ? { 'help-text-html': field.helpTextHtml } : {})), (field.dependencySettings ? { 'data-dependency': field.dependencySettings } : {}));
16
- // Special field types
17
- if (['checkbox', 'select', 'textarea', 'file', 'notice'].includes(field.type || '')) {
18
- switch (field.type) {
19
- case 'checkbox':
20
- return (react_1.default.createElement("crowdin-checkbox", Object.assign({}, commonProps, { value: "false", "use-switch": true }, (field.defaultValue === true ? { checked: String(field.defaultValue) } : {}))));
21
- case 'select':
22
- return (react_1.default.createElement("crowdin-select", Object.assign({}, commonProps, (field.isMulti ? { 'is-multi': true, 'close-on-select': 'false' } : {}), (field.isSearchable ? { 'is-searchable': true } : {})), (_a = field.options) === null || _a === void 0 ? void 0 : _a.map((option) => (react_1.default.createElement("option", Object.assign({ value: option.value }, (field.defaultValue === option.value ? { selected: true } : {})), option.label)))));
23
- case 'textarea':
24
- return (react_1.default.createElement("crowdin-textarea", Object.assign({}, commonProps, { value: field.defaultValue || '' })));
25
- case 'notice':
26
- return (react_1.default.createElement("crowdin-alert", Object.assign({}, (field.noticeType ? { type: field.noticeType } : {}), (field.label ? { title: field.label } : {}), (field.noIcon ? { 'no-icon': String(field.noIcon) } : {}), (field.dependencySettings ? { 'data-dependency': field.dependencySettings } : {}), { dangerouslySetInnerHTML: { __html: field.helpText || '' } })));
27
- case 'file':
28
- return (react_1.default.createElement("div", { className: "file-field" },
29
- field.helpText && react_1.default.createElement("div", { className: "help-text" }, field.helpText),
30
- field.helpTextHtml && react_1.default.createElement("div", { className: "help-text" }, field.helpTextHtml),
31
- react_1.default.createElement("div", { className: "upload" },
32
- react_1.default.createElement("crowdin-button", { outlined: true, onclick: `uploadFiles('${field.key}');` }, field.label),
33
- react_1.default.createElement("textarea", { hidden: true, id: field.key }),
34
- react_1.default.createElement("input", Object.assign({ id: `store_${field.key}`, "data-id": field.key }, (field.accept ? { accept: field.accept } : {}), { 'onchange': 'readFileData(event)' }, { hidden: true, type: field.type })),
35
- react_1.default.createElement("div", { className: "uploaded-file" },
36
- react_1.default.createElement("i", null, "No file")))));
37
- }
38
- }
39
- // Default input field
40
- return (react_1.default.createElement("crowdin-input", Object.assign({}, commonProps, (field.type ? { type: field.type } : {}), { value: field.defaultValue || '' })));
41
- };
42
- const LoginPage = ({ name, loginFields, oauthLogin, oauthUrl, oauthMode, sentryData }) => (react_1.default.createElement("html", { lang: "en" },
43
- react_1.default.createElement(Head_1.Head, { sentryData: sentryData }),
44
- react_1.default.createElement("body", null,
45
- react_1.default.createElement("div", { className: "i_w center" },
46
- react_1.default.createElement("div", null,
47
- react_1.default.createElement("crowdin-card", { "is-shadowed": true, "is-padding-lg": true, className: "login" },
48
- react_1.default.createElement("img", { alt: `${name} logo`, src: "logo.png" }),
49
- react_1.default.createElement("crowdin-h4", { id: "integration-name" }, name),
50
- react_1.default.createElement("div", { className: "inputs" }, loginFields.map((field) => (react_1.default.createElement(react_1.default.Fragment, null,
51
- renderField(field, name),
52
- react_1.default.createElement("div", Object.assign({ style: { padding: '8px' } }, (field.dependencySettings ? { 'data-dependency': field.dependencySettings } : {}))))))),
53
- react_1.default.createElement("crowdin-button", { id: "login-button", outlined: true, "icon-after": "arrow_forward", onclick: oauthLogin ? 'oauthLogin()' : 'integrationLogin()' },
54
- "Log In With ",
55
- name)))),
56
- react_1.default.createElement("crowdin-toasts", null),
57
- react_1.default.createElement("script", { type: "text/javascript", dangerouslySetInnerHTML: {
58
- __html: `
59
- const loginButton = document.querySelector('#login-button');
60
- let refreshIntervalId;
61
-
62
- function oauthLogin() {
63
- const url = ${oauthUrl ? `'${oauthUrl}'` : 'undefined'};
64
- if (url) {
65
- openOAuthPopup(url);
66
- return;
67
- }
68
- loginButton.setAttribute('disabled', true);
69
- loginButton.setAttribute('is-loading', true);
70
- checkOrigin()
71
- .then(queryParams =>
72
- fetch(\`api/oauth-url\${queryParams}\`, {
73
- method: 'POST',
74
- headers: { 'Content-Type': 'application/json' },
75
- body: JSON.stringify({ loginForm: getLoginForm() })
76
- })
77
- )
78
- .then(checkResponse)
79
- .then(res => openOAuthPopup(res.url))
80
- .catch(e => {
81
- loginButton.setAttribute('disabled', false);
82
- loginButton.setAttribute('is-loading', false);
83
- catchRejection(e, 'Can\\'t get oauth token');
84
- });
85
- }
86
-
87
- function openOAuthPopup(url) {
88
- const oauthMode = ${oauthMode ? `'${oauthMode}'` : 'undefined'};
89
- const oauthWindow = window.open(url, '${name}', 'location=0,status=0,width=800,height=400');
90
-
91
- if (oauthMode === 'polling') {
92
- if (refreshIntervalId) {
93
- clearInterval(refreshIntervalId);
94
- }
95
- refreshIntervalId = setInterval(() =>
96
- checkOrigin()
97
- .then(queryParams =>
98
- fetch(\`api/oauth-polling\${queryParams}\`, { method: 'POST' })
99
- )
100
- .then(checkResponse)
101
- .then(res => {
102
- if (res.oauthCreds) {
103
- integrationLogin({
104
- refreshToken: res.oauthCreds.refreshToken,
105
- accessToken: res.oauthCreds.accessToken,
106
- expireIn: res.oauthCreds.expireIn,
107
- timestamp: res.oauthCreds.timestamp
108
- });
109
- if (refreshIntervalId) {
110
- clearInterval(refreshIntervalId);
111
- }
112
- }
113
- }), 2000);
114
- return;
115
- }
116
-
117
- postPromises['oauth_popup'] = {
118
- resolve: (data) => {
119
- if (data.error) {
120
- showToast(data.error);
121
- return;
122
- }
123
- integrationLogin({
124
- refreshToken: data.refreshToken,
125
- accessToken: data.accessToken,
126
- expireIn: data.expireIn,
127
- timestamp: data.timestamp
128
- });
129
- }
130
- }
131
- }
132
-
133
- function integrationLogin(oauthCredentials) {
134
- const credentials = oauthCredentials || getLoginForm();
135
- loginButton.setAttribute('disabled', true);
136
- loginButton.setAttribute('is-loading', true);
137
- checkOrigin()
138
- .then(queryParams =>
139
- fetch(\`api/login\${queryParams}\`, {
140
- method: 'POST',
141
- headers: { 'Content-Type': 'application/json' },
142
- body: JSON.stringify({ credentials })
143
- })
144
- )
145
- .then(checkResponse)
146
- .then(localStorage.removeItem('revised_${name}'))
147
- .then(reloadLocation)
148
- .catch(e => {
149
- const errorMessage = e.message || 'Credentials are not stored';
150
- loginButton.setAttribute('disabled', false);
151
- loginButton.setAttribute('is-loading', false);
152
- catchRejection(e, errorMessage);
153
- });
154
- }
155
-
156
- function getLoginForm() {
157
- return {
158
- ${loginFields
159
- .filter((f) => f.key)
160
- .map((f) => {
161
- if (f.type === 'checkbox') {
162
- return `'${f.key}': !!document.querySelector('#${f.key}').checked`;
163
- }
164
- return `'${f.key}': document.querySelector('#${f.key}').getAttribute('value') || document.querySelector('#${f.key}').value`;
165
- })
166
- .join(',\n ')}
167
- };
168
- }
169
-
170
- function uploadFiles(id) {
171
- const input = document.querySelector(\`#store_\${id}\`);
172
- input.value = '';
173
- input.click();
174
- }
175
-
176
- function readFileData(event) {
177
- const reader = new FileReader();
178
- const identifier = event.target.getAttribute('data-id');
179
- const fileName = document.querySelector('.uploaded-file');
180
- const input = document.querySelector(\`#\${identifier}\`);
181
- const file = event.target.files[0];
182
- fileName.innerText = file.name;
183
-
184
- reader.onloadstart = function() {
185
- loginButton.setAttribute('disabled', true);
186
- loginButton.setAttribute('is-loading', true);
187
- };
188
- reader.onloadend = function() {
189
- loginButton.setAttribute('disabled', false);
190
- loginButton.setAttribute('is-loading', false);
191
- };
192
-
193
- reader.onload = () => {
194
- input.value = reader.result;
195
- };
196
- reader.readAsText(file);
197
- }
198
- `,
199
- } }))));
200
- exports.LoginPage = LoginPage;
@@ -1,81 +0,0 @@
1
- import { FC } from 'react';
2
- interface ConfigField {
3
- key?: string;
4
- label?: string;
5
- labelHtml?: string;
6
- helpText?: string;
7
- helpTextHtml?: string;
8
- type?: string;
9
- defaultValue?: any;
10
- dependencySettings?: string;
11
- isMulti?: boolean;
12
- isSearchable?: boolean;
13
- options?: Array<{
14
- value: string;
15
- label: string;
16
- }>;
17
- noticeType?: string;
18
- noIcon?: boolean;
19
- }
20
- interface ConfigurationTab {
21
- name: string;
22
- fields: ConfigField[];
23
- }
24
- interface Notice {
25
- title: string;
26
- content: string;
27
- type?: string;
28
- icon?: boolean;
29
- close?: boolean;
30
- }
31
- interface InfoModal {
32
- title: string;
33
- content: string;
34
- }
35
- interface MainPageProps {
36
- name: string;
37
- userId?: string;
38
- notice?: Notice;
39
- checkSubscription?: boolean;
40
- isManager?: boolean;
41
- isOwner?: boolean;
42
- infoModal?: InfoModal;
43
- configurationFields?: ConfigurationTab[];
44
- config?: string;
45
- syncNewElements?: {
46
- crowdin?: boolean;
47
- integration?: boolean;
48
- };
49
- withCronSync?: {
50
- crowdin?: boolean;
51
- integration?: boolean;
52
- };
53
- webhooks?: {
54
- crowdin?: boolean;
55
- integration?: boolean;
56
- };
57
- integrationOneLevelFetching?: boolean;
58
- integrationSearchListener?: boolean;
59
- integrationPagination?: boolean;
60
- uploadTranslations?: boolean;
61
- excludedTargetLanguages?: boolean;
62
- forcePushSources?: boolean;
63
- forcePushTranslations?: boolean;
64
- filtering?: {
65
- crowdinLanguages?: boolean;
66
- integrationFilterConfig?: string;
67
- };
68
- hasOrganization?: boolean;
69
- zenModeUrl?: string;
70
- asyncProgress?: {
71
- checkInterval: number;
72
- };
73
- reloadOnConfigSave?: boolean;
74
- progressiveCrowdinFilesLoading?: boolean;
75
- sentryData?: {
76
- dsn: string;
77
- appIdentifier: string;
78
- };
79
- }
80
- export declare const MainPage: FC<MainPageProps>;
81
- export {};