@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,120 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import './Types.js';
3
+ import { g as getInPersonLink } from './Recipients.js';
4
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint.js';
5
+ import { g as getEnvelopeStore } from './EnvelopeStore.js';
6
+ import { V as VerdocsToast } from './Toast.js';
7
+ import { S as SDKError } from './errors.js';
8
+ import { d as defineCustomElement$1 } from './verdocs-button2.js';
9
+
10
+ const verdocsEnvelopeRecipientLinkCss = "verdocs-envelope-recipient-link{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:100000;position:fixed;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;font-family:\"Inter\", \"Barlow\", sans-serif;background-color:#0000007f}verdocs-envelope-recipient-link .summary-content{width:600px;display:-ms-flexbox;display:flex;max-width:90%;font-size:18px;-ms-flex:0 0 600px;flex:0 0 600px;border-radius:6px;background:#ffffff;-ms-flex-direction:column;flex-direction:column;padding:30px 20px 20px}verdocs-envelope-recipient-link .summary-content .summary-title{font-size:20px;font-weight:700;margin:0 0 10px 0;color:#33364b}verdocs-envelope-recipient-link .summary-recipient{display:-ms-flexbox;display:flex;color:#33364b;margin:8px 0 24px 0;-ms-flex-direction:column;flex-direction:column}verdocs-envelope-recipient-link .summary-recipient .role-name{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;font-size:14px;font-weight:600;margin:0 0 8px 0;color:#092c4c}verdocs-envelope-recipient-link .summary-recipient .role-info{gap:5px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:end;align-items:flex-end}verdocs-envelope-recipient-link .summary-recipient .role-full-name{-ms-flex:1;flex:1;height:34px;display:-ms-flexbox;display:flex;font-size:16px;padding:0 12px;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #cccccc;background:#f9fafb}verdocs-envelope-recipient-link .summary-recipient .recipient-link{width:120px;padding:0 16px;font-weight:500;margin:0 0 0 8px;text-align:center;font-size:0.875rem;border-radius:100%;color:#374151;line-height:1.25rem;background-color:#d8d8d8;border:2px solid #9ca3af}verdocs-envelope-recipient-link .summary-recipient .link-wrapper{gap:5px;display:-ms-flexbox;display:flex;margin:4px 0 0 0;-ms-flex-direction:row;flex-direction:row}verdocs-envelope-recipient-link .summary-recipient .link-wrapper .link{-ms-flex:1;flex:1;height:34px;display:-ms-flexbox;display:flex;font-size:16px;padding:0 12px;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #cccccc;background:#f9fafb}verdocs-envelope-recipient-link .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;margin:10px 0 0 0;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-envelope-recipient-link .buttons verdocs-button{-ms-flex:0 0 120px;flex:0 0 120px;margin-left:10px;white-space:nowrap}verdocs-envelope-recipient-link .buttons verdocs-button button{width:100%}";
11
+
12
+ const VerdocsEnvelopeRecipientLink = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
13
+ constructor() {
14
+ super();
15
+ this.__registerHost();
16
+ this.next = createEvent(this, "next", 7);
17
+ this.sdkError = createEvent(this, "sdkError", 7);
18
+ this.store = null;
19
+ this.recipient = null;
20
+ this.endpoint = VerdocsEndpoint.getDefault();
21
+ this.envelopeId = '';
22
+ this.roleName = '';
23
+ this.isOpen = undefined;
24
+ this.loading = true;
25
+ this.gettingLink = true;
26
+ this.link = '';
27
+ }
28
+ async componentWillLoad() {
29
+ var _a, _b, _c, _d, _e, _f;
30
+ try {
31
+ this.endpoint.loadSession();
32
+ if (!this.envelopeId) {
33
+ console.log(`[RECIPIENT_LINK] Missing required envelope ID ${this.envelopeId}`);
34
+ return;
35
+ }
36
+ if (!this.endpoint.session) {
37
+ console.log('[RECIPIENT_LINK] Unable to start session, must be authenticated');
38
+ return;
39
+ }
40
+ this.store = await getEnvelopeStore(this.endpoint, this.envelopeId, true);
41
+ this.loading = false;
42
+ this.gettingLink = true;
43
+ 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);
44
+ this.getLink(this.recipient);
45
+ }
46
+ catch (e) {
47
+ console.log('[RECIPIENT_LINK] Error loading envelope', e);
48
+ (_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));
49
+ }
50
+ }
51
+ handleDone(e) {
52
+ var _a;
53
+ e.preventDefault();
54
+ (_a = this.next) === null || _a === void 0 ? void 0 : _a.emit({ envelope: this.store.state });
55
+ }
56
+ copyLink(link) {
57
+ navigator.clipboard
58
+ .writeText(link)
59
+ .then(() => VerdocsToast('Link copied to clipboard!', { style: 'success', duration: 3000 }))
60
+ .catch(e => {
61
+ console.warn('[RECIPIENT_LINK] Error copying to clipboard', e);
62
+ VerdocsToast(`Unable to copy to clipboard: ${e.message}`, { style: 'error' });
63
+ });
64
+ }
65
+ getLink(recipient) {
66
+ this.gettingLink = true;
67
+ getInPersonLink(this.endpoint, recipient.envelope_id, recipient.role_name)
68
+ .then(response => {
69
+ this.gettingLink = false;
70
+ this.link = response.link;
71
+ // NOTE: Left here for documentation purposes. We don't auto-copy the link because many browsers now
72
+ // error on that because we aren't the focus/gesture-initiator since we're a new component just being
73
+ // drawn in the DOM. So we let the user click to trigger that.
74
+ // this.copyLink(response.link);
75
+ })
76
+ .catch(e => {
77
+ this.gettingLink = false;
78
+ console.log('[RECIPIENT_LINK] Error getting link', e);
79
+ VerdocsToast('Unable to get link: ' + e.message, { style: 'error' });
80
+ });
81
+ }
82
+ render() {
83
+ if (this.loading || !this.recipient) {
84
+ return h(Host, null);
85
+ }
86
+ // const recipientsWithActions = getRecipientsWithActions(this.store.state); const showLinkButton = recipientCanAct(recipient, recipientsWithActions); const link =
87
+ // this.links[recipient.role_name]; const gettingLink = this.gettingLinks[recipient.role_name]; return (
88
+ 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) })))));
89
+ }
90
+ static get style() { return verdocsEnvelopeRecipientLinkCss; }
91
+ }, [0, "verdocs-envelope-recipient-link", {
92
+ "endpoint": [16],
93
+ "envelopeId": [1, "envelope-id"],
94
+ "roleName": [1, "role-name"],
95
+ "isOpen": [32],
96
+ "loading": [32],
97
+ "gettingLink": [32],
98
+ "link": [32]
99
+ }]);
100
+ function defineCustomElement() {
101
+ if (typeof customElements === "undefined") {
102
+ return;
103
+ }
104
+ const components = ["verdocs-envelope-recipient-link", "verdocs-button"];
105
+ components.forEach(tagName => { switch (tagName) {
106
+ case "verdocs-envelope-recipient-link":
107
+ if (!customElements.get(tagName)) {
108
+ customElements.define(tagName, VerdocsEnvelopeRecipientLink);
109
+ }
110
+ break;
111
+ case "verdocs-button":
112
+ if (!customElements.get(tagName)) {
113
+ defineCustomElement$1();
114
+ }
115
+ break;
116
+ } });
117
+ }
118
+ defineCustomElement();
119
+
120
+ export { VerdocsEnvelopeRecipientLink as V, defineCustomElement as d };
@@ -3,89 +3,11 @@ import { g as getRecipientsWithActions, r as recipientCanAct } from './Permissio
3
3
  import { g as getInPersonLink } from './Recipients.js';
