@verdocs/web-sdk 1.14.9 → 1.14.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.
Files changed (174) hide show
  1. package/dist/cjs/EnvelopeStore-a4231cf7.js +83 -0
  2. package/dist/cjs/{Recipients-2b21fdea.js → Recipients-f3d6cf10.js} +9 -0
  3. package/dist/cjs/{index-6528b430.js → index-7c19ba1d.js} +63 -219
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/{utils-f4efefe3.js → utils-618c13f1.js} +1 -1
  6. package/dist/cjs/verdocs-dropdown_2.cjs.entry.js +2 -2
  7. package/dist/cjs/verdocs-envelope-recipient-summary.cjs.entry.js +15 -91
  8. package/dist/cjs/verdocs-envelope-sidebar.cjs.entry.js +101 -45
  9. package/dist/cjs/verdocs-field-checkbox.cjs.entry.js +2 -2
  10. package/dist/cjs/verdocs-field-date.cjs.entry.js +2 -2
  11. package/dist/cjs/verdocs-field-dropdown.cjs.entry.js +2 -2
  12. package/dist/cjs/verdocs-field-initial.cjs.entry.js +2 -2
  13. package/dist/cjs/verdocs-field-payment.cjs.entry.js +2 -2
  14. package/dist/cjs/verdocs-field-radio-button.cjs.entry.js +2 -2
  15. package/dist/cjs/verdocs-field-signature.cjs.entry.js +2 -2
  16. package/dist/cjs/verdocs-field-textarea.cjs.entry.js +27 -19
  17. package/dist/cjs/verdocs-field-textbox.cjs.entry.js +26 -17
  18. package/dist/cjs/verdocs-field-timestamp.cjs.entry.js +2 -2
  19. package/dist/cjs/verdocs-organization-card.cjs.entry.js +1 -1
  20. package/dist/cjs/verdocs-preview.cjs.entry.js +2 -2
  21. package/dist/cjs/verdocs-send.cjs.entry.js +2 -2
  22. package/dist/cjs/verdocs-sign.cjs.entry.js +3 -3
  23. package/dist/cjs/verdocs-template-document-page_2.cjs.entry.js +2 -2
  24. package/dist/cjs/verdocs-template-fields_4.cjs.entry.js +3 -3
  25. package/dist/cjs/verdocs-template-reminders.cjs.entry.js +10 -0
  26. package/dist/cjs/verdocs-view.cjs.entry.js +2 -2
  27. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  28. package/dist/collection/components/envelopes/verdocs-envelope-sidebar/verdocs-envelope-sidebar.css +8 -0
  29. package/dist/collection/components/envelopes/verdocs-envelope-sidebar/verdocs-envelope-sidebar.js +101 -48
  30. package/dist/collection/components/envelopes/verdocs-envelope-sidebar/verdocs-envelope-sidebar.stories.js +1 -1
  31. package/dist/collection/components/fields/verdocs-field-textarea/verdocs-field-textarea.js +61 -17
  32. package/dist/collection/components/fields/verdocs-field-textbox/verdocs-field-textbox.js +60 -15
  33. package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.stories.js +1 -1
  34. package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.css +2 -1
  35. package/dist/components/Envelopes.js +1 -1
  36. package/dist/components/Recipients.js +9 -1
  37. package/dist/components/index2.js +63 -219
  38. package/dist/components/verdocs-envelope-document-page2.js +1 -1
  39. package/dist/components/verdocs-envelope-recipient-summary2.js +2 -2
  40. package/dist/components/verdocs-envelope-sidebar.js +112 -54
  41. package/dist/components/verdocs-field-textarea.js +27 -17
  42. package/dist/components/verdocs-field-textbox.js +26 -15
  43. package/dist/components/verdocs-template-reminders.js +10 -0
  44. package/dist/components/verdocs-template-roles2.js +1 -1
  45. package/dist/components/verdocs-view2.js +1 -1
  46. package/dist/docs.json +80 -3
  47. package/dist/esm/EnvelopeStore-28f5d8f5.js +81 -0
  48. package/dist/esm/{Envelopes-c3d471e5.js → Envelopes-105a4a8f.js} +1 -1
  49. package/dist/esm/{Recipients-198b2531.js → Recipients-4ec2138c.js} +9 -1
  50. package/dist/esm/{index-d264c496.js → index-914ed6f7.js} +63 -219
  51. package/dist/esm/loader.js +1 -1
  52. package/dist/esm/{utils-9da23ba1.js → utils-60683446.js} +2 -2
  53. package/dist/esm/verdocs-dropdown_2.entry.js +3 -3
  54. package/dist/esm/verdocs-envelope-recipient-summary.entry.js +4 -80
  55. package/dist/esm/verdocs-envelope-sidebar.entry.js +102 -46
  56. package/dist/esm/verdocs-field-checkbox.entry.js +3 -3
  57. package/dist/esm/verdocs-field-date.entry.js +3 -3
  58. package/dist/esm/verdocs-field-dropdown.entry.js +3 -3
  59. package/dist/esm/verdocs-field-initial.entry.js +3 -3
  60. package/dist/esm/verdocs-field-payment.entry.js +3 -3
  61. package/dist/esm/verdocs-field-radio-button.entry.js +3 -3
  62. package/dist/esm/verdocs-field-signature.entry.js +3 -3
  63. package/dist/esm/verdocs-field-textarea.entry.js +28 -20
  64. package/dist/esm/verdocs-field-textbox.entry.js +27 -18
  65. package/dist/esm/verdocs-field-timestamp.entry.js +3 -3
  66. package/dist/esm/verdocs-organization-card.entry.js +1 -1
  67. package/dist/esm/verdocs-preview.entry.js +3 -3
  68. package/dist/esm/verdocs-send.entry.js +3 -3
  69. package/dist/esm/verdocs-sign.entry.js +4 -4
  70. package/dist/esm/verdocs-template-document-page_2.entry.js +3 -3
  71. package/dist/esm/verdocs-template-fields_4.entry.js +4 -4
  72. package/dist/esm/verdocs-template-reminders.entry.js +10 -0
  73. package/dist/esm/verdocs-view.entry.js +3 -3
  74. package/dist/esm/verdocs-web-sdk.js +1 -1
  75. package/dist/esm-es5/EnvelopeStore-28f5d8f5.js +1 -0
  76. package/dist/esm-es5/{Envelopes-c3d471e5.js → Envelopes-105a4a8f.js} +1 -1
  77. package/dist/esm-es5/Recipients-4ec2138c.js +1 -0
  78. package/dist/esm-es5/index-914ed6f7.js +1 -0
  79. package/dist/esm-es5/loader.js +1 -1
  80. package/dist/esm-es5/{utils-9da23ba1.js → utils-60683446.js} +1 -1
  81. package/dist/esm-es5/verdocs-dropdown_2.entry.js +1 -1
  82. package/dist/esm-es5/verdocs-envelope-recipient-summary.entry.js +1 -1
  83. package/dist/esm-es5/verdocs-envelope-sidebar.entry.js +1 -1
  84. package/dist/esm-es5/verdocs-field-checkbox.entry.js +1 -1
  85. package/dist/esm-es5/verdocs-field-date.entry.js +1 -1
  86. package/dist/esm-es5/verdocs-field-dropdown.entry.js +1 -1
  87. package/dist/esm-es5/verdocs-field-initial.entry.js +1 -1
  88. package/dist/esm-es5/verdocs-field-payment.entry.js +1 -1
  89. package/dist/esm-es5/verdocs-field-radio-button.entry.js +1 -1
  90. package/dist/esm-es5/verdocs-field-signature.entry.js +1 -1
  91. package/dist/esm-es5/verdocs-field-textarea.entry.js +1 -1
  92. package/dist/esm-es5/verdocs-field-textbox.entry.js +1 -1
  93. package/dist/esm-es5/verdocs-field-timestamp.entry.js +1 -1
  94. package/dist/esm-es5/verdocs-organization-card.entry.js +1 -1
  95. package/dist/esm-es5/verdocs-preview.entry.js +1 -1
  96. package/dist/esm-es5/verdocs-send.entry.js +1 -1
  97. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  98. package/dist/esm-es5/verdocs-template-document-page_2.entry.js +1 -1
  99. package/dist/esm-es5/verdocs-template-fields_4.entry.js +1 -1
  100. package/dist/esm-es5/verdocs-view.entry.js +1 -1
  101. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  102. package/dist/types/components/envelopes/verdocs-envelope-sidebar/verdocs-envelope-sidebar.d.ts +7 -5
  103. package/dist/types/components/fields/verdocs-field-textarea/verdocs-field-textarea.d.ts +8 -0
  104. package/dist/types/components/fields/verdocs-field-textbox/verdocs-field-textbox.d.ts +8 -0
  105. package/dist/types/components.d.ts +32 -0
  106. package/dist/verdocs-web-sdk/{p-4a39c1a4.system.entry.js → p-02a70b8e.system.entry.js} +1 -1
  107. package/dist/verdocs-web-sdk/{p-eb3beb29.system.entry.js → p-095a3eba.system.entry.js} +1 -1
  108. package/dist/verdocs-web-sdk/{p-592e9e12.entry.js → p-0aee25b9.entry.js} +1 -1
  109. package/dist/verdocs-web-sdk/p-0e381c36.entry.js +1 -0
  110. package/dist/verdocs-web-sdk/p-13959c36.system.entry.js +1 -0
  111. package/dist/verdocs-web-sdk/p-18ee4fd5.js +1 -0
  112. package/dist/verdocs-web-sdk/{p-886461cd.system.entry.js → p-1a0cccea.system.entry.js} +1 -1
  113. package/dist/verdocs-web-sdk/p-1cf38cea.system.js +1 -1
  114. package/dist/verdocs-web-sdk/{p-2cf70fcd.entry.js → p-1f561c42.entry.js} +1 -1
  115. package/dist/verdocs-web-sdk/{p-afe91637.system.entry.js → p-2c0d7838.system.entry.js} +1 -1
  116. package/dist/verdocs-web-sdk/{p-74dd0569.entry.js → p-33640d84.entry.js} +1 -1
  117. package/dist/verdocs-web-sdk/{p-7b215f9d.system.entry.js → p-380efff2.system.entry.js} +1 -1
  118. package/dist/verdocs-web-sdk/p-3cd894ff.js +1 -0
  119. package/dist/verdocs-web-sdk/{p-aebd2d02.system.entry.js → p-3fe24d0c.system.entry.js} +1 -1
  120. package/dist/verdocs-web-sdk/p-44ec0583.entry.js +1 -0
  121. package/dist/verdocs-web-sdk/{p-2631bdd9.entry.js → p-49b3ac56.entry.js} +1 -1
  122. package/dist/verdocs-web-sdk/p-4a3b037b.system.entry.js +1 -0
  123. package/dist/verdocs-web-sdk/p-5cff98bd.entry.js +1 -0
  124. package/dist/verdocs-web-sdk/{p-1402ff01.system.entry.js → p-6a44fb56.system.entry.js} +1 -1
  125. package/dist/verdocs-web-sdk/{p-cfec9914.entry.js → p-717c9fe1.entry.js} +1 -1
  126. package/dist/verdocs-web-sdk/{p-e7da2f5c.entry.js → p-73ea1ea3.entry.js} +1 -1
  127. package/dist/verdocs-web-sdk/{p-b898c99b.system.entry.js → p-7850f739.system.entry.js} +1 -1
  128. package/dist/verdocs-web-sdk/p-7a23c2c8.system.js +1 -0
  129. package/dist/verdocs-web-sdk/{p-7baf2c02.system.entry.js → p-813c2fae.system.entry.js} +1 -1
  130. package/dist/verdocs-web-sdk/{p-00f8400e.system.entry.js → p-8c5ffa7b.system.entry.js} +1 -1
  131. package/dist/verdocs-web-sdk/{p-38ac3807.entry.js → p-8e386265.entry.js} +1 -1
  132. package/dist/verdocs-web-sdk/{p-973ebb54.system.js → p-8fd812f4.system.js} +1 -1
  133. package/dist/verdocs-web-sdk/p-94365585.entry.js +1 -0
  134. package/dist/verdocs-web-sdk/{p-b8d94f4c.system.entry.js → p-9c87f6f8.system.entry.js} +1 -1
  135. package/dist/verdocs-web-sdk/p-9d7fa51d.system.entry.js +1 -0
  136. package/dist/verdocs-web-sdk/p-a3c06b62.entry.js +1 -0
  137. package/dist/verdocs-web-sdk/{p-10fe89ab.entry.js → p-a4cbba4a.entry.js} +1 -1
  138. package/dist/verdocs-web-sdk/p-a6e5814e.entry.js +1 -0
  139. package/dist/verdocs-web-sdk/{p-ee53ee29.system.entry.js → p-afa1f20b.system.entry.js} +1 -1
  140. package/dist/verdocs-web-sdk/{p-b00a49aa.entry.js → p-be6d3848.entry.js} +1 -1
  141. package/dist/verdocs-web-sdk/p-c220af42.js +1 -0
  142. package/dist/verdocs-web-sdk/{p-c0b1ace5.entry.js → p-c3ef7b4f.entry.js} +1 -1
  143. package/dist/verdocs-web-sdk/{p-9b73909f.js → p-cf790f4f.js} +1 -1
  144. package/dist/verdocs-web-sdk/{p-7dda316b.entry.js → p-d4c8f358.entry.js} +1 -1
  145. package/dist/verdocs-web-sdk/p-dc9c4361.system.js +1 -0
  146. package/dist/verdocs-web-sdk/{p-64897a63.entry.js → p-decf6a56.entry.js} +1 -1
  147. package/dist/verdocs-web-sdk/p-e2635788.system.entry.js +1 -0
  148. package/dist/verdocs-web-sdk/{p-f1940c85.system.entry.js → p-e727af9c.system.entry.js} +1 -1
  149. package/dist/verdocs-web-sdk/{p-d146b48e.entry.js → p-e72c075e.entry.js} +1 -1
  150. package/dist/verdocs-web-sdk/p-eaf0b189.system.js +1 -0
  151. package/dist/verdocs-web-sdk/{p-ca2ed07e.system.entry.js → p-f0db17e6.system.entry.js} +1 -1
  152. package/dist/verdocs-web-sdk/{p-10444734.system.entry.js → p-f2b225b7.system.entry.js} +1 -1
  153. package/dist/verdocs-web-sdk/{p-73155c52.js → p-f9bea98a.js} +1 -1
  154. package/dist/verdocs-web-sdk/{p-da31f940.system.js → p-fa6b1145.system.js} +1 -1
  155. package/dist/verdocs-web-sdk/{p-05fc6555.system.entry.js → p-fcfd3193.system.entry.js} +1 -1
  156. package/dist/verdocs-web-sdk/{p-4dec0879.entry.js → p-fdda1309.entry.js} +1 -1
  157. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  158. package/package.json +5 -5
  159. package/dist/esm-es5/Recipients-198b2531.js +0 -1
  160. package/dist/esm-es5/index-d264c496.js +0 -1
  161. package/dist/verdocs-web-sdk/p-10ec9a96.entry.js +0 -1
  162. package/dist/verdocs-web-sdk/p-12e54f39.js +0 -1
  163. package/dist/verdocs-web-sdk/p-23292d40.system.entry.js +0 -1
  164. package/dist/verdocs-web-sdk/p-3601cc11.entry.js +0 -1
  165. package/dist/verdocs-web-sdk/p-381f2a5f.entry.js +0 -1
  166. package/dist/verdocs-web-sdk/p-48d71927.system.entry.js +0 -1
  167. package/dist/verdocs-web-sdk/p-494d4276.system.js +0 -1
  168. package/dist/verdocs-web-sdk/p-4d1f3ddb.entry.js +0 -1
  169. package/dist/verdocs-web-sdk/p-51a3ea62.system.js +0 -1
  170. package/dist/verdocs-web-sdk/p-9c87a748.system.entry.js +0 -1
  171. package/dist/verdocs-web-sdk/p-ab01f71e.js +0 -1
  172. package/dist/verdocs-web-sdk/p-c2e75693.entry.js +0 -1
  173. package/dist/verdocs-web-sdk/p-e4ab3dfc.system.entry.js +0 -1
  174. package/dist/verdocs-web-sdk/p-e5f44611.entry.js +0 -1
