@verdocs/web-sdk 2.0.2 → 2.0.3

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 (48) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/{verdocs-envelope-recipient-summary.cjs.entry.js → verdocs-envelope-recipient-link_2.cjs.entry.js} +85 -3
  3. package/dist/cjs/verdocs-envelope-sidebar.cjs.entry.js +10 -24
  4. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  5. package/dist/collection/collection-manifest.json +1 -0
  6. package/dist/collection/components/envelopes/verdocs-envelope-recipient-link/verdocs-envelope-recipient-link.css +107 -0
  7. package/dist/collection/components/envelopes/verdocs-envelope-recipient-link/verdocs-envelope-recipient-link.js +208 -0
  8. package/dist/collection/components/envelopes/verdocs-envelope-recipient-link/verdocs-envelope-recipient-link.stories.js +13 -0
  9. package/dist/collection/components/envelopes/verdocs-envelope-recipient-summary/verdocs-envelope-recipient-summary.js +1 -28
  10. package/dist/collection/components/envelopes/verdocs-envelope-sidebar/verdocs-envelope-sidebar.js +13 -26
  11. package/dist/collection/components/envelopes/verdocs-envelope-sidebar/verdocs-envelope-sidebar.stories.js +1 -1
  12. package/dist/components/EnvelopeStore.js +81 -0
  13. package/dist/components/Envelopes.js +1 -1
  14. package/dist/components/index.d.ts +1 -0
  15. package/dist/components/index.js +1 -0
  16. package/dist/components/utils.js +1 -1
  17. package/dist/components/verdocs-envelope-recipient-link.d.ts +11 -0
  18. package/dist/components/verdocs-envelope-recipient-link.js +6 -0
  19. package/dist/components/verdocs-envelope-recipient-link2.js +120 -0
  20. package/dist/components/verdocs-envelope-recipient-summary2.js +2 -82
  21. package/dist/components/verdocs-envelope-sidebar.js +24 -30
  22. package/dist/docs.json +110 -17
  23. package/dist/esm/loader.js +1 -1
  24. package/dist/esm/{verdocs-envelope-recipient-summary.entry.js → verdocs-envelope-recipient-link_2.entry.js} +85 -4
  25. package/dist/esm/verdocs-envelope-sidebar.entry.js +11 -25
  26. package/dist/esm/verdocs-web-sdk.js +1 -1
  27. package/dist/esm-es5/loader.js +1 -1
  28. package/dist/esm-es5/verdocs-envelope-recipient-link_2.entry.js +1 -0
  29. package/dist/esm-es5/verdocs-envelope-sidebar.entry.js +1 -1
  30. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  31. package/dist/types/components/envelopes/verdocs-envelope-recipient-link/verdocs-envelope-recipient-link.d.ts +46 -0
  32. package/dist/types/components/envelopes/verdocs-envelope-recipient-link/verdocs-envelope-recipient-link.stories.d.ts +8 -0
  33. package/dist/types/components/envelopes/verdocs-envelope-recipient-summary/verdocs-envelope-recipient-summary.d.ts +1 -11
  34. package/dist/types/components/envelopes/verdocs-envelope-sidebar/verdocs-envelope-sidebar.d.ts +1 -2
  35. package/dist/types/components.d.ts +49 -8
  36. package/dist/verdocs-web-sdk/p-3a4d619d.system.entry.js +1 -0
  37. package/dist/verdocs-web-sdk/p-51f09ff0.system.entry.js +1 -0
  38. package/dist/verdocs-web-sdk/p-647cdb84.system.js +1 -1
  39. package/dist/verdocs-web-sdk/p-c0b4cda6.entry.js +1 -0
  40. package/dist/verdocs-web-sdk/p-e0379271.entry.js +1 -0
  41. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  42. package/package.json +1 -1
  43. package/dist/custom-elements.json +0 -1894
  44. package/dist/esm-es5/verdocs-envelope-recipient-summary.entry.js +0 -1
  45. package/dist/verdocs-web-sdk/p-0df85bd4.entry.js +0 -1
  46. package/dist/verdocs-web-sdk/p-434dd9d9.system.entry.js +0 -1
  47. package/dist/verdocs-web-sdk/p-b8036fd4.system.entry.js +0 -1
  48. package/dist/verdocs-web-sdk/p-d278b481.entry.js +0 -1
