@signiphi/pdf-signer 0.2.0-beta.2 → 0.2.0-beta.21
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/assets/viewer.html +1 -5
- package/dist/components/index.js +2746 -901
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +2513 -669
- package/dist/components/index.mjs.map +1 -1
- package/dist/core/index.js +420 -20
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +420 -20
- package/dist/core/index.mjs.map +1 -1
- package/dist/hooks/index.js +506 -211
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +507 -212
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.css +214 -191
- package/dist/index.css.map +1 -1
- package/dist/index.js +3019 -893
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2762 -653
- package/dist/index.mjs.map +1 -1
- package/dist/styles/index.css +202 -172
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/utils/index.js +792 -147
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +777 -148
- package/dist/utils/index.mjs.map +1 -1
- package/package.json +2 -2
- package/scripts/copy-utils.js +14 -3
- package/src/styles/index.css +33 -3
- package/dist/__tests__/helpers/fixtures.d.ts +0 -43
- package/dist/__tests__/helpers/fixtures.d.ts.map +0 -1
- package/dist/__tests__/helpers/mocks.d.ts +0 -333
- package/dist/__tests__/helpers/mocks.d.ts.map +0 -1
- package/dist/__tests__/setup.d.ts +0 -6
- package/dist/__tests__/setup.d.ts.map +0 -1
- package/dist/components/AcknowledgementModal.d.ts +0 -21
- package/dist/components/AcknowledgementModal.d.ts.map +0 -1
- package/dist/components/AcknowledgementsSidebar.d.ts +0 -22
- package/dist/components/AcknowledgementsSidebar.d.ts.map +0 -1
- package/dist/components/AttachmentUpload.d.ts +0 -17
- package/dist/components/AttachmentUpload.d.ts.map +0 -1
- package/dist/components/EditableFieldsPanel.d.ts +0 -30
- package/dist/components/EditableFieldsPanel.d.ts.map +0 -1
- package/dist/components/ErrorBoundary.d.ts +0 -67
- package/dist/components/ErrorBoundary.d.ts.map +0 -1
- package/dist/components/FormFieldsView.d.ts +0 -46
- package/dist/components/FormFieldsView.d.ts.map +0 -1
- package/dist/components/InitialsModal.d.ts +0 -16
- package/dist/components/InitialsModal.d.ts.map +0 -1
- package/dist/components/PdfViewerStyled.d.ts +0 -16
- package/dist/components/PdfViewerStyled.d.ts.map +0 -1
- package/dist/components/PoweredBySigniphi.d.ts +0 -11
- package/dist/components/PoweredBySigniphi.d.ts.map +0 -1
- package/dist/components/RequiredFieldNavigation.d.ts +0 -18
- package/dist/components/RequiredFieldNavigation.d.ts.map +0 -1
- package/dist/components/SignatureCanvas.d.ts +0 -12
- package/dist/components/SignatureCanvas.d.ts.map +0 -1
- package/dist/components/SignatureInitialsBox.d.ts +0 -25
- package/dist/components/SignatureInitialsBox.d.ts.map +0 -1
- package/dist/components/SignatureModal.d.ts +0 -21
- package/dist/components/SignatureModal.d.ts.map +0 -1
- package/dist/components/SigningInstructions.d.ts +0 -12
- package/dist/components/SigningInstructions.d.ts.map +0 -1
- package/dist/components/SubmissionForm.d.ts +0 -52
- package/dist/components/SubmissionForm.d.ts.map +0 -1
- package/dist/components/UnacknowledgedFieldsModal.d.ts +0 -23
- package/dist/components/UnacknowledgedFieldsModal.d.ts.map +0 -1
- package/dist/components/ViewToggleToolbar.d.ts +0 -38
- package/dist/components/ViewToggleToolbar.d.ts.map +0 -1
- package/dist/components/form-fields/CheckboxRenderer.d.ts +0 -10
- package/dist/components/form-fields/CheckboxRenderer.d.ts.map +0 -1
- package/dist/components/form-fields/DateFieldRenderer.d.ts +0 -14
- package/dist/components/form-fields/DateFieldRenderer.d.ts.map +0 -1
- package/dist/components/form-fields/DropdownRenderer.d.ts +0 -14
- package/dist/components/form-fields/DropdownRenderer.d.ts.map +0 -1
- package/dist/components/form-fields/FormFieldRenderer.d.ts +0 -22
- package/dist/components/form-fields/FormFieldRenderer.d.ts.map +0 -1
- package/dist/components/form-fields/InitialsFieldRenderer.d.ts +0 -16
- package/dist/components/form-fields/InitialsFieldRenderer.d.ts.map +0 -1
- package/dist/components/form-fields/RadioGroupRenderer.d.ts +0 -10
- package/dist/components/form-fields/RadioGroupRenderer.d.ts.map +0 -1
- package/dist/components/form-fields/SignatureFieldRenderer.d.ts +0 -16
- package/dist/components/form-fields/SignatureFieldRenderer.d.ts.map +0 -1
- package/dist/components/form-fields/TextFieldRenderer.d.ts +0 -14
- package/dist/components/form-fields/TextFieldRenderer.d.ts.map +0 -1
- package/dist/components/form-fields/TextLabelRenderer.d.ts +0 -14
- package/dist/components/form-fields/TextLabelRenderer.d.ts.map +0 -1
- package/dist/components/form-fields/index.d.ts +0 -14
- package/dist/components/form-fields/index.d.ts.map +0 -1
- package/dist/components/index.d.ts +0 -17
- package/dist/components/index.d.ts.map +0 -1
- package/dist/core/PdfViewerCore.d.ts +0 -19
- package/dist/core/PdfViewerCore.d.ts.map +0 -1
- package/dist/core/SignatureCaptureCore.d.ts +0 -37
- package/dist/core/SignatureCaptureCore.d.ts.map +0 -1
- package/dist/core/index.d.ts +0 -3
- package/dist/core/index.d.ts.map +0 -1
- package/dist/hooks/index.d.ts +0 -9
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/useAcknowledgements.d.ts +0 -50
- package/dist/hooks/useAcknowledgements.d.ts.map +0 -1
- package/dist/hooks/useAttachments.d.ts +0 -25
- package/dist/hooks/useAttachments.d.ts.map +0 -1
- package/dist/hooks/useFieldFiltering.d.ts +0 -29
- package/dist/hooks/useFieldFiltering.d.ts.map +0 -1
- package/dist/hooks/useFormFields.d.ts +0 -23
- package/dist/hooks/useFormFields.d.ts.map +0 -1
- package/dist/hooks/useMultiSignerContext.d.ts +0 -25
- package/dist/hooks/useMultiSignerContext.d.ts.map +0 -1
- package/dist/hooks/usePdfViewer.d.ts +0 -52
- package/dist/hooks/usePdfViewer.d.ts.map +0 -1
- package/dist/hooks/useRequiredFieldNavigation.d.ts +0 -16
- package/dist/hooks/useRequiredFieldNavigation.d.ts.map +0 -1
- package/dist/hooks/useSignatureCapture.d.ts +0 -17
- package/dist/hooks/useSignatureCapture.d.ts.map +0 -1
- package/dist/hooks/useSignatures.d.ts +0 -29
- package/dist/hooks/useSignatures.d.ts.map +0 -1
- package/dist/index.d.ts +0 -17
- package/dist/index.d.ts.map +0 -1
- package/dist/integrations/index.d.ts +0 -6
- package/dist/integrations/index.d.ts.map +0 -1
- package/dist/integrations/next-config.d.ts +0 -46
- package/dist/integrations/next-config.d.ts.map +0 -1
- package/dist/integrations/vite-plugin.d.ts +0 -48
- package/dist/integrations/vite-plugin.d.ts.map +0 -1
- package/dist/lib/index.d.ts +0 -3
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/ui/accordion.d.ts +0 -8
- package/dist/lib/ui/accordion.d.ts.map +0 -1
- package/dist/lib/ui/alert.d.ts +0 -9
- package/dist/lib/ui/alert.d.ts.map +0 -1
- package/dist/lib/ui/button.d.ts +0 -12
- package/dist/lib/ui/button.d.ts.map +0 -1
- package/dist/lib/ui/calendar.d.ts +0 -10
- package/dist/lib/ui/calendar.d.ts.map +0 -1
- package/dist/lib/ui/card.d.ts +0 -9
- package/dist/lib/ui/card.d.ts.map +0 -1
- package/dist/lib/ui/checkbox.d.ts +0 -5
- package/dist/lib/ui/checkbox.d.ts.map +0 -1
- package/dist/lib/ui/dialog.d.ts +0 -20
- package/dist/lib/ui/dialog.d.ts.map +0 -1
- package/dist/lib/ui/index.d.ts +0 -13
- package/dist/lib/ui/index.d.ts.map +0 -1
- package/dist/lib/ui/input.d.ts +0 -6
- package/dist/lib/ui/input.d.ts.map +0 -1
- package/dist/lib/ui/label.d.ts +0 -6
- package/dist/lib/ui/label.d.ts.map +0 -1
- package/dist/lib/ui/popover.d.ts +0 -7
- package/dist/lib/ui/popover.d.ts.map +0 -1
- package/dist/lib/ui/radio-group.d.ts +0 -6
- package/dist/lib/ui/radio-group.d.ts.map +0 -1
- package/dist/lib/ui/select.d.ts +0 -14
- package/dist/lib/ui/select.d.ts.map +0 -1
- package/dist/lib/utils.d.ts +0 -7
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -278
- package/dist/types/index.d.ts.map +0 -1
- package/dist/utils/attachment-validators.d.ts +0 -118
- package/dist/utils/attachment-validators.d.ts.map +0 -1
- package/dist/utils/audit-trail.d.ts +0 -27
- package/dist/utils/audit-trail.d.ts.map +0 -1
- package/dist/utils/date-validation.d.ts +0 -30
- package/dist/utils/date-validation.d.ts.map +0 -1
- package/dist/utils/errors.d.ts +0 -106
- package/dist/utils/errors.d.ts.map +0 -1
- package/dist/utils/field-extraction.d.ts +0 -36
- package/dist/utils/field-extraction.d.ts.map +0 -1
- package/dist/utils/field-visibility.d.ts +0 -104
- package/dist/utils/field-visibility.d.ts.map +0 -1
- package/dist/utils/index.d.ts +0 -18
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/logger.d.ts +0 -16
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/pdf-field-type-helpers.d.ts +0 -78
- package/dist/utils/pdf-field-type-helpers.d.ts.map +0 -1
- package/dist/utils/pdf-helpers.d.ts +0 -38
- package/dist/utils/pdf-helpers.d.ts.map +0 -1
- package/dist/utils/pdf-lib-loader.d.ts +0 -45
- package/dist/utils/pdf-lib-loader.d.ts.map +0 -1
- package/dist/utils/pdf-manipulation.d.ts +0 -93
- package/dist/utils/pdf-manipulation.d.ts.map +0 -1
- package/dist/utils/pdf-metadata.d.ts +0 -41
- package/dist/utils/pdf-metadata.d.ts.map +0 -1
- package/dist/utils/pdf-validators.d.ts +0 -149
- package/dist/utils/pdf-validators.d.ts.map +0 -1
- package/dist/utils/pdf-viewer-filter.d.ts +0 -35
- package/dist/utils/pdf-viewer-filter.d.ts.map +0 -1
- package/dist/utils/pdf-widget-helpers.d.ts +0 -98
- package/dist/utils/pdf-widget-helpers.d.ts.map +0 -1
- package/dist/utils/pdfjs-config.d.ts +0 -56
- package/dist/utils/pdfjs-config.d.ts.map +0 -1
- package/dist/utils/pdfjs-version-check.d.ts +0 -28
- package/dist/utils/pdfjs-version-check.d.ts.map +0 -1
- package/dist/utils/performance-monitor.d.ts +0 -172
- package/dist/utils/performance-monitor.d.ts.map +0 -1
- package/dist/utils/tracking.d.ts +0 -89
- package/dist/utils/tracking.d.ts.map +0 -1
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PDF Validation Utilities
|
|
3
|
-
* Common validation functions used across the package
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Validate that bytes represent a valid PDF file
|
|
7
|
-
*
|
|
8
|
-
* Checks for:
|
|
9
|
-
* - Non-empty bytes
|
|
10
|
-
* - Valid PDF header (%PDF-)
|
|
11
|
-
*
|
|
12
|
-
* @param pdfBytes - The PDF bytes to validate
|
|
13
|
-
* @returns Validation result with valid flag and optional error message
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* const result = validatePdfBytes(pdfBytes);
|
|
18
|
-
* if (!result.valid) {
|
|
19
|
-
* console.error(result.error);
|
|
20
|
-
* return;
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export declare function validatePdfBytes(pdfBytes: Uint8Array): {
|
|
25
|
-
valid: boolean;
|
|
26
|
-
error?: string;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Check if a label is auto-generated (not user-typed)
|
|
30
|
-
*
|
|
31
|
-
* Auto-generated labels are simple type names like "Text", "Signature", etc.
|
|
32
|
-
* These are default labels assigned by the form builder and should not be
|
|
33
|
-
* displayed to users in the same way as custom labels.
|
|
34
|
-
*
|
|
35
|
-
* Works identically in both single-signer and multi-signer flows.
|
|
36
|
-
*
|
|
37
|
-
* @param label - The label to check
|
|
38
|
-
* @returns true if the label is auto-generated, false if it's a custom user label
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```ts
|
|
42
|
-
* isAutoGeneratedLabel('Signature') // true
|
|
43
|
-
* isAutoGeneratedLabel('Sign here please') // false
|
|
44
|
-
* isAutoGeneratedLabel('') // true
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export declare function isAutoGeneratedLabel(label: string): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Validate field values object
|
|
50
|
-
*
|
|
51
|
-
* Checks that the values object is properly formatted and contains
|
|
52
|
-
* only string values for field IDs.
|
|
53
|
-
*
|
|
54
|
-
* @param values - Field values to validate
|
|
55
|
-
* @returns Validation result with valid flag and errors array
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```ts
|
|
59
|
-
* const result = validateFieldValues({ field1: 'value1', field2: 'value2' });
|
|
60
|
-
* if (!result.valid) {
|
|
61
|
-
* console.error('Validation errors:', result.errors);
|
|
62
|
-
* }
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
export declare function validateFieldValues(values: unknown): {
|
|
66
|
-
valid: boolean;
|
|
67
|
-
errors: string[];
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Validate signatures object
|
|
71
|
-
*
|
|
72
|
-
* Checks that signatures are properly formatted data URLs.
|
|
73
|
-
*
|
|
74
|
-
* @param signatures - Signatures to validate
|
|
75
|
-
* @returns Validation result with valid flag and errors array
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* ```ts
|
|
79
|
-
* const result = validateSignatures({
|
|
80
|
-
* sig1: 'data:image/png;base64,iVBORw0KG...',
|
|
81
|
-
* sig2: 'data:image/png;base64,iVBORw0KG...'
|
|
82
|
-
* });
|
|
83
|
-
* if (!result.valid) {
|
|
84
|
-
* console.error('Invalid signatures:', result.errors);
|
|
85
|
-
* }
|
|
86
|
-
* ```
|
|
87
|
-
*/
|
|
88
|
-
export declare function validateSignatures(signatures: unknown): {
|
|
89
|
-
valid: boolean;
|
|
90
|
-
errors: string[];
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Validate a form field definition
|
|
94
|
-
*
|
|
95
|
-
* Checks that a field has all required properties and they are valid.
|
|
96
|
-
*
|
|
97
|
-
* @param field - Form field to validate
|
|
98
|
-
* @returns Validation result with valid flag and errors array
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* ```ts
|
|
102
|
-
* const result = validateFormField({
|
|
103
|
-
* id: 'field1',
|
|
104
|
-
* name: 'firstName',
|
|
105
|
-
* type: FormFieldType.TEXT,
|
|
106
|
-
* label: 'First Name',
|
|
107
|
-
* position: { x: 100, y: 200, width: 150, height: 30, page: 1 },
|
|
108
|
-
* required: true
|
|
109
|
-
* });
|
|
110
|
-
* if (!result.valid) {
|
|
111
|
-
* console.error('Field validation errors:', result.errors);
|
|
112
|
-
* }
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
export declare function validateFormField(field: unknown): {
|
|
116
|
-
valid: boolean;
|
|
117
|
-
errors: string[];
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* Validate PDF URL format
|
|
121
|
-
*
|
|
122
|
-
* Accepts absolute URLs, relative paths, and data URLs.
|
|
123
|
-
*
|
|
124
|
-
* @param url - URL to validate
|
|
125
|
-
* @returns Validation result with valid flag and optional error message
|
|
126
|
-
*
|
|
127
|
-
* @example
|
|
128
|
-
* ```ts
|
|
129
|
-
* // Absolute URLs
|
|
130
|
-
* validatePdfUrl('https://example.com/document.pdf'); // valid
|
|
131
|
-
* validatePdfUrl('http://localhost:3000/doc.pdf'); // valid
|
|
132
|
-
*
|
|
133
|
-
* // Relative paths
|
|
134
|
-
* validatePdfUrl('/public/document.pdf'); // valid
|
|
135
|
-
* validatePdfUrl('./document.pdf'); // valid
|
|
136
|
-
*
|
|
137
|
-
* // Data URLs and blobs
|
|
138
|
-
* validatePdfUrl('data:application/pdf;base64,...'); // valid
|
|
139
|
-
* validatePdfUrl('blob:http://localhost/...'); // valid
|
|
140
|
-
*
|
|
141
|
-
* // Local files
|
|
142
|
-
* validatePdfUrl('file:///C:/path/to/file.pdf'); // valid
|
|
143
|
-
* ```
|
|
144
|
-
*/
|
|
145
|
-
export declare function validatePdfUrl(url: unknown): {
|
|
146
|
-
valid: boolean;
|
|
147
|
-
error?: string;
|
|
148
|
-
};
|
|
149
|
-
//# sourceMappingURL=pdf-validators.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pdf-validators.d.ts","sourceRoot":"","sources":["../../src/utils/pdf-validators.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,UAAU,GAAG;IACtD,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAmBA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAe3D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG;IACpD,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAqBA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,OAAO,GAAG;IACvD,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAiCA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG;IACjD,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAuEA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG;IAC5C,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CA6BA"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PDF Viewer Filtering Utility
|
|
3
|
-
* Removes other signers' fields from PDF for viewer display
|
|
4
|
-
* Based on Dockmaster's field removal logic (lines 977-1037)
|
|
5
|
-
*/
|
|
6
|
-
import type { EsignFormField, MultiSignerContext } from '../types';
|
|
7
|
-
/**
|
|
8
|
-
* Filter PDF for current signer by removing other signers' fields
|
|
9
|
-
* This creates a modified PDF for the viewer while preserving the original
|
|
10
|
-
*
|
|
11
|
-
* @param pdfBytes - Original PDF bytes with ALL fields
|
|
12
|
-
* @param allFields - All form fields extracted from the PDF
|
|
13
|
-
* @param multiSignerContext - Multi-signer context
|
|
14
|
-
* @returns Modified PDF bytes with other signers' fields removed (for viewer only)
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```ts
|
|
18
|
-
* const originalPdfBytes = await urlToPdfBytes(pdfUrl);
|
|
19
|
-
* const allFields = await extractFormFields(originalPdfBytes);
|
|
20
|
-
*
|
|
21
|
-
* if (multiSignerContext.isMultiSigner) {
|
|
22
|
-
* // Create filtered PDF for viewer
|
|
23
|
-
* const viewerPdfBytes = await filterPdfForCurrentSigner(
|
|
24
|
-
* originalPdfBytes,
|
|
25
|
-
* allFields,
|
|
26
|
-
* multiSignerContext
|
|
27
|
-
* );
|
|
28
|
-
* loadPdfIntoViewer(viewerPdfBytes);
|
|
29
|
-
*
|
|
30
|
-
* // CRITICAL: Keep originalPdfBytes for submission
|
|
31
|
-
* }
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export declare function filterPdfForCurrentSigner(pdfBytes: Uint8Array, allFields: EsignFormField[], multiSignerContext: MultiSignerContext): Promise<Uint8Array>;
|
|
35
|
-
//# sourceMappingURL=pdf-viewer-filter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pdf-viewer-filter.d.ts","sourceRoot":"","sources":["../../src/utils/pdf-viewer-filter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AA6LnE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,yBAAyB,CAC7C,QAAQ,EAAE,UAAU,EACpB,SAAS,EAAE,cAAc,EAAE,EAC3B,kBAAkB,EAAE,kBAAkB,GACrC,OAAO,CAAC,UAAU,CAAC,CA6GrB"}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PDF Widget Helper Utilities
|
|
3
|
-
* Common utilities for working with PDF widgets and pages
|
|
4
|
-
*
|
|
5
|
-
* Used across pdf-manipulation.ts and pdf-viewer-filter.ts
|
|
6
|
-
*/
|
|
7
|
-
import type { PDFPage } from 'pdf-lib';
|
|
8
|
-
/**
|
|
9
|
-
* Find the page index for a given page reference
|
|
10
|
-
*
|
|
11
|
-
* This is a common pattern used when working with PDF widgets to determine
|
|
12
|
-
* which page a widget belongs to by comparing page references.
|
|
13
|
-
*
|
|
14
|
-
* @param pages - Array of PDF pages
|
|
15
|
-
* @param pageRef - The page reference to search for
|
|
16
|
-
* @returns Page index (0-based), or -1 if not found
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```ts
|
|
20
|
-
* const widget = widgets[0];
|
|
21
|
-
* const pageRef = widget.P?.();
|
|
22
|
-
* const pageIndex = findPageIndexByRef(pages, pageRef);
|
|
23
|
-
* if (pageIndex >= 0) {
|
|
24
|
-
* const page = pages[pageIndex];
|
|
25
|
-
* // Draw on the page
|
|
26
|
-
* }
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export declare function findPageIndexByRef(pages: PDFPage[], pageRef: unknown): number;
|
|
30
|
-
/**
|
|
31
|
-
* Extended type for PDF widgets with rectangle and page methods
|
|
32
|
-
*/
|
|
33
|
-
export interface PDFWidgetWithExtensions {
|
|
34
|
-
getRectangle?: () => {
|
|
35
|
-
x: number;
|
|
36
|
-
y: number;
|
|
37
|
-
width: number;
|
|
38
|
-
height: number;
|
|
39
|
-
} | undefined;
|
|
40
|
-
P?: () => unknown;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Get widget rectangle and its page
|
|
44
|
-
*
|
|
45
|
-
* Helper to extract both the rectangle coordinates and the page that a widget
|
|
46
|
-
* belongs to in a single operation.
|
|
47
|
-
*
|
|
48
|
-
* @param widget - The PDF widget
|
|
49
|
-
* @param pages - Array of PDF pages
|
|
50
|
-
* @returns Object with rect, page, and pageIndex, or null if unable to determine
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```ts
|
|
54
|
-
* for (const widget of widgets) {
|
|
55
|
-
* const result = getWidgetRectangleAndPage(widget, pages);
|
|
56
|
-
* if (result) {
|
|
57
|
-
* const { rect, page, pageIndex } = result;
|
|
58
|
-
* // Draw something at rect coordinates on page
|
|
59
|
-
* page.drawRectangle({ x: rect.x, y: rect.y, ... });
|
|
60
|
-
* }
|
|
61
|
-
* }
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
export declare function getWidgetRectangleAndPage(widget: PDFWidgetWithExtensions, pages: PDFPage[]): {
|
|
65
|
-
rect: {
|
|
66
|
-
x: number;
|
|
67
|
-
y: number;
|
|
68
|
-
width: number;
|
|
69
|
-
height: number;
|
|
70
|
-
};
|
|
71
|
-
page: PDFPage;
|
|
72
|
-
pageIndex: number;
|
|
73
|
-
} | null;
|
|
74
|
-
/**
|
|
75
|
-
* Find page index with fallback to single-page PDFs
|
|
76
|
-
*
|
|
77
|
-
* Same as findPageIndexByRef but with a fallback: if pageRef lookup fails
|
|
78
|
-
* and there's only one page in the document, returns index 0.
|
|
79
|
-
*
|
|
80
|
-
* This is useful for label drawing where single-page PDFs might not have
|
|
81
|
-
* proper page references but we can safely assume page 0.
|
|
82
|
-
*
|
|
83
|
-
* @param pages - Array of PDF pages
|
|
84
|
-
* @param pageRef - The page reference to search for
|
|
85
|
-
* @returns Page index (0-based), 0 if single-page PDF, or -1 if not found
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* ```ts
|
|
89
|
-
* // Used in pdf-viewer-filter for label drawing
|
|
90
|
-
* const pageIndex = findPageIndexWithFallback(pages, pageRef);
|
|
91
|
-
* if (pageIndex >= 0) {
|
|
92
|
-
* const page = pages[pageIndex];
|
|
93
|
-
* page.drawText(label, ...);
|
|
94
|
-
* }
|
|
95
|
-
* ```
|
|
96
|
-
*/
|
|
97
|
-
export declare function findPageIndexWithFallback(pages: PDFPage[], pageRef: unknown): number;
|
|
98
|
-
//# sourceMappingURL=pdf-widget-helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pdf-widget-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/pdf-widget-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAUvC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EAAE,EAChB,OAAO,EAAE,OAAO,GACf,MAAM,CAWR;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,YAAY,CAAC,EAAE,MAAM;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IACzF,CAAC,CAAC,EAAE,MAAM,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,uBAAuB,EAC/B,KAAK,EAAE,OAAO,EAAE,GACf;IACD,IAAI,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9D,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,IAAI,CAcP;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,OAAO,EAAE,EAChB,OAAO,EAAE,OAAO,GACf,MAAM,CAcR"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PDF.js Configuration Provider
|
|
3
|
-
* Manages global configuration for PDF.js worker and viewer paths
|
|
4
|
-
*
|
|
5
|
-
* COMPATIBILITY NOTE: This module is designed to work with both Vite and Next.js/webpack.
|
|
6
|
-
* The worker source URL is computed lazily to avoid issues with webpack's handling of import.meta.
|
|
7
|
-
*/
|
|
8
|
-
import type { PdfJsConfig } from '../types';
|
|
9
|
-
/**
|
|
10
|
-
* CDN paths for PDF.js (exported for manual fallback configuration)
|
|
11
|
-
* Note: CDN URLs may cause CORS issues in some environments
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* // Manually configure CDN (not recommended)
|
|
15
|
-
* setPdfJsConfig({
|
|
16
|
-
* viewerBasePath: CDN_VIEWER,
|
|
17
|
-
* workerSrc: CDN_WORKER
|
|
18
|
-
* });
|
|
19
|
-
*/
|
|
20
|
-
export declare const CDN_WORKER = "https://cdn.jsdelivr.net/npm/pdfjs-dist@5.3.93/build/pdf.worker.mjs";
|
|
21
|
-
export declare const CDN_VIEWER = "https://mozilla.github.io/pdf.js";
|
|
22
|
-
/**
|
|
23
|
-
* Set PDF.js configuration
|
|
24
|
-
* @param config - Partial configuration to merge with defaults
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* // Use self-hosted PDF.js files
|
|
28
|
-
* setPdfJsConfig({ viewerBasePath: '/pdfjs' });
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* // Use custom CDN
|
|
32
|
-
* setPdfJsConfig({
|
|
33
|
-
* viewerBasePath: 'https://my-cdn.com/pdfjs',
|
|
34
|
-
* workerSrc: 'https://my-cdn.com/pdfjs/build/pdf.worker.mjs'
|
|
35
|
-
* });
|
|
36
|
-
*/
|
|
37
|
-
export declare function setPdfJsConfig(config: Partial<PdfJsConfig>): void;
|
|
38
|
-
/**
|
|
39
|
-
* Get current PDF.js configuration
|
|
40
|
-
* @returns Current configuration
|
|
41
|
-
*/
|
|
42
|
-
export declare function getPdfJsConfig(): Required<PdfJsConfig>;
|
|
43
|
-
/**
|
|
44
|
-
* Reset configuration to defaults (local files)
|
|
45
|
-
*/
|
|
46
|
-
export declare function resetPdfJsConfig(): void;
|
|
47
|
-
/**
|
|
48
|
-
* Initialize PDF.js configuration
|
|
49
|
-
* This is called automatically when the first PDF operation is attempted,
|
|
50
|
-
* but can also be called manually to pre-initialize the configuration.
|
|
51
|
-
*
|
|
52
|
-
* Unlike previous versions, this does NOT run at module load time to
|
|
53
|
-
* ensure compatibility with Next.js/webpack environments.
|
|
54
|
-
*/
|
|
55
|
-
export declare function initializePdfJs(): void;
|
|
56
|
-
//# sourceMappingURL=pdfjs-config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pdfjs-config.d.ts","sourceRoot":"","sources":["../../src/utils/pdfjs-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,wEAAwE,CAAC;AAChG,eAAO,MAAM,UAAU,qCAAqC,CAAC;AA4F7D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI,CAmBjE;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,QAAQ,CAAC,WAAW,CAAC,CAItD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAQvC;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAEtC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PDF.js Version Check Utility
|
|
3
|
-
* Detects version mismatches between viewer and worker
|
|
4
|
-
*/
|
|
5
|
-
export interface PdfJsVersionCheckResult {
|
|
6
|
-
viewerExists: boolean;
|
|
7
|
-
versionMatch: boolean;
|
|
8
|
-
viewerVersion?: string;
|
|
9
|
-
workerVersion: string;
|
|
10
|
-
errorMessage?: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Check if PDF.js viewer files exist and versions match
|
|
14
|
-
* @param viewerBasePath - Base path for the viewer (e.g., '/pdfjs')
|
|
15
|
-
* @returns Version check result
|
|
16
|
-
*/
|
|
17
|
-
export declare function checkPdfJsVersion(viewerBasePath?: string): Promise<PdfJsVersionCheckResult>;
|
|
18
|
-
/**
|
|
19
|
-
* Log version check warnings to console
|
|
20
|
-
* @param result - Version check result
|
|
21
|
-
*/
|
|
22
|
-
export declare function logVersionCheckWarning(result: PdfJsVersionCheckResult): void;
|
|
23
|
-
/**
|
|
24
|
-
* Check version and log warnings automatically
|
|
25
|
-
* @param viewerBasePath - Base path for the viewer
|
|
26
|
-
*/
|
|
27
|
-
export declare function checkAndLogPdfJsVersion(viewerBasePath?: string): Promise<PdfJsVersionCheckResult>;
|
|
28
|
-
//# sourceMappingURL=pdfjs-version-check.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pdfjs-version-check.d.ts","sourceRoot":"","sources":["../../src/utils/pdfjs-version-check.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,cAAc,GAAE,MAAiB,GAChC,OAAO,CAAC,uBAAuB,CAAC,CA4ClC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,CAgB5E;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,cAAc,GAAE,MAAiB,GAChC,OAAO,CAAC,uBAAuB,CAAC,CAQlC"}
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Performance Monitoring Utility
|
|
3
|
-
*
|
|
4
|
-
* Provides utilities for tracking and measuring performance metrics
|
|
5
|
-
* in critical operations like PDF loading, form filling, and signature capture.
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* ```typescript
|
|
9
|
-
* const monitor = createPerformanceMonitor();
|
|
10
|
-
* const endTimer = monitor.startTimer('pdf-load');
|
|
11
|
-
* await loadPdf(url);
|
|
12
|
-
* endTimer();
|
|
13
|
-
* const metrics = monitor.getMetrics();
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export interface PerformanceMetric {
|
|
17
|
-
label: string;
|
|
18
|
-
duration: number;
|
|
19
|
-
timestamp: number;
|
|
20
|
-
}
|
|
21
|
-
export interface PerformanceMetrics {
|
|
22
|
-
[label: string]: {
|
|
23
|
-
count: number;
|
|
24
|
-
total: number;
|
|
25
|
-
avg: number;
|
|
26
|
-
min: number;
|
|
27
|
-
max: number;
|
|
28
|
-
last: number;
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Performance Monitor Class
|
|
33
|
-
*
|
|
34
|
-
* Tracks performance metrics for various operations.
|
|
35
|
-
* Maintains history and calculates statistics (avg, min, max).
|
|
36
|
-
*/
|
|
37
|
-
export declare class PerformanceMonitor {
|
|
38
|
-
private metrics;
|
|
39
|
-
private enabled;
|
|
40
|
-
constructor(enabled?: boolean);
|
|
41
|
-
/**
|
|
42
|
-
* Start a timer for a labeled operation
|
|
43
|
-
*
|
|
44
|
-
* @param label - Unique label for the operation
|
|
45
|
-
* @returns Function to call when operation completes
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```typescript
|
|
49
|
-
* const endTimer = monitor.startTimer('pdf-load');
|
|
50
|
-
* await loadPdf(url);
|
|
51
|
-
* endTimer(); // Records duration
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
startTimer(label: string): () => void;
|
|
55
|
-
/**
|
|
56
|
-
* Manually record a performance measurement
|
|
57
|
-
*
|
|
58
|
-
* @param label - Unique label for the operation
|
|
59
|
-
* @param duration - Duration in milliseconds
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```typescript
|
|
63
|
-
* monitor.measure('pdf-load', 1234.56);
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
measure(label: string, duration: number): void;
|
|
67
|
-
/**
|
|
68
|
-
* Get all recorded metrics with statistics
|
|
69
|
-
*
|
|
70
|
-
* @returns Object containing metrics for all labels
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* ```typescript
|
|
74
|
-
* const metrics = monitor.getMetrics();
|
|
75
|
-
* console.log(`PDF load avg: ${metrics['pdf-load'].avg}ms`);
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
getMetrics(): PerformanceMetrics;
|
|
79
|
-
/**
|
|
80
|
-
* Get metrics for a specific label
|
|
81
|
-
*
|
|
82
|
-
* @param label - Label to get metrics for
|
|
83
|
-
* @returns Metrics for the label, or null if not found
|
|
84
|
-
*/
|
|
85
|
-
getMetric(label: string): PerformanceMetrics[string] | null;
|
|
86
|
-
/**
|
|
87
|
-
* Get raw measurements for a label
|
|
88
|
-
*
|
|
89
|
-
* @param label - Label to get measurements for
|
|
90
|
-
* @returns Array of duration measurements in milliseconds
|
|
91
|
-
*/
|
|
92
|
-
getRawMeasurements(label: string): number[];
|
|
93
|
-
/**
|
|
94
|
-
* Clear all metrics
|
|
95
|
-
*/
|
|
96
|
-
clear(): void;
|
|
97
|
-
/**
|
|
98
|
-
* Clear metrics for a specific label
|
|
99
|
-
*
|
|
100
|
-
* @param label - Label to clear metrics for
|
|
101
|
-
*/
|
|
102
|
-
clearLabel(label: string): void;
|
|
103
|
-
/**
|
|
104
|
-
* Enable or disable performance monitoring
|
|
105
|
-
*
|
|
106
|
-
* @param enabled - Whether to enable monitoring
|
|
107
|
-
*/
|
|
108
|
-
setEnabled(enabled: boolean): void;
|
|
109
|
-
/**
|
|
110
|
-
* Check if monitoring is enabled
|
|
111
|
-
*/
|
|
112
|
-
isEnabled(): boolean;
|
|
113
|
-
/**
|
|
114
|
-
* Generate a performance report as a string
|
|
115
|
-
*
|
|
116
|
-
* @returns Formatted performance report
|
|
117
|
-
*/
|
|
118
|
-
generateReport(): string;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Create a new performance monitor instance
|
|
122
|
-
*
|
|
123
|
-
* @param enabled - Whether to enable monitoring (default: true in development)
|
|
124
|
-
* @returns PerformanceMonitor instance
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* ```typescript
|
|
128
|
-
* const monitor = createPerformanceMonitor();
|
|
129
|
-
* ```
|
|
130
|
-
*/
|
|
131
|
-
export declare function createPerformanceMonitor(enabled?: boolean): PerformanceMonitor;
|
|
132
|
-
/**
|
|
133
|
-
* Global performance monitor instance
|
|
134
|
-
* Can be used across the application for centralized monitoring
|
|
135
|
-
*/
|
|
136
|
-
export declare const globalPerformanceMonitor: PerformanceMonitor;
|
|
137
|
-
/**
|
|
138
|
-
* Decorator for measuring function performance
|
|
139
|
-
*
|
|
140
|
-
* @param label - Label for the performance measurement
|
|
141
|
-
* @param monitor - Performance monitor instance (defaults to global)
|
|
142
|
-
* @returns Function decorator
|
|
143
|
-
*
|
|
144
|
-
* @example
|
|
145
|
-
* ```typescript
|
|
146
|
-
* class MyClass {
|
|
147
|
-
* @measurePerformance('my-operation')
|
|
148
|
-
* async myOperation() {
|
|
149
|
-
* // ... operation code ...
|
|
150
|
-
* }
|
|
151
|
-
* }
|
|
152
|
-
* ```
|
|
153
|
-
*/
|
|
154
|
-
export declare function measurePerformance(label: string, monitor?: PerformanceMonitor): (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
155
|
-
/**
|
|
156
|
-
* Higher-order function to wrap async functions with performance monitoring
|
|
157
|
-
*
|
|
158
|
-
* @param label - Label for the performance measurement
|
|
159
|
-
* @param fn - Function to wrap
|
|
160
|
-
* @param monitor - Performance monitor instance (defaults to global)
|
|
161
|
-
* @returns Wrapped function
|
|
162
|
-
*
|
|
163
|
-
* @example
|
|
164
|
-
* ```typescript
|
|
165
|
-
* const loadPdfWithMonitoring = withPerformanceMonitoring(
|
|
166
|
-
* 'pdf-load',
|
|
167
|
-
* loadPdf
|
|
168
|
-
* );
|
|
169
|
-
* ```
|
|
170
|
-
*/
|
|
171
|
-
export declare function withPerformanceMonitoring<T extends (...args: any[]) => Promise<any>>(label: string, fn: T, monitor?: PerformanceMonitor): T;
|
|
172
|
-
//# sourceMappingURL=performance-monitor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"performance-monitor.d.ts","sourceRoot":"","sources":["../../src/utils/performance-monitor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,CAAC,KAAK,EAAE,MAAM,GAAG;QACf,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED;;;;;GAKG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,OAAO,CAAoC;IACnD,OAAO,CAAC,OAAO,CAAU;gBAEb,OAAO,GAAE,OAAc;IAInC;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,IAAI;IAarC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAY9C;;;;;;;;;;OAUG;IACH,UAAU,IAAI,kBAAkB;IAyBhC;;;;;OAKG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,CAAC,MAAM,CAAC,GAAG,IAAI;IAsB3D;;;;;OAKG;IACH,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAI3C;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;;;OAIG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI/B;;;;OAIG;IACH,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAIlC;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;;;OAIG;IACH,cAAc,IAAI,MAAM;CAoBzB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAG9E;AAED;;;GAGG;AACH,eAAO,MAAM,wBAAwB,oBAA6B,CAAC;AAEnE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,kBAA6C,IAGpD,SAAS,GAAG,EACZ,cAAc,MAAM,EACpB,YAAY,kBAAkB,wBAgBjC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,EAClF,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,CAAC,EACL,OAAO,GAAE,kBAA6C,GACrD,CAAC,CASH"}
|
package/dist/utils/tracking.d.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Usage tracking utilities for signiphi API integration.
|
|
3
|
-
* Enables automatic tracking of document sends and signings via API key.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Configuration for the tracking API
|
|
7
|
-
*/
|
|
8
|
-
export interface TrackingConfig {
|
|
9
|
-
/** API key for authentication */
|
|
10
|
-
apiKey: string;
|
|
11
|
-
/** Custom API endpoint (defaults to https://api.signiphi.ai) */
|
|
12
|
-
endpoint?: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Data for tracking a document send event
|
|
16
|
-
*/
|
|
17
|
-
export interface TrackSendData {
|
|
18
|
-
/** Email address of the recipient */
|
|
19
|
-
recipientEmail: string;
|
|
20
|
-
/** Optional document ID for correlation */
|
|
21
|
-
documentId?: string;
|
|
22
|
-
/** Optional idempotency key to prevent duplicate tracking */
|
|
23
|
-
idempotencyKey?: string;
|
|
24
|
-
/** Optional additional metadata */
|
|
25
|
-
metadata?: Record<string, unknown>;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Data for tracking a document signing event
|
|
29
|
-
*/
|
|
30
|
-
export interface TrackSigningData {
|
|
31
|
-
/** Email address of the signer */
|
|
32
|
-
signerEmail: string;
|
|
33
|
-
/** Optional document ID for correlation */
|
|
34
|
-
documentId?: string;
|
|
35
|
-
/** Optional idempotency key to prevent duplicate tracking */
|
|
36
|
-
idempotencyKey?: string;
|
|
37
|
-
/** Optional additional metadata */
|
|
38
|
-
metadata?: Record<string, unknown>;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Response from tracking API
|
|
42
|
-
*/
|
|
43
|
-
export interface TrackingResponse {
|
|
44
|
-
success: boolean;
|
|
45
|
-
eventId: string;
|
|
46
|
-
idempotencyKey: string;
|
|
47
|
-
usage: {
|
|
48
|
-
currentMonth: number;
|
|
49
|
-
limit: number;
|
|
50
|
-
remaining: number;
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Track a document send event.
|
|
55
|
-
* Call this when a document is sent to a recipient for signing.
|
|
56
|
-
*
|
|
57
|
-
* @param config - Tracking configuration with API key
|
|
58
|
-
* @param data - Send event data
|
|
59
|
-
* @returns Tracking response with usage stats
|
|
60
|
-
*/
|
|
61
|
-
export declare function trackDocumentSent(config: TrackingConfig, data: TrackSendData): Promise<TrackingResponse>;
|
|
62
|
-
/**
|
|
63
|
-
* Track a document signing event.
|
|
64
|
-
* Call this when a document is signed by a recipient.
|
|
65
|
-
*
|
|
66
|
-
* @param config - Tracking configuration with API key
|
|
67
|
-
* @param data - Signing event data
|
|
68
|
-
* @returns Tracking response with usage stats
|
|
69
|
-
*/
|
|
70
|
-
export declare function trackDocumentSigned(config: TrackingConfig, data: TrackSigningData): Promise<TrackingResponse>;
|
|
71
|
-
/**
|
|
72
|
-
* Silently track a document signing event (non-blocking).
|
|
73
|
-
* This version catches errors and logs them without throwing.
|
|
74
|
-
* Use this when tracking failure should not affect the main flow.
|
|
75
|
-
*
|
|
76
|
-
* @param config - Tracking configuration with API key
|
|
77
|
-
* @param data - Signing event data
|
|
78
|
-
*/
|
|
79
|
-
export declare function trackDocumentSignedSilent(config: TrackingConfig, data: TrackSigningData): Promise<void>;
|
|
80
|
-
/**
|
|
81
|
-
* Silently track a document send event (non-blocking).
|
|
82
|
-
* This version catches errors and logs them without throwing.
|
|
83
|
-
* Use this when tracking failure should not affect the main flow.
|
|
84
|
-
*
|
|
85
|
-
* @param config - Tracking configuration with API key
|
|
86
|
-
* @param data - Send event data
|
|
87
|
-
*/
|
|
88
|
-
export declare function trackDocumentSentSilent(config: TrackingConfig, data: TrackSendData): Promise<void>;
|
|
89
|
-
//# sourceMappingURL=tracking.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tracking.d.ts","sourceRoot":"","sources":["../../src/utils/tracking.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,qCAAqC;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE;QACL,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAMD;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,gBAAgB,CAAC,CAgC3B;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,gBAAgB,CAAC,CAgC3B;AAED;;;;;;;GAOG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,IAAI,CAAC,CAMf;AAED;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,IAAI,CAAC,CAMf"}
|