@crowdin/app-project-module 0.84.1 → 0.85.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.
@@ -92,12 +92,12 @@ function handle({ config, optional = false, checkSubscriptionExpiration = true,
92
92
  next();
93
93
  }
94
94
  catch (e) {
95
- (0, logger_1.logError)(e);
95
+ const errorMessage = (0, logger_1.getErrorMessage)(e);
96
96
  if (e instanceof util_1.CodeError) {
97
- throw e;
97
+ return res.status(402).send({ message: errorMessage || 'Error', code: e.code });
98
98
  }
99
- const message = (0, logger_1.getErrorMessage)(e);
100
- return res.status(403).send({ error: message || 'Error' });
99
+ (0, logger_1.logError)(e);
100
+ return res.status(403).send({ error: errorMessage || 'Error' });
101
101
  }
102
102
  }));
103
103
  }
@@ -4,4 +4,8 @@ export interface EditorPanels extends UiModule {
4
4
  * The Editor's mode list where the module will be available.
5
5
  */
6
6
  modes: EditorMode[];
7
+ /**
8
+ * Defines if the module supports multiple strings at once.
9
+ */
10
+ supportsMultipleStrings: boolean;
7
11
  }
@@ -178,6 +178,7 @@ function processSyncSettings({ config, integration, period, syncSettings, }) {
178
178
  crowdinId: crowdinCredentials.id,
179
179
  clientId: integrationCredentials.id,
180
180
  };
