@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
@@ -538,7 +538,8 @@ const VerdocsFieldInitial = class {
538
538
  this.tempInitials = '';
539
539
  }
540
540
  async focusField() {
541
- this.handleShow();
541
+ this.el.focus();
542
+ this.focused = true;
542
543
  }
543
544
  componentDidRender() {
544
545
  interact_min.interact.dynamicDrop(true);
@@ -563,6 +564,9 @@ const VerdocsFieldInitial = class {
563
564
  });
564
565
  }
565
566
  }
567
+ onBlur() {
568
+ this.focused = false;
569
+ }
566
570
  handleResizeStart(e) {
567
571
  e.preventDefault();
568
572
  e.stopPropagation();
@@ -610,28 +614,6 @@ const VerdocsFieldInitial = class {
610
614
  })
611
615
  .catch(e => console.log('Field update failed', e));
612
616
  }
613
- hideDialog() {
614
- var _a;
615
- (_a = this.dialog) === null || _a === void 0 ? void 0 : _a.remove();
616
- this.dialog = null;
617
- this.focused = false;
618
- }
619
- handleAdopt(e) {
620
- var _a;
621
- console.log('[INITIAL] Adopted initials');
622
- this.tempInitials = e.detail;
623
- (_a = this.fieldChange) === null || _a === void 0 ? void 0 : _a.emit(this.tempInitials);
624
- this.hideDialog();
625
- }
626
- handleShow() {
627
- this.dialog = document.createElement('verdocs-initial-dialog');
628
- this.dialog.setAttribute('initials', this.initials);
629
- // this.dialog.setAttribute('roleindex', this.roleindex);
630
- this.dialog.addEventListener('exit', () => this.hideDialog());
631
- this.dialog.addEventListener('next', (e) => this.handleAdopt(e));
632
- document.body.append(this.dialog);
633
- this.focused = true;
634
- }
635
617
  async showSettingsPanel() {
636
618
  const settingsPanel = document.getElementById(`verdocs-settings-panel-${this.fieldname}`);
637
619
  if (settingsPanel && settingsPanel.showPanel) {
@@ -669,7 +651,7 @@ const VerdocsFieldInitial = class {
669
651
  (_a = this.fieldChange) === null || _a === void 0 ? void 0 : _a.emit(this.initialid);
670
652
  }
671
653
  else {
672
- this.handleShow();
654
+ this.adopt.emit();
673
655
  }
674
656
  } }, "Initial")), editable && (index.h(index.Fragment, null, index.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: Icons.SettingsIcon, onClick: (e) => {
675
657
  e.stopPropagation();
@@ -803,6 +785,7 @@ const VerdocsFieldSignature = class {
803
785
  this.settingsPress = index.createEvent(this, "settingsPress");
804
786
  this.settingsChanged = index.createEvent(this, "settingsChanged");
805
787
  this.deleted = index.createEvent(this, "deleted");
788
+ this.adopt = index.createEvent(this, "adopt");
806
789
  /**
807
790
  * Fields may be attached to templates or envelopes, but only template fields may be edited.
808
791
  */
@@ -858,7 +841,8 @@ const VerdocsFieldSignature = class {
858
841
  this.tempSignature = '';
859
842
  }
860
843
  async focusField() {
861
- this.handleShow();
844
+ this.el.focus();
845
+ this.focused = true;
862
846
  }
863
847
  componentDidRender() {
864
848
  interact_min.interact.dynamicDrop(true);
@@ -883,6 +867,9 @@ const VerdocsFieldSignature = class {
883
867
  });
884
868
  }
885
869
  }
870
+ onBlur() {
871
+ this.focused = false;
872
+ }
886
873
  handleResizeStart(e) {
887
874
  e.preventDefault();
888
875
  e.stopPropagation();
@@ -930,28 +917,6 @@ const VerdocsFieldSignature = class {
930
917
  })
931
918
  .catch(e => console.log('Field update failed', e));
932
919
  }
933
- hideDialog() {
934
- var _a;
935
- (_a = this.dialog) === null || _a === void 0 ? void 0 : _a.remove();
936
- this.dialog = null;
937
- this.focused = false;
938
- }
939
- handleAdopt(e) {
940
- var _a;
941
- console.log('[SIGNATURE] Adopted signature');
942
- this.tempSignature = e.detail;
943
- (_a = this.fieldChange) === null || _a === void 0 ? void 0 : _a.emit(this.tempSignature);
944
- this.hideDialog();
945
- }
946
- handleShow() {
947
- this.dialog = document.createElement('verdocs-signature-dialog');
948
- this.dialog.setAttribute('name', this.name);
949
- // this.dialog.setAttribute('roleindex', this.roleindex);
950
- this.dialog.addEventListener('exit', () => this.hideDialog());
951
- this.dialog.addEventListener('next', (e) => this.handleAdopt(e));
952
- document.body.append(this.dialog);
953
- this.focused = true;
954
- }
955
920
  async showSettingsPanel() {
956
921
  const settingsPanel = document.getElementById(`verdocs-settings-panel-${this.fieldname}`);
957
922
  if (settingsPanel && settingsPanel.showPanel) {
@@ -991,7 +956,7 @@ const VerdocsFieldSignature = class {
991
956
  (_a = this.fieldChange) === null || _a === void 0 ? void 0 : _a.emit(this.signatureid);
992
957
  }
993
958
  else {
994
- this.handleShow();
959
+ this.adopt.emit();
995
960
  }
996
961
  } }, "Signature")), editable && (index.h(index.Fragment, null, index.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: Icons.SettingsIcon, onClick: (e) => {
997
962
  e.stopPropagation();
@@ -1437,578 +1402,6 @@ const VerdocsFieldTimestamp = class {
1437
1402
  };
1438
1403
  VerdocsFieldTimestamp.style = verdocsFieldTimestampCss;
1439
1404
 
1440
- 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}";
1441
-
1442
- const VerdocsInitialDialog = class {
1443
- constructor(hostRef) {
1444
- index.registerInstance(this, hostRef);
1445
- this.next = index.createEvent(this, "next");
1446
- this.exit = index.createEvent(this, "exit");
1447
- /**
1448
- * Initial signature text
1449
- */
1450
- this.initials = '';
1451
- this.fontLoaded = false;
1452
- this.enteredInitials = '';
1453
- this.mode = 'type';
1454
- }
1455
- componentWillLoad() {
1456
- this.enteredInitials = this.initials.toUpperCase();
1457
- const ds = new FontFace('Dancing Script', 'url(https://fonts.gstatic.com/s/dancingscript/v19/If2cXTr6YS-zF4S-kcSWSVi_sxjsohD9F50Ruu7BMSo3Sup6hNX6plRP.woff)');
1458
- ds.load().then(font => {
1459
- document.fonts.add(font);
1460
- this.fontLoaded = true;
1461
- });
1462
- }
1463
- componentDidLoad() {
1464
- this.redrawSignature();
1465
- }
1466
- componentDidUpdate() {
1467
- this.redrawSignature();
1468
- }
1469
- redrawSignature() {
1470
- if (!this.canvasElement) {
1471
- return;
1472
- }
1473
- const canvasWidth = this.canvasElement.width;
1474
- const context = this.canvasElement.getContext('2d');
1475
- context.clearRect(0, 0, this.canvasElement.width, this.canvasElement.height);
1476
- let fontSize = 100;
1477
- do {
1478
- fontSize -= 2;
1479
- context.font = `${fontSize}px Dancing Script`;
1480
- } while (context.measureText(this.enteredInitials).width > canvasWidth - 32); // 32px padding each side
1481
- context.textAlign = 'center';
1482
- context.textBaseline = 'middle';
1483
- context.font = `${fontSize}px Dancing Script`;
1484
- context.fillText(this.enteredInitials, this.canvasElement.width / 2, this.canvasElement.height / 2);
1485
- }
1486
- handleNameChange(e) {
1487
- this.enteredInitials = e.target.value;
1488
- }
1489
- handleCancel(e) {
1490
- e.stopPropagation();
1491
- e.preventDefault();
1492
- this.exit.emit();
1493
- }
1494
- handleAdopt(e) {
1495
- e.stopPropagation();
1496
- e.preventDefault();
1497
- const data = this.canvasElement.toDataURL('image/png');
1498
- this.next.emit(data);
1499
- }
1500
- /*
1501
- selColor(hex: string) {
1502
- this.color = hex;
1503
- this.animateDraw();
1504
- }
1505
-
1506
- stopDraw() {
1507
- this.paint = false;
1508
- this.adoptedAndSigned = !this.hasSignature();
1509
- }
1510
-
1511
- draw(e) {
1512
- this.paint = true;
1513
- this.addPoints(e, false);
1514
- this.animateDraw();
1515
- }
1516
-
1517
- recordPoints(e) {
1518
- if (this.paint) {
1519
- this.addPoints(e, true);
1520
- this.animateDraw();
1521
- }
1522
- }
1523
-
1524
- animateDraw() {
1525
- this.canvas.clearRect(0, 0, this.canvas.canvas.offsetWidth, this.canvas.canvas.offsetHeight);
1526
-
1527
- this.canvas.strokeStyle = this.color || '#000000';
1528
- this.canvas.lineJoin = 'round';
1529
- this.canvas.lineWidth = 3;
1530
-
1531
- for (let i = 0; i < this.points.length; i++) {
1532
- this.canvas.beginPath();
1533
- if (this.points[i].drag && i) {
1534
- this.canvas.moveTo(this.points[i - 1].x, this.points[i - 1].y);
1535
- // this.canvas.arc(this.points[i - 1].x, this.points[i - 1].y, 2, 0, 2 * Math.PI, false);
1536
- } else {
1537
- this.canvas.moveTo(this.points[i].x - 1, this.points[i].y);
1538
- // this.canvas.arc(this.points[i].x, this.points[i].y, 2, 0, 2 * Math.PI, false);
1539
- }
1540
-
1541
- this.canvas.lineTo(this.points[i].x, this.points[i].y);
1542
- this.canvas.closePath();
1543
- this.canvas.stroke();
1544
- }
1545
- }
1546
-
1547
- drawCurve(color: string, curve: number) {
1548
- this.canvas.beginPath();
1549
- }
1550
-
1551
-
1552
-
1553
- addPoints(e, drag: boolean) {
1554
- if (window) {
1555
- let x;
1556
- let y;
1557
- e.preventDefault();
1558
- if (e.touches && e.touches.length > 0) {
1559
- x = e.touches[0].clientX;
1560
- } else {
1561
- x = e.clientX;
1562
- }
1563
-
1564
- if (e.touches && e.touches.length > 0) {
1565
- y = e.touches[0].clientY;
1566
- } else {
1567
- y = e.clientY;
1568
- }
1569
- const rect = this.signatureCanvas.nativeElement.getBoundingClientRect();
1570
- this.points.push({
1571
- x: x - rect.left,
1572
- y: y - rect.top,
1573
- drag: drag
1574
- });
1575
- }
1576
- }
1577
-
1578
- clearPad() {
1579
- this.canvas.clearRect(0, 0, this.canvas.canvas.offsetWidth, this.canvas.canvas.offsetHeight);
1580
- this.points = [];
1581
- this.adoptedAndSigned = !this.hasSignature();
1582
- }
1583
-
1584
- async adoptAndSign() {
1585
- try {
1586
- this.adoptedAndSigned = true;
1587
- await this.updateFullName();
1588
- await this.captureSignatureFromCanvas();
1589
- const message = this.signatureMode === 'Signature' ? 'Saving Signature' : 'Saving Initial';
1590
- this.snackbarService.open(message, 'OK', this.snackbarService.initConfig(null, 'bottom'));
1591
- this.handleMode();
1592
- } catch (err) {
1593
- this.snackbarService.open('Failed to apply signature', 'OK', this.snackbarService.initConfig(null, 'bottom'));
1594
- }
1595
- }
1596
-
1597
- handleMode() {
1598
- let currentField;
1599
- switch (this.mode) {
1600
- case 'signerview':
1601
- if (this.signatureMode === 'Signature') {
1602
- this.signatureService.postSignatureBlob().then(result => {
1603
- if (result && result.id && result.url) {
1604
- currentField = this.signatureService.currField;
1605
- this.signatureService.updateSigned(currentField.fName, true);
1606
- this.signatureService.toggleSig(false);
1607
- this.signatureService.setSignatureId(result.id);
1608
- this.signatureService.putSignatureField(this.envelopeId, this.fieldName, result.id).then(res => {
1609
- this.eventTracker.createEvent({
1610
- category: 'verdoc',
1611
- action: 'verdoc signed',
1612
- label: `verdoc id: ${this.envelopeId}`
1613
- })
1614
- if (res && res.settings) {
1615
- this.signatureService.setSignatureData(res.settings.base64);
1616
- this.signatureService.setSignatureId(res.settings.signature_id);
1617
- }
1618
- this.snackbarService.dismiss();
1619
- this.dialog.close({ status: 'saved', temp_sig: res.settings.base64, sig_id: res.settings.signature_id });
1620
- }).catch(err => {
1621
- this.snackbarService.open('Failed to save signature. Please try again.', 'DISMISS', {
1622
- duration: 3000
1623
- });
1624
- this.adoptedAndSigned = false;
1625
- return err;
1626
- });
1627
- }
1628
- });
1629
- } else {
1630
- this.signatureService.postInitialBlob().then(result => {
1631
- if (result && result.id && result.url) {
1632
- currentField = this.signatureService.currField;
1633
- this.signatureService.updateInitialed(currentField.fName, true);
1634
- this.signatureService.setInitialId(result.id);
1635
- this.signatureService.toggleSig(false);
1636
- this.signatureService.putInitialField(this.envelopeId, this.fieldName, result.id).then(res => {
1637
- if (res && res.settings) {
1638
- this.signatureService.setInitialData(res.settings.base64);
1639
- this.signatureService.setInitialId(res.settings.initial_id);
1640
- }
1641
- this.snackbarService.dismiss();
1642
- this.dialog.close({ status: 'saved', temp_int: res.settings.base64, int_id: res.settings.initial_id });
1643
- }).catch(err => {
1644
- this.snackbarService.open('Failed to save initial. Please try again.', 'DISMISS', {
1645
- duration: 3000
1646
- });
1647
- this.adoptedAndSigned = false;
1648
- return err;
1649
- });
1650
- }
1651
- });
1652
- }
1653
- break;
1654
- }
1655
- }
1656
- */
1657
- render() {
1658
- return (index.h(index.Host, { key: 'adf8b7f3191850b40c865196d5a435e9d85ef28a', onClick: e => this.handleCancel(e) }, index.h("div", { key: 'c80e81a5ff5a686cbab68b9ac0fa23dd61d9ee32', class: "dialog" }, index.h("div", { key: '622d2ebd26b3ac4003add36dc40c9eef54fb95bc', class: "heading" }, "Create Your Initial"), index.h("div", { key: '8179e48c368a5831b395a01ea6e6dbf19377e3f3', class: "content" }, index.h("verdocs-text-input", { key: 'c5696ad5ab2fc4a703b596d12029e95dcad099b6', placeholder: "Initials...", label: "Initials", value: this.enteredInitials, onInput: e => this.handleNameChange(e), onClick: e => e.stopPropagation() }), index.h("div", { key: 'a63b403893d70267d94e4029b72a54e50ccc56ae', class: "as-shown" }, "As shown on driver's license or govt. ID card."), this.fontLoaded ? index.h("canvas", { ref: el => (this.canvasElement = el) }) : index.h("div", { style: { display: 'none' } }), index.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."), index.h("div", { key: 'b76005f2943578684934f6e5299d1bcf0bb5f705', class: "buttons" }, index.h("verdocs-button", { key: '5b9a99183f1f31d940a6a22cf4167c84f93d2284', label: "CANCEL", size: "normal", variant: "outline", onClick: e => this.handleCancel(e) }), index.h("verdocs-button", { key: 'e9dbfe8255870db5ff0b5f2aee3d9a3c1e48b702', label: "Adopt & Sign", size: "normal", onClick: e => this.handleAdopt(e) }))))));
1659
- }
1660
- };
1661
- VerdocsInitialDialog.style = verdocsInitialDialogCss;
1662
-
1663
- 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}";
1664
-
1665
- 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>`;
1666
- 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>`;
1667
- 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>`;
1668
- const VerdocsSignatureDialog = class {
1669
- constructor(hostRef) {
1670
- index.registerInstance(this, hostRef);
1671
- this.next = index.createEvent(this, "next");
1672
- this.exit = index.createEvent(this, "exit");
1673
- /**
1674
- * Initial signature text
1675
- */
1676
- this.name = '';
1677
- this.fontLoaded = false;
1678
- this.enteredName = '';
1679
- this.mode = 'type';
1680
- // Drawing state
1681
- this.isDrawing = false;
1682
- this.hasDrawnSignature = false;
1683
- // Upload state
1684
- this.hasUploadedImage = false;
1685
- this.uploadedFileName = '';
1686
- this.currentStroke = [];
1687
- this.allStrokes = [];
1688
- this.lastPoint = null;
1689
- this.uploadedImage = null;
1690
- this.handlePointerDown = (e) => {
1691
- e.preventDefault();
1692
- if (!this.canvasElement || !this.drawingContext) {
1693
- return;
1694
- }
1695
- this.isDrawing = true;
1696
- this.hasDrawnSignature = true;
1697
- const point = this.getCanvasCoordinates(e);
1698
- this.currentStroke = [point];
1699
- this.lastPoint = point;
1700
- // Start a new path
1701
- this.drawingContext.beginPath();
1702
- this.drawingContext.moveTo(point.x, point.y);
1703
- // Capture pointer to ensure we get all events even if pointer leaves canvas
1704
- this.canvasElement.setPointerCapture(e.pointerId);
1705
- };
1706
- this.handlePointerMove = (e) => {
1707
- e.preventDefault();
1708
- if (!this.isDrawing || !this.drawingContext || !this.lastPoint) {
1709
- return;
1710
- }
1711
- const point = this.getCanvasCoordinates(e);
1712
- this.currentStroke.push(point);
1713
- // Use quadratic curves for smooth drawing
1714
- // The control point is the last point, and we draw to the midpoint
1715
- const midPoint = {
1716
- x: (this.lastPoint.x + point.x) / 2,
1717
- y: (this.lastPoint.y + point.y) / 2,
1718
- };
1719
- this.drawingContext.quadraticCurveTo(this.lastPoint.x, this.lastPoint.y, midPoint.x, midPoint.y);
1720
- this.drawingContext.stroke();
1721
- this.lastPoint = point;
1722
- };
1723
- this.handlePointerUp = (e) => {
1724
- e.preventDefault();
1725
- if (!this.isDrawing || !this.drawingContext) {
1726
- return;
1727
- }
1728
- // Complete the stroke
1729
- if (this.lastPoint && this.currentStroke.length > 0) {
1730
- this.drawingContext.lineTo(this.lastPoint.x, this.lastPoint.y);
1731
- this.drawingContext.stroke();
1732
- }
1733
- // Save the completed stroke
1734
- if (this.currentStroke.length > 0) {
1735
- this.allStrokes.push([...this.currentStroke]);
1736
- }
1737
- this.isDrawing = false;
1738
- this.currentStroke = [];
1739
- this.lastPoint = null;
1740
- // Release pointer capture
1741
- if (this.canvasElement) {
1742
- this.canvasElement.releasePointerCapture(e.pointerId);
1743
- }
1744
- };
1745
- this.handlePointerCancel = (e) => {
1746
- // Handle cases where drawing is interrupted (e.g., phone call, notification)
1747
- this.isDrawing = false;
1748
- this.currentStroke = [];
1749
- this.lastPoint = null;
1750
- if (this.canvasElement) {
1751
- this.canvasElement.releasePointerCapture(e.pointerId);
1752
- }
1753
- };
1754
- this.handleSelectFile = (e) => {
1755
- var _a;
1756
- e.stopPropagation();
1757
- e.preventDefault();
1758
- (_a = this.fileInputElement) === null || _a === void 0 ? void 0 : _a.click();
1759
- };
1760
- this.handleFileChange = (e) => {
1761
- var _a;
1762
- const input = e.target;
1763
- const file = (_a = input.files) === null || _a === void 0 ? void 0 : _a[0];
1764
- if (!file) {
1765
- return;
1766
- }
1767
- // Validate file type
1768
- if (!file.type.startsWith('image/png')) {
1769
- alert('Please select a PNG image file.');
1770
- input.value = '';
1771
- return;
1772
- }
1773
- // Load and display the image
1774
- const reader = new FileReader();
1775
- reader.onload = (event) => {
1776
- var _a;
1777
- const img = new Image();
1778
- img.onload = () => {
1779
- this.uploadedImage = img;
1780
- this.uploadedFileName = file.name;
1781
- this.hasUploadedImage = true;
1782
- this.drawUploadedImage();
1783
- };
1784
- img.onerror = () => {
1785
- alert('Failed to load image. Please try a different file.');
1786
- input.value = '';
1787
- };
1788
- img.src = (_a = event.target) === null || _a === void 0 ? void 0 : _a.result;
1789
- };
1790
- reader.onerror = () => {
1791
- alert('Failed to read file. Please try again.');
1792
- input.value = '';
1793
- };
1794
- reader.readAsDataURL(file);
1795
- };
1796
- this.handleClearUpload = (e) => {
1797
- e.stopPropagation();
1798
- e.preventDefault();
1799
- this.uploadedImage = null;
1800
- this.uploadedFileName = '';
1801
- this.hasUploadedImage = false;
1802
- // Clear the file input
1803
- if (this.fileInputElement) {
1804
- this.fileInputElement.value = '';
1805
- }
1806
- // Clear the canvas
1807
- if (this.canvasElement) {
1808
- const ctx = this.canvasElement.getContext('2d');
1809
- if (ctx) {
1810
- ctx.clearRect(0, 0, this.canvasElement.width, this.canvasElement.height);
1811
- }
1812
- }
1813
- };
1814
- }
1815
- componentWillLoad() {
1816
- this.enteredName = this.name;
1817
- const ds = new FontFace('Dancing Script', 'url(https://fonts.gstatic.com/s/dancingscript/v19/If2cXTr6YS-zF4S-kcSWSVi_sxjsohD9F50Ruu7BMSo3Sup6hNX6plRP.woff)');
1818
- ds.load().then(font => {
1819
- document.fonts.add(font);
1820
- this.fontLoaded = true;
1821
- });
1822
- }
1823
- componentDidLoad() {
1824
- this.redrawSignature();
1825
- this.setupDrawingCanvas();
1826
- }
1827
- componentDidUpdate() {
1828
- this.redrawSignature();
1829
- this.setupDrawingCanvas();
1830
- // Redraw uploaded image when in upload mode
1831
- if (this.mode === 'upload' && this.hasUploadedImage) {
1832
- this.drawUploadedImage();
1833
- }
1834
- // Redraw drawn signature when in draw mode
1835
- if (this.mode === 'draw' && this.allStrokes.length > 0) {
1836
- this.redrawDrawnSignature();
1837
- }
1838
- }
1839
- redrawSignature() {
1840
- if (!this.canvasElement || this.mode !== 'type') {
1841
- return;
1842
- }
1843
- const canvasWidth = this.canvasElement.width;
1844
- const context = this.canvasElement.getContext('2d');
1845
- context.clearRect(0, 0, this.canvasElement.width, this.canvasElement.height);
1846
- let fontSize = 100;
1847
- do {
1848
- fontSize -= 2;
1849
- context.font = `${fontSize}px Dancing Script`;
1850
- } while (context.measureText(this.enteredName).width > canvasWidth - 32); // 32px padding each side
1851
- context.textAlign = 'center';
1852
- context.textBaseline = 'middle';
1853
- context.font = `${fontSize}px Dancing Script`;
1854
- context.fillText(this.enteredName, this.canvasElement.width / 2, this.canvasElement.height / 2);
1855
- }
1856
- redrawDrawnSignature() {
1857
- if (!this.canvasElement || !this.drawingContext || this.allStrokes.length === 0) {
1858
- return;
1859
- }
1860
- // Clear the canvas first
1861
- this.drawingContext.clearRect(0, 0, this.canvasElement.width, this.canvasElement.height);
1862
- // Redraw all strokes
1863
- for (const stroke of this.allStrokes) {
1864
- if (stroke.length === 0) {
1865
- continue;
1866
- }
1867
- // Start the path at the first point
1868
- this.drawingContext.beginPath();
1869
- this.drawingContext.moveTo(stroke[0].x, stroke[0].y);
1870
- // Draw smooth curves through all points in the stroke
1871
- for (let i = 1; i < stroke.length; i++) {
1872
- const currentPoint = stroke[i];
1873
- const previousPoint = stroke[i - 1];
1874
- // Use quadratic curves for smooth lines
1875
- const midPoint = {
1876
- x: (previousPoint.x + currentPoint.x) / 2,
1877
- y: (previousPoint.y + currentPoint.y) / 2,
1878
- };
1879
- this.drawingContext.quadraticCurveTo(previousPoint.x, previousPoint.y, midPoint.x, midPoint.y);
1880
- }
1881
- // Draw to the last point
1882
- if (stroke.length > 1) {
1883
- const lastPoint = stroke[stroke.length - 1];
1884
- this.drawingContext.lineTo(lastPoint.x, lastPoint.y);
1885
- }
1886
- this.drawingContext.stroke();
1887
- }
1888
- }
1889
- handleNameChange(e) {
1890
- this.enteredName = e.target.value;
1891
- }
1892
- handleCancel(e) {
1893
- e.stopPropagation();
1894
- e.preventDefault();
1895
- this.exit.emit();
1896
- }
1897
- handleAdopt(e) {
1898
- e.stopPropagation();
1899
- e.preventDefault();
1900
- const data = this.canvasElement.toDataURL('image/png');
1901
- this.next.emit(data);
1902
- }
1903
- isAdoptButtonDisabled() {
1904
- switch (this.mode) {
1905
- case 'type':
1906
- // Disable if no name has been entered
1907
- return !this.enteredName || this.enteredName.trim().length === 0;
1908
- case 'draw':
1909
- // Disable if nothing has been drawn
1910
- return !this.hasDrawnSignature || this.allStrokes.length === 0;
1911
- case 'upload':
1912
- // Disable if no file has been uploaded
1913
- return !this.hasUploadedImage;
1914
- default:
1915
- return true;
1916
- }
1917
- }
1918
- setupDrawingCanvas() {
1919
- if (!this.canvasElement) {
1920
- return;
1921
- }
1922
- // Set up drawing context when in draw mode
1923
- if (this.mode === 'draw') {
1924
- // Always get fresh context from the current canvas element
1925
- const ctx = this.canvasElement.getContext('2d');
1926
- // Only initialize if we don't have a context or it's different
1927
- if (ctx && ctx !== this.drawingContext) {
1928
- this.drawingContext = ctx;
1929
- // Configure drawing style for smooth signatures
1930
- this.drawingContext.strokeStyle = '#000000';
1931
- this.drawingContext.lineWidth = 2;
1932
- this.drawingContext.lineCap = 'round';
1933
- this.drawingContext.lineJoin = 'round';
1934
- // Clear canvas only if there are no existing strokes
1935
- if (this.allStrokes.length === 0) {
1936
- this.drawingContext.clearRect(0, 0, this.canvasElement.width, this.canvasElement.height);
1937
- }
1938
- }
1939
- }
1940
- // Reset drawing context when switching away from draw mode
1941
- // NOTE: We don't clear allStrokes here so drawing persists when returning to draw mode
1942
- if (this.mode !== 'draw' && this.drawingContext) {
1943
- this.drawingContext = null;
1944
- this.currentStroke = [];
1945
- this.lastPoint = null;
1946
- }
1947
- }
1948
- clearDrawingCanvas() {
1949
- if (!this.canvasElement || !this.drawingContext) {
1950
- return;
1951
- }
1952
- this.drawingContext.clearRect(0, 0, this.canvasElement.width, this.canvasElement.height);
1953
- this.currentStroke = [];
1954
- this.allStrokes = [];
1955
- this.lastPoint = null;
1956
- this.hasDrawnSignature = false;
1957
- }
1958
- handleClearDrawing(e) {
1959
- e.stopPropagation();
1960
- e.preventDefault();
1961
- this.clearDrawingCanvas();
1962
- }
1963
- getCanvasCoordinates(e) {
1964
- if (!this.canvasElement) {
1965
- return { x: 0, y: 0 };
1966
- }
1967
- const rect = this.canvasElement.getBoundingClientRect();
1968
- // Calculate the scale factor between canvas size and display size
1969
- const scaleX = this.canvasElement.width / rect.width;
1970
- const scaleY = this.canvasElement.height / rect.height;
1971
- return {
1972
- x: (e.clientX - rect.left) * scaleX,
1973
- y: (e.clientY - rect.top) * scaleY,
1974
- };
1975
- }
1976
- drawUploadedImage() {
1977
- if (!this.canvasElement || !this.uploadedImage) {
1978
- return;
1979
- }
1980
- const ctx = this.canvasElement.getContext('2d');
1981
- if (!ctx) {
1982
- return;
1983
- }
1984
- // Clear the canvas
1985
- ctx.clearRect(0, 0, this.canvasElement.width, this.canvasElement.height);
1986
- // Calculate scaling to fit image within canvas while maintaining aspect ratio
1987
- const canvasWidth = this.canvasElement.width;
1988
- const canvasHeight = this.canvasElement.height;
1989
- const imageWidth = this.uploadedImage.width;
1990
- const imageHeight = this.uploadedImage.height;
1991
- // Calculate scale to fit within canvas (with some padding)
1992
- const padding = 10;
1993
- const availableWidth = canvasWidth - padding * 2;
1994
- const availableHeight = canvasHeight - padding * 2;
1995
- const scaleX = availableWidth / imageWidth;
1996
- const scaleY = availableHeight / imageHeight;
1997
- const scale = Math.min(scaleX, scaleY);
1998
- // Calculate dimensions and position to center the image
1999
- const scaledWidth = imageWidth * scale;
2000
- const scaledHeight = imageHeight * scale;
2001
- const x = (canvasWidth - scaledWidth) / 2;
2002
- const y = (canvasHeight - scaledHeight) / 2;
2003
- // Draw the image centered and scaled
2004
- ctx.drawImage(this.uploadedImage, x, y, scaledWidth, scaledHeight);
2005
- }
2006
- render() {
2007
- return (index.h("verdocs-dialog", { key: 'd838183810455ddd1cb36e160b5cf601bf31db65' }, index.h("div", { key: 'e086f4ac7e2fdeb84ce71cf2030a677152033f7e', slot: "heading", class: "heading" }, index.h("div", { key: '5695fd95e4e3d5769d63e0436491451fadfca4a4', class: "icon" }, index.h("svg", { key: 'a58836ecf7dd0bce31b6cc0a41ee21641c3a5e46', width: "22", height: "19", viewBox: "0 0 22 19", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("g", { key: '119572170e51d5ab36fd7ad09513a09d1cfdb632', "clip-path": "url(#clip0_34208_4881)" }, index.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" })), index.h("defs", { key: 'b435fa99e9ab36cff1c5ee12df81d6644d1e8b3b' }, index.h("clipPath", { key: 'ea95f0abb5d9e08c8e95a8f345cd02917b3c46db', id: "clip0_34208_4881" }, index.h("path", { key: '2e5f0f1e4fd960e21614a46735acc0c869b87437', d: "M0.875 0.75H21.125V18.75H0.875V0.75Z", fill: "white" }))))), index.h("div", { key: 'c36d8d6aa53bdba02dea4a8885ad531f4bf55fe8', class: "title" }, "Adopt Signature")), index.h("div", { key: '9616e43bfd7dfcdb38acc54bff69eeab12239d94', slot: "content", class: "content" }, index.h("div", { key: '421ac8a9a88a53bd535c8202e383583181146e34', class: "tabs" }, index.h("div", { key: '8ebc6cc05e11553afa53685dc528c1e58e7bd43a', class: { tab: true, active: this.mode === 'type' }, onClick: () => (this.mode = 'type') }, index.h("div", { key: '22373fb7e6fdd5a78d5d36b5740da0a2fee38f8c', innerHTML: Keyboard, class: "icon" }), index.h("div", { key: '835b389a3e4b56a9c085650530c32f0af0354b17' }, "Type")), index.h("div", { key: '589afcff232ca9cef56cf042d9bac75884892974', class: { tab: true, active: this.mode === 'draw' }, onClick: () => (this.mode = 'draw') }, index.h("div", { key: '5573796f4f12093489e151a020da56ed0579956a', innerHTML: Pencil, class: "icon" }), index.h("div", { key: '12e652e05d33c50abd0b8b730562b45264c3e6c0' }, "Draw")), index.h("div", { key: '41a795695850d155991f2175acf203c674a51dad', class: { tab: true, active: this.mode === 'upload' }, onClick: () => (this.mode = 'upload') }, index.h("div", { key: '0c0248b88c77b3a1fb334f785b5bbbe389d31f97', innerHTML: Upload, class: "icon" }), index.h("div", { key: '04de2e449f9e6c943a219387d4c6340673e24041' }, "Upload"))), index.h("div", { key: '53fc1dcf9b5d29e613da7079a267c3e30625dfc7', class: { type: true, active: this.mode === 'type' } }, index.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() })), index.h("div", { key: 'fc156dcb001bd84b6db225840dcc95a9abab34bb', class: { draw: true, active: this.mode === 'draw' } }, index.h("div", { key: '299bd972c18922c192b21949069633e275da4d24', class: "draw-instructions" }, "Draw your signature below using your mouse or finger"), index.h("div", { key: 'fb3796bbd36fe6269392903a75268820a17858c0', class: "draw-actions" }, index.h("button", { key: 'ebe9b40d645352229a0be444c822314320387fd4', class: "clear-button", onClick: e => this.handleClearDrawing(e), disabled: !this.hasDrawnSignature }, "Clear"))), index.h("div", { key: 'c92a9661aabd3362dba6933f953f6cd8b32374e2', class: { upload: true, active: this.mode === 'upload' } }, index.h("div", { key: 'faf6d5d34f48e5eb078bc039f1a4c3dddbbe40c3', class: "upload-instructions" }, "Upload a PNG image of your signature"), index.h("input", { key: 'bf0f0e47f5db36b6d87b1e01f8781d29bbfcd63c', ref: el => (this.fileInputElement = el), type: "file", accept: "image/png", onChange: this.handleFileChange, style: { display: 'none' } }), index.h("div", { key: '54a1d918f66c6d0f2f4e7f7498410c50c204dd6d', class: "upload-actions" }, index.h("button", { key: '08b1536cec63081c48483d5da15cbea42b2e8e4f', class: "upload-button", onClick: this.handleSelectFile }, this.hasUploadedImage ? 'Change Image' : 'Select PNG File'), this.hasUploadedImage && (index.h("button", { key: 'e201f4042c323e4eb88f48a72f28e40bd06c5600', class: "clear-button", onClick: this.handleClearUpload }, "Clear"))), this.uploadedFileName && index.h("div", { key: '1a3b6b0a3dbb196ebd66302b6c50cb3238925532', class: "upload-filename" }, this.uploadedFileName)), index.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' } }), index.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.")), index.h("div", { key: 'c039995afc96ddebd96d8a974ffa41353cadb118', class: "footer", slot: "footer" }, index.h("div", { key: 'b87e6fdb90a30e049f03a40f7cf5a065858f7303', class: "buttons" }, index.h("button", { key: 'dd96285ada5f5428e8205dd13f405f5ee56a51ba', class: "cancel", onClick: e => this.handleCancel(e) }, "Cancel"), index.h("button", { key: '46b3af475fded0383a7590c2253a3dd39f1de9ca', class: "proceed", onClick: e => this.handleAdopt(e), disabled: this.isAdoptButtonDisabled() }, "Adopt & Sign")))));
2008
- }
2009
- };
2010
- VerdocsSignatureDialog.style = verdocsSignatureDialogCss;
2011
-
2012
1405
  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}";
2013
1406
 
2014
1407
  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>`;
@@ -2106,7 +1499,5 @@ exports.verdocs_field_signature = VerdocsFieldSignature;
2106
1499
  exports.verdocs_field_textarea = VerdocsFieldTextarea;
2107
1500
  exports.verdocs_field_textbox = VerdocsFieldTextbox;
2108
1501
  exports.verdocs_field_timestamp = VerdocsFieldTimestamp;
2109
- exports.verdocs_initial_dialog = VerdocsInitialDialog;
2110
- exports.verdocs_signature_dialog = VerdocsSignatureDialog;
2111
1502
  exports.verdocs_upload_dialog = VerdocsUploadDialog;
2112
- //# 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.cjs.js.map
1503
+ //# 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.cjs.js.map