@verdocs/web-sdk 5.0.30 → 5.0.32

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.
@@ -131,7 +131,8 @@ const VerdocsSend = class {
131
131
  async listenToTemplate() {
132
132
  console.log('[SEND] Loading template', this.templateId);
133
133
  this.unlistenToTemplate();
134
- Datastore.Store.subscribe('templates', this.templateId, () => jsSdk.getTemplate(this.endpoint, this.templateId), false, (template) => {
134
+ Datastore.Store.subscribe('templates', this.templateId, () => jsSdk.getTemplate(this.endpoint, this.templateId), true, (template) => {
135
+ console.log('[SEND] Got new template', template);
135
136
  this.template = template;
136
137
  this.loading = false;
137
138
  this.rolesCompleted = {};
@@ -219,7 +220,7 @@ const VerdocsSend = class {
219
220
  });
220
221
  console.log('[SEND] Sequences', sequences);
221
222
  return Object.keys(sequences)
222
- .map(s => +s)
223
+ .map(s => +s - 1) // We subtract 1 here because the sequence is 1-based and our rendering is 0-based
223
224
  .sort((a, b) => a - b);
224
225
  // const levels = [...new Set((this.template?.roles || []).map(role => role.sequence - 1))];
225
226
  // levels.sort((a, b) => a - b);
@@ -316,11 +317,15 @@ const VerdocsSend = class {
316
317
  return (index$1.h(index$1.Host, { style: { display: 'flex' } }, index$1.h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
317
318
  }
318
319
  const levels = this.getLevels();
320
+ console.log('[SEND] Rendering levels', levels);
319
321
  const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => jsSdk.isValidEmail(recipient.email) && recipient.first_name && recipient.last_name);
320
322
  // TODO: Reactivate once SMS is re-enabled
321
323
  // const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => isValidEmail(recipient.email) || isValidPhone(recipient.phone));
322
324
  const allRolesAssigned = rolesAssigned.length >= getRoleNames(this.template).length;
323
- return (index$1.h(index$1.Host, { class: { sendable: (_a = this.template) === null || _a === void 0 ? void 0 : _a.is_sendable } }, index$1.h("div", { class: "recipients" }, index$1.h("div", { class: "left-line" }), index$1.h("div", { class: `level level-start` }, this.getLevelIcon(-1), index$1.h("div", { class: "complete" }, "Send Envelope")), levels.map(level => (index$1.h("div", { class: `level level-${level}` }, this.getLevelIcon(level), this.getRolesAtLevel(level).map(role => {
325
+ return (index$1.h(index$1.Host, { class: { sendable: (_a = this.template) === null || _a === void 0 ? void 0 : _a.is_sendable } }, index$1.h("div", { class: "recipients" }, index$1.h("div", { class: "left-line" }), index$1.h("div", { class: `level level-start` }, this.getLevelIcon(-1), index$1.h("div", { class: "complete" }, "Send Envelope")), levels.map(level => (index$1.h("div", { class: `level level-${level}` }, this.getLevelIcon(level), () => {
326
+ console.log('Rendering level', level, this.getRolesAtLevel(level));
327
+ return '';
328
+ }, this.getRolesAtLevel(level).map(role => {
324
329
  var _a, _b, _c;
325
330
  const unknown = !role.email || !role.first_name || !role.last_name;
326
331
  const roleName = ((_a = this.rolesCompleted[role.id]) === null || _a === void 0 ? void 0 : _a.first_name) ? jsSdk.formatFullName(this.rolesCompleted[role.id]) : unknown ? role.role_name : jsSdk.formatFullName(role);