@crowdin/app-project-module 0.66.1 → 0.68.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 (45) hide show
  1. package/README.md +3 -17
  2. package/out/index.js +25 -10
  3. package/out/middlewares/crowdin-client.d.ts +13 -2
  4. package/out/middlewares/crowdin-client.js +17 -3
  5. package/out/middlewares/ui-module.d.ts +5 -1
  6. package/out/middlewares/ui-module.js +5 -1
  7. package/out/modules/ai-prompt-provider/index.js +7 -2
  8. package/out/modules/ai-provider/handlers/chat-completions.js +75 -5
  9. package/out/modules/ai-provider/handlers/get-model-list.js +3 -2
  10. package/out/modules/ai-provider/index.js +13 -3
  11. package/out/modules/ai-provider/types.d.ts +5 -2
  12. package/out/modules/ai-tools/index.js +7 -2
  13. package/out/modules/ai-tools/types.d.ts +2 -2
  14. package/out/modules/api/api.js +66 -11
  15. package/out/modules/context-menu/index.js +1 -1
  16. package/out/modules/custom-mt/index.js +6 -1
  17. package/out/modules/custom-mt/types.d.ts +4 -2
  18. package/out/modules/custom-spell-check/index.js +14 -4
  19. package/out/modules/custom-spell-check/types.d.ts +2 -2
  20. package/out/modules/editor-right-panel/index.js +1 -1
  21. package/out/modules/external-qa-check/index.js +7 -2
  22. package/out/modules/external-qa-check/types.d.ts +2 -2
  23. package/out/modules/file-processing/index.js +30 -5
  24. package/out/modules/file-processing/types.d.ts +3 -2
  25. package/out/modules/file-processing/util/files.d.ts +1 -0
  26. package/out/modules/install.js +10 -2
  27. package/out/modules/integration/index.js +109 -18
  28. package/out/modules/integration/types.d.ts +2 -2
  29. package/out/modules/manifest.js +48 -22
  30. package/out/modules/modal/index.js +1 -1
  31. package/out/modules/organization-menu/index.js +1 -1
  32. package/out/modules/profile-resources-menu/index.js +1 -1
  33. package/out/modules/project-menu/index.js +1 -1
  34. package/out/modules/project-menu-crowdsource/index.js +1 -1
  35. package/out/modules/project-reports/index.js +1 -1
  36. package/out/modules/project-tools/index.js +1 -1
  37. package/out/static/css/crowdin-ui-colors.css +115 -0
  38. package/out/static/js/form.js +10 -10
  39. package/out/types.d.ts +16 -2
  40. package/out/util/handlebars.js +2 -2
  41. package/out/util/index.d.ts +0 -1
  42. package/out/util/index.js +1 -9
  43. package/out/views/main.handlebars +3 -19
  44. package/out/views/partials/head.handlebars +1 -0
  45. package/package.json +12 -12
