@docuninja/builder2.0 0.0.85 → 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;
@@ -94,6 +99,7 @@ export type Builder = {
94
99
  invoiceninja?: boolean;
95
100
  company?: string;
96
101
  onEntityReady?: (entity: Document | Blueprint) => void;
102
+ onEntityRefresh?: (entity: Document | Blueprint) => void;
97
103
  services?: {
98
104
  google?: {
99
105
  appId: string;
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;
@@ -155,6 +160,7 @@ export declare type Builder = {
155
160
  invoiceninja?: boolean;
156
161
  company?: string;
157
162
  onEntityReady?: (entity: Document_2 | Blueprint) => void;
163
+ onEntityRefresh?: (entity: Document_2 | Blueprint) => void;
158
164
  services?: {
159
165
  google?: {
160
166
  appId: string;
@@ -201,6 +207,8 @@ export declare namespace BuilderTypes {
201
207
  }
202
208
  }
203
209
 
210
+ declare type CheckboxOperator = "checked" | "unchecked";
211
+
204
212
  export declare function checkPdfPassword(file: File, password: string): Promise<boolean>;
205
213
 
206
214
  export declare interface Client {
@@ -295,6 +303,15 @@ export declare interface CompanyUser {
295
303
  deleted_at: string | null;
296
304
  }
297
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
+
298
315
  export declare type ConfirmationDialogButtonProps = {
299
316
  onClick: () => void;
300
317
  };
@@ -386,6 +403,8 @@ export declare type DateInputProps = {
386
403
  onChange: (date: string) => void;
387
404
  };
388
405
 
406
+ declare type DateOperator = "empty" | "not_empty" | "equals" | "not_equals" | "before" | "after" | "before_or_equal" | "after_or_equal";
407
+
389
408
  export declare type DeleteDialogButtonProps = {
390
409
  isSubmitting: boolean;
391
410
  };
@@ -550,6 +569,8 @@ export declare interface Language {
550
569
 
551
570
  export declare type MinimizeButtonProps = StartSigningButtonProps;
552
571
 
572
+ declare type MultiselectOperator = "empty" | "not_empty" | "contains" | "not_contains" | "contains_all" | "contains_any";
573
+
553
574
  export declare type NavigateButtonProps = {
554
575
  onClick: () => void;
555
576
  disabled: boolean;
@@ -557,6 +578,8 @@ export declare type NavigateButtonProps = {
557
578
 
558
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";
559
580
 
581
+ declare type NumberOperator = "empty" | "not_empty" | "equals" | "not_equals" | "greater_than" | "less_than" | "greater_than_or_equal" | "less_than_or_equal";
582
+
560
583
  export declare const pdfjs: typeof lib;
561
584
 
562
585
  export declare interface Plan {
@@ -587,11 +610,16 @@ export declare type Rectangle = {
587
610
  file_id: string;
588
611
  signatory_id: string;
589
612
  color: string;
613
+ borderStyle?: "solid" | "dotted" | "hidden";
590
614
  required: boolean;
591
615
  options?: RectangleOptions;
592
616
  show_label?: boolean;
617
+ conditional?: RectangleConditional;
618
+ conditionalRequired?: RectangleConditional;
593
619
  };
594
620
 
621
+ declare type RectangleConditional = SingleCondition | CompoundCondition;
622
+
595
623
  declare type RectangleOptions = {
596
624
  date?: {
597
625
  format: DateFormat;
@@ -698,6 +726,8 @@ export declare type SaveButtonProps = {
698
726
  onClick: () => void;
699
727
  };
700
728
 
729
+ declare type SelectOperator = "empty" | "not_empty" | "equals" | "not_equals";
730
+
701
731
  declare type SelectOption = {
702
732
  value: string;
703
733
  label: string;
@@ -764,6 +794,9 @@ export declare type Sign = {
764
794
  };
765
795
  styles: Builder["styles"];
766
796
  company?: string;
797
+ translations?: {
798
+ [key: string]: string | object;
799
+ };
767
800
  };
768
801
 
769
802
  export declare type SignatorySelectorProps = {
@@ -832,6 +865,13 @@ export declare type SignProps = {
832
865
  invitation: DocumentInvitation;
833
866
  };
834
867
 
868
+ declare type SingleCondition = {
869
+ fieldId: string;
870
+ fieldType: ConditionFieldType;
871
+ operator: ConditionOperator;
872
+ value?: string | number | string[];
873
+ };
874
+
835
875
  export declare type StartSigningButtonProps = {
836
876
  onClick: () => void;
837
877
  };
@@ -850,6 +890,8 @@ export declare interface Template {
850
890
  type_id: number;
851
891
  }
852
892
 
893
+ declare type TextOperator = "empty" | "not_empty" | "equals" | "not_equals" | "contains" | "not_contains" | "starts_with" | "ends_with";
894
+
853
895
  export declare interface Timezone {
854
896
  id: string;
855
897
  location: string;