@zerohive/hive-viewer 1.0.0 → 2.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/dist/index.d.cts CHANGED
@@ -3,18 +3,144 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  interface Signature {
4
4
  id?: string;
5
5
  signatureImageUrl: string;
6
- signedBy: string;
6
+ signedBy?: string;
7
+ jobTitle?: string;
7
8
  dateSigned: string;
8
9
  comment?: string;
9
10
  }
11
+ type SignatureInkColor = "black" | "blue" | "red" | "green";
12
+ type SignatureSurfaceKind = "document" | "page" | "slide" | "sheet" | "image";
13
+ type AnnotationSurfaceKind = SignatureSurfaceKind;
14
+ interface SignaturePlacement {
15
+ id: string;
16
+ signatureId?: string;
17
+ signature: Signature;
18
+ signatureColor?: SignatureInkColor;
19
+ surfaceKind: SignatureSurfaceKind;
20
+ surfaceKey: string;
21
+ page?: number;
22
+ slide?: number;
23
+ sheetName?: string;
24
+ x: number;
25
+ y: number;
26
+ width: number;
27
+ height: number;
28
+ }
29
+ interface AnnotationPlacement {
30
+ id: string;
31
+ surfaceKind: AnnotationSurfaceKind;
32
+ surfaceKey: string;
33
+ page?: number;
34
+ slide?: number;
35
+ sheetName?: string;
36
+ x: number;
37
+ y: number;
38
+ width: number;
39
+ height: number;
40
+ text: string;
41
+ linkedSignaturePlacementId?: string;
42
+ linkedSignatureId?: string;
43
+ }
44
+ type PlacementGeometryPatch = Partial<Pick<SignaturePlacement, "x" | "y" | "width" | "height" | "signatureColor">>;
45
+ type AnnotationPatch = Partial<Pick<AnnotationPlacement, "x" | "y" | "width" | "height" | "text">>;
46
+ interface SignaturePlacementDraft {
47
+ signature: Signature;
48
+ signatureColor?: SignatureInkColor;
49
+ surfaceKind: SignatureSurfaceKind;
50
+ surfaceKey: string;
51
+ page?: number;
52
+ slide?: number;
53
+ sheetName?: string;
54
+ x: number;
55
+ y: number;
56
+ width: number;
57
+ height: number;
58
+ }
59
+ interface AnnotationPlacementDraft {
60
+ surfaceKind: AnnotationSurfaceKind;
61
+ surfaceKey: string;
62
+ page?: number;
63
+ slide?: number;
64
+ sheetName?: string;
65
+ x: number;
66
+ y: number;
67
+ width: number;
68
+ height: number;
69
+ text: string;
70
+ linkedSignaturePlacementId?: string;
71
+ linkedSignatureId?: string;
72
+ }
73
+ interface DocumentSurfaceOverlayState {
74
+ placements: SignaturePlacement[];
75
+ annotations: AnnotationPlacement[];
76
+ pendingSignature?: Signature | null;
77
+ pendingAnnotation?: boolean;
78
+ activePlacementId?: string | null;
79
+ activeAnnotationId?: string | null;
80
+ placeHint: string;
81
+ annotationHint: string;
82
+ annotationPlaceholder: string;
83
+ signatureAltLabel: string;
84
+ signatureAltByLabel: string;
85
+ signatureNoteIndicatorLabel: string;
86
+ signatureColorLabel: string;
87
+ signatureColorNames: Record<SignatureInkColor, string>;
88
+ removeSignatureLabel: string;
89
+ annotationTitle: string;
90
+ linkedAnnotationTitle: string;
91
+ linkedAnnotationBadge: string;
92
+ openAnnotationLabel: string;
93
+ removeAnnotationLabel: string;
94
+ onPlaceSignature: (placement: SignaturePlacementDraft) => void;
95
+ onPlaceAnnotation: (annotation: AnnotationPlacementDraft) => void;
96
+ onUpdatePlacement: (id: string, patch: PlacementGeometryPatch) => void;
97
+ onUpdateAnnotation: (id: string, patch: AnnotationPatch) => void;
98
+ onRemovePlacement: (id: string) => void;
99
+ onRemoveAnnotation: (id: string) => void;
100
+ onSelectPlacement: (id: string | null) => void;
101
+ onSelectAnnotation: (id: string | null) => void;
102
+ }
10
103
  type PageLayout = "single" | "side-by-side";
11
104
  type DocumentMode = "view" | "edit" | "create";
