@verdocs/web-sdk 6.5.0-beta.22 → 6.5.0-beta.23

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.
@@ -1,10 +1,10 @@
1
1
  import { Host, Fragment, h } from "@stencil/core";
2
- import { uploadEnvelopeFieldAttachment, VerdocsEndpoint, getEnvelopeDocumentDownloadLink, getEnvelopesZip } from "@verdocs/js-sdk";
3
2
  import { askQuestion, DEFAULT_DISCLOSURES, integerSequence, isFieldFilled, isFieldValid } from "@verdocs/js-sdk";
4
3
  import { verifySigner } from "@verdocs/js-sdk";
5
4
  import { fullNameToInitials, startSigningSession, deleteEnvelopeFieldAttachment, formatFullName } from "@verdocs/js-sdk";
6
5
  import { updateEnvelopeField, sortFields, delegateRecipient } from "@verdocs/js-sdk";
7
6
  import { createInitials, createSignature, envelopeRecipientAgree, envelopeRecipientDecline, envelopeRecipientSubmit } from "@verdocs/js-sdk";
7
+ import { uploadEnvelopeFieldAttachment, VerdocsEndpoint, getEnvelopeDocumentDownloadLink, getEnvelopesZip } from "@verdocs/js-sdk";
8
8
  import { getFieldId, renderDocumentField, renderDocumentFlag, updateDocumentFieldValue, defaultHeight } from "../../../utils/utils";
9
9
  import { DocumentPageIcon } from "../../../utils/Icons";
10
10
  import { VerdocsToast } from "../../../utils/Toast";
@@ -501,14 +501,14 @@ export class VerdocsSign {
501
501
  sortFields(recipientFields);
502
502
  return recipientFields;
503
503
  }
504
- handleNext() {
504
+ async handleNext() {
505
505
  var _a;
506
506
  if (this.nextSubmits) {
507
507
  try {
508
508
  // Patches the date picker to be forcibly removed if still showing during submission
509
509
  (_a = document.getElementById('air-datepicker-global-container')) === null || _a === void 0 ? void 0 : _a.remove();
510
510
  this.submitting = true;
511
- const result = envelopeRecipientSubmit(this.endpoint, this.envelopeId, this.roleId);
511
+ const result = await envelopeRecipientSubmit(this.endpoint, this.envelopeId, this.roleId);
512
512
  console.log('[SIGN] Submitted successfully', result);
513
513
  // TODO: The "proper" way is generating an error from Stencil
514
514
  // NotFoundError: Failed to execute 'insertBefore' on 'Node': The node before which
@@ -517,6 +517,8 @@ export class VerdocsSign {
517
517
  }
518
518
  catch (e) {
519
519
  console.log('[SIGN] Error submitting', e);
520
+ this.submitting = false;
521
+ VerdocsToast('Unable to submit document, please try again.', { style: 'error' });
520
522
  }
521
523
  return;
522
524
  }
@@ -988,22 +990,6 @@ export class VerdocsSign {
988
990
  this.initialId = initResult.id;
989
991
  this.showSpinner = false;
990
992
  this.adoptingSignature = false;
991
- // If we have a focused field, we should auto-apply the new signature/initials to it
992
- if (this.focusedField) {
993
- const field = this.getRecipientFields().find(f => f.name === this.focusedField);
994
- if (field) {
995
- console.log('[SIGN] Auto-applying adopted signature to focused field', field.name);
996
- if (field.type === 'signature') {
997
- const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.signatureId, false);
998
- this.updateRecipientFieldValue(field.name, updateResult);
999
- }
1000
- else if (field.type === 'initial') {
1001
- const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.initialId, false);
1002
- this.updateRecipientFieldValue(field.name, updateResult);
1003
- }
1004
- this.checkRecipientFields();
1005
- }
1006
- }
1007
993
  }, onExit: () => (this.adoptingSignature = false) })), (this.submitting || this.showSpinner) && (h("verdocs-portal", null, h("div", { class: "spinner-overlay" }, h("verdocs-spinner", null)))), this.showDownloadDialog && (h("verdocs-download-dialog", { hasCertificate: (_b = (_a = this.envelope) === null || _a === void 0 ? void 0 : _a.documents) === null || _b === void 0 ? void 0 : _b.some(d => d.type === 'certificate'), onExit: () => (this.showDownloadDialog = false), onNext: async (e) => {
1008
994
  this.showDownloadDialog = false;
1009
995
  const { action } = e.detail;
@@ -1017,15 +1003,6 @@ export class VerdocsSign {
1017
1003
  window.open(url, '_blank');
1018
1004
  }
1019
1005
  else {
1020
- // If multiple docs, we might want to zip them or just download the first one for now as per previous logic?
1021
- // The requirement says "Document", implies the PDF.
1022
- // Users might have multiple files though.
1023
- // For now let's just do the zip of everything if multiple? Or loop?
1024
- // Let's stick to the previous behavior "firstDoc" strategy if we can't do better,
1025
- // or use getEnvelopeDocumentDownloadLink for each?
1026
- // Best user experience for "Document" if multiple is probably just the first one or a zip of docs.
1027
- // But "All Files" covers zip.
1028
- // Let's assume the main document is the primary intent.
1029
1006
  const firstDoc = attachments[0];
1030
1007
  if (firstDoc) {
1031
1008
  const url = await getEnvelopeDocumentDownloadLink(this.endpoint, firstDoc.id);
@@ -1104,7 +1081,7 @@ export class VerdocsSign {
1104
1081
  },
1105
1082
  "getter": false,
1106
1083
  "setter": false,
1107
- "defaultValue": "new VerdocsEndpoint({ sessionType: 'signing' })"
1084
+ "defaultValue": "new VerdocsEndpoint({sessionType: 'signing'})"
1108
1085
  },
1109
1086
  "envelopeId": {
1110
1087
  "type": "string",
@@ -1279,7 +1256,7 @@ export class VerdocsSign {
1279
1256
  "text": "Event fired when the envelope is loaded for the first time."
1280
1257
  },
1281
1258
  "complexType": {
1282
- "original": "{ endpoint: VerdocsEndpoint; envelope: IEnvelope }",
1259
+ "original": "{endpoint: VerdocsEndpoint; envelope: IEnvelope}",
1283
1260
  "resolved": "{ endpoint: VerdocsEndpoint; envelope: IEnvelope; }",
1284
1261
  "references": {
1285
1262
  "VerdocsEndpoint": {
@@ -1305,7 +1282,7 @@ export class VerdocsSign {
1305
1282
  "text": "Event fired when the envelope is updated in any way."
1306
1283
  },
1307
1284
  "complexType": {
1308
- "original": "{ endpoint: VerdocsEndpoint; envelope: IEnvelope; event: string }",
1285
+ "original": "{endpoint: VerdocsEndpoint; envelope: IEnvelope; event: string}",
1309
1286
  "resolved": "{ endpoint: VerdocsEndpoint; envelope: IEnvelope; event: string; }",
1310
1287
  "references": {
1311
1288
  "VerdocsEndpoint": {