4
4
  import './Types.js';
5
5
  import { V as VerdocsEndpoint } from './VerdocsEndpoint.js';
6
- import { c as createStore } from './index3.js';
7
- import { f as getEnvelope } from './Envelopes.js';
6
+ import { g as getEnvelopeStore } from './EnvelopeStore.js';
8
7
  import { V as VerdocsToast } from './Toast.js';
9
8
  import { S as SDKError } from './errors.js';
10
9
  import { d as defineCustomElement$1 } from './verdocs-button2.js';
11
10
 
12
- const createEnvelopeStore = (envelopeId) => {
13
- const now = new Date().toISOString();
14
- return createStore({
15
- isLoading: true,
16
- isLoaded: false,
17
- isError: false,
18
- error: null,
19
- updateCount: 0,
20
- roleNames: [],
21
- id: envelopeId,
22
- template_id: '',
23
- name: '',
24
- status: 'pending',
25
- profile_id: '',
26
- organization_id: '',
27
- no_contact: false,
28
- created_at: now,
29
- updated_at: now,
30
- canceled_at: null,
31
- reminder_id: null,
32
- envelope_document_id: '',
33
- certificate_document_id: null,
34
- visibility: 'private',
35
- histories: [],
36
- recipients: [],
37
- profile: undefined,
38
- certificate: undefined,
39
- document: undefined,
40
- documents: undefined,
41
- fields: undefined,
42
- });
43
- };
44
- const envelopeStores = {};
45
- const getEnvelopeStore = async (endpoint, envelopeId, forceReload = false) => {
46
- let created = false;
47
- if (!envelopeStores[envelopeId]) {
48
- console.debug('[ENVELOPES] No envelope store found for ID, creating', envelopeId);
49
- envelopeStores[envelopeId] = createEnvelopeStore(envelopeId);
50
- created = true;
51
- }
52
- const store = envelopeStores[envelopeId];
53
- // NOTE: If we need it, store.use() returns an unsubcribe function
54
- // See https://github.com/ionic-team/stencil-store#storeusesubscriptions
55
- store.use({
56
- reset: () => console.debug('[ENVELOPES] Store got reset'),
57
- dispose: () => console.debug('[ENVELOPES] Store got disposed'),
58
- });
59
- // TODO: This can create a race condition if two components call this at the same time.
60
- // For now we can probably defer doing something smart here because it's only a
61
- // double-load issue.
62
- if (created || forceReload) {
63
- console.debug('[ENVELOPES] Reloading envelope', { envelopeId, created, forceReload });
64
- store.state.isLoading = true;
65
- store.state.isLoaded = false;
66
- store.state.isError = false;
67
- store.state.error = undefined;
68
- try {
69
- const envelope = await getEnvelope(endpoint, envelopeId);
70
- console.debug('[ENVELOPES] Got envelope', envelope);
71
- Object.assign(store.state, envelope);
72
- store.state.isLoaded = true;
73
- store.state.isError = false;
74
- store.state.error = undefined;
75
- }
76
- catch (e) {
77
- console.error('[ENVELOPES] Error loading envelope', e);
78
- store.state.isLoaded = false;
79
- store.state.isError = true;
80
- store.state.error = e;
81
- throw e;
82
- }
83
- store.state.isLoading = false;
84
- store.state.updateCount++;
85
- }
86
- return store;
87
- };
88
-
89
11
  const verdocsEnvelopeRecipientSummaryCss = "verdocs-envelope-recipient-summary{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:100000;position:fixed;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;font-family:\"Inter\", \"Barlow\", sans-serif;background-color:#0000007f}verdocs-envelope-recipient-summary .summary-content{width:600px;display:-ms-flexbox;display:flex;max-width:90%;font-size:18px;-ms-flex:0 0 600px;flex:0 0 600px;border-radius:6px;background:#ffffff;-ms-flex-direction:column;flex-direction:column;padding:30px 20px 20px}verdocs-envelope-recipient-summary .summary-content .summary-title{font-size:20px;font-weight:700;margin:0 0 10px 0;color:#33364b}verdocs-envelope-recipient-summary .summary-recipient{display:-ms-flexbox;display:flex;color:#33364b;margin:8px 0 24px 0;-ms-flex-direction:column;flex-direction:column}verdocs-envelope-recipient-summary .summary-recipient .role-name{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;font-size:14px;font-weight:600;margin:0 0 8px 0;color:#092c4c}verdocs-envelope-recipient-summary .summary-recipient .role-info{gap:5px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:end;align-items:flex-end}verdocs-envelope-recipient-summary .summary-recipient .role-full-name{-ms-flex:1;flex:1;height:34px;display:-ms-flexbox;display:flex;font-size:16px;padding:0 12px;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #cccccc;background:#f9fafb}verdocs-envelope-recipient-summary .summary-recipient .recipient-link{width:120px;padding:0 16px;font-weight:500;margin:0 0 0 8px;text-align:center;font-size:0.875rem;border-radius:100%;color:#374151;line-height:1.25rem;background-color:#d8d8d8;border:2px solid #9ca3af}verdocs-envelope-recipient-summary .summary-recipient .link-wrapper{gap:5px;display:-ms-flexbox;display:flex;margin:4px 0 0 0;-ms-flex-direction:row;flex-direction:row}verdocs-envelope-recipient-summary .summary-recipient .link-wrapper .link{-ms-flex:1;flex:1;height:34px;display:-ms-flexbox;display:flex;font-size:16px;padding:0 12px;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #cccccc;background:#f9fafb}verdocs-envelope-recipient-summary .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;margin:10px 0 0 0;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-envelope-recipient-summary .buttons verdocs-button{-ms-flex:0 0 120px;flex:0 0 120px;margin-left:10px;white-space:nowrap}verdocs-envelope-recipient-summary .buttons verdocs-button button{width:100%}";
