@crowdin/app-project-module 0.15.3 → 0.15.5
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.
- package/README.md +6 -0
- package/out/handlers/main.js +1 -0
- package/out/models/index.d.ts +9 -1
- package/out/util/defaults.js +3 -0
- package/out/views/main.handlebars +46 -38
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -326,6 +326,9 @@ It is also possible to define settings window for your app where users can custo
|
|
|
326
326
|
```javascript
|
|
327
327
|
configuration.projectIntegration.getConfiguration = (projectId, crowdinClient, integrationCredentials) => {
|
|
328
328
|
return [
|
|
329
|
+
{
|
|
330
|
+
label: 'GENERAL'
|
|
331
|
+
},
|
|
329
332
|
{
|
|
330
333
|
key: 'flag',
|
|
331
334
|
label: 'Checkbox',
|
|
@@ -350,6 +353,9 @@ configuration.projectIntegration.getConfiguration = (projectId, crowdinClient, i
|
|
|
350
353
|
}
|
|
351
354
|
]
|
|
352
355
|
}
|
|
356
|
+
|
|
357
|
+
//auto reload on settings updates
|
|
358
|
+
configuration.projectIntegration.reloadOnConfigSave = true;
|
|
353
359
|
```
|
|
354
360
|
|
|
355
361
|
## Info window
|
package/out/handlers/main.js
CHANGED
|
@@ -49,6 +49,7 @@ function handle(config, integration) {
|
|
|
49
49
|
const configurationFields = yield integration.getConfiguration(req.crowdinContext.jwtPayload.context.project_id, req.crowdinApiClient, req.integrationCredentials);
|
|
50
50
|
options.configurationFields = configurationFields;
|
|
51
51
|
options.config = JSON.stringify(req.integrationSettings || {});
|
|
52
|
+
options.reloadOnConfigSave = !!integration.reloadOnConfigSave;
|
|
52
53
|
(0, util_1.log)(`Adding configuration fields ${JSON.stringify(configurationFields, null, 2)}`, config.logger);
|
|
53
54
|
}
|
|
54
55
|
options.infoModal = integration.infoModal;
|
package/out/models/index.d.ts
CHANGED
|
@@ -150,7 +150,11 @@ export interface IntegrationLogic {
|
|
|
150
150
|
/**
|
|
151
151
|
* function to define configuration(settings) modal for you app (by default app will not have any custom settings)
|
|
152
152
|
*/
|
|
153
|
-
getConfiguration?: (projectId: number, client: Crowdin, apiCredentials: any) => Promise<
|
|
153
|
+
getConfiguration?: (projectId: number, client: Crowdin, apiCredentials: any) => Promise<ConfigurationModalEntity[]>;
|
|
154
|
+
/**
|
|
155
|
+
* flag to turn on auto reload of the tree whenever user updates the configuration
|
|
156
|
+
*/
|
|
157
|
+
reloadOnConfigSave?: boolean;
|
|
154
158
|
/**
|
|
155
159
|
* define info modal (help section) for you app (by default app will not have own info section)
|
|
156
160
|
*/
|
|
@@ -171,6 +175,7 @@ export interface IntegrationLogic {
|
|
|
171
175
|
integration: boolean;
|
|
172
176
|
};
|
|
173
177
|
}
|
|
178
|
+
export declare type ConfigurationModalEntity = ConfigurationField | ConfigurationDelimeter;
|
|
174
179
|
export interface ConfigurationField {
|
|
175
180
|
key: string;
|
|
176
181
|
label: string;
|
|
@@ -188,6 +193,9 @@ export interface ConfigurationField {
|
|
|
188
193
|
value: string;
|
|
189
194
|
}[];
|
|
190
195
|
}
|
|
196
|
+
export interface ConfigurationDelimeter {
|
|
197
|
+
label: string;
|
|
198
|
+
}
|
|
191
199
|
export interface LoginForm {
|
|
192
200
|
fields: FormField[];
|
|
193
201
|
}
|
package/out/util/defaults.js
CHANGED
|
@@ -105,6 +105,9 @@ function applyDefaults(config, integration) {
|
|
|
105
105
|
fields = yield getUserSettings(projectId, crowdinClient, integrationCredentials);
|
|
106
106
|
}
|
|
107
107
|
return [
|
|
108
|
+
{
|
|
109
|
+
label: 'Background synchronization',
|
|
110
|
+
},
|
|
108
111
|
{
|
|
109
112
|
key: 'schedule',
|
|
110
113
|
label: 'Sync schedule',
|
|
@@ -59,50 +59,54 @@
|
|
|
59
59
|
>
|
|
60
60
|
<div id="modal-content">
|
|
61
61
|
{{#each configurationFields}}
|
|
62
|
-
{{#
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
value="false"
|
|
67
|
-
id="{{key}}-settings"
|
|
68
|
-
key="{{key}}"
|
|
69
|
-
{{#if helpText}}
|
|
70
|
-
help-text="{{helpText}}"
|
|
71
|
-
{{/if}}
|
|
72
|
-
>
|
|
73
|
-
</crowdin-checkbox>
|
|
74
|
-
{{/ifeq}}
|
|
75
|
-
{{#ifeq type "select"}}
|
|
76
|
-
<crowdin-select
|
|
77
|
-
{{#if isMulti}}
|
|
78
|
-
is-multi
|
|
79
|
-
close-on-select="false"
|
|
80
|
-
{{/if}}
|
|
81
|
-
id="{{key}}-settings"
|
|
82
|
-
key="{{key}}"
|
|
83
|
-
label="{{label}}"
|
|
84
|
-
{{#if helpText}}
|
|
85
|
-
help-text="{{helpText}}"
|
|
86
|
-
{{/if}}
|
|
87
|
-
>
|
|
88
|
-
{{#each options}}
|
|
89
|
-
<option value="{{value}}">{{label}}</option>
|
|
90
|
-
{{/each}}
|
|
91
|
-
</crowdin-select>
|
|
92
|
-
{{/ifeq}}
|
|
93
|
-
{{#ifeq type "text"}}
|
|
94
|
-
<crowdin-input
|
|
95
|
-
with-fixed-height
|
|
62
|
+
{{#if key}}
|
|
63
|
+
{{#ifeq type "checkbox"}}
|
|
64
|
+
<crowdin-checkbox
|
|
65
|
+
use-switch
|
|
96
66
|
label="{{label}}"
|
|
97
|
-
value=""
|
|
67
|
+
value="false"
|
|
98
68
|
id="{{key}}-settings"
|
|
99
69
|
key="{{key}}"
|
|
100
70
|
{{#if helpText}}
|
|
101
71
|
help-text="{{helpText}}"
|
|
102
72
|
{{/if}}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
73
|
+
>
|
|
74
|
+
</crowdin-checkbox>
|
|
75
|
+
{{/ifeq}}
|
|
76
|
+
{{#ifeq type "select"}}
|
|
77
|
+
<crowdin-select
|
|
78
|
+
{{#if isMulti}}
|
|
79
|
+
is-multi
|
|
80
|
+
close-on-select="false"
|
|
81
|
+
{{/if}}
|
|
82
|
+
id="{{key}}-settings"
|
|
83
|
+
key="{{key}}"
|
|
84
|
+
label="{{label}}"
|
|
85
|
+
{{#if helpText}}
|
|
86
|
+
help-text="{{helpText}}"
|
|
87
|
+
{{/if}}
|
|
88
|
+
>
|
|
89
|
+
{{#each options}}
|
|
90
|
+
<option value="{{value}}">{{label}}</option>
|
|
91
|
+
{{/each}}
|
|
92
|
+
</crowdin-select>
|
|
93
|
+
{{/ifeq}}
|
|
94
|
+
{{#ifeq type "text"}}
|
|
95
|
+
<crowdin-input
|
|
96
|
+
with-fixed-height
|
|
97
|
+
label="{{label}}"
|
|
98
|
+
value=""
|
|
99
|
+
id="{{key}}-settings"
|
|
100
|
+
key="{{key}}"
|
|
101
|
+
{{#if helpText}}
|
|
102
|
+
help-text="{{helpText}}"
|
|
103
|
+
{{/if}}
|
|
104
|
+
>
|
|
105
|
+
</crowdin-input>
|
|
106
|
+
{{/ifeq}}
|
|
107
|
+
{{else}}
|
|
108
|
+
<crowdin-p>{{label}}</crowdin-p>
|
|
109
|
+
{{/if}}
|
|
106
110
|
<div style="padding: 8px"></div>
|
|
107
111
|
{{/each}}
|
|
108
112
|
</div>
|
|
@@ -350,6 +354,10 @@
|
|
|
350
354
|
.finally(() => {
|
|
351
355
|
settingsSaveBtn.removeAttribute('disabled');
|
|
352
356
|
settingsModal.close();
|
|
357
|
+
{{#if reloadOnConfigSave}}
|
|
358
|
+
getIntegrationData();
|
|
359
|
+
getCrowdinData();
|
|
360
|
+
{{/if}}
|
|
353
361
|
});
|
|
354
362
|
}
|
|
355
363
|
{{/if}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crowdin/app-project-module",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.5",
|
|
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",
|
|
@@ -17,15 +17,16 @@
|
|
|
17
17
|
"express": "4.17.1",
|
|
18
18
|
"express-handlebars": "^5.3.4",
|
|
19
19
|
"node-cron": "^3.0.0",
|
|
20
|
-
"sqlite3": "^5.0.2"
|
|
20
|
+
"sqlite3": "^5.0.2",
|
|
21
|
+
"uuid": "^8.3.2"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"@types/crypto-js": "^4.0.0",
|
|
24
25
|
"@types/express": "4.17.13",
|
|
25
26
|
"@types/express-handlebars": "^5.3.1",
|
|
26
27
|
"@types/node": "^12.0.10",
|
|
27
|
-
"@types/sqlite3": "^3.1.7",
|
|
28
28
|
"@types/node-cron": "^3.0.0",
|
|
29
|
+
"@types/sqlite3": "^3.1.7",
|
|
29
30
|
"@typescript-eslint/eslint-plugin": "^2.3.1",
|
|
30
31
|
"@typescript-eslint/parser": "^2.3.1",
|
|
31
32
|
"eslint": "^6.4.0",
|