@docuninja/builder2.0 0.0.86 → 0.0.87

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.
@@ -0,0 +1,20 @@
1
+ import { ConditionFieldType, ConditionOperator, OperatorInfo, Rectangle } from '../index';
2
+ export declare function getOperatorsForFieldType(fieldType: ConditionFieldType): OperatorInfo[];
3
+ export declare function operatorNeedsValue(operator: ConditionOperator): boolean;
4
+ export declare function getFieldTypeFromRectangle(rectangle: Rectangle | undefined | null): ConditionFieldType | null;
5
+ export declare function evaluateConditional(rectangle: Rectangle | null | undefined, state: {
6
+ checkboxes: Record<string, boolean>;
7
+ inputs: Record<string, string>;
8
+ dates: Record<string, string>;
9
+ selects: Record<string, string>;
10
+ radios: Record<string, string>;
11
+ multiselects: Record<string, string[]>;
12
+ numbers: Record<string, string>;
13
+ initials: Record<string, string>;
14
+ }): boolean;
15
+ /**
16
+ * Hook to check if a field is effectively required (considering conditional required)
17
+ */
18
+ export declare function useIsFieldRequired(rectangle: Rectangle | null): boolean;
19
+ export declare function useVisibleRectangles(rectangles: Rectangle[]): Rectangle[];
20
+ export declare function getConditionalTriggerFields(rectangles: Rectangle[]): Rectangle[];
@@ -14,9 +14,12 @@ export type Rectangle = {
14
14
  file_id: string;
15
15
  signatory_id: string;
16
16
  color: string;
17
+ borderStyle?: "solid" | "dotted" | "hidden";
17
18
  required: boolean;
18
19
  options?: RectangleOptions;
19
20
  show_label?: boolean;
21
+ conditional?: RectangleConditional;
22
+ conditionalRequired?: RectangleConditional;
20
23
  };
21
24
  export type InputType = "signature" | "input" | "date" | "checkbox" | "initial" | "select" | "radio" | "multiselect" | "number";
22
25
  export type Rectangles = Record<string, Rectangle[]>;
@@ -29,6 +32,30 @@ export type SelectOption = {
29
32
  label: string;
30
33
  value: string;
31
34
  };
