@verdocs/web-sdk 2.0.10 → 2.0.11

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.
@@ -2,7 +2,6 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/
2
2
  import './Types.js';
3
3
  import { V as VerdocsEndpoint, c as canPerformTemplateAction } from './VerdocsEndpoint.js';
4
4
  import { l as listTemplates, d as deleteTemplate } from './Templates.js';
5
- import { V as VerdocsToast } from './Toast.js';
6
5
  import { S as SDKError } from './errors.js';
7
6
  import { d as defineCustomElement$a } from './verdocs-button2.js';
8
7
  import { d as defineCustomElement$9 } from './verdocs-dropdown2.js';
@@ -49,6 +48,8 @@ const VerdocsTemplatesList$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
49
48
  this.__registerHost();
50
49
  this.sdkError = createEvent(this, "sdkError", 7);
51
50
  this.viewTemplate = createEvent(this, "viewTemplate", 7);
51
+ this.signNow = createEvent(this, "signNow", 7);
52
+ this.submittedData = createEvent(this, "submittedData", 7);
52
53
  this.editTemplate = createEvent(this, "editTemplate", 7);
53
54
  this.templateDeleted = createEvent(this, "templateDeleted", 7);
54
55
  this.changeSort = createEvent(this, "changeSort", 7);
@@ -56,24 +57,22 @@ const VerdocsTemplatesList$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
56
57
  this.changeStarred = createEvent(this, "changeStarred", 7);
57
58
  this.changeName = createEvent(this, "changeName", 7);
58
59
  this.handleOptionSelected = (option, template) => {
59
- var _a, _b;
60
+ var _a, _b, _c, _d;
60
61
  if (option === 'send') {
61
62
  (_a = this.viewTemplate) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, template: template });
62
- }
63
- else if (option === 'createlink') {
64
- VerdocsToast('This feature is coming soon!');
63
+ // } else if (option === 'createlink') {
64
+ // VerdocsToast('This feature is coming soon!');
65
65
  }
66
66
  else if (option === 'signnow') {
67
- VerdocsToast('This feature is coming soon!');
67
+ (_b = this.signNow) === null || _b === void 0 ? void 0 : _b.emit({ endpoint: this.endpoint, template: template });
68
68
  }
69
69
  else if (option === 'submitted') {
70
- VerdocsToast('This feature is coming soon!');
71
- }
72
- else if (option === 'link') {
73
- VerdocsToast('This feature is coming soon!');
70
+ (_c = this.submittedData) === null || _c === void 0 ? void 0 : _c.emit({ endpoint: this.endpoint, template: template });
71
+ // } else if (option === 'link') {
72
+ // VerdocsToast('This feature is coming soon!');
74
73
  }
75
74
  else if (option === 'edit') {
76
- (_b = this.editTemplate) === null || _b === void 0 ? void 0 : _b.emit({ endpoint: this.endpoint, template: template });
75
+ (_d = this.editTemplate) === null || _d === void 0 ? void 0 : _d.emit({ endpoint: this.endpoint, template: template });
77
76
  }
78
77
  else if (option === 'delete') {
79
78
  this.confirmDelete = template;
@@ -84,7 +83,9 @@ const VerdocsTemplatesList$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
84
83
  this.starred = 'all';
85
84
  this.sort = 'updated_at';
86
85
  this.name = '';
87
- this.allowedActions = ['send', 'createlink', 'signnow', 'submitted', 'link', 'edit', 'delete'];
86
+ this.allowedActions = ['send', 'submitted', 'link', 'edit', 'delete'];
87
+ this.showPagination = true;
88
+ this.rowsPerPage = 10;
88
89
  this.selectedPage = 0;
89
90
  this.count = 0;
90
91
  this.loading = true;
@@ -113,12 +114,15 @@ const VerdocsTemplatesList$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
113
114
  }
