@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
@@ -58,6 +58,7 @@ const VerdocsSign = class {
58
58
  this.fatalErrorMessage = '';
59
59
  this.focusedField = '';
60
60
  this.disclosures = DEFAULT_DISCLOSURES;
61
+ this.brand = null;
61
62
  this.fieldUpdateCounter = 0;
62
63
  this.submitting = false;
63
64
  this.submitted = false;
@@ -260,10 +261,32 @@ const VerdocsSign = class {
260
261
  existing.remove();
261
262
  }
262
263
  }
264
+ // A brand saved from the detail form has colors but no CSS block of its own. Those colors still
265
+ // have to reach the signing UI, so a minimal block is built from them, using the same variables
266
+ // the Builder would have emitted.
267
+ synthesizeBrandCss(brand) {
268
+ const primary = typeof brand.primary_color === 'string' ? brand.primary_color.trim() : '';
269
+ if (!/^#[0-9a-f]{6}$/i.test(primary)) {
270
+ return '';
271
+ }
272
+ const shade = (hex, amount) => {
273
+ const channel = (i) => Math.round(Math.max(0, Math.min(255, parseInt(hex.slice(i, i + 2), 16) * (1 + amount))));
274
+ return `#${[1, 3, 5].map(i => channel(i).toString(16).padStart(2, '0')).join('')}`;
275
+ };
276
+ const secondary = typeof brand.secondary_color === 'string' && /^#[0-9a-f]{6}$/i.test(brand.secondary_color.trim()) ? brand.secondary_color.trim() : primary;
277
+ return [
278
+ ':root, .verdocs-custom-theme {',
279
+ ` --verdocs-primary-color: ${primary};`,
280
+ ` --verdocs-primary-color-hover: ${shade(primary, -0.14)};`,
281
+ ` --verdocs-link-color: ${secondary};`,
282
+ ` --verdocs-checkbox-color: ${primary};`,
283
+ '}',
284
+ ].join('\n');
285
+ }
263
286
  applyBrandStyleOverrides(brand) {
264
287
  const styleId = this.getBrandStyleOverridesId();
265
288
  const existing = document.getElementById(styleId);
266
- const overrides = brand === null || brand === void 0 ? void 0 : brand.style_overrides;
289
+ const overrides = brand ? (typeof brand.style_overrides === 'string' && brand.style_overrides.trim() ? brand.style_overrides : this.synthesizeBrandCss(brand)) : '';
267
290
  if (typeof overrides === 'string' && overrides.length > 0) {
268
291
  const styleEl = existing || document.createElement('style');
269
292
  styleEl.id = styleId;
@@ -277,15 +300,25 @@ const VerdocsSign = class {
277
300
  }
278
301
  }
279
302
  processAuthResponse(response) {
280
- var _a, _b, _c, _d;
303
+ var _a, _b, _c, _d, _e;
281
304
  const { envelope, recipient, brand } = response;
282
305
  (_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)));
283
306
  const { auth_step } = recipient;
284
307
  this.recipient = recipient;
285
308
  this.envelope = envelope;
286
- this.disclosures = ((_c = (_b = this.envelope) === null || _b === void 0 ? void 0 : _b.organization) === null || _c === void 0 ? void 0 : _c.disclaimer) || DEFAULT_DISCLOSURES;
287
- this.applyOrgStyleOverrides();
288
- this.applyBrandStyleOverrides(brand);
309
+ this.brand = brand || null;
310
+ 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) || DEFAULT_DISCLOSURES;
311
+ // A resolved brand (the envelope's own, or the organization's default) replaces the
312
+ // organization's legacy CSS block outright. Applying both let the older block's direct
313
+ // header and button rules beat the brand's variables, so the brand never showed.
314
+ if (brand) {
315
+ (_d = document.getElementById(this.getOrgStyleOverridesId())) === null || _d === void 0 ? void 0 : _d.remove();
316
+ this.applyBrandStyleOverrides(brand);
317
+ }
318
+ else {
319
+ this.applyOrgStyleOverrides();
320
+ this.applyBrandStyleOverrides(null);
321
+ }
289
322
  this.authStep = auth_step;
290
323
  this.delegated = !!recipient.delegated_to;
291
324
  this.agreed = recipient.agreed;
@@ -322,7 +355,7 @@ const VerdocsSign = class {
322
355
  this.nextButtonLabel = 'Next';
323
356
  }
324
357
  this.checkRecipientFields();
325
- (_d = this.envelopeLoaded) === null || _d === void 0 ? void 0 : _d.emit({ endpoint: this.endpoint, envelope: this.envelope });
358
+ (_e = this.envelopeLoaded) === null || _e === void 0 ? void 0 : _e.emit({ endpoint: this.endpoint, envelope: this.envelope });
326
359
  }
327
360
  handleClickAgree() {
328
361
  this.submitting = true;
@@ -1160,7 +1193,8 @@ const VerdocsSign = class {
1160
1193
  const totalPages = this.envelope.documents.reduce((acc, doc) => acc + doc.pages, 0);
1161
1194
  const pageOptions = integerSequence(1, totalPages).map(p => ({ label: p.toString(), value: p.toString() }));
1162
1195
  let globalPageCounter = 0;
1163
- return (h(Host, null, this.toolbarStyle === 'menu' && (h("div", { id: "verdocs-sign-header" }, h("div", { class: "inner" }, h("div", { class: "title" }, this.envelope.name), h("div", { style: { flex: '1' } }), !this.finishLater && !this.submitted &&
1196
+ return (h(Host, null, this.toolbarStyle === 'menu' && (h("div", { id: "verdocs-sign-header" }, h("div", { class: "inner" }, h("div", { class: "title" }, this.envelope.name), h("div", { style: { flex: '1' } }), !this.finishLater &&
1197
+ !this.submitted &&
1164
1198
  (() => {
1165
1199
  const remaining = this.getRequiredTotalCount() - this.getRequiredFilledCount();
1166
1200
  const optionalLeft = this.getOptionalUnfilledCount();
@@ -1228,7 +1262,7 @@ const VerdocsSign = class {
1228
1262
  }, 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", { signed: this.envelope.signed, polling: this.polling, documents: this.envelope.documents, onExit: () => {
1229
1263
  this.showDownloadDialog = false;
1230
1264
  this.stopPolling();
1231
- }, onDownload: e => this.handleOnDownload(e) })), !this.loading && !this.isDone && !this.submitted && (h("verdocs-sign-footer", { endpoint: this.endpoint, envelopeId: this.envelopeId, isDone: this.isDone, onAskQuestion: (e) => {
1265
+ }, onDownload: e => this.handleOnDownload(e) })), !this.loading && !this.isDone && !this.submitted && (h("verdocs-sign-footer", { endpoint: this.endpoint, envelopeId: this.envelopeId, brand: this.brand, isDone: this.isDone, onAskQuestion: (e) => {
1232
1266
  askQuestion(this.endpoint, this.envelopeId, this.roleId, { question: e.detail.question })
1233
1267
  .then(() => VerdocsToast('Your question has been sent.', { style: 'success' }))
1234
1268
  .catch(e => {