@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,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Date Validation and Parsing Utility
|
|
3
|
-
* Handles parsing of various date formats and validation
|
|
4
|
-
*/
|
|
5
|
-
export interface DateValidationResult {
|
|
6
|
-
isValid: boolean;
|
|
7
|
-
date: Date | null;
|
|
8
|
-
isoString: string | null;
|
|
9
|
-
originalValue: string;
|
|
10
|
-
error?: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Parse and validate a date string from various formats
|
|
14
|
-
* Attempts to parse common formats: ISO, US, EU, timestamps
|
|
15
|
-
*
|
|
16
|
-
* Format priority:
|
|
17
|
-
* 1. ISO 8601 (YYYY-MM-DD)
|
|
18
|
-
* 2. US format (MM/DD/YYYY) - assumes US format for ambiguous dates
|
|
19
|
-
* 3. EU format (DD/MM/YYYY)
|
|
20
|
-
* 4. Timestamp (numeric string)
|
|
21
|
-
*
|
|
22
|
-
* @param value - The date string to parse
|
|
23
|
-
* @returns Validation result with parsed date or error
|
|
24
|
-
*/
|
|
25
|
-
export declare function parseAndValidateDate(value: string | null | undefined): DateValidationResult;
|
|
26
|
-
/**
|
|
27
|
-
* Validate if a string is a valid ISO date (YYYY-MM-DD)
|
|
28
|
-
*/
|
|
29
|
-
export declare function isValidISODate(value: string | null | undefined): boolean;
|
|
30
|
-
//# sourceMappingURL=date-validation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date-validation.d.ts","sourceRoot":"","sources":["../../src/utils/date-validation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AASD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,oBAAoB,CAoJ3F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAgBxE"}
|
package/dist/utils/errors.d.ts
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom Error Classes
|
|
3
|
-
* Domain-specific error types for better error handling and debugging
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Error thrown when PDF validation fails
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const validation = validatePdfBytes(bytes);
|
|
11
|
-
* if (!validation.valid) {
|
|
12
|
-
* throw new PdfValidationError(validation.error || 'Invalid PDF');
|
|
13
|
-
* }
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export declare class PdfValidationError extends Error {
|
|
17
|
-
readonly details?: unknown | undefined;
|
|
18
|
-
constructor(message: string, details?: unknown | undefined);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Error thrown during PDF processing operations
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```ts
|
|
25
|
-
* try {
|
|
26
|
-
* const pdfDoc = await PDFDocument.load(bytes);
|
|
27
|
-
* } catch (err) {
|
|
28
|
-
* throw new PdfProcessingError('Failed to load PDF document', err);
|
|
29
|
-
* }
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare class PdfProcessingError extends Error {
|
|
33
|
-
readonly details?: unknown | undefined;
|
|
34
|
-
constructor(message: string, details?: unknown | undefined);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Error thrown for form field related issues
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```ts
|
|
41
|
-
* if (!field.value && field.required) {
|
|
42
|
-
* throw new FormFieldError(
|
|
43
|
-
* 'Required field is empty',
|
|
44
|
-
* field.name
|
|
45
|
-
* );
|
|
46
|
-
* }
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
export declare class FormFieldError extends Error {
|
|
50
|
-
readonly fieldName?: string | undefined;
|
|
51
|
-
readonly details?: unknown | undefined;
|
|
52
|
-
constructor(message: string, fieldName?: string | undefined, details?: unknown | undefined);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Error thrown for attachment validation failures
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```ts
|
|
59
|
-
* if (file.size > maxFileSize) {
|
|
60
|
-
* throw new AttachmentValidationError(
|
|
61
|
-
* `File size exceeds limit: ${file.name}`,
|
|
62
|
-
* file.name
|
|
63
|
-
* );
|
|
64
|
-
* }
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
export declare class AttachmentValidationError extends Error {
|
|
68
|
-
readonly fileName?: string | undefined;
|
|
69
|
-
readonly details?: unknown | undefined;
|
|
70
|
-
constructor(message: string, fileName?: string | undefined, details?: unknown | undefined);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Type guard to check if an error is a PdfValidationError
|
|
74
|
-
*/
|
|
75
|
-
export declare function isPdfValidationError(error: unknown): error is PdfValidationError;
|
|
76
|
-
/**
|
|
77
|
-
* Type guard to check if an error is a PdfProcessingError
|
|
78
|
-
*/
|
|
79
|
-
export declare function isPdfProcessingError(error: unknown): error is PdfProcessingError;
|
|
80
|
-
/**
|
|
81
|
-
* Type guard to check if an error is a FormFieldError
|
|
82
|
-
*/
|
|
83
|
-
export declare function isFormFieldError(error: unknown): error is FormFieldError;
|
|
84
|
-
/**
|
|
85
|
-
* Type guard to check if an error is an AttachmentValidationError
|
|
86
|
-
*/
|
|
87
|
-
export declare function isAttachmentValidationError(error: unknown): error is AttachmentValidationError;
|
|
88
|
-
/**
|
|
89
|
-
* Extract error message from unknown error type
|
|
90
|
-
*
|
|
91
|
-
* @param error - The error to extract message from
|
|
92
|
-
* @param defaultMessage - Default message if extraction fails
|
|
93
|
-
* @returns Error message string
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* ```ts
|
|
97
|
-
* try {
|
|
98
|
-
* // ... operation
|
|
99
|
-
* } catch (err) {
|
|
100
|
-
* const message = getErrorMessage(err, 'Operation failed');
|
|
101
|
-
* logger.error(message);
|
|
102
|
-
* }
|
|
103
|
-
* ```
|
|
104
|
-
*/
|
|
105
|
-
export declare function getErrorMessage(error: unknown, defaultMessage?: string): string;
|
|
106
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;aAGzB,OAAO,CAAC,EAAE,OAAO;gBADjC,OAAO,EAAE,MAAM,EACC,OAAO,CAAC,EAAE,OAAO,YAAA;CASpC;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;aAGzB,OAAO,CAAC,EAAE,OAAO;gBADjC,OAAO,EAAE,MAAM,EACC,OAAO,CAAC,EAAE,OAAO,YAAA;CAQpC;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,cAAe,SAAQ,KAAK;aAGrB,SAAS,CAAC,EAAE,MAAM;aAClB,OAAO,CAAC,EAAE,OAAO;gBAFjC,OAAO,EAAE,MAAM,EACC,SAAS,CAAC,EAAE,MAAM,YAAA,EAClB,OAAO,CAAC,EAAE,OAAO,YAAA;CAQpC;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;aAGhC,QAAQ,CAAC,EAAE,MAAM;aACjB,OAAO,CAAC,EAAE,OAAO;gBAFjC,OAAO,EAAE,MAAM,EACC,QAAQ,CAAC,EAAE,MAAM,YAAA,EACjB,OAAO,CAAC,EAAE,OAAO,YAAA;CAQpC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB,CAEhF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB,CAEhF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAExE;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,yBAAyB,CAE9F;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,cAAc,SAAkB,GAAG,MAAM,CAQxF"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PDF Form Field Extraction Utilities
|
|
3
|
-
* Functions for extracting and decoding form fields from PDFs
|
|
4
|
-
*/
|
|
5
|
-
import { EsignFormField, FormFieldType } from '../types';
|
|
6
|
-
/**
|
|
7
|
-
* Extract visible form fields from a PDF document
|
|
8
|
-
* @param pdfBytes - The PDF bytes to extract fields from
|
|
9
|
-
* @param currentSignerEmail - Optional email of the current signer (for multi-signer filtering)
|
|
10
|
-
* @returns Array of extracted form fields
|
|
11
|
-
*/
|
|
12
|
-
export declare function extractVisibleFormFields(pdfBytes: Uint8Array, currentSignerEmail?: string): Promise<EsignFormField[]>;
|
|
13
|
-
/**
|
|
14
|
-
* Decode a field name to extract label, signer email, and placeholder
|
|
15
|
-
* Format: fieldName__LABEL__labelText__SIGNER__email__PLACEHOLDER__placeholderText
|
|
16
|
-
*
|
|
17
|
-
* @deprecated This function is deprecated and kept only for backward compatibility with old PDFs.
|
|
18
|
-
* New PDFs store metadata in the PDF's document information dictionary instead of encoding it in field names.
|
|
19
|
-
* Use getSigniphiMetadata() for new PDFs.
|
|
20
|
-
*/
|
|
21
|
-
export declare function decodeFieldName(fieldName: string): {
|
|
22
|
-
decodedFieldName: string;
|
|
23
|
-
displayLabel: string;
|
|
24
|
-
assignedSignerEmail?: string;
|
|
25
|
-
fieldPlaceholder: string;
|
|
26
|
-
acknowledgements?: Array<{
|
|
27
|
-
id: string;
|
|
28
|
-
title: string;
|
|
29
|
-
description: string;
|
|
30
|
-
}>;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Generate a fallback label from a decoded field name
|
|
34
|
-
*/
|
|
35
|
-
export declare function generateFallbackLabel(decodedFieldName: string, fieldType: FormFieldType): string;
|
|
36
|
-
//# sourceMappingURL=field-extraction.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"field-extraction.d.ts","sourceRoot":"","sources":["../../src/utils/field-extraction.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAwBzD;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,QAAQ,EAAE,UAAU,EACpB,kBAAkB,CAAC,EAAE,MAAM,GAC1B,OAAO,CAAC,cAAc,EAAE,CAAC,CAgN3B;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG;IAClD,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,KAAK,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAC,CAAC,CAAC;CAC5E,CAmFA;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM,CAgChG"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Field Visibility Utilities
|
|
3
|
-
* Core logic for determining which fields are visible/editable in multi-signer mode
|
|
4
|
-
*
|
|
5
|
-
* CRITICAL: This logic must work identically in both flows:
|
|
6
|
-
* - Single-signer flow: isMultiSigner = false, all fields visible
|
|
7
|
-
* - Multi-signer flow: isMultiSigner = true, filtered by assignment rules
|
|
8
|
-
*/
|
|
9
|
-
import type { EsignFormField, MultiSignerContext } from '../types';
|
|
10
|
-
/**
|
|
11
|
-
* Determine if a field should be visible to the current signer
|
|
12
|
-
*
|
|
13
|
-
* Implements the 5-rule visibility logic used throughout the application:
|
|
14
|
-
* - Rule 1: Unassigned fields → only final signer sees them
|
|
15
|
-
* - Rule 2: Direct assignment → show if assigned to current signer
|
|
16
|
-
* - Rule 3: Recipients group → only primary signers (signOrder === 1)
|
|
17
|
-
* - Rule 4: Signers group → only final signer
|
|
18
|
-
* - Rule 5: Assigned to different signer → hide
|
|
19
|
-
*
|
|
20
|
-
* @param field - The form field to check
|
|
21
|
-
* @param multiSignerContext - Multi-signer context with current signer info
|
|
22
|
-
* @returns true if field should be visible, false if hidden
|
|
23
|
-
*
|
|
24
|
-
* @example Single-signer flow
|
|
25
|
-
* ```ts
|
|
26
|
-
* const context = { isMultiSigner: false, ... };
|
|
27
|
-
* isFieldVisibleToSigner(anyField, context); // always returns true
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* @example Multi-signer flow
|
|
31
|
-
* ```ts
|
|
32
|
-
* const context = {
|
|
33
|
-
* isMultiSigner: true,
|
|
34
|
-
* currentSignerEmail: 'signer1@example.com',
|
|
35
|
-
* isPrimarySigner: true,
|
|
36
|
-
* isFinalSigner: false
|
|
37
|
-
* };
|
|
38
|
-
*
|
|
39
|
-
* // Unassigned field - only final signer sees it
|
|
40
|
-
* isFieldVisibleToSigner({ assignedSignerEmail: undefined, ... }, context); // false
|
|
41
|
-
*
|
|
42
|
-
* // Direct assignment to current signer
|
|
43
|
-
* isFieldVisibleToSigner({ assignedSignerEmail: 'signer1@example.com', ... }, context); // true
|
|
44
|
-
*
|
|
45
|
-
* // Recipients group - primary signer sees it
|
|
46
|
-
* isFieldVisibleToSigner({ assignedSignerEmail: 'recipients', ... }, context); // true
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
export declare function isFieldVisibleToSigner(field: EsignFormField, multiSignerContext: MultiSignerContext): boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Filter an array of fields to only those visible to the current signer
|
|
52
|
-
*
|
|
53
|
-
* @param fields - All form fields
|
|
54
|
-
* @param multiSignerContext - Multi-signer context
|
|
55
|
-
* @returns Filtered array of visible fields
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```ts
|
|
59
|
-
* const allFields = [...]; // 10 fields
|
|
60
|
-
* const context = { isMultiSigner: true, isPrimarySigner: true, ... };
|
|
61
|
-
* const visible = filterFieldsBySigner(allFields, context); // 5 fields (only primary signer's)
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
export declare function filterFieldsBySigner(fields: EsignFormField[], multiSignerContext: MultiSignerContext): EsignFormField[];
|
|
65
|
-
/**
|
|
66
|
-
* Determine if a field should be flattened (made non-editable) by the current signer
|
|
67
|
-
*
|
|
68
|
-
* Used during PDF submission to determine which fields to flatten.
|
|
69
|
-
* In multi-signer mode, only flatten fields assigned to current signer.
|
|
70
|
-
* In single-signer mode, flatten all fields.
|
|
71
|
-
*
|
|
72
|
-
* CRITICAL: This affects PDF flattening behavior - must preserve exact logic!
|
|
73
|
-
*
|
|
74
|
-
* @param field - The form field to check
|
|
75
|
-
* @param multiSignerContext - Multi-signer context
|
|
76
|
-
* @returns true if current signer should flatten this field
|
|
77
|
-
*
|
|
78
|
-
* @example Single-signer flow
|
|
79
|
-
* ```ts
|
|
80
|
-
* const context = { isMultiSigner: false, ... };
|
|
81
|
-
* shouldFlattenField(anyField, context); // always returns true
|
|
82
|
-
* ```
|
|
83
|
-
*
|
|
84
|
-
* @example Multi-signer flow
|
|
85
|
-
* ```ts
|
|
86
|
-
* const context = {
|
|
87
|
-
* isMultiSigner: true,
|
|
88
|
-
* currentSignerEmail: 'signer1@example.com',
|
|
89
|
-
* isPrimarySigner: true,
|
|
90
|
-
* isFinalSigner: false
|
|
91
|
-
* };
|
|
92
|
-
*
|
|
93
|
-
* // Current signer's field - flatten it
|
|
94
|
-
* shouldFlattenField({ assignedSignerEmail: 'signer1@example.com', ... }, context); // true
|
|
95
|
-
*
|
|
96
|
-
* // Different signer's field - don't flatten (keep editable for them)
|
|
97
|
-
* shouldFlattenField({ assignedSignerEmail: 'signer2@example.com', ... }, context); // false
|
|
98
|
-
*
|
|
99
|
-
* // Unassigned field - only final signer flattens
|
|
100
|
-
* shouldFlattenField({ assignedSignerEmail: undefined, ... }, context); // false (not final)
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
export declare function shouldFlattenField(field: EsignFormField, multiSignerContext: MultiSignerContext): boolean;
|
|
104
|
-
//# sourceMappingURL=field-visibility.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"field-visibility.d.ts","sourceRoot":"","sources":["../../src/utils/field-visibility.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,cAAc,EACrB,kBAAkB,EAAE,kBAAkB,GACrC,OAAO,CA8BT;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,cAAc,EAAE,EACxB,kBAAkB,EAAE,kBAAkB,GACrC,cAAc,EAAE,CAQlB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,cAAc,EACrB,kBAAkB,EAAE,kBAAkB,GACrC,OAAO,CA8BT"}
|
package/dist/utils/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export * from './pdf-helpers';
|
|
2
|
-
export * from './pdf-metadata';
|
|
3
|
-
export * from './pdf-manipulation';
|
|
4
|
-
export * from './field-extraction';
|
|
5
|
-
export * from './pdfjs-config';
|
|
6
|
-
export * from './pdfjs-version-check';
|
|
7
|
-
export * from './audit-trail';
|
|
8
|
-
export * from './pdf-validators';
|
|
9
|
-
export * from './field-visibility';
|
|
10
|
-
export * from './pdf-widget-helpers';
|
|
11
|
-
export * from './pdf-field-type-helpers';
|
|
12
|
-
export * from './errors';
|
|
13
|
-
export * from './attachment-validators';
|
|
14
|
-
export { logger } from './logger';
|
|
15
|
-
export * from './performance-monitor';
|
|
16
|
-
export * from './date-validation';
|
|
17
|
-
export * from './tracking';
|
|
18
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,UAAU,CAAC;AACzB,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC"}
|
package/dist/utils/logger.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Logger Utility
|
|
3
|
-
* Centralized logging system with environment-based log level control
|
|
4
|
-
*/
|
|
5
|
-
interface Logger {
|
|
6
|
-
debug(message: string, ...args: unknown[]): void;
|
|
7
|
-
info(message: string, ...args: unknown[]): void;
|
|
8
|
-
warn(message: string, ...args: unknown[]): void;
|
|
9
|
-
error(message: string, ...args: unknown[]): void;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Singleton logger instance
|
|
13
|
-
*/
|
|
14
|
-
export declare const logger: Logger;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,UAAU,MAAM;IACd,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACjD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CAClD;AAgDD;;GAEG;AACH,eAAO,MAAM,MAAM,QAAiB,CAAC"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PDF Field Type Helper Utilities
|
|
3
|
-
* Common utilities for detecting field types and extracting values
|
|
4
|
-
*
|
|
5
|
-
* Used across pdf-manipulation.ts for consistent field processing
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* PDF form field type for operations
|
|
9
|
-
*/
|
|
10
|
-
interface PDFFormField {
|
|
11
|
-
getName(): string;
|
|
12
|
-
constructor: {
|
|
13
|
-
name: string;
|
|
14
|
-
};
|
|
15
|
-
getText?(): string;
|
|
16
|
-
setText?(text: string): void;
|
|
17
|
-
isRequired?(): boolean;
|
|
18
|
-
isChecked?(): boolean;
|
|
19
|
-
getSelected?(): string[];
|
|
20
|
-
enableReadOnly?(): void;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Detect the field type from a PDF field
|
|
24
|
-
*
|
|
25
|
-
* Maps pdf-lib's field constructor names to standardized type strings.
|
|
26
|
-
*
|
|
27
|
-
* @param field - The PDF form field
|
|
28
|
-
* @returns Standardized field type string
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```ts
|
|
32
|
-
* const fieldType = detectFieldType(field);
|
|
33
|
-
* // Returns: 'text', 'checkbox', 'dropdown', 'radiogroup', 'signature', etc.
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export declare function detectFieldType(field: PDFFormField): string;
|
|
37
|
-
/**
|
|
38
|
-
* Extract the current value from a PDF field based on its type
|
|
39
|
-
*
|
|
40
|
-
* Handles different field types appropriately:
|
|
41
|
-
* - Text fields: getText()
|
|
42
|
-
* - Checkboxes: isChecked() → 'true'/'false'
|
|
43
|
-
* - Dropdowns: getSelected()[0]
|
|
44
|
-
* - Radio groups: getSelected()[0]
|
|
45
|
-
*
|
|
46
|
-
* @param field - The PDF form field
|
|
47
|
-
* @param fieldType - The field type (from detectFieldType)
|
|
48
|
-
* @returns The field value as a string, or empty string if no value
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```ts
|
|
52
|
-
* const fieldType = detectFieldType(field);
|
|
53
|
-
* const value = extractFieldValue(field, fieldType);
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
export declare function extractFieldValue(field: PDFFormField, fieldType: string): string;
|
|
57
|
-
/**
|
|
58
|
-
* Check if a field is required based on field metadata and name patterns
|
|
59
|
-
*
|
|
60
|
-
* Attempts to determine required status through:
|
|
61
|
-
* 1. field.isRequired() method (if available)
|
|
62
|
-
* 2. Field name patterns (signature, initials, required)
|
|
63
|
-
* 3. Field type (signatures are always required)
|
|
64
|
-
*
|
|
65
|
-
* @param field - The PDF form field
|
|
66
|
-
* @param fieldName - The field name
|
|
67
|
-
* @param fieldType - The field type (from detectFieldType)
|
|
68
|
-
* @returns true if field is required
|
|
69
|
-
*
|
|
70
|
-
* @example
|
|
71
|
-
* ```ts
|
|
72
|
-
* const isRequired = isRequiredField(field, 'signature_1', 'text');
|
|
73
|
-
* // Returns: true (signature fields are required)
|
|
74
|
-
* ```
|
|
75
|
-
*/
|
|
76
|
-
export declare function isRequiredField(field: PDFFormField, fieldName: string, fieldType: string): boolean;
|
|
77
|
-
export {};
|
|
78
|
-
//# sourceMappingURL=pdf-field-type-helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pdf-field-type-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/pdf-field-type-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,UAAU,YAAY;IACpB,OAAO,IAAI,MAAM,CAAC;IAClB,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9B,OAAO,CAAC,IAAI,MAAM,CAAC;IACnB,OAAO,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,CAAC,IAAI,OAAO,CAAC;IACvB,SAAS,CAAC,IAAI,OAAO,CAAC;IACtB,WAAW,CAAC,IAAI,MAAM,EAAE,CAAC;IACzB,cAAc,CAAC,IAAI,IAAI,CAAC;CACzB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAkB3D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAoBhF;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAyBT"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PDF utility helper functions
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Create a blob URL from PDF bytes for preview
|
|
6
|
-
*/
|
|
7
|
-
export declare function createPdfBlobUrl(pdfBytes: Uint8Array): string;
|
|
8
|
-
/**
|
|
9
|
-
* Download PDF file
|
|
10
|
-
*/
|
|
11
|
-
export declare function downloadPdf(pdfBytes: Uint8Array, filename: string): void;
|
|
12
|
-
/**
|
|
13
|
-
* Convert URL to PDF bytes
|
|
14
|
-
* @param url - The URL to fetch the PDF from
|
|
15
|
-
* @returns PDF bytes as Uint8Array
|
|
16
|
-
*/
|
|
17
|
-
export declare function urlToPdfBytes(url: string): Promise<Uint8Array>;
|
|
18
|
-
/**
|
|
19
|
-
* Validate that data is a valid PDF
|
|
20
|
-
*/
|
|
21
|
-
export declare function isValidPdf(pdfBytes: Uint8Array): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Convert base64 data URL to image bytes
|
|
24
|
-
*/
|
|
25
|
-
export declare function dataUrlToBytes(dataUrl: string): Uint8Array;
|
|
26
|
-
/**
|
|
27
|
-
* Format field name for display
|
|
28
|
-
*/
|
|
29
|
-
export declare function formatFieldName(fieldName: string): string;
|
|
30
|
-
/**
|
|
31
|
-
* Check if a field is a signature field
|
|
32
|
-
*/
|
|
33
|
-
export declare function isSignatureField(fieldName: string): boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Check if a field is an initials field
|
|
36
|
-
*/
|
|
37
|
-
export declare function isInitialsField(fieldName: string): boolean;
|
|
38
|
-
//# sourceMappingURL=pdf-helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pdf-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/pdf-helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,CAG7D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAOxE;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAyBpE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,UAAU,GAAG,OAAO,CAGxD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAM1D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAOzD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE1D"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lazy loader for pdf-lib
|
|
3
|
-
*
|
|
4
|
-
* This module provides a lazy loading mechanism for the pdf-lib library (~150KB).
|
|
5
|
-
* By deferring the import until actually needed, we can significantly reduce
|
|
6
|
-
* the initial bundle size for consumers who only view PDFs without filling forms.
|
|
7
|
-
*
|
|
8
|
-
* The pdf-lib library is only loaded when:
|
|
9
|
-
* - fillPdf() is called
|
|
10
|
-
* - combinePdfs() is called
|
|
11
|
-
* - Other PDF manipulation functions are used
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Dynamically import pdf-lib library
|
|
15
|
-
*
|
|
16
|
-
* This function lazily loads pdf-lib only when needed. The import is cached
|
|
17
|
-
* so subsequent calls return the same promise, avoiding multiple imports.
|
|
18
|
-
*
|
|
19
|
-
* @returns Promise resolving to the pdf-lib module
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```typescript
|
|
23
|
-
* const { PDFDocument, rgb, StandardFonts } = await loadPdfLib();
|
|
24
|
-
* const pdfDoc = await PDFDocument.load(pdfBytes);
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare function loadPdfLib(): Promise<typeof import("pdf-lib")>;
|
|
28
|
-
/**
|
|
29
|
-
* Check if pdf-lib has been loaded
|
|
30
|
-
*
|
|
31
|
-
* Useful for debugging and testing to verify lazy loading behavior.
|
|
32
|
-
*
|
|
33
|
-
* @returns true if pdf-lib has been loaded, false otherwise
|
|
34
|
-
*/
|
|
35
|
-
export declare function isPdfLibLoaded(): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Reset the pdf-lib cache (primarily for testing)
|
|
38
|
-
*
|
|
39
|
-
* This should only be used in test environments to reset state
|
|
40
|
-
* between tests.
|
|
41
|
-
*
|
|
42
|
-
* @internal
|
|
43
|
-
*/
|
|
44
|
-
export declare function resetPdfLibCache(): void;
|
|
45
|
-
//# sourceMappingURL=pdf-lib-loader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pdf-lib-loader.d.ts","sourceRoot":"","sources":["../../src/utils/pdf-lib-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH;;;;;;;;;;;;;GAaG;AACH,wBAAsB,UAAU,sCAK/B;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC"}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PDF Manipulation Utilities
|
|
3
|
-
* Core utilities for PDF processing, page manipulation, and file combining
|
|
4
|
-
*/
|
|
5
|
-
import { PdfPage, EsignFormField, FormFieldPosition, MultiSignerContext } from '../types';
|
|
6
|
-
/**
|
|
7
|
-
* Convert PDF pages to images for rendering in the UI using PDF.js
|
|
8
|
-
*/
|
|
9
|
-
export declare function pdfToImages(pdfBytes: Uint8Array, options?: {
|
|
10
|
-
hideFormFields?: boolean;
|
|
11
|
-
}): Promise<PdfPage[]>;
|
|
12
|
-
/**
|
|
13
|
-
* Remove all existing form fields from a PDF using robust widget cleanup
|
|
14
|
-
* @param pdfBytes - The PDF bytes
|
|
15
|
-
* @param stripAllAnnotations - If true, removes all annotations from pages (more aggressive cleanup)
|
|
16
|
-
* @returns The PDF bytes with all form fields removed
|
|
17
|
-
*/
|
|
18
|
-
export declare function removeAllFormFields(pdfBytes: Uint8Array, stripAllAnnotations?: boolean): Promise<Uint8Array>;
|
|
19
|
-
/**
|
|
20
|
-
* Read existing PDF form fields and their properties
|
|
21
|
-
*/
|
|
22
|
-
export declare function readPdfFormFields(pdfBytes: Uint8Array): Promise<{
|
|
23
|
-
name: string;
|
|
24
|
-
type: string;
|
|
25
|
-
required: boolean;
|
|
26
|
-
value?: string;
|
|
27
|
-
}[]>;
|
|
28
|
-
/**
|
|
29
|
-
* Read current PDF form field values (including user-filled data)
|
|
30
|
-
*/
|
|
31
|
-
export declare function readCurrentPdfFormValues(pdfBytes: Uint8Array): Promise<Record<string, string>>;
|
|
32
|
-
/**
|
|
33
|
-
* Validate PDF form fields against provided values
|
|
34
|
-
* In multi-signer mode, only validates fields visible to the current signer
|
|
35
|
-
*/
|
|
36
|
-
export declare function validatePdfFormFields(pdfBytes: Uint8Array, fieldValues: Record<string, string>, signatures: Record<string, string>, extractedFields?: EsignFormField[], // Pass extracted fields to know which are visible
|
|
37
|
-
multiSignerContext?: MultiSignerContext): Promise<string[]>;
|
|
38
|
-
/**
|
|
39
|
-
* Validate PDF form fields against current form state
|
|
40
|
-
*/
|
|
41
|
-
export declare function validateCurrentPdfState(pdfBytes: Uint8Array, signatures: Record<string, string>, formFieldValues?: Record<string, string>): Promise<string[]>;
|
|
42
|
-
/**
|
|
43
|
-
* Fill PDF with signature images and form field values, then flatten the form
|
|
44
|
-
* @param pdfBytes - The PDF bytes
|
|
45
|
-
* @param signatures - The signature data URLs (field name -> base64 PNG)
|
|
46
|
-
* @param formFieldValues - The form field values to fill
|
|
47
|
-
* @returns The filled and flattened PDF bytes
|
|
48
|
-
*/
|
|
49
|
-
export declare function fillPdfWithSignatures(pdfBytes: Uint8Array, signatures: Record<string, string>, formFieldValues?: Record<string, string>, currentSignerEmail?: string, extractedFormFields?: EsignFormField[], metadata?: {
|
|
50
|
-
submissionId?: string;
|
|
51
|
-
documentId?: string;
|
|
52
|
-
author?: string;
|
|
53
|
-
signerEmail?: string;
|
|
54
|
-
signerInitials?: string;
|
|
55
|
-
createdAt?: Date;
|
|
56
|
-
}, auditTrail?: {
|
|
57
|
-
userAgent?: string;
|
|
58
|
-
screenResolution?: string;
|
|
59
|
-
timezone?: string;
|
|
60
|
-
language?: string;
|
|
61
|
-
platform?: string;
|
|
62
|
-
ipAddress?: string;
|
|
63
|
-
geolocation?: {
|
|
64
|
-
latitude: number;
|
|
65
|
-
longitude: number;
|
|
66
|
-
accuracy?: number;
|
|
67
|
-
};
|
|
68
|
-
}, multiSignerContext?: {
|
|
69
|
-
isMultiSigner: boolean;
|
|
70
|
-
currentSigner: any;
|
|
71
|
-
currentSignerEmail: string;
|
|
72
|
-
isPrimarySigner: boolean;
|
|
73
|
-
isFinalSigner: boolean;
|
|
74
|
-
}): Promise<Uint8Array>;
|
|
75
|
-
/**
|
|
76
|
-
* Fill form fields and replace signature/initials with actual signature images
|
|
77
|
-
* This is used when fields are rendered as overlays on the PDF
|
|
78
|
-
* @param pdfBytes - The PDF bytes
|
|
79
|
-
* @param formFields - The form fields with their positions
|
|
80
|
-
* @param fieldValues - The field values to fill
|
|
81
|
-
* @param signatures - The signature images (base64 data URLs)
|
|
82
|
-
* @returns The filled PDF bytes
|
|
83
|
-
*/
|
|
84
|
-
export declare function fillFormFieldsWithSignatures(pdfBytes: Uint8Array, formFields: EsignFormField[], fieldValues: Record<string, string>, signatures: Record<string, string>): Promise<Uint8Array>;
|
|
85
|
-
/**
|
|
86
|
-
* Extract field positions and page numbers from a PDF document
|
|
87
|
-
* Returns maps for field name -> page number and field name -> position
|
|
88
|
-
*/
|
|
89
|
-
export declare function getFieldPageNumbers(pdfBytes: Uint8Array): Promise<{
|
|
90
|
-
pageMap: Record<string, number>;
|
|
91
|
-
positionMap: Record<string, FormFieldPosition>;
|
|
92
|
-
}>;
|
|
93
|
-
//# sourceMappingURL=pdf-manipulation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pdf-manipulation.d.ts","sourceRoot":"","sources":["../../src/utils/pdf-manipulation.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PDF Metadata Utilities
|
|
3
|
-
* Functions for storing and retrieving Signiphi metadata in PDF documents
|
|
4
|
-
*/
|
|
5
|
-
import type { PDFDocument } from 'pdf-lib';
|
|
6
|
-
import { Acknowledgement } from '../types';
|
|
7
|
-
/**
|
|
8
|
-
* Initialize PDF classes from dynamically loaded pdf-lib module
|
|
9
|
-
* Must be called before using getSigniphiMetadata or setSigniphiMetadata
|
|
10
|
-
*/
|
|
11
|
-
export declare function initPdfMetadata(pdfLibModule: any): void;
|
|
12
|
-
/**
|
|
13
|
-
* Metadata for a single form field
|
|
14
|
-
*/
|
|
15
|
-
export interface FieldMetadata {
|
|
16
|
-
fieldId?: string;
|
|
17
|
-
label?: string;
|
|
18
|
-
signer?: string;
|
|
19
|
-
placeholder?: string;
|
|
20
|
-
acknowledgements?: Acknowledgement[];
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Complete metadata structure stored in PDF
|
|
24
|
-
*/
|
|
25
|
-
export interface SigniphiMetadata {
|
|
26
|
-
version: string;
|
|
27
|
-
fields: Record<string, FieldMetadata>;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Stores Signiphi metadata in the PDF's document information dictionary
|
|
31
|
-
* @param pdfDoc - The PDF document to store metadata in
|
|
32
|
-
* @param metadata - The metadata object to store
|
|
33
|
-
*/
|
|
34
|
-
export declare function setSigniphiMetadata(pdfDoc: PDFDocument, metadata: SigniphiMetadata): void;
|
|
35
|
-
/**
|
|
36
|
-
* Retrieves Signiphi metadata from the PDF's document information dictionary
|
|
37
|
-
* @param pdfDoc - The PDF document to read metadata from
|
|
38
|
-
* @returns The metadata object if found, null otherwise
|
|
39
|
-
*/
|
|
40
|
-
export declare function getSigniphiMetadata(pdfDoc: PDFDocument): SigniphiMetadata | null;
|
|
41
|
-
//# sourceMappingURL=pdf-metadata.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pdf-metadata.d.ts","sourceRoot":"","sources":["../../src/utils/pdf-metadata.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAsD,MAAM,SAAS,CAAC;AAC/F,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAM3C;;;GAGG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,GAAG,GAAG,IAAI,CAGvD;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CACvC;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAqBzF;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,GAAG,gBAAgB,GAAG,IAAI,CA2ChF"}
|