@signiphi/page-assembly 0.2.0-beta.18 → 0.2.0-beta.19
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.mts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -302,7 +302,7 @@ declare function normalizePdfEncryption(pdfBytes: Uint8Array): Promise<Uint8Arra
|
|
|
302
302
|
*/
|
|
303
303
|
interface ExtractedField {
|
|
304
304
|
name: string;
|
|
305
|
-
type: 'text' | 'signature' | 'initials' | 'date' | 'checkbox' | 'radio' | 'dropdown' | 'text_label';
|
|
305
|
+
type: 'text' | 'signature' | 'initials' | 'date' | 'date_signed' | 'checkbox' | 'radio' | 'dropdown' | 'text_label';
|
|
306
306
|
page: number;
|
|
307
307
|
x: number;
|
|
308
308
|
y: number;
|
|
@@ -331,6 +331,12 @@ interface ExtractedField {
|
|
|
331
331
|
*/
|
|
332
332
|
interface SigniphiFieldMetadata {
|
|
333
333
|
fieldId?: string;
|
|
334
|
+
/**
|
|
335
|
+
* Persisted field type. Read for one value: `date_signed`, which the name
|
|
336
|
+
* guess can only see as a date. Every other key (`autofillTag`, `dateFormat`,
|
|
337
|
+
* …) is carried through the merge untouched without being declared here.
|
|
338
|
+
*/
|
|
339
|
+
type?: ExtractedField['type'];
|
|
334
340
|
label?: string;
|
|
335
341
|
signer?: string;
|
|
336
342
|
placeholder?: string;
|
|
@@ -449,7 +455,9 @@ declare enum FormFieldType {
|
|
|
449
455
|
CHECKBOX = "checkbox",
|
|
450
456
|
RADIO = "radio",
|
|
451
457
|
DROPDOWN = "dropdown",
|
|
452
|
-
TEXT_LABEL = "text_label"
|
|
458
|
+
TEXT_LABEL = "text_label",
|
|
459
|
+
/** A DATE the signer never edits: stamped at signing. Re-added exactly like DATE. */
|
|
460
|
+
DATE_SIGNED = "date_signed"
|
|
453
461
|
}
|
|
454
462
|
/**
|
|
455
463
|
* Form field position
|
package/dist/index.d.ts
CHANGED
|
@@ -302,7 +302,7 @@ declare function normalizePdfEncryption(pdfBytes: Uint8Array): Promise<Uint8Arra
|
|
|
302
302
|
*/
|
|
303
303
|
interface ExtractedField {
|
|
304
304
|
name: string;
|
|
305
|
-
type: 'text' | 'signature' | 'initials' | 'date' | 'checkbox' | 'radio' | 'dropdown' | 'text_label';
|
|
305
|
+
type: 'text' | 'signature' | 'initials' | 'date' | 'date_signed' | 'checkbox' | 'radio' | 'dropdown' | 'text_label';
|
|
306
306
|
page: number;
|
|
307
307
|
x: number;
|
|
308
308
|
y: number;
|
|
@@ -331,6 +331,12 @@ interface ExtractedField {
|
|
|
331
331
|
*/
|
|
332
332
|
interface SigniphiFieldMetadata {
|
|
333
333
|
fieldId?: string;
|
|
334
|
+
/**
|
|
335
|
+
* Persisted field type. Read for one value: `date_signed`, which the name
|
|
336
|
+
* guess can only see as a date. Every other key (`autofillTag`, `dateFormat`,
|
|
337
|
+
* …) is carried through the merge untouched without being declared here.
|
|
338
|
+
*/
|
|
339
|
+
type?: ExtractedField['type'];
|
|
334
340
|
label?: string;
|
|
335
341
|
signer?: string;
|
|
336
342
|
placeholder?: string;
|
|
@@ -449,7 +455,9 @@ declare enum FormFieldType {
|
|
|
449
455
|
CHECKBOX = "checkbox",
|
|
450
456
|
RADIO = "radio",
|
|
451
457
|
DROPDOWN = "dropdown",
|
|
452
|
-
TEXT_LABEL = "text_label"
|
|
458
|
+
TEXT_LABEL = "text_label",
|
|
459
|
+
/** A DATE the signer never edits: stamped at signing. Re-added exactly like DATE. */
|
|
460
|
+
DATE_SIGNED = "date_signed"
|
|
453
461
|
}
|
|
454
462
|
/**
|
|
455
463
|
* Form field position
|
package/dist/index.js
CHANGED
|
@@ -1631,8 +1631,9 @@ async function extractFieldsFromPdf(pdfBytes) {
|
|
|
1631
1631
|
const extractedField = {
|
|
1632
1632
|
name: baseName,
|
|
1633
1633
|
// Use clean base name without __SIGNER__ encoding (signer stored in signer property)
|
|
1634
|
-
|
|
1635
|
-
//
|
|
1634
|
+
// Uses base name internally. A stored date_signed is a declaration the
|
|
1635
|
+
// name can't express, so it wins.
|
|
1636
|
+
type: fieldMetadata?.type === "date_signed" ? "date_signed" : determineFieldType(fieldName, widgetType),
|
|
1636
1637
|
page: pageNumber,
|
|
1637
1638
|
x: rect.x,
|
|
1638
1639
|
y: pageHeight - rect.y - rect.height,
|
|
@@ -1709,6 +1710,7 @@ var FormFieldType = /* @__PURE__ */ ((FormFieldType2) => {
|
|
|
1709
1710
|
FormFieldType2["RADIO"] = "radio";
|
|
1710
1711
|
FormFieldType2["DROPDOWN"] = "dropdown";
|
|
1711
1712
|
FormFieldType2["TEXT_LABEL"] = "text_label";
|
|
1713
|
+
FormFieldType2["DATE_SIGNED"] = "date_signed";
|
|
1712
1714
|
return FormFieldType2;
|
|
1713
1715
|
})(FormFieldType || {});
|
|
1714
1716
|
function parseEncodedFieldName(encodedName) {
|
|
@@ -1939,7 +1941,10 @@ async function addFormFieldsToPdf(pdfBytes, formFields, options = {}) {
|
|
|
1939
1941
|
}
|
|
1940
1942
|
break;
|
|
1941
1943
|
}
|
|
1942
|
-
|
|
1944
|
+
// DATE_SIGNED is the same widget; its metadata `type` (carried by the
|
|
1945
|
+
// merge, not by this pass) is what tells pdf-signer to stamp it.
|
|
1946
|
+
case "date" /* DATE */:
|
|
1947
|
+
case "date_signed" /* DATE_SIGNED */: {
|
|
1943
1948
|
const baseWithSuffix = field.name.endsWith("_date") ? field.name : `${field.name}_date`;
|
|
1944
1949
|
const finalName = conflictingNames.has(field.name) ? `${baseWithSuffix}_p${field.position.page}` : baseWithSuffix;
|
|
1945
1950
|
const encodedName = encodeFieldNameWithLabelAndSigner(finalName, field.label, field.assignedSignerEmail);
|