@crowdin/app-project-module 0.53.0 → 0.53.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.
@@ -38,6 +38,7 @@ function handle(integration) {
38
38
  crowdinId: req.crowdinContext.crowdinId,
39
39
  clientId: req.crowdinContext.clientId,
40
40
  });
41
+ res.send({ data: [], message: (e === null || e === void 0 ? void 0 : e.message) || e });
41
42
  throw e;
42
43
  }
43
44
  req.logInfo(`Integration data response ${JSON.stringify(files, null, 2)}`);
@@ -287,7 +287,7 @@ export interface FormField {
287
287
  helpText?: string;
288
288
  helpTextHtml?: string;
289
289
  label: string;
290
- type?: 'text' | 'password' | 'checkbox' | 'select' | 'textarea' | 'file';
290
+ type?: 'text' | 'password' | 'checkbox' | 'select' | 'textarea' | 'file' | 'notice';
291
291
  defaultValue?: any;
292
292
  /**
293
293
  * only for select
@@ -312,6 +312,14 @@ export interface FormField {
312
312
  * field dependency settings
313
313
  */
314
314
  dependencySettings?: string;
315
+ /**
316
+ * only for notice type
317
+ */
318
+ noticeType?: string;
319
+ /**
320
+ * only for notice type
321
+ */
322
+ noIcon?: boolean;
315
323
  }
316
324
  type NoticeType = 'info' | 'warning' | 'danger' | 'success' | 'error' | 'dataLostWarning';