@@ -0,0 +1,208 @@
1
+ import { VerdocsEndpoint } from '@verdocs/js-sdk';
2
+ import { getInPersonLink } from '@verdocs/js-sdk/Envelopes/Recipients';
3
+ import { Host, h } from '@stencil/core';
4
+ import { getEnvelopeStore } from '../../../utils/EnvelopeStore';
5
+ import { VerdocsToast } from '../../../utils/Toast';
6
+ import { SDKError } from '../../../utils/errors';
7
+ /**
8
+ * Displays a single recipient from an envelope, with the opportunity to copy an in-person
9
+ * signing link for that recipient to use.
10
+ */
11
+ export class VerdocsEnvelopeRecipientLink {
12
+ constructor() {
13
+ this.store = null;
14
+ this.recipient = null;
15
+ this.endpoint = VerdocsEndpoint.getDefault();
16
+ this.envelopeId = '';
17
+ this.roleName = '';
18
+ this.isOpen = undefined;
19
+ this.loading = true;
20
+ this.gettingLink = true;
21
+ this.link = '';
22
+ }
23
+ async componentWillLoad() {
24
+ var _a, _b, _c, _d, _e, _f;
25
+ try {
26
+ this.endpoint.loadSession();
27
+ if (!this.envelopeId) {
28
+ console.log(`[RECIPIENT_LINK] Missing required envelope ID ${this.envelopeId}`);
29
+ return;
30
+ }
31
+ if (!this.endpoint.session) {
32
+ console.log('[RECIPIENT_LINK] Unable to start session, must be authenticated');
33
+ return;
34
+ }
35
+ this.store = await getEnvelopeStore(this.endpoint, this.envelopeId, true);
36
+ this.loading = false;
37
+ this.gettingLink = true;
38
+ this.recipient = (_c = (_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.recipients) === null || _c === void 0 ? void 0 : _c.find(r => r.role_name === this.roleName);
39
+ this.getLink(this.recipient);
40
+ }
41
+ catch (e) {
42
+ console.log('[RECIPIENT_LINK] Error loading envelope', e);
43
+ (_d = this.sdkError) === null || _d === void 0 ? void 0 : _d.emit(new SDKError(e.message, (_e = e.response) === null || _e === void 0 ? void 0 : _e.status, (_f = e.response) === null || _f === void 0 ? void 0 : _f.data));
44
+ }
45
+ }
46
+ handleDone(e) {
47
+ var _a;
48
+ e.preventDefault();
49
+ (_a = this.next) === null || _a === void 0 ? void 0 : _a.emit({ envelope: this.store.state });
50
+ }
51
+ copyLink(link) {
52
+ navigator.clipboard
53
+ .writeText(link)
54
+ .then(() => VerdocsToast('Link copied to clipboard!', { style: 'success', duration: 3000 }))
55
+ .catch(e => {
56
+ console.warn('[RECIPIENT_LINK] Error copying to clipboard', e);
57
+ VerdocsToast(`Unable to copy to clipboard: ${e.message}`, { style: 'error' });
58
+ });
59
+ }
60
+ getLink(recipient) {
61
+ this.gettingLink = true;
62
+ getInPersonLink(this.endpoint, recipient.envelope_id, recipient.role_name)
63
+ .then(response => {
64
+ this.gettingLink = false;
65
+ this.link = response.link;
66
+ // NOTE: Left here for documentation purposes. We don't auto-copy the link because many browsers now
67
+ // error on that because we aren't the focus/gesture-initiator since we're a new component just being
68
+ // drawn in the DOM. So we let the user click to trigger that.
69
+ // this.copyLink(response.link);
70
+ })
71
+ .catch(e => {
72
+ this.gettingLink = false;
73
+ console.log('[RECIPIENT_LINK] Error getting link', e);
74
+ VerdocsToast('Unable to get link: ' + e.message, { style: 'error' });
75
+ });
76
+ }
77
+ render() {
78
+ if (this.loading || !this.recipient) {
79
+ return h(Host, null);
80
+ }
81
+ // const recipientsWithActions = getRecipientsWithActions(this.store.state); const showLinkButton = recipientCanAct(recipient, recipientsWithActions); const link =
82
+ // this.links[recipient.role_name]; const gettingLink = this.gettingLinks[recipient.role_name]; return (
83
+ return (h(Host, null, h("div", { class: "summary-content" }, h("h1", { class: "summary-title" }, "In-Person Signing Link"), h("div", { class: "summary-rows" }, h("div", { class: "summary-recipient" }, h("div", { class: "role-name" }, this.recipient.role_name), h("div", { class: "role-details" }, h("div", { class: "role-info" }, h("div", { class: "role-full-name" }, this.recipient.full_name, " (", this.recipient.email || this.recipient.phone, ")"), !this.link && (h("verdocs-button", { size: "small", variant: "outline", label: this.gettingLink ? 'Loading...' : 'Get Link', disabled: this.gettingLink, onClick: () => this.getLink(this.recipient) }))), this.link && (h("div", { class: "link-wrapper" }, h("div", { class: "link" }, this.link), h("verdocs-button", { size: "small", variant: "outline", label: "Copy", onClick: () => this.copyLink(this.link) })))))), h("div", { class: "buttons" }, h("verdocs-button", { size: "small", label: "Done", onClick: e => this.handleDone(e) })))));
84
+ }
85
+ static get is() { return "verdocs-envelope-recipient-link"; }
86
+ static get originalStyleUrls() {
87
+ return {
88
+ "$": ["verdocs-envelope-recipient-link.scss"]
89
+ };
90
+ }
91
+ static get styleUrls() {
92
+ return {
93
+ "$": ["verdocs-envelope-recipient-link.css"]
94
+ };
95
+ }
96
+ static get properties() {
97
+ return {
98
+ "endpoint": {
99
+ "type": "unknown",
100
+ "mutable": false,
101
+ "complexType": {
102
+ "original": "VerdocsEndpoint",
103
+ "resolved": "VerdocsEndpoint",
104
+ "references": {
105
+ "VerdocsEndpoint": {
106
+ "location": "import",
107
+ "path": "@verdocs/js-sdk"
108
+ }
109
+ }
110
+ },
111
+ "required": false,
112
+ "optional": false,
113
+ "docs": {
114
+ "tags": [],
115
+ "text": "The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used."
116
+ },
117
+ "defaultValue": "VerdocsEndpoint.getDefault()"
118
+ },
119
+ "envelopeId": {
120
+ "type": "string",
121
+ "mutable": false,
122
+ "complexType": {
123
+ "original": "string",
124
+ "resolved": "string",
125
+ "references": {}
126
+ },
127
+ "required": false,
128
+ "optional": false,
129
+ "docs": {
130
+ "tags": [],
131
+ "text": "The envelope ID to edit."
132
+ },
133
+ "attribute": "envelope-id",
134
+ "reflect": false,
135
+ "defaultValue": "''"
136
+ },
137
+ "roleName": {
138
+ "type": "string",
139
+ "mutable": false,
140
+ "complexType": {
141
+ "original": "string",
142
+ "resolved": "string",
143
+ "references": {}
144
+ },
145
+ "required": false,
146
+ "optional": false,
147
+ "docs": {
148
+ "tags": [],
149
+ "text": "The role to load."
150
+ },
151
+ "attribute": "role-name",
152
+ "reflect": false,
153
+ "defaultValue": "''"
154
+ }
155
+ };
156
+ }
157
+ static get states() {
158
+ return {
159
+ "isOpen": {},
160
+ "loading": {},
161
+ "gettingLink": {},
162
+ "link": {}
163
+ };
164
+ }
165
+ static get events() {
166
+ return [{
167
+ "method": "next",
168
+ "name": "next",
169
+ "bubbles": true,
170
+ "cancelable": true,
171
+ "composed": true,
172
+ "docs": {
173
+ "tags": [],
174
+ "text": "Event fired when the user clicks Done to proceed. It is up to the host application\nto redirect the user to the appropriate next workflow step."
175
+ },
176
+ "complexType": {
177
+ "original": "{envelope: IEnvelope}",
178
+ "resolved": "{ envelope: IEnvelope; }",
179
+ "references": {
180
+ "IEnvelope": {
181
+ "location": "import",
182
+ "path": "@verdocs/js-sdk/Envelopes/Types"
183
+ }
184
+ }
185
+ }
186
+ }, {
187
+ "method": "sdkError",
188
+ "name": "sdkError",
189
+ "bubbles": true,
190
+ "cancelable": true,
191
+ "composed": true,
192
+ "docs": {
193
+ "tags": [],
194
+ "text": "Event fired if an error occurs. The event details will contain information about the error. Most errors will\nterminate the process, and the calling application should correct the condition and re-render the component."
195
+ },
196
+ "complexType": {
197
+ "original": "SDKError",
198
+ "resolved": "SDKError",
199
+ "references": {
200
+ "SDKError": {
201
+ "location": "import",
202
+ "path": "../../../utils/errors"
203
+ }
204
+ }
205
+ }
206
+ }];
207
+ }
208
+ }
@@ -0,0 +1,13 @@
1
+ import { html } from 'lit-html';
2
+ export default {
3
+ title: 'Envelopes/Recipient Link',
4
+ component: 'verdocs-envelope-recipient-link',
5
+ args: {
6
+ envelopeId: 'c64b09c1-23d8-4612-bc66-86723ab7ede3',
7
+ roleName: 'Buyer',
8
+ },
9
+ argTypes: {
10
+ next: { action: 'next' },
11
+ },
12
+ };
13
+ export const recipientLink = ({ envelopeId, roleName, next }) => html `<verdocs-envelope-recipient-link .envelopeId="${envelopeId}" .roleName="${roleName}" @next=${next} />`;
@@ -6,13 +6,7 @@ import { getEnvelopeStore } from '../../../utils/EnvelopeStore';
6
6
  import { VerdocsToast } from '../../../utils/Toast';
7
7
  import { SDKError } from '../../../utils/errors';
8
8
  /**
9
- * Displays an icon and message describing a document's completion status. For convenience, the status may be passed in either
10
- * directly as a status field or the whole document object may be passed in.
11
- *
12
- * If the document is provided, the status flag will indicate the document's overall status. This also makes the component clickable
13
- * to display a popup panel with per-recipient status data.
14
- *
15
- * If the status is provided as a string it can be either a `TRecipientStatus` or `TDocumentStatus` value.
9
+ * Displays a list of recipients with options to get in-person signing links for each one.
16
10
  */
17
11
  export class VerdocsEnvelopeRecipientSummary {
18
12
  constructor() {
@@ -22,7 +16,6 @@ export class VerdocsEnvelopeRecipientSummary {
22
16
  this.canSendAnother = true;
23
17
  this.canView = true;
24
18
  this.canDone = true;
25
- this.envelope = undefined;
26
19
  this.isOpen = undefined;
27
20
  this.loading = true;
28
21
  this.recipientStatusIcons = [];
@@ -213,26 +206,6 @@ export class VerdocsEnvelopeRecipientSummary {
213
206
  "attribute": "can-done",
214
207
  "reflect": false,
215
208
  "defaultValue": "true"
216
- },
217
- "envelope": {
218
- "type": "unknown",
219
- "mutable": false,
220
- "complexType": {
221
- "original": "IEnvelope",
222
- "resolved": "IEnvelope",
223
- "references": {
224
- "IEnvelope": {
225
- "location": "import",
226
- "path": "@verdocs/js-sdk/Envelopes/Types"
227
- }
228
- }
229
- },
230
- "required": false,
231
- "optional": true,
232
- "docs": {
233
- "tags": [],
234
- "text": "The document to display status for. Ignored if `status` is set directly."
235
- }
236
209
  }
237
210
  };
238
211
  }
@@ -1,13 +1,13 @@
1
1
  import { format } from 'date-fns';
2
2
  import { VerdocsEndpoint } from '@verdocs/js-sdk';
3
+ import { cancelEnvelope } from '@verdocs/js-sdk/Envelopes/Envelopes';
4
+ import { resendInvitation } from '@verdocs/js-sdk/Envelopes/Recipients';
3
5
  import { userIsEnvelopeOwner } from '@verdocs/js-sdk/Envelopes/Permissions';
4
6
  import { h, Host } from '@stencil/core';
5
- import { getInPersonLink, resendInvitation } from '@verdocs/js-sdk/Envelopes/Recipients';
6
7
  import { getEnvelopeStore } from '../../../utils/EnvelopeStore';
7
8
  import { FORMAT_TIMESTAMP } from '../../../utils/Types';
8
9
  import { VerdocsToast } from '../../../utils/Toast';
9
10
  import { SDKError } from '../../../utils/errors';
10
- import { cancelEnvelope } from '@verdocs/js-sdk/Envelopes/Envelopes';
11
11
  const InformationCircle = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="#ffffff"><path stroke-linecap="round" stroke-linejoin="round" d="M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z" /></svg>`;
12
12
  const Users = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="#ffffff"><path stroke-linecap="round" stroke-linejoin="round" d="M15 19.128a9.38 9.38 0 002.625.372 9.337 9.337 0 004.121-.952 4.125 4.125 0 00-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 018.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0111.964-3.07M12 6.375a3.375 3.375 0 11-6.75 0 3.375 3.375 0 016.75 0zm8.25 2.25a2.625 2.625 0 11-5.25 0 2.625 2.625 0 015.25 0z" /></svg>`;
13
13
  const ClipboardDocuments = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="#ffffff"><path stroke-linecap="round" stroke-linejoin="round" d="M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 002.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 00-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25zM6.75 12h.008v.008H6.75V12zm0 3h.008v.008H6.75V15zm0 3h.008v.008H6.75V18z" /></svg>`;
@@ -44,6 +44,7 @@ export class VerdocsEnvelopeSidebar {
44
44
  this.activeTab = 1;
45
45
  this.panelOpen = false;
46
46
  this.showManageDialog = false;
47
+ this.showRecipientDialog = '';
47
48
  this.showCancelDialog = false;
48
49
  this.loading = true;
49
50
  }
@@ -86,12 +87,6 @@ export class VerdocsEnvelopeSidebar {
86
87
  return (!['pending', 'declined', 'submitted', 'canceled'].includes(recipient.status) && //
87
88
  !['complete', 'declined', 'canceled'].includes((_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.status));
88
89
  }
89
- canModifyRecipient(recipient) {
90
- var _a, _b;
91
- return (!recipient.claimed && //
92
- !['declined', 'signed', 'submitted', 'canceled'].includes(recipient.status) &&
93
- !['complete', 'declined', 'canceled'].includes((_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.status));
94
- }
95
90
  handleRecipientAction(recipient, id) {
96
91
  var _a, _b;
97
92
  console.log('[SIDEBAR] Recipient action', id, recipient);
@@ -107,13 +102,7 @@ export class VerdocsEnvelopeSidebar {
107
102
  });
108
103
  break;
109
104
  case 'inperson':
110
- getInPersonLink(this.endpoint, recipient.envelope_id, recipient.role_name)
111
- .then(({ link }) => navigator.clipboard.writeText(link))
112
- .then(() => VerdocsToast('Link copied to clipboard.', { style: 'success', duration: 2000 }))
113
- .catch(e => {
114
- console.log('[RECIPIENTS] Error getting link', e);
115
- VerdocsToast('Unable to get link: ' + e.message, { style: 'error' });
116
- });
105
+ this.showRecipientDialog = recipient.role_name;
117
106
  break;
118
107
  case 'modify':
119
108
  VerdocsToast('This feature will be enabled in a future release. Please try again later.', { style: 'info' });
@@ -255,12 +244,11 @@ export class VerdocsEnvelopeSidebar {
255
244
  entries.sort((a, b) => b.date.getTime() - a.date.getTime());
256
245
  return entries;
257
246
  }
258
- canModify(recipient) {
259
- var _a, _b;
260
- const invalidRecipientStatus = ['declined', 'signed', 'submitted', 'canceled'];
261
- const invalidEnvelopeStatus = ['complete', 'declined', 'canceled'];
262
- return recipient.claimed !== true && invalidRecipientStatus.indexOf(recipient.status) === -1 && invalidEnvelopeStatus.indexOf((_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.status) === -1;
263
- }
247
+ // canModify(recipient: IRecipient) {
248
+ // const invalidRecipientStatus = ['declined', 'signed', 'submitted', 'canceled'];
249
+ // const invalidEnvelopeStatus = ['complete', 'declined', 'canceled'];
250
+ // return recipient.claimed !== true && invalidRecipientStatus.indexOf(recipient.status) === -1 && invalidEnvelopeStatus.indexOf(this.store?.state?.status) === -1;
251
+ // }
264
252
  render() {
265
253
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
266
254
  if (!this.store.state) {
@@ -274,7 +262,7 @@ export class VerdocsEnvelopeSidebar {
274
262
  _s.first_name, " ", (_v = (_u = (_t = this.store) === null || _t === void 0 ? void 0 : _t.state) === null || _u === void 0 ? void 0 : _u.profile) === null || _v === void 0 ? void 0 :
275
263
  _v.last_name), h("div", { class: "label" }, "Verdoc Owner Email"), h("div", { class: "value" }, (_y = (_x = (_w = this.store) === null || _w === void 0 ? void 0 : _w.state) === null || _x === void 0 ? void 0 : _x.profile) === null || _y === void 0 ? void 0 : _y.email))), this.activeTab === 2 && (h("div", { class: "content" }, h("div", { class: "title" }, "Recipients"), (_0 = (_z = this.store) === null || _z === void 0 ? void 0 : _z.state) === null || _0 === void 0 ? void 0 :
276
264
  _0.recipients.map((recipient, index) => {
277
- const canGetInPersonLink = !this.canModify(recipient) || (recipient.status !== 'invited' && recipient.status !== 'opened');
265
+ const canGetInPersonLink = recipient.status !== 'signed' && recipient.status !== 'submitted' && recipient.status !== 'canceled' && recipient.status !== 'declined';
278
266
  const canSendReminder = this.canResendRecipient(recipient);
279
267
  return (h("div", { class: "recipient-detail" }, h("div", { class: "recipient-header" }, h("div", { class: "recipient-number" }, index + 1), h("div", { class: "recipient-type" }, recipient.role_name), h("div", { class: { 'recipient-status': true, [recipient.status]: true } }, recipient.status), isEnvelopeOwner && !functionsDisabled && (h("verdocs-dropdown", { onOptionSelected: item => this.handleRecipientAction(recipient, item.detail.id), options: [
280
268
  { id: 'reminder', label: 'Send Reminder', disabled: !canSendReminder },
@@ -283,13 +271,11 @@ export class VerdocsEnvelopeSidebar {
283
271
  // TODO: Details dialog
284
272
  // {id:'details',label: 'View Details'},
285
273
  ] }))), h("dic", { class: "recipient-content" }, h("div", { class: "recipient-name" }, recipient.full_name), h("div", { class: "recipient-name" }, recipient.email), h("div", { class: "recipient-name" }, recipient.phone))));
286
- }), isEnvelopeOwner && (h("verdocs-button", { class: "manage-recipients-button", variant: "standard", label: "Turn On Reminders", onClick: () => (this.showManageDialog = !functionsDisabled), disabled: functionsDisabled })), isEnvelopeOwner && (h("verdocs-button", { class: "manage-recipients-button", variant: "standard", label: "Cancel Verdoc", onClick: () => (this.showCancelDialog = !functionsDisabled), disabled: functionsDisabled })))), this.activeTab === 3 && (h("div", { class: "content" }, h("div", { class: "title" }, "History"), historyEntries.map(entry => (h("div", { class: "history-entry" }, h("div", { class: "activity-icon", innerHTML: ActivityIcons[entry.icon] || entry.icon }), h("div", { class: "activity-details" }, h("div", { class: "activity-text" }, entry.message), h("div", { class: "activity-date" }, format(entry.date, FORMAT_TIMESTAMP)))))))), this.showManageDialog && (h("verdocs-envelope-recipient-summary", { envelopeId: this.envelopeId, canView: false, onAnother: () => {
274
+ }), isEnvelopeOwner && (h("verdocs-button", { class: "manage-recipients-button", variant: "standard", label: "Turn On Reminders", onClick: () => (this.showManageDialog = !functionsDisabled), disabled: functionsDisabled })), isEnvelopeOwner && (h("verdocs-button", { class: "manage-recipients-button", variant: "standard", label: "Cancel Verdoc", onClick: () => (this.showCancelDialog = !functionsDisabled), disabled: functionsDisabled })))), this.activeTab === 3 && (h("div", { class: "content" }, h("div", { class: "title" }, "History"), historyEntries.map(entry => (h("div", { class: "history-entry" }, h("div", { class: "activity-icon", innerHTML: ActivityIcons[entry.icon] || entry.icon }), h("div", { class: "activity-details" }, h("div", { class: "activity-text" }, entry.message), h("div", { class: "activity-date" }, format(entry.date, FORMAT_TIMESTAMP)))))))), this.showRecipientDialog && (h("verdocs-envelope-recipient-link", { envelopeId: this.envelopeId, roleName: this.showRecipientDialog, onNext: () => (this.showRecipientDialog = '') })), this.showManageDialog && (h("verdocs-envelope-recipient-summary", { envelopeId: this.envelopeId, canView: false, onAnother: () => {
287
275
  var _a;
288
276
  this.showManageDialog = false;
289
277
  (_a = this.another) === null || _a === void 0 ? void 0 : _a.emit({ envelope: this.store.state });
290
- }, onNext: () => {
291
- this.showManageDialog = false;
292
- } })), this.showCancelDialog && (h("verdocs-ok-dialog", { heading: "Cancel Envelope?", message: 'Are you sure you want to cancel this Envelope? This action cannot be undone.', onNext: () => {
278
+ }, onNext: () => (this.showManageDialog = false) })), this.showCancelDialog && (h("verdocs-ok-dialog", { heading: "Cancel Envelope?", message: 'Are you sure you want to cancel this Envelope? This action cannot be undone.', onNext: () => {
293
279
  this.showCancelDialog = false;
294
280
  this.cancelEnvelope();
295
281
  } }))));
@@ -353,6 +339,7 @@ export class VerdocsEnvelopeSidebar {
353
339
  "activeTab": {},
354
340
  "panelOpen": {},
355
341
  "showManageDialog": {},
342
+ "showRecipientDialog": {},
356
343
  "showCancelDialog": {},
357
344
  "loading": {}
358
345
  };
@@ -3,7 +3,7 @@ export default {
3
3
  title: 'Envelopes/Envelope Sidebar',
4
4
  component: 'verdocs-envelope-sidebar',
5
5
  args: {
6
- envelopeId: '98126d3a-b6b0-4041-93a7-5cbd9daf5afa',
6
+ envelopeId: 'c64b09c1-23d8-4612-bc66-86723ab7ede3',
7
7
  },
8
8
  argTypes: {
9
9
  envelopeId: { name: 'envelopeId' },
@@ -0,0 +1,81 @@
1
+ import { c as createStore } from './index3.js';
2
+ import { i as getEnvelope } from './Envelopes.js';
3
+
4
+ const createEnvelopeStore = (envelopeId) => {
5
+ const now = new Date().toISOString();
6
+ return createStore({
7
+ isLoading: true,
8
+ isLoaded: false,
9
+ isError: false,
10
+ error: null,
11
+ updateCount: 0,
12
+ roleNames: [],
13
+ id: envelopeId,
14
+ template_id: '',
15
+ name: '',
16
+ status: 'pending',
17
+ profile_id: '',
18
+ organization_id: '',
19
+ no_contact: false,
20
+ created_at: now,
21
+ updated_at: now,
22
+ canceled_at: null,
23
+ reminder_id: null,
24
+ envelope_document_id: '',
25
+ certificate_document_id: null,
26
+ visibility: 'private',
27
+ histories: [],
28
+ recipients: [],
29
+ profile: undefined,
30
+ certificate: undefined,
31
+ document: undefined,
32
+ documents: undefined,
33
+ fields: undefined,
34
+ });
35
+ };
36
+ const envelopeStores = {};
37
+ const getEnvelopeStore = async (endpoint, envelopeId, forceReload = false) => {
38
+ let created = false;
39
+ if (!envelopeStores[envelopeId]) {
40
+ console.debug('[ENVELOPES] No envelope store found for ID, creating', envelopeId);
41
+ envelopeStores[envelopeId] = createEnvelopeStore(envelopeId);
42
+ created = true;
43
+ }
44
+ const store = envelopeStores[envelopeId];
45
+ // NOTE: If we need it, store.use() returns an unsubcribe function
46
+ // See https://github.com/ionic-team/stencil-store#storeusesubscriptions
47
+ store.use({
48
+ reset: () => console.debug('[ENVELOPES] Store got reset'),
49
+ dispose: () => console.debug('[ENVELOPES] Store got disposed'),
50
+ });
51
+ // TODO: This can create a race condition if two components call this at the same time.
52
+ // For now we can probably defer doing something smart here because it's only a
53
+ // double-load issue.
54
+ if (created || forceReload) {
55
+ console.debug('[ENVELOPES] Reloading envelope', { envelopeId, created, forceReload });
56
+ store.state.isLoading = true;
57
+ store.state.isLoaded = false;
58
+ store.state.isError = false;
59
+ store.state.error = undefined;
60
+ try {
61
+ const envelope = await getEnvelope(endpoint, envelopeId);
62
+ console.debug('[ENVELOPES] Got envelope', envelope);
63
+ Object.assign(store.state, envelope);
64
+ store.state.isLoaded = true;
65
+ store.state.isError = false;
66
+ store.state.error = undefined;
67
+ }
68
+ catch (e) {
69
+ console.error('[ENVELOPES] Error loading envelope', e);
70
+ store.state.isLoaded = false;
71
+ store.state.isError = true;
72
+ store.state.error = e;
73
+ throw e;
74
+ }
75
+ store.state.isLoading = false;
76
+ store.state.updateCount++;
77
+ }
78
+ return store;
79
+ };
80
+
81
+ export { getEnvelopeStore as g };
@@ -195,4 +195,4 @@ var throttledGetEnvelope = function (endpoint, envelopeId) {
195
195
  });
196
196
  };
197
197
 
198
- export { getSigningSession as a, updateEnvelopeFieldSignature as b, cancelEnvelope as c, updateEnvelopeFieldInitials as d, getEnvelopeDocumentPageDisplayUri as e, getEnvelope as f, getSummary as g, getEnvelopeFile as h, getFieldAttachment as i, searchEnvelopes as s, throttledGetEnvelope as t, updateEnvelopeField as u };
198
+ export { getSigningSession as a, updateEnvelopeFieldSignature as b, cancelEnvelope as c, updateEnvelopeFieldInitials as d, getEnvelopeDocumentPageDisplayUri as e, getEnvelopeFile as f, getSummary as g, getFieldAttachment as h, getEnvelope as i, searchEnvelopes as s, throttledGetEnvelope as t, updateEnvelopeField as u };
@@ -10,6 +10,7 @@ export { VerdocsComponentError as VerdocsComponentError } from '../types/compone
10
10
  export { VerdocsContactPicker as VerdocsContactPicker } from '../types/components/envelopes/verdocs-contact-picker/verdocs-contact-picker';
11
11
  export { VerdocsDropdown as VerdocsDropdown } from '../types/components/controls/verdocs-dropdown/verdocs-dropdown';
12
12
  export { VerdocsEnvelopeDocumentPage as VerdocsEnvelopeDocumentPage } from '../types/components/envelopes/verdocs-envelope-document-page/verdocs-envelope-document-page';
13
+ export { VerdocsEnvelopeRecipientLink as VerdocsEnvelopeRecipientLink } from '../types/components/envelopes/verdocs-envelope-recipient-link/verdocs-envelope-recipient-link';
13
14
  export { VerdocsEnvelopeRecipientSummary as VerdocsEnvelopeRecipientSummary } from '../types/components/envelopes/verdocs-envelope-recipient-summary/verdocs-envelope-recipient-summary';
14
15
  export { VerdocsEnvelopeSidebar as VerdocsEnvelopeSidebar } from '../types/components/envelopes/verdocs-envelope-sidebar/verdocs-envelope-sidebar';
15
16
  export { VerdocsEnvelopesList as VerdocsEnvelopesList } from '../types/components/envelopes/verdocs-envelopes-list/verdocs-envelopes-list';
@@ -10,6 +10,7 @@ export { VerdocsComponentError, defineCustomElement as defineCustomElementVerdoc
10
10
  export { VerdocsContactPicker, defineCustomElement as defineCustomElementVerdocsContactPicker } from './verdocs-contact-picker.js';
11
11
  export { VerdocsDropdown, defineCustomElement as defineCustomElementVerdocsDropdown } from './verdocs-dropdown.js';
12
12
  export { VerdocsEnvelopeDocumentPage, defineCustomElement as defineCustomElementVerdocsEnvelopeDocumentPage } from './verdocs-envelope-document-page.js';
13
+ export { VerdocsEnvelopeRecipientLink, defineCustomElement as defineCustomElementVerdocsEnvelopeRecipientLink } from './verdocs-envelope-recipient-link.js';
13
14
  export { VerdocsEnvelopeRecipientSummary, defineCustomElement as defineCustomElementVerdocsEnvelopeRecipientSummary } from './verdocs-envelope-recipient-summary.js';
14
15
  export { VerdocsEnvelopeSidebar, defineCustomElement as defineCustomElementVerdocsEnvelopeSidebar } from './verdocs-envelope-sidebar.js';
15
16
  export { VerdocsEnvelopesList, defineCustomElement as defineCustomElementVerdocsEnvelopesList } from './verdocs-envelopes-list.js';
@@ -1,5 +1,5 @@
1
1
  import { a as createCommonjsModule, c as commonjsGlobal, b as commonjsRequire } from './_commonjsHelpers.js';
2
- import { h as getEnvelopeFile, i as getFieldAttachment } from './Envelopes.js';
2
+ import { f as getEnvelopeFile, h as getFieldAttachment } from './Envelopes.js';
3
3
  import './Types.js';
4
4
  import { d as downloadBlob } from './Files.js';
5
5
  import { a as FORMAT_DATE } from './Types2.js';
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface VerdocsEnvelopeRecipientLink extends Components.VerdocsEnvelopeRecipientLink, HTMLElement {}
4
+ export const VerdocsEnvelopeRecipientLink: {
5
+ prototype: VerdocsEnvelopeRecipientLink;
6
+ new (): VerdocsEnvelopeRecipientLink;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { V as VerdocsEnvelopeRecipientLink$1, d as defineCustomElement$1 } from './verdocs-envelope-recipient-link2.js';
2
+
3
+ const VerdocsEnvelopeRecipientLink = VerdocsEnvelopeRecipientLink$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { VerdocsEnvelopeRecipientLink, defineCustomElement };