@verdocs/web-sdk 6.5.0-beta.10 → 6.5.0-beta.11

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.
Files changed (108) hide show
  1. package/dist/cjs/index-CQ5bTnED.js +10 -2
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/{verdocs-field-attachment_13.cjs.entry.js → verdocs-field-attachment_11.cjs.entry.js} +14 -623
  4. package/dist/cjs/verdocs-initial-dialog.cjs.entry.js +229 -0
  5. package/dist/cjs/verdocs-initial-dialog.entry.cjs.js.map +1 -0
  6. package/dist/cjs/verdocs-sign.cjs.entry.js +72 -5
  7. package/dist/cjs/verdocs-sign.entry.cjs.js.map +1 -1
  8. package/dist/cjs/verdocs-signature-dialog.cjs.entry.js +355 -0
  9. package/dist/cjs/verdocs-signature-dialog.entry.cjs.js.map +1 -0
  10. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  11. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +72 -5
  12. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
  13. package/dist/collection/components/fields/verdocs-field-initial/verdocs-field-initial.js +17 -26
  14. package/dist/collection/components/fields/verdocs-field-initial/verdocs-field-initial.js.map +1 -1
  15. package/dist/collection/components/fields/verdocs-field-signature/verdocs-field-signature.js +32 -26
  16. package/dist/collection/components/fields/verdocs-field-signature/verdocs-field-signature.js.map +1 -1
  17. package/dist/components/{p-CYoBhLFP.js → p-B4XIUesD.js} +42 -54
  18. package/dist/components/p-B4XIUesD.js.map +1 -0
  19. package/dist/components/{p-DjOK66Dt.js → p-BoIZ0eWm.js} +43 -55
  20. package/dist/components/p-BoIZ0eWm.js.map +1 -0
  21. package/dist/components/{p-BxnX5zPJ.js → p-BzCNCMTQ.js} +24 -53
  22. package/dist/components/p-BzCNCMTQ.js.map +1 -0
  23. package/dist/components/{p-DKJPJj6P.js → p-CaA92LBj.js} +43 -55
  24. package/dist/components/p-CaA92LBj.js.map +1 -0
  25. package/dist/components/{p-Bygkg9Ho.js → p-DlWkjPea.js} +17 -41
  26. package/dist/components/p-DlWkjPea.js.map +1 -0
  27. package/dist/components/verdocs-build.js +56 -68
  28. package/dist/components/verdocs-build.js.map +1 -1
  29. package/dist/components/verdocs-field-initial.js +1 -1
  30. package/dist/components/verdocs-field-signature.js +1 -1
  31. package/dist/components/verdocs-initial-dialog.js +263 -1
  32. package/dist/components/verdocs-initial-dialog.js.map +1 -1
  33. package/dist/components/verdocs-preview.js +1 -1
  34. package/dist/components/verdocs-sign.js +72 -5
  35. package/dist/components/verdocs-sign.js.map +1 -1
  36. package/dist/components/verdocs-signature-dialog.js +393 -1
  37. package/dist/components/verdocs-signature-dialog.js.map +1 -1
  38. package/dist/components/verdocs-template-document-page.js +1 -1
  39. package/dist/components/verdocs-template-fields.js +1 -1
  40. package/dist/esm/index-BIRwgFLv.js +10 -2
  41. package/dist/esm/loader.js +1 -1
  42. package/dist/esm/{verdocs-field-attachment_13.entry.js → verdocs-field-attachment_11.entry.js} +15 -622
  43. package/dist/{components/p-Daqfz15U.js → esm/verdocs-initial-dialog.entry.js} +8 -49
  44. package/dist/esm/verdocs-initial-dialog.entry.js.map +1 -0
  45. package/dist/esm/verdocs-sign.entry.js +72 -5
  46. package/dist/esm/verdocs-sign.entry.js.map +1 -1
  47. package/dist/{components/p-0L80sqd9.js → esm/verdocs-signature-dialog.entry.js} +8 -53
  48. package/dist/esm/verdocs-signature-dialog.entry.js.map +1 -0
  49. package/dist/esm/verdocs-web-sdk.js +1 -1
  50. package/dist/esm-es5/index-BIRwgFLv.js +1 -1
  51. package/dist/esm-es5/loader.js +1 -1
  52. package/dist/esm-es5/verdocs-field-attachment_11.entry.js +2 -0
  53. package/dist/esm-es5/verdocs-field-attachment_11.entry.js.map +1 -0
  54. package/dist/esm-es5/verdocs-initial-dialog.entry.js +2 -0
  55. package/dist/esm-es5/verdocs-initial-dialog.entry.js.map +1 -0
  56. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  57. package/dist/esm-es5/verdocs-sign.entry.js.map +1 -1
  58. package/dist/esm-es5/verdocs-signature-dialog.entry.js +2 -0
  59. package/dist/esm-es5/verdocs-signature-dialog.entry.js.map +1 -0
  60. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  61. package/dist/types/components/fields/verdocs-field-initial/verdocs-field-initial.d.ts +1 -4
  62. package/dist/types/components/fields/verdocs-field-signature/verdocs-field-signature.d.ts +2 -4
  63. package/dist/types/components.d.ts +10 -8
  64. package/dist/verdocs-web-sdk/p-12422d5d.system.entry.js +2 -0
  65. package/dist/verdocs-web-sdk/p-12422d5d.system.entry.js.map +1 -0
  66. package/dist/verdocs-web-sdk/p-2fb3119a.entry.js +2 -0
  67. package/dist/verdocs-web-sdk/p-2fb3119a.entry.js.map +1 -0
  68. package/dist/verdocs-web-sdk/p-36659fcd.entry.js +2 -0
  69. package/dist/verdocs-web-sdk/p-36659fcd.entry.js.map +1 -0
  70. package/dist/verdocs-web-sdk/p-48d217b4.system.entry.js +2 -0
  71. package/dist/verdocs-web-sdk/p-48d217b4.system.entry.js.map +1 -0
  72. package/dist/verdocs-web-sdk/p-5d720de7.entry.js +2 -0
  73. package/dist/verdocs-web-sdk/p-5d720de7.entry.js.map +1 -0
  74. package/dist/verdocs-web-sdk/p-8052a9b8.system.entry.js +2 -0
  75. package/dist/verdocs-web-sdk/p-8052a9b8.system.entry.js.map +1 -0
  76. package/dist/verdocs-web-sdk/p-B8zpaHu-.system.js +1 -1
  77. package/dist/verdocs-web-sdk/p-BYyqNgjP.system.js.map +1 -0
  78. package/dist/verdocs-web-sdk/p-D2FLn0Fu.system.js.map +1 -0
  79. package/dist/verdocs-web-sdk/p-DQr2_l0b.system.js.map +1 -0
  80. package/dist/verdocs-web-sdk/p-c7243201.system.entry.js +2 -0
  81. package/dist/verdocs-web-sdk/p-c7243201.system.entry.js.map +1 -0
  82. package/dist/verdocs-web-sdk/p-f0c0e64f.entry.js +2 -0
  83. package/dist/verdocs-web-sdk/p-f0c0e64f.entry.js.map +1 -0
  84. package/dist/verdocs-web-sdk/p-u99GfztJ.system.js.map +1 -0
  85. package/dist/verdocs-web-sdk/verdocs-initial-dialog.entry.esm.js.map +1 -0
  86. package/dist/verdocs-web-sdk/verdocs-sign.entry.esm.js.map +1 -1
  87. package/dist/verdocs-web-sdk/verdocs-signature-dialog.entry.esm.js.map +1 -0
  88. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  89. package/package.json +2 -2
  90. package/dist/components/p-0L80sqd9.js.map +0 -1
  91. package/dist/components/p-BxnX5zPJ.js.map +0 -1
  92. package/dist/components/p-Bygkg9Ho.js.map +0 -1
  93. package/dist/components/p-CYoBhLFP.js.map +0 -1
  94. package/dist/components/p-DKJPJj6P.js.map +0 -1
  95. package/dist/components/p-Daqfz15U.js.map +0 -1
  96. package/dist/components/p-DjOK66Dt.js.map +0 -1
  97. package/dist/esm-es5/verdocs-field-attachment_13.entry.js +0 -2
  98. package/dist/esm-es5/verdocs-field-attachment_13.entry.js.map +0 -1
  99. package/dist/verdocs-web-sdk/p-198d3577.entry.js +0 -2
  100. package/dist/verdocs-web-sdk/p-198d3577.entry.js.map +0 -1
  101. package/dist/verdocs-web-sdk/p-25b3c1d6.system.entry.js +0 -2
  102. package/dist/verdocs-web-sdk/p-25b3c1d6.system.entry.js.map +0 -1
  103. package/dist/verdocs-web-sdk/p-644689ce.system.entry.js +0 -2
  104. package/dist/verdocs-web-sdk/p-644689ce.system.entry.js.map +0 -1
  105. package/dist/verdocs-web-sdk/p-71ab2ea9.entry.js +0 -2
  106. package/dist/verdocs-web-sdk/p-71ab2ea9.entry.js.map +0 -1
  107. package/dist/verdocs-web-sdk/p-BBoL1FXa.system.js.map +0 -1
  108. package/dist/verdocs-web-sdk/p-DSPz-5FG.system.js.map +0 -1