317
325
  export interface IntegrationCredentials {
@@ -215,7 +215,7 @@ function filesCron({ config, integration, period, }) {
215
215
  }
216
216
  catch (e) {
217
217
  (0, logger_1.logError)(e, context);
218
- throw e;
218
+ continue;
219
219
  }
220
220
  if (Object.keys(newFiles).length) {
221
221
  yield (0, storage_1.getStorage)().updateSyncSettings(JSON.stringify(Object.assign(Object.assign({}, files), newFiles)), syncSettings.integrationId, syncSettings.crowdinId, 'schedule', syncSettings.provider);
@@ -256,7 +256,7 @@ function filesCron({ config, integration, period, }) {
256
256
  }
257
257
  catch (e) {
258
258
  (0, logger_1.logError)(e, context);
259
- throw e;
259
+ continue;
260
260
  }
261
261
  if (Object.keys(newFiles).length) {
262
262
  const newSyncSettingsFields = allIntFiles.map((file) => (Object.assign(Object.assign({}, file), { schedule: true, sync: false })));
@@ -22,7 +22,7 @@ exports.engine = (0, express_handlebars_1.default)({
22
22
  return options.inverse(this);
23
23
  },
24
24
  in: function (a, b, options) {
25
- if (a.toString().includes(b.toString())) {
25
+ if (a !== undefined && a !== null && b !== undefined && b !== null && a.toString().includes(b.toString())) {
26
26
  return options.fn(this);
27
27
  }
28
28
  return options.inverse(this);
@@ -11,24 +11,28 @@
11
11
  <div class="inputs">
12
12
  {{#each loginFields}}
13
13
  {{#if key}}
14
- {{#ifeq type "checkbox"}}
15
- <crowdin-checkbox
16
- id="{{key}}"
17
- label="{{label}}"
18
- value="false"
19
- use-switch
20
- {{#if helpText}}
21
- help-text="{{helpText}}"
22
- {{/if}}
23
- {{#if helpTextHtml}}
24
- help-text-html="{{helpTextHtml}}"
25
- {{/if}}
26
- {{#ifeq defaultValue true}}
27
- checked="{{defaultValue}}"
28
- {{/ifeq}}
29
- >
30
- </crowdin-checkbox>
31
- {{else}}
14
+ {{#in "checkbox select textarea file notice" type}}
15
+ {{#ifeq type "checkbox"}}
16
+ <crowdin-checkbox
17
+ id="{{key}}"
18
+ label="{{label}}"
19
+ value="false"
20
+ use-switch
21
+ {{#if helpText}}
22
+ help-text="{{helpText}}"
23
+ {{/if}}
24
+ {{#if helpTextHtml}}
25
+ help-text-html="{{helpTextHtml}}"
26
+ {{/if}}
27
+ {{#ifeq defaultValue true}}
28
+ checked="{{defaultValue}}"
29
+ {{/ifeq}}
30
+ {{#if dependencySettings}}
31
+ data-dependency="{{dependencySettings}}"
32
+ {{/if}}
33
+ >
34
+ </crowdin-checkbox>
35
+ {{/ifeq}}
32
36
  {{#ifeq type "select"}}
33
37
  <crowdin-select
34
38
  {{#if isMulti}}
@@ -46,72 +50,114 @@
46
50
  {{#if helpTextHtml}}
47
51
  help-text-html="{{helpTextHtml}}"
48
52
  {{/if}}
53
+ {{#if dependencySettings}}
54
+ data-dependency="{{dependencySettings}}"
55
+ {{/if}}
49
56
  >
50
57
  {{#each options}}
51
58
  <option {{#ifeq ../defaultValue value}} selected {{/ifeq}} value="{{value}}">{{label}}</option>
52
59
  {{/each}}
53
60
  </crowdin-select>
54
- {{else}}
55
- {{#ifeq type "textarea"}}
56
- <crowdin-textarea
57
- id="{{key}}"
58
- label="{{label}}"
59
- {{#if helpText}}
60
- help-text="{{helpText}}"
61
- {{/if}}
62
- {{#if helpTextHtml}}
63
- help-text-html="{{helpTextHtml}}"
64
- {{/if}}
65
- value="{{#if defaultValue}}{{defaultValue}}{{/if}}">
66
- </crowdin-textarea>
67
- {{else}}
68
- {{#ifeq type "file"}}
69
- <div class="file-field">
70
- {{#if helpText}}<div class="help-text">{{helpText}}</div>{{/if}}
71
- {{#if helpTextHtml}}<div class="help-text">{{helpTextHtml}}</div>{{/if}}
72
- <div class="upload">
73
- <crowdin-button outlined onclick="uploadFiles('{{key}}');">{{label}}</crowdin-button>
74
- <textarea hidden id="{{key}}"></textarea>
75
- <input
76
- id="store_{{key}}"
77
- data-id="{{key}}"
78
- {{#if accept}}
79
- accept="{{accept}}"
80
- {{/if}}
81
- onchange="readFileData(event)"
82
- hidden
83
- type="{{type}}"
84
- >
85
- <div class="uploaded-file"><i>No file</i></div>
86
- </div>
87
- </div>
88
- {{else}}
89
- <crowdin-input
90
- id="{{key}}"
91
- label="{{label}}"
92
- {{#if helpText}}
93
- help-text="{{helpText}}"
94
- {{/if}}
95
- {{#if helpTextHtml}}
96
- help-text-html="{{helpTextHtml}}"
97
- {{/if}}
98
- {{#if type}}
99
- type="{{type}}"
61
+ {{/ifeq}}
62
+ {{#ifeq type "textarea"}}
63
+ <crowdin-textarea
64
+ id="{{key}}"
65
+ label="{{label}}"
66
+ {{#if helpText}}
67
+ help-text="{{helpText}}"
68
+ {{/if}}
69
+ {{#if helpTextHtml}}
70
+ help-text-html="{{helpTextHtml}}"
71
+ {{/if}}
72
+ {{#if dependencySettings}}
73
+ data-dependency="{{dependencySettings}}"
74
+ {{/if}}
75
+ value="{{#if defaultValue}}{{defaultValue}}{{/if}}">
76
+ </crowdin-textarea>
77
+ {{/ifeq}}
78
+ {{#ifeq type "notice"}}
79
+ <crowdin-alert
80
+ {{#if noticeType}}
81
+ type="{{noticeType}}"
82
+ {{/if}}
83
+ {{#if label}}
84
+ title="{{label}}"
85
+ {{/if}}
86
+ {{#if noIcon}}
87
+ no-icon="{{noIcon}}"
88
+ {{/if}}
89
+ {{#if dependencySettings}}
90
+ data-dependency="{{dependencySettings}}"
91
+ {{/if}}
92
+ >
93
+ {{{helpText}}}
94
+ </crowdin-alert>
95
+ {{/ifeq}}
96
+ {{#ifeq type "file"}}
97
+ <div class="file-field">
98
+ {{#if helpText}}<div class="help-text">{{helpText}}</div>{{/if}}
99
+ {{#if helpTextHtml}}<div class="help-text">{{helpTextHtml}}</div>{{/if}}
100
+ <div class="upload">
101
+ <crowdin-button outlined onclick="uploadFiles('{{key}}');">{{label}}</crowdin-button>
102
+ <textarea hidden id="{{key}}"></textarea>
103
+ <input
104
+ id="store_{{key}}"
105
+ data-id="{{key}}"
106
+ {{#if accept}}
107
+ accept="{{accept}}"
100
108
  {{/if}}
101
- value="{{#if defaultValue}}{{defaultValue}}{{/if}}">
102
- </crowdin-input>
103
- {{/ifeq}}
104
- {{/ifeq}}
109
+ onchange="readFileData(event)"
110
+ hidden
111
+ type="{{type}}"
112
+ >
113
+ <div class="uploaded-file"><i>No file</i></div>
114
+ </div>
115
+ </div>
105
116
  {{/ifeq}}
106
- {{/ifeq}}
117
+ {{else}}
118
+ <crowdin-input
119
+ id="{{key}}"
120
+ label="{{label}}"
121
+ {{#if helpText}}
122
+ help-text="{{helpText}}"
123
+ {{/if}}
124
+ {{#if helpTextHtml}}
125
+ help-text-html="{{helpTextHtml}}"
126
+ {{/if}}
127
+ {{#if type}}
128
+ type="{{type}}"
129
+ {{/if}}
130
+ {{#if dependencySettings}}
131
+ data-dependency="{{dependencySettings}}"
132
+ {{/if}}
133
+ value="{{#if defaultValue}}{{defaultValue}}{{/if}}">
134
+ </crowdin-input>
135
+ {{/in}}
107
136
  {{else}}
108
137
  {{#if labelHtml}}
109
- <crowdin-p>{{{labelHtml}}}</crowdin-p>
138
+ <crowdin-p
139
+ {{#if dependencySettings}}
140
+ data-dependency="{{dependencySettings}}"
141
+ {{/if}}
142
+ >
143
+ {{{labelHtml}}}
144
+ </crowdin-p>
110
145
  {{else}}
111
- <crowdin-p>{{label}}</crowdin-p>
146
+ <crowdin-p
147
+ {{#if dependencySettings}}
148
+ data-dependency="{{dependencySettings}}"
149
+ {{/if}}
150
+ >
151
+ {{label}}
152
+ </crowdin-p>
112
153
  {{/if}}
113
154
  {{/if}}
114
- <div style="padding: 8px"></div>
155
+ <div
156
+ style="padding: 8px"
157
+ {{#if dependencySettings}}
158
+ data-dependency="{{dependencySettings}}"
159
+ {{/if}}
160
+ ></div>
115
161
  {{/each}}
116
162
  </div>
117
163
  <crowdin-button
@@ -227,6 +227,24 @@
227
227
  value="{{#if defaultValue}}{{defaultValue}}{{/if}}">
228
228
  </crowdin-textarea>
229
229
  {{/ifeq}}
230
+ {{#ifeq type "notice"}}
231
+ <crowdin-alert
232
+ {{#if noticeType}}
233
+ type="{{noticeType}}"
234
+ {{/if}}
235
+ {{#if label}}
236
+ title="{{label}}"
237
+ {{/if}}
238
+ {{#if noIcon}}
239
+ no-icon="{{noIcon}}"
240
+ {{/if}}
241
+ {{#if dependencySettings}}
242
+ data-dependency="{{dependencySettings}}"
243
+ {{/if}}
244
+ >
245
+ {{{helpText}}}
246
+ </crowdin-alert>
247
+ {{/ifeq}}
230
248
  {{else}}
231
249
  {{#if labelHtml}}
232
250
  <crowdin-p
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdin/app-project-module",
3
- "version": "0.53.0",
3
+ "version": "0.53.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",