@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.mjs CHANGED
@@ -1604,8 +1604,9 @@ async function extractFieldsFromPdf(pdfBytes) {
1604
1604
  const extractedField = {
1605
1605
  name: baseName,
1606
1606
  // Use clean base name without __SIGNER__ encoding (signer stored in signer property)
1607
- type: determineFieldType(fieldName, widgetType),
1608
- // Uses base name internally
1607
+ // Uses base name internally. A stored date_signed is a declaration the
1608
+ // name can't express, so it wins.
1609
+ type: fieldMetadata?.type === "date_signed" ? "date_signed" : determineFieldType(fieldName, widgetType),
1609
1610
  page: pageNumber,
1610
1611
  x: rect.x,
1611
1612
  y: pageHeight - rect.y - rect.height,
@@ -1682,6 +1683,7 @@ var FormFieldType = /* @__PURE__ */ ((FormFieldType2) => {
1682
1683
  FormFieldType2["RADIO"] = "radio";
1683
1684
  FormFieldType2["DROPDOWN"] = "dropdown";
1684
1685
  FormFieldType2["TEXT_LABEL"] = "text_label";
1686
+ FormFieldType2["DATE_SIGNED"] = "date_signed";
1685
1687
  return FormFieldType2;
1686
1688
  })(FormFieldType || {});
1687
1689
  function parseEncodedFieldName(encodedName) {
@@ -1912,7 +1914,10 @@ async function addFormFieldsToPdf(pdfBytes, formFields, options = {}) {
1912
1914
  }
1913
1915
  break;
1914
1916
  }
1915
- case "date" /* DATE */: {
1917
+ // DATE_SIGNED is the same widget; its metadata `type` (carried by the
1918
+ // merge, not by this pass) is what tells pdf-signer to stamp it.
1919
+ case "date" /* DATE */:
1920
+ case "date_signed" /* DATE_SIGNED */: {
1916
1921
  const baseWithSuffix = field.name.endsWith("_date") ? field.name : `${field.name}_date`;
1917
1922
  const finalName = conflictingNames.has(field.name) ? `${baseWithSuffix}_p${field.position.page}` : baseWithSuffix;
1918
1923
  const encodedName = encodeFieldNameWithLabelAndSigner(finalName, field.label, field.assignedSignerEmail);