@@ -536,7 +536,8 @@ const VerdocsFieldInitial = class {
536
536
  this.tempInitials = '';
537
537
  }
538
538
  async focusField() {
539
- this.handleShow();
539
+ this.el.focus();
540
+ this.focused = true;
540
541
  }
541
542
  componentDidRender() {
542
543
  interact.dynamicDrop(true);
@@ -561,6 +562,9 @@ const VerdocsFieldInitial = class {
561
562
  });
562
563
  }
563
564
  }
565
+ onBlur() {
566
+ this.focused = false;
567
+ }
564
568
  handleResizeStart(e) {
565
569
  e.preventDefault();
566
570
  e.stopPropagation();
@@ -608,28 +612,6 @@ const VerdocsFieldInitial = class {
608
612
  })
609
613
  .catch(e => console.log('Field update failed', e));
610
614
  }
611
- hideDialog() {
612
- var _a;
613
- (_a = this.dialog) === null || _a === void 0 ? void 0 : _a.remove();
614
- this.dialog = null;
615
- this.focused = false;
616
- }
617
- handleAdopt(e) {
618
- var _a;
619
- console.log('[INITIAL] Adopted initials');
620
- this.tempInitials = e.detail;
621
- (_a = this.fieldChange) === null || _a === void 0 ? void 0 : _a.emit(this.tempInitials);
622
- this.hideDialog();
623
- }
624
- handleShow() {
625
- this.dialog = document.createElement('verdocs-initial-dialog');
626
- this.dialog.setAttribute('initials', this.initials);
627
- // this.dialog.setAttribute('roleindex', this.roleindex);
628
- this.dialog.addEventListener('exit', () => this.hideDialog());
629
- this.dialog.addEventListener('next', (e) => this.handleAdopt(e));
630
- document.body.append(this.dialog);
631
- this.focused = true;
632
- }
633
615
  async showSettingsPanel() {
634
616
  const settingsPanel = document.getElementById(`verdocs-settings-panel-${this.fieldname}`);
635
617
  if (settingsPanel && settingsPanel.showPanel) {
@@ -667,7 +649,7 @@ const VerdocsFieldInitial = class {
667
649
  (_a = this.fieldChange) === null || _a === void 0 ? void 0 : _a.emit(this.initialid);
668
650
  }
669
651
  else {
670
- this.handleShow();
652
+ this.adopt.emit();
671
653
  }
672
654
  } }, "Initial")), editable && (h(Fragment, null, h("div", { id: `verdocs-settings-panel-trigger-${fieldname}`, style: { transform: `scale(${Math.floor((1 / xscale) * 1000) / 1000}, ${Math.floor((1 / yscale) * 1000) / 1000})` }, class: "settings-icon", innerHTML: SettingsIcon, onClick: (e) => {
673
655
  e.stopPropagation();
@@ -801,6 +783,7 @@ const VerdocsFieldSignature = class {
801
783
  this.settingsPress = createEvent(this, "settingsPress");
802
784
  this.settingsChanged = createEvent(this, "settingsChanged");
803
785
  this.deleted = createEvent(this, "deleted");
786
+ this.adopt = createEvent(this, "adopt");
804
787
  /**
805
788
  * Fields may be attached to templates or envelopes, but only template fields may be edited.
806
789
  */
@@ -856,7 +839,8 @@ const VerdocsFieldSignature = class {
856
839
  this.tempSignature = '';
857
840
  }
858
841
  async focusField() {
859
- this.handleShow();
842
+ this.el.focus();
843
+ this.focused = true;
860
844
  }
861
845
  componentDidRender() {
862
846
  interact.dynamicDrop(true);
@@ -881,6 +865,9 @@ const VerdocsFieldSignature = class {
881
865
  });
882
866
  }
883
867
  }
868
+ onBlur() {
869
+ this.focused = false;
870
+ }
884
871
  handleResizeStart(e) {
885
872
  e.preventDefault();
886
873
  e.stopPropagation();
@@ -928,28 +915,6 @@ const VerdocsFieldSignature = class {
928
915
  })
929
916
  .catch(e => console.log('Field update failed', e));
930
917
  }
931
- hideDialog() {
932
- var _a;
933
- (_a = this.dialog) === null || _a === void 0 ? void 0 : _a.remove();
934
- this.dialog = null;
935
- this.focused = false;
936
- }
937
- handleAdopt(e) {
938
- var _a;
939
- console.log('[SIGNATURE] Adopted signature');
940
- this.tempSignature = e.detail;
941
- (_a = this.fieldChange) === null || _a === void 0 ? void 0 : _a.emit(this.tempSignature);
942
- this.hideDialog();
943
- }
944
- handleShow() {
945
- this.dialog = document.createElement('verdocs-signature-dialog');
946
- this.dialog.setAttribute('name', this.name);
947
- // this.dialog.setAttribute('roleindex', this.roleindex);
948
- this.dialog.addEventListener('exit', () => this.hideDialog());
949
- this.dialog.addEventListener('next', (e) => this.handleAdopt(e));
950
- document.body.append(this.dialog);
951
- this.focused = true;
952
- }
953
918
  async showSettingsPanel() {
954
919
  const settingsPanel = document.getElementById(`verdocs-settings-panel-${this.fieldname}`);
955
920
  if (settingsPanel && settingsPanel.showPanel) {
@@ -989,7 +954,7 @@ const VerdocsFieldSignature = class {
989
954
  (_a = this.fieldChange) === null || _a === void 0 ? void 0 : _a.emit(this.signatureid);
990
955
  }
991
956
  else {
992
- this.handleShow();
957
+ this.adopt.emit();
993
958
  }
994
959
  } }, "Signature")), editable && (h(Fragment, null, h("div", { id: `verdocs-settings-panel-trigger-${fieldname}`, style: { transform: `scale(${Math.floor((1 / xscale) * 1000) / 1000}, ${Math.floor((1 / yscale) * 1000) / 1000})` }, class: "settings-icon", innerHTML: SettingsIcon, onClick: (e) => {
995
960
  e.stopPropagation();
@@ -1435,578 +1400,6 @@ const VerdocsFieldTimestamp = class {
1435
1400
  };
1436
1401
  VerdocsFieldTimestamp.style = verdocsFieldTimestampCss;
1437
1402
 
1438
- const verdocsInitialDialogCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-initial-dialog{font-family:\"Inter\", \"Barlow\", sans-serif;-webkit-box-sizing:border-box;box-sizing:border-box;position:fixed;z-index:10000;top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background:rgba(0, 0, 0, 0.4980392157)}verdocs-initial-dialog .dialog{width:100%;max-width:340px;border-radius:4px;overflow:hidden;-webkit-box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4);box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4);background:#f9f9f9}verdocs-initial-dialog .heading{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;padding:20px 20px 0 20px;line-height:28px;font-size:20px;font-weight:500}verdocs-initial-dialog .content{font-size:14px;padding:20px}verdocs-initial-dialog .buttons{display:-ms-flexbox;display:flex;margin:20px 0 0 0;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end;-ms-flex-align:center;align-items:center}verdocs-initial-dialog .buttons verdocs-button{margin-left:16px}verdocs-initial-dialog canvas{background:#fff;-webkit-box-sizing:border-box;box-sizing:border-box;margin:0 auto;width:300px;height:79px;max-width:100%;-webkit-box-shadow:0 0 6px 0 rgba(0, 0, 0, 0.1215686275);box-shadow:0 0 6px 0 rgba(0, 0, 0, 0.1215686275)}verdocs-initial-dialog .disclaimer{text-align:justify;padding:8px 0;font-size:11px;line-height:14px;color:rgba(0, 0, 0, 0.54)}verdocs-initial-dialog .as-shown{font-size:11px;margin:4px 0 20px 4px;color:rgba(0, 0, 0, 0.54)}verdocs-initial-dialog .tabs{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-initial-dialog .tabs .tab{padding:8px 15px;cursor:pointer}verdocs-initial-dialog .tabs .tab.active{border-bottom:2px solid #cccccc}verdocs-initial-dialog .tabs .tab:hover{color:#55bc81}";
1439
-
1440
- const VerdocsInitialDialog = class {
1441
- constructor(hostRef) {
1442
- registerInstance(this, hostRef);
1443
- this.next = createEvent(this, "next");
1444
- this.exit = createEvent(this, "exit");
1445
- /**
1446
- * Initial signature text
1447
- */
1448
- this.initials = '';
1449
- this.fontLoaded = false;
1450
- this.enteredInitials = '';
1451
- this.mode = 'type';
1452
- }
1453
- componentWillLoad() {
1454
- this.enteredInitials = this.initials.toUpperCase();
1455
- const ds = new FontFace('Dancing Script', 'url(https://fonts.gstatic.com/s/dancingscript/v19/If2cXTr6YS-zF4S-kcSWSVi_sxjsohD9F50Ruu7BMSo3Sup6hNX6plRP.woff)');
1456
- ds.load().then(font => {
1457
- document.fonts.add(font);
1458
- this.fontLoaded = true;
1459
- });
1460
- }
1461
- componentDidLoad() {
1462
- this.redrawSignature();
1463
- }
1464
- componentDidUpdate() {
1465
- this.redrawSignature();
1466
- }
1467
- redrawSignature() {
1468
- if (!this.canvasElement) {
1469
- return;
1470
- }
1471
- const canvasWidth = this.canvasElement.width;
1472
- const context = this.canvasElement.getContext('2d');
1473
- context.clearRect(0, 0, this.canvasElement.width, this.canvasElement.height);
1474
- let fontSize = 100;
1475
- do {
1476
- fontSize -= 2;
1477
- context.font = `${fontSize}px Dancing Script`;
1478
- } while (context.measureText(this.enteredInitials).width > canvasWidth - 32); // 32px padding each side
1479
- context.textAlign = 'center';
1480
- context.textBaseline = 'middle';
1481
- context.font = `${fontSize}px Dancing Script`;
1482
- context.fillText(this.enteredInitials, this.canvasElement.width / 2, this.canvasElement.height / 2);
1483
- }
1484
- handleNameChange(e) {
1485
- this.enteredInitials = e.target.value;
1486
- }
1487
- handleCancel(e) {
1488
- e.stopPropagation();
1489
- e.preventDefault();
1490
- this.exit.emit();
1491
- }
1492
- handleAdopt(e) {
1493
- e.stopPropagation();
1494
- e.preventDefault();
1495
- const data = this.canvasElement.toDataURL('image/png');
1496
- this.next.emit(data);
1497
- }
1498
- /*
1499
- selColor(hex: string) {
1500
- this.color = hex;
1501
- this.animateDraw();
1502
- }
1503
-
1504
- stopDraw() {
1505
- this.paint = false;
1506
- this.adoptedAndSigned = !this.hasSignature();
1507
- }
1508
-
1509
- draw(e) {
1510
- this.paint = true;
1511
- this.addPoints(e, false);
1512
- this.animateDraw();
1513
- }
1514
-
1515
- recordPoints(e) {
1516
- if (this.paint) {
1517
- this.addPoints(e, true);
1518
- this.animateDraw();
1519
- }
1520
- }
1521
-
1522
- animateDraw() {
1523
- this.canvas.clearRect(0, 0, this.canvas.canvas.offsetWidth, this.canvas.canvas.offsetHeight);
1524
-
1525
- this.canvas.strokeStyle = this.color || '#000000';
1526
- this.canvas.lineJoin = 'round';
1527
- this.canvas.lineWidth = 3;
1528
-
1529
- for (let i = 0; i < this.points.length; i++) {
1530
- this.canvas.beginPath();
1531
- if (this.points[i].drag && i) {
1532
- this.canvas.moveTo(this.points[i - 1].x, this.points[i - 1].y);
1533
- // this.canvas.arc(this.points[i - 1].x, this.points[i - 1].y, 2, 0, 2 * Math.PI, false);
1534
- } else {
1535
- this.canvas.moveTo(this.points[i].x - 1, this.points[i].y);
1536
- // this.canvas.arc(this.points[i].x, this.points[i].y, 2, 0, 2 * Math.PI, false);
1537
- }
1538
-
1539
- this.canvas.lineTo(this.points[i].x, this.points[i].y);
1540
- this.canvas.closePath();
1541
- this.canvas.stroke();
1542
- }
1543
- }
1544
-
1545
- drawCurve(color: string, curve: number) {
1546
- this.canvas.beginPath();
1547
- }
1548
-
1549
-
1550
-
1551
- addPoints(e, drag: boolean) {
1552
- if (window) {
1553
- let x;
1554
- let y;
1555
- e.preventDefault();
1556
- if (e.touches && e.touches.length > 0) {
1557
- x = e.touches[0].clientX;
1558
- } else {
1559
- x = e.clientX;
1560
- }
1561
-
1562
- if (e.touches && e.touches.length > 0) {
1563
- y = e.touches[0].clientY;
1564
- } else {
1565
- y = e.clientY;
1566
- }
1567
- const rect = this.signatureCanvas.nativeElement.getBoundingClientRect();
1568
- this.points.push({
1569
- x: x - rect.left,
1570
- y: y - rect.top,
1571
- drag: drag
1572
- });
1573
- }
1574
- }
1575
-
1576
- clearPad() {
1577
- this.canvas.clearRect(0, 0, this.canvas.canvas.offsetWidth, this.canvas.canvas.offsetHeight);
1578
- this.points = [];
1579
- this.adoptedAndSigned = !this.hasSignature();
1580
- }
1581
-
1582
- async adoptAndSign() {
1583
- try {
1584
- this.adoptedAndSigned = true;
1585
- await this.updateFullName();
1586
- await this.captureSignatureFromCanvas();
1587
- const message = this.signatureMode === 'Signature' ? 'Saving Signature' : 'Saving Initial';
1588
- this.snackbarService.open(message, 'OK', this.snackbarService.initConfig(null, 'bottom'));
1589
- this.handleMode();
1590
- } catch (err) {
1591
- this.snackbarService.open('Failed to apply signature', 'OK', this.snackbarService.initConfig(null, 'bottom'));
1592
- }
1593
- }
1594
-
1595
- handleMode() {
1596
- let currentField;
1597
- switch (this.mode) {
1598
- case 'signerview':
1599
- if (this.signatureMode === 'Signature') {
1600
- this.signatureService.postSignatureBlob().then(result => {
1601
- if (result && result.id && result.url) {
1602
- currentField = this.signatureService.currField;
1603
- this.signatureService.updateSigned(currentField.fName, true);
1604
- this.signatureService.toggleSig(false);
1605
- this.signatureService.setSignatureId(result.id);
1606
- this.signatureService.putSignatureField(this.envelopeId, this.fieldName, result.id).then(res => {
1607
- this.eventTracker.createEvent({
1608
- category: 'verdoc',
1609
- action: 'verdoc signed',
1610
- label: `verdoc id: ${this.envelopeId}`
1611
- })
1612
- if (res && res.settings) {
1613
- this.signatureService.setSignatureData(res.settings.base64);
1614
- this.signatureService.setSignatureId(res.settings.signature_id);
1615
- }
1616
- this.snackbarService.dismiss();
1617
- this.dialog.close({ status: 'saved', temp_sig: res.settings.base64, sig_id: res.settings.signature_id });
1618
- }).catch(err => {
1619
- this.snackbarService.open('Failed to save signature. Please try again.', 'DISMISS', {
1620
- duration: 3000
1621
- });
1622
- this.adoptedAndSigned = false;
1623
- return err;
1624
- });
1625
- }
1626
- });
1627
- } else {
1628
- this.signatureService.postInitialBlob().then(result => {
1629
- if (result && result.id && result.url) {
1630
- currentField = this.signatureService.currField;
1631
- this.signatureService.updateInitialed(currentField.fName, true);
1632
- this.signatureService.setInitialId(result.id);
1633
- this.signatureService.toggleSig(false);
1634
- this.signatureService.putInitialField(this.envelopeId, this.fieldName, result.id).then(res => {
1635
- if (res && res.settings) {
1636
- this.signatureService.setInitialData(res.settings.base64);
1637
- this.signatureService.setInitialId(res.settings.initial_id);
1638
- }
1639
- this.snackbarService.dismiss();
1640
- this.dialog.close({ status: 'saved', temp_int: res.settings.base64, int_id: res.settings.initial_id });
1641
- }).catch(err => {
1642
- this.snackbarService.open('Failed to save initial. Please try again.', 'DISMISS', {
1643
- duration: 3000
1644
- });
1645
- this.adoptedAndSigned = false;
1646
- return err;
1647
- });
1648
- }
1649
- });
1650
- }
1651
- break;
1652
- }
1653
- }
1654
- */
1655
- render() {
1656
- return (h(Host, { key: 'adf8b7f3191850b40c865196d5a435e9d85ef28a', onClick: e => this.handleCancel(e) }, h("div", { key: 'c80e81a5ff5a686cbab68b9ac0fa23dd61d9ee32', class: "dialog" }, h("div", { key: '622d2ebd26b3ac4003add36dc40c9eef54fb95bc', class: "heading" }, "Create Your Initial"), h("div", { key: '8179e48c368a5831b395a01ea6e6dbf19377e3f3', class: "content" }, h("verdocs-text-input", { key: 'c5696ad5ab2fc4a703b596d12029e95dcad099b6', placeholder: "Initials...", label: "Initials", value: this.enteredInitials, onInput: e => this.handleNameChange(e), onClick: e => e.stopPropagation() }), h("div", { key: 'a63b403893d70267d94e4029b72a54e50ccc56ae', class: "as-shown" }, "As shown on driver's license or govt. ID card."), this.fontLoaded ? h("canvas", { ref: el => (this.canvasElement = el) }) : h("div", { style: { display: 'none' } }), h("div", { key: '917afd9ece52ed0716f06d5fb8cc1167644f015d', class: "disclaimer" }, "By clicking Adopt, I agree that the signature will be the electronic representation of my signature for all purposes when I (or my agent) use them on documents, including legally binding contracts \u2014 just the same as a pen-and-paper signature or initial."), h("div", { key: 'b76005f2943578684934f6e5299d1bcf0bb5f705', class: "buttons" }, h("verdocs-button", { key: '5b9a99183f1f31d940a6a22cf4167c84f93d2284', label: "CANCEL", size: "normal", variant: "outline", onClick: e => this.handleCancel(e) }), h("verdocs-button", { key: 'e9dbfe8255870db5ff0b5f2aee3d9a3c1e48b702', label: "Adopt & Sign", size: "normal", onClick: e => this.handleAdopt(e) }))))));
1657
- }
1658
- };
1659
- VerdocsInitialDialog.style = verdocsInitialDialogCss;
1660
-
1661
- const verdocsSignatureDialogCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-signature-dialog{font-family:\"Inter\", \"Barlow\", sans-serif;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-signature-dialog .content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-signature-dialog canvas{background:#ffffff;width:300px;height:79px;max-width:100%;margin:20px auto;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:0 0 6px 0 rgba(0, 0, 0, 0.1215686275);box-shadow:0 0 6px 0 rgba(0, 0, 0, 0.1215686275)}verdocs-signature-dialog .disclaimer{padding:8px 0;font-size:11px;line-height:14px;text-align:justify;color:rgba(0, 0, 0, 0.54)}verdocs-signature-dialog .tabs{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;margin:-20px -20px 0 -20px;border-bottom:1px solid #eeeeee}verdocs-signature-dialog .tabs .tab{-ms-flex:1;flex:1;gap:4px;display:-ms-flexbox;display:flex;cursor:pointer;font-size:12px;font-weight:500;padding:6px 10px;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-signature-dialog .tabs .tab.active{background:#f9f5fe;border-bottom:2px solid #707ae5}verdocs-signature-dialog .tabs .tab:hover{color:#55bc81}verdocs-signature-dialog .tabs .tab .icon{width:16px;height:16px}verdocs-signature-dialog .type{display:none;height:100px;margin-top:20px;-ms-flex-direction:column;flex-direction:column}verdocs-signature-dialog .type.active{display:-ms-flexbox;display:flex}verdocs-signature-dialog .draw{height:100px;display:none;margin-top:20px;-ms-flex-direction:column;flex-direction:column}verdocs-signature-dialog .draw.active{display:-ms-flexbox;display:flex}verdocs-signature-dialog .draw .draw-instructions{font-size:13px;color:rgba(0, 0, 0, 0.6);margin-bottom:8px;text-align:center}verdocs-signature-dialog .draw canvas{cursor:crosshair;-ms-touch-action:none;touch-action:none}verdocs-signature-dialog .draw .draw-actions{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;margin-top:12px}verdocs-signature-dialog .draw .draw-actions .clear-button{border:1px solid #d0d0d0;background-color:#ffffff;color:#333333;padding:6px 16px;font-size:13px;cursor:pointer;border-radius:4px;-webkit-transition:all 0.2s ease;transition:all 0.2s ease}verdocs-signature-dialog .draw .draw-actions .clear-button:hover:not(:disabled){background-color:#f5f5f5;border-color:#b0b0b0}verdocs-signature-dialog .draw .draw-actions .clear-button:disabled{opacity:0.5;cursor:not-allowed}verdocs-signature-dialog .upload{height:100px;display:none;margin-top:20px;-ms-flex-direction:column;flex-direction:column}verdocs-signature-dialog .upload.active{display:-ms-flexbox;display:flex}verdocs-signature-dialog .upload .upload-instructions{font-size:13px;color:rgba(0, 0, 0, 0.6);margin-bottom:8px;text-align:center}verdocs-signature-dialog .upload .upload-actions{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;gap:12px;margin-top:8px}verdocs-signature-dialog .upload .upload-actions .upload-button{border:1px solid #55bc81;background-color:#55bc81;color:#ffffff;padding:8px 20px;font-size:13px;cursor:pointer;border-radius:4px;-webkit-transition:all 0.2s ease;transition:all 0.2s ease}verdocs-signature-dialog .upload .upload-actions .upload-button:hover{background-color:rgb(62.7594936709, 159.2405063291, 103.9746835443);border-color:rgb(62.7594936709, 159.2405063291, 103.9746835443)}verdocs-signature-dialog .upload .upload-actions .clear-button{border:1px solid #d0d0d0;background-color:#ffffff;color:#333333;padding:8px 16px;font-size:13px;cursor:pointer;border-radius:4px;-webkit-transition:all 0.2s ease;transition:all 0.2s ease}verdocs-signature-dialog .upload .upload-actions .clear-button:hover:not(:disabled){background-color:#f5f5f5;border-color:#b0b0b0}verdocs-signature-dialog .upload .upload-actions .clear-button:disabled{opacity:0.5;cursor:not-allowed}verdocs-signature-dialog .upload .upload-filename{font-size:12px;color:rgba(0, 0, 0, 0.6);text-align:center;margin-top:8px;font-style:italic}verdocs-signature-dialog{}verdocs-signature-dialog .buttons{gap:20px;display:-ms-flexbox;display:flex;margin-top:14px;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-signature-dialog .buttons button{-ms-flex:1;flex:1;border:0;height:38px;display:-ms-flexbox;display:flex;color:#ffffff;font-size:14px;cursor:pointer;-ms-flex-align:center;align-items:center;border-radius:6px;-ms-flex-pack:center;justify-content:center}verdocs-signature-dialog .buttons button.cancel{background-color:#654dcb}verdocs-signature-dialog .buttons button.proceed{background-color:#55bc81}verdocs-signature-dialog .buttons button:disabled{background-color:#6c727f}";
1662
-
1663
- const Keyboard = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 8h.01"/><path d="M12 12h.01"/><path d="M14 8h.01"/><path d="M16 12h.01"/><path d="M18 8h.01"/><path d="M6 8h.01"/><path d="M7 16h10"/><path d="M8 12h.01"/><rect width="20" height="16" x="2" y="4" rx="2"/></svg>`;
1664
- const Pencil = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/></svg>`;
1665
- const Upload = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21"/><path d="m14 19.5 3-3 3 3"/><path d="M17 22v-5.5"/><circle cx="9" cy="9" r="2"/></svg>`;
1666
- const VerdocsSignatureDialog = class {
1667
- constructor(hostRef) {
1668
- registerInstance(this, hostRef);
1669
- this.next = createEvent(this, "next");
1670
- this.exit = createEvent(this, "exit");
1671
- /**
1672
- * Initial signature text
1673
- */
1674
- this.name = '';
1675
- this.fontLoaded = false;
1676
- this.enteredName = '';
1677
- this.mode = 'type';
1678
- // Drawing state
1679
- this.isDrawing = false;
1680
- this.hasDrawnSignature = false;
1681
- // Upload state
1682
- this.hasUploadedImage = false;
1683
- this.uploadedFileName = '';
1684
- this.currentStroke = [];
1685
- this.allStrokes = [];
1686
- this.lastPoint = null;
1687
- this.uploadedImage = null;
1688
- this.handlePointerDown = (e) => {
1689
- e.preventDefault();
1690
- if (!this.canvasElement || !this.drawingContext) {
1691
- return;
1692
- }
1693
- this.isDrawing = true;
1694
- this.hasDrawnSignature = true;
1695
- const point = this.getCanvasCoordinates(e);
1696
- this.currentStroke = [point];
1697
- this.lastPoint = point;
1698
- // Start a new path
1699
- this.drawingContext.beginPath();
1700
- this.drawingContext.moveTo(point.x, point.y);
1701
- // Capture pointer to ensure we get all events even if pointer leaves canvas
1702
- this.canvasElement.setPointerCapture(e.pointerId);
1703
- };
1704
- this.handlePointerMove = (e) => {
1705
- e.preventDefault();
1706
- if (!this.isDrawing || !this.drawingContext || !this.lastPoint) {
1707
- return;
1708
- }
1709
- const point = this.getCanvasCoordinates(e);
1710
- this.currentStroke.push(point);
1711
- // Use quadratic curves for smooth drawing
1712
- // The control point is the last point, and we draw to the midpoint
1713
- const midPoint = {
1714
- x: (this.lastPoint.x + point.x) / 2,
1715
- y: (this.lastPoint.y + point.y) / 2,
1716
- };
1717
- this.drawingContext.quadraticCurveTo(this.lastPoint.x, this.lastPoint.y, midPoint.x, midPoint.y);
1718
- this.drawingContext.stroke();
1719
- this.lastPoint = point;
1720
- };
1721
- this.handlePointerUp = (e) => {
1722
- e.preventDefault();
1723
- if (!this.isDrawing || !this.drawingContext) {
1724
- return;
1725
- }
1726
- // Complete the stroke
1727
- if (this.lastPoint && this.currentStroke.length > 0) {
1728
- this.drawingContext.lineTo(this.lastPoint.x, this.lastPoint.y);
1729
- this.drawingContext.stroke();
1730
- }
1731
- // Save the completed stroke
1732
- if (this.currentStroke.length > 0) {
1733
- this.allStrokes.push([...this.currentStroke]);
1734
- }
1735
- this.isDrawing = false;
1736
- this.currentStroke = [];
1737
- this.lastPoint = null;
1738
- // Release pointer capture
1739
- if (this.canvasElement) {
1740
- this.canvasElement.releasePointerCapture(e.pointerId);
1741
- }
1742
- };
1743
- this.handlePointerCancel = (e) => {
1744
- // Handle cases where drawing is interrupted (e.g., phone call, notification)
1745
- this.isDrawing = false;
1746
- this.currentStroke = [];
1747
- this.lastPoint = null;
1748
- if (this.canvasElement) {
1749
- this.canvasElement.releasePointerCapture(e.pointerId);
1750
- }
1751
- };
1752
- this.handleSelectFile = (e) => {
1753
- var _a;
1754
- e.stopPropagation();
1755
- e.preventDefault();
1756
- (_a = this.fileInputElement) === null || _a === void 0 ? void 0 : _a.click();
1757
- };
1758
- this.handleFileChange = (e) => {
1759
- var _a;
1760
- const input = e.target;
1761
- const file = (_a = input.files) === null || _a === void 0 ? void 0 : _a[0];
1762
- if (!file) {
1763
- return;
1764
- }
1765
- // Validate file type
1766
- if (!file.type.startsWith('image/png')) {
1767
- alert('Please select a PNG image file.');
1768
- input.value = '';
1769
- return;
1770
- }
1771
- // Load and display the image
1772
- const reader = new FileReader();
1773
- reader.onload = (event) => {
1774
- var _a;
1775
- const img = new Image();
1776
- img.onload = () => {
1777
- this.uploadedImage = img;
1778
- this.uploadedFileName = file.name;
1779
- this.hasUploadedImage = true;
1780
- this.drawUploadedImage();
1781
- };
1782
- img.onerror = () => {
1783
- alert('Failed to load image. Please try a different file.');
1784
- input.value = '';
1785
- };
1786
- img.src = (_a = event.target) === null || _a === void 0 ? void 0 : _a.result;
1787
- };
1788
- reader.onerror = () => {
1789
- alert('Failed to read file. Please try again.');
1790
- input.value = '';
1791
- };
1792
- reader.readAsDataURL(file);
1793
- };
1794
- this.handleClearUpload = (e) => {
1795
- e.stopPropagation();
1796
- e.preventDefault();
1797
- this.uploadedImage = null;
1798
- this.uploadedFileName = '';
1799
- this.hasUploadedImage = false;
1800
- // Clear the file input
1801
- if (this.fileInputElement) {
1802
- this.fileInputElement.value = '';
1803
- }
1804
- // Clear the canvas
1805
- if (this.canvasElement) {
1806
- const ctx = this.canvasElement.getContext('2d');
1807
- if (ctx) {
1808
- ctx.clearRect(0, 0, this.canvasElement.width, this.canvasElement.height);
1809
- }
1810
- }
1811
- };
1812
- }
1813
- componentWillLoad() {
1814
- this.enteredName = this.name;
1815
- const ds = new FontFace('Dancing Script', 'url(https://fonts.gstatic.com/s/dancingscript/v19/If2cXTr6YS-zF4S-kcSWSVi_sxjsohD9F50Ruu7BMSo3Sup6hNX6plRP.woff)');
1816
- ds.load().then(font => {
1817
- document.fonts.add(font);
1818
- this.fontLoaded = true;
1819
- });
1820
- }
1821
- componentDidLoad() {
1822
- this.redrawSignature();
1823
- this.setupDrawingCanvas();
1824
- }
1825
- componentDidUpdate() {
1826
- this.redrawSignature();
1827
- this.setupDrawingCanvas();
1828
- // Redraw uploaded image when in upload mode
1829
- if (this.mode === 'upload' && this.hasUploadedImage) {
1830
- this.drawUploadedImage();
1831
- }
1832
- // Redraw drawn signature when in draw mode
1833
- if (this.mode === 'draw' && this.allStrokes.length > 0) {
1834
- this.redrawDrawnSignature();
1835
- }
1836
- }
1837
- redrawSignature() {
1838
- if (!this.canvasElement || this.mode !== 'type') {
1839
- return;
1840
- }
1841
- const canvasWidth = this.canvasElement.width;
1842
- const context = this.canvasElement.getContext('2d');
1843
- context.clearRect(0, 0, this.canvasElement.width, this.canvasElement.height);
1844
- let fontSize = 100;
1845
- do {
1846
- fontSize -= 2;
1847
- context.font = `${fontSize}px Dancing Script`;
1848
- } while (context.measureText(this.enteredName).width > canvasWidth - 32); // 32px padding each side
1849
- context.textAlign = 'center';
1850
- context.textBaseline = 'middle';
1851
- context.font = `${fontSize}px Dancing Script`;
1852
- context.fillText(this.enteredName, this.canvasElement.width / 2, this.canvasElement.height / 2);
1853
- }
1854
- redrawDrawnSignature() {
1855
- if (!this.canvasElement || !this.drawingContext || this.allStrokes.length === 0) {
1856
- return;
1857
- }
1858
- // Clear the canvas first
1859
- this.drawingContext.clearRect(0, 0, this.canvasElement.width, this.canvasElement.height);
1860
- // Redraw all strokes
1861
- for (const stroke of this.allStrokes) {
1862
- if (stroke.length === 0) {
1863
- continue;
1864
- }
1865
- // Start the path at the first point
1866
- this.drawingContext.beginPath();
1867
- this.drawingContext.moveTo(stroke[0].x, stroke[0].y);
1868
- // Draw smooth curves through all points in the stroke
1869
- for (let i = 1; i < stroke.length; i++) {
1870
- const currentPoint = stroke[i];
1871
- const previousPoint = stroke[i - 1];
1872
- // Use quadratic curves for smooth lines
1873
- const midPoint = {
1874
- x: (previousPoint.x + currentPoint.x) / 2,
1875
- y: (previousPoint.y + currentPoint.y) / 2,
1876
- };
1877
- this.drawingContext.quadraticCurveTo(previousPoint.x, previousPoint.y, midPoint.x, midPoint.y);
1878
- }
1879
- // Draw to the last point
1880
- if (stroke.length > 1) {
1881
- const lastPoint = stroke[stroke.length - 1];
1882
- this.drawingContext.lineTo(lastPoint.x, lastPoint.y);
1883
- }
1884
- this.drawingContext.stroke();
1885
- }
1886
- }
1887
- handleNameChange(e) {
1888
- this.enteredName = e.target.value;
1889
- }
1890
- handleCancel(e) {
1891
- e.stopPropagation();
1892
- e.preventDefault();
1893
- this.exit.emit();
1894
- }
1895
- handleAdopt(e) {
1896
- e.stopPropagation();
1897
- e.preventDefault();
1898
- const data = this.canvasElement.toDataURL('image/png');
1899
- this.next.emit(data);
1900
- }
1901
- isAdoptButtonDisabled() {
1902
- switch (this.mode) {
1903
- case 'type':
1904
- // Disable if no name has been entered
1905
- return !this.enteredName || this.enteredName.trim().length === 0;
1906
- case 'draw':
1907
- // Disable if nothing has been drawn
1908
- return !this.hasDrawnSignature || this.allStrokes.length === 0;
1909
- case 'upload':
1910
- // Disable if no file has been uploaded
1911
- return !this.hasUploadedImage;
1912
- default:
1913
- return true;
1914
- }
1915
- }
1916
- setupDrawingCanvas() {
1917
- if (!this.canvasElement) {
1918
- return;
1919
- }
1920
- // Set up drawing context when in draw mode
1921
- if (this.mode === 'draw') {
1922
- // Always get fresh context from the current canvas element
1923
- const ctx = this.canvasElement.getContext('2d');
1924
- // Only initialize if we don't have a context or it's different
1925
- if (ctx && ctx !== this.drawingContext) {
1926
- this.drawingContext = ctx;
1927
- // Configure drawing style for smooth signatures
1928
- this.drawingContext.strokeStyle = '#000000';
1929
- this.drawingContext.lineWidth = 2;
1930
- this.drawingContext.lineCap = 'round';
1931
- this.drawingContext.lineJoin = 'round';
1932
- // Clear canvas only if there are no existing strokes
1933
- if (this.allStrokes.length === 0) {
1934
- this.drawingContext.clearRect(0, 0, this.canvasElement.width, this.canvasElement.height);
1935
- }
1936
- }
1937
- }
1938
- // Reset drawing context when switching away from draw mode
1939
- // NOTE: We don't clear allStrokes here so drawing persists when returning to draw mode
1940
- if (this.mode !== 'draw' && this.drawingContext) {
1941
- this.drawingContext = null;
1942
- this.currentStroke = [];
1943
- this.lastPoint = null;
1944
- }
1945
- }
1946
- clearDrawingCanvas() {
1947
- if (!this.canvasElement || !this.drawingContext) {
1948
- return;
1949
- }
1950
- this.drawingContext.clearRect(0, 0, this.canvasElement.width, this.canvasElement.height);
1951
- this.currentStroke = [];
1952
- this.allStrokes = [];
1953
- this.lastPoint = null;
1954
- this.hasDrawnSignature = false;
1955
- }
1956
- handleClearDrawing(e) {
1957
- e.stopPropagation();
1958
- e.preventDefault();
1959
- this.clearDrawingCanvas();
1960
- }
1961
- getCanvasCoordinates(e) {
1962
- if (!this.canvasElement) {
1963
- return { x: 0, y: 0 };
1964
- }
1965
- const rect = this.canvasElement.getBoundingClientRect();
1966
- // Calculate the scale factor between canvas size and display size
1967
- const scaleX = this.canvasElement.width / rect.width;
1968
- const scaleY = this.canvasElement.height / rect.height;
1969
- return {
1970
- x: (e.clientX - rect.left) * scaleX,
1971
- y: (e.clientY - rect.top) * scaleY,
1972
- };
1973
- }
1974
- drawUploadedImage() {
1975
- if (!this.canvasElement || !this.uploadedImage) {
1976
- return;
1977
- }
1978
- const ctx = this.canvasElement.getContext('2d');
1979
- if (!ctx) {
1980
- return;
1981
- }
1982
- // Clear the canvas
1983
- ctx.clearRect(0, 0, this.canvasElement.width, this.canvasElement.height);
1984
- // Calculate scaling to fit image within canvas while maintaining aspect ratio
1985
- const canvasWidth = this.canvasElement.width;
1986
- const canvasHeight = this.canvasElement.height;
1987
- const imageWidth = this.uploadedImage.width;
1988
- const imageHeight = this.uploadedImage.height;
1989
- // Calculate scale to fit within canvas (with some padding)
1990
- const padding = 10;
1991
- const availableWidth = canvasWidth - padding * 2;
1992
- const availableHeight = canvasHeight - padding * 2;
1993
- const scaleX = availableWidth / imageWidth;
1994
- const scaleY = availableHeight / imageHeight;
1995
- const scale = Math.min(scaleX, scaleY);
1996
- // Calculate dimensions and position to center the image
1997
- const scaledWidth = imageWidth * scale;
1998
- const scaledHeight = imageHeight * scale;
1999
- const x = (canvasWidth - scaledWidth) / 2;
2000
- const y = (canvasHeight - scaledHeight) / 2;
2001
- // Draw the image centered and scaled
2002
- ctx.drawImage(this.uploadedImage, x, y, scaledWidth, scaledHeight);
2003
- }
2004
- render() {
2005
- return (h("verdocs-dialog", { key: 'd838183810455ddd1cb36e160b5cf601bf31db65' }, h("div", { key: 'e086f4ac7e2fdeb84ce71cf2030a677152033f7e', slot: "heading", class: "heading" }, h("div", { key: '5695fd95e4e3d5769d63e0436491451fadfca4a4', class: "icon" }, h("svg", { key: 'a58836ecf7dd0bce31b6cc0a41ee21641c3a5e46', width: "22", height: "19", viewBox: "0 0 22 19", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("g", { key: '119572170e51d5ab36fd7ad09513a09d1cfdb632', "clip-path": "url(#clip0_34208_4881)" }, h("path", { key: 'b0ec47c70c63c58bf46a5d7ce63b2f95ec4d2bb1', d: "M3.125 0.75C1.88398 0.75 0.875 1.75898 0.875 3V16.5C0.875 17.741 1.88398 18.75 3.125 18.75H12.125C13.366 18.75 14.375 17.741 14.375 16.5V15.8215C14.2801 15.8602 14.1852 15.8918 14.0867 15.9164L11.9738 16.4437C11.8684 16.4684 11.7629 16.4859 11.6574 16.493C11.6258 16.4965 11.5941 16.5 11.5625 16.5H9.3125C9.09805 16.5 8.90469 16.3805 8.80977 16.1906L8.50039 15.5684C8.44062 15.4488 8.32109 15.375 8.19102 15.375C8.06094 15.375 7.93789 15.4488 7.88164 15.5684L7.57227 16.1906C7.47031 16.398 7.24883 16.5211 7.02031 16.5C6.7918 16.4789 6.59492 16.3207 6.53164 16.1027L5.9375 14.1445L5.59297 15.2977C5.37852 16.0113 4.72109 16.5 3.97578 16.5H3.6875C3.37812 16.5 3.125 16.2469 3.125 15.9375C3.125 15.6281 3.37812 15.375 3.6875 15.375H3.97578C4.22539 15.375 4.44336 15.2133 4.51367 14.9742L5.0375 13.234C5.15703 12.8367 5.52266 12.5625 5.9375 12.5625C6.35234 12.5625 6.71797 12.8367 6.8375 13.234L7.24531 14.591C7.50547 14.373 7.83594 14.25 8.1875 14.25C8.74648 14.25 9.25625 14.5664 9.50586 15.0656L9.66055 15.375H9.97344C9.86445 15.0656 9.84336 14.7281 9.92422 14.3977L10.4516 12.2848C10.55 11.8875 10.7539 11.5289 11.0422 11.2406L14.375 7.90781V6.375H9.875C9.25273 6.375 8.75 5.87227 8.75 5.25V0.75H3.125ZM9.875 0.75V5.25H14.375L9.875 0.75ZM20.2039 5.66133C19.6555 5.11289 18.766 5.11289 18.2141 5.66133L17.1805 6.69492L19.6766 9.19102L20.7102 8.15742C21.2586 7.60898 21.2586 6.71953 20.7102 6.16758L20.2039 5.66133ZM11.8402 12.0352C11.6961 12.1793 11.5941 12.3586 11.5449 12.559L11.0176 14.6719C10.9684 14.8652 11.0246 15.0656 11.1652 15.2063C11.3059 15.3469 11.5062 15.4031 11.6996 15.3539L13.8125 14.8266C14.0094 14.7773 14.1922 14.6754 14.3363 14.5312L18.8785 9.98555L16.3824 7.48945L11.8402 12.0352Z", fill: "white" })), h("defs", { key: 'b435fa99e9ab36cff1c5ee12df81d6644d1e8b3b' }, h("clipPath", { key: 'ea95f0abb5d9e08c8e95a8f345cd02917b3c46db', id: "clip0_34208_4881" }, h("path", { key: '2e5f0f1e4fd960e21614a46735acc0c869b87437', d: "M0.875 0.75H21.125V18.75H0.875V0.75Z", fill: "white" }))))), h("div", { key: 'c36d8d6aa53bdba02dea4a8885ad531f4bf55fe8', class: "title" }, "Adopt Signature")), h("div", { key: '9616e43bfd7dfcdb38acc54bff69eeab12239d94', slot: "content", class: "content" }, h("div", { key: '421ac8a9a88a53bd535c8202e383583181146e34', class: "tabs" }, h("div", { key: '8ebc6cc05e11553afa53685dc528c1e58e7bd43a', class: { tab: true, active: this.mode === 'type' }, onClick: () => (this.mode = 'type') }, h("div", { key: '22373fb7e6fdd5a78d5d36b5740da0a2fee38f8c', innerHTML: Keyboard, class: "icon" }), h("div", { key: '835b389a3e4b56a9c085650530c32f0af0354b17' }, "Type")), h("div", { key: '589afcff232ca9cef56cf042d9bac75884892974', class: { tab: true, active: this.mode === 'draw' }, onClick: () => (this.mode = 'draw') }, h("div", { key: '5573796f4f12093489e151a020da56ed0579956a', innerHTML: Pencil, class: "icon" }), h("div", { key: '12e652e05d33c50abd0b8b730562b45264c3e6c0' }, "Draw")), h("div", { key: '41a795695850d155991f2175acf203c674a51dad', class: { tab: true, active: this.mode === 'upload' }, onClick: () => (this.mode = 'upload') }, h("div", { key: '0c0248b88c77b3a1fb334f785b5bbbe389d31f97', innerHTML: Upload, class: "icon" }), h("div", { key: '04de2e449f9e6c943a219387d4c6340673e24041' }, "Upload"))), h("div", { key: '53fc1dcf9b5d29e613da7079a267c3e30625dfc7', class: { type: true, active: this.mode === 'type' } }, h("verdocs-text-input", { key: '53e1a6653495665effb048f3a936f0f1b4124c2d', label: "Full Name", value: this.enteredName, placeholder: "Full Name...", description: "As shown on driver's license or govt. ID card.", onInput: e => this.handleNameChange(e), onClick: e => e.stopPropagation() })), h("div", { key: 'fc156dcb001bd84b6db225840dcc95a9abab34bb', class: { draw: true, active: this.mode === 'draw' } }, h("div", { key: '299bd972c18922c192b21949069633e275da4d24', class: "draw-instructions" }, "Draw your signature below using your mouse or finger"), h("div", { key: 'fb3796bbd36fe6269392903a75268820a17858c0', class: "draw-actions" }, h("button", { key: 'ebe9b40d645352229a0be444c822314320387fd4', class: "clear-button", onClick: e => this.handleClearDrawing(e), disabled: !this.hasDrawnSignature }, "Clear"))), h("div", { key: 'c92a9661aabd3362dba6933f953f6cd8b32374e2', class: { upload: true, active: this.mode === 'upload' } }, h("div", { key: 'faf6d5d34f48e5eb078bc039f1a4c3dddbbe40c3', class: "upload-instructions" }, "Upload a PNG image of your signature"), h("input", { key: 'bf0f0e47f5db36b6d87b1e01f8781d29bbfcd63c', ref: el => (this.fileInputElement = el), type: "file", accept: "image/png", onChange: this.handleFileChange, style: { display: 'none' } }), h("div", { key: '54a1d918f66c6d0f2f4e7f7498410c50c204dd6d', class: "upload-actions" }, h("button", { key: '08b1536cec63081c48483d5da15cbea42b2e8e4f', class: "upload-button", onClick: this.handleSelectFile }, this.hasUploadedImage ? 'Change Image' : 'Select PNG File'), this.hasUploadedImage && (h("button", { key: 'e201f4042c323e4eb88f48a72f28e40bd06c5600', class: "clear-button", onClick: this.handleClearUpload }, "Clear"))), this.uploadedFileName && h("div", { key: '1a3b6b0a3dbb196ebd66302b6c50cb3238925532', class: "upload-filename" }, this.uploadedFileName)), h("canvas", { key: '23f76d5797a4daaea89970062653204af53da5bc', ref: el => (this.canvasElement = el), width: "300", height: "79", onPointerDown: this.handlePointerDown, onPointerMove: this.handlePointerMove, onPointerUp: this.handlePointerUp, onPointerCancel: this.handlePointerCancel, style: { touchAction: 'none', cursor: 'crosshair' } }), h("div", { key: '5b652d1f2b484fedc47c93107a33375979ebb7e5', class: "disclaimer" }, "By clicking Adopt, I agree that the signature will be the electronic representation of my signature for all purposes when I (or my agent) use them on documents, including legally binding contracts \u2014 just the same as a pen-and-paper signature or initial.")), h("div", { key: 'c039995afc96ddebd96d8a974ffa41353cadb118', class: "footer", slot: "footer" }, h("div", { key: 'b87e6fdb90a30e049f03a40f7cf5a065858f7303', class: "buttons" }, h("button", { key: 'dd96285ada5f5428e8205dd13f405f5ee56a51ba', class: "cancel", onClick: e => this.handleCancel(e) }, "Cancel"), h("button", { key: '46b3af475fded0383a7590c2253a3dd39f1de9ca', class: "proceed", onClick: e => this.handleAdopt(e), disabled: this.isAdoptButtonDisabled() }, "Adopt & Sign")))));
2006
- }
2007
- };
2008
- VerdocsSignatureDialog.style = verdocsSignatureDialogCss;
2009
-
2010
1403
  const verdocsUploadDialogCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-upload-dialog{position:fixed;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:\"Inter\", \"Barlow\", sans-serif}verdocs-upload-dialog div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-upload-dialog .background-overlay{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:10000;position:fixed;-ms-flex-align:center;align-items:center;background:rgba(0, 0, 0, 0.4980392157);-ms-flex-pack:center;justify-content:center}verdocs-upload-dialog .upload-dialog-content{width:320px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border-radius:4px;overflow:hidden;background:#ffffff;padding:16px;-webkit-box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4);box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4)}verdocs-upload-dialog .heading{display:-ms-flexbox;display:flex;font-size:20px;font-weight:500;-ms-flex-direction:row;flex-direction:row}verdocs-upload-dialog .buttons{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-upload-dialog .buttons verdocs-button{margin-left:16px}verdocs-upload-dialog .current-label{margin:20px 0 5px 0}verdocs-upload-dialog .drop-target{opacity:1;width:100%;display:-ms-flexbox;display:flex;margin:20px 0;min-height:260px;padding:30px 15px;text-align:center;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;background-color:#f5f5f5;color:#33364b;border:2px dashed #979797}verdocs-upload-dialog .drop-target p{margin:12px 0;font-weight:500}verdocs-upload-dialog .drop-target p.subscript{margin:20px;color:#5c6575;font-size:14px}verdocs-upload-dialog .drop-target.dragging-over{border:5px solid #4c56cb}verdocs-upload-dialog .drop-target>verdocs-button{margin:12px 0;display:inline-block}verdocs-upload-dialog .attachments{height:56px;font-size:0;margin:20px 0;padding:0 16px;line-height:56px;white-space:normal;-webkit-box-shadow:0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.12), 0 0 2px 0 rgba(0, 0, 0, 0.14);box-shadow:0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.12), 0 0 2px 0 rgba(0, 0, 0, 0.14)}verdocs-upload-dialog .attachments .attachment{gap:10px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-upload-dialog .attachments .attachment .icon{width:18px;height:18px;line-height:18px}verdocs-upload-dialog .attachments .attachment .icon.trash{cursor:pointer}verdocs-upload-dialog .attachments .attachment .name{-ms-flex:1;flex:1;font-size:14px;overflow:hidden;font-weight:400;white-space:nowrap;text-overflow:ellipsis}verdocs-upload-dialog .error{margin:20px 0;color:#cc0000}";
2011
1404
 
2012
1405
  const TrashIcon = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" /></svg>`;
@@ -2094,5 +1487,5 @@ const VerdocsUploadDialog = class {
2094
1487
  };
2095
1488
  VerdocsUploadDialog.style = verdocsUploadDialogCss;
2096
1489
 
2097
- export { VerdocsFieldAttachment as verdocs_field_attachment, VerdocsFieldCheckbox as verdocs_field_checkbox, VerdocsFieldDate as verdocs_field_date, VerdocsFieldDropdown as verdocs_field_dropdown, VerdocsFieldInitial as verdocs_field_initial, VerdocsFieldRadio as verdocs_field_radio, VerdocsFieldSignature as verdocs_field_signature, VerdocsFieldTextarea as verdocs_field_textarea, VerdocsFieldTextbox as verdocs_field_textbox, VerdocsFieldTimestamp as verdocs_field_timestamp, VerdocsInitialDialog as verdocs_initial_dialog, VerdocsSignatureDialog as verdocs_signature_dialog, VerdocsUploadDialog as verdocs_upload_dialog };
2098
- //# sourceMappingURL=verdocs-field-attachment.verdocs-field-checkbox.verdocs-field-date.verdocs-field-dropdown.verdocs-field-initial.verdocs-field-radio.verdocs-field-signature.verdocs-field-textarea.verdocs-field-textbox.verdocs-field-timestamp.verdocs-initial-dialog.verdocs-signature-dialog.verdocs-upload-dialog.entry.js.map
1490
+ export { VerdocsFieldAttachment as verdocs_field_attachment, VerdocsFieldCheckbox as verdocs_field_checkbox, VerdocsFieldDate as verdocs_field_date, VerdocsFieldDropdown as verdocs_field_dropdown, VerdocsFieldInitial as verdocs_field_initial, VerdocsFieldRadio as verdocs_field_radio, VerdocsFieldSignature as verdocs_field_signature, VerdocsFieldTextarea as verdocs_field_textarea, VerdocsFieldTextbox as verdocs_field_textbox, VerdocsFieldTimestamp as verdocs_field_timestamp, VerdocsUploadDialog as verdocs_upload_dialog };
1491
+ //# sourceMappingURL=verdocs-field-attachment.verdocs-field-checkbox.verdocs-field-date.verdocs-field-dropdown.verdocs-field-initial.verdocs-field-radio.verdocs-field-signature.verdocs-field-textarea.verdocs-field-textbox.verdocs-field-timestamp.verdocs-upload-dialog.entry.js.map