@legalplace/prerenderx 3.8.24-staging.0 → 3.9.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.
@@ -1,915 +0,0 @@
1
- // Type definitions for model v3
2
- // TypeScript Version: 2.1
3
- import type { ROLE } from "@legalplace/typeorm-constants";
4
-
5
- type CONDITION_TYPE =
6
- | "selected"
7
- | "not-selected"
8
- | "not-selected-ip"
9
- | "has-one"
10
- | "at-least-one"
11
- | "has-many"
12
- | "contains"
13
- | "does-not-contain"
14
- | "="
15
- | ">"
16
- | "<"
17
- | "!="
18
- | ">="
19
- | "<="
20
- | "<>"
21
- | "=="
22
- | "empty"
23
- | "not-empty"
24
- | "is"
25
- | "not"
26
- | "like"
27
- | "not-like"
28
- | "regex-match"
29
- | "conditions-met"
30
- | "conditions-not-met";
31
- type DATA_MAP = {
32
- var: string;
33
- };
34
- type CONDITION = {
35
- [key in CONDITION_TYPE]?: [
36
- DATA_MAP,
37
- (string | number | boolean)?,
38
- DATA_MAP[]?
39
- ];
40
- };
41
- type CONDITION_SCOPE = "first" | "all" | "any" | "related";
42
- type GROUP_META = { label?: string; collapsed?: boolean };
43
- type CONDITION_NODE = CONDITION & {
44
- scope?: CONDITION_SCOPE;
45
- groupMeta?: GROUP_META;
46
- };
47
- type CONDITION_OPERATOR = {
48
- [key in "and" | "or"]?: (CONDITION_OPERATOR & CONDITION_NODE)[];
49
- };
50
- export type ConditionV3 = CONDITION_OPERATOR & CONDITION_NODE;
51
-
52
- /**
53
- * Document section role for output regions (body is the default when absent).
54
- */
55
- export type SectionRoleV3 =
56
- | "body"
57
- | "header"
58
- | "footer"
59
- | "firstPageHeader"
60
- | "firstPageFooter";
61
-
62
- /**
63
- * Word page layout settings (distances in centimeters).
64
- */
65
- export interface DocumentLayoutV3 {
66
- margins?: {
67
- top?: number;
68
- right?: number;
69
- bottom?: number;
70
- left?: number;
71
- };
72
- headerDistance?: number;
73
- footerDistance?: number;
74
- differentFirstPage?: boolean;
75
- }
76
-
77
- /**
78
- * Model
79
- */
80
- export interface ModelV3<ConstumizationMeta = CustomizationMetaDefault> {
81
- documents: {
82
- /**
83
- * This interface was referenced by `undefined`'s JSON-Schema definition
84
- * via the `patternProperty` ".*".
85
- */
86
- [k: string]: {
87
- /**
88
- * Document's name
89
- */
90
- name: string;
91
- /**
92
- * Document's fallback name
93
- */
94
- fallbackName?: string;
95
- /**
96
- * Document's slug name
97
- */
98
- documentSlug?: string;
99
- /**
100
- * Document's sections list
101
- */
102
- sections: SectionV3[];
103
- /**
104
- * Document's PDF link
105
- */
106
- pdf?: {
107
- id: string;
108
- filename: string;
109
- form: FDFFormV3;
110
- thumbnails: string[];
111
- };
112
- /**
113
- * Document's params
114
- */
115
- params?: {
116
- formats?: {
117
- pdf?: boolean;
118
- docx?: boolean;
119
- };
120
- visibility?: {
121
- [key: string]: boolean | undefined;
122
- private?: boolean;
123
- };
124
- documentStyle?: {
125
- styles?: {
126
- Normal?: {
127
- color?: string;
128
- indent?: number;
129
- /** Font size in pt (lpdocast default: 10). Unset uses built-in default. */
130
- fontSize?: string;
131
- };
132
- headingOne?: {
133
- color?: string;
134
- indent?: number;
135
- /** Font size in pt (lpdocast default: 14). Unset uses built-in default. */
136
- fontSize?: string;
137
- };
138
- headingTwo?: {
139
- color?: string;
140
- indent?: number;
141
- /** Font size in pt (lpdocast default: 12). Unset uses built-in default. */
142
- fontSize?: string;
143
- };
144
- headingThree?: {
145
- color?: string;
146
- indent?: number;
147
- /** Font size in pt (lpdocast default: 10). Unset uses built-in default. */
148
- fontSize?: string;
149
- };
150
- headingFour?: {
151
- color?: string;
152
- indent?: number;
153
- /** Font size in pt (lpdocast default: 10). Unset uses built-in default. */
154
- fontSize?: string;
155
- };
156
- };
157
- titlesNumbering?: {
158
- enabled: boolean;
159
- type: "ARTICLE-FIRST" | "SIMPLE";
160
- };
161
- };
162
- conditions?: ConditionV3;
163
- grantLevel?: ROLE;
164
- /**
165
- * Document multiple settings: when enabled, the document is rendered
166
- * once per occurrence of the linked multiple option, producing N separate
167
- * PDF/DOCX files instead of a single file.
168
- */
169
- multiple?: {
170
- /**
171
- * Enable/disable the document-level multiple
172
- */
173
- enabled: boolean;
174
- /**
175
- * ID of the option that drives the repetition. Must point to an
176
- * `OptionV3` whose `meta.multiple.enabled === true`.
177
- */
178
- repeatOption: number;
179
- /**
180
- * Optional filename template, e.g. `"Contrat - [var:47]"`.
181
- * `[var:X]` placeholders are resolved per occurrence at render time.
182
- * When absent or empty, prerenderx falls back to
183
- * `"<documentName> N°<index + incrementationStart>"`.
184
- */
185
- filenameTemplate?: string;
186
- };
187
- /**
188
- * Word page layout: margins, header/footer distance, first-page header/footer.
189
- */
190
- layout?: DocumentLayoutV3;
191
- };
192
- };
193
- };
194
- options: {
195
- [k: string]: OptionV3;
196
- };
197
- variables: {
198
- [k: string]: VariableV3;
199
- };
200
- customization: {
201
- disableAutoDefault?: boolean;
202
- meta?: ConstumizationMeta;
203
- dataStorage?: {
204
- extendedDuration?: boolean;
205
- };
206
- };
207
- }
208
-
209
- /**
210
- * Default meta customization
211
- */
212
- export interface CustomizationMetaDefault {
213
- [key: string]: any;
214
- extracts?: ExtractV3[];
215
- clientType?: {
216
- type: "ind" | "pro" | "conditionnal";
217
- conditions?: ConditionV3;
218
- };
219
- isTwoSteps?: boolean;
220
- isFullWidth?: boolean;
221
- previewTitle?: string;
222
- contractType?: {
223
- socialType?: "individual" | "collective";
224
- privacy?: "public" | "private";
225
- };
226
- emailSection?: {
227
- sectionTitle?: string;
228
- inputLabel?: string;
229
- warningBlock?: string;
230
- ctaLabel?: string;
231
- ctaIcon?: string;
232
- };
233
- disableDownloads?: boolean;
234
- }
235
-
236
- /**
237
- * Extract V3
238
- */
239
- export interface ExtractV3 {
240
- type: "option" | "variable";
241
- id: number;
242
- destination: {
243
- sendinblue?: {
244
- name: string;
245
- };
246
- mixpanel?: {
247
- name: string;
248
- };
249
- slack?: {
250
- name: string;
251
- channel: string;
252
- };
253
- };
254
- }
255
-
256
- /**
257
- * Email Customization
258
- */
259
- export interface EmailStep {
260
- sectionTitle?: string;
261
- icon?: "download" | "continue";
262
- ctaLabel?: string;
263
- label?: string;
264
- }
265
-
266
- /**
267
- * Section V3
268
- */
269
- export interface SectionV3 {
270
- /**
271
- * Section's id
272
- */
273
- id: number;
274
- /**
275
- * Section's grant type
276
- */
277
- grantLevel?: ROLE;
278
- /**
279
- * Section's title
280
- */
281
- label: string;
282
- /**
283
- * Section's options
284
- */
285
- options: number[];
286
- /**
287
- * Section's conditions
288
- */
289
- conditions?: ConditionV3;
290
- /**
291
- * Step two only
292
- */
293
- step?: "*" | number[];
294
- /**
295
- * Tags
296
- */
297
- tags?: string[];
298
- /**
299
- * Slug
300
- */
301
- slug?: string;
302
- /**
303
- * Output region role. When absent, the section is treated as body content.
304
- */
305
- role?: SectionRoleV3;
306
- }
307
-
308
- export interface OptionV3 {
309
- meta: {
310
- /**
311
- * Option's id
312
- */
313
- id: number;
314
- /**
315
- * Option's type
316
- * - `static`: A static question
317
- * - `radio`: A radio input
318
- * - `checkbox`: A checkbox input
319
- * - `hidden`: An option that only displays an output
320
- * - `brut-text`: An option without output that displays HTML in the wizard
321
- * - `repeated`: A loop linked to a multiple (can only have `hidden` options as children)
322
- */
323
- type:
324
- | "static"
325
- | "radio"
326
- | "checkbox"
327
- | "hidden"
328
- | "repeated"
329
- | "box"
330
- | "separator";
331
-
332
- /**
333
- * Option's label
334
- */
335
- label: string;
336
- /**
337
- * Option steps
338
- */
339
- step: "*" | number[];
340
- /**
341
- * Fallback Label
342
- */
343
- fallbackLabel?: string;
344
- /**
345
- * Set to true to make the option mandatory
346
- */
347
- mandatory?: boolean;
348
- /**
349
- * Tags
350
- */
351
- tags?: string[];
352
- /**
353
- * The raw option's output
354
- */
355
- output?: string;
356
- /**
357
- * The html content of the warning block
358
- */
359
- warning?: string;
360
- /**
361
- * The html content of the helper block
362
- */
363
- helper?: string;
364
- /**
365
- * Raw conditions array
366
- */
367
- conditions?: ConditionV3;
368
- /**
369
- * Option's grantLevel
370
- */
371
- grantLevel?: ROLE;
372
- /**
373
- * Option's randomize order of children
374
- */
375
- randomizeChildren?: boolean;
376
- /**
377
- * Option's fixed last order of children
378
- */
379
- fixedChildrenLastOrder?: string;
380
- /**
381
- * Option style
382
- */
383
- style?: "" | "half" | "full";
384
- /**
385
- * 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
386
- */
387
- defaultRadio?: number;
388
- /**
389
- * In case of a `repeated` option, this defines the multiple's id that the loop should be linked to
390
- */
391
- repeatOption?: number;
392
- /**
393
- * Hidden option
394
- */
395
- hidden?: boolean;
396
- /**
397
- * Disabled option
398
- */
399
- disabled?: boolean;
400
- /**
401
- * Prechecked option
402
- * If true, the option will be prechecked on initialization
403
- */
404
- prechecked?: boolean;
405
- /**
406
- * Validator PARAMS
407
- */
408
- validator?: {
409
- /**
410
- * Validator condition
411
- */
412
- conditions?: ConditionV3;
413
- /**
414
- * Unvalid message
415
- */
416
- message?: string;
417
- };
418
-
419
- /**
420
- * MULTIPLE PARAMS
421
- */
422
- multiple?: {
423
- /**
424
- * Enabled/Disable Multiple (on root options only)
425
- */
426
- enabled: boolean;
427
- /**
428
- * The label of the multiple's incrementing cta
429
- */
430
- cta?: string;
431
- /**
432
- * The text that preceeds the reccurency number of the multiple
433
- */
434
- label?: string;
435
- /**
436
- * The start of the multiples incrementation counter
437
- */
438
- incrementationStart?: number;
439
- };
440
-
441
- /**
442
- * TERMSHEET PARAMS
443
- */
444
- termsheet?: {
445
- /**
446
- * Option's termsheetLabel
447
- */
448
- label?: string;
449
- /**
450
- * Hide option from termsheet
451
- */
452
- hide?: boolean;
453
- };
454
-
455
- /**
456
- * Table hierarchy role for hidden output options.
457
- * When set, the option participates in an output table tree instead of storing inline HTML.
458
- */
459
- tableRole?: "table" | "row" | "cell";
460
-
461
- /**
462
- * Table styling metadata (only on tableRole = 'table' options).
463
- */
464
- tableStyle?: {
465
- columnWidths?: number[];
466
- width?: number;
467
- borderStyle?: string;
468
- borderColor?: string;
469
- borderWidth?: number;
470
- };
471
-
472
- /**
473
- * Cell styling metadata (only on tableRole = 'cell' options).
474
- */
475
- cellStyle?: Record<string, string>;
476
-
477
- /**
478
- * BOX PARAMS
479
- */
480
- box?: {
481
- /**
482
- * Box type
483
- */
484
- type?: "warning" | "error" | "info" | "light";
485
- /**
486
- * Box title
487
- */
488
- title?: string;
489
- /**
490
- * Box collapsable
491
- */
492
- collapsable?: boolean;
493
- /**
494
- * Box aggregatable
495
- */
496
- aggregatable?: boolean;
497
- /**
498
- * The html content of the brut-text option
499
- */
500
- content?: string;
501
- };
502
- };
503
- /**
504
- * Child options
505
- */
506
- options: number[];
507
- /**
508
- * Child variables
509
- */
510
- variables: number[];
511
- }
512
- /**
513
- * Variable definition object
514
- *
515
- * This interface was referenced by `undefined`'s JSON-Schema definition
516
- * via the `patternProperty` ".*".
517
- */
518
- export interface VariableV3 {
519
- /**
520
- * Variable's id (must be unique)
521
- */
522
- id: number;
523
- /**
524
- * Variable's label
525
- */
526
- label: string;
527
- /**
528
- * Variable's Fallback Label
529
- */
530
- fallbackLabel?: string;
531
- /**
532
- * Variable's type
533
- */
534
- type:
535
- | "text"
536
- | "date"
537
- | "list"
538
- | "textarea"
539
- | "number"
540
- | "eval"
541
- | "hour"
542
- | "email"
543
- | "user_email"
544
- | "phone_number"
545
- | "iframe"
546
- | "mask"
547
- | "autocomplete"
548
- | "upload";
549
- /**
550
- * Variable's grantLevel
551
- */
552
- grantLevel?: ROLE;
553
- /**
554
- * Variable's suffix
555
- */
556
- suffix?: string;
557
- /**
558
- * Variable's place holder length
559
- */
560
- placeholderLength?: number;
561
- /**
562
- * The html content of the warning block
563
- */
564
- warning?: string;
565
- /**
566
- * The html content of the helper block
567
- */
568
- helper?: string;
569
- /**
570
- * The list of options for the select (list type) variable
571
- */
572
- selectValues?: string[];
573
- /**
574
- * The input's autocomplete attribute
575
- */
576
- autocomplete?: string;
577
- /**
578
- * Preffiling's object
579
- */
580
- prefillings?: PrefillingV3[];
581
- /**
582
- * Determines whether prefillers take priority over user input.
583
- */
584
- prioritizePrefillings?: boolean;
585
- /**
586
- * Input's placeholder
587
- */
588
- placeholder?: string;
589
- /**
590
- * Set to true if the variable should be displayed in the second step only
591
- */
592
- step: "*" | number[];
593
- /**
594
- * Variable conditions
595
- */
596
- conditions?: ConditionV3;
597
- /**
598
- * Defines input size
599
- */
600
- style?: "half" | "full";
601
- /**
602
- * Hidden variable
603
- */
604
- hidden?: boolean;
605
- /**
606
- * Tags
607
- */
608
- tags?: string[];
609
- /**
610
- * True if the variable is mandatory
611
- */
612
- mandatory?: boolean;
613
-
614
- /**
615
- * When true, the date should not be in the past (for date type only)
616
- */
617
- dateNotInPast?: boolean;
618
-
619
- /**
620
- * When true, the date should not be in the future (for date type only)
621
- */
622
- dateNotInFuture?: boolean;
623
-
624
- /**
625
- * Evaluation params
626
- */
627
- eval?: {
628
- /**
629
- * The evaluation formula (eval type), Example:
630
- * ```
631
- * [var:1]*[var:2]/[var:3]```
632
- */
633
- formula?: string;
634
- /**
635
- * The number of decimals for the result of an evaluation (eval type)
636
- */
637
- decimals?: number;
638
- /**
639
- * Round evalulation result (eval type).
640
- */
641
- round?: "ceil" | "floor" | "round";
642
- };
643
-
644
- /**
645
- * Number input
646
- */
647
- number?: {
648
- intOnly?: boolean;
649
- };
650
-
651
- /**
652
- * Textarea styling
653
- */
654
- textarea?: {
655
- /**
656
- * Textarea's size (textarea type)
657
- * - l: Large (240px)
658
- * - m: Medium (120px)
659
- * - s: Small (60px)
660
- * - p: Custom size in number of lines
661
- */
662
- size?: "l" | "m" | "p" | "s";
663
- /**
664
- * The textarea's high (lines number) (Only if textarea_size is set to `p`)
665
- */
666
- lineNumbers?: number;
667
- };
668
-
669
- /**
670
- * Mask
671
- */
672
- mask?: {
673
- /**
674
- * The advanced mask's formula (ex: 20 ???-???-???) (?: Char & Number, !: Number Only, @: Char Only)
675
- */
676
- formula?: string;
677
- /**
678
- * Mask's placeholder
679
- */
680
- placeholder?: string;
681
- };
682
-
683
- /**
684
- * Validator
685
- */
686
- validator?: {
687
- /**
688
- * Validator condition
689
- */
690
- conditions?: ConditionV3;
691
- /**
692
- * Unvalid error message
693
- */
694
- message?: string;
695
- };
696
-
697
- /**
698
- * Autocomplete input type
699
- */
700
- autocompleteInputType?: "text" | "select";
701
-
702
- /**
703
- * Autocomplete dataset
704
- */
705
- autocompleteDataset?: AutocompleteDatasetType;
706
-
707
- /**
708
- * Linked variables (used in autocomplete)
709
- */
710
- linkedVariables?: Record<string, number>;
711
-
712
- /**
713
- * User side variable disabled condition
714
- */
715
- disabled?: boolean;
716
-
717
- /**
718
- * User side variable disabled tooltip
719
- */
720
- disabledTooltip?: string;
721
-
722
- /**
723
- * Termsheet
724
- */
725
- termsheet?: {
726
- /**
727
- * Variable's termsheet label
728
- */
729
- label?: string;
730
- /**
731
- * Hide variable from termsheet
732
- */
733
- hide?: boolean;
734
- };
735
-
736
- /**
737
- * ExtraInformations (for managing multiple datas associated with a single variable)
738
- */
739
- extraInformations?: ExtraInformations;
740
- }
741
- /**
742
- * ExtraInformations (for managing multiple datas associated with a single variable)
743
- */
744
- interface ExtraInformations {
745
- /**
746
- * List of the inputs to check if it's disabled or not
747
- */
748
- disabledIndexes: boolean[];
749
- /**
750
- * List of defined options for each dropdown menu associated with a specific variable
751
- */
752
- selectedValuesIndexes?: string[][];
753
- }
754
- /**
755
- * A Prefilling, is a conditionned text placeholder/example used to fill a textarea according to different conditions
756
- */
757
- export interface PrefillingV3 {
758
- /**
759
- * Text used to fill the textarea if the condition is realized
760
- */
761
- value: string;
762
- /**
763
- * Compiled conditions object
764
- */
765
- conditions?: ConditionV3;
766
- }
767
-
768
- /**
769
- * FDF
770
- */
771
- export interface FDFFormV3 {
772
- inputs: FDFInputsV3[];
773
- boxes: FDFBoxesV3[];
774
- }
775
-
776
- /**
777
- * FDF Inputs
778
- */
779
- export interface FDFInputsV3 {
780
- name: string;
781
- page: number;
782
- rect: {
783
- x: number;
784
- y: number;
785
- width: number;
786
- height: number;
787
- };
788
- variables: {
789
- id: number;
790
- date?: "DD" | "MM" | "YYYY";
791
- hour?: "HH" | "MM";
792
- email?: "ADDRESS" | "PROVIDER";
793
- fragment?: {
794
- from?: number;
795
- to?: number;
796
- };
797
- }[];
798
- }
799
-
800
- /**
801
- * FDF Boxes
802
- */
803
- export interface FDFBoxesV3 {
804
- name: string;
805
- page: number;
806
- value: string;
807
- rect: {
808
- x: number;
809
- y: number;
810
- width: number;
811
- height: number;
812
- };
813
- options: {
814
- id: number;
815
- }[];
816
- }
817
-
818
- /**
819
- * Autocomplete datasets
820
- */
821
- export type AutocompleteDatasetType =
822
- | "datagouv_addresses"
823
- | "datagouv_cities"
824
- | "pappers"
825
- | "activities"
826
- | "kanoon_collective_agreements"
827
- | "datagouv_addresses_v2"
828
- | "datagouv_cities_with_inpi"
829
- | "rbe";
830
-
831
- /**
832
- * RBE linkedvariables
833
- */
834
- export type RbeLinkedVariableType =
835
- // First variation with _1
836
- | "civilite_1"
837
- | "prenoms_1"
838
- | "nom_1"
839
- | "nationalite_1"
840
- | "dateDeNaissance_1"
841
- | "paysDeNaissance_1"
842
- | "villeDeNaissance_1"
843
- | "codePostalDeLaVilleDeNaissance_1"
844
- | "paysDuDomicile_1"
845
- | "numeroEtVoieDuDomicile_1"
846
- | "codePostalDuDomicile_1"
847
- | "villeDuDomicile_1"
848
- | "partsDirectesPleinePropriete_1"
849
- | "partsIndirectesIndivisionPleinePropriete_1"
850
- // Second variation with _2
851
- | "civilite_2"
852
- | "prenoms_2"
853
- | "nom_2"
854
- | "nationalite_2"
855
- | "dateDeNaissance_2"
856
- | "paysDeNaissance_2"
857
- | "villeDeNaissance_2"
858
- | "codePostalDeLaVilleDeNaissance_2"
859
- | "paysDuDomicile_2"
860
- | "numeroEtVoieDuDomicile_2"
861
- | "codePostalDuDomicile_2"
862
- | "villeDuDomicile_2"
863
- | "partsDirectesPleinePropriete_2"
864
- | "partsIndirectesIndivisionPleinePropriete_2"
865
- // Third variation with _3
866
- | "civilite_3"
867
- | "prenoms_3"
868
- | "nom_3"
869
- | "nationalite_3"
870
- | "dateDeNaissance_3"
871
- | "paysDeNaissance_3"
872
- | "villeDeNaissance_3"
873
- | "codePostalDeLaVilleDeNaissance_3"
874
- | "paysDuDomicile_3"
875
- | "numeroEtVoieDuDomicile_3"
876
- | "codePostalDuDomicile_3"
877
- | "villeDuDomicile_3"
878
- | "partsDirectesPleinePropriete_3"
879
- | "partsIndirectesIndivisionPleinePropriete_3";
880
-
881
- /**
882
- * Autocomplete linkedvariables
883
- */
884
- export type AutocompleteLinkedVariableType =
885
- | "city"
886
- | "communal_code"
887
- | "postcode"
888
- | "company_activity"
889
- | "company_capital"
890
- | "company_ceased_business"
891
- | "company_creation_date"
892
- | "company_denomination"
893
- | "company_hq_address"
894
- | "company_hq_city"
895
- | "company_hq_country"
896
- | "company_hq_postcode"
897
- | "company_legal_status"
898
- | "company_naf_code"
899
- | "company_siren"
900
- | "category"
901
- | "nafCode"
902
- | "type"
903
- | "level1Id"
904
- | "level2Id"
905
- | "level3Id"
906
- | "level4Id"
907
- | "shouldAskIfAlcohol"
908
- | "shouldAskIfCommercialPremises"
909
- | "comptaplaceEligibility"
910
- | "comptaplaceCategory"
911
- | "regulatedActivityProofNeeded"
912
- | "description"
913
- | "descriptionIfSellsAlcohol"
914
- | "warningText"
915
- | RbeLinkedVariableType;