@verdocs/web-sdk 5.0.22 → 5.0.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. package/dist/cjs/verdocs-preview_6.cjs.entry.js +13 -9
  2. package/dist/cjs/verdocs-preview_6.cjs.entry.js.map +1 -1
  3. package/dist/cjs/verdocs-sign.cjs.entry.js +1 -2
  4. package/dist/cjs/verdocs-sign.cjs.entry.js.map +1 -1
  5. package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +25 -15
  6. package/dist/collection/components/embeds/verdocs-send/verdocs-send.js.map +1 -1
  7. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.css +2 -0
  8. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +0 -1
  9. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
  10. package/dist/components/{p-b8885b5c.js → p-ca3e45f3.js} +14 -10
  11. package/dist/components/p-ca3e45f3.js.map +1 -0
  12. package/dist/components/verdocs-build.js +1 -1
  13. package/dist/components/verdocs-send.js +1 -1
  14. package/dist/components/verdocs-sign.js +1 -2
  15. package/dist/components/verdocs-sign.js.map +1 -1
  16. package/dist/esm/verdocs-preview_6.entry.js +13 -9
  17. package/dist/esm/verdocs-preview_6.entry.js.map +1 -1
  18. package/dist/esm/verdocs-sign.entry.js +1 -2
  19. package/dist/esm/verdocs-sign.entry.js.map +1 -1
  20. package/dist/esm-es5/verdocs-preview_6.entry.js +1 -1
  21. package/dist/esm-es5/verdocs-preview_6.entry.js.map +1 -1
  22. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  23. package/dist/esm-es5/verdocs-sign.entry.js.map +1 -1
  24. package/dist/types/components/embeds/verdocs-send/verdocs-send.d.ts +6 -4
  25. package/dist/types/components.d.ts +13 -13
  26. package/dist/verdocs-web-sdk/p-23d6f064.entry.js +2 -0
  27. package/dist/verdocs-web-sdk/p-23d6f064.entry.js.map +1 -0
  28. package/dist/verdocs-web-sdk/{p-51c7f852.system.entry.js → p-80952d72.system.entry.js} +3 -3
  29. package/dist/verdocs-web-sdk/p-80952d72.system.entry.js.map +1 -0
  30. package/dist/verdocs-web-sdk/{p-3701b851.entry.js → p-b1a9dc79.entry.js} +3 -3
  31. package/dist/verdocs-web-sdk/p-b1a9dc79.entry.js.map +1 -0
  32. package/dist/verdocs-web-sdk/p-c4a10e58.system.entry.js +2 -0
  33. package/dist/verdocs-web-sdk/p-c4a10e58.system.entry.js.map +1 -0
  34. package/dist/verdocs-web-sdk/p-e2b70dfb.system.js +1 -1
  35. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  36. package/package.json +1 -1
  37. package/dist/components/p-b8885b5c.js.map +0 -1
  38. package/dist/custom-elements.json +0 -2156
  39. package/dist/verdocs-web-sdk/p-0bfebc86.entry.js +0 -2
  40. package/dist/verdocs-web-sdk/p-0bfebc86.entry.js.map +0 -1
  41. package/dist/verdocs-web-sdk/p-3701b851.entry.js.map +0 -1
  42. package/dist/verdocs-web-sdk/p-376c3d9d.system.entry.js +0 -2
  43. package/dist/verdocs-web-sdk/p-376c3d9d.system.entry.js.map +0 -1
  44. package/dist/verdocs-web-sdk/p-51c7f852.system.entry.js.map +0 -1
@@ -108,7 +108,7 @@ const doneIcon = '<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24"
108
108
  const VerdocsSend = class {
109
109
  constructor(hostRef) {
110
110
  index$1.registerInstance(this, hostRef);
111
- this.sendingEnvelope = index$1.createEvent(this, "sendingEnvelope", 7);
111
+ this.beforeSend = index$1.createEvent(this, "beforeSend", 7);
112
112
  this.send = index$1.createEvent(this, "send", 7);
113
113
  this.exit = index$1.createEvent(this, "exit", 7);
114
114
  this.sdkError = index$1.createEvent(this, "sdkError", 7);
@@ -250,7 +250,7 @@ const VerdocsSend = class {
250
250
  this.showPickerForId = role.id;
251
251
  }
252
252
  handleSend(e) {
253
- var _a, _b;
253
+ var _a;
254
254
  if (this.sending) {
255
255
  console.log('[SEND] Skipping duplicate send', e);
256
256
  return;
@@ -259,10 +259,9 @@ const VerdocsSend = class {
259
259
  e.preventDefault();
260
260
  e.stopPropagation();
261
261
  this.sending = true;
262
- (_a = this.sendingEnvelope) === null || _a === void 0 ? void 0 : _a.emit({ sending: true });
263
262
  const details = {
264
263
  template_id: this.templateId,
265
- name: ((_b = this.template) === null || _b === void 0 ? void 0 : _b.name) || 'New Envelope',
264
+ name: ((_a = this.template) === null || _a === void 0 ? void 0 : _a.name) || 'New Envelope',
266
265
  environment: this.environment,
267
266
  initial_reminder: 0,
268
267
  followup_reminders: 0,
@@ -270,22 +269,27 @@ const VerdocsSend = class {
270
269
  // TODO: Pre-filled fields support
271
270
  fields: [],
272
271
  };
272
+ const beforeSendResult = this.beforeSend.emit({ ...details, name: details.name });
273
+ if (beforeSendResult.defaultPrevented) {
274
+ console.log('[SEND] Send cancelled by parent', details);
275
+ this.sending = false;
276
+ return;
277
+ }
273
278
  console.log('[SEND] Creating envelope', details);
274
279
  jsSdk.createEnvelope(this.endpoint, details)
275
280
  .then(r => {
276
- var _a, _b;
281
+ var _a;
277
282
  console.log('[SEND] Send envelope', r);
278
283
  this.reset().catch((e) => console.log('Unknown Error', e));
279
284
  this.sending = false;
280
- (_a = this.sendingEnvelope) === null || _a === void 0 ? void 0 : _a.emit({ sending: false });
281
- (_b = this.send) === null || _b === void 0 ? void 0 : _b.emit({ ...details, name: details.name, envelope_id: r.id, envelope: r });
285
+ (_a = this.send) === null || _a === void 0 ? void 0 : _a.emit({ ...details, name: details.name, envelope_id: r.id, envelope: r });
282
286
  })
283
287
  .catch(e => {
284
288
  var _a, _b, _c;
285
- console.log('Send error', e);
289
+ console.log('[SEND] Send error', e);
286
290
  Toast.VerdocsToast(((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) || 'Error creating envelope, please try again later.');
287
291
  this.sending = false;
288
- (_c = this.sendingEnvelope) === null || _c === void 0 ? void 0 : _c.emit({ sending: false });
292
+ (_c = this.sdkError) === null || _c === void 0 ? void 0 : _c.emit(e);
289
293
  });
290
294
  }
291
295
  handleCancel(e) {