114
115
  async queryTemplates() {
115
116
  var _a, _b, _c;
117
+ console.log('[TEMPLATES] Querying templates');
118
+ this.loading = true;
116
119
  try {
117
120
  let queryParams = {
118
121
  sharing: this.sharing,
119
122
  starred: this.starred,
120
123
  page: this.selectedPage,
121
124
  sort: this.sort,
125
+ rows: this.rowsPerPage,
122
126
  // ascending: this.sort === 'name' || this.sort === 'star_counter',
123
127
  };
124
128
  if (this.name.trim() !== '') {
@@ -191,12 +195,12 @@ const VerdocsTemplatesList$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
191
195
  const date = template[dateToShow];
192
196
  const MENU_OPTIONS = [];
193
197
  if (this.allowedActions.includes('send')) {
194
- MENU_OPTIONS.push({ label: 'Send', id: 'send', disabled: !this.canPreview(template) });
198
+ MENU_OPTIONS.push({ label: 'Preview / Send', id: 'send', disabled: !this.canPreview(template) });
195
199
  }
196
- if (this.allowedActions.includes('createlink')) {
197
- MENU_OPTIONS.push({ label: 'Create Link', id: 'createlink', disabled: true });
198
- }
199
- if (this.allowedActions.includes('createlink')) {
200
+ // if (this.allowedActions.includes('createlink')) {
201
+ // MENU_OPTIONS.push({label: 'Create Link', id: 'createlink', disabled: true});
202
+ // }
203
+ if (this.allowedActions.includes('signnow')) {
200
204
  MENU_OPTIONS.push({ label: 'Sign Now', id: 'signnow', disabled: true });
201
205
  }
202
206
  if (this.allowedActions.includes('submitted')) {
@@ -205,9 +209,12 @@ const VerdocsTemplatesList$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
205
209
  }
206
210
  if (this.allowedActions.includes('link') || this.allowedActions.includes('edit') || this.allowedActions.includes('delete')) {
207
211
  MENU_OPTIONS.push({ label: '' });
208
- if (this.allowedActions.includes('link') || this.allowedActions.includes('edit') || this.allowedActions.includes('delete')) {
209
- MENU_OPTIONS.push({ label: 'Get Preview Link', id: 'link', disabled: !this.canPreview(template) });
210
- }
212
+ // TODO: The preview link used to be just an internal route in the main Web application, but
213
+ // that's not suitable for embeddding. Disabling until this gets re-requested as a feature,
214
+ // in which case we'll want to move this to an API-driven function.
215
+ // if (this.allowedActions.includes('link') || this.allowedActions.includes('edit') || this.allowedActions.includes('delete')) {
216
+ // MENU_OPTIONS.push({label: 'Get Preview Link', id: 'link', disabled: !this.canPreview(template)});
217
+ // }
211
218
  if (this.allowedActions.includes('link') || this.allowedActions.includes('edit') || this.allowedActions.includes('delete')) {
212
219
  MENU_OPTIONS.push({ label: 'Edit', id: 'edit', disabled: !this.canEdit(template) });
213
220
  }
@@ -219,10 +226,10 @@ const VerdocsTemplatesList$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
219
226
  var _a;
220
227
  (_a = this.viewTemplate) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, template });
221
228
  } }, h("div", { class: "inner" }, h("verdocs-template-star", { template: template, endpoint: this.endpoint }), h("div", { class: "spacer icon-spacer" }), h("div", { class: "name" }, template.name), h("div", { class: "spacer usage-spacer" }), h("div", { class: "usage" }, h("span", { innerHTML: EnvelopeIcon, title: "Usage Counter" }), template.counter || '--'), h("div", { class: "spacer last-used-spacer" }), h("div", { class: "last-used" }, dateToShow === 'created_at' && h("span", { innerHTML: CreatedIcon, title: "Created" }), dateToShow === 'updated_at' && h("span", { innerHTML: UpdatedIcon, title: "Last Updated" }), dateToShow === 'last_used_at' && h("span", { innerHTML: LastUsedIcon, title: "Last Used" }), date ? format(new Date(date), 'P') : 'Never'), h("div", { class: "spacer ownership-spacer" }), template.is_public && (h("div", { class: "ownership" }, h("span", { innerHTML: GlobeAltIcon }), " Public")), !template.is_public && !template.is_personal && (h("div", { class: "ownership" }, h("span", { innerHTML: LockClosedIcon }), " Private")), !template.is_public && template.is_personal && (h("div", { class: "ownership" }, h("span", { innerHTML: BuildingOfficeIcon }), " Shared")), h("verdocs-dropdown", { options: MENU_OPTIONS, onOptionSelected: e => this.handleOptionSelected(e.detail.id, template) }))));
222
- }), !this.templates.length ? (h("div", { class: "empty-text" }, "No matching templates found. Please adjust your filters and try again.")) : (h("div", { style: { marginTop: '10px' } }, h("verdocs-pagination", { selectedPage: this.selectedPage, perPage: 10, itemCount: this.count, onSelectPage: e => {
229
+ }), !this.templates.length ? (h("div", { class: "empty-text" }, "No matching templates found. Please adjust your filters and try again.")) : this.showPagination ? (h("div", { style: { marginTop: '20px' } }, h("verdocs-pagination", { selectedPage: this.selectedPage, perPage: this.rowsPerPage, itemCount: this.count, onSelectPage: e => {
223
230
  this.selectedPage = e.detail.selectedPage;
224
231
  return this.queryTemplates();
225
- } }))), this.confirmDelete && (h("verdocs-ok-dialog", { heading: "Delete this Template?", message: "This operation cannot be undone.", onNext: () => this.deleteTemplate(this.confirmDelete), onExit: () => (this.confirmDelete = null), showCancel: true }))));
232
+ } }))) : (h("div", null)), this.confirmDelete && (h("verdocs-ok-dialog", { heading: "Delete this Template?", message: "This operation cannot be undone.", onNext: () => this.deleteTemplate(this.confirmDelete), onExit: () => (this.confirmDelete = null), showCancel: true }))));
226
233
  }
227
234
  static get watchers() { return {
228
235
  "sharing": ["handleSharingUpdated"],
@@ -238,7 +245,9 @@ const VerdocsTemplatesList$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
238
245
  "sort": [1537],
239
246
  "name": [1537],
240
247
  "allowedActions": [1040],
241
- "selectedPage": [1538, "selected-page"],
248
+ "showPagination": [4, "show-pagination"],
249
+ "rowsPerPage": [2, "rows-per-page"],
250
+ "selectedPage": [2, "selected-page"],
242
251
  "count": [32],
243
252
  "loading": [32],
244
253
  "confirmDelete": [32],