@crowdin/app-project-module 0.90.0 → 0.91.1

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.
@@ -193,11 +193,21 @@ function handle(config) {
193
193
  ];
194
194
  }
195
195
  if (config.modal) {
196
- // prevent possible overrides of the other modules
197
- config.modal = Object.assign(Object.assign({}, config.modal), { key: config.identifier + '-modal' });
198
- modules['modal'] = [
199
- Object.assign({ key: config.modal.key, name: config.modal.name || config.name, url: config.modal.url || '/modal/' + (config.modal.fileName || 'index.html') }, (!!config.modal.environments && { environments: normalizeEnvironments(config.modal.environments) })),
200
- ];
196
+ let modals = [];
197
+ if (Array.isArray(config.modal)) {
198
+ modals = config.modal.map((modal, i) => {
199
+ const moduleKey = modal.key || `${config.identifier}-modal-${i}`;
200
+ return Object.assign({ key: moduleKey, name: modal.name || config.name, url: modal.url || `/modal-${moduleKey}/` + (modal.fileName || 'index.html') }, (!!modal.environments && { environments: normalizeEnvironments(modal.environments) }));
201
+ });
202
+ }
203
+ else {
204
+ modals = [
205
+ Object.assign({ key: config.identifier + '-modal', name: config.modal.name || config.name, url: config.modal.url || '/modal/' + (config.modal.fileName || 'index.html') }, (!!config.modal.environments && {
206
+ environments: normalizeEnvironments(config.modal.environments),
207
+ })),
208
+ ];
209
+ }
210
+ modules['modal'] = modals;
201
211
  }
202
212
  if (config.contextMenu) {
203
213
  // prevent possible overrides of the other modules
@@ -10,8 +10,20 @@ const util_1 = require("../../util");
10
10
  function register({ config, app }) {
11
11
  var _a, _b;
12
12
  const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
13
- if (((_a = config.modal) === null || _a === void 0 ? void 0 : _a.uiPath) || ((_b = config.modal) === null || _b === void 0 ? void 0 : _b.formSchema)) {
14
- app.use('/modal', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.modal.key }), (0, render_ui_module_1.default)(config.modal));
13
+ if (!config.modal) {
14
+ return;
15
+ }
16
+ if (Array.isArray(config.modal)) {
17
+ config.modal.forEach((modal) => {
18
+ if ((modal === null || modal === void 0 ? void 0 : modal.uiPath) || (modal === null || modal === void 0 ? void 0 : modal.formSchema)) {
19
+ app.use(`/modal-${modal.key}`, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: modal.key }), (0, render_ui_module_1.default)(modal));
20
+ }
21
+ });
22
+ }
23
+ else {
24
+ if (((_a = config.modal) === null || _a === void 0 ? void 0 : _a.uiPath) || ((_b = config.modal) === null || _b === void 0 ? void 0 : _b.formSchema)) {
25
+ app.use('/modal', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.modal.key }), (0, render_ui_module_1.default)(config.modal));
26
+ }
15
27
  }
16
28
  }
17
29
  exports.register = register;
package/out/types.d.ts CHANGED
@@ -159,7 +159,7 @@ export interface ClientConfig extends ImagePath {
159
159
  /**
160
160
  * modal module
161
161
  */
162
- modal?: ModuleContent & UiModule & Environments;
162
+ modal?: ModalModule | ModalModule[];
163
163
  /**
164
164
  * Install hook
165
165
  */
@@ -497,4 +497,6 @@ export declare enum storageFiles {
497
497
  SQLITE_BACKUP = "backup_app.sqlite",
498
498
  DUMP = "dump_table_%s.sql"
499
499
  }
500
+ export interface ModalModule extends ModuleContent, UiModule, Environments {
501
+ }
500
502
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdin/app-project-module",
3
- "version": "0.90.0",
3
+ "version": "0.91.1",
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",
@@ -34,7 +34,7 @@
34
34
  "lodash.isstring": "^4.0.1",
35
35
  "lodash.snakecase": "^4.1.1",
36
36
  "lodash.uniqby": "^4.7.0",
37
- "minimatch": "^10.0.1",
37
+ "minimatch": "^10.0.3",
38
38
  "mysql2": "^3.12.0",
39
39
  "node-cron": "^3.0.3",
40
40
  "pg": "^8.13.3",