@verdocs/web-sdk 6.13.0 → 6.13.2

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 (75) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/verdocs-download-dialog_4.cjs.entry.js +13 -4
  3. package/dist/cjs/verdocs-download-dialog_4.cjs.entry.js.map +1 -1
  4. package/dist/cjs/verdocs-preview_6.cjs.entry.js +47 -2
  5. package/dist/cjs/verdocs-preview_6.cjs.entry.js.map +1 -1
  6. package/dist/cjs/verdocs-sign.cjs.entry.js +42 -8
  7. package/dist/cjs/verdocs-sign.cjs.entry.js.map +1 -1
  8. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  9. package/dist/collection/components/embeds/verdocs-send/verdocs-send.css +55 -0
  10. package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +49 -1
  11. package/dist/collection/components/embeds/verdocs-send/verdocs-send.js.map +1 -1
  12. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +43 -8
  13. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
  14. package/dist/collection/components/envelopes/verdocs-sign-footer/verdocs-sign-footer.js +36 -4
  15. package/dist/collection/components/envelopes/verdocs-sign-footer/verdocs-sign-footer.js.map +1 -1
  16. package/dist/components/{p-BTrjJycH.js → p-06em1_P-.js} +2 -2
  17. package/dist/components/p-Blr31TcJ.js +2 -0
  18. package/dist/components/p-Blr31TcJ.js.map +1 -0
  19. package/dist/components/p-D495hZfr.js +2 -0
  20. package/dist/components/p-D495hZfr.js.map +1 -0
  21. package/dist/components/verdocs-build.js +1 -1
  22. package/dist/components/verdocs-send.js +1 -1
  23. package/dist/components/verdocs-sign-footer.js +1 -1
  24. package/dist/components/verdocs-sign.js +1 -1
  25. package/dist/components/verdocs-sign.js.map +1 -1
  26. package/dist/components/verdocs-view.js +1 -1
  27. package/dist/esm/loader.js +1 -1
  28. package/dist/esm/verdocs-download-dialog_4.entry.js +13 -4
  29. package/dist/esm/verdocs-download-dialog_4.entry.js.map +1 -1
  30. package/dist/esm/verdocs-preview_6.entry.js +48 -3
  31. package/dist/esm/verdocs-preview_6.entry.js.map +1 -1
  32. package/dist/esm/verdocs-sign.entry.js +42 -8
  33. package/dist/esm/verdocs-sign.entry.js.map +1 -1
  34. package/dist/esm/verdocs-web-sdk.js +1 -1
  35. package/dist/esm-es5/loader.js +1 -1
  36. package/dist/esm-es5/verdocs-download-dialog_4.entry.js +1 -1
  37. package/dist/esm-es5/verdocs-download-dialog_4.entry.js.map +1 -1
  38. package/dist/esm-es5/verdocs-preview_6.entry.js +2 -2
  39. package/dist/esm-es5/verdocs-preview_6.entry.js.map +1 -1
  40. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  41. package/dist/esm-es5/verdocs-sign.entry.js.map +1 -1
  42. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  43. package/dist/types/components/embeds/verdocs-send/verdocs-send.d.ts +15 -1
  44. package/dist/types/components/embeds/verdocs-sign/verdocs-sign.d.ts +2 -0
  45. package/dist/types/components/envelopes/verdocs-sign-footer/verdocs-sign-footer.d.ts +4 -0
  46. package/dist/types/components.d.ts +10 -0
  47. package/dist/verdocs-web-sdk/p-1b818cdf.entry.js +8 -0
  48. package/dist/verdocs-web-sdk/p-1b818cdf.entry.js.map +1 -0
  49. package/dist/verdocs-web-sdk/p-24dcc54e.system.entry.js +8 -0
  50. package/dist/verdocs-web-sdk/{p-987d5653.entry.js.map → p-24dcc54e.system.entry.js.map} +1 -1
  51. package/dist/verdocs-web-sdk/p-935267a6.entry.js +2 -0
  52. package/dist/verdocs-web-sdk/p-935267a6.entry.js.map +1 -0
  53. package/dist/verdocs-web-sdk/p-BdZ5Ghsa.system.js +1 -1
  54. package/dist/verdocs-web-sdk/p-a9899fce.system.entry.js +2 -0
  55. package/dist/verdocs-web-sdk/p-a9899fce.system.entry.js.map +1 -0
  56. package/dist/verdocs-web-sdk/{p-2e382167.entry.js → p-ea6c0b55.entry.js} +2 -2
  57. package/dist/verdocs-web-sdk/p-ea6c0b55.entry.js.map +1 -0
  58. package/dist/verdocs-web-sdk/{p-3f9102c4.system.entry.js → p-eccac670.system.entry.js} +2 -2
  59. package/dist/verdocs-web-sdk/p-eccac670.system.entry.js.map +1 -0
  60. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  61. package/package.json +3 -3
  62. package/dist/components/p-CnUZ9w2T.js +0 -2
  63. package/dist/components/p-CnUZ9w2T.js.map +0 -1
  64. package/dist/components/p-E2hWLZ47.js +0 -2
  65. package/dist/components/p-E2hWLZ47.js.map +0 -1
  66. package/dist/verdocs-web-sdk/p-2a6a3bc6.entry.js +0 -2
  67. package/dist/verdocs-web-sdk/p-2a6a3bc6.entry.js.map +0 -1
  68. package/dist/verdocs-web-sdk/p-2e382167.entry.js.map +0 -1
  69. package/dist/verdocs-web-sdk/p-3f9102c4.system.entry.js.map +0 -1
  70. package/dist/verdocs-web-sdk/p-5404f6bf.system.entry.js +0 -2
  71. package/dist/verdocs-web-sdk/p-5404f6bf.system.entry.js.map +0 -1
  72. package/dist/verdocs-web-sdk/p-788c8d67.system.entry.js +0 -8
  73. package/dist/verdocs-web-sdk/p-788c8d67.system.entry.js.map +0 -1
  74. package/dist/verdocs-web-sdk/p-987d5653.entry.js +0 -8
  75. /package/dist/components/{p-BTrjJycH.js.map → p-06em1_P-.js.map} +0 -0
