@signiphi/pdf-signer 0.2.0-beta.22 → 0.2.0-beta.24

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.
@@ -1561,7 +1561,9 @@ async function extractVisibleFormFields(pdfBytes, currentSignerEmail) {
1561
1561
  placeholder: "Draw or upload your signature",
1562
1562
  assignedSignerEmail: currentSignerEmail
1563
1563
  });
1564
- const shouldCreateInitialsField = hasAnyInitialsFields;
1564
+ const shouldCreateInitialsField = currentSignerEmail ? visibleFields.some(
1565
+ (f) => f.type === "initials" /* INITIALS */ && (!f.assignedSignerEmail || f.assignedSignerEmail === currentSignerEmail || f.assignedSignerEmail === "to-recipients" || f.assignedSignerEmail === "additional-signers")
1566
+ ) : hasAnyInitialsFields;
1565
1567
  if (shouldCreateInitialsField) {
1566
1568
  mainFields.push({
1567
1569
  id: "initials_field_main",
@@ -7567,7 +7569,7 @@ function usePdfViewer(multiSignerContext) {
7567
7569
  isFinalSigner: true
7568
7570
  }
7569
7571
  );
7570
- setViewerPdfBytes(filteredBytes);
7572
+ setViewerPdfBytes(new Uint8Array(filteredBytes));
7571
7573
  const blobUrl = createPdfBlobUrl(filteredBytes);
7572
7574
  await viewerRef.current?.loadPdf(blobUrl);
7573
7575
  } catch (err) {
@@ -7650,7 +7652,7 @@ function usePdfViewer(multiSignerContext) {
7650
7652
  multiSignerContext
7651
7653
  // Pass multi-signer context for partial flattening
7652
7654
  );
7653
- return filledPdfBytes;
7655
+ return new Uint8Array(filledPdfBytes);
7654
7656
  } catch (err) {
7655
7657
  const errorMessage = err instanceof Error ? err.message : "Failed to fill PDF";
7656
7658
  logger.error("Error filling PDF:", err);
@@ -7714,8 +7716,8 @@ function usePdfViewer(multiSignerContext) {
7714
7716
  async (newPdfBytes) => {
7715
7717
  try {
7716
7718
  const blobUrl = createPdfBlobUrl(newPdfBytes);
7717
- setOriginalPdfBytes(newPdfBytes);
7718
- setViewerPdfBytes(newPdfBytes);
7719
+ setOriginalPdfBytes(new Uint8Array(newPdfBytes));
7720
+ setViewerPdfBytes(new Uint8Array(newPdfBytes));
7719
7721
  setPdfUrl(blobUrl);
7720
7722
  await viewerRef.current?.loadPdf(blobUrl);
7721
7723
  } catch (err) {