@verdocs/web-sdk 4.2.132 → 4.2.134

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.
@@ -4,8 +4,8 @@ import { g as getTemplateFieldStore, u as updateStoreField } from './TemplateFie
4
4
  import { g as getTemplateRoleStore, b as getRoleNames, a as getRoleIndex, u as updateStoreRole } from './TemplateRoleStore-6d1bec83.js';
5
5
  import { g as getTemplateStore } from './TemplateStore-41799d0a.js';
6
6
  import { S as SDKError } from './errors-887f1e88.js';
7
- import { D as DocIcon, P as PngIcon, J as JpgIcon, a as PdfIcon, F as FileIcon$1, b as PageCountIcon, T as TrashIcon } from './Icons-faf0377f.js';
8
7
  import { V as VerdocsToast } from './Toast-c4843828.js';
8
+ import { D as DocIcon, P as PngIcon, J as JpgIcon, a as PdfIcon, F as FileIcon$1, b as PageCountIcon, T as TrashIcon } from './Icons-faf0377f.js';
9
9
  import { f as format } from './format-b8602175.js';
10
10
  import { i as interact } from './interact.min-a71beb3d.js';
11
11
  import { b as updateCssTransform, c as removeCssTransform, g as getFieldId, d as defaultWidth, e as defaultHeight } from './utils-6ecd6558.js';
@@ -258,7 +258,7 @@ const VerdocsSend = class {
258
258
  (_a = this.sendingEnvelope) === null || _a === void 0 ? void 0 : _a.emit({ sending: true });
259
259
  const details = {
260
260
  template_id: this.templateId,
261
- name: (_c = (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.name,
261
+ name: ((_c = (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.name) || '',
262
262
  environment: this.environment,
263
263
  // TODO: Make optional in the SDK
264
264
  initial_reminder: 0,
@@ -270,19 +270,19 @@ const VerdocsSend = class {
270
270
  console.log('[SEND] Creating envelope', details);
271
271
  createEnvelope(this.endpoint, details)
272
272
  .then(r => {
273
- var _a, _b;
273
+ var _a, _b, _c, _d;
274
274
  console.log('[SEND] Send envelope', r);
275
275
  this.reset().catch((e) => console.log('Unknown Error', e));
276
276
  this.sending = false;
277
277
  (_a = this.sendingEnvelope) === null || _a === void 0 ? void 0 : _a.emit({ sending: false });
278
- (_b = this.send) === null || _b === void 0 ? void 0 : _b.emit({ ...details, envelope_id: r.id, envelope: r });
278
+ (_b = this.send) === null || _b === void 0 ? void 0 : _b.emit({ ...details, name: ((_d = (_c = this.templateStore) === null || _c === void 0 ? void 0 : _c.state) === null || _d === void 0 ? void 0 : _d.name) || 'New Envelope', envelope_id: r.id, envelope: r });
279
279
  })
280
280
  .catch(e => {
281
- var _a;
281
+ var _a, _b, _c;
282
282
  console.log('Send error', e);
283
- // toast.error(e.response?.data?.message || 'Unknown error creating envelope');
283
+ VerdocsToast(((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.message) || 'Error creating envelope, please try again later.');
284
284
  this.sending = false;
285
- (_a = this.sendingEnvelope) === null || _a === void 0 ? void 0 : _a.emit({ sending: false });
285
+ (_c = this.sendingEnvelope) === null || _c === void 0 ? void 0 : _c.emit({ sending: false });
286
286
  });
287
287
  }
288
288
  handleCancel(e) {
@@ -261,11 +261,17 @@ const VerdocsSign = class {
261
261
  if (!e.detail) {
262
262
  return;
263
263
  }
264
+ this.showSpinner = true;
264
265
  const initialsBlob = await (await fetch(e.detail)).blob();
265
266
  return createInitials(this.endpoint, 'initial', initialsBlob) //
266
267
  .then(async (newInitials) => {
267
268
  const updateResult = await updateEnvelopeFieldInitials(this.endpoint, this.envelopeId, field.name, newInitials.id);
268
269
  this.updateRecipientFieldValue(field.name, updateResult);
270
+ this.showSpinner = false;
271
+ })
272
+ .catch(e => {
273
+ console.log('Error updating initials', e);
274
+ this.showSpinner = false;
269
275
  });
270
276
  case 'signature':
271
277
  // This can be caused by a focus-out event if the user clicks the field
@@ -274,15 +280,18 @@ const VerdocsSign = class {
274
280
  if (!e.detail) {
275
281
  return;
276
282
  }
283
+ this.showSpinner = true;
277
284
  const signatureBlob = await (await fetch(e.detail)).blob();
278
285
  return createSignature(this.endpoint, 'signature', signatureBlob) //
279
286
  .then(async (newSignature) => {
280
287
  console.log('Signature update result', newSignature);
281
288
  const updateResult = await updateEnvelopeFieldSignature(this.endpoint, this.envelopeId, field.name, newSignature.id);
282
289
  this.updateRecipientFieldValue(field.name, updateResult);
290
+ this.showSpinner = false;
283
291
  })
284
292
  .catch(e => {
285
293
  console.warn('[SIGN] Error updating signature', e);
294
+ this.showSpinner = false;
286
295
  });
287
296
  case 'date':
288
297
  const { formattedDate } = e.detail;
@@ -447,7 +456,6 @@ const VerdocsSign = class {
447
456
  }
448
457
  });
449
458
  el.addEventListener('attached', async (e) => {
450
- // TODO: Show a spinner and/or progress bar
451
459
  console.log('[SIGN] onAttached', e.detail, e.target.value);
452
460
  this.showSpinner = true;
453
461
  try {
@@ -510,7 +518,6 @@ const VerdocsSign = class {
510
518
  if (field.page !== pageInfo.pageNumber) {
511
519
  return;
512
520
  }
513
- // TODO: Review possible workflow/race conditions vs rendering in -document-page.
514
521
  const el = renderDocumentField(field, pageInfo, { disabled: false, editable: false, draggable: false, done: this.isDone }, tabIndex);
515
522
  if (!el) {
516
523
  return;
@@ -620,7 +627,8 @@ const VerdocsSign = class {
620
627
  e.stopPropagation();
621
628
  // We don't allow this to be hidden
622
629
  // this.showDeclined = false;
623
- } })), this.submitting && (h("div", { class: "loading-indicator" }, h("verdocs-loader", null))), this.showSpinner && (h("verdocs-portal", null, h("div", { class: "spinner-overlay" }, h("verdocs-spinner", null))))));
630
+ } })), this.submitting ||
631
+ (this.showSpinner && (h("verdocs-portal", null, h("div", { class: "spinner-overlay" }, h("verdocs-spinner", null)))))));
624
632
  }
625
633
  };
626
634
  VerdocsSign.style = VerdocsSignStyle0;