35
+ export type CheckboxOperator = "checked" | "unchecked";
36
+ export type TextOperator = "empty" | "not_empty" | "equals" | "not_equals" | "contains" | "not_contains" | "starts_with" | "ends_with";
37
+ export type NumberOperator = "empty" | "not_empty" | "equals" | "not_equals" | "greater_than" | "less_than" | "greater_than_or_equal" | "less_than_or_equal";
38
+ export type SelectOperator = "empty" | "not_empty" | "equals" | "not_equals";
39
+ export type MultiselectOperator = "empty" | "not_empty" | "contains" | "not_contains" | "contains_all" | "contains_any";
40
+ export type DateOperator = "empty" | "not_empty" | "equals" | "not_equals" | "before" | "after" | "before_or_equal" | "after_or_equal";
41
+ export type ConditionOperator = CheckboxOperator | TextOperator | NumberOperator | SelectOperator | MultiselectOperator | DateOperator;
42
+ export type ConditionFieldType = "checkbox" | "input" | "date" | "select" | "radio" | "multiselect" | "number" | "initial";
43
+ export type OperatorInfo = {
44
+ value: ConditionOperator;
45
+ label: string;
46
+ needsValue?: boolean;
47
+ };
48
+ export type SingleCondition = {
49
+ fieldId: string;
50
+ fieldType: ConditionFieldType;
51
+ operator: ConditionOperator;
52
+ value?: string | number | string[];
53
+ };
54
+ export type CompoundCondition = {
55
+ operator: "and" | "or";
56
+ conditions: SingleCondition[];
57
+ };
58
+ export type RectangleConditional = SingleCondition | CompoundCondition;
32
59
  export type RectangleOptions = {
33
60
  date?: {
34
61
  format: DateFormat;
@@ -33,6 +33,9 @@ export type Sign = {
33
33
  };
34
34
  styles: Builder["styles"];
35
35
  company?: string;
36
+ translations?: {
37
+ [key: string]: string | object;
38
+ };
36
39
  };
37
40
  export declare const SignContext: import('react').Context<Sign | null>;
38
41
  export declare const SignContextPlus: import('react').Context<(Sign & {
@@ -4,6 +4,9 @@ type DocuNinjaSignOptions = {
4
4
  sig?: string;
5
5
  endpoint?: string;
6
6
  company?: string;
7
+ translations?: {
8
+ [key: string]: string | object;
9
+ };
7
10
  };
8
11
  export declare class DocuNinjaSign {
9
12
  options: DocuNinjaSignOptions;
@@ -67,6 +67,11 @@ export type Builder = {
67
67
  };
68
68
  };
69
69
  styles: {
70
+ general?: {
71
+ backgroundColor?: string;
72
+ textColor?: string;
73
+ foregroundColor?: string;
74
+ };
70
75
  frame: React.CSSProperties | undefined;
71
76
  border: string | undefined;
72
77
  childrenWrapper?: React.CSSProperties;
package/dist/builder.d.ts CHANGED
@@ -128,6 +128,11 @@ export declare type Builder = {
128
128
  };
129
129
  };
130
130
  styles: {
131
+ general?: {
132
+ backgroundColor?: string;
133
+ textColor?: string;
134
+ foregroundColor?: string;
135
+ };
131
136
  frame: React.CSSProperties | undefined;
132
137
  border: string | undefined;
133
138
  childrenWrapper?: React.CSSProperties;
@@ -202,6 +207,8 @@ export declare namespace BuilderTypes {
202
207
  }
203
208
  }
204
209
 
210
+ declare type CheckboxOperator = "checked" | "unchecked";
211
+
205
212
  export declare function checkPdfPassword(file: File, password: string): Promise<boolean>;
206
213
 
207
214
  export declare interface Client {
@@ -296,6 +303,15 @@ export declare interface CompanyUser {
296
303
  deleted_at: string | null;
297
304
  }
298
305
 
306
+ declare type CompoundCondition = {
307
+ operator: "and" | "or";
308
+ conditions: SingleCondition[];
309
+ };
310
+
311
+ declare type ConditionFieldType = "checkbox" | "input" | "date" | "select" | "radio" | "multiselect" | "number" | "initial";
312
+
313
+ declare type ConditionOperator = CheckboxOperator | TextOperator | NumberOperator | SelectOperator | MultiselectOperator | DateOperator;
314
+
299
315
  export declare type ConfirmationDialogButtonProps = {
300
316
  onClick: () => void;
301
317
  };
@@ -387,6 +403,8 @@ export declare type DateInputProps = {
387
403
  onChange: (date: string) => void;
388
404
  };
389
405
 
406
+ declare type DateOperator = "empty" | "not_empty" | "equals" | "not_equals" | "before" | "after" | "before_or_equal" | "after_or_equal";
407
+
390
408
  export declare type DeleteDialogButtonProps = {
391
409
  isSubmitting: boolean;
392
410
  };
@@ -551,6 +569,8 @@ export declare interface Language {
551
569
 
552
570
  export declare type MinimizeButtonProps = StartSigningButtonProps;
553
571
 
572
+ declare type MultiselectOperator = "empty" | "not_empty" | "contains" | "not_contains" | "contains_all" | "contains_any";
573
+
554
574
  export declare type NavigateButtonProps = {
555
575
  onClick: () => void;
556
576
  disabled: boolean;
@@ -558,6 +578,8 @@ export declare type NavigateButtonProps = {
558
578
 
559
579
  declare type NumberFormat = "123456789.567" | "$123,456,789.57" | "123 456 789,57 €" | "£123,456,789.57" | "123,456,789.567" | "123.456.789,567" | "123 456 789,567";
560
580
 
581
+ declare type NumberOperator = "empty" | "not_empty" | "equals" | "not_equals" | "greater_than" | "less_than" | "greater_than_or_equal" | "less_than_or_equal";
582
+
561
583
  export declare const pdfjs: typeof lib;
562
584
 
563
585
  export declare interface Plan {
@@ -588,11 +610,16 @@ export declare type Rectangle = {
588
610
  file_id: string;
589
611
  signatory_id: string;
590
612
  color: string;
613
+ borderStyle?: "solid" | "dotted" | "hidden";
591
614
  required: boolean;
592
615
  options?: RectangleOptions;
593
616
  show_label?: boolean;
617
+ conditional?: RectangleConditional;
618
+ conditionalRequired?: RectangleConditional;
594
619
  };
595
620
 
621
+ declare type RectangleConditional = SingleCondition | CompoundCondition;
622
+
596
623
  declare type RectangleOptions = {
597
624
  date?: {
598
625
  format: DateFormat;
@@ -699,6 +726,8 @@ export declare type SaveButtonProps = {
699
726
  onClick: () => void;
700
727
  };
701
728
 
729
+ declare type SelectOperator = "empty" | "not_empty" | "equals" | "not_equals";
730
+
702
731
  declare type SelectOption = {
703
732
  value: string;
704
733
  label: string;
@@ -765,6 +794,9 @@ export declare type Sign = {
765
794
  };
766
795
  styles: Builder["styles"];
767
796
  company?: string;
797
+ translations?: {
798
+ [key: string]: string | object;
799
+ };
768
800
  };
769
801
 
770
802
  export declare type SignatorySelectorProps = {
@@ -833,6 +865,13 @@ export declare type SignProps = {
833
865
  invitation: DocumentInvitation;
834
866
  };
835
867
 
868
+ declare type SingleCondition = {
869
+ fieldId: string;
870
+ fieldType: ConditionFieldType;
871
+ operator: ConditionOperator;
872
+ value?: string | number | string[];
873
+ };
874
+
836
875
  export declare type StartSigningButtonProps = {
837
876
  onClick: () => void;
838
877
  };
@@ -851,6 +890,8 @@ export declare interface Template {
851
890
  type_id: number;
852
891
  }
853
892
 
893
+ declare type TextOperator = "empty" | "not_empty" | "equals" | "not_equals" | "contains" | "not_contains" | "starts_with" | "ends_with";
894
+
854
895
  export declare interface Timezone {
855
896
  id: string;
856
897
  location: string;