@crowdin/app-project-module 0.45.0 → 0.45.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.
@@ -14,14 +14,9 @@ function handle(config) {
14
14
  const modules = {};
15
15
  if (config.projectIntegration) {
16
16
  modules['project-integrations'] = [
17
- {
18
- key: config.identifier + '-int',
19
- name: config.name,
20
- description: config.description,
21
- logo: (0, util_1.getLogoUrl)(config.projectIntegration, '/integration'),
22
- url: '/',
17
+ Object.assign({ key: config.identifier + '-int', name: config.name, description: config.description, logo: (0, util_1.getLogoUrl)(config.projectIntegration, '/integration'), url: '/' }, (!!config.projectIntegration.environments && {
23
18
  environments: normalizeEnvironments(config.projectIntegration.environments),
24
- },
19
+ })),
25
20
  ];
26
21
  }
27
22
  if (config.customFileFormat) {
@@ -77,14 +72,9 @@ function handle(config) {
77
72
  }
78
73
  if (config.customMT) {
79
74
  modules['custom-mt'] = [
80
- {
81
- key: config.identifier + '-mt',
82
- name: config.name,
83
- logo: (0, util_1.getLogoUrl)(config.customMT, '/mt'),
84
- url: '/translate',
75
+ Object.assign({ key: config.identifier + '-mt', name: config.name, logo: (0, util_1.getLogoUrl)(config.customMT, '/mt'), url: '/translate', withContext: !!config.customMT.withContext }, (!!config.customMT.environments && {
85
76
  environments: normalizeEnvironments(config.customMT.environments),
86
- withContext: !!config.customMT.withContext,
87
- },
77
+ })),
88
78
  ];
89
79
  }
90
80
  if (config.organizationMenu) {
@@ -99,46 +89,30 @@ function handle(config) {
99
89
  }
100
90
  if (config.profileResourcesMenu) {
101
91
  modules['profile-resources-menu'] = [
102
- {
103
- key: config.identifier + '-profile-resources-menu',
104
- name: config.profileResourcesMenu.name || config.name,
105
- url: '/resources/' + (config.profileResourcesMenu.fileName || 'index.html'),
106
- icon: (0, util_1.getLogoUrl)(config.profileResourcesMenu, '/resources'),
92
+ Object.assign({ key: config.identifier + '-profile-resources-menu', name: config.profileResourcesMenu.name || config.name, url: '/resources/' + (config.profileResourcesMenu.fileName || 'index.html'), icon: (0, util_1.getLogoUrl)(config.profileResourcesMenu, '/resources') }, (!!config.profileResourcesMenu.environments && {
107
93
  environments: normalizeEnvironments(config.profileResourcesMenu.environments),
108
- },
94
+ })),
109
95
  ];
110
96
  }
111
97
  if (config.editorRightPanel) {
112
98
  modules['editor-right-panel'] = [
113
- {
114
- key: config.identifier + '-editor-panels',
115
- name: config.editorRightPanel.name || config.name,
116
- url: '/editor-panels/' + (config.editorRightPanel.fileName || 'index.html'),
117
- modes: config.editorRightPanel.modes,
99
+ Object.assign({ key: config.identifier + '-editor-panels', name: config.editorRightPanel.name || config.name, url: '/editor-panels/' + (config.editorRightPanel.fileName || 'index.html'), modes: config.editorRightPanel.modes }, (!!config.editorRightPanel.environments && {
118
100
  environments: normalizeEnvironments(config.editorRightPanel.environments),
119
- },
101
+ })),
120
102
  ];
121
103
  }
122
104
  if (config.editorThemes) {
123
105
  modules['editor-themes'] = [
124
- {
125
- key: config.identifier + '-editor-themes',
126
- name: config.editorThemes.name || config.name,
127
- logo: (0, util_1.getLogoUrl)(config.editorThemes, '/editor-themes'),
128
- styles: config.editorThemes.styles,
129
- modes: config.editorThemes.modes,
106
+ Object.assign({ key: config.identifier + '-editor-themes', name: config.editorThemes.name || config.name, logo: (0, util_1.getLogoUrl)(config.editorThemes, '/editor-themes'), styles: config.editorThemes.styles, modes: config.editorThemes.modes }, (!!config.editorThemes.environments && {
130
107
  environments: normalizeEnvironments(config.editorThemes.environments),
131
- },
108
+ })),
132
109
  ];
133
110
  }
134
111
  if (config.projectMenu) {
135
112
  modules['project-menu'] = [
136
- {
137
- key: config.identifier + '-project-menu',
138
- name: config.projectMenu.name || config.name,
139
- url: '/project-menu/' + (config.projectMenu.fileName || 'index.html'),
113
+ Object.assign({ key: config.identifier + '-project-menu', name: config.projectMenu.name || config.name, url: '/project-menu/' + (config.projectMenu.fileName || 'index.html') }, (!!config.projectMenu.environments && {
140
114
  environments: normalizeEnvironments(config.projectMenu.environments),
141
- },
115
+ })),
142
116
  ];
143
117
  }
144
118
  if (config.projectMenuCrowdsource) {
@@ -152,14 +126,9 @@ function handle(config) {
152
126
  }
153
127
  if (config.projectTools) {
154
128
  modules['project-tools'] = [
155
- {
156
- key: config.identifier + '-tools',
157
- name: config.projectTools.name || config.name,
158
- description: config.description,
159
- logo: (0, util_1.getLogoUrl)(config.projectTools, '/tools'),
160
- url: '/tools/' + (config.projectTools.fileName || 'index.html'),
129
+ Object.assign({ key: config.identifier + '-tools', name: config.projectTools.name || config.name, description: config.description, logo: (0, util_1.getLogoUrl)(config.projectTools, '/tools'), url: '/tools/' + (config.projectTools.fileName || 'index.html') }, (!!config.projectTools.environments && {
161
130
  environments: normalizeEnvironments(config.projectTools.environments),
162
- },
131
+ })),
163
132
  ];
164
133
  }
165
134
  if (config.projectReports) {
@@ -175,30 +144,20 @@ function handle(config) {
175
144
  }
176
145
  if (config.modal) {
177
146
  modules['modal'] = [
178
- {
179
- key: config.identifier + '-modal',
180
- name: config.modal.name || config.name,
181
- url: config.modal.url || '/modal/' + (config.modal.fileName || 'index.html'),
182
- environments: normalizeEnvironments(config.modal.environments),
183
- },
147
+ 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 && { environments: normalizeEnvironments(config.modal.environments) })),
184
148
  ];
185
149
  }
186
150
  if (config.contextMenu) {
187
151
  modules['context-menu'] = [
188
- {
189
- key: config.identifier + '-context-menu',
190
- name: config.contextMenu.name || config.name,
191
- description: config.description,
192
- options: Object.assign(Object.assign({ location: config.contextMenu.location, type: config.contextMenu.type }, (config.contextMenu.module
152
+ Object.assign({ key: config.identifier + '-context-menu', name: config.contextMenu.name || config.name, description: config.description, options: Object.assign(Object.assign({ location: config.contextMenu.location, type: config.contextMenu.type }, (config.contextMenu.module
193
153
  ? {
194
154
  module: {
195
155
  [config.contextMenu.module]: modules[config.contextMenu.module][0].key,
196
156
  },
197
157
  }
198
- : {})), { url: '/context/' + (config.contextMenu.fileName || 'index.html') }),
199
- signaturePatterns: config.contextMenu.signaturePatterns,
158
+ : {})), { url: '/context/' + (config.contextMenu.fileName || 'index.html') }), signaturePatterns: config.contextMenu.signaturePatterns }, (!!config.contextMenu.environments && {
200
159
  environments: normalizeEnvironments(config.contextMenu.environments),
201
- },
160
+ })),
202
161
  ];
203
162
  }
204
163
  if (config.api) {
@@ -207,7 +166,9 @@ function handle(config) {
207
166
  if (config.customSpellchecker) {
208
167
  const uiModule = config.customSpellchecker.settingsUiModule;
209
168
  modules['custom-spellchecker'] = [
210
- Object.assign({ key: config.identifier + '-spellchecker', name: config.customSpellchecker.name || config.name, description: config.customSpellchecker.description || config.description, listSupportedLanguagesUrl: '/languages', checkSpellingUrl: '/spellcheck', environments: normalizeEnvironments(config.customSpellchecker.environments) }, (uiModule ? { url: '/settings/' + (uiModule.fileName || 'index.html') } : {})),
169
+ Object.assign(Object.assign({ key: config.identifier + '-spellchecker', name: config.customSpellchecker.name || config.name, description: config.customSpellchecker.description || config.description, listSupportedLanguagesUrl: '/languages', checkSpellingUrl: '/spellcheck' }, (!!config.customSpellchecker.environments && {
170
+ environments: normalizeEnvironments(config.customSpellchecker.environments),
171
+ })), (uiModule ? { url: '/settings/' + (uiModule.fileName || 'index.html') } : {})),
211
172
  ];
212
173
  }
213
174
  const events = {
package/out/types.d.ts CHANGED
@@ -173,7 +173,7 @@ export interface ClientConfig extends ImagePath {
173
173
  customSpellchecker?: CustomSpellcheckerModule;
174
174
  }
175
175
  export interface Environments {
176
- environments: Environment | Environment[];
176
+ environments?: Environment | Environment[];
177
177
  }
178
178
  type Environment = 'crowdin' | 'crowdin-enterprise';
179
179
  export type Config = ClientConfig & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdin/app-project-module",
3
- "version": "0.45.0",
3
+ "version": "0.45.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",