package/out/types.d.ts CHANGED
@@ -140,6 +140,14 @@ export interface ClientConfig extends ImagePath {
140
140
  * modal module
141
141
  */
142
142
  modal?: ModuleContent & UiModule & Environments;
143
+ /**
144
+ * Install hook
145
+ */
146
+ onInstall?: ({ organization, userId, client, }: {
147
+ organization: string;
148
+ userId: number;
149
+ client: Crowdin;
150
+ }) => Promise<void>;
143
151
  /**
144
152
  * Uninstall hook for cleanup logic
145
153
  */
@@ -310,7 +318,7 @@ interface ModuleContent {
310
318
  url?: string;
311
319
  }
312
320
  export interface CrowdinAppUtilities extends CrowdinMetadataStore {
313
- establishCrowdinConnection: (authRequest: string | CrowdinClientRequest) => Promise<{
321
+ establishCrowdinConnection: (authRequest: string | CrowdinClientRequest, moduleKey: string[] | string | undefined) => Promise<{
314
322
  context: CrowdinContextInfo;
315
323
  client?: Crowdin;
316
324
  }>;
@@ -332,7 +340,7 @@ export interface CrowdinMetadataStore {
332
340
  */
333
341
  getUserSettings: (clientId: string) => Promise<any | undefined>;
334
342
  }
335
- export interface UiModule {
343
+ export interface UiModule extends ModuleKey {
336
344
  /**
337
345
  * Form schema for react-jsonschema-doc to be used as front-end
338
346
  * https://rjsf-team.github.io/react-jsonschema-form/docs
@@ -369,6 +377,12 @@ export interface UiModule {
369
377
  */
370
378
  maskPasswords?: boolean;
371
379
  }
380
+ export interface ModuleKey {
381
+ /**
382
+ * key to identify module
383
+ */
384
+ key?: string;
385
+ }
372
386
  export interface ImagePath {
373
387
  /**
374
388
  * path to app logo (e.g. {@example join(__dirname, 'logo.png')})
@@ -25,10 +25,10 @@ exports.engine = (0, express_handlebars_1.default)({
25
25
  if (a !== undefined && a !== null && b !== undefined && b !== null) {
26
26
  let bArray;
27
27
  if (Array.isArray(b)) {
28
- bArray = b;
28
+ bArray = b.map((item) => item.toString());
29
29
  }
30
30
  else {
31
- bArray = b.split(' ');
31
+ bArray = b.toString().split(' ');
32
32
  }
33
33
  if (bArray.includes(a === null || a === void 0 ? void 0 : a.toString())) {
34
34
  return options.fn(this);
@@ -10,7 +10,6 @@ export declare function decryptData(config: Config, data: string): string;
10
10
  export declare function executeWithRetry<T>(func: () => Promise<T>, numOfRetries?: number): Promise<T>;
11
11
  export declare function getLogoUrl(moduleConfig?: ImagePath, modulePath?: string): string;
12
12
  export declare function isAuthorizedConfig(config: Config | UnauthorizedConfig): config is Config;
13
- export declare function hasFormSchema(moduleConfig: any): boolean;
14
13
  export declare function isJson(string: string): boolean;
15
14
  export declare function getPreviousDate(days: number): Date;
16
15
  export declare function prepareFormDataMetadataId(req: CrowdinClientRequest, config: Config): Promise<string>;
package/out/util/index.js CHANGED
@@ -32,7 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
32
  });
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.prepareFormDataMetadataId = exports.getPreviousDate = exports.isJson = exports.hasFormSchema = exports.isAuthorizedConfig = exports.getLogoUrl = exports.executeWithRetry = exports.decryptData = exports.encryptData = exports.runAsyncWrapper = exports.CodeError = void 0;
35
+ exports.prepareFormDataMetadataId = exports.getPreviousDate = exports.isJson = exports.isAuthorizedConfig = exports.getLogoUrl = exports.executeWithRetry = exports.decryptData = exports.encryptData = exports.runAsyncWrapper = exports.CodeError = void 0;
36
36
  const crypto = __importStar(require("crypto-js"));
37
37
  const storage_1 = require("../storage");
38
38
  const types_1 = require("../types");
@@ -119,14 +119,6 @@ function isAuthorizedConfig(config) {
119
119
  return !!config.clientId && !!config.clientSecret && config.authenticationType !== types_1.AuthenticationType.NONE;
120
120
  }
121
121
  exports.isAuthorizedConfig = isAuthorizedConfig;
122
- function hasFormSchema(moduleConfig) {
123
- var _a;
124
- if (typeof moduleConfig === 'object' && moduleConfig !== null) {
125
- return moduleConfig.formSchema || ((_a = moduleConfig.settingsUiModule) === null || _a === void 0 ? void 0 : _a.formSchema);
126
- }
127
- return false;
128
- }
129
- exports.hasFormSchema = hasFormSchema;
130
122
  function isJson(string) {
131
123
  try {
132
124
  JSON.parse(string);
@@ -44,18 +44,6 @@
44
44
  {{/if}}
45
45
  <crowdin-button icon-before="account_circle" onclick="integrationLogout()">Log out</crowdin-button>
46
46
  </div>
47
- {{#if uploadTranslations}}
48
- <crowdin-alert id="translation-info" no-icon="true" style="display: none;">
49
- <div class="box-center">
50
- <p class="info-text">
51
- We recommend importing existing translations into your Crowdin project for newly uploaded source content.
52
- Please note that translations imported for non-key-value formats may require additional review.
53
- Read more about <crowdin-a href="https://support.crowdin.com/uploading-translations/" target="_blank">Uploading Translations</crowdin-a>.
54
- </p>
55
- </div>
56
- <crowdin-button onclick="closeAlert(this)" class="dismiss-alert" icon>close</crowdin-button>
57
- </crowdin-alert>
58
- {{/if}}
59
47
  </div>
60
48
  <crowdin-simple-integration
61
49
  async-progress
@@ -83,7 +71,7 @@
83
71
  integration-name="{{name}}"
84
72
  integration-logo="logo.png"
85
73
  {{#if uploadTranslations}}
86
- integration-button-menu-items='[{"label":"Upload Translations", "action":"uploadTranslations"}]'
74
+ integration-button-menu-items='[{"label":"Sync translations", "title":"Sync translations to Crowdin", "action":"uploadTranslations"}]'
87
75
  {{/if}}
88
76
  {{#if filtering.crowdinLanguages}}
89
77
  crowdin-filter
@@ -126,7 +114,7 @@
126
114
  <crowdin-modal
127
115
  id="settings-modal"
128
116
  body-overflow-unset="{{#checkLength configurationFields 3}}false{{else}}true{{/checkLength}}"
129
- modal-width="50"
117
+ modal-width="65"
130
118
  modal-title="Settings"
131
119
  close-button-title="Close"
132
120
  >
@@ -179,6 +167,7 @@
179
167
  {{#if dependencySettings}}
180
168
  data-dependency="{{dependencySettings}}"
181
169
  {{/if}}
170
+ is-position-fixed
182
171
  >
183
172
  {{#each options}}
184
173
  <option
@@ -1119,11 +1108,6 @@
1119
1108
  localStorage.setItem(`revised_${name}`, 1);
1120
1109
  }
1121
1110
 
1122
- {{#if uploadTranslations}}
1123
- const translationInfo = document.getElementById('translation-info');
1124
- checkAlert(translationInfo);
1125
- {{/if}}
1126
-
1127
1111
  {{#if notice}}
1128
1112
  const notice = document.getElementById('notice');
1129
1113
  checkAlert(notice, 'notice');
@@ -4,6 +4,7 @@
4
4
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
5
5
  <title></title>
6
6
  <link rel="stylesheet" href="/assets/css/styles.css">
7
+ <link rel="stylesheet" href="/assets/css/crowdin-ui-colors.css">
7
8
  <script type="module"
8
9
  src="https://crowdin-web-components.s3.amazonaws.com/crowdin-web-components/crowdin-web-components.esm.js"></script>
9
10
  <script nomodule=""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdin/app-project-module",
3
- "version": "0.66.1",
3
+ "version": "0.68.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",
@@ -20,18 +20,18 @@
20
20
  "dependencies": {
21
21
  "@aws-sdk/client-s3": "^3.606.0",
22
22
  "@aws-sdk/s3-request-presigner": "^3.598.0",
23
- "@crowdin/crowdin-apps-functions": "0.8.1",
24
- "@crowdin/logs-formatter": "^2.1.5",
23
+ "@crowdin/crowdin-apps-functions": "0.9.0",
24
+ "@crowdin/logs-formatter": "^2.1.6",
25
25
  "@godaddy/terminus": "^4.12.1",
26
26
  "amqplib": "^0.10.4",
27
27
  "crypto-js": "^4.2.0",
28
- "express": "4.19.2",
28
+ "express": "^4.21.0",
29
29
  "express-handlebars": "^5.3.5",
30
30
  "lodash.get": "^4.4.2",
31
31
  "lodash.uniqby": "^4.7.0",
32
32
  "mysql2": "^3.10.2",
33
33
  "node-cron": "^3.0.3",
34
- "pg": "^8.11.5",
34
+ "pg": "^8.13.0",
35
35
  "redoc-express": "^2.1.0",
36
36
  "sqlite3": "^5.1.7",
37
37
  "swagger-jsdoc": "^6.2.8",
@@ -43,14 +43,14 @@
43
43
  "@emotion/styled": "^11.11.5",
44
44
  "@mui/icons-material": "^5.16.7",
45
45
  "@mui/material": "^5.16.7",
46
- "@rjsf/core": "^5.20.1",
47
- "@rjsf/mui": "^5.20.1",
48
- "@rjsf/utils": "^5.18.4",
49
- "@rjsf/validator-ajv8": "^5.20.1",
46
+ "@rjsf/core": "^5.21.1",
47
+ "@rjsf/mui": "^5.21.1",
48
+ "@rjsf/utils": "^5.21.1",
49
+ "@rjsf/validator-ajv8": "^5.21.1",
50
50
  "@rollup/plugin-babel": "^6.0.4",
51
51
  "@rollup/plugin-commonjs": "^24.1.0",
52
52
  "@rollup/plugin-json": "^6.1.0",
53
- "@rollup/plugin-node-resolve": "^15.2.3",
53
+ "@rollup/plugin-node-resolve": "^15.3.0",
54
54
  "@rollup/plugin-replace": "^5.0.7",
55
55
  "@rollup/plugin-terser": "^0.4.3",
56
56
  "@types/amqplib": "^0.10.4",
@@ -60,9 +60,9 @@
60
60
  "@types/jest": "^29.5.12",
61
61
  "@types/lodash.get": "^4.4.9",
62
62
  "@types/lodash.uniqby": "^4.7.9",
63
- "@types/node": "^16.18.101",
63
+ "@types/node": "^16.18.112",
64
64
  "@types/node-cron": "^3.0.11",
65
- "@types/pg": "^8.11.6",
65
+ "@types/pg": "^8.11.10",
66
66
  "@types/swagger-jsdoc": "^6.0.4",
67
67
  "@types/uuid": "^9.0.7",
68
68
  "@typescript-eslint/eslint-plugin": "^2.3.1",