12
105
  type SupportedFileType = "pdf" | "md" | "docx" | "doc" | "rtf" | "jpeg" | "gif" | "bmp" | "xlsx" | "pptx" | "txt" | "png" | "jpg" | "svg" | "ppt" | "csv" | "xls" | "xml";
106
+ interface LetterheadSectionTemplate {
107
+ logoUrl?: string;
108
+ brandName?: string;
109
+ title?: string;
110
+ subtitle?: string;
111
+ lines?: string[];
112
+ align?: "left" | "center" | "right";
113
+ layout?: "logo-left" | "stacked" | "text-only";
114
+ textColor?: string;
115
+ subtextColor?: string;
116
+ accentColor?: string;
117
+ dividerColor?: string;
118
+ backgroundColor?: string;
119
+ badgeText?: string;
120
+ }
121
+ interface LetterheadTemplate {
122
+ header?: LetterheadSectionTemplate;
123
+ footer?: LetterheadSectionTemplate;
124
+ }
13
125
  interface DocumentViewerSaveMeta {
14
126
  fileName: string;
15
127
  fileType: SupportedFileType;
16
128
  exportedAsPdf?: boolean;
17
- annotations?: unknown;
129
+ annotations?: AnnotationPlacement[];
130
+ signaturePlacements?: SignaturePlacement[];
131
+ signatures?: Signature[];
132
+ signatureList?: Array<{
133
+ placementId: string;
134
+ signatureId?: string;
135
+ signedBy?: string;
136
+ jobTitle?: string;
137
+ dateSigned: string;
138
+ signatureColor?: SignatureInkColor;
139
+ surfaceKind: SignatureSurfaceKind;
140
+ page?: number;
141
+ slide?: number;
142
+ sheetName?: string;
143
+ }>;
18
144
  }
