@crowdin/app-project-module 1.13.2 → 1.15.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 CHANGED
@@ -71,6 +71,7 @@ const types_1 = require("./types");
71
71
  const util_1 = require("./util");
72
72
  const form_schema_1 = require("./util/form-schema");
73
73
  const connection_1 = require("./util/connection");
74
+ const log_sanitizer_1 = require("./util/log-sanitizer");
74
75
  const logger = __importStar(require("./util/logger"));
75
76
  const logger_1 = require("./util/logger");
76
77
  const terminus_express_1 = __importDefault(require("./util/terminus-express"));
@@ -94,6 +95,7 @@ const editorRightPanelApp = __importStar(require("./modules/editor-right-panel")
94
95
  const externalQaCheck = __importStar(require("./modules/external-qa-check"));
95
96
  const fileProcessingApps = __importStar(require("./modules/file-processing"));
96
97
  const integrationApp = __importStar(require("./modules/integration"));
98
+ const chatApp = __importStar(require("./modules/chat"));
97
99
  const modalApp = __importStar(require("./modules/modal"));
98
100
  const organizationMenuApp = __importStar(require("./modules/organization-menu"));
99
101
  const organizationSettingsMenuApp = __importStar(require("./modules/organization-settings-menu"));
@@ -186,6 +188,7 @@ function addCrowdinEndpoints(app, clientConfig) {
186
188
  });
187
189
  if (!config.disableLogsFormatter) {
188
190
  logsFormatter.setup();
191
+ logsFormatter.registerSanitizer(log_sanitizer_1.crowdinLogSanitizer);
189
192
  app.use(logsFormatter.contextResolverMiddleware());
190
193
  app.use(logsFormatter.expressMiddleware());
191
194
  }
@@ -222,6 +225,7 @@ function addCrowdinEndpoints(app, clientConfig) {
222
225
  projectToolsApp.register({ config, app });
223
226
  projectReportsApp.register({ config, app });
224
227
  modalApp.register({ config, app });
228
+ chatApp.register({ config, app });
225
229
  contextMenuApp.register({ config, app });
226
230
  //other apps only work in authorized context
227
231
  if (!(0, util_1.isAuthorizedConfig)(config)) {
@@ -0,0 +1,6 @@
1
+ import { Express } from 'express';
2
+ import { Config, UnauthorizedConfig } from '../../types';
3
+ export declare function register({ config, app }: {
4
+ config: Config | UnauthorizedConfig;
5
+ app: Express;
6
+ }): void;
@@ -0,0 +1,21 @@
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.register = register;
7
+ const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
8
+ const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
9
+ const util_1 = require("../../util");
10
+ function register({ config, app }) {
11
+ const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
12
+ if (!config.chat) {
13
+ return;
14
+ }
15
+ config.chat.forEach((chat, index) => {
16
+ if ((chat === null || chat === void 0 ? void 0 : chat.uiPath) || (chat === null || chat === void 0 ? void 0 : chat.formSchema)) {
17
+ const moduleKey = chat.key || `${config.identifier}-chat-${index}`;
18
+ app.use(`/chat-${moduleKey}`, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: moduleKey }), (0, render_ui_module_1.default)(chat, config));
19
+ }
20
+ });
21
+ }
@@ -255,6 +255,7 @@ function applyIntegrationModuleDefaults(config, integration) {
255
255
  key: 'new-crowdin-files',
256
256
  label: 'Automatically sync new translations from Crowdin',
257
257
  type: 'checkbox',
258
+ helpText: 'Automatically include newly added Crowdin files and folders in Auto Sync.',
258
259
  dependencySettings: JSON.stringify([{ '#schedule-settings': { type: '!equal', value: ['0'] } }]),
259
260
  category: types_1.DefaultCategory.SYNC,
260
261
  position: 1,
@@ -265,6 +266,7 @@ function applyIntegrationModuleDefaults(config, integration) {
265
266
  key: 'new-integration-files',
266
267
  label: `Automatically sync new content from ${config.name}`,
267
268
  type: 'checkbox',
269
+ helpText: `Automatically include new ${config.name} files and folders in Auto Sync as soon as they appear.`,
268
270
  dependencySettings: JSON.stringify([{ '#schedule-settings': { type: '!equal', value: ['0'] } }]),
269
271
  category: types_1.DefaultCategory.SYNC,
270
272
  position: 2,
@@ -279,18 +281,21 @@ function applyIntegrationModuleDefaults(config, integration) {
279
281
  key: 'importEqSuggestions',
280
282
  label: 'Add translations that are the same as the source text',
281
283
  type: 'checkbox',
284
+ helpText: 'Upload translations that match the source text. Useful when the source and target are intentionally identical, for example brand names, numbers, or code snippets.',
282
285
  category: types_1.DefaultCategory.SYNC,
283
286
  position: 4,
284
287
  }, {
285
288
  key: 'autoApproveImported',
286
289
  label: 'Mark added translations as Approved in Crowdin',
287
290
  type: 'checkbox',
291
+ helpText: 'Mark uploaded translations as Approved in Crowdin, bypassing proofreading. Leave off if your workflow requires a reviewer to approve translations manually.',
288
292
  category: types_1.DefaultCategory.SYNC,
289
293
  position: 5,
290
294
  }, {
291
295
  key: 'translateHidden',
292
296
  label: 'Add translations for hidden source strings in Crowdin',
293
297
  type: 'checkbox',
298
+ helpText: 'Also upload translations for source strings marked as hidden in Crowdin. Hidden strings are excluded from the translator workflow but can still receive translations from your integration.',
294
299
  category: types_1.DefaultCategory.SYNC,
295
300
  position: 6,
296
301
  });
@@ -300,6 +305,7 @@ function applyIntegrationModuleDefaults(config, integration) {
300
305
  label: 'Files export settings',
301
306
  type: 'select',
302
307
  defaultValue: '0',
308
+ helpText: 'Decides which Crowdin files are exported on each sync. "Export all" includes every file; "Export translated only" skips files with no translations; "Export approved only" requires translations to be approved by a proofreader.',
303
309
  dependencySettings: JSON.stringify([{ '#schedule-settings': { type: '!equal', value: ['0'] } }]),
304
310
  category: types_1.DefaultCategory.SYNC,
305
311
  position: 7,
@@ -432,6 +432,13 @@ function handle(config) {
432
432
  }
433
433
  modules['modal'] = modals;
434
434
  }
435
+ if (config.chat) {
436
+ const chats = config.chat.map((chat, i) => {
437
+ const moduleKey = chat.key || `${config.identifier}-chat-${i}`;
438
+ return Object.assign({ key: moduleKey, name: chat.name || config.name, url: chat.url || `/chat-${moduleKey}/` + (chat.fileName || 'index.html') }, (!!chat.environments && { environments: normalizeEnvironments(chat.environments) }));
439
+ });
440
+ modules['chat'] = chats;
441
+ }
435
442
  if (config.contextMenu) {
436
443
  let contextMenus = [];
437
444
  if (Array.isArray(config.contextMenu)) {