@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.
@@ -480,14 +480,14 @@ const VerdocsSign = class {
480
480
  jsSdk.sortFields(recipientFields);
481
481
  return recipientFields;
482
482
  }
483
- handleNext() {
483
+ async handleNext() {
484
484
  var _a;
485
485
  if (this.nextSubmits) {
486
486
  try {
487
487
  // Patches the date picker to be forcibly removed if still showing during submission
488
488
  (_a = document.getElementById('air-datepicker-global-container')) === null || _a === void 0 ? void 0 : _a.remove();
489
489
  this.submitting = true;
490
- const result = jsSdk.envelopeRecipientSubmit(this.endpoint, this.envelopeId, this.roleId);
490
+ const result = await jsSdk.envelopeRecipientSubmit(this.endpoint, this.envelopeId, this.roleId);
491
491
  console.log('[SIGN] Submitted successfully', result);
492
492
  // TODO: The "proper" way is generating an error from Stencil
493
493
  // NotFoundError: Failed to execute 'insertBefore' on 'Node': The node before which
@@ -496,6 +496,8 @@ const VerdocsSign = class {
496
496
  }
497
497
  catch (e) {
498
498
  console.log('[SIGN] Error submitting', e);
499
+ this.submitting = false;
500
+ Toast.VerdocsToast('Unable to submit document, please try again.', { style: 'error' });
499
501
  }
500
502
  return;
501
503
  }
@@ -967,22 +969,6 @@ const VerdocsSign = class {
967
969
  this.initialId = initResult.id;
968
970
  this.showSpinner = false;
969
971
  this.adoptingSignature = false;
970
- // If we have a focused field, we should auto-apply the new signature/initials to it
971
- if (this.focusedField) {
972
- const field = this.getRecipientFields().find(f => f.name === this.focusedField);
973
- if (field) {
974
- console.log('[SIGN] Auto-applying adopted signature to focused field', field.name);
975
- if (field.type === 'signature') {
976
- const updateResult = await jsSdk.updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.signatureId, false);
977
- this.updateRecipientFieldValue(field.name, updateResult);
978
- }
979
- else if (field.type === 'initial') {
980
- const updateResult = await jsSdk.updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.initialId, false);
981
- this.updateRecipientFieldValue(field.name, updateResult);
982
- }
983
- this.checkRecipientFields();
984
- }
985
- }
986
972
  }, onExit: () => (this.adoptingSignature = false) })), (this.submitting || this.showSpinner) && (index.h("verdocs-portal", null, index.h("div", { class: "spinner-overlay" }, index.h("verdocs-spinner", null)))), this.showDownloadDialog && (index.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) => {
987
973
  this.showDownloadDialog = false;
988
974
  const { action } = e.detail;
@@ -996,15 +982,6 @@ const VerdocsSign = class {
996
982
  window.open(url, '_blank');
997
983
  }
998
984
  else {
999
- // If multiple docs, we might want to zip them or just download the first one for now as per previous logic?
1000
- // The requirement says "Document", implies the PDF.
1001
- // Users might have multiple files though.
1002
- // For now let's just do the zip of everything if multiple? Or loop?
1003
- // Let's stick to the previous behavior "firstDoc" strategy if we can't do better,
1004
- // or use getEnvelopeDocumentDownloadLink for each?
1005
- // Best user experience for "Document" if multiple is probably just the first one or a zip of docs.
1006
- // But "All Files" covers zip.
1007
- // Let's assume the main document is the primary intent.
1008
985
  const firstDoc = attachments[0];
1009
986
  if (firstDoc) {
1010
987
  const url = await jsSdk.getEnvelopeDocumentDownloadLink(this.endpoint, firstDoc.id);