@verdocs/web-sdk 5.0.18 → 5.0.19

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 (184) hide show
  1. package/dist/cjs/{Datastore-4448f6ef.js → Datastore-931fd77e.js} +7 -4
  2. package/dist/cjs/Datastore-931fd77e.js.map +1 -0
  3. package/dist/cjs/verdocs-build.cjs.entry.js +1 -1
  4. package/dist/cjs/verdocs-checkbox_6.cjs.entry.js +1 -1
  5. package/dist/cjs/verdocs-envelope-recipient-link_2.cjs.entry.js +1 -1
  6. package/dist/cjs/verdocs-envelope-recipient-summary.cjs.entry.js +1 -1
  7. package/dist/cjs/verdocs-envelope-sidebar.cjs.entry.js +1 -1
  8. package/dist/cjs/verdocs-field-attachment_13.cjs.entry.js +1 -1
  9. package/dist/cjs/verdocs-field-payment.cjs.entry.js +1 -1
  10. package/dist/cjs/verdocs-kba-dialog_2.cjs.entry.js +1 -1
  11. package/dist/cjs/verdocs-menu-panel_2.cjs.entry.js +1 -1
  12. package/dist/cjs/verdocs-preview_6.cjs.entry.js +18 -15
  13. package/dist/cjs/verdocs-preview_6.cjs.entry.js.map +1 -1
  14. package/dist/cjs/verdocs-sign.cjs.entry.js +1 -1
  15. package/dist/cjs/verdocs-template-document-page_2.cjs.entry.js +1 -1
  16. package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.css +1 -1
  17. package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.js +16 -13
  18. package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.js.map +1 -1
  19. package/dist/components/{p-78043e4b.js → p-02ebfef0.js} +20 -17
  20. package/dist/components/p-02ebfef0.js.map +1 -0
  21. package/dist/components/{p-d9a2e920.js → p-1ab01232.js} +3 -3
  22. package/dist/components/{p-d9a2e920.js.map → p-1ab01232.js.map} +1 -1
  23. package/dist/components/{p-efa3b8ac.js → p-1ce18a42.js} +2 -2
  24. package/dist/components/{p-efa3b8ac.js.map → p-1ce18a42.js.map} +1 -1
  25. package/dist/components/{p-c662e5f4.js → p-1f0f5448.js} +2 -2
  26. package/dist/components/{p-c662e5f4.js.map → p-1f0f5448.js.map} +1 -1
  27. package/dist/components/{p-aa59fa42.js → p-28e3b2e3.js} +14 -14
  28. package/dist/components/{p-aa59fa42.js.map → p-28e3b2e3.js.map} +1 -1
  29. package/dist/components/{p-9bcf9620.js → p-2d8b46e5.js} +2 -2
  30. package/dist/components/{p-9bcf9620.js.map → p-2d8b46e5.js.map} +1 -1
  31. package/dist/components/{p-58d027d1.js → p-3828cb31.js} +7 -4
  32. package/dist/components/p-3828cb31.js.map +1 -0
  33. package/dist/components/{p-314d698d.js → p-53168eec.js} +2 -2
  34. package/dist/components/{p-314d698d.js.map → p-53168eec.js.map} +1 -1
  35. package/dist/components/{p-bcc8771f.js → p-681e7dd4.js} +3 -3
  36. package/dist/components/{p-bcc8771f.js.map → p-681e7dd4.js.map} +1 -1
  37. package/dist/components/{p-14c80ae8.js → p-91d65fde.js} +3 -3
  38. package/dist/components/{p-14c80ae8.js.map → p-91d65fde.js.map} +1 -1
  39. package/dist/components/{p-d8340641.js → p-a415ce22.js} +3 -3
  40. package/dist/components/{p-d8340641.js.map → p-a415ce22.js.map} +1 -1
  41. package/dist/components/{p-022b87d3.js → p-b8885b5c.js} +2 -2
  42. package/dist/components/{p-022b87d3.js.map → p-b8885b5c.js.map} +1 -1
  43. package/dist/components/{p-5182136e.js → p-c4c9feda.js} +3 -3
  44. package/dist/components/{p-5182136e.js.map → p-c4c9feda.js.map} +1 -1
  45. package/dist/components/{p-2ddf4d5b.js → p-e4799d51.js} +3 -3
  46. package/dist/components/{p-2ddf4d5b.js.map → p-e4799d51.js.map} +1 -1
  47. package/dist/components/{p-261521bc.js → p-e4a97ad5.js} +3 -3
  48. package/dist/components/{p-261521bc.js.map → p-e4a97ad5.js.map} +1 -1
  49. package/dist/components/{p-c9bed8f7.js → p-e9528d9f.js} +3 -3
  50. package/dist/components/{p-c9bed8f7.js.map → p-e9528d9f.js.map} +1 -1
  51. package/dist/components/{p-8a76ec8a.js → p-e95ded6b.js} +14 -14
  52. package/dist/components/{p-8a76ec8a.js.map → p-e95ded6b.js.map} +1 -1
  53. package/dist/components/{p-7cd6c0ce.js → p-eb12a71c.js} +2 -2
  54. package/dist/components/{p-7cd6c0ce.js.map → p-eb12a71c.js.map} +1 -1
  55. package/dist/components/{p-6c4fe42c.js → p-eb2ad8d0.js} +2 -2
  56. package/dist/components/{p-6c4fe42c.js.map → p-eb2ad8d0.js.map} +1 -1
  57. package/dist/components/{p-43fa069d.js → p-ecfc85ae.js} +3 -3
  58. package/dist/components/{p-43fa069d.js.map → p-ecfc85ae.js.map} +1 -1
  59. package/dist/components/{p-211fa3e2.js → p-f6156f7a.js} +3 -3
  60. package/dist/components/{p-211fa3e2.js.map → p-f6156f7a.js.map} +1 -1
  61. package/dist/components/{p-13260b9f.js → p-fcf13666.js} +13 -13
  62. package/dist/components/{p-13260b9f.js.map → p-fcf13666.js.map} +1 -1
  63. package/dist/components/verdocs-build.js +20 -20
  64. package/dist/components/verdocs-envelope-recipient-link.js +1 -1
  65. package/dist/components/verdocs-envelope-recipient-summary.js +1 -1
  66. package/dist/components/verdocs-envelope-sidebar.js +2 -2
  67. package/dist/components/verdocs-field-attachment.js +1 -1
  68. package/dist/components/verdocs-field-checkbox.js +1 -1
  69. package/dist/components/verdocs-field-date.js +1 -1
  70. package/dist/components/verdocs-field-dropdown.js +1 -1
  71. package/dist/components/verdocs-field-initial.js +1 -1
  72. package/dist/components/verdocs-field-payment.js +2 -2
  73. package/dist/components/verdocs-field-radio.js +1 -1
  74. package/dist/components/verdocs-field-signature.js +1 -1
  75. package/dist/components/verdocs-field-textarea.js +1 -1
  76. package/dist/components/verdocs-field-textbox.js +1 -1
  77. package/dist/components/verdocs-field-timestamp.js +1 -1
  78. package/dist/components/verdocs-preview.js +1 -1
  79. package/dist/components/verdocs-send.js +1 -1
  80. package/dist/components/verdocs-sign.js +2 -2
  81. package/dist/components/verdocs-template-attachments.js +1 -1
  82. package/dist/components/verdocs-template-build-tabs.js +1 -1
  83. package/dist/components/verdocs-template-document-page.js +1 -1
  84. package/dist/components/verdocs-template-field-properties.js +1 -1
  85. package/dist/components/verdocs-template-fields.js +1 -1
  86. package/dist/components/verdocs-template-role-properties.js +1 -1
  87. package/dist/components/verdocs-template-roles.js +1 -1
  88. package/dist/components/verdocs-view.js +1 -1
  89. package/dist/esm/{Datastore-b55570ff.js → Datastore-3f924d94.js} +7 -4
  90. package/dist/esm/Datastore-3f924d94.js.map +1 -0
  91. package/dist/esm/verdocs-build.entry.js +1 -1
  92. package/dist/esm/verdocs-checkbox_6.entry.js +1 -1
  93. package/dist/esm/verdocs-envelope-recipient-link_2.entry.js +1 -1
  94. package/dist/esm/verdocs-envelope-recipient-summary.entry.js +1 -1
  95. package/dist/esm/verdocs-envelope-sidebar.entry.js +1 -1
  96. package/dist/esm/verdocs-field-attachment_13.entry.js +1 -1
  97. package/dist/esm/verdocs-field-payment.entry.js +1 -1
  98. package/dist/esm/verdocs-kba-dialog_2.entry.js +1 -1
  99. package/dist/esm/verdocs-menu-panel_2.entry.js +1 -1
  100. package/dist/esm/verdocs-preview_6.entry.js +18 -15
  101. package/dist/esm/verdocs-preview_6.entry.js.map +1 -1
  102. package/dist/esm/verdocs-sign.entry.js +1 -1
  103. package/dist/esm/verdocs-template-document-page_2.entry.js +1 -1
  104. package/dist/esm-es5/{Datastore-b55570ff.js → Datastore-3f924d94.js} +2 -2
  105. package/dist/esm-es5/Datastore-3f924d94.js.map +1 -0
  106. package/dist/esm-es5/verdocs-build.entry.js +1 -1
  107. package/dist/esm-es5/verdocs-checkbox_6.entry.js +1 -1
  108. package/dist/esm-es5/verdocs-envelope-recipient-link_2.entry.js +1 -1
  109. package/dist/esm-es5/verdocs-envelope-recipient-summary.entry.js +1 -1
  110. package/dist/esm-es5/verdocs-envelope-sidebar.entry.js +1 -1
  111. package/dist/esm-es5/verdocs-field-attachment_13.entry.js +1 -1
  112. package/dist/esm-es5/verdocs-field-payment.entry.js +1 -1
  113. package/dist/esm-es5/verdocs-kba-dialog_2.entry.js +1 -1
  114. package/dist/esm-es5/verdocs-menu-panel_2.entry.js +1 -1
  115. package/dist/esm-es5/verdocs-preview_6.entry.js +2 -2
  116. package/dist/esm-es5/verdocs-preview_6.entry.js.map +1 -1
  117. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  118. package/dist/esm-es5/verdocs-template-document-page_2.entry.js +1 -1
  119. package/dist/types/components/templates/verdocs-template-roles/verdocs-template-roles.d.ts +3 -0
  120. package/dist/verdocs-web-sdk/{p-19462841.system.entry.js → p-086ee7f1.system.entry.js} +2 -2
  121. package/dist/verdocs-web-sdk/{p-fedcc413.entry.js → p-1902bf04.entry.js} +2 -2
  122. package/dist/verdocs-web-sdk/{p-fda9c437.system.entry.js → p-208a8b41.system.entry.js} +2 -2
  123. package/dist/verdocs-web-sdk/{p-00ed440b.system.entry.js → p-2175c81a.system.entry.js} +2 -2
  124. package/dist/verdocs-web-sdk/{p-3cc50f0b.system.entry.js → p-26106576.system.entry.js} +2 -2
  125. package/dist/verdocs-web-sdk/{p-eb3ceb39.system.entry.js → p-32cf09f0.system.entry.js} +2 -2
  126. package/dist/verdocs-web-sdk/{p-99d5305a.system.entry.js → p-3417143a.system.entry.js} +3 -3
  127. package/dist/verdocs-web-sdk/p-3417143a.system.entry.js.map +1 -0
  128. package/dist/verdocs-web-sdk/{p-9021fc7b.system.entry.js → p-34c2298e.system.entry.js} +2 -2
  129. package/dist/verdocs-web-sdk/{p-58d027d1.js → p-3828cb31.js} +2 -2
  130. package/dist/verdocs-web-sdk/p-3828cb31.js.map +1 -0
  131. package/dist/verdocs-web-sdk/{p-dced30fa.entry.js → p-471fd78e.entry.js} +2 -2
  132. package/dist/verdocs-web-sdk/{p-17f35bcb.entry.js → p-60da8e6b.entry.js} +2 -2
  133. package/dist/verdocs-web-sdk/{p-35dcb386.system.js → p-65be7617.system.js} +2 -2
  134. package/dist/verdocs-web-sdk/p-65be7617.system.js.map +1 -0
  135. package/dist/verdocs-web-sdk/{p-e3077c5e.system.entry.js → p-6b2fc4bd.system.entry.js} +2 -2
  136. package/dist/verdocs-web-sdk/{p-37fa9d00.system.entry.js → p-7975ec40.system.entry.js} +2 -2
  137. package/dist/verdocs-web-sdk/{p-27416916.entry.js → p-7ffebea3.entry.js} +2 -2
  138. package/dist/verdocs-web-sdk/{p-bbf30adc.system.entry.js → p-90690dde.system.entry.js} +2 -2
  139. package/dist/verdocs-web-sdk/{p-03399c69.entry.js → p-a4d94e2e.entry.js} +2 -2
  140. package/dist/verdocs-web-sdk/{p-d8d279a8.entry.js → p-b0bf5256.entry.js} +3 -3
  141. package/dist/verdocs-web-sdk/p-b0bf5256.entry.js.map +1 -0
  142. package/dist/verdocs-web-sdk/{p-882aa754.entry.js → p-c59aa521.entry.js} +2 -2
  143. package/dist/verdocs-web-sdk/{p-f2b16ddf.entry.js → p-cc230abf.entry.js} +2 -2
  144. package/dist/verdocs-web-sdk/{p-c2bca18a.entry.js → p-d4aff253.entry.js} +2 -2
  145. package/dist/verdocs-web-sdk/p-db1faf41.entry.js +2 -0
  146. package/dist/verdocs-web-sdk/{p-d23b5949.entry.js.map → p-db1faf41.entry.js.map} +1 -1
  147. package/dist/verdocs-web-sdk/{p-ea078594.system.entry.js → p-dc5c275f.system.entry.js} +2 -2
  148. package/dist/verdocs-web-sdk/p-e2b70dfb.system.js +1 -1
  149. package/dist/verdocs-web-sdk/{p-88baf4d1.entry.js → p-e84cf41e.entry.js} +2 -2
  150. package/dist/verdocs-web-sdk/{p-546daa8b.entry.js → p-f6ed768d.entry.js} +2 -2
  151. package/dist/verdocs-web-sdk/{p-41f22b0a.system.entry.js → p-ff048639.system.entry.js} +2 -2
  152. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  153. package/package.json +4 -4
  154. package/dist/cjs/Datastore-4448f6ef.js.map +0 -1
  155. package/dist/components/p-58d027d1.js.map +0 -1
  156. package/dist/components/p-78043e4b.js.map +0 -1
  157. package/dist/esm/Datastore-b55570ff.js.map +0 -1
  158. package/dist/esm-es5/Datastore-b55570ff.js.map +0 -1
  159. package/dist/verdocs-web-sdk/p-35dcb386.system.js.map +0 -1
  160. package/dist/verdocs-web-sdk/p-58d027d1.js.map +0 -1
  161. package/dist/verdocs-web-sdk/p-99d5305a.system.entry.js.map +0 -1
  162. package/dist/verdocs-web-sdk/p-d23b5949.entry.js +0 -2
  163. package/dist/verdocs-web-sdk/p-d8d279a8.entry.js.map +0 -1
  164. /package/dist/verdocs-web-sdk/{p-19462841.system.entry.js.map → p-086ee7f1.system.entry.js.map} +0 -0
  165. /package/dist/verdocs-web-sdk/{p-fedcc413.entry.js.map → p-1902bf04.entry.js.map} +0 -0
  166. /package/dist/verdocs-web-sdk/{p-fda9c437.system.entry.js.map → p-208a8b41.system.entry.js.map} +0 -0
  167. /package/dist/verdocs-web-sdk/{p-00ed440b.system.entry.js.map → p-2175c81a.system.entry.js.map} +0 -0
  168. /package/dist/verdocs-web-sdk/{p-3cc50f0b.system.entry.js.map → p-26106576.system.entry.js.map} +0 -0
  169. /package/dist/verdocs-web-sdk/{p-eb3ceb39.system.entry.js.map → p-32cf09f0.system.entry.js.map} +0 -0
  170. /package/dist/verdocs-web-sdk/{p-9021fc7b.system.entry.js.map → p-34c2298e.system.entry.js.map} +0 -0
  171. /package/dist/verdocs-web-sdk/{p-dced30fa.entry.js.map → p-471fd78e.entry.js.map} +0 -0
  172. /package/dist/verdocs-web-sdk/{p-17f35bcb.entry.js.map → p-60da8e6b.entry.js.map} +0 -0
  173. /package/dist/verdocs-web-sdk/{p-e3077c5e.system.entry.js.map → p-6b2fc4bd.system.entry.js.map} +0 -0
  174. /package/dist/verdocs-web-sdk/{p-37fa9d00.system.entry.js.map → p-7975ec40.system.entry.js.map} +0 -0
  175. /package/dist/verdocs-web-sdk/{p-27416916.entry.js.map → p-7ffebea3.entry.js.map} +0 -0
  176. /package/dist/verdocs-web-sdk/{p-bbf30adc.system.entry.js.map → p-90690dde.system.entry.js.map} +0 -0
  177. /package/dist/verdocs-web-sdk/{p-03399c69.entry.js.map → p-a4d94e2e.entry.js.map} +0 -0
  178. /package/dist/verdocs-web-sdk/{p-882aa754.entry.js.map → p-c59aa521.entry.js.map} +0 -0
  179. /package/dist/verdocs-web-sdk/{p-f2b16ddf.entry.js.map → p-cc230abf.entry.js.map} +0 -0
  180. /package/dist/verdocs-web-sdk/{p-c2bca18a.entry.js.map → p-d4aff253.entry.js.map} +0 -0
  181. /package/dist/verdocs-web-sdk/{p-ea078594.system.entry.js.map → p-dc5c275f.system.entry.js.map} +0 -0
  182. /package/dist/verdocs-web-sdk/{p-88baf4d1.entry.js.map → p-e84cf41e.entry.js.map} +0 -0
  183. /package/dist/verdocs-web-sdk/{p-546daa8b.entry.js.map → p-f6ed768d.entry.js.map} +0 -0
  184. /package/dist/verdocs-web-sdk/{p-41f22b0a.system.entry.js.map → p-ff048639.system.entry.js.map} +0 -0
