@legalplace/models-v3-types 3.0.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.
- package/.gitlab-ci.yml +0 -0
- package/README +6 -0
- package/index.ts +458 -0
- package/package.json +8 -0
- package/schema.json +1324 -0
- package/tsconfig.json +22 -0
package/.gitlab-ci.yml
ADDED
|
File without changes
|
package/README
ADDED
package/index.ts
ADDED
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
// Type definitions for model v3
|
|
2
|
+
// TypeScript Version: 2.1
|
|
3
|
+
|
|
4
|
+
type CONDITION_TYPE = 'selected' | 'not-selected' | 'has-one' | 'at-least-one' | 'has-many' | 'contains' | 'does-not-contain' | '=' | '>' | '<' | '!=' | '>=' | '<=' | '<>' | '==';
|
|
5
|
+
type DATA_MAP = {
|
|
6
|
+
var: string
|
|
7
|
+
};
|
|
8
|
+
type CONDITION = {
|
|
9
|
+
[key in CONDITION_TYPE]?: [DATA_MAP, (string | number | boolean)?]
|
|
10
|
+
}
|
|
11
|
+
type CONDITION_OPERATOR = { [key in 'and' | 'or']?: (CONDITION_OPERATOR & CONDITION)[] };
|
|
12
|
+
export type ConditionV3 = CONDITION_OPERATOR & CONDITION;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Model
|
|
16
|
+
*/
|
|
17
|
+
export interface ModelV3 {
|
|
18
|
+
documents: {
|
|
19
|
+
/**
|
|
20
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
21
|
+
* via the `patternProperty` ".*".
|
|
22
|
+
*/
|
|
23
|
+
[k: string]: {
|
|
24
|
+
/**
|
|
25
|
+
* Document's name
|
|
26
|
+
*/
|
|
27
|
+
name: string;
|
|
28
|
+
/**
|
|
29
|
+
* Document's sections list
|
|
30
|
+
*/
|
|
31
|
+
sections: SectionV3[];
|
|
32
|
+
/**
|
|
33
|
+
* Document's params
|
|
34
|
+
*/
|
|
35
|
+
params?: {
|
|
36
|
+
formats?: {
|
|
37
|
+
pdf?: boolean;
|
|
38
|
+
docx?: boolean;
|
|
39
|
+
};
|
|
40
|
+
private?: boolean;
|
|
41
|
+
conditions?: ConditionV3;
|
|
42
|
+
grantLevel?: 'ADMIN' | 'MANAGER' | 'USER' | 'GUEST';
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
options: {
|
|
47
|
+
[k: string]: OptionV3;
|
|
48
|
+
};
|
|
49
|
+
variables: {
|
|
50
|
+
[k: string]: VariableV3;
|
|
51
|
+
};
|
|
52
|
+
customization: {
|
|
53
|
+
disableAutoDefaut?: boolean;
|
|
54
|
+
extracts?: ExtractV3[];
|
|
55
|
+
clientType?: {
|
|
56
|
+
type: "ind" | "pro" | "conditionnal";
|
|
57
|
+
conditions?: ConditionV3;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Extract V3
|
|
64
|
+
*/
|
|
65
|
+
export interface ExtractV3 {
|
|
66
|
+
type: 'option' | 'variable';
|
|
67
|
+
id: number;
|
|
68
|
+
destination: {
|
|
69
|
+
sendinblue?: {
|
|
70
|
+
name: string;
|
|
71
|
+
};
|
|
72
|
+
mixpanel?: {
|
|
73
|
+
name: string;
|
|
74
|
+
};
|
|
75
|
+
slack?: {
|
|
76
|
+
name: string;
|
|
77
|
+
channel: string;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Section V3
|
|
84
|
+
*/
|
|
85
|
+
export interface SectionV3 {
|
|
86
|
+
/**
|
|
87
|
+
* Section's id
|
|
88
|
+
*/
|
|
89
|
+
id: number;
|
|
90
|
+
/**
|
|
91
|
+
* Section's grant type
|
|
92
|
+
*/
|
|
93
|
+
grantLevel?: 'ADMIN' | 'MANAGER' | 'USER' | 'GUEST';
|
|
94
|
+
/**
|
|
95
|
+
* Section's title
|
|
96
|
+
*/
|
|
97
|
+
label: string;
|
|
98
|
+
/**
|
|
99
|
+
* Section's options
|
|
100
|
+
*/
|
|
101
|
+
options: number[];
|
|
102
|
+
/**
|
|
103
|
+
* Section's conditions
|
|
104
|
+
*/
|
|
105
|
+
conditions?: ConditionV3;
|
|
106
|
+
/**
|
|
107
|
+
* Step two only
|
|
108
|
+
*/
|
|
109
|
+
step?: '*' | number[];
|
|
110
|
+
/**
|
|
111
|
+
* Tags
|
|
112
|
+
*/
|
|
113
|
+
tags?: string[];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface OptionV3 {
|
|
117
|
+
meta: {
|
|
118
|
+
/**
|
|
119
|
+
* Option's id
|
|
120
|
+
*/
|
|
121
|
+
id: number;
|
|
122
|
+
/**
|
|
123
|
+
* Option's type
|
|
124
|
+
* - `static`: A static question
|
|
125
|
+
* - `radio`: A radio input
|
|
126
|
+
* - `checkbox`: A checkbox input
|
|
127
|
+
* - `hidden`: An option that only displays an output
|
|
128
|
+
* - `brut-text`: An option without output that displays HTML in the wizard
|
|
129
|
+
* - `repeated`: A loop linked to a multiple (can only have `hidden` options as children)
|
|
130
|
+
*/
|
|
131
|
+
type:
|
|
132
|
+
| 'static'
|
|
133
|
+
| 'radio'
|
|
134
|
+
| 'checkbox'
|
|
135
|
+
| 'hidden'
|
|
136
|
+
| 'repeated'
|
|
137
|
+
| 'box'
|
|
138
|
+
| 'separator';
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Option's label
|
|
142
|
+
*/
|
|
143
|
+
label: string;
|
|
144
|
+
/**
|
|
145
|
+
* Option steps
|
|
146
|
+
*/
|
|
147
|
+
step: '*' | number[];
|
|
148
|
+
/**
|
|
149
|
+
* Fallback Label
|
|
150
|
+
*/
|
|
151
|
+
fallbackLabel?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Set to true to make the option mandatory
|
|
154
|
+
*/
|
|
155
|
+
mandatory?: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Tags
|
|
158
|
+
*/
|
|
159
|
+
tags?: string[];
|
|
160
|
+
/**
|
|
161
|
+
* The raw option's output
|
|
162
|
+
*/
|
|
163
|
+
output?: string;
|
|
164
|
+
/**
|
|
165
|
+
* The html content of the warning block
|
|
166
|
+
*/
|
|
167
|
+
warning?: string;
|
|
168
|
+
/**
|
|
169
|
+
* The html content of the helper block
|
|
170
|
+
*/
|
|
171
|
+
helper?: string;
|
|
172
|
+
/**
|
|
173
|
+
* Raw conditions array
|
|
174
|
+
*/
|
|
175
|
+
conditions?: ConditionV3;
|
|
176
|
+
/**
|
|
177
|
+
* Option's grantLevel
|
|
178
|
+
*/
|
|
179
|
+
grantLevel?: 'ADMIN' | 'MANAGER' | 'USER' | 'GUEST';
|
|
180
|
+
/**
|
|
181
|
+
* Option style
|
|
182
|
+
*/
|
|
183
|
+
style?: '' | 'half' | 'full';
|
|
184
|
+
/**
|
|
185
|
+
* In case of a radio/checkbox/static options, this holds the default child id that should be selected in case the user advances to the next section without selecting any of the child
|
|
186
|
+
*/
|
|
187
|
+
defaultRadio?: number;
|
|
188
|
+
/**
|
|
189
|
+
* In case of a `repeated` option, this defines the multiple's id that the loop should be linked to
|
|
190
|
+
*/
|
|
191
|
+
repeatOption?: number;
|
|
192
|
+
/**
|
|
193
|
+
* Validator PARAMS
|
|
194
|
+
*/
|
|
195
|
+
validator?: {
|
|
196
|
+
/**
|
|
197
|
+
* Validator condition
|
|
198
|
+
*/
|
|
199
|
+
conditions?: ConditionV3;
|
|
200
|
+
/**
|
|
201
|
+
* Unvalid message
|
|
202
|
+
*/
|
|
203
|
+
message?: string;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* MULTIPLE PARAMS
|
|
208
|
+
*/
|
|
209
|
+
multiple?: {
|
|
210
|
+
/**
|
|
211
|
+
* Enabled/Disable Multiple (on root options only)
|
|
212
|
+
*/
|
|
213
|
+
enabled: boolean;
|
|
214
|
+
/**
|
|
215
|
+
* The label of the multiple's incrementing cta
|
|
216
|
+
*/
|
|
217
|
+
cta?: string;
|
|
218
|
+
/**
|
|
219
|
+
* The text that preceeds the reccurency number of the multiple
|
|
220
|
+
*/
|
|
221
|
+
label?: string;
|
|
222
|
+
/**
|
|
223
|
+
* The start of the multiples incrementation counter
|
|
224
|
+
*/
|
|
225
|
+
incrementationStart?: number;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* TERMSHEET PARAMS
|
|
230
|
+
*/
|
|
231
|
+
termsheet?: {
|
|
232
|
+
/**
|
|
233
|
+
* Option's termsheetLabel
|
|
234
|
+
*/
|
|
235
|
+
label?: string;
|
|
236
|
+
/**
|
|
237
|
+
* Hide option from termsheet
|
|
238
|
+
*/
|
|
239
|
+
hide?: boolean;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* BOX PARAMS
|
|
244
|
+
*/
|
|
245
|
+
box?: {
|
|
246
|
+
/**
|
|
247
|
+
* Box type
|
|
248
|
+
*/
|
|
249
|
+
type?: 'warning' | 'error' | 'info' | 'light';
|
|
250
|
+
/**
|
|
251
|
+
* Box title
|
|
252
|
+
*/
|
|
253
|
+
title?: string;
|
|
254
|
+
/**
|
|
255
|
+
* Box collapsable
|
|
256
|
+
*/
|
|
257
|
+
collapsable?: boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Box aggregatable
|
|
260
|
+
*/
|
|
261
|
+
aggregatable?: boolean;
|
|
262
|
+
/**
|
|
263
|
+
* The html content of the brut-text option
|
|
264
|
+
*/
|
|
265
|
+
content?: string;
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* Child options
|
|
270
|
+
*/
|
|
271
|
+
options: number[];
|
|
272
|
+
/**
|
|
273
|
+
* Child variables
|
|
274
|
+
*/
|
|
275
|
+
variables: number[];
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Variable definition object
|
|
279
|
+
*
|
|
280
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
281
|
+
* via the `patternProperty` ".*".
|
|
282
|
+
*/
|
|
283
|
+
export interface VariableV3 {
|
|
284
|
+
/**
|
|
285
|
+
* Variable's id (must be unique)
|
|
286
|
+
*/
|
|
287
|
+
id: number;
|
|
288
|
+
/**
|
|
289
|
+
* Variable's label
|
|
290
|
+
*/
|
|
291
|
+
label: string;
|
|
292
|
+
/**
|
|
293
|
+
* Variable's type
|
|
294
|
+
*/
|
|
295
|
+
type:
|
|
296
|
+
| 'text'
|
|
297
|
+
| 'date'
|
|
298
|
+
| 'list'
|
|
299
|
+
| 'textarea'
|
|
300
|
+
| 'number'
|
|
301
|
+
| 'eval'
|
|
302
|
+
| 'hour'
|
|
303
|
+
| 'email'
|
|
304
|
+
| 'mask';
|
|
305
|
+
/**
|
|
306
|
+
* Variable's grantLevel
|
|
307
|
+
*/
|
|
308
|
+
grantLevel?: 'ADMIN' | 'MANAGER' | 'USER' | 'GUEST';
|
|
309
|
+
/**
|
|
310
|
+
* Variable's suffix
|
|
311
|
+
*/
|
|
312
|
+
suffix?: string;
|
|
313
|
+
/**
|
|
314
|
+
* Variable's place holder length
|
|
315
|
+
*/
|
|
316
|
+
placeholderLength?: number;
|
|
317
|
+
/**
|
|
318
|
+
* The html content of the warning block
|
|
319
|
+
*/
|
|
320
|
+
warning?: string;
|
|
321
|
+
/**
|
|
322
|
+
* The html content of the helper block
|
|
323
|
+
*/
|
|
324
|
+
helper?: string;
|
|
325
|
+
/**
|
|
326
|
+
* The list of options for the select (list type) variable
|
|
327
|
+
*/
|
|
328
|
+
selectValues?: string[];
|
|
329
|
+
/**
|
|
330
|
+
* The input's autocomplete attribute
|
|
331
|
+
*/
|
|
332
|
+
autocomplete?: string;
|
|
333
|
+
/**
|
|
334
|
+
* Preffiling's object
|
|
335
|
+
*/
|
|
336
|
+
prefillings?: PrefillingV3[];
|
|
337
|
+
/**
|
|
338
|
+
* Input's placeholder
|
|
339
|
+
*/
|
|
340
|
+
placeholder?: string;
|
|
341
|
+
/**
|
|
342
|
+
* Set to true if the variable should be displayed in the second step only
|
|
343
|
+
*/
|
|
344
|
+
step: '*' | number[];
|
|
345
|
+
/**
|
|
346
|
+
* Variable conditions
|
|
347
|
+
*/
|
|
348
|
+
conditions?: ConditionV3;
|
|
349
|
+
/**
|
|
350
|
+
* Defines input size
|
|
351
|
+
*/
|
|
352
|
+
style?: 'half' | 'full';
|
|
353
|
+
/**
|
|
354
|
+
* Hidden variable
|
|
355
|
+
*/
|
|
356
|
+
hidden?: boolean;
|
|
357
|
+
/**
|
|
358
|
+
* Tags
|
|
359
|
+
*/
|
|
360
|
+
tags?: string[];
|
|
361
|
+
/**
|
|
362
|
+
* True if the variable is mandatory
|
|
363
|
+
*/
|
|
364
|
+
mandatory?: boolean;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Evaluation params
|
|
368
|
+
*/
|
|
369
|
+
eval?: {
|
|
370
|
+
/**
|
|
371
|
+
* The evaluation formula (eval type), Example:
|
|
372
|
+
* ```
|
|
373
|
+
* [var:1]*[var:2]/[var:3]```
|
|
374
|
+
*/
|
|
375
|
+
formula?: string;
|
|
376
|
+
/**
|
|
377
|
+
* The number of decimals for the result of an evaluation (eval type)
|
|
378
|
+
*/
|
|
379
|
+
decimals?: number;
|
|
380
|
+
/**
|
|
381
|
+
* Round evalulation result (eval type).
|
|
382
|
+
*/
|
|
383
|
+
round?: 'ceil' | 'floor' | 'round';
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Textarea styling
|
|
388
|
+
*/
|
|
389
|
+
textarea?: {
|
|
390
|
+
/**
|
|
391
|
+
* Textarea's size (textarea type)
|
|
392
|
+
* - l: Large (240px)
|
|
393
|
+
* - m: Medium (120px)
|
|
394
|
+
* - s: Small (60px)
|
|
395
|
+
* - p: Custom size in number of lines
|
|
396
|
+
*/
|
|
397
|
+
size?: 'l' | 'm' | 'p' | 's';
|
|
398
|
+
/**
|
|
399
|
+
* The textarea's high (lines number) (Only if textarea_size is set to `p`)
|
|
400
|
+
*/
|
|
401
|
+
lineNumbers?: number;
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Mask
|
|
406
|
+
*/
|
|
407
|
+
mask?: {
|
|
408
|
+
/**
|
|
409
|
+
* The advanced mask's formula (ex: 20 ???-???-???) (?: Char & Number, !: Number Only, @: Char Only)
|
|
410
|
+
*/
|
|
411
|
+
formula?: string;
|
|
412
|
+
/**
|
|
413
|
+
* Mask's placeholder
|
|
414
|
+
*/
|
|
415
|
+
placeholder?: string;
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Validator
|
|
420
|
+
*/
|
|
421
|
+
validator?: {
|
|
422
|
+
/**
|
|
423
|
+
* Validator condition
|
|
424
|
+
*/
|
|
425
|
+
conditions?: ConditionV3;
|
|
426
|
+
/**
|
|
427
|
+
* Unvalid error message
|
|
428
|
+
*/
|
|
429
|
+
message?: string;
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Termsheet
|
|
434
|
+
*/
|
|
435
|
+
termsheet?: {
|
|
436
|
+
/**
|
|
437
|
+
* Variable's termsheet label
|
|
438
|
+
*/
|
|
439
|
+
label?: string;
|
|
440
|
+
/**
|
|
441
|
+
* Hide variable from termsheet
|
|
442
|
+
*/
|
|
443
|
+
hide?: boolean;
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* A Prefilling, is a conditionned text placeholder/example used to fill a textarea according to different conditions
|
|
448
|
+
*/
|
|
449
|
+
export interface PrefillingV3 {
|
|
450
|
+
/**
|
|
451
|
+
* Text used to fill the textarea if the condition is realized
|
|
452
|
+
*/
|
|
453
|
+
value: string;
|
|
454
|
+
/**
|
|
455
|
+
* Compiled conditions object
|
|
456
|
+
*/
|
|
457
|
+
conditions?: ConditionV3;
|
|
458
|
+
}
|