181
+ const logInfo = (0, logger_1.withContext)(context);
181
182
  try {
182
183
  const preparedCrowdinClient = yield (0, connection_1.prepareCrowdinClient)({
183
184
  config,
@@ -189,6 +190,9 @@ function processSyncSettings({ config, integration, period, syncSettings, }) {
189
190
  crowdinClient = preparedCrowdinClient.client;
190
191
  }
191
192
  catch (e) {
193
+ intConfig.schedule = '0';
194
+ yield (0, storage_1.getStorage)().updateIntegrationConfig(syncSettings.integrationId, JSON.stringify(intConfig));
195
+ logInfo(`Auto-sync has been disabled for organization '${crowdinCredentials.id}'.`);
192
196
  (0, logger_1.logError)(e, context);
193
197
  return;
194
198
  }
@@ -159,8 +159,8 @@ function applyIntegrationModuleDefaults(config, integration) {
159
159
  if (integration.withCronSync || integration.webhooks) {
160
160
  defaultSettings.push({
161
161
  key: 'schedule',
162
- label: 'Auto sync',
163
- helpText: 'Adjust the update frequency for sources and translations. If enabled, make sure Auto Sync is enabled for your selected directories and files in the dual pane view.',
162
+ label: 'Sync schedule',
163
+ helpText: `Defines how often content is synced between ${config.name} and Crowdin. Make sure Auto Sync is enabled for selected directories and files in the dual pane view.`,
164
164
  type: 'select',
165
165
  defaultValue: '0',
166
166
  options: [
@@ -208,16 +208,18 @@ function applyIntegrationModuleDefaults(config, integration) {
208
208
  }
209
209
  if (integration.uploadTranslations) {
210
210
  defaultSettings.push({
211
+ labelHtml: `<b>Translation sync settings (${config.name} → Crowdin)</b>`,
212
+ }, {
211
213
  key: 'importEqSuggestions',
212
- label: 'Allow target translation to match source',
214
+ label: 'Add translations that are the same as the source text',
213
215
  type: 'checkbox',
214
216
  }, {
215
217
  key: 'autoApproveImported',
216
- label: 'Approve added translations',
218
+ label: 'Mark added translations as Approved in Crowdin',
217
219
  type: 'checkbox',
218
220
  }, {
219
221
  key: 'translateHidden',
220
- label: 'Translate hidden strings',
222
+ label: 'Add translations for hidden source strings in Crowdin',
221
223
  type: 'checkbox',
222
224
  });
223
225
  }
@@ -14,7 +14,7 @@ function normalizeEnvironments(environments) {
14
14
  return [environments];
15
15
  }
16
16
  function handle(config) {
17
- var _a, _b;
17
+ var _a, _b, _c;
18
18
  const modules = {};
19
19
  if (config.projectIntegration) {
20
20
  // prevent possible overrides of the other modules
@@ -145,7 +145,7 @@ function handle(config) {
145
145
  // prevent possible overrides of the other modules
146
146
  config.editorRightPanel = Object.assign(Object.assign({}, config.editorRightPanel), { key: config.identifier + '-editor-panels' });
147
147
  modules['editor-right-panel'] = [
148
- Object.assign({ key: config.editorRightPanel.key, name: config.editorRightPanel.name || config.name, url: '/editor-panels/' + (config.editorRightPanel.fileName || 'index.html'), modes: config.editorRightPanel.modes }, (!!config.editorRightPanel.environments && {
148
+ Object.assign({ key: config.editorRightPanel.key, name: config.editorRightPanel.name || config.name, url: '/editor-panels/' + (config.editorRightPanel.fileName || 'index.html'), supportsMultipleStrings: (_a = config.editorRightPanel.supportsMultipleStrings) !== null && _a !== void 0 ? _a : false, modes: config.editorRightPanel.modes }, (!!config.editorRightPanel.environments && {
149
149
  environments: normalizeEnvironments(config.editorRightPanel.environments),
150
150
  })),
151
151
  ];
@@ -341,7 +341,7 @@ function handle(config) {
341
341
  if (!workflowStep.key) {
342
342
  workflowStep.key = config.identifier + '-' + (0, util_3.getWorkflowStepKey)(workflowStep);
343
343
  }
344
- const uiModule = ((_a = workflowStep === null || workflowStep === void 0 ? void 0 : workflowStep.settingsUiModule) === null || _a === void 0 ? void 0 : _a.formSchema) || ((_b = workflowStep === null || workflowStep === void 0 ? void 0 : workflowStep.settingsUiModule) === null || _b === void 0 ? void 0 : _b.fileName);
344
+ const uiModule = ((_b = workflowStep === null || workflowStep === void 0 ? void 0 : workflowStep.settingsUiModule) === null || _b === void 0 ? void 0 : _b.formSchema) || ((_c = workflowStep === null || workflowStep === void 0 ? void 0 : workflowStep.settingsUiModule) === null || _c === void 0 ? void 0 : _c.fileName);
345
345
  modules['workflow-step-type'].push(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ key: workflowStep.key, name: workflowStep.name || config.name }, ((workflowStep === null || workflowStep === void 0 ? void 0 : workflowStep.imagePath) ? { logo: (0, util_1.getLogoUrl)(workflowStep, `-${workflowStep.key}`) } : {})), { description: workflowStep.description || config.description, boundaries: workflowStep.boundaries }), (workflowStep.editorMode ? { editorMode: workflowStep.editorMode } : {})), { updateSettingsUrl: (0, util_3.getWorkflowStepUrl)('/workflow-step/settings', workflowStep), deleteSettingsUrl: (0, util_3.getWorkflowStepUrl)('/workflow-step/delete', workflowStep) }), (uiModule ? { url: (0, util_3.getWorkflowStepUrl)('/workflow-step', workflowStep) } : {})));
346
346
  }
347
347
  }
package/out/types.d.ts CHANGED
@@ -362,7 +362,10 @@ export declare enum EditorMode {
362
362
  ASSETS = "assets",
363
363
  REVIEW = "review",
364
364
  TRANSLATE = "TRANSLATE",
365
- PROOFREAD = "proofread"
365
+ PROOFREAD = "proofread",
366
+ COMFORTABLE = "comfortable",
367
+ SIDE_BY_SIDE = "side-by-side",
368
+ MULTILINGUAL = "multilingual"
366
369
  }
367
370
  interface ModuleContent {
368
371
  /**
package/out/types.js CHANGED
@@ -52,6 +52,9 @@ var EditorMode;
52
52
  EditorMode["REVIEW"] = "review";
53
53
  EditorMode["TRANSLATE"] = "TRANSLATE";
54
54
  EditorMode["PROOFREAD"] = "proofread";
55
+ EditorMode["COMFORTABLE"] = "comfortable";
56
+ EditorMode["SIDE_BY_SIDE"] = "side-by-side";
57
+ EditorMode["MULTILINGUAL"] = "multilingual";
55
58
  })(EditorMode = exports.EditorMode || (exports.EditorMode = {}));
56
59
  var UserPermissions;
57
60
  (function (UserPermissions) {
@@ -80,9 +80,9 @@
80
80
  integration-logo="logo.png"
81
81
  {{#if uploadTranslations}}
82
82
  {{#if excludedTargetLanguages}}
83
- integration-button-menu-items='[{"label":"Sync translations", "title":"Sync translations to Crowdin", "action":"uploadTranslations"}, {"label":"Select target languages", "title":"Upload file for translation into selected languages", "action":"excludedTargetLanguages"}]'
83
+ integration-button-menu-items='[{"label":"Sync translations", "title":"Sync existing translations from {{name}} to Crowdin. Falls back to heuristics if string keys are not defined. Accuracy may vary.", "action":"uploadTranslations"}, {"label":"Select target languages", "title":"Upload file for translation into selected languages", "action":"excludedTargetLanguages"}]'
84
84
  {{else}}
85
- integration-button-menu-items='[{"label":"Sync translations", "title":"Sync translations to Crowdin", "action":"uploadTranslations"}]'
85
+ integration-button-menu-items='[{"label":"Sync translations", "title":"Sync existing translations from {{name}} to Crowdin. Falls back to heuristics if string keys are not defined. Accuracy may vary.", "action":"uploadTranslations"}]'
86
86
  {{/if}}
87
87
  {{else}}
88
88
  {{#if excludedTargetLanguages}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdin/app-project-module",
3
- "version": "0.84.1",
3
+ "version": "0.85.0",
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",