@@ -7,7 +7,7 @@ const jsSdk = require('@verdocs/js-sdk');
7
7
  const utils = require('./utils-746daf30.js');
8
8
  const Toast = require('./Toast-d84d7bd3.js');
9
9
  const errors = require('./errors-017fb835.js');
10
- const Datastore = require('./Datastore-4448f6ef.js');
10
+ const Datastore = require('./Datastore-931fd77e.js');
11
11
  require('./_commonjsHelpers-e6ff1d6e.js');
12
12
  require('./Types-7a726ff3.js');
13
13
  require('./format-dc0f3757.js');
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-ccac8641.js');
6
6
  const jsSdk = require('@verdocs/js-sdk');
7
7
  const utils = require('./utils-746daf30.js');
8
- const Datastore = require('./Datastore-4448f6ef.js');
8
+ const Datastore = require('./Datastore-931fd77e.js');
9
9
  const popper = require('./popper-31badbf8.js');
10
10
  require('./_commonjsHelpers-e6ff1d6e.js');
11
11
  require('./Types-7a726ff3.js');
@@ -124,7 +124,7 @@ verdocs-template-roles .row.add-sequence {
124
124
  display: none;
125
125
  }
126
126
  verdocs-template-roles .add-role {
127
- margin: 0;
127
+ margin: 0 0 0 -8px;
128
128
  padding: 0;
129
129
  border: none;
130
130
  opacity: 0.3;
@@ -14,6 +14,7 @@ const iconCC = `<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><
14
14
  export class VerdocsTemplateRoles {
15
15
  constructor() {
16
16
  this.templateListenerId = null;
17
+ this.sortableRefs = [];
17
18
  this.endpoint = VerdocsEndpoint.getDefault();
18
19
  this.templateId = '';
19
20
  this.showingRoleDialog = null;
@@ -24,6 +25,7 @@ export class VerdocsTemplateRoles {
24
25
  }
25
26
  disconnectedCallback() {
26
27
  this.unlistenToTemplate();
28
+ this.cleanupSortables();
27
29
  }
28
30
  async listenToTemplate() {
29
31
  console.log('[ROLES] Loading template', this.templateId);
@@ -43,7 +45,6 @@ export class VerdocsTemplateRoles {
43
45
  async componentWillLoad() {
44
46
  var _a, _b, _c;
45
47
  try {
46
- VerdocsEndpoint.getDefault().setBaseURL('https://api.verdocs.com');
47
48
  this.endpoint.loadSession();
48
49
  if (!this.templateId) {
49
50
  console.log(`[ROLES] Missing required template ID ${this.templateId}`);
@@ -60,13 +61,18 @@ export class VerdocsTemplateRoles {
60
61
  (_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));
61
62
  }
62
63
  }
64
+ cleanupSortables() {
65
+ this.sortableRefs.forEach(sr => sr.destroy());
66
+ this.sortableRefs.length = 0;
67
+ }
63
68
  componentDidRender() {
69
+ this.cleanupSortables();
64
70
  // Existing sequence numbers
65
71
  const sequenceNumbers = this.getSequenceNumbers();
66
72
  (sequenceNumbers || []).forEach(sequence => {
67
73
  const el = document.getElementById(`verdocs-roles-sequence-${sequence}`);
68
74
  if (el) {
69
- new Sortable(el, {
75
+ const sortable = new Sortable(el, {
70
76
  group: 'roles',
71
77
  animation: 150,
72
78
  dragoverBubble: true,
@@ -75,11 +81,13 @@ export class VerdocsTemplateRoles {
75
81
  onChoose: () => (this.dragging = true),
76
82
  onUnchoose: () => (this.dragging = false),
77
83
  });
84
+ this.sortableRefs.push(sortable);
78
85
  }
79
86
  });
80
87
  const el = document.getElementById(`verdocs-roles-sequence-add-target`);
81
88
  if (el) {
82
- new Sortable(el, {
89
+ console.log('[ROLES] Applying sortable to add-sequence slot');
90
+ const sortable = new Sortable(el, {
83
91
  group: 'roles',
84
92
  animation: 150,
85
93
  dragoverBubble: true,
@@ -88,6 +96,7 @@ export class VerdocsTemplateRoles {
88
96
  onChoose: () => (this.dragging = true),
89
97
  onUnchoose: () => (this.dragging = false),
90
98
  });
99
+ this.sortableRefs.push(sortable);
91
100
  }
92
101
  }
93
102
  handleMoveEnd(evt) {
@@ -124,15 +133,9 @@ export class VerdocsTemplateRoles {
124
133
  }
125
134
  });
126
135
  });
127
- // When renumbering, we don't try to update the store for every individual item
128
- // changing. We just do it once at the end.
129
- console.log(`[ROLES] Awaiting ${renumberRequests.length} renumber requests`, renumberRequests);
130
- return Promise.all(renumberRequests).then(async () => {
131
- const newTemplate = JSON.parse(JSON.stringify(this.template));
132
- newTemplate.roles = Object.keys(sortableRoles).reduce((acc, seq) => acc.concat(sortableRoles[seq]), []);
133
- await Store.getTemplate(this.endpoint, this.templateId, true);
134
- // Store.updateTemplate(this.templateId, newTemplate);
135
- });
136
+ return Promise.all(renumberRequests)
137
+ .then(async () => console.log('[ROLES] Done renumbering'))
138
+ .catch(e => console.log('[ROLES] Error updating roles', e));
136
139
  }
137
140
  handleCancel() {
138
141
  var _a;
@@ -270,7 +273,7 @@ export class VerdocsTemplateRoles {
270
273
  const sequences = this.getSequenceNumbers();
271
274
  const nextSequence = sequences && sequences.length > 0 ? (sequences[sequences.length - 1] || 0) + 1 : 1;
272
275
  // style={{backgroundColor: getRGBA(getRoleIndex(this.template, role.name))}}
273
- return (h(Host, { class: { dragging: this.dragging } }, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("h5", null, "Roles and Workflow"), h("div", { class: "roles" }, sequences.map((sequence, index) => (h("div", { class: "sequence" }, h("div", { class: "sequence-label no-drag" }, index + 1, "."), h("div", { class: "sequence-roles", id: `verdocs-roles-sequence-${sequence}`, "data-sequence": sequence }, this.getRolesAtSequence(sequence).map(role => {
276
+ return (h(Host, { class: { dragging: this.dragging } }, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("h5", null, "Roles and Workflow"), h("div", { class: "roles" }, sequences.map((sequence, index) => (h("div", { class: "sequence" }, console.log('Rendering sequence', sequence, index, this.getRolesAtSequence(sequence)), h("div", { class: "sequence-label no-drag" }, index + 1, "."), h("div", { class: "sequence-roles", id: `verdocs-roles-sequence-${sequence}`, "data-sequence": sequence }, this.getRolesAtSequence(sequence).map(role => {
274
277
  const unknown = !role.email || !role.first_name || !role.last_name;
275
278
  return unknown ? (h("div", { class: "role", "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, h("div", { class: "role-name" }, role.name), h("div", { class: "icons" }, h("div", { class: "gear-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" }), h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover })))) : (h("div", { class: "role", "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, h("div", { class: "role-name" }, formatFullName(role)), h("div", { class: "icons" }, h("div", { class: "gear-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" }), h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }))));
276
279
  })), h("button", { class: "add-role no-drag", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, sequence) })))), h("div", { class: "sequence add-sequence" }, h("div", { class: "sequence-label no-drag" }, sequences.length + 1, "."), h("div", { class: "sequence-roles", id: `verdocs-roles-sequence-add-target`, "data-sequence": nextSequence }), h("button", { class: "add-role no-drag", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, nextSequence) }))), roleNames.length < 1 && (h("div", { class: "empty" }, "You must add at least one Role before proceeding.", h("br", null), " Click the ", h("span", { innerHTML: plusIcon }), " Add button above to get started.")), h("div", { class: "buttons" }, h("div", { class: "flex-fill" }), h("verdocs-button", { variant: "outline", label: "Cancel", size: "small", onClick: () => this.handleCancel() }), h("verdocs-button", { label: "OK", size: "small", onClick: () => this.handleSubmit(), disabled: roleNames.length < 1 }))), this.showingRoleDialog && (h("verdocs-menu-panel", { onClose: () => (this.showingRoleDialog = null) }, h("verdocs-template-role-properties", { endpoint: this.endpoint, templateId: this.templateId, roleName: this.showingRoleDialog, onClose: () => {
@@ -1 +1 @@
1
- {"version":3,"file":"verdocs-template-roles.js","sourceRoot":"","sources":["../../../../src/components/templates/verdocs-template-roles/verdocs-template-roles.tsx"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAC,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAC,kBAAkB,EAAE,cAAc,EAAE,WAAW,EAAoB,kBAAkB,EAAE,eAAe,EAAC,MAAM,iBAAiB,CAAC;AACvI,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAC,KAAK,EAAC,MAAM,0BAA0B,CAAC;AAE/C,MAAM,YAAY,GAChB,myCAAmyC,CAAC;AAEtyC,MAAM,QAAQ,GAAG,mOAAmO,CAAC;AAErP,MAAM,UAAU,GACd,qWAAqW,CAAC;AAExW,MAAM,YAAY,GAAG,yVAAyV,CAAC;AAE/W,MAAM,MAAM,GAAG,sRAAsR,CAAC;AAEtS;;GAEG;AAMH,MAAM,OAAO,o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,CAAC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;gBAChE,wCACE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAChC,OAAO,EAAE,GAAG,EAAE;;wBACZ,MAAA,QAAQ,CAAC,cAAc,CAAC,4BAA4B,CAAC,0CAAE,MAAM,EAAE,CAAC;wBAChE,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;oBAChC,CAAC,EACD,QAAQ,EAAE,KAAK,IAAI,EAAE;;wBACnB,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;wBAC9B,+EAA+E;wBAC/E,MAAM,IAAI,CAAC,qBAAqB,EAAE,CAAC;wBACnC,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI,CAAC,EAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,EAAC,CAAC,CAAC;oBAClI,CAAC,GACD,CACiB,CACtB,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import Sortable from 'sortablejs';\nimport {Component, h, Element, Event, EventEmitter, Host, Prop, State} from '@stencil/core';\nimport {createTemplateRole, formatFullName, getTemplate, IRole, ITemplate, updateTemplateRole, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {SDKError} from '../../../utils/errors';\nimport {Store} from '../../../utils/Datastore';\n\nconst settingsIcon =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"20\" width=\"20\" fill=\"#00000089\"><path d=\"m8.021 17.917-.313-2.5q-.27-.125-.625-.334-.354-.208-.625-.395l-2.312.979-1.979-3.438 1.979-1.5q-.021-.167-.031-.364-.011-.198-.011-.365 0-.146.011-.344.01-.198.031-.385l-1.979-1.5 1.979-3.417 2.312.958q.271-.187.615-.385t.635-.344l.313-2.5h3.958l.313 2.5q.312.167.625.344.312.177.604.385l2.333-.958 1.979 3.417-1.979 1.521q.021.187.021.364V10q0 .146-.01.333-.011.188-.011.396l1.958 1.5-1.979 3.438-2.312-.979q-.292.208-.615.395-.323.188-.614.334l-.313 2.5Zm1.937-5.355q1.063 0 1.813-.75t.75-1.812q0-1.062-.75-1.812t-1.813-.75q-1.041 0-1.802.75-.76.75-.76 1.812t.76 1.812q.761.75 1.802.75Zm0-1.333q-.5 0-.864-.364-.365-.365-.365-.865t.365-.865q.364-.364.864-.364t.865.364q.365.365.365.865t-.365.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.187q.605-.167 1.136-.49.531-.323 1.031-.802l2.021.875.854-1.375-1.792-1.354q.105-.333.136-.635.031-.303.031-.615 0-.292-.031-.573-.031-.281-.115-.635l1.792-1.396-.834-1.375-2.062.875q-.438-.438-1.021-.781-.583-.344-1.125-.49l-.271-2.208H9.167l-.271 2.208q-.584.146-1.125.458-.542.313-1.042.792l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.479.458 1.021.771.542.312 1.146.479Z\"/></svg>';\n\nconst plusIcon = `<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"#ffffff\" viewBox=\"0 0 24 24\" strokeWidth={1.5} stroke=\"currentColor\"><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z\" /></svg>`;\n\nconst iconSigner =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" width=\"24\"><path d=\"m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z\"/></svg>';\n\nconst iconApprover = `<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" width=\"24\"><path fill-rule=\"evenodd\" d=\"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z\" clip-rule=\"evenodd\" /></svg>`;\n\nconst iconCC = `<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" width=\"24\"><path d=\"M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z\" /><path d=\"M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z\" /></svg>`;\n\n/**\n * Display an edit form that allows the user to adjust a template's roles and workflow.\n */\n@Component({\n tag: 'verdocs-template-roles',\n styleUrl: 'verdocs-template-roles.scss',\n shadow: false,\n})\nexport class VerdocsTemplateRoles {\n private templateListenerId = null;\n\n @Element()\n el: HTMLElement;\n\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * The template ID to edit.\n */\n @Prop() templateId: string = '';\n\n /**\n * Event fired when the user clicks to proceed.\n */\n @Event({composed: true}) next: EventEmitter;\n\n /**\n * Event fired when the step is cancelled. This is called exit to avoid conflicts with the JS-reserved \"cancel\" event name.\n */\n @Event({composed: true}) exit: EventEmitter;\n\n /**\n * Event fired if an error occurs. The event details will contain information about the error. Most errors will\n * terminate the process, and the calling application should correct the condition and re-render the component.\n */\n @Event({composed: true}) sdkError: EventEmitter<SDKError>;\n\n /**\n * Event fired when the template is updated in any way. May be used for tasks such as cache invalidation or reporting to other systems.\n */\n @Event({composed: true}) rolesUpdated: EventEmitter<{endpoint: VerdocsEndpoint; templateId: string; event: 'added' | 'deleted' | 'updated'; roles: IRole[]}>;\n\n @State() showingRoleDialog: string | null = null;\n @State() sender = null;\n\n @State() dragging = false;\n @State() loading = true;\n @State() template: ITemplate | null = null;\n\n disconnectedCallback() {\n this.unlistenToTemplate();\n }\n\n async listenToTemplate() {\n console.log('[ROLES] Loading template', this.templateId);\n this.unlistenToTemplate();\n Store.subscribe(\n 'templates',\n this.templateId,\n () => getTemplate(this.endpoint, this.templateId),\n false,\n (template: ITemplate) => {\n console.log('[ROLES] Template Updated', template);\n this.template = template;\n this.loading = false;\n },\n );\n }\n\n unlistenToTemplate() {\n if (this.templateListenerId) {\n Store.store.delListener(this.templateListenerId);\n this.templateListenerId = null;\n }\n }\n\n async componentWillLoad() {\n try {\n VerdocsEndpoint.getDefault().setBaseURL('https://api.verdocs.com');\n this.endpoint.loadSession();\n\n if (!this.templateId) {\n console.log(`[ROLES] Missing required template ID ${this.templateId}`);\n return;\n }\n\n if (!this.endpoint.session) {\n console.log('[ROLES] Unable to start builder session, must be authenticated');\n return;\n }\n\n this.listenToTemplate();\n } catch (e) {\n console.log('[ROLES] Error with preview session', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n }\n\n componentDidRender() {\n // Existing sequence numbers\n const sequenceNumbers = this.getSequenceNumbers();\n (sequenceNumbers || []).forEach(sequence => {\n const el = document.getElementById(`verdocs-roles-sequence-${sequence}`);\n if (el) {\n new Sortable(el, {\n group: 'roles',\n animation: 150,\n dragoverBubble: true,\n filter: '.no-drag',\n onEnd: this.handleMoveEnd.bind(this),\n onChoose: () => (this.dragging = true),\n onUnchoose: () => (this.dragging = false),\n });\n }\n });\n\n const el = document.getElementById(`verdocs-roles-sequence-add-target`);\n if (el) {\n new Sortable(el, {\n group: 'roles',\n animation: 150,\n dragoverBubble: true,\n filter: '.no-drag',\n onEnd: this.handleMoveEnd.bind(this),\n onChoose: () => (this.dragging = true),\n onUnchoose: () => (this.dragging = false),\n });\n }\n }\n\n handleMoveEnd(evt) {\n const fromSeq = +evt.from.dataset.sequence;\n const toSeq = +evt.to.dataset.sequence;\n const fromIndex = +evt.oldIndex + 1;\n const toIndex = +evt.newIndex + 1;\n\n console.log(`Move from ${fromSeq}:${fromIndex} to ${toSeq}:${toIndex}`, evt.item);\n\n const sortableRoles: Record<string, IRole[]> = {};\n const sequenceNumbers = this.getSequenceNumbers();\n sequenceNumbers.forEach(sequence => {\n const ras = this.getRolesAtSequence(sequence);\n\n sortableRoles[String(sequence)] = JSON.parse(JSON.stringify(ras));\n });\n\n // We might be adding a new sequence number now. Make sure we have an array to drop\n // the record into.\n sortableRoles[sequenceNumbers[sequenceNumbers.length - 1] + 1] = [];\n\n const role = sortableRoles[fromSeq].splice(fromIndex - 1, 1)[0];\n sortableRoles[toSeq] ||= [];\n sortableRoles[toSeq].splice(toIndex - 1, 0, role);\n\n const renumberRequests = [];\n Object.entries(sortableRoles).forEach(([targetSeq, roles]) => {\n roles.forEach((role, index) => {\n if (!role) {\n return;\n }\n\n const targetOrder = +index + 1;\n if (role.sequence !== +targetSeq || role.order !== targetOrder) {\n role.sequence = +targetSeq;\n role.order = targetOrder;\n renumberRequests.push(\n updateTemplateRole(this.endpoint, this.templateId, role.name, {sequence: +targetSeq, order: targetOrder})\n .then(r => console.log('[ROLES] Updated role', role.name, r))\n .catch(e => console.log('[ROLES] Error updating role', e)),\n );\n }\n });\n });\n\n // When renumbering, we don't try to update the store for every individual item\n // changing. We just do it once at the end.\n console.log(`[ROLES] Awaiting ${renumberRequests.length} renumber requests`, renumberRequests);\n return Promise.all(renumberRequests).then(async () => {\n const newTemplate = JSON.parse(JSON.stringify(this.template));\n newTemplate.roles = Object.keys(sortableRoles).reduce((acc, seq) => acc.concat(sortableRoles[seq]), []);\n await Store.getTemplate(this.endpoint, this.templateId, true);\n // Store.updateTemplate(this.templateId, newTemplate);\n });\n }\n\n handleCancel() {\n this.exit?.emit();\n }\n\n handleSubmit() {\n this.next?.emit();\n }\n\n getSortedRoles() {\n // NOTE: This mutates the source array but that's OK because everything that touches\n // it will want the same thing done.\n return (this.template?.roles || []).sort((a, b) => {\n return a.sequence === b.sequence ? a.order - b.order : a.sequence - b.sequence;\n });\n }\n\n getSequenceNumbers() {\n const sequenceNumbers = (this.template?.roles || []).map(role => role.sequence);\n const deduped = [...new Set(sequenceNumbers)];\n deduped.sort((a, b) => a - b);\n return deduped;\n }\n\n getRoleNames() {\n const roles = this.getSortedRoles();\n return roles.map(role => role.name);\n }\n\n getRolesAtSequence(sequence: number) {\n // Entries can be undefined when deleted because Stencil has no remove() operator yet for stores.\n // See https://github.com/ionic-team/stencil-store/issues/23\n return (this.template?.roles || []).filter(role => role && role.sequence === sequence);\n }\n\n // When the user drags a role around, we handle placement \"between\" items by assigning it a half-order number\n // e.g. 1.5 to place it between items 1 and 2, 0.5 to place it at the beginning, or last+0.5 to place it at the end.\n // Then we re-sort the list of roles and renumber them.\n async renumberTemplateRoles() {\n const sortableRoles: Record<string, IRole[]> = {};\n const renumberRequests = [];\n const sequenceNumbers = this.getSequenceNumbers();\n\n (sequenceNumbers || []).forEach(targetSeq => {\n (sortableRoles[targetSeq] || []).forEach((role, targetOrderMinusOne) => {\n const targetOrder = +targetOrderMinusOne + 1;\n if (role.sequence !== +targetSeq || role.order !== targetOrder) {\n console.log('[ROLES] Updating role', role.name, 'from', role.sequence, role.order, 'to', targetSeq, targetOrder);\n role.sequence = +targetSeq;\n role.order = targetOrder;\n renumberRequests.push(\n updateTemplateRole(this.endpoint, this.templateId, role.name, {sequence: +targetSeq, order: targetOrder})\n .then(r => console.log('[ROLES] Updated role', role.name, r))\n .catch(e => console.log('[ROLES] Error updating role', e)),\n );\n }\n });\n });\n\n console.log(`[ROLES] Awaiting ${renumberRequests.length} renumber requests`);\n await Promise.all(renumberRequests).then(async () => {\n // When renumbering, we don't try to update the store for every individual item\n // changing. We just do it once at the end.\n const newTemplate = JSON.parse(JSON.stringify(this.template));\n newTemplate.roles = Object.keys(sortableRoles).reduce((acc, seq) => acc.concat(sortableRoles[seq]), []);\n console.log(\n '[ROLES] Done renumbering',\n newTemplate.roles.map(r => ({name: r.name, sequence: r.sequence, order: r.order})),\n );\n Store.updateTemplate(this.templateId, newTemplate);\n // TODO: Explore race condition in reordering roles\n // this.template = await Store.getTemplate(this.endpoint, this.templateId, true);\n });\n\n this.rolesUpdated?.emit({event: 'updated', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles()});\n }\n\n // Look for name conflicts, because they're UGC and can be anything, regardless of order.\n getNextRoleName() {\n let name = '';\n let nextNumber = (this.template?.roles || []).length;\n do {\n nextNumber++;\n name = `Recipient ${nextNumber}`;\n } while (!name || (this.template?.roles || []).some(role => role && role.name === name));\n\n return name;\n }\n\n callCreateRole(name: string, sequence: number, order: number) {\n console.log('[ROLES] Will create role', {name, sequence, order});\n createTemplateRole(this.endpoint, this.templateId, {\n template_id: this.templateId,\n name,\n sequence,\n message: '',\n order,\n full_name: null,\n first_name: '',\n last_name: '',\n email: '',\n phone: '',\n type: 'signer',\n delegator: false,\n kba_method: null,\n })\n .then(async role => {\n console.log('[ROLES] Created role', role);\n // const newTemplate = JSON.parse(JSON.stringify(this.template));\n // newTemplate.roles.push(role);\n // TODO: Verify this immediately triggers a self-update\n console.log('Updating template in data store');\n await Store.getTemplate(this.endpoint, this.templateId, true);\n // Store.updateTemplate(this.templateId, newTemplate);\n // This will re-sort the roles and renumbers them via server calls if necessary\n // await this.renumberTemplateRoles();\n this.rolesUpdated?.emit({event: 'added', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles()});\n })\n .catch(e => {\n console.log('[ROLES] Error creating role', e);\n });\n }\n\n handleAddRole(e: any, sequence: number) {\n e.stopPropagation();\n const order = this.getRolesAtSequence(sequence).length + 1;\n const name = this.getNextRoleName();\n this.callCreateRole(name, sequence, order);\n }\n\n handleAddStep(e: any, sequence: number) {\n e.stopPropagation();\n\n const order = 1;\n const name = this.getNextRoleName();\n this.callCreateRole(name, sequence, order);\n }\n\n render() {\n if (!this.endpoint.session) {\n return (\n <Host>\n <verdocs-component-error message=\"You must be authenticated to use this module.\" />\n </Host>\n );\n }\n\n if (this.loading || !this.template) {\n return (\n <Host class=\"loading\">\n <verdocs-loader />\n </Host>\n );\n }\n\n console.log(\n '[ROLES] Rendering',\n this.template.roles.map(r => ({name: r.name, sequence: r.sequence, order: r.order})),\n );\n\n const roleNames = this.getRoleNames();\n const sequences = this.getSequenceNumbers();\n const nextSequence = sequences && sequences.length > 0 ? (sequences[sequences.length - 1] || 0) + 1 : 1;\n\n // style={{backgroundColor: getRGBA(getRoleIndex(this.template, role.name))}}\n return (\n <Host class={{dragging: this.dragging}}>\n <form onSubmit={e => e.preventDefault()} onClick={e => e.stopPropagation()} autocomplete=\"off\">\n <h5>Roles and Workflow</h5>\n\n <div class=\"roles\">\n {sequences.map((sequence, index) => (\n <div class=\"sequence\">\n <div class=\"sequence-label no-drag\">{index + 1}.</div>\n\n <div class=\"sequence-roles\" id={`verdocs-roles-sequence-${sequence}`} data-sequence={sequence}>\n {this.getRolesAtSequence(sequence).map(role => {\n const unknown = !role.email || !role.first_name || !role.last_name;\n return unknown ? (\n <div class=\"role\" data-rolename={role.name} data-sequence={sequence} data-order={role.order}>\n <div class=\"role-name\">{role.name}</div>\n <div class=\"icons\">\n <div class=\"gear-button\" innerHTML={settingsIcon} onClick={() => (this.showingRoleDialog = role.name)} aria-role=\"button\" />\n <span class=\"type-icon\" innerHTML={role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover} />\n </div>\n </div>\n ) : (\n <div\n class=\"role\"\n // style={{borderColor: getRGBA(getRoleIndex(this.template, role.name))}}\n data-rolename={role.name}\n data-sequence={sequence}\n data-order={role.order}\n >\n <div class=\"role-name\">{formatFullName(role)}</div>\n <div class=\"icons\">\n <div class=\"gear-button\" innerHTML={settingsIcon} onClick={() => (this.showingRoleDialog = role.name)} aria-role=\"button\" />\n <span class=\"type-icon\" innerHTML={role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover} />\n </div>\n </div>\n );\n })}\n </div>\n\n <button class=\"add-role no-drag\" innerHTML={plusIcon} onClick={e => this.handleAddRole(e, sequence)} />\n </div>\n ))}\n\n <div class=\"sequence add-sequence\">\n <div class=\"sequence-label no-drag\">{sequences.length + 1}.</div>\n\n <div class=\"sequence-roles\" id={`verdocs-roles-sequence-add-target`} data-sequence={nextSequence} />\n\n <button class=\"add-role no-drag\" innerHTML={plusIcon} onClick={e => this.handleAddRole(e, nextSequence)} />\n </div>\n </div>\n\n {roleNames.length < 1 && (\n <div class=\"empty\">\n You must add at least one Role before proceeding.\n <br /> Click the <span innerHTML={plusIcon} /> Add button above to get started.\n </div>\n )}\n\n <div class=\"buttons\">\n <div class=\"flex-fill\" />\n\n <verdocs-button variant=\"outline\" label=\"Cancel\" size=\"small\" onClick={() => this.handleCancel()} />\n <verdocs-button label=\"OK\" size=\"small\" onClick={() => this.handleSubmit()} disabled={roleNames.length < 1} />\n </div>\n </form>\n\n {this.showingRoleDialog && (\n <verdocs-menu-panel onClose={() => (this.showingRoleDialog = null)}>\n <verdocs-template-role-properties\n endpoint={this.endpoint}\n templateId={this.templateId}\n roleName={this.showingRoleDialog}\n onClose={() => {\n document.getElementById('verdocs-menu-panel-overlay')?.remove();\n this.showingRoleDialog = null;\n }}\n onDelete={async () => {\n this.showingRoleDialog = null;\n // This will re-sort the roles and renumbers them via server calls if necessary\n await this.renumberTemplateRoles();\n this.rolesUpdated?.emit({event: 'deleted', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles()});\n }}\n />\n </verdocs-menu-panel>\n )}\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"verdocs-template-roles.js","sourceRoot":"","sources":["../../../../src/components/templates/verdocs-template-roles/verdocs-template-roles.tsx"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAC,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAC,kBAAkB,EAAE,cAAc,EAAE,WAAW,EAAoB,kBAAkB,EAAE,eAAe,EAAC,MAAM,iBAAiB,CAAC;AACvI,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAC,KAAK,EAAC,MAAM,0BAA0B,CAAC;AAE/C,MAAM,YAAY,GAChB,myCAAmyC,CAAC;AAEtyC,MAAM,QAAQ,GAAG,mOAAmO,CAAC;AAErP,MAAM,UAAU,GACd,qWAAqW,CAAC;AAExW,MAAM,YAAY,GAAG,yVAAyV,CAAC;AAE/W,MAAM,MAAM,GAAG,sRAAsR,CAAC;AAEtS;;GAEG;AAMH,MAAM,OAAO,oBAAoB;;QACvB,uBAAkB,GAAG,IAAI,CAAC;QA4FlC,iBAAY,GAAe,EAAE,CAAC;wBApFM,eAAe,CAAC,UAAU,EAAE;0BAKnC,EAAE;iCAuBa,IAAI;sBAC9B,IAAI;wBAEF,KAAK;uBACN,IAAI;wBACe,IAAI;;IAE1C,oBAAoB;QAClB,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC1B,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACzD,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC1B,KAAK,CAAC,SAAS,CAC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,CAAC,EACD,QAAQ,EAAE,KAAK,IAAI,EAAE;;wBACnB,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;wBAC9B,+EAA+E;wBAC/E,MAAM,IAAI,CAAC,qBAAqB,EAAE,CAAC;wBACnC,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI,CAAC,EAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,EAAC,CAAC,CAAC;oBAClI,CAAC,GACD,CACiB,CACtB,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import Sortable from 'sortablejs';\nimport {Component, h, Element, Event, EventEmitter, Host, Prop, State} from '@stencil/core';\nimport {createTemplateRole, formatFullName, getTemplate, IRole, ITemplate, updateTemplateRole, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {SDKError} from '../../../utils/errors';\nimport {Store} from '../../../utils/Datastore';\n\nconst settingsIcon =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"20\" width=\"20\" fill=\"#00000089\"><path d=\"m8.021 17.917-.313-2.5q-.27-.125-.625-.334-.354-.208-.625-.395l-2.312.979-1.979-3.438 1.979-1.5q-.021-.167-.031-.364-.011-.198-.011-.365 0-.146.011-.344.01-.198.031-.385l-1.979-1.5 1.979-3.417 2.312.958q.271-.187.615-.385t.635-.344l.313-2.5h3.958l.313 2.5q.312.167.625.344.312.177.604.385l2.333-.958 1.979 3.417-1.979 1.521q.021.187.021.364V10q0 .146-.01.333-.011.188-.011.396l1.958 1.5-1.979 3.438-2.312-.979q-.292.208-.615.395-.323.188-.614.334l-.313 2.5Zm1.937-5.355q1.063 0 1.813-.75t.75-1.812q0-1.062-.75-1.812t-1.813-.75q-1.041 0-1.802.75-.76.75-.76 1.812t.76 1.812q.761.75 1.802.75Zm0-1.333q-.5 0-.864-.364-.365-.365-.365-.865t.365-.865q.364-.364.864-.364t.865.364q.365.365.365.865t-.365.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.187q.605-.167 1.136-.49.531-.323 1.031-.802l2.021.875.854-1.375-1.792-1.354q.105-.333.136-.635.031-.303.031-.615 0-.292-.031-.573-.031-.281-.115-.635l1.792-1.396-.834-1.375-2.062.875q-.438-.438-1.021-.781-.583-.344-1.125-.49l-.271-2.208H9.167l-.271 2.208q-.584.146-1.125.458-.542.313-1.042.792l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.479.458 1.021.771.542.312 1.146.479Z\"/></svg>';\n\nconst plusIcon = `<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"#ffffff\" viewBox=\"0 0 24 24\" strokeWidth={1.5} stroke=\"currentColor\"><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z\" /></svg>`;\n\nconst iconSigner =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" width=\"24\"><path d=\"m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z\"/></svg>';\n\nconst iconApprover = `<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" width=\"24\"><path fill-rule=\"evenodd\" d=\"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z\" clip-rule=\"evenodd\" /></svg>`;\n\nconst iconCC = `<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" width=\"24\"><path d=\"M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z\" /><path d=\"M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z\" /></svg>`;\n\n/**\n * Display an edit form that allows the user to adjust a template's roles and workflow.\n */\n@Component({\n tag: 'verdocs-template-roles',\n styleUrl: 'verdocs-template-roles.scss',\n shadow: false,\n})\nexport class VerdocsTemplateRoles {\n private templateListenerId = null;\n\n @Element()\n el: HTMLElement;\n\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * The template ID to edit.\n */\n @Prop() templateId: string = '';\n\n /**\n * Event fired when the user clicks to proceed.\n */\n @Event({composed: true}) next: EventEmitter;\n\n /**\n * Event fired when the step is cancelled. This is called exit to avoid conflicts with the JS-reserved \"cancel\" event name.\n */\n @Event({composed: true}) exit: EventEmitter;\n\n /**\n * Event fired if an error occurs. The event details will contain information about the error. Most errors will\n * terminate the process, and the calling application should correct the condition and re-render the component.\n */\n @Event({composed: true}) sdkError: EventEmitter<SDKError>;\n\n /**\n * Event fired when the template is updated in any way. May be used for tasks such as cache invalidation or reporting to other systems.\n */\n @Event({composed: true}) rolesUpdated: EventEmitter<{endpoint: VerdocsEndpoint; templateId: string; event: 'added' | 'deleted' | 'updated'; roles: IRole[]}>;\n\n @State() showingRoleDialog: string | null = null;\n @State() sender = null;\n\n @State() dragging = false;\n @State() loading = true;\n @State() template: ITemplate | null = null;\n\n disconnectedCallback() {\n this.unlistenToTemplate();\n this.cleanupSortables();\n }\n\n async listenToTemplate() {\n console.log('[ROLES] Loading template', this.templateId);\n this.unlistenToTemplate();\n Store.subscribe(\n 'templates',\n this.templateId,\n () => getTemplate(this.endpoint, this.templateId),\n false,\n (template: ITemplate) => {\n console.log('[ROLES] Template Updated', template);\n this.template = template;\n this.loading = false;\n },\n );\n }\n\n unlistenToTemplate() {\n if (this.templateListenerId) {\n Store.store.delListener(this.templateListenerId);\n this.templateListenerId = null;\n }\n }\n\n async componentWillLoad() {\n try {\n this.endpoint.loadSession();\n\n if (!this.templateId) {\n console.log(`[ROLES] Missing required template ID ${this.templateId}`);\n return;\n }\n\n if (!this.endpoint.session) {\n console.log('[ROLES] Unable to start builder session, must be authenticated');\n return;\n }\n\n this.listenToTemplate();\n } catch (e) {\n console.log('[ROLES] Error with preview session', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n }\n\n sortableRefs: Sortable[] = [];\n\n cleanupSortables() {\n this.sortableRefs.forEach(sr => sr.destroy());\n this.sortableRefs.length = 0;\n }\n\n componentDidRender() {\n this.cleanupSortables();\n\n // Existing sequence numbers\n const sequenceNumbers = this.getSequenceNumbers();\n (sequenceNumbers || []).forEach(sequence => {\n const el = document.getElementById(`verdocs-roles-sequence-${sequence}`);\n if (el) {\n const sortable = new Sortable(el, {\n group: 'roles',\n animation: 150,\n dragoverBubble: true,\n filter: '.no-drag',\n onEnd: this.handleMoveEnd.bind(this),\n onChoose: () => (this.dragging = true),\n onUnchoose: () => (this.dragging = false),\n });\n this.sortableRefs.push(sortable);\n }\n });\n\n const el = document.getElementById(`verdocs-roles-sequence-add-target`);\n if (el) {\n console.log('[ROLES] Applying sortable to add-sequence slot');\n const sortable = new Sortable(el, {\n group: 'roles',\n animation: 150,\n dragoverBubble: true,\n filter: '.no-drag',\n onEnd: this.handleMoveEnd.bind(this),\n onChoose: () => (this.dragging = true),\n onUnchoose: () => (this.dragging = false),\n });\n this.sortableRefs.push(sortable);\n }\n }\n\n handleMoveEnd(evt) {\n const fromSeq = +evt.from.dataset.sequence;\n const toSeq = +evt.to.dataset.sequence;\n const fromIndex = +evt.oldIndex + 1;\n const toIndex = +evt.newIndex + 1;\n\n console.log(`Move from ${fromSeq}:${fromIndex} to ${toSeq}:${toIndex}`, evt.item);\n\n const sortableRoles: Record<string, IRole[]> = {};\n const sequenceNumbers = this.getSequenceNumbers();\n sequenceNumbers.forEach(sequence => {\n const ras = this.getRolesAtSequence(sequence);\n\n sortableRoles[String(sequence)] = JSON.parse(JSON.stringify(ras));\n });\n\n // We might be adding a new sequence number now. Make sure we have an array to drop\n // the record into.\n sortableRoles[sequenceNumbers[sequenceNumbers.length - 1] + 1] = [];\n\n const role = sortableRoles[fromSeq].splice(fromIndex - 1, 1)[0];\n sortableRoles[toSeq] ||= [];\n sortableRoles[toSeq].splice(toIndex - 1, 0, role);\n\n const renumberRequests = [];\n Object.entries(sortableRoles).forEach(([targetSeq, roles]) => {\n roles.forEach((role, index) => {\n if (!role) {\n return;\n }\n\n const targetOrder = +index + 1;\n if (role.sequence !== +targetSeq || role.order !== targetOrder) {\n role.sequence = +targetSeq;\n role.order = targetOrder;\n renumberRequests.push(\n updateTemplateRole(this.endpoint, this.templateId, role.name, {sequence: +targetSeq, order: targetOrder})\n .then(r => console.log('[ROLES] Updated role', role.name, r))\n .catch(e => console.log('[ROLES] Error updating role', e)),\n );\n }\n });\n });\n\n return Promise.all(renumberRequests)\n .then(async () => console.log('[ROLES] Done renumbering'))\n .catch(e => console.log('[ROLES] Error updating roles', e));\n }\n\n handleCancel() {\n this.exit?.emit();\n }\n\n handleSubmit() {\n this.next?.emit();\n }\n\n getSortedRoles() {\n // NOTE: This mutates the source array but that's OK because everything that touches\n // it will want the same thing done.\n return (this.template?.roles || []).sort((a, b) => {\n return a.sequence === b.sequence ? a.order - b.order : a.sequence - b.sequence;\n });\n }\n\n getSequenceNumbers() {\n const sequenceNumbers = (this.template?.roles || []).map(role => role.sequence);\n const deduped = [...new Set(sequenceNumbers)];\n deduped.sort((a, b) => a - b);\n return deduped;\n }\n\n getRoleNames() {\n const roles = this.getSortedRoles();\n return roles.map(role => role.name);\n }\n\n getRolesAtSequence(sequence: number) {\n // Entries can be undefined when deleted because Stencil has no remove() operator yet for stores.\n // See https://github.com/ionic-team/stencil-store/issues/23\n return (this.template?.roles || []).filter(role => role && role.sequence === sequence);\n }\n\n // When the user drags a role around, we handle placement \"between\" items by assigning it a half-order number\n // e.g. 1.5 to place it between items 1 and 2, 0.5 to place it at the beginning, or last+0.5 to place it at the end.\n // Then we re-sort the list of roles and renumber them.\n async renumberTemplateRoles() {\n const sortableRoles: Record<string, IRole[]> = {};\n const renumberRequests = [];\n const sequenceNumbers = this.getSequenceNumbers();\n\n (sequenceNumbers || []).forEach(targetSeq => {\n (sortableRoles[targetSeq] || []).forEach((role, targetOrderMinusOne) => {\n const targetOrder = +targetOrderMinusOne + 1;\n if (role.sequence !== +targetSeq || role.order !== targetOrder) {\n console.log('[ROLES] Updating role', role.name, 'from', role.sequence, role.order, 'to', targetSeq, targetOrder);\n role.sequence = +targetSeq;\n role.order = targetOrder;\n renumberRequests.push(\n updateTemplateRole(this.endpoint, this.templateId, role.name, {sequence: +targetSeq, order: targetOrder})\n .then(r => console.log('[ROLES] Updated role', role.name, r))\n .catch(e => console.log('[ROLES] Error updating role', e)),\n );\n }\n });\n });\n\n console.log(`[ROLES] Awaiting ${renumberRequests.length} renumber requests`);\n await Promise.all(renumberRequests).then(async () => {\n // When renumbering, we don't try to update the store for every individual item\n // changing. We just do it once at the end.\n const newTemplate = JSON.parse(JSON.stringify(this.template));\n newTemplate.roles = Object.keys(sortableRoles).reduce((acc, seq) => acc.concat(sortableRoles[seq]), []);\n console.log(\n '[ROLES] Done renumbering',\n newTemplate.roles.map(r => ({name: r.name, sequence: r.sequence, order: r.order})),\n );\n Store.updateTemplate(this.templateId, newTemplate);\n // TODO: Explore race condition in reordering roles\n // this.template = await Store.getTemplate(this.endpoint, this.templateId, true);\n });\n\n this.rolesUpdated?.emit({event: 'updated', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles()});\n }\n\n // Look for name conflicts, because they're UGC and can be anything, regardless of order.\n getNextRoleName() {\n let name = '';\n let nextNumber = (this.template?.roles || []).length;\n do {\n nextNumber++;\n name = `Recipient ${nextNumber}`;\n } while (!name || (this.template?.roles || []).some(role => role && role.name === name));\n\n return name;\n }\n\n callCreateRole(name: string, sequence: number, order: number) {\n console.log('[ROLES] Will create role', {name, sequence, order});\n createTemplateRole(this.endpoint, this.templateId, {\n template_id: this.templateId,\n name,\n sequence,\n message: '',\n order,\n full_name: null,\n first_name: '',\n last_name: '',\n email: '',\n phone: '',\n type: 'signer',\n delegator: false,\n kba_method: null,\n })\n .then(async role => {\n console.log('[ROLES] Created role', role);\n // const newTemplate = JSON.parse(JSON.stringify(this.template));\n // newTemplate.roles.push(role);\n // TODO: Verify this immediately triggers a self-update\n console.log('Updating template in data store');\n await Store.getTemplate(this.endpoint, this.templateId, true);\n // Store.updateTemplate(this.templateId, newTemplate);\n // This will re-sort the roles and renumbers them via server calls if necessary\n // await this.renumberTemplateRoles();\n this.rolesUpdated?.emit({event: 'added', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles()});\n })\n .catch(e => {\n console.log('[ROLES] Error creating role', e);\n });\n }\n\n handleAddRole(e: any, sequence: number) {\n e.stopPropagation();\n const order = this.getRolesAtSequence(sequence).length + 1;\n const name = this.getNextRoleName();\n this.callCreateRole(name, sequence, order);\n }\n\n handleAddStep(e: any, sequence: number) {\n e.stopPropagation();\n\n const order = 1;\n const name = this.getNextRoleName();\n this.callCreateRole(name, sequence, order);\n }\n\n render() {\n if (!this.endpoint.session) {\n return (\n <Host>\n <verdocs-component-error message=\"You must be authenticated to use this module.\" />\n </Host>\n );\n }\n\n if (this.loading || !this.template) {\n return (\n <Host class=\"loading\">\n <verdocs-loader />\n </Host>\n );\n }\n\n console.log(\n '[ROLES] Rendering',\n this.template.roles.map(r => ({name: r.name, sequence: r.sequence, order: r.order})),\n );\n\n const roleNames = this.getRoleNames();\n const sequences = this.getSequenceNumbers();\n const nextSequence = sequences && sequences.length > 0 ? (sequences[sequences.length - 1] || 0) + 1 : 1;\n\n // style={{backgroundColor: getRGBA(getRoleIndex(this.template, role.name))}}\n return (\n <Host class={{dragging: this.dragging}}>\n <form onSubmit={e => e.preventDefault()} onClick={e => e.stopPropagation()} autocomplete=\"off\">\n <h5>Roles and Workflow</h5>\n\n <div class=\"roles\">\n {sequences.map((sequence, index) => (\n <div class=\"sequence\">\n {console.log('Rendering sequence', sequence, index, this.getRolesAtSequence(sequence))}\n <div class=\"sequence-label no-drag\">{index + 1}.</div>\n\n <div class=\"sequence-roles\" id={`verdocs-roles-sequence-${sequence}`} data-sequence={sequence}>\n {this.getRolesAtSequence(sequence).map(role => {\n const unknown = !role.email || !role.first_name || !role.last_name;\n return unknown ? (\n <div class=\"role\" data-rolename={role.name} data-sequence={sequence} data-order={role.order}>\n <div class=\"role-name\">{role.name}</div>\n <div class=\"icons\">\n <div class=\"gear-button\" innerHTML={settingsIcon} onClick={() => (this.showingRoleDialog = role.name)} aria-role=\"button\" />\n <span class=\"type-icon\" innerHTML={role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover} />\n </div>\n </div>\n ) : (\n <div\n class=\"role\"\n // style={{borderColor: getRGBA(getRoleIndex(this.template, role.name))}}\n data-rolename={role.name}\n data-sequence={sequence}\n data-order={role.order}\n >\n <div class=\"role-name\">{formatFullName(role)}</div>\n <div class=\"icons\">\n <div class=\"gear-button\" innerHTML={settingsIcon} onClick={() => (this.showingRoleDialog = role.name)} aria-role=\"button\" />\n <span class=\"type-icon\" innerHTML={role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover} />\n </div>\n </div>\n );\n })}\n </div>\n\n <button class=\"add-role no-drag\" innerHTML={plusIcon} onClick={e => this.handleAddRole(e, sequence)} />\n </div>\n ))}\n\n <div class=\"sequence add-sequence\">\n <div class=\"sequence-label no-drag\">{sequences.length + 1}.</div>\n\n <div class=\"sequence-roles\" id={`verdocs-roles-sequence-add-target`} data-sequence={nextSequence} />\n\n <button class=\"add-role no-drag\" innerHTML={plusIcon} onClick={e => this.handleAddRole(e, nextSequence)} />\n </div>\n </div>\n\n {roleNames.length < 1 && (\n <div class=\"empty\">\n You must add at least one Role before proceeding.\n <br /> Click the <span innerHTML={plusIcon} /> Add button above to get started.\n </div>\n )}\n\n <div class=\"buttons\">\n <div class=\"flex-fill\" />\n\n <verdocs-button variant=\"outline\" label=\"Cancel\" size=\"small\" onClick={() => this.handleCancel()} />\n <verdocs-button label=\"OK\" size=\"small\" onClick={() => this.handleSubmit()} disabled={roleNames.length < 1} />\n </div>\n </form>\n\n {this.showingRoleDialog && (\n <verdocs-menu-panel onClose={() => (this.showingRoleDialog = null)}>\n <verdocs-template-role-properties\n endpoint={this.endpoint}\n templateId={this.templateId}\n roleName={this.showingRoleDialog}\n onClose={() => {\n document.getElementById('verdocs-menu-panel-overlay')?.remove();\n this.showingRoleDialog = null;\n }}\n onDelete={async () => {\n this.showingRoleDialog = null;\n // This will re-sort the roles and renumbers them via server calls if necessary\n await this.renumberTemplateRoles();\n this.rolesUpdated?.emit({event: 'deleted', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles()});\n }}\n />\n </verdocs-menu-panel>\n )}\n </Host>\n );\n }\n}\n"]}
@@ -1,14 +1,14 @@
1
1
  import { p as proxyCustomElement, H, c as createEvent, h, d as Host } from './p-324ed895.js';
2
2
  import { VerdocsEndpoint, getTemplate, updateTemplateRole, createTemplateRole, formatFullName } from '@verdocs/js-sdk';
3
3
  import { S as SDKError } from './p-fd97809c.js';
4
- import { S as Store } from './p-58d027d1.js';
4
+ import { S as Store } from './p-3828cb31.js';
5
5
  import { d as defineCustomElement$8 } from './p-0e332769.js';
6
6
  import { d as defineCustomElement$7 } from './p-84ae0283.js';
7
7
  import { d as defineCustomElement$6 } from './p-7f32e087.js';
8
8
  import { d as defineCustomElement$5 } from './p-1ae5d7e0.js';
9
9
  import { d as defineCustomElement$4 } from './p-be261487.js';
10
10
  import { d as defineCustomElement$3 } from './p-62743fd3.js';
11
- import { d as defineCustomElement$2 } from './p-314d698d.js';
11
+ import { d as defineCustomElement$2 } from './p-53168eec.js';
12
12
  import { d as defineCustomElement$1 } from './p-325b3828.js';
13
13
 
14
14
  /**!
@@ -2676,7 +2676,7 @@ _extends(Remove, {
2676
2676
  Sortable.mount(new AutoScrollPlugin());
2677
2677
  Sortable.mount(Remove, Revert);
2678
2678
 
2679
- const verdocsTemplateRolesCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-roles{display:block;max-width:600px;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-template-roles .roles{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:10px;margin-top:10px}verdocs-template-roles .roles .sequence{gap:10px;height:34px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;font-weight:500;padding:0 0 8px 0;-ms-flex-direction:row;flex-direction:row;border-bottom:1px dotted #e3e3e3}verdocs-template-roles .roles .sequence.add-sequence{color:#777777;line-height:34px}verdocs-template-roles .roles .sequence-label{font-size:18px;line-height:32px}verdocs-template-roles .roles .sequence-roles{gap:10px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-wrap:wrap;flex-wrap:wrap;font-weight:500;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .roles .role{height:32px;cursor:move;display:-ms-flexbox;display:flex;max-width:200px;position:relative;border-radius:32px;background-color:#eff7fb;-webkit-box-sizing:border-box;box-sizing:border-box;padding:0 14px 0 34px;border:1px solid #ccc;-ms-flex-direction:column;flex-direction:column}verdocs-template-roles .roles .role .role-name{font-size:14px;overflow:hidden;font-weight:400;line-height:30px;white-space:nowrap;text-overflow:ellipsis}verdocs-template-roles .roles .role .icons{position:absolute;left:1px;top:-3px;cursor:pointer;padding:5px;z-index:10}verdocs-template-roles .roles .role .icons .gear-button{display:none;-webkit-transform:scale(1.1);transform:scale(1.1);margin:4px 0 0 1px}verdocs-template-roles .roles .role .icons .type-icon{opacity:0.6;display:block;-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-roles .roles .role .icons:hover .gear-button{display:block}verdocs-template-roles .roles .role .icons:hover .type-icon{display:none}verdocs-template-roles>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-roles>form h5{font-size:16px;font-weight:bold;color:#46497d;margin:0 0 10px 0}verdocs-template-roles>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-roles>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-roles>form input:focus{outline:none}verdocs-template-roles .row.add-sequence{display:none}verdocs-template-roles .add-role{margin:0;padding:0;border:none;opacity:0.3;cursor:pointer;background:none;-webkit-transform:scale(0.75);transform:scale(0.75)}verdocs-template-roles .add-role:hover{opacity:1}verdocs-template-roles .add-role svg{width:32px;height:32px}verdocs-template-roles .add-step{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-step:hover{opacity:1}verdocs-template-roles .add-step svg{width:32px;height:32px}verdocs-template-roles.dragging .row.add-sequence{display:-ms-flexbox;display:flex}verdocs-template-roles .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .empty{font-size:13px;margin-top:15px;margin-bottom:5px}verdocs-template-roles .empty svg{width:16px;height:16px;stroke:#666666;margin-bottom:2px;display:inline-block}verdocs-template-roles .sequence-roles{display:-ms-flexbox;display:flex}verdocs-template-roles ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-moz-placeholder{color:#aaaaaa}verdocs-template-roles :-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::placeholder{color:#aaaaaa}";
2679
+ const verdocsTemplateRolesCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-roles{display:block;max-width:600px;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-template-roles .roles{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:10px;margin-top:10px}verdocs-template-roles .roles .sequence{gap:10px;height:34px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;font-weight:500;padding:0 0 8px 0;-ms-flex-direction:row;flex-direction:row;border-bottom:1px dotted #e3e3e3}verdocs-template-roles .roles .sequence.add-sequence{color:#777777;line-height:34px}verdocs-template-roles .roles .sequence-label{font-size:18px;line-height:32px}verdocs-template-roles .roles .sequence-roles{gap:10px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-wrap:wrap;flex-wrap:wrap;font-weight:500;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .roles .role{height:32px;cursor:move;display:-ms-flexbox;display:flex;max-width:200px;position:relative;border-radius:32px;background-color:#eff7fb;-webkit-box-sizing:border-box;box-sizing:border-box;padding:0 14px 0 34px;border:1px solid #ccc;-ms-flex-direction:column;flex-direction:column}verdocs-template-roles .roles .role .role-name{font-size:14px;overflow:hidden;font-weight:400;line-height:30px;white-space:nowrap;text-overflow:ellipsis}verdocs-template-roles .roles .role .icons{position:absolute;left:1px;top:-3px;cursor:pointer;padding:5px;z-index:10}verdocs-template-roles .roles .role .icons .gear-button{display:none;-webkit-transform:scale(1.1);transform:scale(1.1);margin:4px 0 0 1px}verdocs-template-roles .roles .role .icons .type-icon{opacity:0.6;display:block;-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-roles .roles .role .icons:hover .gear-button{display:block}verdocs-template-roles .roles .role .icons:hover .type-icon{display:none}verdocs-template-roles>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-roles>form h5{font-size:16px;font-weight:bold;color:#46497d;margin:0 0 10px 0}verdocs-template-roles>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-roles>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-roles>form input:focus{outline:none}verdocs-template-roles .row.add-sequence{display:none}verdocs-template-roles .add-role{margin:0 0 0 -8px;padding:0;border:none;opacity:0.3;cursor:pointer;background:none;-webkit-transform:scale(0.75);transform:scale(0.75)}verdocs-template-roles .add-role:hover{opacity:1}verdocs-template-roles .add-role svg{width:32px;height:32px}verdocs-template-roles .add-step{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-step:hover{opacity:1}verdocs-template-roles .add-step svg{width:32px;height:32px}verdocs-template-roles.dragging .row.add-sequence{display:-ms-flexbox;display:flex}verdocs-template-roles .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .empty{font-size:13px;margin-top:15px;margin-bottom:5px}verdocs-template-roles .empty svg{width:16px;height:16px;stroke:#666666;margin-bottom:2px;display:inline-block}verdocs-template-roles .sequence-roles{display:-ms-flexbox;display:flex}verdocs-template-roles ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-moz-placeholder{color:#aaaaaa}verdocs-template-roles :-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::placeholder{color:#aaaaaa}";
2680
2680
  const VerdocsTemplateRolesStyle0 = verdocsTemplateRolesCss;
2681
2681
 
2682
2682
  const settingsIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" fill="#00000089"><path d="m8.021 17.917-.313-2.5q-.27-.125-.625-.334-.354-.208-.625-.395l-2.312.979-1.979-3.438 1.979-1.5q-.021-.167-.031-.364-.011-.198-.011-.365 0-.146.011-.344.01-.198.031-.385l-1.979-1.5 1.979-3.417 2.312.958q.271-.187.615-.385t.635-.344l.313-2.5h3.958l.313 2.5q.312.167.625.344.312.177.604.385l2.333-.958 1.979 3.417-1.979 1.521q.021.187.021.364V10q0 .146-.01.333-.011.188-.011.396l1.958 1.5-1.979 3.438-2.312-.979q-.292.208-.615.395-.323.188-.614.334l-.313 2.5Zm1.937-5.355q1.063 0 1.813-.75t.75-1.812q0-1.062-.75-1.812t-1.813-.75q-1.041 0-1.802.75-.76.75-.76 1.812t.76 1.812q.761.75 1.802.75Zm0-1.333q-.5 0-.864-.364-.365-.365-.365-.865t.365-.865q.364-.364.864-.364t.865.364q.365.365.365.865t-.365.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.187q.605-.167 1.136-.49.531-.323 1.031-.802l2.021.875.854-1.375-1.792-1.354q.105-.333.136-.635.031-.303.031-.615 0-.292-.031-.573-.031-.281-.115-.635l1.792-1.396-.834-1.375-2.062.875q-.438-.438-1.021-.781-.583-.344-1.125-.49l-.271-2.208H9.167l-.271 2.208q-.584.146-1.125.458-.542.313-1.042.792l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.479.458 1.021.771.542.312 1.146.479Z"/></svg>';
@@ -2693,6 +2693,7 @@ const VerdocsTemplateRoles = /*@__PURE__*/ proxyCustomElement(class VerdocsTempl
2693
2693
  this.sdkError = createEvent(this, "sdkError", 7);
2694
2694
  this.rolesUpdated = createEvent(this, "rolesUpdated", 7);
2695
2695
  this.templateListenerId = null;
2696
+ this.sortableRefs = [];
2696
2697
  this.endpoint = VerdocsEndpoint.getDefault();
2697
2698
  this.templateId = '';
2698
2699
  this.showingRoleDialog = null;
@@ -2703,6 +2704,7 @@ const VerdocsTemplateRoles = /*@__PURE__*/ proxyCustomElement(class VerdocsTempl
2703
2704
  }
2704
2705
  disconnectedCallback() {
2705
2706
  this.unlistenToTemplate();
2707
+ this.cleanupSortables();
2706
2708
  }
2707
2709
  async listenToTemplate() {
2708
2710
  console.log('[ROLES] Loading template', this.templateId);
@@ -2722,7 +2724,6 @@ const VerdocsTemplateRoles = /*@__PURE__*/ proxyCustomElement(class VerdocsTempl
2722
2724
  async componentWillLoad() {
2723
2725
  var _a, _b, _c;
2724
2726
  try {
2725
- VerdocsEndpoint.getDefault().setBaseURL('https://api.verdocs.com');
2726
2727
  this.endpoint.loadSession();
2727
2728
  if (!this.templateId) {
2728
2729
  console.log(`[ROLES] Missing required template ID ${this.templateId}`);
@@ -2739,13 +2740,18 @@ const VerdocsTemplateRoles = /*@__PURE__*/ proxyCustomElement(class VerdocsTempl
2739
2740
  (_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));
2740
2741
  }
2741
2742
  }
2743
+ cleanupSortables() {
2744
+ this.sortableRefs.forEach(sr => sr.destroy());
2745
+ this.sortableRefs.length = 0;
2746
+ }
2742
2747
  componentDidRender() {
2748
+ this.cleanupSortables();
2743
2749
  // Existing sequence numbers
2744
2750
  const sequenceNumbers = this.getSequenceNumbers();
2745
2751
  (sequenceNumbers || []).forEach(sequence => {
2746
2752
  const el = document.getElementById(`verdocs-roles-sequence-${sequence}`);
2747
2753
  if (el) {
2748
- new Sortable(el, {
2754
+ const sortable = new Sortable(el, {
2749
2755
  group: 'roles',
2750
2756
  animation: 150,
2751
2757
  dragoverBubble: true,
@@ -2754,11 +2760,13 @@ const VerdocsTemplateRoles = /*@__PURE__*/ proxyCustomElement(class VerdocsTempl
2754
2760
  onChoose: () => (this.dragging = true),
2755
2761
  onUnchoose: () => (this.dragging = false),
2756
2762
  });
2763
+ this.sortableRefs.push(sortable);
2757
2764
  }
2758
2765
  });
2759
2766
  const el = document.getElementById(`verdocs-roles-sequence-add-target`);
2760
2767
  if (el) {
2761
- new Sortable(el, {
2768
+ console.log('[ROLES] Applying sortable to add-sequence slot');
2769
+ const sortable = new Sortable(el, {
2762
2770
  group: 'roles',
2763
2771
  animation: 150,
2764
2772
  dragoverBubble: true,
@@ -2767,6 +2775,7 @@ const VerdocsTemplateRoles = /*@__PURE__*/ proxyCustomElement(class VerdocsTempl
2767
2775
  onChoose: () => (this.dragging = true),
2768
2776
  onUnchoose: () => (this.dragging = false),
2769
2777
  });
2778
+ this.sortableRefs.push(sortable);
2770
2779
  }
2771
2780
  }
2772
2781
  handleMoveEnd(evt) {
@@ -2803,15 +2812,9 @@ const VerdocsTemplateRoles = /*@__PURE__*/ proxyCustomElement(class VerdocsTempl
2803
2812
  }
2804
2813
  });
2805
2814
  });
2806
- // When renumbering, we don't try to update the store for every individual item
2807
- // changing. We just do it once at the end.
2808
- console.log(`[ROLES] Awaiting ${renumberRequests.length} renumber requests`, renumberRequests);
2809
- return Promise.all(renumberRequests).then(async () => {
2810
- const newTemplate = JSON.parse(JSON.stringify(this.template));
2811
- newTemplate.roles = Object.keys(sortableRoles).reduce((acc, seq) => acc.concat(sortableRoles[seq]), []);
2812
- await Store.getTemplate(this.endpoint, this.templateId, true);
2813
- // Store.updateTemplate(this.templateId, newTemplate);
2814
- });
2815
+ return Promise.all(renumberRequests)
2816
+ .then(async () => console.log('[ROLES] Done renumbering'))
2817
+ .catch(e => console.log('[ROLES] Error updating roles', e));
2815
2818
  }
2816
2819
  handleCancel() {
2817
2820
  var _a;
@@ -2949,7 +2952,7 @@ const VerdocsTemplateRoles = /*@__PURE__*/ proxyCustomElement(class VerdocsTempl
2949
2952
  const sequences = this.getSequenceNumbers();
2950
2953
  const nextSequence = sequences && sequences.length > 0 ? (sequences[sequences.length - 1] || 0) + 1 : 1;
2951
2954
  // style={{backgroundColor: getRGBA(getRoleIndex(this.template, role.name))}}
2952
- return (h(Host, { class: { dragging: this.dragging } }, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("h5", null, "Roles and Workflow"), h("div", { class: "roles" }, sequences.map((sequence, index) => (h("div", { class: "sequence" }, h("div", { class: "sequence-label no-drag" }, index + 1, "."), h("div", { class: "sequence-roles", id: `verdocs-roles-sequence-${sequence}`, "data-sequence": sequence }, this.getRolesAtSequence(sequence).map(role => {
2955
+ return (h(Host, { class: { dragging: this.dragging } }, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("h5", null, "Roles and Workflow"), h("div", { class: "roles" }, sequences.map((sequence, index) => (h("div", { class: "sequence" }, console.log('Rendering sequence', sequence, index, this.getRolesAtSequence(sequence)), h("div", { class: "sequence-label no-drag" }, index + 1, "."), h("div", { class: "sequence-roles", id: `verdocs-roles-sequence-${sequence}`, "data-sequence": sequence }, this.getRolesAtSequence(sequence).map(role => {
2953
2956
  const unknown = !role.email || !role.first_name || !role.last_name;
2954
2957
  return unknown ? (h("div", { class: "role", "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, h("div", { class: "role-name" }, role.name), h("div", { class: "icons" }, h("div", { class: "gear-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" }), h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover })))) : (h("div", { class: "role", "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, h("div", { class: "role-name" }, formatFullName(role)), h("div", { class: "icons" }, h("div", { class: "gear-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" }), h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }))));
2955
2958
  })), h("button", { class: "add-role no-drag", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, sequence) })))), h("div", { class: "sequence add-sequence" }, h("div", { class: "sequence-label no-drag" }, sequences.length + 1, "."), h("div", { class: "sequence-roles", id: `verdocs-roles-sequence-add-target`, "data-sequence": nextSequence }), h("button", { class: "add-role no-drag", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, nextSequence) }))), roleNames.length < 1 && (h("div", { class: "empty" }, "You must add at least one Role before proceeding.", h("br", null), " Click the ", h("span", { innerHTML: plusIcon }), " Add button above to get started.")), h("div", { class: "buttons" }, h("div", { class: "flex-fill" }), h("verdocs-button", { variant: "outline", label: "Cancel", size: "small", onClick: () => this.handleCancel() }), h("verdocs-button", { label: "OK", size: "small", onClick: () => this.handleSubmit(), disabled: roleNames.length < 1 }))), this.showingRoleDialog && (h("verdocs-menu-panel", { onClose: () => (this.showingRoleDialog = null) }, h("verdocs-template-role-properties", { endpoint: this.endpoint, templateId: this.templateId, roleName: this.showingRoleDialog, onClose: () => {
@@ -3031,4 +3034,4 @@ function defineCustomElement() {
3031
3034
 
3032
3035
  export { VerdocsTemplateRoles as V, defineCustomElement as d };
3033
3036
 
3034
- //# sourceMappingURL=p-78043e4b.js.map
3037
+ //# sourceMappingURL=p-02ebfef0.js.map