90
12
 
91
13
  const VerdocsEnvelopeRecipientSummary = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
@@ -102,7 +24,6 @@ const VerdocsEnvelopeRecipientSummary = /*@__PURE__*/ proxyCustomElement(class e
102
24
  this.canSendAnother = true;
103
25
  this.canView = true;
104
26
  this.canDone = true;
105
- this.envelope = undefined;
106
27
  this.isOpen = undefined;
107
28
  this.loading = true;
108
29
  this.recipientStatusIcons = [];
@@ -195,7 +116,6 @@ const VerdocsEnvelopeRecipientSummary = /*@__PURE__*/ proxyCustomElement(class e
195
116
  "canSendAnother": [4, "can-send-another"],
196
117
  "canView": [4, "can-view"],
197
118
  "canDone": [4, "can-done"],
198
- "envelope": [16],
199
119
  "isOpen": [32],
200
120
  "loading": [32],
201
121
  "recipientStatusIcons": [32],
@@ -223,4 +143,4 @@ function defineCustomElement() {
223
143
  }
224
144
  defineCustomElement();
225
145
 
226
- export { VerdocsEnvelopeRecipientSummary as V, defineCustomElement as d, getEnvelopeStore as g };
146
+ export { VerdocsEnvelopeRecipientSummary as V, defineCustomElement as d };
@@ -1,15 +1,17 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
2
  import { c as cancelEnvelope } from './Envelopes.js';
3
3
  import { u as userIsEnvelopeOwner } from './Permissions.js';
4
- import { g as getInPersonLink, r as resendInvitation } from './Recipients.js';
4
+ import { r as resendInvitation } from './Recipients.js';
5
5
  import './Types.js';
6
6
  import { V as VerdocsEndpoint } from './VerdocsEndpoint.js';
7
- import { g as getEnvelopeStore, d as defineCustomElement$3 } from './verdocs-envelope-recipient-summary2.js';
7
+ import { g as getEnvelopeStore } from './EnvelopeStore.js';
8
8
  import { F as FORMAT_TIMESTAMP } from './Types2.js';
9
9
  import { V as VerdocsToast } from './Toast.js';
10
10
  import { S as SDKError } from './errors.js';
11
- import { d as defineCustomElement$5 } from './verdocs-button2.js';
12
- import { d as defineCustomElement$4 } from './verdocs-dropdown2.js';
11
+ import { d as defineCustomElement$6 } from './verdocs-button2.js';
12
+ import { d as defineCustomElement$5 } from './verdocs-dropdown2.js';
13
+ import { d as defineCustomElement$4 } from './verdocs-envelope-recipient-link2.js';
14
+ import { d as defineCustomElement$3 } from './verdocs-envelope-recipient-summary2.js';
13
15
  import { d as defineCustomElement$2 } from './verdocs-ok-dialog2.js';
14
16
  import { f as format } from './index2.js';
15
17
 
@@ -53,6 +55,7 @@ const VerdocsEnvelopeSidebar$1 = /*@__PURE__*/ proxyCustomElement(class extends
53
55
  this.activeTab = 1;
54
56
  this.panelOpen = false;
55
57
  this.showManageDialog = false;
58
+ this.showRecipientDialog = '';
56
59
  this.showCancelDialog = false;
57
60
  this.loading = true;
58
61
  }
@@ -95,12 +98,6 @@ const VerdocsEnvelopeSidebar$1 = /*@__PURE__*/ proxyCustomElement(class extends
95
98
  return (!['pending', 'declined', 'submitted', 'canceled'].includes(recipient.status) && //
96
99
  !['complete', 'declined', 'canceled'].includes((_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.status));
97
100
  }
98
- canModifyRecipient(recipient) {
99
- var _a, _b;
100
- return (!recipient.claimed && //
101
- !['declined', 'signed', 'submitted', 'canceled'].includes(recipient.status) &&
102
- !['complete', 'declined', 'canceled'].includes((_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.status));
103
- }
104
101
  handleRecipientAction(recipient, id) {
105
102
  var _a, _b;
106
103
  console.log('[SIDEBAR] Recipient action', id, recipient);
@@ -116,13 +113,7 @@ const VerdocsEnvelopeSidebar$1 = /*@__PURE__*/ proxyCustomElement(class extends
116
113
  });
117
114
  break;
118
115
  case 'inperson':
119
- getInPersonLink(this.endpoint, recipient.envelope_id, recipient.role_name)
120
- .then(({ link }) => navigator.clipboard.writeText(link))
121
- .then(() => VerdocsToast('Link copied to clipboard.', { style: 'success', duration: 2000 }))
122
- .catch(e => {
123
- console.log('[RECIPIENTS] Error getting link', e);
124
- VerdocsToast('Unable to get link: ' + e.message, { style: 'error' });
125
- });
116
+ this.showRecipientDialog = recipient.role_name;
126
117
  break;
127
118
  case 'modify':
128
119
  VerdocsToast('This feature will be enabled in a future release. Please try again later.', { style: 'info' });
@@ -264,12 +255,11 @@ const VerdocsEnvelopeSidebar$1 = /*@__PURE__*/ proxyCustomElement(class extends
264
255
  entries.sort((a, b) => b.date.getTime() - a.date.getTime());
265
256
  return entries;
266
257
  }
267
- canModify(recipient) {
268
- var _a, _b;
269
- const invalidRecipientStatus = ['declined', 'signed', 'submitted', 'canceled'];
270
- const invalidEnvelopeStatus = ['complete', 'declined', 'canceled'];
271
- 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;
272
- }
258
+ // canModify(recipient: IRecipient) {
259
+ // const invalidRecipientStatus = ['declined', 'signed', 'submitted', 'canceled'];
260
+ // const invalidEnvelopeStatus = ['complete', 'declined', 'canceled'];
261
+ // return recipient.claimed !== true && invalidRecipientStatus.indexOf(recipient.status) === -1 && invalidEnvelopeStatus.indexOf(this.store?.state?.status) === -1;
262
+ // }
273
263
  render() {
274
264
  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;
275
265
  if (!this.store.state) {
@@ -283,7 +273,7 @@ const VerdocsEnvelopeSidebar$1 = /*@__PURE__*/ proxyCustomElement(class extends
283
273
  _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 :
284
274
  _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 :
285
275
  _0.recipients.map((recipient, index) => {
286
- const canGetInPersonLink = !this.canModify(recipient) || (recipient.status !== 'invited' && recipient.status !== 'opened');
276
+ const canGetInPersonLink = recipient.status !== 'signed' && recipient.status !== 'submitted' && recipient.status !== 'canceled' && recipient.status !== 'declined';
287
277
  const canSendReminder = this.canResendRecipient(recipient);
288
278
  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: [
289
279
  { id: 'reminder', label: 'Send Reminder', disabled: !canSendReminder },
@@ -292,13 +282,11 @@ const VerdocsEnvelopeSidebar$1 = /*@__PURE__*/ proxyCustomElement(class extends
292
282
  // TODO: Details dialog
293
283
  // {id:'details',label: 'View Details'},
294
284
  ] }))), 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))));
295
- }), 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: () => {
285
+ }), 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: () => {
296
286
  var _a;
297
287
  this.showManageDialog = false;
298
288
  (_a = this.another) === null || _a === void 0 ? void 0 : _a.emit({ envelope: this.store.state });
299
- }, onNext: () => {
300
- this.showManageDialog = false;
301
- } })), 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: () => {
289
+ }, 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: () => {
302
290
  this.showCancelDialog = false;
303
291
  this.cancelEnvelope();
304
292
  } }))));