@@ -1,11 +1,13 @@
1
1
  import { format } from 'date-fns';
2
2
  import { VerdocsEndpoint } from '@verdocs/js-sdk';
3
- import { throttledGetEnvelope } from '@verdocs/js-sdk/Envelopes/Envelopes';
4
- import { h, Host } from '@stencil/core';
5
3
  import { userIsEnvelopeOwner } from '@verdocs/js-sdk/Envelopes/Permissions';
4
+ import { h, Host } from '@stencil/core';
5
+ import { getInPersonLink, resendInvitation } from '@verdocs/js-sdk/Envelopes/Recipients';
6
+ import { getEnvelopeStore } from '../../../utils/EnvelopeStore';
6
7
  import { FORMAT_TIMESTAMP } from '../../../utils/Types';
7
8
  import { VerdocsToast } from '../../../utils/Toast';
8
9
  import { SDKError } from '../../../utils/errors';
10
+ import { cancelEnvelope } from '@verdocs/js-sdk/Envelopes/Envelopes';
9
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>`;
10
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>`;
11
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>`;
@@ -36,40 +38,42 @@ const ActivityIcons = {
36
38
  */
37
39
  export class VerdocsEnvelopeSidebar {
38
40
  constructor() {
41
+ this.store = null;
39
42
  this.endpoint = VerdocsEndpoint.getDefault();
40
43
  this.envelopeId = '';
41
- this.envelope = null;
42
- this.sortedRecipients = [];
43
- this.roleNames = [];
44
44
  this.activeTab = 1;
45
45
  this.panelOpen = false;
46
46
  this.showManageDialog = false;
47
+ this.showCancelDialog = false;
47
48
  this.loading = true;
48
49
  }
49
- componentWillLoad() {
50
- this.endpoint.loadSession();
51
- }
52
- // TODO: Handling signing vs preview-as-user cases
53
- // TODO: Handle anonymous case and failure to load due to not being logged in
54
- async componentWillRender() {
50
+ async componentWillLoad() {
55
51
  var _a, _b, _c;
56
- if (!this.envelopeId) {
57
- console.error(`[SIDEBAR] Missing required envelopeId`);
58
- return;
59
- }
60
52
  try {
61
- this.envelope = await throttledGetEnvelope(this.endpoint, this.envelopeId);
62
- this.sortedRecipients = [...this.envelope.recipients];
63
- this.sortedRecipients.sort((a, b) => {
64
- return a.sequence === b.sequence ? a.order - b.order : a.sequence - b.sequence;
65
- });
66
- this.roleNames = this.sortedRecipients.map(r => r.role_name);
53
+ this.endpoint.loadSession();
54
+ if (!this.envelopeId) {
55
+ console.log(`[SIDEBAR] Missing required envelope ID ${this.envelopeId}`);
56
+ return;
57
+ }
58
+ if (!this.endpoint.session) {
59
+ console.log('[SIDEBAR] Unable to start session, must be authenticated');
60
+ return;
61
+ }
62
+ this.store = await getEnvelopeStore(this.endpoint, this.envelopeId, true);
63
+ this.sortEnvelopeRecipients();
67
64
  this.loading = false;
68
65
  }
69
66
  catch (e) {
67
+ console.log('[SIDEBAR] Error loading envelope', e);
70
68
  (_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(new SDKError(e.message, (_b = e.response) === null || _b === void 0 ? void 0 : _b.status, (_c = e.response) === null || _c === void 0 ? void 0 : _c.data));
71
69
  }
72
70
  }
71
+ sortEnvelopeRecipients() {
72
+ var _a, _b;
73
+ (_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.recipients.sort((a, b) => {
74
+ return a.sequence === b.sequence ? a.order - b.order : a.sequence - b.sequence;
75
+ });
76
+ }
73
77
  setTab(tab) {
74
78
  var _a;
75
79
  this.panelOpen = tab !== this.activeTab || !this.panelOpen;
@@ -78,20 +82,38 @@ export class VerdocsEnvelopeSidebar {
78
82
  }
79
83
  // TODO: Refactor to a common library?
80
84
  canResendRecipient(recipient) {
85
+ var _a, _b;
81
86
  return (!['pending', 'declined', 'submitted', 'canceled'].includes(recipient.status) && //
82
- !['complete', 'declined', 'canceled'].includes(this.envelope.status));
87
+ !['complete', 'declined', 'canceled'].includes((_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.status));
83
88
  }
84
89
  canModifyRecipient(recipient) {
90
+ var _a, _b;
85
91
  return (!recipient.claimed && //
86
92
  !['declined', 'signed', 'submitted', 'canceled'].includes(recipient.status) &&
87
- !['complete', 'declined', 'canceled'].includes(this.envelope.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));
88
94
  }
89
95
  handleRecipientAction(recipient, id) {
90
- var _a;
96
+ var _a, _b;
91
97
  console.log('[SIDEBAR] Recipient action', id, recipient);
92
98
  switch (id) {
93
99
  case 'reminder':
94
- VerdocsToast('This feature will be enabled in a future release. Please try again later.', { style: 'info' });
100
+ resendInvitation(this.endpoint, this.envelopeId, recipient.role_name)
101
+ .then(() => {
102
+ VerdocsToast('Reminder Sent', { style: 'success' });
103
+ })
104
+ .catch(e => {
105
+ console.log('[SIDEBAR] Error resending invitation', e);
106
+ VerdocsToast('Error resending invitation: ' + e.message, { style: 'error' });
107
+ });
108
+ break;
109
+ 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
+ });
95
117
  break;
96
118
  case 'modify':
97
119
  VerdocsToast('This feature will be enabled in a future release. Please try again later.', { style: 'info' });
@@ -100,21 +122,38 @@ export class VerdocsEnvelopeSidebar {
100
122
  VerdocsToast('This feature will be enabled in a future release. Please try again later.', { style: 'info' });
101
123
  break;
102
124
  }
103
- (_a = this.envelopeUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, envelope: this.envelope, event: id });
125
+ (_a = this.envelopeUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, envelope: (_b = this.store) === null || _b === void 0 ? void 0 : _b.state, event: id });
126
+ }
127
+ cancelEnvelope() {
128
+ cancelEnvelope(this.endpoint, this.envelopeId)
129
+ .then(async (r) => {
130
+ var _a, _b;
131
+ console.log('[SIDEBAR] Envelope canceled', r);
132
+ VerdocsToast('Envelope canceled', { style: 'success' });
133
+ this.store = await getEnvelopeStore(this.endpoint, this.envelopeId, true);
134
+ this.sortEnvelopeRecipients();
135
+ (_a = this.envelopeUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, envelope: (_b = this.store) === null || _b === void 0 ? void 0 : _b.state, event: 'canceled' });
136
+ })
137
+ .catch(e => {
138
+ console.log('[SIDEBAR] Error canceling envelope', e);
139
+ VerdocsToast('Error canceling envelope: ' + e.message, { style: 'error' });
140
+ });
104
141
  }
105
142
  prepareHistoryEntries() {
143
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
106
144
  const entries = [];
107
- const histories = this.envelope.histories || [];
108
- entries.push({ icon: 'pencil', message: 'Envelope created.', date: new Date(this.envelope.created_at) });
109
- if (this.envelope.status === 'complete') {
110
- entries.push({ icon: 'pencil', message: 'Envelope completed.', date: new Date(this.envelope.updated_at) });
145
+ const histories = ((_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.histories) || [];
146
+ entries.push({ icon: 'pencil', message: 'Envelope created.', date: new Date((_d = (_c = this.store) === null || _c === void 0 ? void 0 : _c.state) === null || _d === void 0 ? void 0 : _d.created_at) });
147
+ if (((_f = (_e = this.store) === null || _e === void 0 ? void 0 : _e.state) === null || _f === void 0 ? void 0 : _f.status) === 'complete') {
148
+ entries.push({ icon: 'pencil', message: 'Envelope completed.', date: new Date((_h = (_g = this.store) === null || _g === void 0 ? void 0 : _g.state) === null || _h === void 0 ? void 0 : _h.updated_at) });
111
149
  }
112
150
  const ownerCanceled = histories.some(history => history.event === 'owner:canceled');
113
- if (this.envelope.status === 'canceled' && !ownerCanceled) {
114
- entries.push({ icon: 'pencil', message: 'Envelope Cancelled.', date: new Date(this.envelope.canceled_at) });
151
+ if (((_k = (_j = this.store) === null || _j === void 0 ? void 0 : _j.state) === null || _k === void 0 ? void 0 : _k.status) === 'canceled' && !ownerCanceled) {
152
+ entries.push({ icon: 'pencil', message: 'Envelope Cancelled.', date: new Date((_m = (_l = this.store) === null || _l === void 0 ? void 0 : _l.state) === null || _m === void 0 ? void 0 : _m.canceled_at) });
115
153
  }
116
154
  histories.forEach(history => {
117
- const user = this.sortedRecipients.find(recipient => recipient.role_name === history.role_name);
155
+ var _a;
156
+ const user = (_a = this.store.state) === null || _a === void 0 ? void 0 : _a.recipients.find(recipient => recipient.role_name === history.role_name);
118
157
  const name = (user === null || user === void 0 ? void 0 : user.full_name) || '';
119
158
  switch (history.event.toLowerCase()) {
120
159
  case 'recipient:signed':
@@ -216,27 +255,43 @@ export class VerdocsEnvelopeSidebar {
216
255
  entries.sort((a, b) => b.date.getTime() - a.date.getTime());
217
256
  return entries;
218
257
  }
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
+ }
219
264
  render() {
220
- var _a, _b, _c;
221
- if (!this.envelope || this.loading) {
265
+ 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
+ if (!this.store.state) {
222
267
  return h(Host, null);
223
268
  }
224
269
  const session = this.endpoint.getSession();
225
- const isEnvelopeOwner = userIsEnvelopeOwner(session, this.envelope);
270
+ const isEnvelopeOwner = userIsEnvelopeOwner(session, this.store.state);
226
271
  const historyEntries = this.prepareHistoryEntries();
227
- return (h(Host, { class: this.panelOpen ? 'open' : '' }, h("div", { class: "side-buttons" }, h("button", { class: this.activeTab === 1 ? 'active' : '', onClick: () => this.setTab(1), innerHTML: InformationCircle }), h("button", { class: this.activeTab === 2 ? 'active' : '', onClick: () => this.setTab(2), innerHTML: Users }), h("button", { class: this.activeTab === 3 ? 'active' : '', onClick: () => this.setTab(3), innerHTML: ClipboardDocuments })), this.activeTab === 1 && (h("div", { class: "content" }, h("div", { class: "title" }, "Details"), h("div", { class: "label" }, "Envelope ID"), h("div", { class: "value" }, this.envelope.id), h("div", { class: "label" }, "Date Created"), h("div", { class: "value" }, format(new Date(this.envelope.created_at), FORMAT_TIMESTAMP)), h("div", { class: "label" }, "Last Modified"), h("div", { class: "value" }, format(new Date(this.envelope.updated_at), FORMAT_TIMESTAMP)), h("div", { class: "label" }, "Status"), h("div", { class: "value" }, this.envelope.status), h("div", { class: "label" }, "Verdoc Owner ID"), h("div", { class: "value" }, this.envelope.profile_id), h("div", { class: "label" }, "Verdoc Owner Name"), h("div", { class: "value" }, (_a = this.envelope.profile) === null || _a === void 0 ? void 0 :
228
- _a.first_name, " ", (_b = this.envelope.profile) === null || _b === void 0 ? void 0 :
229
- _b.last_name), h("div", { class: "label" }, "Verdoc Owner Email"), h("div", { class: "value" }, (_c = this.envelope.profile) === null || _c === void 0 ? void 0 : _c.email))), this.activeTab === 2 && (h("div", { class: "content" }, h("div", { class: "title" }, "Recipients"), this.sortedRecipients.map((recipient, index) => (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 && (h("verdocs-dropdown", { onOptionSelected: item => this.handleRecipientAction(recipient, item.detail.id), options: [
230
- { id: 'reminder', label: 'Send Reminder', disabled: !this.canResendRecipient(recipient) },
231
- { id: 'modify', label: 'Modify Recipient', disabled: !this.canModifyRecipient(recipient) },
232
- // TODO: Details dialog
233
- // {id:'details',label: 'View Details'},
234
- ] }))), 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))))), isEnvelopeOwner && h("verdocs-button", { class: "manage-recipients-button", variant: "standard", label: "Manage Recipients", onClick: () => (this.showManageDialog = true) }))), 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: () => {
272
+ const functionsDisabled = ((_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.status) !== 'pending' && ((_d = (_c = this.store) === null || _c === void 0 ? void 0 : _c.state) === null || _d === void 0 ? void 0 : _d.status) !== 'in progress';
273
+ return (h(Host, { class: this.panelOpen ? 'open' : '' }, h("div", { class: "side-buttons" }, h("button", { class: this.activeTab === 1 ? 'active' : '', onClick: () => this.setTab(1), innerHTML: InformationCircle }), h("button", { class: this.activeTab === 2 ? 'active' : '', onClick: () => this.setTab(2), innerHTML: Users }), h("button", { class: this.activeTab === 3 ? 'active' : '', onClick: () => this.setTab(3), innerHTML: ClipboardDocuments })), this.activeTab === 1 && (h("div", { class: "content" }, h("div", { class: "title" }, "Details"), h("div", { class: "label" }, "Envelope ID"), h("div", { class: "value" }, (_f = (_e = this.store) === null || _e === void 0 ? void 0 : _e.state) === null || _f === void 0 ? void 0 : _f.id), h("div", { class: "label" }, "Date Created"), h("div", { class: "value" }, format(new Date((_h = (_g = this.store) === null || _g === void 0 ? void 0 : _g.state) === null || _h === void 0 ? void 0 : _h.created_at), FORMAT_TIMESTAMP)), h("div", { class: "label" }, "Last Modified"), h("div", { class: "value" }, format(new Date((_k = (_j = this.store) === null || _j === void 0 ? void 0 : _j.state) === null || _k === void 0 ? void 0 : _k.updated_at), FORMAT_TIMESTAMP)), h("div", { class: "label" }, "Status"), h("div", { class: "value" }, (_m = (_l = this.store) === null || _l === void 0 ? void 0 : _l.state) === null || _m === void 0 ? void 0 : _m.status), h("div", { class: "label" }, "Verdoc Owner ID"), h("div", { class: "value" }, (_p = (_o = this.store) === null || _o === void 0 ? void 0 : _o.state) === null || _p === void 0 ? void 0 : _p.profile_id), h("div", { class: "label" }, "Verdoc Owner Name"), h("div", { class: "value" }, (_s = (_r = (_q = this.store) === null || _q === void 0 ? void 0 : _q.state) === null || _r === void 0 ? void 0 : _r.profile) === null || _s === void 0 ? void 0 :
274
+ _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
+ _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
+ _0.recipients.map((recipient, index) => {
277
+ const canGetInPersonLink = !this.canModify(recipient) || (recipient.status !== 'invited' && recipient.status !== 'opened');
278
+ const canSendReminder = this.canResendRecipient(recipient);
279
+ 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
+ { id: 'reminder', label: 'Send Reminder', disabled: !canSendReminder },
281
+ { id: 'inperson', label: 'Get In-Person Link', disabled: !canGetInPersonLink },
282
+ // {id: 'modify', label: 'Modify Recipient', disabled: !this.canModifyRecipient(recipient)},
283
+ // TODO: Details dialog
284
+ // {id:'details',label: 'View Details'},
285
+ ] }))), 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: () => {
235
287
  var _a;
236
288
  this.showManageDialog = false;
237
- (_a = this.another) === null || _a === void 0 ? void 0 : _a.emit({ envelope: this.envelope });
289
+ (_a = this.another) === null || _a === void 0 ? void 0 : _a.emit({ envelope: this.store.state });
238
290
  }, onNext: () => {
239
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: () => {
293
+ this.showCancelDialog = false;
294
+ this.cancelEnvelope();
240
295
  } }))));
241
296
  }
242
297
  static get is() { return "verdocs-envelope-sidebar"; }
@@ -295,12 +350,10 @@ export class VerdocsEnvelopeSidebar {
295
350
  }
296
351
  static get states() {
297
352
  return {
298
- "envelope": {},
299
- "sortedRecipients": {},
300
- "roleNames": {},
301
353
  "activeTab": {},
302
354
  "panelOpen": {},
303
355
  "showManageDialog": {},
356
+ "showCancelDialog": {},
304
357
  "loading": {}
305
358
  };
306
359
  }
@@ -3,7 +3,7 @@ export default {
3
3
  title: 'Envelopes/Envelope Sidebar',
4
4
  component: 'verdocs-envelope-sidebar',
5
5
  args: {
6
- envelopeId: 'af083350-0202-4c00-ac90-5346914fa6ff',
6
+ envelopeId: '98126d3a-b6b0-4041-93a7-5cbd9daf5afa',
7
7
  },
8
8
  argTypes: {
9
9
  envelopeId: { name: 'envelopeId' },
@@ -1,9 +1,9 @@
1
+ import interact from 'interactjs';
1
2
  import { VerdocsEndpoint } from '@verdocs/js-sdk';
2
3
  import { getRGBA } from '@verdocs/js-sdk/Utils/Colors';
3
4
  import { updateField } from '@verdocs/js-sdk/Templates/Fields';
4
5
  import { h, Host } from '@stencil/core';
5
6
  import { getFieldSettings } from '../../../utils/utils';
6
- import interact from 'interactjs';
7
7
  const settingsIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20"><path d="m7.5 18.5-.312-2.667q-.188-.125-.396-.25-.209-.125-.396-.229l-2.479 1.063-2.521-4.334 2.125-1.625q.021-.104.021-.229v-.458q0-.125-.021-.229L1.396 7.917l2.521-4.313 2.5 1.042q.166-.104.375-.229.208-.125.396-.229L7.5 1.5h5l.312 2.688q.188.104.396.229.209.125.396.229l2.479-1.042 2.521 4.313-2.125 1.625v.916l2.125 1.625-2.521 4.334-2.5-1.063q-.166.104-.375.229-.208.125-.396.25L12.5 18.5Zm2.479-5.521q1.229 0 2.104-.875T12.958 10q0-1.229-.875-2.104t-2.104-.875q-1.208 0-2.094.875Q7 8.771 7 10t.885 2.104q.886.875 2.094.875Zm0-1.75q-.5 0-.864-.364Q8.75 10.5 8.75 10t.365-.865q.364-.364.864-.364t.865.364q.364.365.364.865t-.364.865q-.365.364-.865.364ZM10.021 10Zm-.792 6.521h1.542l.25-2.146q.625-.167 1.198-.51.573-.344 1.031-.823l2.021.854.771-1.271-1.771-1.354q.104-.292.156-.615.052-.323.052-.656 0-.292-.052-.604-.052-.313-.135-.646l1.77-1.375-.77-1.271-2.021.875q-.479-.5-1.042-.833-.562-.334-1.187-.5l-.271-2.167H9.208l-.25 2.167q-.625.166-1.187.5-.563.333-1.042.812l-2-.854-.771 1.271 1.73 1.354q-.084.333-.136.656Q5.5 9.708 5.5 10t.052.604q.052.313.136.667l-1.73 1.354.771 1.271 2-.834q.479.459 1.042.792.562.334 1.187.5Z"/></svg>';
8
8
  /**
9
9
  * Display a multi-line text input field.
@@ -18,6 +18,8 @@ export class VerdocsFieldTextarea {
18
18
  this.moveable = false;
19
19
  this.done = false;
20
20
  this.roleindex = 0;
21
+ this.xscale = 1;
22
+ this.yscale = 1;
21
23
  this.rerender = 0;
22
24
  }
23
25
  async focusField() {
@@ -54,25 +56,31 @@ export class VerdocsFieldTextarea {
54
56
  e.stopPropagation();
55
57
  }
56
58
  handleResize(e) {
57
- const oldX = +(e.target.getAttribute('resizeX') || 0);
58
- const oldY = +(e.target.getAttribute('resizeY') || 0);
59
- const newX = e.dx + oldX;
60
- const newY = e.dy + oldY;
61
- this.el.style.width = `${parseFloat(this.el.style.width || '0') + e.dx}px`;
62
- this.el.style.height = `${parseFloat(this.el.style.height || '0') + e.dy}px`;
63
- e.target.setAttribute('resizeX', newX);
64
- e.target.setAttribute('resizeY', newY);
59
+ let { x = 0, y = 0, h = 0 } = e.target.dataset;
60
+ let { width, height } = e.rect;
61
+ x = (parseFloat(x) || 0) + e.deltaRect.left;
62
+ y = (parseFloat(y) || 0) + e.deltaRect.top;
63
+ h = (parseFloat(h) || 0) + e.deltaRect.height;
64
+ Object.assign(e.target.style, {
65
+ width: `${width}px`,
66
+ height: `${height}px`,
67
+ transform: `translate(${x}px, ${y + h}px)`,
68
+ });
69
+ Object.assign(e.target.dataset, { x, y, h });
65
70
  }
66
71
  handleResizeEnd(e) {
67
- const resizeWidth = +(e.target.getAttribute('resizeX') || 0);
68
- const resizeHeight = +(e.target.getAttribute('resizeY') || 0);
69
- const settings = getFieldSettings(this.field);
70
- const newWidth = (settings.width || 150) + resizeWidth;
71
- const newHeight = (settings.height || 41) + resizeHeight;
72
- const newSettings = { ...getFieldSettings(this.field), width: Math.round(newWidth), height: Math.round(newHeight) };
73
- delete newSettings['result'];
72
+ const newSettings = { ...getFieldSettings(this.field) };
73
+ const [translateX, translateY] = e.target.style.transform.split('(')[1].split(')')[0].split(',').map(parseFloat);
74
+ newSettings.width = Math.round(parseFloat(e.target.style.width) / this.xscale);
75
+ newSettings.height = Math.round(parseFloat(e.target.style.height) / this.yscale);
76
+ newSettings.x = Math.round(newSettings.x + translateX / this.xscale);
77
+ newSettings.y = Math.round(newSettings.y - translateY / this.yscale);
74
78
  updateField(this.endpoint, this.templateid, this.field.name, { setting: newSettings })
75
- .then(() => { var _a; return (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name, settings: newSettings }); })
79
+ .then(() => {
80
+ var _a;
81
+ (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name, settings: newSettings });
82
+ Object.assign(e.target.dataset, { x: 0, y: 0, h: 0 });
83
+ })
76
84
  .catch(e => console.log('Field update failed', e));
77
85
  }
78
86
  render() {
@@ -260,6 +268,42 @@ export class VerdocsFieldTextarea {
260
268
  "reflect": false,
261
269
  "defaultValue": "0"
262
270
  },
271
+ "xscale": {
272
+ "type": "number",
273
+ "mutable": false,
274
+ "complexType": {
275
+ "original": "number",
276
+ "resolved": "number",
277
+ "references": {}
278
+ },
279
+ "required": false,
280
+ "optional": true,
281
+ "docs": {
282
+ "tags": [],
283
+ "text": "If set, the field will be be scaled horizontally by this factor."
284
+ },
285
+ "attribute": "xscale",
286
+ "reflect": false,
287
+ "defaultValue": "1"
288
+ },
289
+ "yscale": {
290
+ "type": "number",
291
+ "mutable": false,
292
+ "complexType": {
293
+ "original": "number",
294
+ "resolved": "number",
295
+ "references": {}
296
+ },
297
+ "required": false,
298
+ "optional": true,
299
+ "docs": {
300
+ "tags": [],
301
+ "text": "If set, the field will be be scaled vertically by this factor."
302
+ },
303
+ "attribute": "yscale",
304
+ "reflect": false,
305
+ "defaultValue": "1"
306
+ },
263
307
  "rerender": {
264
308
  "type": "number",
265
309
  "mutable": false,
@@ -18,6 +18,8 @@ export class VerdocsFieldTextbox {
18
18
  this.moveable = false;
19
19
  this.done = false;
20
20
  this.roleindex = 0;
21
+ this.xscale = 1;
22
+ this.yscale = 1;
21
23
  this.rerender = 0;
22
24
  }
23
25
  async focusField() {
@@ -54,24 +56,31 @@ export class VerdocsFieldTextbox {
54
56
  e.stopPropagation();
55
57
  }
56
58
  handleResize(e) {
57
- const oldX = +(e.target.getAttribute('resizeX') || 0);
58
- const oldY = +(e.target.getAttribute('resizeY') || 0);
59
- const newX = e.dx + oldX;
60
- const newY = e.dy + oldY;
61
- this.el.style.width = `${parseFloat(this.el.style.width || '0') + e.dx}px`;
62
- // Single line text fields are not resizeable in height
63
- // this.el.style.height = `${parseFloat(this.el.style.height || '0') + event.dy}px`;
64
- e.target.setAttribute('resizeX', newX);
65
- e.target.setAttribute('resizeY', newY);
59
+ let { x = 0, y = 0, h = 0 } = e.target.dataset;
60
+ let { width, height } = e.rect;
61
+ x = (parseFloat(x) || 0) + e.deltaRect.left;
62
+ y = (parseFloat(y) || 0) + e.deltaRect.top;
63
+ h = (parseFloat(h) || 0) + e.deltaRect.height;
64
+ Object.assign(e.target.style, {
65
+ width: `${width}px`,
66
+ height: `${height}px`,
67
+ transform: `translate(${x}px, ${y + h}px)`,
68
+ });
69
+ Object.assign(e.target.dataset, { x, y, h });
66
70
  }
67
71
  handleResizeEnd(e) {
68
- const resizeWidth = +(e.target.getAttribute('resizeX') || 0);
69
- const settings = getFieldSettings(this.field);
70
- const newWidth = (settings.width || 150) + resizeWidth;
71
- const newSettings = { ...getFieldSettings(this.field), width: Math.round(newWidth) };
72
- delete newSettings['result'];
72
+ const newSettings = { ...getFieldSettings(this.field) };
73
+ const [translateX, translateY] = e.target.style.transform.split('(')[1].split(')')[0].split(',').map(parseFloat);
74
+ newSettings.width = Math.round(parseFloat(e.target.style.width) / this.xscale);
75
+ newSettings.height = Math.round(parseFloat(e.target.style.height) / this.yscale);
76
+ newSettings.x = Math.round(newSettings.x + translateX / this.xscale);
77
+ newSettings.y = Math.round(newSettings.y - translateY / this.yscale);
73
78
  updateField(this.endpoint, this.templateid, this.field.name, { setting: newSettings })
74
- .then(() => { var _a; return (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name, settings: newSettings }); })
79
+ .then(() => {
80
+ var _a;
81
+ (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name, settings: newSettings });
82
+ Object.assign(e.target.dataset, { x: 0, y: 0, h: 0 });
83
+ })
75
84
  .catch(e => console.log('Field update failed', e));
76
85
  }
77
86
  render() {
@@ -263,6 +272,42 @@ export class VerdocsFieldTextbox {
263
272
  "reflect": false,
264
273
  "defaultValue": "0"
265
274
  },
275
+ "xscale": {
276
+ "type": "number",
277
+ "mutable": false,
278
+ "complexType": {
279
+ "original": "number",
280
+ "resolved": "number",
281
+ "references": {}
282
+ },
283
+ "required": false,
284
+ "optional": true,
285
+ "docs": {
286
+ "tags": [],
287
+ "text": "If set, the field will be be scaled horizontally by this factor."
288
+ },
289
+ "attribute": "xscale",
290
+ "reflect": false,
291
+ "defaultValue": "1"
292
+ },
293
+ "yscale": {
294
+ "type": "number",
295
+ "mutable": false,
296
+ "complexType": {
297
+ "original": "number",
298
+ "resolved": "number",
299
+ "references": {}
300
+ },
301
+ "required": false,
302
+ "optional": true,
303
+ "docs": {
304
+ "tags": [],
305
+ "text": "If set, the field will be be scaled vertically by this factor."
306
+ },
307
+ "attribute": "yscale",
308
+ "reflect": false,
309
+ "defaultValue": "1"
310
+ },
266
311
  "rerender": {
267
312
  "type": "number",
268
313
  "mutable": false,
@@ -3,7 +3,7 @@ export default {
3
3
  title: 'Templates/Fields',
4
4
  component: 'verdocs-template-fields',
5
5
  args: {
6
- templateId: '8337af06-3b5a-4e1b-98be-67d82bc7ecd1',
6
+ templateId: '',
7
7
  },
8
8
  argTypes: {},
9
9
  parameters: {
@@ -39,8 +39,9 @@ verdocs-template-roles > form .row {
39
39
  }
40
40
  verdocs-template-roles > form .row .row-roles {
41
41
  flex: 1;
42
+ gap: 10px;
42
43
  display: flex;
43
- column-gap: 10px;
44
+ flex-wrap: wrap;
44
45
  flex-direction: row;
45
46
  }
46
47
  verdocs-template-roles > form .row .icon {
@@ -163,4 +163,4 @@ var throttledGetEnvelope = function (endpoint, envelopeId) {
163
163
  });
164
164
  };
165
165
 
166
- export { updateEnvelopeFieldSignature as a, updateEnvelopeFieldInitials as b, getEnvelopeDocumentPageDisplayUri as c, getEnvelope as d, cancelEnvelope as e, getEnvelopeFile as f, getSigningSession as g, getFieldAttachment as h, throttledGetEnvelope as t, updateEnvelopeField as u };
166
+ export { updateEnvelopeFieldSignature as a, updateEnvelopeFieldInitials as b, cancelEnvelope as c, getEnvelopeDocumentPageDisplayUri as d, getEnvelope as e, getEnvelopeFile as f, getSigningSession as g, getFieldAttachment as h, throttledGetEnvelope as t, updateEnvelopeField as u };
@@ -70,5 +70,13 @@ var getInPersonLink = function (endpoint, envelopeId, roleName) {
70
70
  .get("/envelopes/".concat(envelopeId, "/recipients/").concat(encodeURIComponent(roleName), "?in_person_link=true"))
71
71
  .then(function (r) { return r.data; });
72
72
  };
73
+ /**
74
+ * Resend a recipient's invitation.
75
+ */
76
+ var resendInvitation = function (endpoint, envelopeId, roleName) {
77
+ return endpoint.api //
78
+ .post("/envelopes/".concat(envelopeId, "/recipients/").concat(encodeURIComponent(roleName), "/resend_invitation"))
79
+ .then(function (r) { return r.data; });
80
+ };
73
81
 
74
- export { envelopeRecipientDecline as a, envelopeRecipientSubmit as b, envelopeRecipientAgree as e, getInPersonLink as g };
82
+ export { envelopeRecipientDecline as a, envelopeRecipientSubmit as b, envelopeRecipientAgree as e, getInPersonLink as g, resendInvitation as r };