@verdocs/web-sdk 1.12.37 → 1.12.38

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.
@@ -43,7 +43,7 @@ const VerdocsSend = class {
43
43
  this.rolesCompleted = {};
44
44
  }
45
45
  async componentWillLoad() {
46
- var _a, _b, _c, _d, _e;
46
+ var _a, _b, _c, _d, _e, _f;
47
47
  const loadSessionResult = this.endpoint.loadSession();
48
48
  if (!this.templateId) {
49
49
  console.log(`[SEND] Missing required template ID ${this.templateId}`);
@@ -52,10 +52,10 @@ const VerdocsSend = class {
52
52
  try {
53
53
  console.log(`[SEND] Loading template ${this.templateId}`);
54
54
  await Templates.loadTemplate(this.endpoint, this.templateId, true);
55
- if (!templateStore.state.template.is_sendable) {
55
+ if (!((_a = templateStore.state.template) === null || _a === void 0 ? void 0 : _a.is_sendable)) {
56
56
  console.warn(`[SEND] Template is not sendable`, this.templateId);
57
57
  }
58
- if ((_a = templateStore.state.template) === null || _a === void 0 ? void 0 : _a.roles) {
58
+ if ((_b = templateStore.state.template) === null || _b === void 0 ? void 0 : _b.roles) {
59
59
  const rolesAtLevel = {};
60
60
  this.rolesCompleted = {};
61
61
  templateStore.state.template.roles.forEach(role => {
@@ -71,9 +71,9 @@ const VerdocsSend = class {
71
71
  }
72
72
  catch (e) {
73
73
  console.log('[SEND] Error loading template', e);
74
- (_b = this.sdkError) === null || _b === void 0 ? void 0 : _b.emit(new errors.SDKError(e.message, (_c = e.response) === null || _c === void 0 ? void 0 : _c.status, (_d = e.response) === null || _d === void 0 ? void 0 : _d.data));
74
+ (_c = this.sdkError) === null || _c === void 0 ? void 0 : _c.emit(new errors.SDKError(e.message, (_d = e.response) === null || _d === void 0 ? void 0 : _d.status, (_e = e.response) === null || _e === void 0 ? void 0 : _e.data));
75
75
  }
76
- if ((_e = loadSessionResult.session) === null || _e === void 0 ? void 0 : _e.profile) {
76
+ if ((_f = loadSessionResult.session) === null || _f === void 0 ? void 0 : _f.profile) {
77
77
  this.sessionContacts.push({
78
78
  id: loadSessionResult.session.profile.id,
79
79
  name: `${loadSessionResult.session.profile.first_name} ${loadSessionResult.session.profile.last_name}`,
@@ -113,11 +113,11 @@ const VerdocsSend = class {
113
113
  (_a = this.exit) === null || _a === void 0 ? void 0 : _a.emit();
114
114
  }
115
115
  render() {
116
- var _a;
116
+ var _a, _b;
117
117
  const roleNames = (((_a = templateStore.state.template) === null || _a === void 0 ? void 0 : _a.roles) || []).map(role => role.name) || [];
118
118
  const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => Validators.isValidEmail(recipient.email) || Validators.isValidPhone(recipient.phone));
119
119
  const allRolesAssigned = rolesAssigned.length >= roleNames.length;
120
- return (index.h(index.Host, { class: { sendable: templateStore.state.template.is_sendable } }, index.h("div", { class: "recipients" }, index.h("div", { class: "left-line" }), index.h("div", { class: `level level-start` }, this.getLevelIcon(-1), index.h("div", { class: "complete" }, "Send Envelope")), this.levels.map(level => (index.h("div", { class: `level level-${level}` }, this.getLevelIcon(level), this.rolesAtLevel[level].map(role => {
120
+ return (index.h(index.Host, { class: { sendable: (_b = templateStore.state.template) === null || _b === void 0 ? void 0 : _b.is_sendable } }, index.h("div", { class: "recipients" }, index.h("div", { class: "left-line" }), index.h("div", { class: `level level-start` }, this.getLevelIcon(-1), index.h("div", { class: "complete" }, "Send Envelope")), this.levels.map(level => (index.h("div", { class: `level level-${level}` }, this.getLevelIcon(level), this.rolesAtLevel[level].map(role => {
121
121
  var _a, _b, _c, _d, _e, _f;
122
122
  const unknown = !role.email;
123
123
  return unknown ? (index.h("div", { class: "recipient", style: { backgroundColor: Colors.getRGBA(utils.getRoleIndex(roleNames, role.name)) }, onClick: e => this.handleClickRole(e, role) }, (_b = (_a = this.rolesCompleted[role.id]) === null || _a === void 0 ? void 0 : _a.full_name) !== null && _b !== void 0 ? _b : role.name, index.h("div", { class: "icon", innerHTML: editIcon }), this.showPickerForId === role.id && (index.h("verdocs-contact-picker", { onExit: () => (this.showPickerForId = ''), onNext: e => this.handleSelectContact(e, role), contactSuggestions: this.sessionContacts, templateRole: (_c = this.rolesCompleted[role.id]) !== null && _c !== void 0 ? _c : role, onSearchContacts: e => { var _a; return (_a = this.searchContacts) === null || _a === void 0 ? void 0 : _a.emit(e.detail); } })))) : (index.h("div", { class: "recipient", style: { borderColor: Colors.getRGBA(utils.getRoleIndex(roleNames, role.name)) }, onClick: e => this.handleClickRole(e, role) }, (_e = (_d = this.rolesCompleted[role.id]) === null || _d === void 0 ? void 0 : _d.full_name) !== null && _e !== void 0 ? _e : role.full_name, index.h("div", { class: "icon", innerHTML: editIcon }), this.showPickerForId === role.id && (index.h("verdocs-contact-picker", { onExit: () => (this.showPickerForId = ''), onNext: e => this.handleSelectContact(e, role), contactSuggestions: this.sessionContacts, templateRole: (_f = this.rolesCompleted[role.id]) !== null && _f !== void 0 ? _f : role, onSearchContacts: e => { var _a; return (_a = this.searchContacts) === null || _a === void 0 ? void 0 : _a.emit(e.detail); } }))));
@@ -34,7 +34,7 @@ export class VerdocsSend {
34
34
  this.rolesCompleted = {};
35
35
  }
36
36
  async componentWillLoad() {
37
- var _a, _b, _c, _d, _e;
37
+ var _a, _b, _c, _d, _e, _f;
38
38
  const loadSessionResult = this.endpoint.loadSession();
39
39
  if (!this.templateId) {
40
40
  console.log(`[SEND] Missing required template ID ${this.templateId}`);
@@ -43,10 +43,10 @@ export class VerdocsSend {
43
43
  try {
44
44
  console.log(`[SEND] Loading template ${this.templateId}`);
45
45
  await loadTemplate(this.endpoint, this.templateId, true);
46
- if (!TemplateStore.template.is_sendable) {
46
+ if (!((_a = TemplateStore.template) === null || _a === void 0 ? void 0 : _a.is_sendable)) {
47
47
  console.warn(`[SEND] Template is not sendable`, this.templateId);
48
48
  }
49
- if ((_a = TemplateStore.template) === null || _a === void 0 ? void 0 : _a.roles) {
49
+ if ((_b = TemplateStore.template) === null || _b === void 0 ? void 0 : _b.roles) {
50
50
  const rolesAtLevel = {};
51
51
  this.rolesCompleted = {};
52
52
  TemplateStore.template.roles.forEach(role => {
@@ -62,9 +62,9 @@ export class VerdocsSend {
62
62
  }
63
63
  catch (e) {
64
64
  console.log('[SEND] Error loading template', e);
65
- (_b = this.sdkError) === null || _b === void 0 ? void 0 : _b.emit(new SDKError(e.message, (_c = e.response) === null || _c === void 0 ? void 0 : _c.status, (_d = e.response) === null || _d === void 0 ? void 0 : _d.data));
65
+ (_c = this.sdkError) === null || _c === void 0 ? void 0 : _c.emit(new SDKError(e.message, (_d = e.response) === null || _d === void 0 ? void 0 : _d.status, (_e = e.response) === null || _e === void 0 ? void 0 : _e.data));
66
66
  }
67
- if ((_e = loadSessionResult.session) === null || _e === void 0 ? void 0 : _e.profile) {
67
+ if ((_f = loadSessionResult.session) === null || _f === void 0 ? void 0 : _f.profile) {
68
68
  this.sessionContacts.push({
69
69
  id: loadSessionResult.session.profile.id,
70
70
  name: `${loadSessionResult.session.profile.first_name} ${loadSessionResult.session.profile.last_name}`,
@@ -105,11 +105,11 @@ export class VerdocsSend {
105
105
  (_a = this.exit) === null || _a === void 0 ? void 0 : _a.emit();
106
106
  }
107
107
  render() {
108
- var _a;
108
+ var _a, _b;
109
109
  const roleNames = (((_a = TemplateStore.template) === null || _a === void 0 ? void 0 : _a.roles) || []).map(role => role.name) || [];
110
110
  const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => isValidEmail(recipient.email) || isValidPhone(recipient.phone));
111
111
  const allRolesAssigned = rolesAssigned.length >= roleNames.length;
112
- return (h(Host, { class: { sendable: TemplateStore.template.is_sendable } }, h("div", { class: "recipients" }, h("div", { class: "left-line" }), h("div", { class: `level level-start` }, this.getLevelIcon(-1), h("div", { class: "complete" }, "Send Envelope")), this.levels.map(level => (h("div", { class: `level level-${level}` }, this.getLevelIcon(level), this.rolesAtLevel[level].map(role => {
112
+ return (h(Host, { class: { sendable: (_b = TemplateStore.template) === null || _b === void 0 ? void 0 : _b.is_sendable } }, h("div", { class: "recipients" }, h("div", { class: "left-line" }), h("div", { class: `level level-start` }, this.getLevelIcon(-1), h("div", { class: "complete" }, "Send Envelope")), this.levels.map(level => (h("div", { class: `level level-${level}` }, this.getLevelIcon(level), this.rolesAtLevel[level].map(role => {
113
113
  var _a, _b, _c, _d, _e, _f;
114
114
  const unknown = !role.email;
115
115
  return unknown ? (h("div", { class: "recipient", style: { backgroundColor: getRGBA(getRoleIndex(roleNames, role.name)) }, onClick: e => this.handleClickRole(e, role) }, (_b = (_a = this.rolesCompleted[role.id]) === null || _a === void 0 ? void 0 : _a.full_name) !== null && _b !== void 0 ? _b : role.name, h("div", { class: "icon", innerHTML: editIcon }), this.showPickerForId === role.id && (h("verdocs-contact-picker", { onExit: () => (this.showPickerForId = ''), onNext: e => this.handleSelectContact(e, role), contactSuggestions: this.sessionContacts, templateRole: (_c = this.rolesCompleted[role.id]) !== null && _c !== void 0 ? _c : role, onSearchContacts: e => { var _a; return (_a = this.searchContacts) === null || _a === void 0 ? void 0 : _a.emit(e.detail); } })))) : (h("div", { class: "recipient", style: { borderColor: getRGBA(getRoleIndex(roleNames, role.name)) }, onClick: e => this.handleClickRole(e, role) }, (_e = (_d = this.rolesCompleted[role.id]) === null || _d === void 0 ? void 0 : _d.full_name) !== null && _e !== void 0 ? _e : role.full_name, h("div", { class: "icon", innerHTML: editIcon }), this.showPickerForId === role.id && (h("verdocs-contact-picker", { onExit: () => (this.showPickerForId = ''), onNext: e => this.handleSelectContact(e, role), contactSuggestions: this.sessionContacts, templateRole: (_f = this.rolesCompleted[role.id]) !== null && _f !== void 0 ? _f : role, onSearchContacts: e => { var _a; return (_a = this.searchContacts) === null || _a === void 0 ? void 0 : _a.emit(e.detail); } }))));
@@ -38,7 +38,7 @@ const VerdocsSend$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
38
38
  this.rolesCompleted = {};
39
39
  }
40
40
  async componentWillLoad() {
41
- var _a, _b, _c, _d, _e;
41
+ var _a, _b, _c, _d, _e, _f;
42
42
  const loadSessionResult = this.endpoint.loadSession();
43
43
  if (!this.templateId) {
44
44
  console.log(`[SEND] Missing required template ID ${this.templateId}`);
@@ -47,10 +47,10 @@ const VerdocsSend$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
47
47
  try {
48
48
  console.log(`[SEND] Loading template ${this.templateId}`);
49
49
  await loadTemplate(this.endpoint, this.templateId, true);
50
- if (!state.template.is_sendable) {
50
+ if (!((_a = state.template) === null || _a === void 0 ? void 0 : _a.is_sendable)) {
51
51
  console.warn(`[SEND] Template is not sendable`, this.templateId);
52
52
  }
53
- if ((_a = state.template) === null || _a === void 0 ? void 0 : _a.roles) {
53
+ if ((_b = state.template) === null || _b === void 0 ? void 0 : _b.roles) {
54
54
  const rolesAtLevel = {};
55
55
  this.rolesCompleted = {};
56
56
  state.template.roles.forEach(role => {
@@ -66,9 +66,9 @@ const VerdocsSend$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
66
66
  }
67
67
  catch (e) {
68
68
  console.log('[SEND] Error loading template', e);
69
- (_b = this.sdkError) === null || _b === void 0 ? void 0 : _b.emit(new SDKError(e.message, (_c = e.response) === null || _c === void 0 ? void 0 : _c.status, (_d = e.response) === null || _d === void 0 ? void 0 : _d.data));
69
+ (_c = this.sdkError) === null || _c === void 0 ? void 0 : _c.emit(new SDKError(e.message, (_d = e.response) === null || _d === void 0 ? void 0 : _d.status, (_e = e.response) === null || _e === void 0 ? void 0 : _e.data));
70
70
  }
71
- if ((_e = loadSessionResult.session) === null || _e === void 0 ? void 0 : _e.profile) {
71
+ if ((_f = loadSessionResult.session) === null || _f === void 0 ? void 0 : _f.profile) {
72
72
  this.sessionContacts.push({
73
73
  id: loadSessionResult.session.profile.id,
74
74
  name: `${loadSessionResult.session.profile.first_name} ${loadSessionResult.session.profile.last_name}`,
@@ -108,11 +108,11 @@ const VerdocsSend$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
108
108
  (_a = this.exit) === null || _a === void 0 ? void 0 : _a.emit();
109
109
  }
110
110
  render() {
111
- var _a;
111
+ var _a, _b;
112
112
  const roleNames = (((_a = state.template) === null || _a === void 0 ? void 0 : _a.roles) || []).map(role => role.name) || [];
113
113
  const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => isValidEmail(recipient.email) || isValidPhone(recipient.phone));
114
114
  const allRolesAssigned = rolesAssigned.length >= roleNames.length;
115
- return (h(Host, { class: { sendable: state.template.is_sendable } }, h("div", { class: "recipients" }, h("div", { class: "left-line" }), h("div", { class: `level level-start` }, this.getLevelIcon(-1), h("div", { class: "complete" }, "Send Envelope")), this.levels.map(level => (h("div", { class: `level level-${level}` }, this.getLevelIcon(level), this.rolesAtLevel[level].map(role => {
115
+ return (h(Host, { class: { sendable: (_b = state.template) === null || _b === void 0 ? void 0 : _b.is_sendable } }, h("div", { class: "recipients" }, h("div", { class: "left-line" }), h("div", { class: `level level-start` }, this.getLevelIcon(-1), h("div", { class: "complete" }, "Send Envelope")), this.levels.map(level => (h("div", { class: `level level-${level}` }, this.getLevelIcon(level), this.rolesAtLevel[level].map(role => {
116
116
  var _a, _b, _c, _d, _e, _f;
117
117
  const unknown = !role.email;
118
118
  return unknown ? (h("div", { class: "recipient", style: { backgroundColor: getRGBA(getRoleIndex(roleNames, role.name)) }, onClick: e => this.handleClickRole(e, role) }, (_b = (_a = this.rolesCompleted[role.id]) === null || _a === void 0 ? void 0 : _a.full_name) !== null && _b !== void 0 ? _b : role.name, h("div", { class: "icon", innerHTML: editIcon }), this.showPickerForId === role.id && (h("verdocs-contact-picker", { onExit: () => (this.showPickerForId = ''), onNext: e => this.handleSelectContact(e, role), contactSuggestions: this.sessionContacts, templateRole: (_c = this.rolesCompleted[role.id]) !== null && _c !== void 0 ? _c : role, onSearchContacts: e => { var _a; return (_a = this.searchContacts) === null || _a === void 0 ? void 0 : _a.emit(e.detail); } })))) : (h("div", { class: "recipient", style: { borderColor: getRGBA(getRoleIndex(roleNames, role.name)) }, onClick: e => this.handleClickRole(e, role) }, (_e = (_d = this.rolesCompleted[role.id]) === null || _d === void 0 ? void 0 : _d.full_name) !== null && _e !== void 0 ? _e : role.full_name, h("div", { class: "icon", innerHTML: editIcon }), this.showPickerForId === role.id && (h("verdocs-contact-picker", { onExit: () => (this.showPickerForId = ''), onNext: e => this.handleSelectContact(e, role), contactSuggestions: this.sessionContacts, templateRole: (_f = this.rolesCompleted[role.id]) !== null && _f !== void 0 ? _f : role, onSearchContacts: e => { var _a; return (_a = this.searchContacts) === null || _a === void 0 ? void 0 : _a.emit(e.detail); } }))));