@@ -310,6 +298,7 @@ const VerdocsEnvelopeSidebar$1 = /*@__PURE__*/ proxyCustomElement(class extends
310
298
  "activeTab": [32],
311
299
  "panelOpen": [32],
312
300
  "showManageDialog": [32],
301
+ "showRecipientDialog": [32],
313
302
  "showCancelDialog": [32],
314
303
  "loading": [32]
315
304
  }]);
@@ -317,7 +306,7 @@ function defineCustomElement$1() {
317
306
  if (typeof customElements === "undefined") {
318
307
  return;
319
308
  }
320
- const components = ["verdocs-envelope-sidebar", "verdocs-button", "verdocs-dropdown", "verdocs-envelope-recipient-summary", "verdocs-ok-dialog"];
309
+ const components = ["verdocs-envelope-sidebar", "verdocs-button", "verdocs-dropdown", "verdocs-envelope-recipient-link", "verdocs-envelope-recipient-summary", "verdocs-ok-dialog"];
321
310
  components.forEach(tagName => { switch (tagName) {
322
311
  case "verdocs-envelope-sidebar":
323
312
  if (!customElements.get(tagName)) {
@@ -326,10 +315,15 @@ function defineCustomElement$1() {
326
315
  break;
327
316
  case "verdocs-button":
328
317
  if (!customElements.get(tagName)) {
329
- defineCustomElement$5();
318
+ defineCustomElement$6();
330
319
  }
331
320
  break;
332
321
  case "verdocs-dropdown":
322
+ if (!customElements.get(tagName)) {
323
+ defineCustomElement$5();
324
+ }
325
+ break;
326
+ case "verdocs-envelope-recipient-link":
333
327
  if (!customElements.get(tagName)) {
334
328
  defineCustomElement$4();
335
329
  }
package/dist/docs.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2023-07-14T21:15:06",
2
+ "timestamp": "2023-07-17T15:23:33",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "2.20.0",
@@ -670,6 +670,7 @@
670
670
  "verdocs-activity-box",
671
671
  "verdocs-auth",
672
672
  "verdocs-contact-picker",
673
+ "verdocs-envelope-recipient-link",
673
674
  "verdocs-envelope-recipient-summary",
674
675
  "verdocs-envelope-sidebar",
675
676
  "verdocs-envelopes-list",
@@ -702,6 +703,9 @@
702
703
  "verdocs-contact-picker": [
703
704
  "verdocs-button"
704
705
  ],
706
+ "verdocs-envelope-recipient-link": [
707
+ "verdocs-button"
708
+ ],
705
709
  "verdocs-envelope-recipient-summary": [
706
710
  "verdocs-button"
707
711
  ],
@@ -1458,11 +1462,110 @@
1458
1462
  ]
1459
1463
  }
1460
1464
  },
1465
+ {
1466
+ "filePath": "./src/components/envelopes/verdocs-envelope-recipient-link/verdocs-envelope-recipient-link.tsx",
1467
+ "encapsulation": "none",
1468
+ "tag": "verdocs-envelope-recipient-link",
1469
+ "docs": "Displays a single recipient from an envelope, with the opportunity to copy an in-person\nsigning link for that recipient to use.",
1470
+ "docsTags": [],
1471
+ "usage": {},
1472
+ "props": [
1473
+ {
1474
+ "name": "endpoint",
1475
+ "type": "VerdocsEndpoint",
1476
+ "mutable": false,
1477
+ "reflectToAttr": false,
1478
+ "docs": "The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.",
1479
+ "docsTags": [],
1480
+ "default": "VerdocsEndpoint.getDefault()",
1481
+ "values": [
1482
+ {
1483
+ "type": "VerdocsEndpoint"
1484
+ }
1485
+ ],
1486
+ "optional": false,
1487
+ "required": false
1488
+ },
1489
+ {
1490
+ "name": "envelopeId",
1491
+ "type": "string",
1492
+ "mutable": false,
1493
+ "attr": "envelope-id",
1494
+ "reflectToAttr": false,
1495
+ "docs": "The envelope ID to edit.",
1496
+ "docsTags": [],
1497
+ "default": "''",
1498
+ "values": [
1499
+ {
1500
+ "type": "string"
1501
+ }
1502
+ ],
1503
+ "optional": false,
1504
+ "required": false
1505
+ },
1506
+ {
1507
+ "name": "roleName",
1508
+ "type": "string",
1509
+ "mutable": false,
1510
+ "attr": "role-name",
1511
+ "reflectToAttr": false,
1512
+ "docs": "The role to load.",
1513
+ "docsTags": [],
1514
+ "default": "''",
1515
+ "values": [
1516
+ {
1517
+ "type": "string"
1518
+ }
1519
+ ],
1520
+ "optional": false,
1521
+ "required": false
1522
+ }
1523
+ ],
1524
+ "methods": [],
1525
+ "events": [
1526
+ {
1527
+ "event": "next",
1528
+ "detail": "{ envelope: IEnvelope; }",
1529
+ "bubbles": true,
1530
+ "cancelable": true,
1531
+ "composed": true,
1532
+ "docs": "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.",
1533
+ "docsTags": []
1534
+ },
1535
+ {
1536
+ "event": "sdkError",
1537
+ "detail": "SDKError",
1538
+ "bubbles": true,
1539
+ "cancelable": true,
1540
+ "composed": true,
1541
+ "docs": "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.",
1542
+ "docsTags": []
1543
+ }
1544
+ ],
1545
+ "listeners": [],
1546
+ "styles": [],
1547
+ "slots": [],
1548
+ "parts": [],
1549
+ "dependents": [
1550
+ "verdocs-envelope-sidebar"
1551
+ ],
1552
+ "dependencies": [
1553
+ "verdocs-button"
1554
+ ],
1555
+ "dependencyGraph": {
1556
+ "verdocs-envelope-recipient-link": [
1557
+ "verdocs-button"
1558
+ ],
1559
+ "verdocs-envelope-sidebar": [
1560
+ "verdocs-envelope-recipient-link"
1561
+ ]
1562
+ }
1563
+ },
1461
1564
  {
1462
1565
  "filePath": "./src/components/envelopes/verdocs-envelope-recipient-summary/verdocs-envelope-recipient-summary.tsx",
1463
1566
  "encapsulation": "none",
1464
1567
  "tag": "verdocs-envelope-recipient-summary",
1465
- "docs": "Displays an icon and message describing a document's completion status. For convenience, the status may be passed in either\ndirectly as a status field or the whole document object may be passed in.\n\nIf the document is provided, the status flag will indicate the document's overall status. This also makes the component clickable\nto display a popup panel with per-recipient status data.\n\nIf the status is provided as a string it can be either a `TRecipientStatus` or `TDocumentStatus` value.",
1568
+ "docs": "Displays a list of recipients with options to get in-person signing links for each one.",
1466
1569
  "docsTags": [],
1467
1570
  "usage": {},
1468
1571
  "props": [
@@ -1533,21 +1636,6 @@
1533
1636
  "optional": false,
1534
1637
  "required": false
1535
1638
  },
1536
- {
1537
- "name": "envelope",
1538
- "type": "IEnvelope",
1539
- "mutable": false,
1540
- "reflectToAttr": false,
1541
- "docs": "The document to display status for. Ignored if `status` is set directly.",
1542
- "docsTags": [],
1543
- "values": [
1544
- {
1545
- "type": "IEnvelope"
1546
- }
1547
- ],
1548
- "optional": true,
1549
- "required": false
1550
- },
1551
1639
  {
1552
1640
  "name": "envelopeId",
1553
1641
  "type": "string",
@@ -1713,6 +1801,7 @@
1713
1801
  "dependencies": [
1714
1802
  "verdocs-dropdown",
1715
1803
  "verdocs-button",
1804
+ "verdocs-envelope-recipient-link",
1716
1805
  "verdocs-envelope-recipient-summary",
1717
1806
  "verdocs-ok-dialog"
1718
1807
  ],
@@ -1720,9 +1809,13 @@
1720
1809
  "verdocs-envelope-sidebar": [
1721
1810
  "verdocs-dropdown",
1722
1811
  "verdocs-button",
1812
+ "verdocs-envelope-recipient-link",
1723
1813
  "verdocs-envelope-recipient-summary",
1724
1814
  "verdocs-ok-dialog"
1725
1815
  ],
1816
+ "verdocs-envelope-recipient-link": [
1817
+ "verdocs-button"
1818
+ ],
1726
1819
  "verdocs-envelope-recipient-summary": [
1727
1820
  "verdocs-button"
1728
1821
  ],