19
145
  interface DocumentViewerProps {
20
146
  fileUrl?: string;
@@ -22,15 +148,26 @@ interface DocumentViewerProps {
22
148
  blob?: Blob;
23
149
  fileName?: string;
24
150
  fileType?: SupportedFileType;
151
+ pdfWorkerSrc?: string;
25
152
  mode?: DocumentMode;
26
153
  allowSigning?: boolean;
154
+ disableSigning?: boolean;
155
+ allowAnnotations?: boolean;
156
+ disableAnnotations?: boolean;
27
157
  defaultLayout?: PageLayout;
158
+ defaultShowThumbnails?: boolean;
28
159
  headerComponent?: React.ReactNode;
29
160
  footerComponent?: React.ReactNode;
161
+ letterheadTemplate?: LetterheadTemplate;
30
162
  enableHeaderFooterToggle?: boolean;
163
+ finalizeSignedDocumentsAsPdf?: boolean;
31
164
  signatures?: Signature[];
165
+ signaturePlacements?: SignaturePlacement[];
166
+ annotations?: AnnotationPlacement[];
32
167
  onSave?: (editedFileAsBase64: string, meta: DocumentViewerSaveMeta) => void;
33
168
  onSignRequest?: () => Promise<Signature>;
169
+ onSignaturePlacementsChange?: (placements: SignaturePlacement[]) => void;
170
+ onAnnotationsChange?: (annotations: AnnotationPlacement[]) => void;
34
171
  onSign?: (signature: Signature) => void;
35
172
  theme?: "light" | "dark";
36
173
  locale?: Record<string, string>;
@@ -38,4 +175,10 @@ interface DocumentViewerProps {
38
175
 
39
176
  declare function DocumentViewer(props: DocumentViewerProps): react_jsx_runtime.JSX.Element;
40
177
 
41
- export { type DocumentMode, DocumentViewer, type DocumentViewerProps, type DocumentViewerSaveMeta, type PageLayout, type Signature, type SupportedFileType };
178
+ /**
179
+ * Default locale strings for the viewer UI.
180
+ * You can override these by passing a `locale` prop to DocumentViewer.
181
+ */
182
+ declare const defaultLocale: Record<string, string>;
183
+
184
+ export { type AnnotationPatch, type AnnotationPlacement, type AnnotationPlacementDraft, type AnnotationSurfaceKind, type DocumentMode, type DocumentSurfaceOverlayState, DocumentViewer, type DocumentViewerProps, type DocumentViewerSaveMeta, type LetterheadSectionTemplate, type LetterheadTemplate, type PageLayout, type PlacementGeometryPatch, type Signature, type SignatureInkColor, type SignaturePlacement, type SignaturePlacementDraft, type SignatureSurfaceKind, type SupportedFileType, defaultLocale };
package/dist/index.d.ts CHANGED
@@ -3,18 +3,144 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  interface Signature {
4
4
  id?: string;
5
5
  signatureImageUrl: string;
6
- signedBy: string;
6
+ signedBy?: string;
7
+ jobTitle?: string;
7
8
  dateSigned: string;
8
9
  comment?: string;
9
10
  }
11
+ type SignatureInkColor = "black" | "blue" | "red" | "green";
12
+ type SignatureSurfaceKind = "document" | "page" | "slide" | "sheet" | "image";
13
+ type AnnotationSurfaceKind = SignatureSurfaceKind;
14
+ interface SignaturePlacement {
15
+ id: string;
16
+ signatureId?: string;
17
+ signature: Signature;
18
+ signatureColor?: SignatureInkColor;
19
+ surfaceKind: SignatureSurfaceKind;
20
+ surfaceKey: string;
21
+ page?: number;
22
+ slide?: number;
23
+ sheetName?: string;
24
+ x: number;
25
+ y: number;
26
+ width: number;
27
+ height: number;
28
+ }
29
+ interface AnnotationPlacement {
30
+ id: string;
31
+ surfaceKind: AnnotationSurfaceKind;
32
+ surfaceKey: string;
33
+ page?: number;
34
+ slide?: number;
35
+ sheetName?: string;
36
+ x: number;
37
+ y: number;
38
+ width: number;
39
+ height: number;
40
+ text: string;
41
+ linkedSignaturePlacementId?: string;
42
+ linkedSignatureId?: string;
43
+ }
44
+ type PlacementGeometryPatch = Partial<Pick<SignaturePlacement, "x" | "y" | "width" | "height" | "signatureColor">>;
45
+ type AnnotationPatch = Partial<Pick<AnnotationPlacement, "x" | "y" | "width" | "height" | "text">>;
46
+ interface SignaturePlacementDraft {
47
+ signature: Signature;
48
+ signatureColor?: SignatureInkColor;
49
+ surfaceKind: SignatureSurfaceKind;
50
+ surfaceKey: string;
51
+ page?: number;
52
+ slide?: number;
53
+ sheetName?: string;
54
+ x: number;
55
+ y: number;
56
+ width: number;
57
+ height: number;
58
+ }
59
+ interface AnnotationPlacementDraft {
60
+ surfaceKind: AnnotationSurfaceKind;
61
+ surfaceKey: string;
62
+ page?: number;
63
+ slide?: number;
64
+ sheetName?: string;
65
+ x: number;
66
+ y: number;
67
+ width: number;
68
+ height: number;
69
+ text: string;
70
+ linkedSignaturePlacementId?: string;
71
+ linkedSignatureId?: string;
72
+ }
73
+ interface DocumentSurfaceOverlayState {
74
+ placements: SignaturePlacement[];
75
+ annotations: AnnotationPlacement[];
76
+ pendingSignature?: Signature | null;
77
+ pendingAnnotation?: boolean;
78
+ activePlacementId?: string | null;
79
+ activeAnnotationId?: string | null;
80
+ placeHint: string;
81
+ annotationHint: string;
82
+ annotationPlaceholder: string;
83
+ signatureAltLabel: string;
84
+ signatureAltByLabel: string;
85
+ signatureNoteIndicatorLabel: string;
86
+ signatureColorLabel: string;
87
+ signatureColorNames: Record<SignatureInkColor, string>;
88
+ removeSignatureLabel: string;
89
+ annotationTitle: string;
90
+ linkedAnnotationTitle: string;
91
+ linkedAnnotationBadge: string;
92
+ openAnnotationLabel: string;
93
+ removeAnnotationLabel: string;
94
+ onPlaceSignature: (placement: SignaturePlacementDraft) => void;
95
+ onPlaceAnnotation: (annotation: AnnotationPlacementDraft) => void;
96
+ onUpdatePlacement: (id: string, patch: PlacementGeometryPatch) => void;
97
+ onUpdateAnnotation: (id: string, patch: AnnotationPatch) => void;
98
+ onRemovePlacement: (id: string) => void;
99
+ onRemoveAnnotation: (id: string) => void;
100
+ onSelectPlacement: (id: string | null) => void;
101
+ onSelectAnnotation: (id: string | null) => void;
102
+ }
10
103
  type PageLayout = "single" | "side-by-side";
11
104
  type DocumentMode = "view" | "edit" | "create";
12
105
  type SupportedFileType = "pdf" | "md" | "docx" | "doc" | "rtf" | "jpeg" | "gif" | "bmp" | "xlsx" | "pptx" | "txt" | "png" | "jpg" | "svg" | "ppt" | "csv" | "xls" | "xml";
106
+ interface LetterheadSectionTemplate {
107
+ logoUrl?: string;
108
+ brandName?: string;
109
+ title?: string;
110
+ subtitle?: string;
111
+ lines?: string[];
112
+ align?: "left" | "center" | "right";
113
+ layout?: "logo-left" | "stacked" | "text-only";
114
+ textColor?: string;
115
+ subtextColor?: string;
116
+ accentColor?: string;
117
+ dividerColor?: string;
118
+ backgroundColor?: string;
119
+ badgeText?: string;
120
+ }
121
+ interface LetterheadTemplate {
122
+ header?: LetterheadSectionTemplate;
123
+ footer?: LetterheadSectionTemplate;
124
+ }
13
125
  interface DocumentViewerSaveMeta {
14
126
  fileName: string;
15
127
  fileType: SupportedFileType;
16
128
  exportedAsPdf?: boolean;
17
- annotations?: unknown;
129
+ annotations?: AnnotationPlacement[];
130
+ signaturePlacements?: SignaturePlacement[];
131
+ signatures?: Signature[];
132
+ signatureList?: Array<{
133
+ placementId: string;
134
+ signatureId?: string;
135
+ signedBy?: string;
136
+ jobTitle?: string;
137
+ dateSigned: string;
138
+ signatureColor?: SignatureInkColor;
139
+ surfaceKind: SignatureSurfaceKind;
140
+ page?: number;
141
+ slide?: number;
142
+ sheetName?: string;
143
+ }>;
18
144
  }
19
145
  interface DocumentViewerProps {
20
146
  fileUrl?: string;
@@ -22,15 +148,26 @@ interface DocumentViewerProps {
22
148
  blob?: Blob;
23
149
  fileName?: string;
24
150
  fileType?: SupportedFileType;
151
+ pdfWorkerSrc?: string;
25
152
  mode?: DocumentMode;
26
153
  allowSigning?: boolean;
154
+ disableSigning?: boolean;
155
+ allowAnnotations?: boolean;
156
+ disableAnnotations?: boolean;
27
157
  defaultLayout?: PageLayout;
158
+ defaultShowThumbnails?: boolean;
28
159
  headerComponent?: React.ReactNode;
29
160
  footerComponent?: React.ReactNode;
161
+ letterheadTemplate?: LetterheadTemplate;
30
162
  enableHeaderFooterToggle?: boolean;
163
+ finalizeSignedDocumentsAsPdf?: boolean;
31
164
  signatures?: Signature[];
165
+ signaturePlacements?: SignaturePlacement[];
166
+ annotations?: AnnotationPlacement[];
32
167
  onSave?: (editedFileAsBase64: string, meta: DocumentViewerSaveMeta) => void;
33
168
  onSignRequest?: () => Promise<Signature>;
169
+ onSignaturePlacementsChange?: (placements: SignaturePlacement[]) => void;
170
+ onAnnotationsChange?: (annotations: AnnotationPlacement[]) => void;
34
171
  onSign?: (signature: Signature) => void;
35
172
  theme?: "light" | "dark";
36
173
  locale?: Record<string, string>;
@@ -38,4 +175,10 @@ interface DocumentViewerProps {
38
175
 
39
176
  declare function DocumentViewer(props: DocumentViewerProps): react_jsx_runtime.JSX.Element;
40
177
 
41
- export { type DocumentMode, DocumentViewer, type DocumentViewerProps, type DocumentViewerSaveMeta, type PageLayout, type Signature, type SupportedFileType };
178
+ /**
179
+ * Default locale strings for the viewer UI.
180
+ * You can override these by passing a `locale` prop to DocumentViewer.
181
+ */
182
+ declare const defaultLocale: Record<string, string>;
183
+
184
+ export { type AnnotationPatch, type AnnotationPlacement, type AnnotationPlacementDraft, type AnnotationSurfaceKind, type DocumentMode, type DocumentSurfaceOverlayState, DocumentViewer, type DocumentViewerProps, type DocumentViewerSaveMeta, type LetterheadSectionTemplate, type LetterheadTemplate, type PageLayout, type PlacementGeometryPatch, type Signature, type SignatureInkColor, type SignaturePlacement, type SignaturePlacementDraft, type SignatureSurfaceKind, type SupportedFileType, defaultLocale };