@@ -60,6 +60,7 @@ const VerdocsSign = class {
60
60
  this.fatalErrorMessage = '';
61
61
  this.focusedField = '';
62
62
  this.disclosures = jsSdk.DEFAULT_DISCLOSURES;
63
+ this.brand = null;
63
64
  this.fieldUpdateCounter = 0;
64
65
  this.submitting = false;
65
66
  this.submitted = false;
@@ -262,10 +263,32 @@ const VerdocsSign = class {
262
263
  existing.remove();
263
264
  }
264
265
  }
266
+ // A brand saved from the detail form has colors but no CSS block of its own. Those colors still
267
+ // have to reach the signing UI, so a minimal block is built from them, using the same variables
268
+ // the Builder would have emitted.
269
+ synthesizeBrandCss(brand) {
270
+ const primary = typeof brand.primary_color === 'string' ? brand.primary_color.trim() : '';
271
+ if (!/^#[0-9a-f]{6}$/i.test(primary)) {
272
+ return '';
273
+ }
274
+ const shade = (hex, amount) => {
275
+ const channel = (i) => Math.round(Math.max(0, Math.min(255, parseInt(hex.slice(i, i + 2), 16) * (1 + amount))));
276
+ return `#${[1, 3, 5].map(i => channel(i).toString(16).padStart(2, '0')).join('')}`;
277
+ };
278
+ const secondary = typeof brand.secondary_color === 'string' && /^#[0-9a-f]{6}$/i.test(brand.secondary_color.trim()) ? brand.secondary_color.trim() : primary;
279
+ return [
280
+ ':root, .verdocs-custom-theme {',
281
+ ` --verdocs-primary-color: ${primary};`,
282
+ ` --verdocs-primary-color-hover: ${shade(primary, -0.14)};`,
283
+ ` --verdocs-link-color: ${secondary};`,
284
+ ` --verdocs-checkbox-color: ${primary};`,
285
+ '}',
286
+ ].join('\n');
287
+ }
265
288
  applyBrandStyleOverrides(brand) {
266
289
  const styleId = this.getBrandStyleOverridesId();
267
290
  const existing = document.getElementById(styleId);
268
- const overrides = brand === null || brand === void 0 ? void 0 : brand.style_overrides;
291
+ const overrides = brand ? (typeof brand.style_overrides === 'string' && brand.style_overrides.trim() ? brand.style_overrides : this.synthesizeBrandCss(brand)) : '';
269
292
  if (typeof overrides === 'string' && overrides.length > 0) {
270
293
  const styleEl = existing || document.createElement('style');
271
294
  styleEl.id = styleId;
@@ -279,15 +302,25 @@ const VerdocsSign = class {
279
302
  }
280
303
  }
281
304
  processAuthResponse(response) {
282
- var _a, _b, _c, _d;
305
+ var _a, _b, _c, _d, _e;
283
306
  const { envelope, recipient, brand } = response;
284
307
  (_a = envelope.documents) === null || _a === void 0 ? void 0 : _a.sort((a, b) => (a.order !== b.order ? a.order - b.order : a.created_at.localeCompare(b.created_at)));
285
308
  const { auth_step } = recipient;
286
309
  this.recipient = recipient;
287
310
  this.envelope = envelope;
288
- this.disclosures = ((_c = (_b = this.envelope) === null || _b === void 0 ? void 0 : _b.organization) === null || _c === void 0 ? void 0 : _c.disclaimer) || jsSdk.DEFAULT_DISCLOSURES;
289
- this.applyOrgStyleOverrides();
290
- this.applyBrandStyleOverrides(brand);
311
+ this.brand = brand || null;
312
+ this.disclosures = (brand === null || brand === void 0 ? void 0 : brand.disclaimer) || ((_c = (_b = this.envelope) === null || _b === void 0 ? void 0 : _b.organization) === null || _c === void 0 ? void 0 : _c.disclaimer) || jsSdk.DEFAULT_DISCLOSURES;
313
+ // A resolved brand (the envelope's own, or the organization's default) replaces the
314
+ // organization's legacy CSS block outright. Applying both let the older block's direct
315
+ // header and button rules beat the brand's variables, so the brand never showed.
316
+ if (brand) {
317
+ (_d = document.getElementById(this.getOrgStyleOverridesId())) === null || _d === void 0 ? void 0 : _d.remove();
318
+ this.applyBrandStyleOverrides(brand);
319
+ }
320
+ else {
321
+ this.applyOrgStyleOverrides();
322
+ this.applyBrandStyleOverrides(null);
323
+ }
291
324
  this.authStep = auth_step;
292
325
  this.delegated = !!recipient.delegated_to;
293
326
  this.agreed = recipient.agreed;
@@ -324,7 +357,7 @@ const VerdocsSign = class {
324
357
  this.nextButtonLabel = 'Next';
325
358
  }
326
359
  this.checkRecipientFields();
327
- (_d = this.envelopeLoaded) === null || _d === void 0 ? void 0 : _d.emit({ endpoint: this.endpoint, envelope: this.envelope });
360
+ (_e = this.envelopeLoaded) === null || _e === void 0 ? void 0 : _e.emit({ endpoint: this.endpoint, envelope: this.envelope });
328
361
  }
329
362
  handleClickAgree() {
330
363
  this.submitting = true;
@@ -1162,7 +1195,8 @@ const VerdocsSign = class {
1162
1195
  const totalPages = this.envelope.documents.reduce((acc, doc) => acc + doc.pages, 0);
1163
1196
  const pageOptions = jsSdk.integerSequence(1, totalPages).map(p => ({ label: p.toString(), value: p.toString() }));
1164
1197
  let globalPageCounter = 0;
1165
- return (index.h(index.Host, null, this.toolbarStyle === 'menu' && (index.h("div", { id: "verdocs-sign-header" }, index.h("div", { class: "inner" }, index.h("div", { class: "title" }, this.envelope.name), index.h("div", { style: { flex: '1' } }), !this.finishLater && !this.submitted &&
1198
+ return (index.h(index.Host, null, this.toolbarStyle === 'menu' && (index.h("div", { id: "verdocs-sign-header" }, index.h("div", { class: "inner" }, index.h("div", { class: "title" }, this.envelope.name), index.h("div", { style: { flex: '1' } }), !this.finishLater &&
1199
+ !this.submitted &&
1166
1200
  (() => {
1167
1201
  const remaining = this.getRequiredTotalCount() - this.getRequiredFilledCount();
1168
1202
  const optionalLeft = this.getOptionalUnfilledCount();
@@ -1230,7 +1264,7 @@ const VerdocsSign = class {
1230
1264
  }, 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", { signed: this.envelope.signed, polling: this.polling, documents: this.envelope.documents, onExit: () => {
1231
1265
  this.showDownloadDialog = false;
1232
1266
  this.stopPolling();
1233
- }, onDownload: e => this.handleOnDownload(e) })), !this.loading && !this.isDone && !this.submitted && (index.h("verdocs-sign-footer", { endpoint: this.endpoint, envelopeId: this.envelopeId, isDone: this.isDone, onAskQuestion: (e) => {
1267
+ }, onDownload: e => this.handleOnDownload(e) })), !this.loading && !this.isDone && !this.submitted && (index.h("verdocs-sign-footer", { endpoint: this.endpoint, envelopeId: this.envelopeId, brand: this.brand, isDone: this.isDone, onAskQuestion: (e) => {
1234
1268
  jsSdk.askQuestion(this.endpoint, this.envelopeId, this.roleId, { question: e.detail.question })
1235
1269
  .then(() => Toast.VerdocsToast('Your question has been sent.', { style: 'success' }))
1236
1270
  .catch(e => {